TUPLE: just-parser p1 ;
-: just-pattern
+CONSTANT: just-pattern
[
- execute dup [
+ dup [
dup remaining>> empty? [ drop f ] unless
] when
- ] ;
+ ]
M: just-parser (compile) ( parser -- quot )
- p1>> compile-parser just-pattern curry ;
+ p1>> compile-parser-quot just-pattern compose ;
: just ( parser -- parser )
just-parser boa wrap-peg ;
dup zero? [
2drop epsilon
] [
- [ exactly-n ] [ 1- at-most-n ] 2bi 2choice
+ [ exactly-n ] [ 1 - at-most-n ] 2bi 2choice
] if ;
: at-least-n ( parser n -- parser' )