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:
Petri Lehtinen
2009-07-13 23:34:31 +03:00
parent 1f65a3cae7
commit df307f1bc3
2 changed files with 93 additions and 57 deletions

10
test/testdata/invalid vendored
View File

@@ -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 '"'