Report errors from lexical and stream level in parser
Before, only the syntax level (parse_*) was able to set the error string. This patch fixes the situation so that lexical (lex_*) and stream (stream_*) levels can report detailed error messages. Also, instead of 0, EOF is now returned by stream on error.
This commit is contained in:
10
test/testdata/invalid
vendored
10
test/testdata/invalid
vendored
@@ -30,7 +30,7 @@ unexpected token near ','
|
||||
["a
|
||||
====
|
||||
1
|
||||
invalid token near '"a'
|
||||
unexpected newline near '"a'
|
||||
========
|
||||
["a"
|
||||
====
|
||||
@@ -50,12 +50,12 @@ string or '}' expected near ','
|
||||
{"
|
||||
====
|
||||
1
|
||||
string or '}' expected near '"'
|
||||
unexpected newline near '"'
|
||||
========
|
||||
{"a
|
||||
====
|
||||
1
|
||||
string or '}' expected near '"a'
|
||||
unexpected newline near '"a'
|
||||
========
|
||||
{"a"
|
||||
====
|
||||
@@ -75,7 +75,7 @@ unexpected token near end of file
|
||||
{"a":"a
|
||||
====
|
||||
1
|
||||
invalid token near '"a'
|
||||
unexpected newline near '"a'
|
||||
========
|
||||
{[
|
||||
====
|
||||
@@ -135,4 +135,4 @@ invalid token near '-0'
|
||||
[" <-- tab character"]
|
||||
====
|
||||
1
|
||||
invalid token near '"'
|
||||
control character 0x9 near '"'
|
||||
|
||||
Reference in New Issue
Block a user