Skip to content

Commit

Permalink
throw when quant follows nonquantable
Browse files Browse the repository at this point in the history
  • Loading branch information
FROGGS committed Oct 19, 2015
1 parent 6fe7900 commit 41ab646
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/QRegex/P6Regex/Actions.nqp
Expand Up @@ -83,6 +83,7 @@ class QRegex::P6Regex::Actions is HLL::Actions {
if $<quantifier> {
$/.CURSOR.panic('Quantifier quantifies nothing')
unless $qast;
$/.CURSOR.throw_non_quantifiable() if $qast.rxtype eq 'qastnode';
my $ast := $<quantifier>.ast;
$ast.unshift($qast);
$qast := $ast;
Expand Down
4 changes: 4 additions & 0 deletions src/QRegex/P6Regex/Grammar.nqp
Expand Up @@ -79,6 +79,10 @@ grammar QRegex::P6Regex::Grammar is HLL::Grammar {
self.panic('Quantifier quantifies nothing.');
}

method throw_non_quantifiable() {
self.panic('Can only quantify a construct that produces a match');
}

method throw_solitary_backtrack_control() {
self.panic("Backtrack control ':' does not seem to have a preceding atom to control");
}
Expand Down

0 comments on commit 41ab646

Please sign in to comment.