You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a list of special characters that don't require ${ } anywhere? Ie, $Foo*bar is allowed but you need to use ${Foo*bar}. I assume it's every special character that isn't an operator or keyword but I could be wrong.
changed the title [-]Syntax highlighting for variables incorrect where ? is treated as token separator[/-][+]Handle special characters in variable names.[/+]on May 21, 2018
one more instance I know of is $a:b. There are a few well-known prefixes like $private:, $script:, $global:, but this syntax applies to more scenarios beyond, such as
$function:SayHello = {"Hello"}
SayHello
> Hello
$f:myfile = "content for my file"
$f:myfile
> content for my file
cat F:\myfile
> content for my file
$f:myfile:alternateDataStream = "hidden content"
$f:myfile:alternateDataStream
> hidden content
cat F:\myfile:alternateDataStream
> hidden content
You can look at the tokenizer code to see what characters are valid. Basically almost anything and if you use a brace, pretty much anything (including whitespace) until a closing brace.
Will need to give some thought to the best way to tackle variables. With so many ways to PowerShell a cat I want to cover all of the variable variants in as concise a manner as possible. The current definitions are not great.
Dongbo Wang (@daxian-dbw), part of me hates that those are real... part of me thinks that's super cool lol.
Nick James (@omniomi) It seems that the main set of characters is [A-z0-9_?:]. However, if it's a colon followed by another colon, it's a static member and not part of the variable name like $a::b. And if a brace follows the $, then anything until the closing brace is part of the variable name.
I just need to figure out the best way to split everything in the repository so that it can be logically included in other places. How things are highlighted on their own, in strings, in sub-expressions, etc adds to the complexity. Can't just have one variable definition and use it everywhere. Splatting adds to complexity as well since Get-Something @Splat is a variable but $ByLine = "Author: @omniomi" is not.
Activity
omniomi commentedon May 21, 2018
Is there a list of special characters that don't require
${ }anywhere? Ie,$Foo*baris allowed but you need to use${Foo*bar}. I assume it's every special character that isn't an operator or keyword but I could be wrong.[-]Syntax highlighting for variables incorrect where ? is treated as token separator[/-][+]Handle special characters in variable names.[/+]TylerLeonhardt commentedon May 21, 2018
Hmm I think James Truher (@JamesWTruher), Dongbo Wang (@daxian-dbw), or Steve Lee (@SteveL-MSFT) might know the answer to that.
daxian-dbw commentedon May 21, 2018
one more instance I know of is
$a:b. There are a few well-known prefixes like$private:,$script:,$global:, but this syntax applies to more scenarios beyond, such asSteveL-MSFT commentedon May 22, 2018
You can look at the tokenizer code to see what characters are valid. Basically almost anything and if you use a brace, pretty much anything (including whitespace) until a closing brace.
omniomi commentedon May 22, 2018
Thanks Steve Lee (@SteveL-MSFT).
Will need to give some thought to the best way to tackle variables. With so many ways to PowerShell a cat I want to cover all of the variable variants in as concise a manner as possible. The current definitions are not great.
Dongbo Wang (@daxian-dbw), part of me hates that those are real... part of me thinks that's super cool lol.
SteveL-MSFT commentedon May 22, 2018
Nick James (@omniomi) It seems that the main set of characters is [A-z0-9_?:]. However, if it's a colon followed by another colon, it's a static member and not part of the variable name like $a::b. And if a brace follows the
$, then anything until the closing brace is part of the variable name.omniomi commentedon May 22, 2018
Steve Lee (@SteveL-MSFT) that works and should probably cover most cases.
I just need to figure out the best way to split everything in the repository so that it can be logically included in other places. How things are highlighted on their own, in strings, in sub-expressions, etc adds to the complexity. Can't just have one variable definition and use it everywhere. Splatting adds to complexity as well since
Get-Something @Splatis a variable but$ByLine = "Author: @omniomi"is not.