peg.ebnf: Throw errors not strings.
parent
ba807daf0c
commit
d2a730dda8
|
|
@ -538,16 +538,17 @@ M: ebnf-non-terminal (transform) ( ast -- parser )
|
||||||
: transform-ebnf ( string -- object )
|
: transform-ebnf ( string -- object )
|
||||||
'ebnf' parse transform ;
|
'ebnf' parse transform ;
|
||||||
|
|
||||||
|
ERROR: unable-to-fully-parse-ebnf remaining ;
|
||||||
|
|
||||||
|
ERROR: could-not-parse-ebnf ;
|
||||||
|
|
||||||
: check-parse-result ( result -- result )
|
: check-parse-result ( result -- result )
|
||||||
[
|
[
|
||||||
dup remaining>> [ blank? ] trim [
|
dup remaining>> [ blank? ] trim [
|
||||||
[
|
unable-to-fully-parse-ebnf
|
||||||
"Unable to fully parse EBNF. Left to parse was: " %
|
|
||||||
%
|
|
||||||
] "" make throw
|
|
||||||
] unless-empty
|
] unless-empty
|
||||||
] [
|
] [
|
||||||
"Could not parse EBNF" throw
|
could-not-parse-ebnf
|
||||||
] if* ;
|
] if* ;
|
||||||
|
|
||||||
: parse-ebnf ( string -- hashtable )
|
: parse-ebnf ( string -- hashtable )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue