From ee9626e4d2b75492d4b1fbf088f02d12480508d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 8 Jun 2016 00:14:43 +0200 Subject: [PATCH] Made the section skipping function a proper function. --- include/plasp/pddl/IO.h | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/include/plasp/pddl/IO.h b/include/plasp/pddl/IO.h index 6f40781..be392eb 100644 --- a/include/plasp/pddl/IO.h +++ b/include/plasp/pddl/IO.h @@ -16,27 +16,26 @@ namespace pddl // //////////////////////////////////////////////////////////////////////////////////////////////////// -const auto skipSection = - [](utils::Parser &parser) +inline void skipSection(utils::Parser &parser) +{ + size_t openParentheses = 1; + + while (true) { - size_t openParentheses = 1; + const auto character = parser.currentCharacter(); + parser.advance(); - while (true) + if (character == '(') + openParentheses++; + else if (character == ')') { - const auto character = parser.currentCharacter(); - parser.advance(); + openParentheses--; - if (character == '(') - openParentheses++; - else if (character == ')') - { - openParentheses--; - - if (openParentheses == 0) - return; - } + if (openParentheses == 0) + return; } - }; + } +} ////////////////////////////////////////////////////////////////////////////////////////////////////