Author: kjs
Date: Thu Apr 12 11:23:51 2007
New Revision: 18169
Modified:
trunk/compilers/pirc/src/pirparser.c
trunk/compilers/pirc/t/stmts.pir
Log:
compilers/pirc:
* fix some comments in parser
* add some tests
Modified: trunk/compilers/pirc/src/pirparser.c
==============================================================================
--- trunk/compilers/pirc/src/pirparser.c (original)
+++ trunk/compilers/pirc/src/pirparser.c Thu Apr 12 11:23:51 2007
@@ -1749,7 +1749,7 @@
| long_invocation
| long_return_statement
| long_yield_statement
- | NULL var
+ | 'null' var
| get_results_instruction
| global_assignment
| '\n'
Modified: trunk/compilers/pirc/t/stmts.pir
==============================================================================
--- trunk/compilers/pirc/t/stmts.pir (original)
+++ trunk/compilers/pirc/t/stmts.pir Thu Apr 12 11:23:51 2007
@@ -3,7 +3,7 @@
# test .HLL statement
.HLL "PIRC", "pircgroup"
-
+.pragma n_operators 1
.global x
.sub main
@@ -12,6 +12,10 @@
.local string a, b, c
.local int i, j
.local num pi
+ .sym int ii
+ .sym num nn
+ .sym pmc pp
+ .sym string ss
# test simple expressions
i = 42
@@ -46,7 +50,20 @@
I = P.bar()
N = S.'bar'()
-
+# test return statements
+ .return (1)
+ .return (x :flat)
+ .return (x :named('z'))
+ .return (a, b, c)
+ .return (a :flat, b, c :flat :named)
+
+# test yield statements
+
+ .yield (1)
+ .yield (a :flat)
+ .yield (x :named)
+ .yield (b :named('b'))
+ .yield (d, e, f)
.end
#
# comments
@@ -56,6 +73,40 @@
i = args[0]
print i
+# test long return statement
+ .pcc_begin_return
+ .pcc_end_return
+
+ .pcc_begin_return
+ .return p :flat :named('myP')
+ .pcc_end_return
+
+# test long yield statement
+ .pcc_begin_yield
+ .pcc_end_yield
+
+ .pcc_begin_yield
+ .return q :flat
+ .return r :named('myR')
+ .return s :flat :named
+ .pcc_end_yield
+
+ x = null
+ null x
+
+# test long subcall
+ .pcc_begin
+ .pcc_call Y
+ .pcc_end
+
+ .pcc_begin
+ .arg y :flat
+ .arg z :named('z')
+ .pcc_call Z
+ .result P0 :slurpy
+ .local pmc x
+ .result x
+ .pcc_end
.end