Fix ebnf for peg changes
parent
4b353c7529
commit
cca4700e49
|
@ -147,27 +147,13 @@ IN: peg.ebnf.tests
|
|||
[
|
||||
#! Test direct left recursion. Currently left recursion should cause a
|
||||
#! failure of that parser.
|
||||
#! Not using packrat, so recursion causes data stack overflow
|
||||
"1+1" [EBNF num=([0-9])+ expr=expr "+" num | num EBNF] call
|
||||
] must-fail
|
||||
|
||||
{ V{ 49 } } [
|
||||
#! Test direct left recursion. Currently left recursion should cause a
|
||||
#! failure of that parser.
|
||||
#! Using packrat, so first part of expr fails, causing 2nd choice to be used
|
||||
"1+1" [ [EBNF num=([0-9])+ expr=expr "+" num | num EBNF] call ] with-packrat parse-result-ast
|
||||
] unit-test
|
||||
|
||||
[
|
||||
#! Test indirect left recursion. Currently left recursion should cause a
|
||||
#! failure of that parser.
|
||||
#! Not using packrat, so recursion causes data stack overflow
|
||||
#! Using packrat, so first part of expr fails, causing 2nd choice to be used
|
||||
"1+1" [EBNF num=([0-9])+ x=expr expr=x "+" num | num EBNF] call
|
||||
] must-fail
|
||||
|
||||
{ V{ 49 } } [
|
||||
#! Test indirect left recursion. Currently left recursion should cause a
|
||||
#! failure of that parser.
|
||||
#! Using packrat, so first part of expr fails, causing 2nd choice to be used
|
||||
"1+1" [ [EBNF num=([0-9])+ x=expr expr=x "+" num | num EBNF] call ] with-packrat parse-result-ast
|
||||
] unit-test
|
||||
|
|
|
@ -266,7 +266,7 @@ M: ebnf-non-terminal (transform) ( ast -- parser )
|
|||
] [ ] make delay sp ;
|
||||
|
||||
: transform-ebnf ( string -- object )
|
||||
'ebnf' packrat-parse parse-result-ast transform ;
|
||||
'ebnf' parse parse-result-ast transform ;
|
||||
|
||||
: check-parse-result ( result -- result )
|
||||
dup [
|
||||
|
@ -281,8 +281,8 @@ M: ebnf-non-terminal (transform) ( ast -- parser )
|
|||
] if ;
|
||||
|
||||
: ebnf>quot ( string -- hashtable quot )
|
||||
'ebnf' packrat-parse check-parse-result
|
||||
parse-result-ast transform dup main swap at compile 1quotation ;
|
||||
'ebnf' parse check-parse-result
|
||||
parse-result-ast transform dup main swap at compile [ parse ] curry ;
|
||||
|
||||
: [EBNF "EBNF]" parse-multiline-string ebnf>quot nip parsed ; parsing
|
||||
|
||||
|
|
Loading…
Reference in New Issue