diff --git a/src/include/types.h b/src/include/types.h index 14156f5..a058a72 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -12,8 +12,16 @@ using namespace std; /** * 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 Type { Int, Double }; +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 Type { + Int, Double +}; using TokenData = variant; @@ -183,7 +191,38 @@ struct Scope { /** * 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;