Skip to content

Commit

Permalink
make [expr] support parens
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Jul 26, 2010
1 parent 5768bc2 commit 69a50b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Partcl/Actions.pm
Expand Up @@ -234,6 +234,9 @@ method term:sym<false>($/) { make $/.Str }
method term:sym<variable>($/) { make $<variable>.ast; }
method term:sym<integer>($/) { make $<integer>.ast; }
method term:sym<( )>($/) { make $<EXPR>.ast; }
method term:sym<[ ]>($/) { make $<script>.ast; }
method term:sym<" ">($/) { make concat_atoms($<quoted_atom>); }
Expand Down
2 changes: 2 additions & 0 deletions src/Partcl/Grammar.pm
Expand Up @@ -145,6 +145,8 @@ token term:sym<false> {
)
}

token term:sym<( )> { '(' <EXPR> ')' }

token term:sym<[ ]> { '[' ~ ']' <script> }
token term:sym<" "> { '"' <quoted_atom>* '"' }

Expand Down
2 changes: 1 addition & 1 deletion t/cmd_expr.t
Expand Up @@ -115,7 +115,7 @@ is [

# precedence
eval_is {expr 2*3+4*2} 14 {precedence}
eval_is {expr 2*(3+4)*2} 28 {parens} {TODO NQPRX}
eval_is {expr 2*(3+4)*2} 28 {parens}


is [expr {1 ? 14 : [expr {}]}] 14 \
Expand Down

0 comments on commit 69a50b8

Please sign in to comment.