Add map expressions
This commit is contained in:
parent
e13f15e8db
commit
db2e88a539
5 changed files with 912 additions and 268 deletions
|
|
@ -186,3 +186,120 @@ foo = [
|
|||
(identifier)
|
||||
(list_expression
|
||||
(ERROR))))
|
||||
|
||||
================================================================================
|
||||
Map (empty)
|
||||
================================================================================
|
||||
|
||||
foo = {}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(assignment
|
||||
(identifier)
|
||||
(map_expression)))
|
||||
|
||||
================================================================================
|
||||
Map (singleton)
|
||||
================================================================================
|
||||
|
||||
foo = {foo:42}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(assignment
|
||||
(identifier)
|
||||
(map_expression
|
||||
(identifier)
|
||||
(integer_literal))))
|
||||
|
||||
================================================================================
|
||||
Map (singleton multiline)
|
||||
================================================================================
|
||||
|
||||
foo = {
|
||||
foo: 42
|
||||
}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(assignment
|
||||
(identifier)
|
||||
(map_expression
|
||||
(identifier)
|
||||
(integer_literal))))
|
||||
|
||||
================================================================================
|
||||
Map (singleton trailing comma)
|
||||
================================================================================
|
||||
|
||||
foo = {
|
||||
foo: 42,
|
||||
}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(assignment
|
||||
(identifier)
|
||||
(map_expression
|
||||
(identifier)
|
||||
(integer_literal))))
|
||||
|
||||
================================================================================
|
||||
Map (mixed values)
|
||||
================================================================================
|
||||
|
||||
foo = {
|
||||
answer: 42,
|
||||
value: "foobar",
|
||||
}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(assignment
|
||||
(identifier)
|
||||
(map_expression
|
||||
(identifier)
|
||||
(integer_literal)
|
||||
(identifier)
|
||||
(interpreted_string_literal))))
|
||||
|
||||
================================================================================
|
||||
Map (map of map)
|
||||
================================================================================
|
||||
|
||||
foo = {
|
||||
the: {answer: 42},
|
||||
}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(assignment
|
||||
(identifier)
|
||||
(map_expression
|
||||
(identifier)
|
||||
(map_expression
|
||||
(identifier)
|
||||
(integer_literal)))))
|
||||
|
||||
================================================================================
|
||||
Map (rogue comma)
|
||||
================================================================================
|
||||
|
||||
foo = {
|
||||
,
|
||||
}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(assignment
|
||||
(identifier)
|
||||
(map_expression
|
||||
(ERROR))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue