diff --git a/lib/pddlparse/include/pddlparse/detail/parsing/Utils.h b/lib/pddlparse/include/pddlparse/detail/parsing/Utils.h new file mode 100644 index 0000000..3e36da7 --- /dev/null +++ b/lib/pddlparse/include/pddlparse/detail/parsing/Utils.h @@ -0,0 +1,43 @@ +#ifndef __PDDL_PARSE__DETAIL__PARSE_UTILS_H +#define __PDDL_PARSE__DETAIL__PARSE_UTILS_H + +#include + +namespace pddl +{ +namespace detail +{ + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ParseUtils +// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +inline void skipSection(Tokenizer &tokenizer) +{ + size_t openParentheses = 1; + + while (true) + { + const auto character = tokenizer.currentCharacter(); + tokenizer.advance(); + + if (character == '(') + openParentheses++; + else if (character == ')') + { + openParentheses--; + + if (openParentheses == 0) + return; + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +} +} + +#endif diff --git a/lib/pddlparse/src/CMakeLists.txt b/lib/pddlparse/src/CMakeLists.txt index acb0e82..372b4b4 100644 --- a/lib/pddlparse/src/CMakeLists.txt +++ b/lib/pddlparse/src/CMakeLists.txt @@ -6,6 +6,9 @@ file(GLOB core_headers "../include/pddlparse/*.h") file(GLOB detail_sources "pddlparse/detail/*.cpp") file(GLOB detail_headers "../include/pddlparse/detail/*.h") +file(GLOB detail_parsing_sources "pddlparse/detail/parsing/*.cpp") +file(GLOB detail_parsing_headers "../include/pddlparse/detail/parsing/*.h") + set(includes ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/../../lib/tokenize/include @@ -17,6 +20,9 @@ set(sources ${detail_sources} ${detail_headers} + + ${detail_parsing_sources} + ${detail_parsing_headers} ) set(libraries