diff options
| author | Nagi5Yeq <wu@x-nagi.com> | 2020-06-21 16:00:07 +0800 |
|---|---|---|
| committer | Nagi5Yeq <wu@x-nagi.com> | 2020-06-21 16:00:07 +0800 |
| commit | 50c71fdd495b74e812f0e2a1af87e932a8aa9ade (patch) | |
| tree | 4db5e64a09ad5160caf65fe397e45204d72d335f | |
| parent | 07c2f96ae65f962150610cd9dad35da0ed88ce04 (diff) | |
| -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; |
