340 lines
8.1 KiB
Plaintext
340 lines
8.1 KiB
Plaintext
================================================================================
|
|
Boolean
|
|
================================================================================
|
|
|
|
foo = false
|
|
foo = true
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(identifier)
|
|
(boolean_literal))
|
|
(assignment
|
|
(identifier)
|
|
(boolean_literal)))
|
|
|
|
================================================================================
|
|
Boolean (identifier/literal)
|
|
================================================================================
|
|
|
|
true = false
|
|
false = true
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(identifier)
|
|
(boolean_literal))
|
|
(assignment
|
|
(identifier)
|
|
(boolean_literal)))
|
|
|
|
================================================================================
|
|
Integer
|
|
================================================================================
|
|
|
|
foo = 0
|
|
foo = 42
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(identifier)
|
|
(integer_literal))
|
|
(assignment
|
|
(identifier)
|
|
(integer_literal)))
|
|
|
|
================================================================================
|
|
Integer (negative)
|
|
================================================================================
|
|
|
|
foo = -0
|
|
foo = -42
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(identifier)
|
|
(integer_literal))
|
|
(assignment
|
|
(identifier)
|
|
(integer_literal)))
|
|
|
|
================================================================================
|
|
String
|
|
================================================================================
|
|
|
|
foo = "Hello World!"
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(identifier)
|
|
(interpreted_string_literal)))
|
|
|
|
================================================================================
|
|
String (escape)
|
|
================================================================================
|
|
|
|
foo = "Hello\nWorld!"
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(identifier)
|
|
(interpreted_string_literal
|
|
(escape_sequence))))
|
|
|
|
================================================================================
|
|
String (raw)
|
|
================================================================================
|
|
|
|
foo = `Hello\nWorld!`
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(identifier)
|
|
(raw_string_literal)))
|
|
|
|
================================================================================
|
|
List (empty)
|
|
================================================================================
|
|
|
|
foo = []
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(identifier)
|
|
(list_expression)))
|
|
|
|
================================================================================
|
|
List (singleton)
|
|
================================================================================
|
|
|
|
foo = [42]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(identifier)
|
|
(list_expression
|
|
(integer_literal))))
|
|
|
|
================================================================================
|
|
List (singleton multiline)
|
|
================================================================================
|
|
|
|
foo = [
|
|
42
|
|
]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(identifier)
|
|
(list_expression
|
|
(integer_literal))))
|
|
|
|
================================================================================
|
|
List (singleton trailing comma)
|
|
================================================================================
|
|
|
|
foo = [
|
|
42,
|
|
]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(identifier)
|
|
(list_expression
|
|
(integer_literal))))
|
|
|
|
================================================================================
|
|
List (mixed values)
|
|
================================================================================
|
|
|
|
foo = [
|
|
42,
|
|
"foobar",
|
|
]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(identifier)
|
|
(list_expression
|
|
(integer_literal)
|
|
(interpreted_string_literal))))
|
|
|
|
================================================================================
|
|
List (list of list)
|
|
================================================================================
|
|
|
|
foo = [
|
|
[42],
|
|
["foobar"],
|
|
[],
|
|
]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(identifier)
|
|
(list_expression
|
|
(list_expression
|
|
(integer_literal))
|
|
(list_expression
|
|
(interpreted_string_literal))
|
|
(list_expression))))
|
|
|
|
================================================================================
|
|
List (rogue comma)
|
|
================================================================================
|
|
|
|
foo = [
|
|
,
|
|
]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(assignment
|
|
(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))))
|