[][src]Enum darklua_core::ParsingError

pub enum ParsingError {
    EndOfBlockExpectedAfterLastStatement,
    EndExpectedAfterLastStatement,
    RightExpressionExpected,
    UnexpectedTokenForStatement,
    TokenExpectedToCloseBlock,
    FunctionKeywordExpected,
    OpeningParentheseExpectedForFunction,
    ClosingParentheseExpectedForFunction,
    InvalidFunctionParameter,
    ExpressionExpectedAfterUnaryOperator,
    ExpressionExpectedAfterOpeningParenthese,
    ClosingParentheseExpected,
    ClosingBracketExpected,
    ArgumentsExpectedAfterMethod,
    ClosingBraceExpected,
    ExpressionExpectedForTableEntry,
    ExpressionExpectedForTableKey,
    AssignSymbolExpectedAfterTableKey,
    ClosingBracketExpectedForTableKey,
    ConditionExpectedForWhileStatement,
    DoKeywordExpectedForWhileStatement,
    ConditionExpectedForRepeatStatement,
    ConditionExpectedForIfStatement,
    ConditionExpectedForElseIfClause,
    ThenKeywordExpectedForIfStatement,
    ThenKeywordExpectedForElseifClause,
    StartExpressionExpectedForNumericFor,
    EndExpressionExpectedForNumericFor,
    StepExpressionExpectedForNumericFor,
    CommaExpectedAfterStartExpressionOfNumericFor,
    DoExpectedForNumericFor,
    IdentifierExpectedAfterForKeyword,
    IdentifierExpectedForGenericFor,
    InKeywordExpectedForGenericFor,
    ExpressionExpectedForGenericFor,
    DoKeywordExpectedForGenericFor,
    IdentifierExpectedForLocalAssign,
    IdentifierExpectedForFunction,
    AssignSymbolExpectedForAssignStatement,
    ExpressionExpectedForAssignStatement,
    VariableExpectedForAssignStatement,
    Lexer(LexerErrorType),
}

This enum represents the various errors that may happen while parsing tokens into an AST (abstract syntax tree).

Variants

EndOfBlockExpectedAfterLastStatement

After parsing the last statement of a block (break or return statement), the parser expects a token to close the block (e.g. end, until, else).

EndExpectedAfterLastStatement

After parsing the last statement of a chunk (an entire file for example), the parser expects no more tokens.

RightExpressionExpected

After parsing a binary operator (+, and, or, ==, ...), the parser expects an expression to form a binary expression.

UnexpectedTokenForStatement

The parser was expecting a token that can start a statement.

TokenExpectedToCloseBlock

When parsing a block, a specific token is expected to close that block. For example, when parsing a do statement, the parser expects the keyword end to close the inner block. For a repeat statement, the parser expects the until keyword.

FunctionKeywordExpected

The parser was expecting the keyword function

OpeningParentheseExpectedForFunction

The parser was expecting a ( to begin the parameters definition of a function.

ClosingParentheseExpectedForFunction

The parser was expecting a ) to close the parameters definition of a function.

InvalidFunctionParameter

The parser expects a list of identifiers that may end with the variable arguments symbol (...), separated by commas. The error is return if another token is found.

ExpressionExpectedAfterUnaryOperator

The parser was expecting an expression after a unary operator (#, - or not)

ExpressionExpectedAfterOpeningParenthese

After opening a parenthese (as an expression, not a call to a function or method), the parser expects an expression.

ClosingParentheseExpected

When parsing a parenthese expression, the parser expects a closing parenthese after the expression.

ClosingBracketExpected

When opening a bracket ([) to index another value, the parse expects an expression followed with a closing bracket (]).

ArgumentsExpectedAfterMethod

When parsing a method call, the parser expects arguments after the method name.

ClosingBraceExpected

When parsing a table, the parser expects a closing brace to close that table.

ExpressionExpectedForTableEntry

The parser expects an expression after the = when parsing a field entry in a table ({ key = expect_expression_here }).

ExpressionExpectedForTableKey

The parser expects an expression between brackets when parsing a table entry key ({ [expect_expression_here] = value }).

AssignSymbolExpectedAfterTableKey

After parsing a table entry key ([key] = ...), the parser expects an assign symbol (=).

ClosingBracketExpectedForTableKey

When parsing a table key using brackets, the parser expects a closing bracket after the expression.

ConditionExpectedForWhileStatement

When parsing a while statement, the parser expects an expression after the while keyword.

DoKeywordExpectedForWhileStatement

When parsing a while statement, the parser expects the keyword do after the condition.

ConditionExpectedForRepeatStatement

When parsing a repeat statement, the parser expects an expression after the until keyword.

ConditionExpectedForIfStatement

When parsing an if statement, an expression is expected after the if keyword.

ConditionExpectedForElseIfClause

When parsing an if statement, an expression is expected after an elseif keyword.

ThenKeywordExpectedForIfStatement

When parsing an if statement, a then keyword is expected after the condition.

ThenKeywordExpectedForElseifClause

When parsing an else-if clase, a then keyword is expected after the condition.

StartExpressionExpectedForNumericFor

When declaring a numeric for statement, the parser expects an expression after the assign symbol (=) to specify the starting value.

EndExpressionExpectedForNumericFor

When declaring a numeric for statement, the parser expects an expression after the comma (,) to specify the ending value.

StepExpressionExpectedForNumericFor

When declaring a numeric for statement, the parser expects an expression after the comma following the end expression.

CommaExpectedAfterStartExpressionOfNumericFor

When declaring a numeric for statement, the parser expects a comma after the start expression.

DoExpectedForNumericFor

When declaring a numeric for statement, the parser expects the keyword do after the ending expression or the step expression.

IdentifierExpectedAfterForKeyword

An identifier is expected after a for keyword.

IdentifierExpectedForGenericFor

When parsing the identifier list of a generic for statement, the parser expects an identifier after each comma.

InKeywordExpectedForGenericFor

After parsing the identifier list of a generic for statement, the parser expects the in keyword.

ExpressionExpectedForGenericFor

After the in keyword, an expression is expected.

DoKeywordExpectedForGenericFor

After parsing the expression list of a generic for statement, the parser expects the do keyword.

IdentifierExpectedForLocalAssign

When parsing a local assignement, the parser expects at least one identifier.

IdentifierExpectedForFunction

When parsing a function definition, an identifier is expected after the function keyword or after every dot (.) symbol in the function name.

AssignSymbolExpectedForAssignStatement

The parser expects an identifier to access a field of an expression.

ExpressionExpectedForAssignStatement

When parsing an assign statement, the parser expects an expression after the assign (=) symbol and after each commas following an expression after the assign symbol.

VariableExpectedForAssignStatement

After a comma following a variable in an assign statement, another variable is expected.

Lexer(LexerErrorType)

Wraps the error thrown by the tokenization process.

Trait Implementations

impl Clone for ParsingError[src]

impl Debug for ParsingError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.