Skip to content

Commit

Permalink
RakuAST: simplify blorst handling
Browse files Browse the repository at this point in the history
This saves one ternary check for each blorst
  • Loading branch information
lizmat committed Aug 2, 2023
1 parent 4c1ea9f commit 652b305
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/Raku/Actions.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,7 @@ class Raku::Actions is HLL::Actions does Raku::CommonActions {
# Statement prefixes

# Helper method to normalize a blorst
method blorst($/) {
self.attach: $/, $<block> ?? $<block>.ast !! $<statement>.ast;
}
method blorst($/) { self.attach: $/, $<block>.ast }

# Helper method for setting up simple prefix that just take a blorst
method SP-prefix($/, $name) {
Expand Down
2 changes: 1 addition & 1 deletion src/Raku/Grammar.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ grammar Raku::Grammar is HLL::Grammar does Raku::Common {
token blorst {
[
| <?[{]> <block>
| <![;]> <statement> <.cheat-heredoc>?
| <![;]> <block=.statement> <.cheat-heredoc>?
|| <.missing: 'block or statement'>
]
}
Expand Down

0 comments on commit 652b305

Please sign in to comment.