Last active
March 26, 2025 02:36
-
-
Save MasterDuke17/f81a0a2cfe46be69de9c132e0c450783 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git src/Raku/Grammar.nqp src/Raku/Grammar.nqp | |
index 6ac245eb1..821864dd8 100644 | |
--- src/Raku/Grammar.nqp | |
+++ src/Raku/Grammar.nqp | |
@@ -3945,25 +3945,29 @@ grammar Raku::Grammar is HLL::Grammar does Raku::Common { | |
self.typed-sorry('X::Syntax::Reserved', |%args); | |
} | |
+ token var-dec { | |
+ [ | |
+ | <sigil> <twigil>? <desigilname>? | |
+ | |
+ | $<sigil>=['$'] $<desigilname>=[<[/_!¢]>] | |
+ | |
+ | $<desigilname>=<.sigilless-variable> | |
+ | |
+ # TODO cases for when you declare something you're not allowed to | |
+ ] | |
+ } | |
+ | |
token variable-declarator { | |
:my $*IN-DECL := 'variable'; | |
:my $*VARIABLE; | |
:my $*VARIABLE-NAME; | |
:my $sigil; | |
- [ | |
- | <sigil> <twigil>? <desigilname>? | |
- | |
- | $<sigil>=['$'] $<desigilname>=[<[/_!¢]>] | |
- | |
- | $<desigilname>=<.sigilless-variable> | |
- | |
- # TODO cases for when you declare something you're not allowed to | |
- ] | |
+ <var-dec> | |
{ | |
$*IN-DECL := ''; | |
$*LEFTSIGIL := self.leading-char unless $*LEFTSIGIL; | |
- $sigil := $<sigil> ?? $<sigil>.Str !! ""; | |
- $*VARIABLE-NAME := $<sigil> ~ $<twigil> ~ $<desigilname>; | |
+ $sigil := $<var-dec><sigil> ?? $<var-dec><sigil>.Str !! ""; | |
+ $*VARIABLE-NAME := $<var-dec><sigil> ~ $<var-dec><twigil> ~ $<var-dec><desigilname>; | |
$/.add-variable($*VARIABLE-NAME); | |
} | |
[ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment