2024-04-08 00:39:47 +02:00
|
|
|
================================================================================
|
|
|
|
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)))
|
|
|
|
|
2024-04-07 23:49:15 +02:00
|
|
|
================================================================================
|
|
|
|
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)))
|
2024-04-08 00:16:31 +02:00
|
|
|
|
|
|
|
================================================================================
|
|
|
|
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)))
|
2024-04-08 00:24:14 +02:00
|
|
|
|
|
|
|
================================================================================
|
|
|
|
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))))
|
2024-04-08 00:36:21 +02:00
|
|
|
|
|
|
|
================================================================================
|
|
|
|
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))))
|