chore: use tree-sitter-cli@0.15.9-custom
This commit is contained in:
parent
cca06a9f61
commit
1e70956efb
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
/build
|
/build
|
||||||
/node_modules
|
/node_modules
|
||||||
|
/tree-sitter
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"trailingComma": "all"
|
|
||||||
}
|
|
15
.travis.yml
15
.travis.yml
|
@ -1,16 +1,13 @@
|
||||||
language: node_js
|
language: rust
|
||||||
|
|
||||||
node_js:
|
rust:
|
||||||
- stable
|
- stable
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- yarn lint
|
- if [ ! -d "./tree-sitter/target/release" ]; then bash ./scripts/setup-tree-sitter.sh; fi
|
||||||
- yarn test
|
- ./tree-sitter/target/release/tree-sitter test
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
yarn: true
|
cargo: true
|
||||||
directories:
|
directories:
|
||||||
- node_modules
|
- ./tree-sitter
|
||||||
|
|
||||||
matrix:
|
|
||||||
fast_finish: true
|
|
||||||
|
|
|
@ -28,9 +28,13 @@ key
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (ERROR) (boolean))
|
(key)
|
||||||
|
(ERROR)
|
||||||
|
(boolean))
|
||||||
(pair
|
(pair
|
||||||
(key) (ERROR) (boolean)))
|
(key)
|
||||||
|
(ERROR)
|
||||||
|
(boolean)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
INVALID - float - whitespaces between its components are not allowed
|
INVALID - float - whitespaces between its components are not allowed
|
||||||
|
@ -44,7 +48,8 @@ invalid_both = 1 .0 e 2
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(ERROR
|
(ERROR
|
||||||
(key) (integer)))
|
(key)
|
||||||
|
(integer)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
INVALID - offset date time - whitespaces between its components are not allowed
|
INVALID - offset date time - whitespaces between its components are not allowed
|
||||||
|
@ -57,7 +62,10 @@ invalid2 = 1979-05-27 T 07:32:00 Z
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(ERROR
|
(ERROR
|
||||||
(key) (local_date) (local_time) (local_time)))
|
(key)
|
||||||
|
(local_date)
|
||||||
|
(local_time)
|
||||||
|
(local_time)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
INVALID - local date time - whitespaces between its components are not allowed
|
INVALID - local date time - whitespaces between its components are not allowed
|
||||||
|
@ -70,7 +78,10 @@ invalid2 = 1979-05-27 T 07:32:00
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(ERROR
|
(ERROR
|
||||||
(key) (local_date) (local_time) (local_time)))
|
(key)
|
||||||
|
(local_date)
|
||||||
|
(local_time)
|
||||||
|
(local_time)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - local date - trailing whitespaces are allowed
|
VALID - local date - trailing whitespaces are allowed
|
||||||
|
@ -82,7 +93,8 @@ valid = 1979-05-27
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (local_date)))
|
(key)
|
||||||
|
(local_date)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
INVALID - table - multiline string for header keys are not allowed
|
INVALID - table - multiline string for header keys are not allowed
|
||||||
|
@ -106,9 +118,11 @@ key
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(table
|
(table
|
||||||
(key) (ERROR))
|
(key)
|
||||||
|
(ERROR))
|
||||||
(table
|
(table
|
||||||
(key) (ERROR)))
|
(key)
|
||||||
|
(ERROR)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
INVALID - inline table - newlines outside of pairs are not allowed
|
INVALID - inline table - newlines outside of pairs are not allowed
|
||||||
|
@ -126,7 +140,8 @@ key = {
|
||||||
(inline_table
|
(inline_table
|
||||||
(ERROR)
|
(ERROR)
|
||||||
(pair
|
(pair
|
||||||
(key) (boolean))
|
(key)
|
||||||
|
(boolean))
|
||||||
(ERROR))))
|
(ERROR))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -151,7 +166,8 @@ key
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(ERROR
|
(ERROR
|
||||||
(key) (key)))
|
(key)
|
||||||
|
(key)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - table - empty content separated by comments
|
VALID - table - empty content separated by comments
|
||||||
|
@ -165,7 +181,8 @@ VALID - table - empty content separated by comments
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(table
|
(table
|
||||||
(key) (comment)))
|
(key)
|
||||||
|
(comment)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - array of tables - empty content separated by comments
|
VALID - array of tables - empty content separated by comments
|
||||||
|
@ -179,7 +196,8 @@ VALID - array of tables - empty content separated by comments
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(table_array_element
|
(table_array_element
|
||||||
(key) (comment)))
|
(key)
|
||||||
|
(comment)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - table - two pairs separated by comments
|
VALID - table - two pairs separated by comments
|
||||||
|
@ -199,10 +217,12 @@ b = 2
|
||||||
(table
|
(table
|
||||||
(key)
|
(key)
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))
|
(key)
|
||||||
|
(integer))
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))))
|
(key)
|
||||||
|
(integer))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - array of tables - two pairs separated by comments
|
VALID - array of tables - two pairs separated by comments
|
||||||
|
@ -222,7 +242,9 @@ b = 2
|
||||||
(table_array_element
|
(table_array_element
|
||||||
(key)
|
(key)
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))
|
(key)
|
||||||
|
(integer))
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))))
|
(key)
|
||||||
|
(integer))))
|
||||||
|
|
410
corpus/spec.txt
410
corpus/spec.txt
|
@ -10,7 +10,9 @@ key = "value" # This is a comment at the end of a line
|
||||||
(document
|
(document
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (string) (comment)))
|
(key)
|
||||||
|
(string)
|
||||||
|
(comment)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - key/value pair - basic
|
VALID - key/value pair - basic
|
||||||
|
@ -22,7 +24,8 @@ key = "value"
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (string)))
|
(key)
|
||||||
|
(string)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
INVALID - key/value pair - empty value
|
INVALID - key/value pair - empty value
|
||||||
|
@ -34,7 +37,8 @@ key = # INVALID
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(ERROR
|
(ERROR
|
||||||
(key) (comment)))
|
(key)
|
||||||
|
(comment)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - keys - bare keys
|
VALID - keys - bare keys
|
||||||
|
@ -49,13 +53,17 @@ bare-key = "value"
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string)))
|
(key)
|
||||||
|
(string)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - keys - quoted keys
|
VALID - keys - quoted keys
|
||||||
|
@ -71,15 +79,20 @@ VALID - keys - quoted keys
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string)))
|
(key)
|
||||||
|
(string)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
INVALID - keys - empty bare key
|
INVALID - keys - empty bare key
|
||||||
|
@ -98,9 +111,13 @@ INVALID - keys - empty bare key
|
||||||
(string)
|
(string)
|
||||||
(comment))
|
(comment))
|
||||||
(pair
|
(pair
|
||||||
(key) (string) (comment))
|
(key)
|
||||||
|
(string)
|
||||||
|
(comment))
|
||||||
(pair
|
(pair
|
||||||
(key) (string) (comment)))
|
(key)
|
||||||
|
(string)
|
||||||
|
(comment)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - keys - dotted keys
|
VALID - keys - dotted keys
|
||||||
|
@ -115,18 +132,22 @@ site."google.com" = true
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
(pair
|
|
||||||
(dotted_key
|
|
||||||
(key) (key))
|
|
||||||
(string))
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(string))
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
|
(string))
|
||||||
|
(pair
|
||||||
|
(dotted_key
|
||||||
|
(key)
|
||||||
|
(key))
|
||||||
(boolean)))
|
(boolean)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -142,9 +163,11 @@ name = "Pradyun"
|
||||||
(document
|
(document
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string)))
|
(key)
|
||||||
|
(string)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - keys - directly defined nested keys
|
VALID - keys - directly defined nested keys
|
||||||
|
@ -159,12 +182,14 @@ a.d = 2
|
||||||
(pair
|
(pair
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(key))
|
(key))
|
||||||
(integer))
|
(integer))
|
||||||
(pair
|
(pair
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(integer)))
|
(integer)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -181,12 +206,14 @@ a.b.c = 2
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(integer))
|
(integer))
|
||||||
(pair
|
(pair
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(key))
|
(key))
|
||||||
(integer)))
|
(integer)))
|
||||||
|
|
||||||
|
@ -202,7 +229,12 @@ str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."
|
||||||
(pair
|
(pair
|
||||||
(key)
|
(key)
|
||||||
(string
|
(string
|
||||||
(escape_sequence) (escape_sequence) (escape_sequence) (escape_sequence) (escape_sequence) (escape_sequence))))
|
(escape_sequence)
|
||||||
|
(escape_sequence)
|
||||||
|
(escape_sequence)
|
||||||
|
(escape_sequence)
|
||||||
|
(escape_sequence)
|
||||||
|
(escape_sequence))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - string - multi-line basic strings
|
VALID - string - multi-line basic strings
|
||||||
|
@ -216,7 +248,8 @@ Violets are blue"""
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (string)))
|
(key)
|
||||||
|
(string)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - string - multi-line basic strings with trailing backslashes
|
VALID - string - multi-line basic strings with trailing backslashes
|
||||||
|
@ -243,15 +276,20 @@ str3 = """\
|
||||||
(document
|
(document
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key)
|
(key)
|
||||||
(string
|
(string
|
||||||
(escape_sequence) (escape_sequence)))
|
(escape_sequence)
|
||||||
|
(escape_sequence)))
|
||||||
(pair
|
(pair
|
||||||
(key)
|
(key)
|
||||||
(string
|
(string
|
||||||
(escape_sequence) (escape_sequence) (escape_sequence) (escape_sequence))))
|
(escape_sequence)
|
||||||
|
(escape_sequence)
|
||||||
|
(escape_sequence)
|
||||||
|
(escape_sequence))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - string - literal strings
|
VALID - string - literal strings
|
||||||
|
@ -268,13 +306,17 @@ regex = '<\i\c*\s*>'
|
||||||
(document
|
(document
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string)))
|
(key)
|
||||||
|
(string)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - string - multi-line literal strings
|
VALID - string - multi-line literal strings
|
||||||
|
@ -292,9 +334,11 @@ trimmed in raw strings.
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string)))
|
(key)
|
||||||
|
(string)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - integer - signed/unsigned decimal integer
|
VALID - integer - signed/unsigned decimal integer
|
||||||
|
@ -309,13 +353,17 @@ int4 = -17
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))
|
(key)
|
||||||
|
(integer))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))
|
(key)
|
||||||
|
(integer))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))
|
(key)
|
||||||
|
(integer))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer)))
|
(key)
|
||||||
|
(integer)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - integer - decimal integer with underscores
|
VALID - integer - decimal integer with underscores
|
||||||
|
@ -329,11 +377,15 @@ int7 = 1_2_3_4_5 # VALID but discouraged
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))
|
(key)
|
||||||
|
(integer))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))
|
(key)
|
||||||
|
(integer))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer) (comment)))
|
(key)
|
||||||
|
(integer)
|
||||||
|
(comment)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - integer - hexadecimal/octal/binary integer
|
VALID - integer - hexadecimal/octal/binary integer
|
||||||
|
@ -356,19 +408,26 @@ bin1 = 0b11010110
|
||||||
(document
|
(document
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))
|
(key)
|
||||||
|
(integer))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))
|
(key)
|
||||||
|
(integer))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))
|
(key)
|
||||||
|
(integer))
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))
|
(key)
|
||||||
|
(integer))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer) (comment))
|
(key)
|
||||||
|
(integer)
|
||||||
|
(comment))
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (integer)))
|
(key)
|
||||||
|
(integer)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - float - float with fractional or exponent or both
|
VALID - float - float with fractional or exponent or both
|
||||||
|
@ -392,21 +451,28 @@ flt7 = 6.626e-34
|
||||||
(document
|
(document
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (float))
|
(key)
|
||||||
|
(float))
|
||||||
(pair
|
(pair
|
||||||
(key) (float))
|
(key)
|
||||||
|
(float))
|
||||||
(pair
|
(pair
|
||||||
(key) (float))
|
(key)
|
||||||
|
(float))
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (float))
|
(key)
|
||||||
|
(float))
|
||||||
(pair
|
(pair
|
||||||
(key) (float))
|
(key)
|
||||||
|
(float))
|
||||||
(pair
|
(pair
|
||||||
(key) (float))
|
(key)
|
||||||
|
(float))
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (float)))
|
(key)
|
||||||
|
(float)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - float - float with underscores
|
VALID - float - float with underscores
|
||||||
|
@ -418,7 +484,8 @@ flt8 = 9_224_617.445_991_228_313
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (float)))
|
(key)
|
||||||
|
(float)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - float - special float values
|
VALID - float - special float values
|
||||||
|
@ -439,18 +506,30 @@ sf6 = -nan # valid, actual encoding is implementation specific
|
||||||
(document
|
(document
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (float) (comment))
|
(key)
|
||||||
|
(float)
|
||||||
|
(comment))
|
||||||
(pair
|
(pair
|
||||||
(key) (float) (comment))
|
(key)
|
||||||
|
(float)
|
||||||
|
(comment))
|
||||||
(pair
|
(pair
|
||||||
(key) (float) (comment))
|
(key)
|
||||||
|
(float)
|
||||||
|
(comment))
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (float) (comment))
|
(key)
|
||||||
|
(float)
|
||||||
|
(comment))
|
||||||
(pair
|
(pair
|
||||||
(key) (float) (comment))
|
(key)
|
||||||
|
(float)
|
||||||
|
(comment))
|
||||||
(pair
|
(pair
|
||||||
(key) (float) (comment)))
|
(key)
|
||||||
|
(float)
|
||||||
|
(comment)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - boolean - basic
|
VALID - boolean - basic
|
||||||
|
@ -463,9 +542,11 @@ bool2 = false
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (boolean))
|
(key)
|
||||||
|
(boolean))
|
||||||
(pair
|
(pair
|
||||||
(key) (boolean)))
|
(key)
|
||||||
|
(boolean)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - offset date time - basic
|
VALID - offset date time - basic
|
||||||
|
@ -479,11 +560,14 @@ odt3 = 1979-05-27T00:32:00.999999-07:00
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (offset_date_time))
|
(key)
|
||||||
|
(offset_date_time))
|
||||||
(pair
|
(pair
|
||||||
(key) (offset_date_time))
|
(key)
|
||||||
|
(offset_date_time))
|
||||||
(pair
|
(pair
|
||||||
(key) (offset_date_time)))
|
(key)
|
||||||
|
(offset_date_time)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - offset date time - whitespace as delimiter
|
VALID - offset date time - whitespace as delimiter
|
||||||
|
@ -495,7 +579,8 @@ odt4 = 1979-05-27 07:32:00Z
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (offset_date_time)))
|
(key)
|
||||||
|
(offset_date_time)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - local date time - basic
|
VALID - local date time - basic
|
||||||
|
@ -508,9 +593,11 @@ ldt2 = 1979-05-27T00:32:00.999999
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (local_date_time))
|
(key)
|
||||||
|
(local_date_time))
|
||||||
(pair
|
(pair
|
||||||
(key) (local_date_time)))
|
(key)
|
||||||
|
(local_date_time)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - local date - basic
|
VALID - local date - basic
|
||||||
|
@ -522,7 +609,8 @@ ld1 = 1979-05-27
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (local_date)))
|
(key)
|
||||||
|
(local_date)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - local time - basic
|
VALID - local time - basic
|
||||||
|
@ -535,9 +623,11 @@ lt2 = 00:32:00.999999
|
||||||
|
|
||||||
(document
|
(document
|
||||||
(pair
|
(pair
|
||||||
(key) (local_time))
|
(key)
|
||||||
|
(local_time))
|
||||||
(pair
|
(pair
|
||||||
(key) (local_time)))
|
(key)
|
||||||
|
(local_time)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - array - basic (semantically INVALID for children with mixed types)
|
VALID - array - basic (semantically INVALID for children with mixed types)
|
||||||
|
@ -557,33 +647,47 @@ arr6 = [ 1, 2.0 ] # INVALID
|
||||||
(pair
|
(pair
|
||||||
(key)
|
(key)
|
||||||
(array
|
(array
|
||||||
(integer) (integer) (integer)))
|
(integer)
|
||||||
|
(integer)
|
||||||
|
(integer)))
|
||||||
(pair
|
(pair
|
||||||
(key)
|
(key)
|
||||||
(array
|
(array
|
||||||
(string) (string) (string)))
|
(string)
|
||||||
|
(string)
|
||||||
|
(string)))
|
||||||
(pair
|
(pair
|
||||||
(key)
|
(key)
|
||||||
(array
|
(array
|
||||||
(array
|
(array
|
||||||
(integer) (integer))
|
(integer)
|
||||||
|
(integer))
|
||||||
(array
|
(array
|
||||||
(integer) (integer) (integer))))
|
(integer)
|
||||||
|
(integer)
|
||||||
|
(integer))))
|
||||||
(pair
|
(pair
|
||||||
(key)
|
(key)
|
||||||
(array
|
(array
|
||||||
(string) (string) (string) (string)))
|
(string)
|
||||||
|
(string)
|
||||||
|
(string)
|
||||||
|
(string)))
|
||||||
(pair
|
(pair
|
||||||
(key)
|
(key)
|
||||||
(array
|
(array
|
||||||
(array
|
(array
|
||||||
(integer) (integer))
|
(integer)
|
||||||
|
(integer))
|
||||||
(array
|
(array
|
||||||
(string) (string) (string))))
|
(string)
|
||||||
|
(string)
|
||||||
|
(string))))
|
||||||
(pair
|
(pair
|
||||||
(key)
|
(key)
|
||||||
(array
|
(array
|
||||||
(integer) (float))
|
(integer)
|
||||||
|
(float))
|
||||||
(comment)))
|
(comment)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -605,11 +709,15 @@ arr8 = [
|
||||||
(pair
|
(pair
|
||||||
(key)
|
(key)
|
||||||
(array
|
(array
|
||||||
(integer) (integer) (integer)))
|
(integer)
|
||||||
|
(integer)
|
||||||
|
(integer)))
|
||||||
(pair
|
(pair
|
||||||
(key)
|
(key)
|
||||||
(array
|
(array
|
||||||
(integer) (integer) (comment))))
|
(integer)
|
||||||
|
(integer)
|
||||||
|
(comment))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - table - header
|
VALID - table - header
|
||||||
|
@ -641,15 +749,19 @@ key2 = 456
|
||||||
(table
|
(table
|
||||||
(key)
|
(key)
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer)))
|
(key)
|
||||||
|
(integer)))
|
||||||
(table
|
(table
|
||||||
(key)
|
(key)
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))))
|
(key)
|
||||||
|
(integer))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - table - header with dotted key
|
VALID - table - header with dotted key
|
||||||
|
@ -663,10 +775,12 @@ type.name = "pug"
|
||||||
(document
|
(document
|
||||||
(table
|
(table
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(pair
|
(pair
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(string))))
|
(string))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -684,25 +798,29 @@ VALID - table- header with whitespaces
|
||||||
(table
|
(table
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(key))
|
(key))
|
||||||
(comment))
|
(comment))
|
||||||
(table
|
(table
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(key))
|
(key))
|
||||||
(comment))
|
(comment))
|
||||||
(table
|
(table
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(key))
|
(key))
|
||||||
(comment))
|
(comment))
|
||||||
(table
|
(table
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(key))
|
(key))
|
||||||
(comment)))
|
(comment)))
|
||||||
|
|
||||||
|
@ -725,7 +843,8 @@ VALID - table - directly defined nested header key
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(key))
|
(key))
|
||||||
(key))
|
(key))
|
||||||
(comment)))
|
(comment)))
|
||||||
|
@ -749,11 +868,13 @@ c = 2
|
||||||
(table
|
(table
|
||||||
(key)
|
(key)
|
||||||
(pair
|
(pair
|
||||||
(key) (integer)))
|
(key)
|
||||||
|
(integer)))
|
||||||
(table
|
(table
|
||||||
(key)
|
(key)
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))))
|
(key)
|
||||||
|
(integer))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - table - overlapped header key (semantically INVALID)
|
VALID - table - overlapped header key (semantically INVALID)
|
||||||
|
@ -774,12 +895,15 @@ c = 2
|
||||||
(table
|
(table
|
||||||
(key)
|
(key)
|
||||||
(pair
|
(pair
|
||||||
(key) (integer)))
|
(key)
|
||||||
|
(integer)))
|
||||||
(table
|
(table
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))))
|
(key)
|
||||||
|
(integer))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - inline table - basic
|
VALID - inline table - basic
|
||||||
|
@ -796,22 +920,27 @@ animal = { type.name = "pug" }
|
||||||
(key)
|
(key)
|
||||||
(inline_table
|
(inline_table
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string))))
|
(key)
|
||||||
|
(string))))
|
||||||
(pair
|
(pair
|
||||||
(key)
|
(key)
|
||||||
(inline_table
|
(inline_table
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))
|
(key)
|
||||||
|
(integer))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))))
|
(key)
|
||||||
|
(integer))))
|
||||||
(pair
|
(pair
|
||||||
(key)
|
(key)
|
||||||
(inline_table
|
(inline_table
|
||||||
(pair
|
(pair
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(string)))))
|
(string)))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -835,19 +964,24 @@ color = "gray"
|
||||||
(table_array_element
|
(table_array_element
|
||||||
(key)
|
(key)
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer)))
|
(key)
|
||||||
|
(integer)))
|
||||||
(table_array_element
|
(table_array_element
|
||||||
(key))
|
(key))
|
||||||
(table_array_element
|
(table_array_element
|
||||||
(key)
|
(key)
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (integer))
|
(key)
|
||||||
|
(integer))
|
||||||
(pair
|
(pair
|
||||||
(key) (string))))
|
(key)
|
||||||
|
(string))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - array of tables - nested arrays of tables
|
VALID - array of tables - nested arrays of tables
|
||||||
|
@ -878,33 +1012,44 @@ VALID - array of tables - nested arrays of tables
|
||||||
(table_array_element
|
(table_array_element
|
||||||
(key)
|
(key)
|
||||||
(pair
|
(pair
|
||||||
(key) (string)))
|
(key)
|
||||||
|
(string)))
|
||||||
(table
|
(table
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(pair
|
(pair
|
||||||
(key) (string)))
|
(key)
|
||||||
|
(string)))
|
||||||
(table_array_element
|
(table_array_element
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(pair
|
(pair
|
||||||
(key) (string)))
|
(key)
|
||||||
|
(string)))
|
||||||
(table_array_element
|
(table_array_element
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(pair
|
(pair
|
||||||
(key) (string)))
|
(key)
|
||||||
|
(string)))
|
||||||
(table_array_element
|
(table_array_element
|
||||||
(key)
|
(key)
|
||||||
(pair
|
(pair
|
||||||
(key) (string)))
|
(key)
|
||||||
|
(string)))
|
||||||
(table_array_element
|
(table_array_element
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(pair
|
(pair
|
||||||
(key) (string))))
|
(key)
|
||||||
|
(string))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - array of tables - append to statically defined array (semantically INVALID)
|
VALID - array of tables - append to statically defined array (semantically INVALID)
|
||||||
|
@ -920,9 +1065,11 @@ fruit = []
|
||||||
(document
|
(document
|
||||||
(comment)
|
(comment)
|
||||||
(pair
|
(pair
|
||||||
(key) (array))
|
(key)
|
||||||
|
(array))
|
||||||
(table_array_element
|
(table_array_element
|
||||||
(key) (comment)))
|
(key)
|
||||||
|
(comment)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
VALID - array of tables - append to table (semantically INVALID)
|
VALID - array of tables - append to table (semantically INVALID)
|
||||||
|
@ -946,15 +1093,20 @@ VALID - array of tables - append to table (semantically INVALID)
|
||||||
(table_array_element
|
(table_array_element
|
||||||
(key)
|
(key)
|
||||||
(pair
|
(pair
|
||||||
(key) (string)))
|
(key)
|
||||||
|
(string)))
|
||||||
(table_array_element
|
(table_array_element
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(pair
|
(pair
|
||||||
(key) (string))
|
(key)
|
||||||
|
(string))
|
||||||
(comment))
|
(comment))
|
||||||
(table
|
(table
|
||||||
(dotted_key
|
(dotted_key
|
||||||
(key) (key))
|
(key)
|
||||||
|
(key))
|
||||||
(pair
|
(pair
|
||||||
(key) (string))))
|
(key)
|
||||||
|
(string))))
|
||||||
|
|
12
package.json
12
package.json
|
@ -16,19 +16,17 @@
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "prettier grammar.js --check",
|
"test": "yarn tree-sitter test",
|
||||||
"test": "tree-sitter test && tree-sitter parse examples/*.toml --quiet --time",
|
"prepack": "yarn tree-sitter generate",
|
||||||
"prepack": "tree-sitter generate",
|
"release": "standard-version",
|
||||||
"release": "standard-version"
|
"tree-sitter": "./tree-sitter/target/release/tree-sitter"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nan": "^2.14.0"
|
"nan": "^2.14.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"prettier": "1.18.2",
|
|
||||||
"regexp-util": "1.2.2",
|
"regexp-util": "1.2.2",
|
||||||
"standard-version": "7.0.0",
|
"standard-version": "7.0.0"
|
||||||
"tree-sitter-cli": "0.15.7"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"/src/",
|
"/src/",
|
||||||
|
|
40
scripts/generate-playground.js
Normal file
40
scripts/generate-playground.js
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
const generatePlayground = require("../tree-sitter/script/generate-playground");
|
||||||
|
|
||||||
|
generatePlayground("docs", {
|
||||||
|
name: "TOML",
|
||||||
|
example: `
|
||||||
|
# This is a TOML document.
|
||||||
|
|
||||||
|
title = "TOML Example"
|
||||||
|
|
||||||
|
[owner]
|
||||||
|
name = "Tom Preston-Werner"
|
||||||
|
dob = 1979-05-27T07:32:00-08:00 # First class dates
|
||||||
|
|
||||||
|
[database]
|
||||||
|
server = "192.168.1.1"
|
||||||
|
ports = [ 8001, 8001, 8002 ]
|
||||||
|
connection_max = 5000
|
||||||
|
enabled = true
|
||||||
|
|
||||||
|
[servers]
|
||||||
|
|
||||||
|
# Indentation (tabs and/or spaces) is allowed but not required
|
||||||
|
[servers.alpha]
|
||||||
|
ip = "10.0.0.1"
|
||||||
|
dc = "eqdc10"
|
||||||
|
|
||||||
|
[servers.beta]
|
||||||
|
ip = "10.0.0.2"
|
||||||
|
dc = "eqdc10"
|
||||||
|
|
||||||
|
[clients]
|
||||||
|
data = [ ["gamma", "delta"], [1, 2] ]
|
||||||
|
|
||||||
|
# Line breaks are OK when inside arrays
|
||||||
|
hosts = [
|
||||||
|
"alpha",
|
||||||
|
"omega"
|
||||||
|
]
|
||||||
|
`.trim()
|
||||||
|
});
|
5
scripts/setup-tree-sitter.sh
Normal file
5
scripts/setup-tree-sitter.sh
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
git clone https://github.com/ikatyang/tree-sitter --branch 0.15.9-custom --depth 1
|
||||||
|
cd tree-sitter
|
||||||
|
git submodule update --init
|
||||||
|
./script/build-wasm
|
||||||
|
cargo build --release
|
10
src/node-types.json
generated
10
src/node-types.json
generated
|
@ -79,7 +79,7 @@
|
||||||
"fields": {},
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": false,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "dotted_key",
|
"type": "dotted_key",
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
"fields": {},
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": false,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "array",
|
"type": "array",
|
||||||
|
@ -197,7 +197,7 @@
|
||||||
"fields": {},
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": false,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "escape_sequence",
|
"type": "escape_sequence",
|
||||||
|
@ -212,7 +212,7 @@
|
||||||
"fields": {},
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": false,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "dotted_key",
|
"type": "dotted_key",
|
||||||
|
@ -235,7 +235,7 @@
|
||||||
"fields": {},
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": false,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "dotted_key",
|
"type": "dotted_key",
|
||||||
|
|
3495
src/parser.c
generated
3495
src/parser.c
generated
File diff suppressed because it is too large
Load diff
10
yarn.lock
10
yarn.lock
|
@ -922,11 +922,6 @@ pinkie@^2.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
|
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
|
||||||
integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA=
|
integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA=
|
||||||
|
|
||||||
prettier@1.18.2:
|
|
||||||
version "1.18.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
|
|
||||||
integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==
|
|
||||||
|
|
||||||
process-nextick-args@~2.0.0:
|
process-nextick-args@~2.0.0:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
|
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
|
||||||
|
@ -1231,11 +1226,6 @@ through@2, "through@>=2.2.7 <3":
|
||||||
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
|
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
|
||||||
integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=
|
integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=
|
||||||
|
|
||||||
tree-sitter-cli@0.15.7:
|
|
||||||
version "0.15.7"
|
|
||||||
resolved "https://registry.yarnpkg.com/tree-sitter-cli/-/tree-sitter-cli-0.15.7.tgz#3cda2910460243ad633c73c81460391ef7ec5798"
|
|
||||||
integrity sha512-6to6Hz4uOdmKd+Co4Y/nQps/u4pBG7oFKSmSVScJXtz+M76bFi1n9pB8s16Kdv55KJi4ur6pK4SGMfNdTKywsw==
|
|
||||||
|
|
||||||
trim-newlines@^1.0.0:
|
trim-newlines@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"
|
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"
|
||||||
|
|
Loading…
Reference in a new issue