2015-12-08 04:51:55 +08:00
|
|
|
#pragma once
|
2015-09-13 17:34:17 +08:00
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
#include "token.hpp"
|
|
|
|
|
|
|
|
class SyntaxError : public std::runtime_error
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SyntaxError(const std::string& near)
|
|
|
|
: std::runtime_error("Syntax error near '" + near + "'.") {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class LexicalError : public std::runtime_error
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LexicalError(const Token& token)
|
|
|
|
: std::runtime_error("Unrecognized token '" + token.value + "'.") {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class ParserError : public std::runtime_error
|
|
|
|
{
|
|
|
|
using runtime_error::runtime_error;
|
|
|
|
};
|