Get peg subvocabs working again
parent
a14854520d
commit
d1e0aa6e80
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2007 Chris Double.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
!
|
||||
USING: kernel tools.test peg peg.ebnf ;
|
||||
USING: kernel tools.test peg peg.ebnf words ;
|
||||
IN: peg.ebnf.tests
|
||||
|
||||
{ T{ ebnf-non-terminal f "abc" } } [
|
||||
|
|
|
@ -278,7 +278,7 @@ M: ebnf-non-terminal (transform) ( ast -- parser )
|
|||
|
||||
: ebnf>quot ( string -- hashtable quot )
|
||||
'ebnf' parse check-parse-result
|
||||
parse-result-ast transform dup main swap at compile ;
|
||||
parse-result-ast transform dup main swap at compile 1quotation ;
|
||||
|
||||
: [EBNF "EBNF]" parse-multiline-string ebnf>quot nip parsed ; parsing
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: kernel sequences strings namespaces math assocs shuffle
|
||||
vectors arrays combinators.lib math.parser match
|
||||
unicode.categories sequences.lib compiler.units parser
|
||||
words ;
|
||||
words quotations ;
|
||||
IN: peg
|
||||
|
||||
TUPLE: parse-result remaining ast ;
|
||||
|
@ -42,7 +42,7 @@ GENERIC: (compile) ( parser -- quot )
|
|||
] with-variable ;
|
||||
|
||||
: parse ( state parser -- result )
|
||||
compile call ;
|
||||
compile execute ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
|
@ -260,7 +260,7 @@ TUPLE: delay-parser quot ;
|
|||
|
||||
M: delay-parser (compile) ( parser -- quot )
|
||||
[
|
||||
delay-parser-quot % \ (compile) , \ call ,
|
||||
delay-parser-quot % \ compile , \ execute ,
|
||||
] [ ] make ;
|
||||
|
||||
PRIVATE>
|
||||
|
@ -334,7 +334,7 @@ PRIVATE>
|
|||
: PEG:
|
||||
(:) [
|
||||
[
|
||||
call compile
|
||||
call compile 1quotation
|
||||
[ dup [ parse-result-ast ] [ "Parse failed" throw ] if ]
|
||||
append define
|
||||
] with-compilation-unit
|
||||
|
|
Loading…
Reference in New Issue