Syntax Errors

This page contains all of the errors listed in the SyntaxError category.

SyntaxError;
    -> WrongSyntaxOnDataType;
        // Category used when entering a type of data without its proper syntax
        --> WrongSyntaxOnString;
            // Specific case when there's the wrong character (or none) on string data (text)
            // e.g. `str myString = MyText;` (missing quotes)
        --> WrongSyntaxOnCharacter;
            // Used with characters:
            // e.g. `char myChar = "A";` (wrong use of quotes)
        --> WrongSyntaxOnInteger;
            // e.g. `int myInteger = A;` (using non-numeric characters)
        --> WrongSyntaxOnBoolean;
            // e.g. `bool myBoolean = "A";` or `bool myBoolean = 1` (wrong syntax for boolean literals)
        --> WrongSyntaxOnDouble;
            // e.g. `dbl myDouble = A;` (using non-numeric data type)

    -> MissingSemicolon;
        // When the line (statement) doesn't end with a semicolon
        // e.g. `int myInteger = 1` (missing semicolon)

    -> MissingBraces;
        // When opening or closing braces are missing in function definitions
        --> MissingBothBraces;
            // e.g. `con.out << "Hello World!";` (missing both opening and closing braces)
        --> MissingOpeningBrace;
            // e.g. `con.out << "Hello World!"};` (missing opening brace)
        --> MissingClosingBrace;
            // e.g. `con.out{<< "Hello World!";` (missing closing brace)

    -> UnexpectedToken;
        // When a token that is not expected in the current context is found
        // e.g. `int 1 = myInteger;` (numeric character at the beginning of an identifier)
        --> UnexpectedKeyword;
            // e.g. `int #incd = 5;` (using a reserved keyword or function as an identifier)
        --> UnexpectedSymbol;
            // e.g. `int myInteger = @;` (use of an unexpected symbol in an expression)

    -> UnclosedStringLiteral;
        // When a string literal is not properly closed with a matching quote
        // e.g. `str myString = "This string is not closed;` (missing closing quote)

    -> InvalidAssignment;
        // When there's an invalid assignment operation, such as trying to assign a value of the wrong type
        --> AssigningToLiteral;
            // e.g. `"Hello" = myString;` (attempt to assign a value to a literal)
        --> InvalidOperatorUsage;
            // e.g. `int myInteger = 1 + "2";` (invalid operation between different types)

    -> IncorrectFunctionCallSyntax;
        // Errors related to the incorrect syntax when calling a function
        --> MissingFunctionName;
            // e.g. `{<< "Hello World"};` (missing function name before braces)
        --> MissingParameters;
            // e.g. `con.out{};` (when parameters are expected but not provided)

    -> InvalidVariableDeclaration;
        // Error in variable declaration, such as using invalid characters or wrong syntax
        --> InvalidIdentifierName;
            // e.g. `int 123abc = 5;` (identifier contains number/s)
        --> MissingTypeDeclaration;
            // e.g. `myVariable = 10;` (missing type declaration before variable)

    -> IncorrectLoopSyntax;
        // Errors specific to the syntax used in loops
        --> IncorrectWhileLoopSyntax;
            // e.g. `while (myInteger = 1) : {con.out{<< "Looping";};` (used "=" instead of "==" in condition)
        --> IncorrectForLoopSyntax;
            // e.g. `for (int i == 0, i < 10, i<+) > {con.out{<< i};};` (used "==" instead of "=" in the first condition)

    -> IncorrectConditionSyntax;
        // Errors specific to the syntax used in conditional statements
        --> IncorrectIfSyntax;
            // e.g. Missing braces around code block
        --> IncorrectSwitchSyntax;
            // e.g. Missing braces around code block
        --> WrongSwitchDataType;
            // e.g. When checking for a string literal in a switch.int condition
        --> NotEnoughSwitchCases;
            // When there are <2 cases in a switch condition

Last updated