peg: Throw an error if nothing at all matches at position 0.
parent
e4df1c8503
commit
26689c3d75
|
@ -303,7 +303,11 @@ SYMBOL: delayed
|
||||||
] with-compilation-unit ;
|
] with-compilation-unit ;
|
||||||
|
|
||||||
: compiled-parse ( state word -- result )
|
: compiled-parse ( state word -- result )
|
||||||
swap [ execute( -- result ) [ error-stack get first throw ] unless* ] with-packrat ;
|
swap [
|
||||||
|
execute( -- result )
|
||||||
|
[ error-stack get ?first [ throw ]
|
||||||
|
[ pos get input get f <parse-error> throw ] if* ] unless*
|
||||||
|
] with-packrat ;
|
||||||
|
|
||||||
: (parse) ( input parser -- result )
|
: (parse) ( input parser -- result )
|
||||||
dup word? [ compile ] unless compiled-parse ;
|
dup word? [ compile ] unless compiled-parse ;
|
||||||
|
|
Loading…
Reference in New Issue