Added parsing utils to skip PDDL sections.

This commit is contained in:
2017-05-17 15:28:58 +02:00
parent 5f240b632a
commit 29f8ee0778
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