[svn:parrot] r44870 - in branches/ops_pct/compilers/opsc: src/Ops/Compiler t
cotto at svn.parrot.org
cotto at svn.parrot.org
Thu Mar 11 09:38:01 UTC 2010
Author: cotto
Date: Thu Mar 11 09:37:59 2010
New Revision: 44870
URL: https://trac.parrot.org/parrot/changeset/44870
Log:
[opsc] force op_macro to first try an empty string for body_word so that
subsequent punctuation doesn't get eaten when there's no argument
Modified:
branches/ops_pct/compilers/opsc/src/Ops/Compiler/Grammar.pm
branches/ops_pct/compilers/opsc/t/07-emitter.t
Modified: branches/ops_pct/compilers/opsc/src/Ops/Compiler/Grammar.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/src/Ops/Compiler/Grammar.pm Thu Mar 11 09:02:04 2010 (r44869)
+++ branches/ops_pct/compilers/opsc/src/Ops/Compiler/Grammar.pm Thu Mar 11 09:37:59 2010 (r44870)
@@ -108,7 +108,7 @@
}
rule op_macro {
- <macro_type> <macro_destination> '(' <body_word>? ')'
+ <macro_type> <macro_destination> '(' $<body_word>=[''|<body_word>] ')'
{*}
}
Modified: branches/ops_pct/compilers/opsc/t/07-emitter.t
==============================================================================
--- branches/ops_pct/compilers/opsc/t/07-emitter.t Thu Mar 11 09:02:04 2010 (r44869)
+++ branches/ops_pct/compilers/opsc/t/07-emitter.t Thu Mar 11 09:37:59 2010 (r44870)
@@ -5,7 +5,7 @@
pir::load_bytecode("compilers/opsc/opsc.pbc");
pir::load_bytecode("nqp-settings.pbc");
-plan(20);
+plan(21);
my $trans := Ops::Trans::C.new();
@@ -91,6 +91,14 @@
ok($restart_addr_ok, "goto OFFSET() and \$1 translated ok");
ok($new_body ~~ /'PARROT_JUMP_RELATIVE'/, "jump flags generated");
+$op_body := '
+inline op thingy(in PMC) {
+ opcode * next = expr NEXT();
+}';
+$new_body := translate_op_body($trans, $op_body);
+$restart_addr_ok := $new_body ~~ /'cur_opcode + 3;'/;
+ok($restart_addr_ok, "expr NEXT() translated ok");
+
#say($source);
sub translate_op_body($trans, $body) {
More information about the parrot-commits
mailing list