Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created June 21, 2012 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnthn/2967127 to your computer and use it in GitHub Desktop.
Save jnthn/2967127 to your computer and use it in GitHub Desktop.
diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm
index 4179a02..beeee86 100644
--- a/src/Perl6/Actions.pm
+++ b/src/Perl6/Actions.pm
@@ -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' {
diff --git a/src/Perl6/Grammar.pm b/src/Perl6/Grammar.pm
index 53ccdf3..f441349 100644
--- a/src/Perl6/Grammar.pm
+++ b/src/Perl6/Grammar.pm
@@ -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> ]*
'{'[
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment