Corrected exception types.
This commit is contained in:
parent
d376c1a993
commit
20c687a787
@ -1,6 +1,7 @@
|
|||||||
#include <pddlparse/detail/parsing/Action.h>
|
#include <pddlparse/detail/parsing/Action.h>
|
||||||
|
|
||||||
#include <pddlparse/AST.h>
|
#include <pddlparse/AST.h>
|
||||||
|
#include <pddlparse/ParserException.h>
|
||||||
#include <pddlparse/detail/ASTContext.h>
|
#include <pddlparse/detail/ASTContext.h>
|
||||||
#include <pddlparse/detail/VariableStack.h>
|
#include <pddlparse/detail/VariableStack.h>
|
||||||
#include <pddlparse/detail/parsing/Effect.h>
|
#include <pddlparse/detail/parsing/Effect.h>
|
||||||
@ -86,7 +87,7 @@ void ActionParser::findSections(ast::Action &action)
|
|||||||
if (unique && sectionPosition != -1)
|
if (unique && sectionPosition != -1)
|
||||||
{
|
{
|
||||||
tokenizer.seek(value);
|
tokenizer.seek(value);
|
||||||
throw tokenize::TokenizerException(tokenizer.location(), "only one “:" + sectionName + "” section allowed");
|
throw ParserException(tokenizer.location(), "only one “:" + sectionName + "” section allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
sectionPosition = value;
|
sectionPosition = value;
|
||||||
@ -113,7 +114,7 @@ void ActionParser::findSections(ast::Action &action)
|
|||||||
const auto sectionIdentifier = tokenizer.getIdentifier();
|
const auto sectionIdentifier = tokenizer.getIdentifier();
|
||||||
|
|
||||||
tokenizer.seek(position);
|
tokenizer.seek(position);
|
||||||
throw tokenize::TokenizerException(tokenizer.location(), "unknown action section “" + sectionIdentifier + "”");
|
throw ParserException(tokenizer.location(), "unknown action section “" + sectionIdentifier + "”");
|
||||||
}
|
}
|
||||||
|
|
||||||
tokenizer.expect<std::string>("(");
|
tokenizer.expect<std::string>("(");
|
||||||
|
@ -96,7 +96,7 @@ void DomainParser::findSections(ast::Domain &domain)
|
|||||||
if (unique && sectionPosition != -1)
|
if (unique && sectionPosition != -1)
|
||||||
{
|
{
|
||||||
tokenizer.seek(value);
|
tokenizer.seek(value);
|
||||||
throw tokenize::TokenizerException(tokenizer.location(), "only one “:" + sectionName + "” section allowed");
|
throw ParserException(tokenizer.location(), "only one “:" + sectionName + "” section allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
sectionPosition = value;
|
sectionPosition = value;
|
||||||
@ -146,7 +146,7 @@ void DomainParser::findSections(ast::Domain &domain)
|
|||||||
const auto sectionIdentifier = tokenizer.getIdentifier();
|
const auto sectionIdentifier = tokenizer.getIdentifier();
|
||||||
|
|
||||||
tokenizer.seek(position);
|
tokenizer.seek(position);
|
||||||
throw tokenize::TokenizerException(tokenizer.location(), "unknown domain section “" + sectionIdentifier + "”");
|
throw ParserException(tokenizer.location(), "unknown domain section “" + sectionIdentifier + "”");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip section for now and parse it later
|
// Skip section for now and parse it later
|
||||||
|
@ -83,7 +83,7 @@ std::experimental::optional<ast::Effect> parseEffectBody(Context &context, ASTCo
|
|||||||
const auto expressionIdentifier = tokenizer.getIdentifier();
|
const auto expressionIdentifier = tokenizer.getIdentifier();
|
||||||
|
|
||||||
tokenizer.seek(position);
|
tokenizer.seek(position);
|
||||||
throw tokenize::TokenizerException(tokenizer.location(), "expression type “" + expressionIdentifier + "” unknown or not allowed in effect body");
|
throw ParserException(tokenizer.location(), "expression type “" + expressionIdentifier + "” unknown or not allowed in effect body");
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -144,7 +144,7 @@ std::experimental::optional<ast::ConditionalEffect> parseConditionalEffectBody(C
|
|||||||
const auto expressionIdentifier = tokenizer.getIdentifier();
|
const auto expressionIdentifier = tokenizer.getIdentifier();
|
||||||
|
|
||||||
tokenizer.seek(position);
|
tokenizer.seek(position);
|
||||||
throw tokenize::TokenizerException(tokenizer.location(), "expression type “" + expressionIdentifier + "” unknown or not allowed in conditional effect body");
|
throw ParserException(tokenizer.location(), "expression type “" + expressionIdentifier + "” unknown or not allowed in conditional effect body");
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#include <pddlparse/detail/parsing/InitialState.h>
|
#include <pddlparse/detail/parsing/InitialState.h>
|
||||||
|
|
||||||
#include <pddlparse/AST.h>
|
#include <pddlparse/AST.h>
|
||||||
// TODO: remove
|
#include <pddlparse/ParserException.h>
|
||||||
#include <pddlparse/detail/parsing/Utils.h>
|
|
||||||
|
|
||||||
namespace pddl
|
namespace pddl
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,7 @@ std::experimental::optional<ast::Precondition> parsePreconditionBody(Context &co
|
|||||||
const auto expressionIdentifier = tokenizer.getIdentifier();
|
const auto expressionIdentifier = tokenizer.getIdentifier();
|
||||||
|
|
||||||
tokenizer.seek(position);
|
tokenizer.seek(position);
|
||||||
throw tokenize::TokenizerException(tokenizer.location(), "expression type “" + expressionIdentifier + "” unknown or not allowed in precondition body");
|
throw ParserException(tokenizer.location(), "expression type “" + expressionIdentifier + "” unknown or not allowed in precondition body");
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -24,7 +24,7 @@ ast::PrimitiveTypePointer parsePrimitiveType(Context &context, ast::Domain &doma
|
|||||||
auto typeName = tokenizer.getIdentifier();
|
auto typeName = tokenizer.getIdentifier();
|
||||||
|
|
||||||
if (typeName.empty())
|
if (typeName.empty())
|
||||||
throw tokenize::TokenizerException(tokenizer.location(), "could not parse primitive type, expected identifier");
|
throw ParserException(tokenizer.location(), "could not parse primitive type, expected identifier");
|
||||||
|
|
||||||
auto matchingType = std::find_if(types.begin(), types.end(),
|
auto matchingType = std::find_if(types.begin(), types.end(),
|
||||||
[&](auto &primitiveTypeDeclaration)
|
[&](auto &primitiveTypeDeclaration)
|
||||||
|
@ -93,7 +93,7 @@ void ProblemParser::findSections(ast::Problem &problem)
|
|||||||
if (unique && sectionPosition != -1)
|
if (unique && sectionPosition != -1)
|
||||||
{
|
{
|
||||||
tokenizer.seek(value);
|
tokenizer.seek(value);
|
||||||
throw tokenize::TokenizerException(tokenizer.location(), "only one “:" + sectionName + "” section allowed");
|
throw ParserException(tokenizer.location(), "only one “:" + sectionName + "” section allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
sectionPosition = value;
|
sectionPosition = value;
|
||||||
@ -137,7 +137,7 @@ void ProblemParser::findSections(ast::Problem &problem)
|
|||||||
const auto sectionIdentifier = tokenizer.getIdentifier();
|
const auto sectionIdentifier = tokenizer.getIdentifier();
|
||||||
|
|
||||||
tokenizer.seek(position);
|
tokenizer.seek(position);
|
||||||
throw tokenize::TokenizerException(tokenizer.location(), "unknown problem section “" + sectionIdentifier + "”");
|
throw ParserException(tokenizer.location(), "unknown problem section “" + sectionIdentifier + "”");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip section for now and parse it later
|
// Skip section for now and parse it later
|
||||||
@ -164,7 +164,7 @@ void ProblemParser::parseDomainSection(ast::Problem &problem)
|
|||||||
const auto domainName = tokenizer.getIdentifier();
|
const auto domainName = tokenizer.getIdentifier();
|
||||||
|
|
||||||
if (problem.domain->name != domainName)
|
if (problem.domain->name != domainName)
|
||||||
throw tokenize::TokenizerException(tokenizer.location(), "domains do not match (“" + problem.domain->name + "” and “" + domainName + "”)");
|
throw ParserException(tokenizer.location(), "domains do not match (“" + problem.domain->name + "” and “" + domainName + "”)");
|
||||||
|
|
||||||
tokenizer.expect<std::string>(")");
|
tokenizer.expect<std::string>(")");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user