-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Steps to reproduce
Note the different requirements:
function :hello" {} # allowed single double-quote
function hello"" {} #required matching double-quotes
function global::hello"" {} #also requires matching double quotes
function :hello` more {} # error, 'more' was not expected.
`function hello` more {} # works fine, function name is 'hello more'Expected behavior
All to be consistent.
Actual behavior
It seems that some rules for labels are being applied to functions who's name token directly start with a colon, as the rules seem to match, such that any character that would fail as a label character just gets consumed in to the name with no regard to the rules of that character, such as the double-quote in the first statement above, or the backtick in the 4th statement.
I noticed this while trying to correct the PowerShell/EditorSyntax for function names, see PowerShell/EditorSyntax#156 for my work. I've noticed that a label can also be a function, and that is difficult to properly detect in a TM grammar, so I was double checking some of my matches when I noticed this, and at first thought I had the rules to function names wrong.
Environment data
Tested on 5.1 Windows PowerShell and 6.2 preview
Name Value
---- -----
PSVersion 6.2.0-preview.4
PSEdition Core
GitCommitId 6.2.0-preview.4
OS Microsoft Windows 10.0.18334
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0