cvsuser 04/10/05 08:23:56
Modified: imcc imcc.l imcc.y
imcc/t/syn op.t
Log:
partial fix for #31848 - PIR syntax
Revision Changes Path
1.115 +1 -0 parrot/imcc/imcc.l
Index: imcc.l
===================================================================
RCS file: /cvs/public/parrot/imcc/imcc.l,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -w -r1.114 -r1.115
--- imcc.l 22 Sep 2004 08:46:55 -0000 1.114
+++ imcc.l 5 Oct 2004 15:23:52 -0000 1.115
@@ -258,6 +258,7 @@
"-=" return(MINUS_ASSIGN);
"*=" return(MUL_ASSIGN);
"/=" return(DIV_ASSIGN);
+"%=" return(MOD_ASSIGN);
"//" return(FDIV);
"//=" return(FDIV_ASSIGN);
"&=" return(BAND_ASSIGN);
1.145 +3 -1 parrot/imcc/imcc.y
Index: imcc.y
===================================================================
RCS file: /cvs/public/parrot/imcc/imcc.y,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -w -r1.144 -r1.145
--- imcc.y 3 Aug 2004 11:21:33 -0000 1.144
+++ imcc.y 5 Oct 2004 15:23:52 -0000 1.145
@@ -268,7 +268,7 @@
%token <t> SUB SYM LOCAL CONST
%token <t> INC DEC GLOBAL_CONST
%token <t> PLUS_ASSIGN MINUS_ASSIGN MUL_ASSIGN DIV_ASSIGN CONCAT_ASSIGN
-%token <t> BAND_ASSIGN BOR_ASSIGN BXOR_ASSIGN FDIV FDIV_ASSIGN
+%token <t> BAND_ASSIGN BOR_ASSIGN BXOR_ASSIGN FDIV FDIV_ASSIGN MOD_ASSIGN
%token <t> SHR_ASSIGN SHL_ASSIGN SHR_U_ASSIGN
%token <t> SHIFT_LEFT SHIFT_RIGHT INTV FLOATV STRINGV PMCV OBJECTV LOG_XOR
%token <t> RELOP_EQ RELOP_NE RELOP_GT RELOP_GTE RELOP_LT RELOP_LTE
@@ -896,6 +896,8 @@
{ $$ = MK_I(interp, cur_unit, "mul", 2, $1, $3); }
| target DIV_ASSIGN var
{ $$ = MK_I(interp, cur_unit, "div", 2, $1, $3); }
+ | target MOD_ASSIGN var /* TODO 2 args opcodes */
+ { $$ = MK_I(interp, cur_unit, "mod", 3, $1, $1, $3); }
| target FDIV_ASSIGN var
{ $$ = MK_I(interp, cur_unit, "fdiv", 2, $1, $3); }
| target CONCAT_ASSIGN var
1.3 +13 -1 parrot/imcc/t/syn/op.t
Index: op.t
===================================================================
RCS file: /cvs/public/parrot/imcc/t/syn/op.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- op.t 14 Mar 2004 09:45:46 -0000 1.2
+++ op.t 5 Oct 2004 15:23:56 -0000 1.3
@@ -1,6 +1,6 @@
#!perl
use strict;
-use TestCompiler tests => 19;
+use TestCompiler tests => 20;
##############################
output_is(<<'CODE', <<'OUT', "+=");
@@ -52,6 +52,18 @@
10
OUT
+output_is(<<'CODE', <<'OUT', "%=");
+.sub _test
+ $I0 = 20
+ $I0 %= 7
+ print $I0
+ print "\n"
+ end
+.end
+CODE
+6
+OUT
+
output_is(<<'CODE', <<'OUT', ".=");
.sub _test
$S0 = "ab"