Skip to content

Instantly share code, notes, and snippets.

@masak
Created February 17, 2010 11:55
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 masak/306536 to your computer and use it in GitHub Desktop.
Save masak/306536 to your computer and use it in GitHub Desktop.
$ git diff
diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm
index 8b42d5d..8f0509a 100644
--- a/src/Perl6/Actions.pm
+++ b/src/Perl6/Actions.pm
@@ -467,6 +467,7 @@ method term:sym<scope_declarator>($/) { make $<scope_declarator>.ast; }
method term:sym<routine_declarator>($/) { make $<routine_declarator>.ast; }
method term:sym<multi_declarator>($/) { make $<multi_declarator>.ast; }
method term:sym<regex_declarator>($/) { make $<regex_declarator>.ast; }
+method term:sym<type_declarator>($/) { make $<type_declarator>.ast; }
method term:sym<statement_prefix>($/) { make $<statement_prefix>.ast; }
method term:sym<lambda>($/) { make create_code_object($<pblock>.ast, 'Block', 0, ''); }
@@ -1045,6 +1046,10 @@ method regex_declarator($/, $key?) {
}
}
+method type_declarator($/, $key?) {
+ $/.CURSOR.panic('OH HAI' ~ $key);
+}
+
method capterm($/) {
# Construct a Parcel, and then call .Capture to coerce it to a capture.
my $past := $<termish> ?? $<termish>.ast !!
diff --git a/src/Perl6/Grammar.pm b/src/Perl6/Grammar.pm
index 144e19e..1a72e7d 100644
--- a/src/Perl6/Grammar.pm
+++ b/src/Perl6/Grammar.pm
@@ -750,6 +750,14 @@ rule regex_declarator {
]
}
+proto token type_declarator { <...> }
+
+token type_declarator:sym<enum> {
+ <sym> <.ws>
+ <name>? <.ws>
+ <?before '(' | '<' | '<<' | '«' > <circumfix>
+}
+
rule trait {
:my $*IN_DECL := '';
[
@@ -874,6 +882,8 @@ token typename {
[<.ws> 'of' <.ws> <typename> ]?
}
+token term:sym<type_declarator> { <type_declarator> }
+
proto token quote { <...> }
token quote:sym<apos> { <?[']> <quote_EXPR: ':q'> }
token quote:sym<dblq> { <?["]> <quote_EXPR: ':qq'> }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment