From 586e93190c5a47b75da9a834fe65203e0d7c4bce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Mon, 19 Jun 2017 00:28:17 +0200 Subject: [PATCH] Made plasp compatible to recent tokenizer changes. --- include/plasp/pddl/Description.h | 4 +-- include/plasp/pddl/Domain.h | 10 +++--- include/plasp/pddl/Problem.h | 10 +++--- include/plasp/pddl/expressions/NAry.h | 2 +- src/plasp/output/Logger.cpp | 2 +- src/plasp/pddl/Description.cpp | 18 +++++------ src/plasp/pddl/Domain.cpp | 30 +++++++++--------- src/plasp/pddl/Expression.cpp | 6 ++-- src/plasp/pddl/InitialState.cpp | 2 +- src/plasp/pddl/Problem.cpp | 32 ++++++++++---------- src/plasp/pddl/Requirement.cpp | 4 +-- src/plasp/pddl/VariableStack.cpp | 2 +- src/plasp/pddl/expressions/Constant.cpp | 8 ++--- src/plasp/pddl/expressions/Predicate.cpp | 2 +- src/plasp/pddl/expressions/PrimitiveType.cpp | 6 ++-- src/plasp/pddl/expressions/Unsupported.cpp | 2 +- src/plasp/pddl/expressions/Variable.cpp | 4 +-- src/plasp/sas/Description.cpp | 4 +-- src/plasp/sas/MutexGroup.cpp | 2 +- src/plasp/sas/Predicate.cpp | 2 +- src/plasp/sas/Value.cpp | 6 ++-- src/plasp/sas/Variable.cpp | 4 +-- 22 files changed, 81 insertions(+), 81 deletions(-) diff --git a/include/plasp/pddl/Description.h b/include/plasp/pddl/Description.h index ee87e30..dd5dce2 100644 --- a/include/plasp/pddl/Description.h +++ b/include/plasp/pddl/Description.h @@ -46,9 +46,9 @@ class Description Context &m_context; - tokenize::Stream::Position m_domainPosition; + tokenize::StreamPosition m_domainPosition; std::unique_ptr m_domain; - tokenize::Stream::Position m_problemPosition; + tokenize::StreamPosition m_problemPosition; std::unique_ptr m_problem; }; diff --git a/include/plasp/pddl/Domain.h b/include/plasp/pddl/Domain.h index ed54954..7b76957 100644 --- a/include/plasp/pddl/Domain.h +++ b/include/plasp/pddl/Domain.h @@ -75,19 +75,19 @@ class Domain std::string m_name; - tokenize::Stream::Position m_requirementsPosition; + tokenize::StreamPosition m_requirementsPosition; Requirements m_requirements; - tokenize::Stream::Position m_typesPosition; + tokenize::StreamPosition m_typesPosition; expressions::PrimitiveTypes m_types; - tokenize::Stream::Position m_constantsPosition; + tokenize::StreamPosition m_constantsPosition; expressions::Constants m_constants; - tokenize::Stream::Position m_predicatesPosition; + tokenize::StreamPosition m_predicatesPosition; expressions::PredicateDeclarations m_predicates; - std::vector m_actionPositions; + std::vector m_actionPositions; std::vector> m_actions; expressions::DerivedPredicates m_derivedPredicates; diff --git a/include/plasp/pddl/Problem.h b/include/plasp/pddl/Problem.h index 887dcd0..0fae87b 100644 --- a/include/plasp/pddl/Problem.h +++ b/include/plasp/pddl/Problem.h @@ -64,18 +64,18 @@ class Problem std::string m_name; - tokenize::Stream::Position m_domainPosition; + tokenize::StreamPosition m_domainPosition; - tokenize::Stream::Position m_requirementsPosition; + tokenize::StreamPosition m_requirementsPosition; Requirements m_requirements; - tokenize::Stream::Position m_objectsPosition; + tokenize::StreamPosition m_objectsPosition; expressions::Constants m_objects; - tokenize::Stream::Position m_initialStatePosition; + tokenize::StreamPosition m_initialStatePosition; std::unique_ptr m_initialState; - tokenize::Stream::Position m_goalPosition; + tokenize::StreamPosition m_goalPosition; ExpressionPointer m_goal; }; diff --git a/include/plasp/pddl/expressions/NAry.h b/include/plasp/pddl/expressions/NAry.h index aa52342..5b1d869 100644 --- a/include/plasp/pddl/expressions/NAry.h +++ b/include/plasp/pddl/expressions/NAry.h @@ -79,7 +79,7 @@ boost::intrusive_ptr NAry::parse(Context &context, } if (expression->m_arguments.empty()) - context.logger.log(output::Priority::Warning, tokenizer.location(), "“" + Derived::Identifier + "” expressions should not be empty"); + context.logger.log(output::Priority::Warning, tokenizer, "“" + Derived::Identifier + "” expressions should not be empty"); tokenizer.expect(")"); diff --git a/src/plasp/output/Logger.cpp b/src/plasp/output/Logger.cpp index 9c0c37e..a0391c9 100644 --- a/src/plasp/output/Logger.cpp +++ b/src/plasp/output/Logger.cpp @@ -136,7 +136,7 @@ void Logger::log(Priority priority, const tokenize::Location &location, const ch m_errorStream << LocationFormat - << location.sectionStart << ":" << location.rowStart << ":" << location.columnStart << ":" + << location.sectionStart() << ":" << location.rowStart() << ":" << location.columnStart() << ":" << ResetFormat() << " " << priorityFormat(priority) << priorityName(priority) << ":" << ResetFormat() << " " diff --git a/src/plasp/pddl/Description.cpp b/src/plasp/pddl/Description.cpp index 0521d78..24ac528 100644 --- a/src/plasp/pddl/Description.cpp +++ b/src/plasp/pddl/Description.cpp @@ -21,9 +21,9 @@ namespace pddl Description::Description(Context &context) : m_context(context), - m_domainPosition{-1}, + m_domainPosition{tokenize::InvalidStreamPosition}, m_domain{std::make_unique(Domain(m_context))}, - m_problemPosition{-1} + m_problemPosition{tokenize::InvalidStreamPosition} { } @@ -133,13 +133,13 @@ void Description::parse() // First, determine the locations of domain and problem findSections(); - if (m_domainPosition == -1) + if (m_domainPosition == tokenize::InvalidStreamPosition) throw ConsistencyException("no PDDL domain specified"); tokenizer.seek(m_domainPosition); m_domain->parse(); - if (m_problemPosition != -1) + if (m_problemPosition != tokenize::InvalidStreamPosition) { tokenizer.seek(m_problemPosition); m_problem->parse(); @@ -166,8 +166,8 @@ void Description::findSections() if (tokenizer.testAndSkip("domain")) { - if (m_domainPosition != -1) - throw tokenize::TokenizerException(tokenizer.location(), "PDDL description may not contain two domains"); + if (m_domainPosition != tokenize::InvalidStreamPosition) + throw tokenize::TokenizerException(tokenizer, "PDDL description may not contain two domains"); m_domainPosition = position; @@ -176,8 +176,8 @@ void Description::findSections() } else if (tokenizer.testAndSkip("problem")) { - if (m_problemPosition != -1) - throw tokenize::TokenizerException(tokenizer.location(), "PDDL description may currently not contain two problems"); + if (m_problemPosition != tokenize::InvalidStreamPosition) + throw tokenize::TokenizerException(tokenizer, "PDDL description may currently not contain two problems"); m_problem = std::make_unique(Problem(m_context, *m_domain)); @@ -189,7 +189,7 @@ void Description::findSections() else { const auto sectionIdentifier = tokenizer.get(); - throw tokenize::TokenizerException(tokenizer.location(), "unknown PDDL section “" + sectionIdentifier + "”"); + throw tokenize::TokenizerException(tokenizer, "unknown PDDL section “" + sectionIdentifier + "”"); } tokenizer.skipWhiteSpace(); diff --git a/src/plasp/pddl/Domain.cpp b/src/plasp/pddl/Domain.cpp index b5f8638..525294f 100644 --- a/src/plasp/pddl/Domain.cpp +++ b/src/plasp/pddl/Domain.cpp @@ -24,10 +24,10 @@ namespace pddl Domain::Domain(Context &context) : m_context(context), - m_requirementsPosition{-1}, - m_typesPosition{-1}, - m_constantsPosition{-1}, - m_predicatesPosition{-1} + m_requirementsPosition{tokenize::InvalidStreamPosition}, + m_typesPosition{tokenize::InvalidStreamPosition}, + m_constantsPosition{tokenize::InvalidStreamPosition}, + m_predicatesPosition{tokenize::InvalidStreamPosition} { } @@ -49,10 +49,10 @@ void Domain::findSections() const auto setSectionPosition = [&](const std::string §ionName, auto §ionPosition, const auto value, bool unique = false) { - if (unique && sectionPosition != -1) + if (unique && sectionPosition != tokenize::InvalidStreamPosition) { tokenizer.seek(value); - throw tokenize::TokenizerException(tokenizer.location(), "only one “:" + sectionName + "” section allowed"); + throw tokenize::TokenizerException(tokenizer, "only one “:" + sectionName + "” section allowed"); } sectionPosition = value; @@ -93,7 +93,7 @@ void Domain::findSections() const auto sectionIdentifier = tokenizer.getIdentifier(); - m_context.logger.log(output::Priority::Warning, tokenizer.location(), "section type “" + sectionIdentifier + "” currently unsupported"); + m_context.logger.log(output::Priority::Warning, tokenizer, "section type “" + sectionIdentifier + "” currently unsupported"); tokenizer.seek(sectionIdentifierPosition); } @@ -102,7 +102,7 @@ void Domain::findSections() const auto sectionIdentifier = tokenizer.getIdentifier(); tokenizer.seek(position); - throw tokenize::TokenizerException(tokenizer.location(), "unknown domain section “" + sectionIdentifier + "”"); + throw tokenize::TokenizerException(tokenizer, "unknown domain section “" + sectionIdentifier + "”"); } // Skip section for now and parse it later @@ -120,32 +120,32 @@ void Domain::parse() { auto &tokenizer = m_context.tokenizer; - if (m_requirementsPosition != -1) + if (m_requirementsPosition != tokenize::InvalidStreamPosition) { tokenizer.seek(m_requirementsPosition); parseRequirementSection(); } - if (m_typesPosition != -1) + if (m_typesPosition != tokenize::InvalidStreamPosition) { tokenizer.seek(m_typesPosition); parseTypeSection(); } - if (m_constantsPosition != -1) + if (m_constantsPosition != tokenize::InvalidStreamPosition) { tokenizer.seek(m_constantsPosition); parseConstantSection(); } - if (m_predicatesPosition != -1) + if (m_predicatesPosition != tokenize::InvalidStreamPosition) { tokenizer.seek(m_predicatesPosition); parsePredicateSection(); } for (size_t i = 0; i < m_actionPositions.size(); i++) - if (m_actionPositions[i] != -1) + if (m_actionPositions[i] != tokenize::InvalidStreamPosition) { tokenizer.seek(m_actionPositions[i]); parseActionSection(); @@ -292,7 +292,7 @@ void Domain::checkRequirement(Requirement::Type requirementType) if (hasRequirement(requirementType)) return; - m_context.logger.log(output::Priority::Warning, m_context.tokenizer.location(), "requirement “" + Requirement(requirementType).toPDDL() + "” used but never declared"); + m_context.logger.log(output::Priority::Warning, m_context.tokenizer, "requirement “" + Requirement(requirementType).toPDDL() + "” used but never declared"); m_requirements.push_back(requirementType); } @@ -355,7 +355,7 @@ void Domain::parseTypeSection() while (tokenizer.currentCharacter() != ')') { if (tokenizer.currentCharacter() == '(') - throw tokenize::TokenizerException(tokenizer.location(), "only primitive types are allowed in type section"); + throw tokenize::TokenizerException(tokenizer, "only primitive types are allowed in type section"); expressions::PrimitiveType::parseTypedDeclaration(m_context, *this); diff --git a/src/plasp/pddl/Expression.cpp b/src/plasp/pddl/Expression.cpp index f1f813c..42dd6f7 100644 --- a/src/plasp/pddl/Expression.cpp +++ b/src/plasp/pddl/Expression.cpp @@ -182,7 +182,7 @@ ExpressionPointer parseExpression(Context &context, ExpressionContext &expressio const auto expressionIdentifier = tokenizer.getIdentifier(); tokenizer.seek(position); - throw tokenize::TokenizerException(tokenizer.location(), "expression type “" + expressionIdentifier + "” unknown or not allowed in this context"); + throw tokenize::TokenizerException(tokenizer, "expression type “" + expressionIdentifier + "” unknown or not allowed in this context"); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -257,7 +257,7 @@ ExpressionPointer parseEffectBodyExpression(Context &context, ExpressionContext const auto expressionIdentifier = tokenizer.getIdentifier(); tokenizer.seek(position); - throw tokenize::TokenizerException(tokenizer.location(), "expression type “" + expressionIdentifier + "” unknown or not allowed in this context"); + throw tokenize::TokenizerException(tokenizer, "expression type “" + expressionIdentifier + "” unknown or not allowed in this context"); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -281,7 +281,7 @@ ExpressionPointer parsePredicate(Context &context, ExpressionContext &expression if ((expression = expressions::Predicate::parse(context, expressionContext))) return expression; - throw tokenize::TokenizerException(context.tokenizer.location(), "expected predicate"); + throw tokenize::TokenizerException(context.tokenizer, "expected predicate"); } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/plasp/pddl/InitialState.cpp b/src/plasp/pddl/InitialState.cpp index dddaec7..9fc6dd8 100644 --- a/src/plasp/pddl/InitialState.cpp +++ b/src/plasp/pddl/InitialState.cpp @@ -59,7 +59,7 @@ std::unique_ptr InitialState::parseDeclaration(Context &context, const auto expressionIdentifier = tokenizer.getIdentifier(); tokenizer.seek(position); - throw tokenize::TokenizerException(tokenizer.location(), "expression type “" + expressionIdentifier + "” unknown or not allowed in this context"); + throw tokenize::TokenizerException(tokenizer, "expression type “" + expressionIdentifier + "” unknown or not allowed in this context"); }; tokenizer.skipWhiteSpace(); diff --git a/src/plasp/pddl/Problem.cpp b/src/plasp/pddl/Problem.cpp index a3ee685..e40a544 100644 --- a/src/plasp/pddl/Problem.cpp +++ b/src/plasp/pddl/Problem.cpp @@ -24,11 +24,11 @@ namespace pddl Problem::Problem(Context &context, Domain &domain) : m_context(context), m_domain(domain), - m_domainPosition{-1}, - m_requirementsPosition{-1}, - m_objectsPosition{-1}, - m_initialStatePosition{-1}, - m_goalPosition{-1} + m_domainPosition{tokenize::InvalidStreamPosition}, + m_requirementsPosition{tokenize::InvalidStreamPosition}, + m_objectsPosition{tokenize::InvalidStreamPosition}, + m_initialStatePosition{tokenize::InvalidStreamPosition}, + m_goalPosition{tokenize::InvalidStreamPosition} { } @@ -50,10 +50,10 @@ void Problem::findSections() const auto setSectionPosition = [&](const std::string §ionName, auto §ionPosition, const auto value, bool unique = false) { - if (unique && sectionPosition != -1) + if (unique && sectionPosition != tokenize::InvalidStreamPosition) { tokenizer.seek(value); - throw tokenize::TokenizerException(tokenizer.location(), "only one “:" + sectionName + "” section allowed"); + throw tokenize::TokenizerException(tokenizer, "only one “:" + sectionName + "” section allowed"); } sectionPosition = value; @@ -89,7 +89,7 @@ void Problem::findSections() const auto sectionIdentifier = tokenizer.getIdentifier(); - m_context.logger.log(output::Priority::Warning, tokenizer.location(), "section type “" + sectionIdentifier + "” currently unsupported"); + m_context.logger.log(output::Priority::Warning, tokenizer, "section type “" + sectionIdentifier + "” currently unsupported"); tokenizer.seek(sectionIdentifierPosition); } @@ -98,7 +98,7 @@ void Problem::findSections() const auto sectionIdentifier = tokenizer.getIdentifier(); tokenizer.seek(position); - throw tokenize::TokenizerException(tokenizer.location(), "unknown problem section “" + sectionIdentifier + "”"); + throw tokenize::TokenizerException(tokenizer, "unknown problem section “" + sectionIdentifier + "”"); } // Skip section for now and parse it later @@ -116,31 +116,31 @@ void Problem::parse() { auto &tokenizer = m_context.tokenizer; - if (m_domainPosition == -1) + if (m_domainPosition == tokenize::InvalidStreamPosition) throw ConsistencyException("problem description does not specify the corresponding domain"); tokenizer.seek(m_domainPosition); parseDomainSection(); - if (m_requirementsPosition != -1) + if (m_requirementsPosition != tokenize::InvalidStreamPosition) { tokenizer.seek(m_requirementsPosition); parseRequirementSection(); } - if (m_objectsPosition != -1) + if (m_objectsPosition != tokenize::InvalidStreamPosition) { tokenizer.seek(m_objectsPosition); parseObjectSection(); } - if (m_initialStatePosition == -1) + if (m_initialStatePosition == tokenize::InvalidStreamPosition) throw ConsistencyException("problem description does not specify an initial state"); tokenizer.seek(m_initialStatePosition); parseInitialStateSection(); - if (m_goalPosition == -1) + if (m_goalPosition == tokenize::InvalidStreamPosition) throw ConsistencyException("problem description does not specify a goal"); tokenizer.seek(m_goalPosition); @@ -204,7 +204,7 @@ void Problem::parseDomainSection() const auto domainName = tokenizer.getIdentifier(); if (m_domain.name() != domainName) - throw tokenize::TokenizerException(tokenizer.location(), "domains do not match (“" + m_domain.name() + "” and “" + domainName + "”)"); + throw tokenize::TokenizerException(tokenizer, "domains do not match (“" + m_domain.name() + "” and “" + domainName + "”)"); tokenizer.expect(")"); } @@ -261,7 +261,7 @@ void Problem::checkRequirement(Requirement::Type requirementType) if (hasRequirement(requirementType)) return; - m_context.logger.log(output::Priority::Warning, m_context.tokenizer.location(), "requirement “" + Requirement(requirementType).toPDDL() + "” used but never declared"); + m_context.logger.log(output::Priority::Warning, m_context.tokenizer, "requirement “" + Requirement(requirementType).toPDDL() + "” used but never declared"); m_requirements.push_back(requirementType); } diff --git a/src/plasp/pddl/Requirement.cpp b/src/plasp/pddl/Requirement.cpp index ad38c99..e26ea35 100644 --- a/src/plasp/pddl/Requirement.cpp +++ b/src/plasp/pddl/Requirement.cpp @@ -89,12 +89,12 @@ Requirement Requirement::parse(Context &context) const auto match = requirementTypesToPDDL.right.find(requirementName); if (match == requirementTypesToPDDL.right.end()) - throw tokenize::TokenizerException(tokenizer.location(), "unknown PDDL requirement “" + requirementName + "”"); + throw tokenize::TokenizerException(tokenizer, "unknown PDDL requirement “" + requirementName + "”"); const auto requirementType = match->second; if (requirementType == Requirement::Type::GoalUtilities) - context.logger.log(output::Priority::Warning, tokenizer.location(), "requirement “goal-utilities” is not part of the PDDL 3.1 specification"); + context.logger.log(output::Priority::Warning, tokenizer, "requirement “goal-utilities” is not part of the PDDL 3.1 specification"); return Requirement(match->second); } diff --git a/src/plasp/pddl/VariableStack.cpp b/src/plasp/pddl/VariableStack.cpp index cbe39ab..aedb4ff 100644 --- a/src/plasp/pddl/VariableStack.cpp +++ b/src/plasp/pddl/VariableStack.cpp @@ -53,7 +53,7 @@ expressions::VariablePointer VariableStack::parseAndFind(plasp::pddl::Context &c return match->get(); } - throw tokenize::TokenizerException(tokenizer.location(), "variable “" + variableName + "” used but never declared"); + throw tokenize::TokenizerException(tokenizer, "variable “" + variableName + "” used but never declared"); } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/plasp/pddl/expressions/Constant.cpp b/src/plasp/pddl/expressions/Constant.cpp index 24b3880..2ac99cc 100644 --- a/src/plasp/pddl/expressions/Constant.cpp +++ b/src/plasp/pddl/expressions/Constant.cpp @@ -115,7 +115,7 @@ void Constant::parseTypedDeclarations(Context &context, Domain &domain) domain.checkRequirement(Requirement::Type::Typing); // If no types are given, check that typing is not a requirement else if (domain.hasRequirement(Requirement::Type::Typing)) - throw tokenize::TokenizerException(tokenizer.location(), "constant has undeclared type"); + throw tokenize::TokenizerException(tokenizer, "constant has undeclared type"); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -142,7 +142,7 @@ void Constant::parseTypedDeclarations(Context &context, Problem &problem) problem.checkRequirement(Requirement::Type::Typing); // If no types are given, check that typing is not a requirement else if (problem.hasRequirement(Requirement::Type::Typing)) - throw tokenize::TokenizerException(tokenizer.location(), "constant has undeclared type"); + throw tokenize::TokenizerException(tokenizer, "constant has undeclared type"); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -160,7 +160,7 @@ ConstantPointer Constant::parseAndFind(Context &context, const Domain &domain) if (constant != nullptr) return constant; - throw tokenize::TokenizerException(tokenizer.location(), "constant “" + constantName + "” used but never declared"); + throw tokenize::TokenizerException(tokenizer, "constant “" + constantName + "” used but never declared"); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -183,7 +183,7 @@ ConstantPointer Constant::parseAndFind(Context &context, const Problem &problem) if (constant) return constant; - throw tokenize::TokenizerException(tokenizer.location(), "constant “" + constantName + "” used but never declared"); + throw tokenize::TokenizerException(tokenizer, "constant “" + constantName + "” used but never declared"); } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/plasp/pddl/expressions/Predicate.cpp b/src/plasp/pddl/expressions/Predicate.cpp index 00a75ea..bddcebc 100644 --- a/src/plasp/pddl/expressions/Predicate.cpp +++ b/src/plasp/pddl/expressions/Predicate.cpp @@ -126,7 +126,7 @@ PredicatePointer Predicate::parse(Context &context, const Problem &problem) while (tokenizer.currentCharacter() != ')') { if (tokenizer.currentCharacter() == '?') - throw tokenize::TokenizerException(tokenizer.location(), "variables not allowed in this context"); + throw tokenize::TokenizerException(tokenizer, "variables not allowed in this context"); // Parse objects and constants const auto constant = Constant::parseAndFind(context, problem); diff --git a/src/plasp/pddl/expressions/PrimitiveType.cpp b/src/plasp/pddl/expressions/PrimitiveType.cpp index 45af328..310ee31 100644 --- a/src/plasp/pddl/expressions/PrimitiveType.cpp +++ b/src/plasp/pddl/expressions/PrimitiveType.cpp @@ -113,7 +113,7 @@ PrimitiveTypePointer PrimitiveType::parseAndFind(Context &context, Domain &domai const auto typeName = tokenizer.getIdentifier(); if (typeName.empty()) - throw tokenize::TokenizerException(tokenizer.location(), "no type supplied"); + throw tokenize::TokenizerException(tokenizer, "no type supplied"); const auto match = std::find_if(types.cbegin(), types.cend(), [&](const auto &primitiveType) @@ -126,11 +126,11 @@ PrimitiveTypePointer PrimitiveType::parseAndFind(Context &context, Domain &domai // Only "object" is allowed as an implicit type if (typeName == "object" || typeName == "objects") { - context.logger.log(output::Priority::Warning, tokenizer.location(), "primitive type “" + typeName + "” should be declared"); + context.logger.log(output::Priority::Warning, tokenizer, "primitive type “" + typeName + "” should be declared"); types.emplace_back(PrimitiveTypePointer(new PrimitiveType(typeName))); } else - throw tokenize::TokenizerException(tokenizer.location(), "type “" + typeName + "” used but never declared"); + throw tokenize::TokenizerException(tokenizer, "type “" + typeName + "” used but never declared"); return types.back().get(); } diff --git a/src/plasp/pddl/expressions/Unsupported.cpp b/src/plasp/pddl/expressions/Unsupported.cpp index 11dd4bb..70e68f5 100644 --- a/src/plasp/pddl/expressions/Unsupported.cpp +++ b/src/plasp/pddl/expressions/Unsupported.cpp @@ -25,7 +25,7 @@ UnsupportedPointer Unsupported::parse(Context &context) expression->m_type = tokenizer.getIdentifier(); - context.logger.log(output::Priority::Warning, tokenizer.location(), "expression type “" + expression->m_type + "” currently unsupported in this context"); + context.logger.log(output::Priority::Warning, tokenizer, "expression type “" + expression->m_type + "” currently unsupported in this context"); skipSection(tokenizer); diff --git a/src/plasp/pddl/expressions/Variable.cpp b/src/plasp/pddl/expressions/Variable.cpp index 2289d9e..74c7cbb 100644 --- a/src/plasp/pddl/expressions/Variable.cpp +++ b/src/plasp/pddl/expressions/Variable.cpp @@ -61,7 +61,7 @@ void Variable::parseDeclaration(Context &context, Variables ¶meters) }); if (match != parameters.cend()) - throw tokenize::TokenizerException(tokenizer.location(), "variable “" + variable->m_name + "” already declared in this scope"); + throw tokenize::TokenizerException(tokenizer, "variable “" + variable->m_name + "” already declared in this scope"); // Flag variable for potentially upcoming type declaration variable->setDirty(); @@ -138,7 +138,7 @@ void Variable::parseTypedDeclarations(Context &context, ExpressionContext &expre expressionContext.checkRequirement(Requirement::Type::Typing); // If no types are given, check that typing is not a requirement else if (expressionContext.hasRequirement(Requirement::Type::Typing)) - throw tokenize::TokenizerException(tokenizer.location(), "variable has undeclared type"); + throw tokenize::TokenizerException(tokenizer, "variable has undeclared type"); } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/plasp/sas/Description.cpp b/src/plasp/sas/Description.cpp index 6e8384b..17f044b 100644 --- a/src/plasp/sas/Description.cpp +++ b/src/plasp/sas/Description.cpp @@ -173,7 +173,7 @@ void Description::parseContent(tokenize::Tokenizer<> &tokenizer) tokenizer.skipWhiteSpace(); if (!tokenizer.atEnd()) - throw tokenize::TokenizerException(tokenizer.location(), "expected end of SAS description (perhaps, input contains two SAS descriptions?)"); + throw tokenize::TokenizerException(tokenizer, "expected end of SAS description (perhaps, input contains two SAS descriptions?)"); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -185,7 +185,7 @@ void Description::parseVersionSection(tokenize::Tokenizer<> &tokenizer) const const auto formatVersion = tokenizer.get(); if (formatVersion != 3) - throw tokenize::TokenizerException(tokenizer.location(), "unsupported SAS format version (" + std::to_string(formatVersion) + ")"); + throw tokenize::TokenizerException(tokenizer, "unsupported SAS format version (" + std::to_string(formatVersion) + ")"); tokenizer.expect("end_version"); } diff --git a/src/plasp/sas/MutexGroup.cpp b/src/plasp/sas/MutexGroup.cpp index f0f3eab..cb1b39e 100644 --- a/src/plasp/sas/MutexGroup.cpp +++ b/src/plasp/sas/MutexGroup.cpp @@ -29,7 +29,7 @@ MutexGroup MutexGroup::fromSAS(tokenize::Tokenizer<> &tokenizer, const Variables mutexGroup.m_facts.emplace_back(Fact::fromSAS(tokenizer, variables)); if (mutexGroup.m_facts[j].value() == Value::None) - throw tokenize::TokenizerException(tokenizer.location(), "mutex groups must not contain values"); + throw tokenize::TokenizerException(tokenizer, "mutex groups must not contain values"); } tokenizer.expect("end_mutex_group"); diff --git a/src/plasp/sas/Predicate.cpp b/src/plasp/sas/Predicate.cpp index 4c61d64..20c9e2c 100644 --- a/src/plasp/sas/Predicate.cpp +++ b/src/plasp/sas/Predicate.cpp @@ -44,7 +44,7 @@ Predicate Predicate::fromSAS(tokenize::Tokenizer<> &tokenizer) } catch (const std::exception &e) { - throw tokenize::TokenizerException(tokenizer.location(), "could not parse operator predicate"); + throw tokenize::TokenizerException(tokenizer, "could not parse operator predicate"); } return predicate; diff --git a/src/plasp/sas/Value.cpp b/src/plasp/sas/Value.cpp index 18f9f6d..acf57a8 100644 --- a/src/plasp/sas/Value.cpp +++ b/src/plasp/sas/Value.cpp @@ -75,7 +75,7 @@ Value Value::fromSAS(tokenize::Tokenizer<> &tokenizer) else if (sasSign == "NegatedAtom") value.m_sign = Value::Sign::Negative; else - throw tokenize::TokenizerException(tokenizer.location(), "invalid value sign “" + sasSign + "”"); + throw tokenize::TokenizerException(tokenizer, "invalid value sign “" + sasSign + "”"); try { @@ -91,7 +91,7 @@ Value Value::fromSAS(tokenize::Tokenizer<> &tokenizer) } catch (const std::exception &e) { - throw tokenize::TokenizerException(tokenizer.location(), std::string("could not parse variable value (") + e.what() + ")"); + throw tokenize::TokenizerException(tokenizer, std::string("could not parse variable value (") + e.what() + ")"); } return value; @@ -107,7 +107,7 @@ const Value &Value::referenceFromSAS(tokenize::Tokenizer<> &tokenizer, const Var return Value::Any; if (valueID < 0 || static_cast(valueID) >= variable.values().size()) - throw tokenize::TokenizerException(tokenizer.location(), "value index out of range (variable " + variable.name() + ", index " + std::to_string(valueID) + ")"); + throw tokenize::TokenizerException(tokenizer, "value index out of range (variable " + variable.name() + ", index " + std::to_string(valueID) + ")"); return variable.values()[valueID]; } diff --git a/src/plasp/sas/Variable.cpp b/src/plasp/sas/Variable.cpp index 92fc02d..9e6a914 100644 --- a/src/plasp/sas/Variable.cpp +++ b/src/plasp/sas/Variable.cpp @@ -43,7 +43,7 @@ Variable Variable::fromSAS(tokenize::Tokenizer<> &tokenizer) // values are only allowed at the end if (j < numberOfValues - 1 && variable.m_values[j] == Value::None) - throw tokenize::TokenizerException(tokenizer.location(), " value must be the last value of a variable"); + throw tokenize::TokenizerException(tokenizer, " value must be the last value of a variable"); } tokenizer.expect("end_variable"); @@ -66,7 +66,7 @@ const Variable &Variable::referenceFromSAS(tokenize::Tokenizer<> &tokenizer, con const auto variableID = tokenizer.get(); if (variableID >= variables.size()) - throw tokenize::TokenizerException(tokenizer.location(), "variable index out of range (index " + std::to_string(variableID) + ")"); + throw tokenize::TokenizerException(tokenizer, "variable index out of range (index " + std::to_string(variableID) + ")"); return variables[variableID]; }