Added parsing utils to skip PDDL sections.
This commit is contained in:
parent
5f240b632a
commit
29f8ee0778
43
lib/pddlparse/include/pddlparse/detail/parsing/Utils.h
Normal file
43
lib/pddlparse/include/pddlparse/detail/parsing/Utils.h
Normal 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
|
@ -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
|
||||||
|
Reference in New Issue
Block a user