Skip to content

Commit

Permalink
RakuAST: support {*} in term position
Browse files Browse the repository at this point in the history
This is enough to support re-dispatch from protos to the multi, e.g.
proto foo(|) { say "before"; {*}; say "after"}
  • Loading branch information
niner committed Mar 10, 2023
1 parent 525dd64 commit 5a86936
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Raku/Actions.nqp
Expand Up @@ -1250,6 +1250,10 @@ class Raku::Actions is HLL::Actions does Raku::CommonActions {
self.attach: $/, self.r('Term', 'Capture').new($<args>.ast);
}

method term:sym<onlystar>($/) {
self.attach: $/, self.r('OnlyStar').new;
}

method colonpair($/) {
my $key-str := $*key;
if $key-str {
Expand Down
5 changes: 5 additions & 0 deletions src/Raku/Grammar.nqp
Expand Up @@ -1798,6 +1798,11 @@ grammar Raku::Grammar is HLL::Grammar does Raku::Common {
]
}
token term:sym<onlystar> {
'{*}' <?ENDSTMT>
# [ <?{ $*IN_PROTO }> || <.panic: '{*} may only appear in proto'> ]
}
token colonpair {
:my $*key;
':'
Expand Down

0 comments on commit 5a86936

Please sign in to comment.