[ { "Label": "complex_literal", "Input": "a = {1, 2, three = 3, ['four'] = 4, [2+3] = 5}", "AST": { "Type": "Block", "Range": { "Start": 0, "End": 46 }, "Stmts": [ { "Type": "AssignmentStatement", "Range": { "Start": 0, "End": 46 }, "Vars": [ { "Type": "Identifier", "Range": { "Start": 0, "End": 1 }, "Literal": "a" } ], "Exps": [ { "Type": "TableLiteral", "Range": { "Start": 4, "End": 46 }, "Fields": [ { "Type": "TableField", "Range": { "Start": 5, "End": 6 }, "Key": null, "Value": { "Type": "NumberLiteral", "Range": { "Start": 5, "End": 6 }, "Literal": "1", "Value": 1 } }, { "Type": "TableField", "Range": { "Start": 8, "End": 9 }, "Key": null, "Value": { "Type": "NumberLiteral", "Range": { "Start": 8, "End": 9 }, "Literal": "2", "Value": 2 } }, { "Type": "TableField", "Range": { "Start": 11, "End": 20 }, "Key": { "Type": "Identifier", "Range": { "Start": 11, "End": 16 }, "Literal": "three" }, "Value": { "Type": "NumberLiteral", "Range": { "Start": 19, "End": 20 }, "Literal": "3", "Value": 3 } }, { "Type": "TableField", "Range": { "Start": 22, "End": 34 }, "Key": { "Type": "StringLiteral", "Range": { "Start": 23, "End": 29 }, "Literal": "'four'" }, "Value": { "Type": "NumberLiteral", "Range": { "Start": 33, "End": 34 }, "Literal": "4", "Value": 4 } }, { "Type": "TableField", "Range": { "Start": 36, "End": 45 }, "Key": { "Type": "InfixExpression", "Range": { "Start": 37, "End": 40 }, "Left": { "Type": "NumberLiteral", "Range": { "Start": 37, "End": 38 }, "Literal": "2", "Value": 2 }, "Operator": "plus", "Right": { "Type": "NumberLiteral", "Range": { "Start": 39, "End": 40 }, "Literal": "3", "Value": 3 } }, "Value": { "Type": "NumberLiteral", "Range": { "Start": 44, "End": 45 }, "Literal": "5", "Value": 5 } } ], "StartPos": 4 } ] } ] } }, { "Label": "missing_end_brace_eof", "Input": "local tbl = {", "AST": { "Type": "Block", "Range": { "Start": 0, "End": 13 }, "Stmts": [ { "Type": "LocalStatement", "Range": { "Start": 0, "End": 13 }, "Names": [ { "Type": "Identifier", "Range": { "Start": 6, "End": 9 }, "Literal": "tbl" } ], "Exps": [ { "Type": "TableLiteral", "Range": { "Start": 12, "End": 13 }, "Fields": [ { "Type": "TableField", "Range": { "Start": 13, "End": 13 }, "Key": null, "Value": { "Type": "Invalid", "Range": { "Start": 13, "End": 13 }, "Token": { "Type": "eof", "Literal": "", "Pos": 13 } } } ], "StartPos": 12 } ] } ] }, "Errors": [ { "Message": "Expected expression, got eof", "Range": { "Start": 13, "End": 13 } }, { "Message": "Expected right brace, got eof", "Range": { "Start": 13, "End": 13 } } ] }, { "Label": "unwrapped_expression_key", "Input": "local tbl = {foo.bar = 'baz'}", "AST": { "Type": "Block", "Range": { "Start": 0, "End": 29 }, "Stmts": [ { "Type": "LocalStatement", "Range": { "Start": 0, "End": 29 }, "Names": [ { "Type": "Identifier", "Range": { "Start": 6, "End": 9 }, "Literal": "tbl" } ], "Exps": [ { "Type": "TableLiteral", "Range": { "Start": 12, "End": 29 }, "Fields": [ { "Type": "TableField", "Range": { "Start": 13, "End": 28 }, "Key": { "Type": "IndexExpression", "Range": { "Start": 13, "End": 20 }, "Left": { "Type": "Identifier", "Range": { "Start": 13, "End": 16 }, "Literal": "foo" }, "Indexer": "dot", "Inner": { "Type": "Identifier", "Range": { "Start": 17, "End": 20 }, "Literal": "bar" } }, "Value": { "Type": "StringLiteral", "Range": { "Start": 23, "End": 28 }, "Literal": "'baz'" } } ], "StartPos": 12 } ] } ] }, "Errors": [ { "Message": "Missing brackets around expression key", "Range": { "Start": 13, "End": 20 } } ] } ]