Commit Graph

3 Commits

Author SHA1 Message Date
Bob Nystrom
075f487b6e refactor: restructure list/map compilation loops and extract syntax error tests
- Convert list() and map() compiler functions from if/do-while to do-while loops
- Remove redundant empty literal handling by breaking on right bracket/brace
- Add new test files for duplicate comma, duplicate trailing comma, and empty list/map with comma
- Expand newlines test to cover trailing comma and empty list/map cases
- Simplify trailing_comma tests by removing inline syntax error checks
- Update Test.fail() to handle variable arguments without kwargs
2015-08-31 14:23:36 +00:00
Lukas Werling
d608a03244 test: add invalid trailing comma tests for list and map literals
Add test cases verifying that invalid trailing comma syntaxes in list literals
(e.g. `[,]`, `[1,,]`, `[1,,2]`) and map literals (e.g. `{,}`, `{1:1,,}`, `{1:1,,2:2}`)
correctly produce compile errors when evaluated via Meta.eval in a Fiber.
2015-05-30 20:17:12 +00:00
Lukas Werling
bf3aea5755 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.
2015-05-30 20:17:58 +00:00