Implemented recognition of comments in PDDL.
This commit is contained in:
@@ -15,12 +15,8 @@ namespace plasp
|
||||
|
||||
Language::Type detectLanguage(utils::Parser &parser)
|
||||
{
|
||||
// PDDL contains sections starting with "(define"
|
||||
if (parser.probe<std::string>("(") && parser.probe<std::string>("define"))
|
||||
{
|
||||
parser.seek(std::ios::beg);
|
||||
return Language::Type::PDDL;
|
||||
}
|
||||
parser.setCaseSensitive(false);
|
||||
parser.skipWhiteSpace();
|
||||
|
||||
// SAS begins with "begin_version"
|
||||
if (parser.probe<std::string>("begin"))
|
||||
@@ -29,6 +25,20 @@ Language::Type detectLanguage(utils::Parser &parser)
|
||||
return Language::Type::SAS;
|
||||
}
|
||||
|
||||
// Skip potential PDDL comments
|
||||
while (parser.currentCharacter() == ';')
|
||||
{
|
||||
parser.skipLine();
|
||||
parser.skipWhiteSpace();
|
||||
}
|
||||
|
||||
// PDDL contains sections starting with "(define"
|
||||
if (parser.probe<std::string>("(") && parser.probe<std::string>("define"))
|
||||
{
|
||||
parser.seek(std::ios::beg);
|
||||
return Language::Type::PDDL;
|
||||
}
|
||||
|
||||
parser.seek(std::ios::beg);
|
||||
return Language::Type::Unknown;
|
||||
}
|
||||
|
@@ -62,6 +62,8 @@ class Parser
|
||||
void advance();
|
||||
bool atEndOfStream() const;
|
||||
|
||||
void removeComments(const std::string &startSequence, const std::string &endSequence, bool removeEnd);
|
||||
|
||||
template<typename Type>
|
||||
Type parse();
|
||||
|
||||
|
Reference in New Issue
Block a user