Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
[nqp]: Add statement_control:sym<if> .
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Oct 21, 2009
1 parent 9104507 commit 9681684
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/NQP/Actions.pm
Expand Up @@ -30,6 +30,12 @@ method blockoid($/) {
make $<statementlist>.ast;
}

## Statement control

method statement_control:sym<if>($/) {
make $<xblock>.ast;
}

## Terms

method term:sym<identifier>($/) {
Expand Down
9 changes: 8 additions & 1 deletion src/NQP/Grammar.pm
Expand Up @@ -14,6 +14,7 @@ token statement {

token eat_terminator {
| ';'
| <?terminator>
| $
}

Expand All @@ -29,12 +30,17 @@ token blockoid {
'{' ~ '}' <statementlist>
}

proto token terminator { <...> }

token terminator:sym<;> { <?[;]> }
token terminator:sym<}> { <?[}]> }

## Statement control

proto token statement_control { <...> }

token statement_control:sym<if> {
$<sym>=['if']
$<sym>=['if'] :s
<xblock>
}

Expand Down Expand Up @@ -77,6 +83,7 @@ token quote:sym<Q> { 'Q' <![(]> <.ws> <quote_EXPR> }

token circumfix:sym<( )> { '(' <EXPR> ')' }
token circumfix:sym<ang> { <?[<]> <quote_EXPR: ':q', ':w'> }
token circumfix:sym<{ }> { <?[{]> <pblock> }

## Operators

Expand Down

0 comments on commit 9681684

Please sign in to comment.