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

Commit

Permalink
Make NQP understand single quoted strings on the LHS of =>
Browse files Browse the repository at this point in the history
  • Loading branch information
perlpilot committed Mar 10, 2010
1 parent 2d51ec9 commit c441ffc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/NQP/Actions.pm
Expand Up @@ -269,6 +269,7 @@ method statement_mod_loop:sym<until>($/) { make $<cond>.ast; }
## Terms

method term:sym<fatarrow>($/) { make $<fatarrow>.ast; }
method term:sym<fatarrow2>($/) { make $<fatarrow2>.ast; }
method term:sym<colonpair>($/) { make $<colonpair>.ast; }
method term:sym<variable>($/) { make $<variable>.ast; }
method term:sym<package_declarator>($/) { make $<package_declarator>.ast; }
Expand All @@ -284,6 +285,12 @@ method fatarrow($/) {
make $past;
}

method fatarrow2($/) {
my $past := $<val>.ast;
$past.named( $<key>.ast );
make $past;
}

method colonpair($/) {
my $past := $<circumfix>
?? $<circumfix>[0].ast
Expand Down
5 changes: 5 additions & 0 deletions src/NQP/Grammar.pm
Expand Up @@ -214,6 +214,7 @@ token statement_mod_loop:sym<until> { <sym> :s <cond=.EXPR> }
## Terms

token term:sym<fatarrow> { <fatarrow> }
token term:sym<fatarrow2> { <fatarrow2> }
token term:sym<colonpair> { <colonpair> }
token term:sym<variable> { <variable> }
token term:sym<package_declarator> { <package_declarator> }
Expand All @@ -227,6 +228,10 @@ token fatarrow {
<key=.identifier> \h* '=>' <.ws> <val=.EXPR('i=')>
}

token fatarrow2 {
<?[']> <key=.quote_EXPR: ':q'> \h* '=>' <.ws> <val=.EXPR('i=')>
}

token colonpair {
':'
[
Expand Down

0 comments on commit c441ffc

Please sign in to comment.