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

Commit

Permalink
Refactor <?{...}> and <!{...}> code assertions to prepare for <{...}>.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed May 25, 2010
1 parent aa182b0 commit 43b5e39
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/NQP/Actions.pm
Expand Up @@ -829,6 +829,12 @@ class NQP::RegexActions is Regex::P6Regex::Actions {
:pasttype<pastnode>, :node($/) );
}

method assertion:sym<?{ }>($/) {
make PAST::Regex.new( $<codeblock>.ast,
:subtype<zerowidth>, :negate( $<zw> eq '!' ),
:pasttype<pastnode>, :node($/) );
}

method assertion:sym<var>($/) {
make PAST::Regex.new( '!INTERPOLATE_REGEX', $<var>.ast,
:pasttype<subrule>, :subtype<method>, :node($/));
Expand Down
8 changes: 6 additions & 2 deletions src/NQP/Grammar.pm
Expand Up @@ -558,8 +558,12 @@ grammar NQP::Regex is Regex::P6Regex::Grammar {
<?[$@]> <var=.LANG('MAIN', 'variable')>
}

token assertion:sym<{ }> {
<?[{]> <codeblock>
# token assertion:sym<{ }> {
# <?[{]> <codeblock>
# }

token assertion:sym<?{ }> {
$<zw>=[ <[?!]> <?before '{'> ] <codeblock>
}

token assertion:sym<name> {
Expand Down

0 comments on commit 43b5e39

Please sign in to comment.