There are multiple issues with variables as they stand now in the grammar some of which have been reported and some of which haven't:
There are also questions about the correct scope of properties and methods (mentioned #131) and questions about to what extent the grammar should be concerned with user expectation/"most themes" vs either correctness (subjective) or consistency (with which languages?) (#130 and #129).
Background
The following cases need to be covered with as little repetition / complexity as possible:
- Regular variables with and without scopes, properties, array position, methods, etc.
- Variables contained within strings.
- Variables contained within sub-expressions with and without scopes, properties, array position, methods, etc.
- Variables in and out of strings and sub-expressions when using the
${Variable} format again with and without scopes, properties, array position, methods, etc.
The following gotchas need to be taken in to account:
- Which special characters are legal within
${Variable} syntax vs $Variable syntax.
- International characters (
\p{L} vs [A-z]`).
- Access of variables through splatting where the sigil is
@.
- Separate scoping for constants, automatic variables, language variables, etc.
$$ where "$$Hello" needs to show $$ as the variable and Hello as part of the double quoted string and other similar oddities.
- Lots of others...
Planned Format/Rules
??? tbd
Re: Scope selection -> See #138
There are multiple issues with variables as they stand now in the grammar some of which have been reported and some of which haven't:
$_,$$,$?are treated differently depending on context and are currently scoped incorrectly: $_ scoped differently between inside and outside string.quoted.double #133$Var?Iable), and special automatic variables like$<drive letter>:folderdon't highlight correctly: Handle special characters in variable names. #49There are also questions about the correct scope of properties and methods (mentioned #131) and questions about to what extent the grammar should be concerned with user expectation/"most themes" vs either correctness (subjective) or consistency (with which languages?) (#130 and #129).
Background
The following cases need to be covered with as little repetition / complexity as possible:
${Variable}format again with and without scopes, properties, array position, methods, etc.The following gotchas need to be taken in to account:
${Variable}syntax vs$Variablesyntax.\p{L}vs [A-z]`).@.$$where"$$Hello"needs to show$$as the variable andHelloas part of the double quoted string and other similar oddities.Planned Format/Rules
??? tbd
Re: Scope selection -> See #138