Author: kjs
Date: Wed Apr  4 13:30:10 2007
New Revision: 17980

Modified:
   trunk/compilers/pirc/src/pirparser.c

Log:
compilers/pirc:
* fix target '=' STRINGC syntax
* fix parrot_instruction syntax

Modified: trunk/compilers/pirc/src/pirparser.c
==============================================================================
--- trunk/compilers/pirc/src/pirparser.c        (original)
+++ trunk/compilers/pirc/src/pirparser.c        Wed Apr  4 13:30:10 2007
@@ -670,7 +670,7 @@
 
 =item *
 
-  parrot_instruction -> PARROT_OP [ expression {',' expression } ] '\n'
+  parrot_instruction -> PARROT_OP [ expression {',' expression } ]
 
 =cut
 
@@ -693,7 +693,6 @@
         else break;
     }
 
-    match(p, T_NEWLINE);
     emit_op_end(p);
 }
 
@@ -732,13 +731,18 @@
         case T_INVOCANT_IDENT: /* method call */
             methodcall(p);
             break;
-        case T_STRING_CONSTANT: { /* "foo"() */
-            char *invokable = clone_string(get_current_token(p->lexer));
-            emit_invocation_start(p);
-            emit_invokable(p, invokable);
+        case T_STRING_CONSTANT: {
+            char *str = clone_string(get_current_token(p->lexer));
             next(p);
-            arguments(p);
-            emit_invocation_end(p);
+            if (p->curtoken == T_LPAREN) { /* "foo"() */
+                emit_invocation_start(p);
+                emit_invokable(p, str);
+                arguments(p);
+                emit_invocation_end(p);
+            }
+            else { /* target '=' STRINGC */
+                emit_expr(p, str);
+            }
             break;
         }
         case T_IDENTIFIER:
@@ -1239,7 +1243,7 @@
                 }
                 break;
             /* however, if the current token is a comma or ')', then quit 
parsing flags */
-            case T_COMMA:
+            case T_COMMA: /* huh? */
             case T_RPAREN:
             case T_NEWLINE:
                 ok = 0; /* stop loop */
@@ -1761,6 +1765,7 @@
                 break;
             case T_PARROT_OP: /* parrot instructions */
                 parrot_instruction(p);
+                match(p, T_NEWLINE);
                 break;
             case T_NULL: /* 'null' is a PIR keyword, but also an instruction. 
*/
                 next(p);

Reply via email to