Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
NYI notes for constant, state and macro. Hopefully we get to at least…
… state by R*, but if not better to give a good error.
  • Loading branch information
jnthn committed Jul 20, 2010
1 parent ee1b11b commit cf3da00
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Perl6/Actions.pm
Expand Up @@ -1582,6 +1582,10 @@ method type_declarator:sym<subset>($/) {
}
}

method type_declarator:sym<constant>($/) {
$/.CURSOR.panic('Constant type declarator not yet implemented');
}

method capterm($/) {
# Construct a Parcel, and then call .Capture to coerce it to a capture.
my $past := $<termish> ?? $<termish>.ast !!
Expand Down
24 changes: 24 additions & 0 deletions src/Perl6/Grammar.pm
Expand Up @@ -901,6 +901,9 @@ token scope_declarator:sym<anon> { <sym> <scoped('anon')> }
token scope_declarator:sym<supersede> {
<sym> <.panic: '"supersede" not yet implemented'>
}
token scope_declarator:sym<state> {
<sym> <.panic: '"state" not yet implemented'>
}

rule scoped($*SCOPE) {
:my $*TYPENAME := '';
Expand Down Expand Up @@ -949,6 +952,8 @@ token routine_declarator:sym<method>
{ <sym> <.nofun> :my $*METHODTYPE := 'Method'; <method_def> }
token routine_declarator:sym<submethod>
{ <sym> <.nofun> :my $*METHODTYPE := 'Submethod'; <method_def> }
token routine_declarator:sym<macro>
{ <sym> <.nofun> <.panic: "Macros are not yet implemented"> }

rule routine_def {
:my $*IN_DECL := 'routine';
Expand Down Expand Up @@ -1186,6 +1191,25 @@ token type_declarator:sym<subset> {
]
}

token type_declarator:sym<constant> {
:my $*IN_DECL := 'constant';
<sym> <.ws>

[
| <identifier>
| <variable>
| <?>
]
{ $*IN_DECL := ''; }
<.ws>

[
|| <?before '='>
|| <?before <-[\n=]>*'='> <.panic: "Malformed constant"> # probable initializer later
|| <.panic: "Missing initializer on constant declaration">
]
}

rule trait {
:my $*IN_DECL := '';
[
Expand Down

0 comments on commit cf3da00

Please sign in to comment.