boolangery / py-lua-parser

A Lua parser and AST builder written in Python.
MIT License
124 stars 39 forks source link

Fail to reject unassigned global variable declaration #29

Closed bendrissou closed 1 year ago

bendrissou commented 1 year ago

When a program contains an uninitialized declaration of a global variable. The parser should reject it, as per the specification. However the parser accepts and prints the AST, without raising an error.

Example:

var

Output:

{
    "Chunk": {
        "body": {
            "Block": {
                "body": [
                    {
                        "Name": {
                            "id": "var",
                            "start_char": 0,
                            "stop_char": 2,
                            "line": 1
                        }
                    }
                ],
                "start_char": 0,
                "stop_char": 2,
                "line": 1
            }
        },
        "start_char": 0,
        "stop_char": 2,
        "line": 1
    }
}