peg refactorings
parent
8bd7c51c10
commit
bc5f82255f
|
@ -24,8 +24,13 @@ SYMBOL: packrat
|
||||||
|
|
||||||
GENERIC: (compile) ( parser -- quot )
|
GENERIC: (compile) ( parser -- quot )
|
||||||
|
|
||||||
|
: input-from ( input -- n )
|
||||||
|
#! Return the index from the original string that the
|
||||||
|
#! input slice is based on.
|
||||||
|
dup slice? [ slice-from ] [ drop 0 ] if ;
|
||||||
|
|
||||||
:: run-packrat-parser ( input quot c -- result )
|
:: run-packrat-parser ( input quot c -- result )
|
||||||
input slice? [ input slice-from ] [ 0 ] if
|
input input-from
|
||||||
quot c [ drop H{ } clone ] cache
|
quot c [ drop H{ } clone ] cache
|
||||||
[
|
[
|
||||||
drop input quot call
|
drop input quot call
|
||||||
|
|
Loading…
Reference in New Issue