Corrected exception types.

This commit is contained in:
Patrick Lühne 2017-06-17 19:56:13 +02:00
parent d376c1a993
commit 20c687a787
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
7 changed files with 13 additions and 13 deletions

View File

@ -1,6 +1,7 @@
#include <pddlparse/detail/parsing/Action.h>
#include <pddlparse/AST.h>
#include <pddlparse/ParserException.h>
#include <pddlparse/detail/ASTContext.h>
#include <pddlparse/detail/VariableStack.h>
#include <pddlparse/detail/parsing/Effect.h>
@ -86,7 +87,7 @@ void ActionParser::findSections(ast::Action &action)
if (unique && sectionPosition != -1)
{
tokenizer.seek(value);
throw tokenize::TokenizerException(tokenizer.location(), "only one “:" + sectionName + "” section allowed");
throw ParserException(tokenizer.location(), "only one “:" + sectionName + "” section allowed");
}
sectionPosition = value;
@ -113,7 +114,7 @@ void ActionParser::findSections(ast::Action &action)
const auto sectionIdentifier = tokenizer.getIdentifier();
tokenizer.seek(position);
throw tokenize::TokenizerException(tokenizer.location(), "unknown action section “" + sectionIdentifier + "");
throw ParserException(tokenizer.location(), "unknown action section “" + sectionIdentifier + "");
}
tokenizer.expect<std::string>("(");

View File

@ -96,7 +96,7 @@ void DomainParser::findSections(ast::Domain &domain)
if (unique && sectionPosition != -1)
{
tokenizer.seek(value);
throw tokenize::TokenizerException(tokenizer.location(), "only one “:" + sectionName + "” section allowed");
throw ParserException(tokenizer.location(), "only one “:" + sectionName + "” section allowed");
}
sectionPosition = value;
@ -146,7 +146,7 @@ void DomainParser::findSections(ast::Domain &domain)
const auto sectionIdentifier = tokenizer.getIdentifier();
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

View File

@ -83,7 +83,7 @@ std::experimental::optional<ast::Effect> parseEffectBody(Context &context, ASTCo
const auto expressionIdentifier = tokenizer.getIdentifier();
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();
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");
}
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -1,8 +1,7 @@
#include <pddlparse/detail/parsing/InitialState.h>
#include <pddlparse/AST.h>
// TODO: remove
#include <pddlparse/detail/parsing/Utils.h>
#include <pddlparse/ParserException.h>
namespace pddl
{

View File

@ -99,7 +99,7 @@ std::experimental::optional<ast::Precondition> parsePreconditionBody(Context &co
const auto expressionIdentifier = tokenizer.getIdentifier();
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");
}
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -24,7 +24,7 @@ ast::PrimitiveTypePointer parsePrimitiveType(Context &context, ast::Domain &doma
auto typeName = tokenizer.getIdentifier();
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 &primitiveTypeDeclaration)

View File

@ -93,7 +93,7 @@ void ProblemParser::findSections(ast::Problem &problem)
if (unique && sectionPosition != -1)
{
tokenizer.seek(value);
throw tokenize::TokenizerException(tokenizer.location(), "only one “:" + sectionName + "” section allowed");
throw ParserException(tokenizer.location(), "only one “:" + sectionName + "” section allowed");
}
sectionPosition = value;
@ -137,7 +137,7 @@ void ProblemParser::findSections(ast::Problem &problem)
const auto sectionIdentifier = tokenizer.getIdentifier();
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
@ -164,7 +164,7 @@ void ProblemParser::parseDomainSection(ast::Problem &problem)
const auto domainName = tokenizer.getIdentifier();
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>(")");
}