42afd6a0eb
Since the AST should reflect its logical structure as close as possible, I revert the changes from #2. This PR also renames nodes with more appropriate names. BREAKING CHANGE: - rename `file` with `document`. - rename `table_array` with `table_array_element`. - unflatten `table` and `table_array_element`, i.e., `pair`s are now their children instead of siblings.
229 lines
5.4 KiB
Plaintext
229 lines
5.4 KiB
Plaintext
================================================================================
|
|
VALID - empty file
|
|
================================================================================
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(document)
|
|
|
|
================================================================================
|
|
INVALID - key/value pair - multiline string for keys are not allowed
|
|
================================================================================
|
|
|
|
"""
|
|
invalid
|
|
multiline
|
|
basic
|
|
key
|
|
""" = false
|
|
|
|
'''
|
|
invalid
|
|
multiline
|
|
literal
|
|
key
|
|
''' = false
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(document
|
|
(pair
|
|
(key) (ERROR) (boolean))
|
|
(pair
|
|
(key) (ERROR) (boolean)))
|
|
|
|
================================================================================
|
|
INVALID - float - whitespaces between its components are not allowed
|
|
================================================================================
|
|
|
|
invalid_fractional = 1 .0
|
|
invalid_exponent = 1 e 2
|
|
invalid_both = 1 .0 e 2
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(document
|
|
(ERROR
|
|
(key) (integer)))
|
|
|
|
================================================================================
|
|
INVALID - offset date time - whitespaces between its components are not allowed
|
|
================================================================================
|
|
|
|
invalid1 = 1979-05-27 07:32:00 Z
|
|
invalid2 = 1979-05-27 T 07:32:00 Z
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(document
|
|
(ERROR
|
|
(key) (local_date) (local_time) (local_time)))
|
|
|
|
================================================================================
|
|
INVALID - local date time - whitespaces between its components are not allowed
|
|
================================================================================
|
|
|
|
invalid1 = 1979-05-27 07:32:00
|
|
invalid2 = 1979-05-27 T 07:32:00
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(document
|
|
(ERROR
|
|
(key) (local_date) (local_time) (local_time)))
|
|
|
|
================================================================================
|
|
VALID - local date - trailing whitespaces are allowed
|
|
================================================================================
|
|
|
|
valid = 1979-05-27
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(document
|
|
(pair
|
|
(key) (local_date)))
|
|
|
|
================================================================================
|
|
INVALID - table - multiline string for header keys are not allowed
|
|
================================================================================
|
|
|
|
["""
|
|
invalid
|
|
multiline
|
|
basic
|
|
key
|
|
"""]
|
|
|
|
['''
|
|
invalid
|
|
multiline
|
|
basic
|
|
key
|
|
''']
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(document
|
|
(table
|
|
(key) (ERROR))
|
|
(table
|
|
(key) (ERROR)))
|
|
|
|
================================================================================
|
|
INVALID - inline table - newlines outside of pairs are not allowed
|
|
================================================================================
|
|
|
|
key = {
|
|
newline = true
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(document
|
|
(pair
|
|
(key)
|
|
(inline_table
|
|
(ERROR)
|
|
(pair
|
|
(key) (boolean))
|
|
(ERROR))))
|
|
|
|
================================================================================
|
|
INVALID - array of tables - multiline string for header keys are not allowed
|
|
================================================================================
|
|
|
|
[["""
|
|
invalid
|
|
multiline
|
|
basic
|
|
key
|
|
"""]]
|
|
|
|
[['''
|
|
invalid
|
|
multiline
|
|
basic
|
|
key
|
|
''']]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(document
|
|
(ERROR
|
|
(key) (key)))
|
|
|
|
================================================================================
|
|
VALID - table - empty content separated by comments
|
|
================================================================================
|
|
|
|
[table]
|
|
|
|
# comment
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(document
|
|
(table
|
|
(key) (comment)))
|
|
|
|
================================================================================
|
|
VALID - array of tables - empty content separated by comments
|
|
================================================================================
|
|
|
|
[[array-table]]
|
|
|
|
# comment
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(document
|
|
(table_array_element
|
|
(key) (comment)))
|
|
|
|
================================================================================
|
|
VALID - table - two pairs separated by comments
|
|
================================================================================
|
|
|
|
[table]
|
|
|
|
a = 1
|
|
|
|
# comment
|
|
|
|
b = 2
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(document
|
|
(table
|
|
(key)
|
|
(pair
|
|
(key) (integer))
|
|
(comment)
|
|
(pair
|
|
(key) (integer))))
|
|
|
|
================================================================================
|
|
VALID - array of tables - two pairs separated by comments
|
|
================================================================================
|
|
|
|
[[array-table]]
|
|
|
|
a = 1
|
|
|
|
# comment
|
|
|
|
b = 2
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(document
|
|
(table_array_element
|
|
(key)
|
|
(pair
|
|
(key) (integer))
|
|
(comment)
|
|
(pair
|
|
(key) (integer))))
|