feat: allow trailing comma in map literal by checking right brace in parser

Add a check in the map parsing function to break when encountering a closing brace after a comma, enabling trailing commas in map literals. Include a test case verifying that maps with trailing commas parse and execute correctly.
This commit is contained in:
Lukas Werling
2015-05-30 20:17:58 +00:00
parent 6b40c5b3f5
commit bf3aea5755
2 changed files with 10 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
var map = {
"a": 1,
"b": 2,
}
IO.print(map["a"]) // expect: 1
IO.print(map["b"]) // expect: 2