Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Support empty positional captures.
  • Loading branch information
jnthn committed Sep 29, 2012
1 parent f12484a commit 9c348a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/QRegex/P5Regex/Actions.nqp
Expand Up @@ -85,7 +85,10 @@ class QRegex::P5Regex::Actions is HLL::Actions {
}

method p5metachar:sym<( )>($/) {
make QAST::Regex.new( $<nibbler>.ast, :rxtype<subcapture>, :node($/) );
make QAST::Regex.new( :rxtype<subcapture>, :node($/),
$<nibbler>
?? $<nibbler>[0].ast
!! QAST::Regex.new( :rxtype<anchor>, :subtype<pass> ) );
}

method p5metachar:sym<[ ]>($/) {
Expand Down
2 changes: 1 addition & 1 deletion src/QRegex/P5Regex/Grammar.nqp
Expand Up @@ -59,7 +59,7 @@ grammar QRegex::P5Regex::Grammar is HLL::Grammar {
'(?' {} <assertion=p5assertion>
[ ')' || <.panic: "Perl 5 regex assertion not terminated by parenthesis"> ]
}
token p5metachar:sym<( )> { '(' {} <nibbler> ')' }
token p5metachar:sym<( )> { '(' {} <nibbler>? ')' }
token p5metachar:sym<[ ]> { <?before '['> <cclass> }

token cclass {
Expand Down

0 comments on commit 9c348a6

Please sign in to comment.