USING: accessors arrays assocs classes combinators
combinators.short-circuit compiler.units effects.parser fry
-generalizations kernel locals make math math.order namespaces
-quotations sequences sets splitting unicode vectors
-vocabs.loader words ;
+kernel make math math.order namespaces quotations sequences
+sets splitting unicode vectors vocabs.loader words ;
IN: peg
pos get apply-rule process-parser-result ;
: preset-parser-word ( parser -- word parser )
- gensym swap over >>compiled ;
+ gensym tuck >>compiled ;
: define-parser-word ( word parser -- )
! Return the body of the word that is the compiled version
TUPLE: action-parser parser quot ;
: check-action ( result quot -- result )
- dupd '[ _ change-ast ] when ; inline
+ dupd '[ [ _ call( ast -- ast ) ] change-ast ] when ;
M: action-parser (compile)
[ parser>> compile-parser-quot ] [ quot>> ] bi