Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Add typename parsing to variable declarations.
Browse files Browse the repository at this point in the history
(The typenames don't do anything yet, we just ignore them after parsing.)
  • Loading branch information
pmichaud committed May 15, 2010
1 parent bb798d2 commit 08a765d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/NQP/Actions.pm
Expand Up @@ -365,6 +365,10 @@ method scope_declarator:sym<our>($/) { make $<scoped>.ast; }
method scope_declarator:sym<has>($/) { make $<scoped>.ast; }

method scoped($/) {
make $<declarator>.ast;
}

method declarator($/) {
make $<routine_declarator>
?? $<routine_declarator>.ast
!! $<variable_declarator>.ast;
Expand Down
7 changes: 7 additions & 0 deletions src/NQP/Grammar.pm
Expand Up @@ -271,6 +271,13 @@ token scope_declarator:sym<our> { <sym> <scoped('our')> }
token scope_declarator:sym<has> { <sym> <scoped('has')> }

rule scoped($*SCOPE) {
| <declarator>
| <typename>+ <declarator> # eventually <multi_declarator>
}

token typename { <name> }

token declarator {
| <variable_declarator>
| <routine_declarator>
}
Expand Down

0 comments on commit 08a765d

Please sign in to comment.