Prettify errors
This commit is contained in:
parent
0cd17b9003
commit
f7af17c899
@ -12,8 +12,16 @@ using namespace std;
|
|||||||
/**
|
/**
|
||||||
* Tokens definition
|
* Tokens definition
|
||||||
*/
|
*/
|
||||||
enum class TokenType { Identifier, Litteral, Plus, Minus, DoublePlus, DoubleMinus, DoubleEqual, Land, Lor, Lt, Gt, Leq, Geq, NotEqual, Not, Star, Slash, Percent, Equal, Semicolon, LParenthese, RParenthese, LCurlyBracket, RCurlyBracket, If, Else, While, For, Break, Continue, Comma };
|
enum class TokenType {
|
||||||
enum class Type { Int, Double };
|
Identifier, Litteral, Plus, Minus, DoublePlus, DoubleMinus, DoubleEqual, Land,
|
||||||
|
Lor, Lt, Gt, Leq, Geq, NotEqual, Not, Star, Slash, Percent, Equal, Semicolon,
|
||||||
|
LParenthese, RParenthese, LCurlyBracket, RCurlyBracket, If, Else, While, For,
|
||||||
|
Break, Continue, Comma
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class Type {
|
||||||
|
Int, Double
|
||||||
|
};
|
||||||
|
|
||||||
using TokenData = variant<int, double, string, Type>;
|
using TokenData = variant<int, double, string, Type>;
|
||||||
|
|
||||||
@ -183,7 +191,38 @@ struct Scope {
|
|||||||
/**
|
/**
|
||||||
* Errors
|
* Errors
|
||||||
*/
|
*/
|
||||||
enum class ErrorType { DivisionByZero, ModuloByZero, ExpectedIntegralType, ExpectedArithmeticType, UninitializedIdentifier, UnknownIdentifier, AlreadyDefinedIdentifier, EmptyInput, UnknownToken, InvalidSyntax, ExceptedLParen, ExpectedRParen, ExpectedRCurlyBracket, ExpectedSemicolon, DependentDeclaration, TypesNotComparable, TypeNotCastable, UnknownType };
|
enum class ErrorType {
|
||||||
|
// Generic
|
||||||
|
NotImplemented,
|
||||||
|
|
||||||
|
// Lexing
|
||||||
|
UnknownToken,
|
||||||
|
|
||||||
|
// Parsing
|
||||||
|
EmptyInput,
|
||||||
|
InvalidSyntax,
|
||||||
|
ExceptedLParen,
|
||||||
|
ExpectedRParen,
|
||||||
|
ExpectedRCurlyBracket,
|
||||||
|
ExpectedSemicolon,
|
||||||
|
DependentDeclaration,
|
||||||
|
|
||||||
|
// Analysis
|
||||||
|
UnknownType,
|
||||||
|
TypeNotCastable,
|
||||||
|
TypesNotComparable,
|
||||||
|
ExpectedIntegralType,
|
||||||
|
ExpectedArithmeticType,
|
||||||
|
|
||||||
|
// Runtime
|
||||||
|
DivisionByZero,
|
||||||
|
ModuloByZero,
|
||||||
|
UnknownIdentifier,
|
||||||
|
AlreadyDefinedIdentifier,
|
||||||
|
UninitializedIdentifier,
|
||||||
|
BreakNotWithinLoop,
|
||||||
|
ContinueNotWithinLoop,
|
||||||
|
};
|
||||||
|
|
||||||
using ErrorData = variant<monostate, string>;
|
using ErrorData = variant<monostate, string>;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user