Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
disallow anon sigils in quotes
  • Loading branch information
TimToady committed Aug 30, 2014
1 parent 2e9a1d9 commit 5f9cd51
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Perl6/Grammar.nqp
Expand Up @@ -1939,18 +1939,14 @@ grammar Perl6::Grammar is HLL::Grammar does STD {

regex special_variable:sym<${ }> {
<sigil> '{' {} $<text>=[.*?] '}'
<!{ $*QSIGIL }>
<?{
my $sigil := $<sigil>.Str;
my $text := $<text>.Str;
my $bad := $sigil ~ '{' ~ $text ~ '}';
$text := $text - 1 if $text ~~ /^\d+$/ && $text > 0;
if !($text ~~ /^(\w|\:)+$/) {
if $*QSIGIL {
0
}
else {
$/.CURSOR.obs($bad, $sigil ~ '(' ~ $text ~ ')');
}
$/.CURSOR.obs($bad, $sigil ~ '(' ~ $text ~ ')');
}
elsif $*QSIGIL {
$/.CURSOR.obs($bad, '{' ~ $sigil ~ $text ~ '}');
Expand Down Expand Up @@ -1984,7 +1980,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
| <sigil> <?[<]> <postcircumfix> [<?{ $*IN_DECL }> <.typed_panic('X::Syntax::Variable::Match')>]?
| :dba('contextualizer') <sigil> '(' ~ ')' <sequence> [<?{ $*IN_DECL }> <.panic: "Cannot declare a contextualizer">]?
| $<sigil>=['$'] $<desigilname>=[<[/_!]>]
| {} <sigil> # try last, to allow sublanguages to redefine sigils (like & in regex)
| {} <sigil> <!{ $*QSIGIL }> # try last, to allow sublanguages to redefine sigils (like & in regex)
]
[ <?{ $<twigil> && $<twigil> eq '.' }>
[ <.unsp> | '\\' | <?> ] <?[(]> <arglist=.postcircumfix>
Expand Down

0 comments on commit 5f9cd51

Please sign in to comment.