Prepared exceptions to have different types.
This commit is contained in:
parent
da2a3eefa4
commit
7ead2277e8
@ -1,5 +1,5 @@
|
|||||||
#ifndef __PDDL_PARSE__PARSER_EXCEPTION_H
|
#ifndef __PDDL_PARSE__EXCEPTION_H
|
||||||
#define __PDDL_PARSE__PARSER_EXCEPTION_H
|
#define __PDDL_PARSE__EXCEPTION_H
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -11,39 +11,39 @@ namespace pddl
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// ParserException
|
// Exception
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class ParserException: public std::exception
|
class Exception: public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ParserException()
|
explicit Exception()
|
||||||
: ParserException("unspecified parser error")
|
: Exception("unspecified parser error")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit ParserException(const char *message)
|
explicit Exception(const char *message)
|
||||||
: ParserException(static_cast<std::string>(message))
|
: Exception(static_cast<std::string>(message))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit ParserException(const std::string &message)
|
explicit Exception(const std::string &message)
|
||||||
: m_message{message}
|
: m_message{message}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit ParserException(const tokenize::Location &location)
|
explicit Exception(const tokenize::Location &location)
|
||||||
: ParserException(location, "unspecified parser error")
|
: Exception(location, "unspecified parser error")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit ParserException(const tokenize::Location &location, const char *message)
|
explicit Exception(const tokenize::Location &location, const char *message)
|
||||||
: ParserException(location, static_cast<std::string>(message))
|
: Exception(location, static_cast<std::string>(message))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit ParserException(const tokenize::Location &location, const std::string &message)
|
explicit Exception(const tokenize::Location &location, const std::string &message)
|
||||||
: m_location{location},
|
: m_location{location},
|
||||||
m_message{message},
|
m_message{message},
|
||||||
// TODO: refactor
|
// TODO: refactor
|
||||||
@ -52,7 +52,7 @@ class ParserException: public std::exception
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~ParserException() noexcept = default;
|
~Exception() noexcept = default;
|
||||||
|
|
||||||
const char *what() const throw()
|
const char *what() const throw()
|
||||||
{
|
{
|
||||||
@ -77,6 +77,14 @@ class ParserException: public std::exception
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class ParserException : public Exception
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using Exception::Exception;
|
||||||
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <pddlparse/AST.h>
|
#include <pddlparse/AST.h>
|
||||||
#include <pddlparse/Context.h>
|
#include <pddlparse/Context.h>
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.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/VariableDeclaration.h>
|
#include <pddlparse/detail/parsing/VariableDeclaration.h>
|
||||||
|
@ -1,7 +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/Exception.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>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <pddlparse/detail/parsing/Constant.h>
|
#include <pddlparse/detail/parsing/Constant.h>
|
||||||
|
|
||||||
#include <pddlparse/AST.h>
|
#include <pddlparse/AST.h>
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.h>
|
||||||
|
|
||||||
namespace pddl
|
namespace pddl
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <pddlparse/detail/parsing/ConstantDeclaration.h>
|
#include <pddlparse/detail/parsing/ConstantDeclaration.h>
|
||||||
|
|
||||||
#include <pddlparse/AST.h>
|
#include <pddlparse/AST.h>
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.h>
|
||||||
#include <pddlparse/detail/ASTCopy.h>
|
#include <pddlparse/detail/ASTCopy.h>
|
||||||
#include <pddlparse/detail/parsing/PrimitiveType.h>
|
#include <pddlparse/detail/parsing/PrimitiveType.h>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <pddlparse/detail/parsing/Description.h>
|
#include <pddlparse/detail/parsing/Description.h>
|
||||||
|
|
||||||
#include <pddlparse/AST.h>
|
#include <pddlparse/AST.h>
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.h>
|
||||||
#include <pddlparse/detail/parsing/Domain.h>
|
#include <pddlparse/detail/parsing/Domain.h>
|
||||||
#include <pddlparse/detail/parsing/Problem.h>
|
#include <pddlparse/detail/parsing/Problem.h>
|
||||||
#include <pddlparse/detail/parsing/Utils.h>
|
#include <pddlparse/detail/parsing/Utils.h>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <pddlparse/detail/parsing/Domain.h>
|
#include <pddlparse/detail/parsing/Domain.h>
|
||||||
|
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.h>
|
||||||
#include <pddlparse/detail/Requirements.h>
|
#include <pddlparse/detail/Requirements.h>
|
||||||
#include <pddlparse/detail/parsing/Action.h>
|
#include <pddlparse/detail/parsing/Action.h>
|
||||||
#include <pddlparse/detail/parsing/ConstantDeclaration.h>
|
#include <pddlparse/detail/parsing/ConstantDeclaration.h>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <pddlparse/detail/parsing/InitialState.h>
|
#include <pddlparse/detail/parsing/InitialState.h>
|
||||||
|
|
||||||
#include <pddlparse/AST.h>
|
#include <pddlparse/AST.h>
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.h>
|
||||||
#include <pddlparse/detail/parsing/Fact.h>
|
#include <pddlparse/detail/parsing/Fact.h>
|
||||||
|
|
||||||
namespace pddl
|
namespace pddl
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <pddlparse/detail/parsing/PredicateDeclaration.h>
|
#include <pddlparse/detail/parsing/PredicateDeclaration.h>
|
||||||
|
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.h>
|
||||||
#include <pddlparse/detail/ASTContext.h>
|
#include <pddlparse/detail/ASTContext.h>
|
||||||
#include <pddlparse/detail/parsing/VariableDeclaration.h>
|
#include <pddlparse/detail/parsing/VariableDeclaration.h>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <pddlparse/detail/parsing/PrimitiveType.h>
|
#include <pddlparse/detail/parsing/PrimitiveType.h>
|
||||||
|
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.h>
|
||||||
#include <pddlparse/detail/Requirements.h>
|
#include <pddlparse/detail/Requirements.h>
|
||||||
|
|
||||||
namespace pddl
|
namespace pddl
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <pddlparse/detail/parsing/PrimitiveTypeDeclaration.h>
|
#include <pddlparse/detail/parsing/PrimitiveTypeDeclaration.h>
|
||||||
|
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.h>
|
||||||
#include <pddlparse/detail/ASTCopy.h>
|
#include <pddlparse/detail/ASTCopy.h>
|
||||||
#include <pddlparse/detail/parsing/PrimitiveType.h>
|
#include <pddlparse/detail/parsing/PrimitiveType.h>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <pddlparse/detail/parsing/Problem.h>
|
#include <pddlparse/detail/parsing/Problem.h>
|
||||||
|
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.h>
|
||||||
#include <pddlparse/detail/Requirements.h>
|
#include <pddlparse/detail/Requirements.h>
|
||||||
#include <pddlparse/detail/parsing/ConstantDeclaration.h>
|
#include <pddlparse/detail/parsing/ConstantDeclaration.h>
|
||||||
#include <pddlparse/detail/parsing/InitialState.h>
|
#include <pddlparse/detail/parsing/InitialState.h>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include <pddlparse/AST.h>
|
#include <pddlparse/AST.h>
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.h>
|
||||||
|
|
||||||
namespace pddl
|
namespace pddl
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <pddlparse/detail/parsing/Type.h>
|
#include <pddlparse/detail/parsing/Type.h>
|
||||||
|
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.h>
|
||||||
#include <pddlparse/detail/parsing/Expressions.h>
|
#include <pddlparse/detail/parsing/Expressions.h>
|
||||||
#include <pddlparse/detail/parsing/PrimitiveType.h>
|
#include <pddlparse/detail/parsing/PrimitiveType.h>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <pddlparse/detail/parsing/Variable.h>
|
#include <pddlparse/detail/parsing/Variable.h>
|
||||||
|
|
||||||
#include <pddlparse/AST.h>
|
#include <pddlparse/AST.h>
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.h>
|
||||||
|
|
||||||
namespace pddl
|
namespace pddl
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <pddlparse/detail/parsing/VariableDeclaration.h>
|
#include <pddlparse/detail/parsing/VariableDeclaration.h>
|
||||||
|
|
||||||
#include <pddlparse/AST.h>
|
#include <pddlparse/AST.h>
|
||||||
#include <pddlparse/ParserException.h>
|
#include <pddlparse/Exception.h>
|
||||||
#include <pddlparse/detail/ASTCopy.h>
|
#include <pddlparse/detail/ASTCopy.h>
|
||||||
#include <pddlparse/detail/parsing/Type.h>
|
#include <pddlparse/detail/parsing/Type.h>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user