Skip to content

Commit

Permalink
Inline macro_param
Browse files Browse the repository at this point in the history
  • Loading branch information
bacek committed Feb 23, 2011
1 parent 285318a commit e1c1ef3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
16 changes: 8 additions & 8 deletions compilers/opsc/src/Ops/Compiler/Actions.pm
Expand Up @@ -259,13 +259,6 @@ method op_body($/) {
make $past;
}

method macro_param($/) {
make PAST::Var.new(
:name(~$/),
:node($/),
);
}


method op_macro($/) {
#say('# op_macro');
Expand Down Expand Up @@ -422,7 +415,14 @@ method term:sym<call> ($/) {
}

method term:sym<reg> ($/) {
make $<macro_param>.ast;
make PAST::Var.new(
:name(~$/),
:node($/),
);
}

method term:sym<macro> ($/) {
make $<op_macro>.ast;
}

method term:sym<int> ($/) {
Expand Down
5 changes: 4 additions & 1 deletion compilers/opsc/src/Ops/Compiler/Grammar.pm
Expand Up @@ -194,7 +194,10 @@ token term:sym<float_constant_long> { # longer to work-around lack of LTM
]
}

token term:sym<reg> { <macro_param> }
token term:sym<reg> {
'$' $<num>=<integer> # Up to nine params.
}

token term:sym<macro> { <op_macro> }

# Used for macro-casting. E.g. PTR2INTVAL. Or variable name.
Expand Down

0 comments on commit e1c1ef3

Please sign in to comment.