This repository has been archived on 2023-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
plasp/lib/pddlparse/include/pddlparse/Tokenizer.h

53 lines
1.0 KiB
C
Raw Normal View History

2017-05-12 14:17:57 +02:00
#ifndef __PDDL_PARSE__TOKENIZER_H
#define __PDDL_PARSE__TOKENIZER_H
#include <iostream>
2017-05-12 14:17:57 +02:00
#include <tokenize/Tokenizer.h>
namespace pddl
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
2017-05-12 14:17:57 +02:00
// Tokenizer
//
////////////////////////////////////////////////////////////////////////////////////////////////////
2017-05-12 14:17:57 +02:00
struct PDDLTokenizerPolicy
{
static char transformCharacter(char c) noexcept
{
return std::tolower(c);
}
static bool isWhiteSpaceCharacter(char c)
{
return std::iswspace(c);
}
static bool isBlankCharacter(char c)
{
return std::isblank(c);
}
static bool isIdentifierCharacter(char c)
{
return c != '?'
&& c != '('
&& c != ')'
&& c != ';'
&& std::isgraph(c);
}
};
////////////////////////////////////////////////////////////////////////////////////////////////////
2017-05-12 14:17:57 +02:00
using Tokenizer = tokenize::Tokenizer<PDDLTokenizerPolicy>;
////////////////////////////////////////////////////////////////////////////////////////////////////
}
#endif