Get peg subvocabs working again

db4
Chris Double 2008-03-22 00:58:53 +13:00
parent a14854520d
commit d1e0aa6e80
3 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007 Chris Double. ! Copyright (C) 2007 Chris Double.
! See http://factorcode.org/license.txt for BSD license. ! 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 IN: peg.ebnf.tests
{ T{ ebnf-non-terminal f "abc" } } [ { T{ ebnf-non-terminal f "abc" } } [

View File

@ -278,7 +278,7 @@ M: ebnf-non-terminal (transform) ( ast -- parser )
: ebnf>quot ( string -- hashtable quot ) : ebnf>quot ( string -- hashtable quot )
'ebnf' parse check-parse-result '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 : [EBNF "EBNF]" parse-multiline-string ebnf>quot nip parsed ; parsing

View File

@ -3,7 +3,7 @@
USING: kernel sequences strings namespaces math assocs shuffle USING: kernel sequences strings namespaces math assocs shuffle
vectors arrays combinators.lib math.parser match vectors arrays combinators.lib math.parser match
unicode.categories sequences.lib compiler.units parser unicode.categories sequences.lib compiler.units parser
words ; words quotations ;
IN: peg IN: peg
TUPLE: parse-result remaining ast ; TUPLE: parse-result remaining ast ;
@ -42,7 +42,7 @@ GENERIC: (compile) ( parser -- quot )
] with-variable ; ] with-variable ;
: parse ( state parser -- result ) : parse ( state parser -- result )
compile call ; compile execute ;
<PRIVATE <PRIVATE
@ -260,7 +260,7 @@ TUPLE: delay-parser quot ;
M: delay-parser (compile) ( parser -- quot ) M: delay-parser (compile) ( parser -- quot )
[ [
delay-parser-quot % \ (compile) , \ call , delay-parser-quot % \ compile , \ execute ,
] [ ] make ; ] [ ] make ;
PRIVATE> PRIVATE>
@ -334,7 +334,7 @@ PRIVATE>
: PEG: : PEG:
(:) [ (:) [
[ [
call compile call compile 1quotation
[ dup [ parse-result-ast ] [ "Parse failed" throw ] if ] [ dup [ parse-result-ast ] [ "Parse failed" throw ] if ]
append define append define
] with-compilation-unit ] with-compilation-unit