X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=tests%2Fregression.tc;h=37a302e5a506e87654448ed5a50c630295b8d4c1;hp=025500a348e1424ece9c0c1a5b8f5d8438935a12;hb=ceca07b4020b5dd051e0d01767a35842dec2ca74;hpb=dac355890ce94f5ec7204142aec9a33ad8f81214 diff --git a/tests/regression.tc b/tests/regression.tc index 025500a..37a302e 100644 --- a/tests/regression.tc +++ b/tests/regression.tc @@ -255,59 +255,61 @@ testcase { q ::= [a-z]++ => "q" } -//testcase { -// -// input " -// -// -// while x>0 -// while y>0 -// foo() -// bar() -// -// while x>0 -// while y>0 -// foo() -// bar() -// -// -//"; -// output "smt:{while:{>:{{x} {0}} while:{>:{{y} {0}} sbb:{{f o o} {b a r}}}}}"; -// output "smt:{while:{>:{{x} {0}} sbb:{while:{>:{{y} {0}} {f o o}} {b a r}}}}"; -// -//indent !::= ww -//outdent !::= " " outdent " " -// | " " (~[]*) "\n" -// -//any !::= ~[]* -//s ::= any "\n\n" ww statement ww "\n\n" any => smt -//ww !::= sp* -//ws !::= sp** -//sp ::= " " -// -//block ::= "\n" indent blockBody -// &~ "\n" outdent ~[\ ] ~[]* -// -//blockBody ::= statement -// > statement blockBody /ws => "sbb" -// -//statement ::= call -// | ^"while" expr block /ws -// -//expr ::= ident -// | call -// | expr ^">" expr /ws -// | num -// -//call ::= expr "()" /ws -// -//num ::= [0-9]++ -// -//ident ::= [a-z]++ &~ keyword -//keyword ::= "if" | "then" | "else" | "while" -// -//w ::= " " | "\n" | "\r" -//ws ::= w* -// -// -//} +testcase { + + input " + + + + while x>0 + while y>0 + foo() + bar() + + while x>0 + while y>0 + foo() + bar() + + + +"; + output "smt:{while:{>:{{x} {0}} sbb:{while:{>:{{y} {0}} {f o o}} {b a r}}} while:{>:{{x} {0}} while:{>:{{y} {0}} sbb:{{f o o} {b a r}}}}}"; + output "smt:{while:{>:{{x} {0}} sbb:{while:{>:{{y} {0}} {f o o}} {b a r}}} while:{>:{{x} {0}} sbb:{while:{>:{{y} {0}} {f o o}} {b a r}}}}"; + +indent !::= ww +outdent !::= " " outdent " " + | " " (~[]*) "\n" + +w !::= " " | "\n" | "\r" +ws !::= w* +ww !::= sp* +sp !::= " " +any !::= ~[]* + +s ::= ws statement ws statement ws => smt + +block ::= "\n" indent blockBody + &~ "\n" outdent ~[\ ] ~[]* + +blockBody ::= statement + | statement ws blockBody => "sbb" + +statement ::= call + | ^"while" expr block /ws + +expr ::= ident + | call + | expr ^">" expr /ws + | num + +call ::= expr "()" /ws + +num ::= [0-9]++ + +ident ::= [a-z]++ &~ keyword +keyword ::= "if" | "then" | "else" | "while" + + + +}