Print ebnf quotation on error. Fix generated local quotation

db4
Chris Double 2008-06-17 22:47:38 +12:00
parent f1219c906a
commit dfa4926a84
1 changed files with 10 additions and 4 deletions

View File

@ -3,7 +3,8 @@
USING: kernel compiler.units parser words arrays strings math.parser sequences
quotations vectors namespaces math assocs continuations peg
peg.parsers unicode.categories multiline combinators combinators.lib
splitting accessors effects sequences.deep peg.search inference ;
splitting accessors effects sequences.deep peg.search inference
io.streams.string io prettyprint ;
IN: peg.ebnf
TUPLE: ebnf-non-terminal symbol ;
@ -324,7 +325,7 @@ M: ebnf-sequence build-locals ( code ast -- code )
] 2each
" | " %
%
" ]" %
" nip ]" %
] "" make
] if ;
@ -334,7 +335,7 @@ M: ebnf-var build-locals ( code ast -- )
name>> % " [ dup ] " %
" | " %
%
" ]" %
" nip ]" %
] "" make ;
M: object build-locals ( code ast -- )
@ -344,7 +345,12 @@ M: object build-locals ( code ast -- )
dup infer {
{ [ dup (( a -- b )) effect<= ] [ drop ] }
{ [ dup (( -- b )) effect<= ] [ drop [ drop ] prepose ] }
[ "Bad effect: " swap effect>string append throw ]
[
[
"Bad effect: " write effect>string write
" for quotation " write pprint
] with-string-writer throw
]
} cond ;
M: ebnf-action (transform) ( ast -- parser )