Skip to content

Commit

Permalink
#2912 Properly lex special variables followed by operator
Browse files Browse the repository at this point in the history
Fixes #2912
  • Loading branch information
hurricup committed Sep 28, 2024
1 parent 2bf1083 commit a674e5a
Show file tree
Hide file tree
Showing 6 changed files with 5,894 additions and 5,292 deletions.
11 changes: 6 additions & 5 deletions plugin/core/grammar/Perl.flex
Original file line number Diff line number Diff line change
Expand Up @@ -880,11 +880,12 @@ POSIX_CHARGROUP_ANY = {POSIX_CHARGROUP}|{POSIX_CHARGROUP_DOUBLE}
}

<VARIABLE_UNBRACED>{
// we are here after a sigil, and we can't cast to the $OLD_PERL_VERSION variable $]
"$" / "]" {return getUnbracedVariableNameToken();}
// this is a subset of builtins, $;, $, for example, can't be dereferenced
"$" / [\{\"\'\[\]\`\\\!\%\&\(\+\-\.\/\<\=\>\|\~\?\:\*\^\@\_\$\:\w_\d] {return processUnbracedScalarSigil();}
"{" {return startBracedVariable();}
// followed by the built-in variable which can't be dereferenced, so this is a variable name
"$" / [\.\,\/\\\|\%\-\+\?\:\=\^\~\!\@\#\*\(\)\<\>0\;\[\]\&\`\'\"] {return getUnbracedVariableNameToken();}
// this is definitely a sigil
"$" / [\{\_\$\w_] {return processUnbracedScalarSigil();}

"{" {return startBracedVariable();}
{VARIABLE_NAME} {return getUnbracedVariableNameToken();}
}

Expand Down
Loading

0 comments on commit a674e5a

Please sign in to comment.