Permalink
Browse files

Canonicalize regex names properly so that they will properly particip…

…ate in protoregex dispatch and <sym> will get set properly.
  • Loading branch information...
1 parent 61f6f14 commit d5f39a2c347a43a54bb8a29d4bced90b8c9d87dd @jnthn jnthn committed Jun 21, 2012
Showing with 18 additions and 6 deletions.
  1. +17 −5 src/Perl6/Actions.pm
  2. +1 −1 src/Perl6/Grammar.pm
View
@@ -173,9 +173,22 @@ class Perl6::Actions is HLL::Actions {
}
method deflongname($/) {
- make $<colonpair>
- ?? ~$<name> ~ ':<' ~ ~$<colonpair>[0]<circumfix><quote_EXPR><quote_delimited><quote_atom>[0] ~ '>'
- !! ~$<name>;
+ if $<colonpair> {
+ my $name := ~$<name>;
+ if $<colonpair>[0] {
+ $name := $name ~ ':';
+ }
+ if $<colonpair>[0]<identifier> {
+ $name := $name ~ ~$<colonpair>[0]<identifier>;
+ }
+ if $<colonpair>[0]<circumfix> {
+ $name := $name ~ '<' ~ ~$<colonpair>[0]<circumfix><quote_EXPR><quote_delimited><quote_atom>[0] ~ '>';
+ }
+ make $name;
+ }
+ else {
+ make ~$<name>;
+ }
}
# Turn $code into "for lines() { $code }"
@@ -2194,8 +2207,7 @@ class Perl6::Actions is HLL::Actions {
method regex_def($/) {
my $coderef;
- my $name := ~$<deflongname>[0];
- %*RX<name> := $name;
+ my $name := ~%*RX<name>;
my @params := $<signature> ?? $<signature>[0].ast !! [];
if $*MULTINESS eq 'proto' {
View
@@ -1857,7 +1857,7 @@ grammar Perl6::Grammar is HLL::Grammar {
[
{ $*IN_DECL := '' }
<deflongname>?
- { if $<deflongname> { %*RX<name> := $<deflongname>[0].Str } }
+ { if $<deflongname> { %*RX<name> := ~$<deflongname>[0].ast } }
<.newpad>
[ [ ':'?'(' <signature> ')'] | <trait> ]*
'{'[

0 comments on commit d5f39a2

Please sign in to comment.