Skip to content

Commit

Permalink
Add variable assertions.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed May 25, 2010
1 parent 3362b1a commit f9a12d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Perl6/Actions.pm
Expand Up @@ -2576,6 +2576,11 @@ class Perl6::RegexActions is Regex::P6Regex::Actions {
:pasttype<pastnode>, :node($/) );
}

method assertion:sym<var>($/) {
make PAST::Regex.new( '!INTERPOLATE_REGEX', $<var>.ast,
:pasttype<subrule>, :subtype<method>, :node($/));
}

method codeblock($/) {
my $block := $<block>.ast;
$block.blocktype('immediate');
Expand Down
4 changes: 4 additions & 0 deletions src/Perl6/Grammar.pm
Expand Up @@ -1818,6 +1818,10 @@ grammar Perl6::Regex is Regex::P6Regex::Grammar {
$<zw>=[ <[?!]> <?before '{'> ] <codeblock>
}

token assertion:sym<var> {
<?[$@]> <var=.LANG('MAIN', 'variable')>
}

token codeblock {
<block=.LANG('MAIN','block')>
}
Expand Down

0 comments on commit f9a12d2

Please sign in to comment.