Skip to content

Commit

Permalink
squaak: parse sub calls as expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
Benabik committed Dec 5, 2011
1 parent 4248232 commit cf36033
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/languages/squaak/src/Squaak/Actions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ method quote:sym<'>($/) { make $<quote_EXPR>.ast; }
method quote:sym<">($/) { make $<quote_EXPR>.ast; }

method circumfix:sym<( )>($/) { make $<EXPR>.ast; }
method postcircumfix:sym<( )>($/) { make $<arguments>.ast }

method named_field($/) {
my $past := $<EXPR>.ast;
Expand Down
4 changes: 4 additions & 0 deletions examples/languages/squaak/src/Squaak/Grammar.pm
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ token quote:sym<"> { <?["]> <quote_EXPR: ':qq'> }
## Operators

INIT {
Squaak::Grammar.O(':prec<x>, :assoc<unary>', '%methodop');
Squaak::Grammar.O(':prec<w>, :assoc<unary>', '%unary-negate');
Squaak::Grammar.O(':prec<v>, :assoc<unary>', '%unary-not');
Squaak::Grammar.O(':prec<u>, :assoc<left>', '%multiplicative');
Expand All @@ -169,6 +170,9 @@ INIT {
}

token circumfix:sym<( )> { '(' <.ws> <EXPR> ')' }
token postcircumfix:sym<( )> {
<arguments> <O( '%methodop, :pasttype<call>' )>
}

rule circumfix:sym<[ ]> {
'[' [<EXPR> ** ',']? ']'
Expand Down

0 comments on commit cf36033

Please sign in to comment.