diff options
| -rw-r--r-- | Parser.y | 1 | ||||
| -rw-r--r-- | t/bad.pas | 26 |
2 files changed, 27 insertions, 0 deletions
@@ -215,6 +215,7 @@ statements statement : open_statement {$$=$1;} | closed_statement {$$=$1;} + | error {$$=std::make_shared<pcc::EmptyStatementNode>(ctx);} ; open_statement diff --git a/t/bad.pas b/t/bad.pas new file mode 100644 index 0000000..3bc25ef --- /dev/null +++ b/t/bad.pas @@ -0,0 +1,26 @@ +program hello_world; + +extern Pascal_puts(s:string):integer; +extern Pascal_printf(s:string; ...):integer; +extern Pascal_scanf(s:string; ...):integer; + +function main():integer; +var + buf:array[0..1023] of char; + i:integer; +begin + Pascal_puts(; + (; + i+; + i:=3+; + Pascal_puts('Hello, World!'); + Pascal_printf('Variadic Function Test: %d, %s, %llx\n', 1, 'yes', 0x123456789abcd); + for i:=0 to 10 do + begin + if i=3 then continue; + if i=5 then break; + Pascal_printf('say something: '); + Pascal_scanf('%s', @buf[0]); + Pascal_printf('round %d you said: %s\n', i, @buf[0]) + end; +end; |
