tree-sitter/spec/runtime/languages/json/errors.txt
Max Brunsfeld 77941c85ff Avoid building incomplete error nodes during lexing
The lexer doesn't know the expected symbols, so it doesn't have enough
information to construct error nodes. Now, when it encounters an invalid
character, it returns NULL and the parser builds a correct error node.
2014-08-25 23:35:00 -07:00

40 lines
935 B
Text

==========================================
recovers from top-level errors
==========================================
[}
---
(ERROR '}') (ERROR '}')
==========================================
recovers from unexpected tokens
==========================================
barf
---
(ERROR 'b')
==========================================
recovers from errors inside arrays
==========================================
[1, , 2]
---
(array
(number)
(ERROR ',')
(number))
==========================================
recovers from errors inside objects
==========================================
{ "key1": 1, oops }
---
(object (string) (number) (ERROR 'o'))
==========================================
recovers from errors inside nested objects
==========================================
{ "key1": { "key2": 1, 2 }, [, "key3": 3 }
---
(object
(string) (object (string) (number) (ERROR '2'))
(ERROR '[')
(string) (number))