Added parsing utils to skip PDDL sections.

This commit is contained in:
Patrick Lühne 2017-05-17 15:28:58 +02:00
parent 5f240b632a
commit 29f8ee0778
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,43 @@
#ifndef __PDDL_PARSE__DETAIL__PARSE_UTILS_H
#define __PDDL_PARSE__DETAIL__PARSE_UTILS_H
#include <pddlparse/Tokenizer.h>
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

View File

@ -6,6 +6,9 @@ file(GLOB core_headers "../include/pddlparse/*.h")
file(GLOB detail_sources "pddlparse/detail/*.cpp") file(GLOB detail_sources "pddlparse/detail/*.cpp")
file(GLOB detail_headers "../include/pddlparse/detail/*.h") 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 set(includes
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/../../lib/tokenize/include ${PROJECT_SOURCE_DIR}/../../lib/tokenize/include
@ -17,6 +20,9 @@ set(sources
${detail_sources} ${detail_sources}
${detail_headers} ${detail_headers}
${detail_parsing_sources}
${detail_parsing_headers}
) )
set(libraries set(libraries