-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Issue Details
I have left the template blank at this time, but I believe this might affect all versions.
- In argument mode, each value is treated as an expandable string unless it begins with one of the following special characters: dollar sign ($), at sign (@), single quotation mark ('), double quotation mark ("), or an opening parenthesis (().
If preceded by one of these characters, the value is treated as a value expression.
On about_parsing, there are additional characters that cause the expression mode, including:
- '-' or '+' or '!' as long as it is in turn followed by a numeric value or one of the other mentioned characters, ie, a valid expression.
-$a or -2 or !$a is an expression mode
-hello or +hello or !test is an argument mode
Also, I think the last line should actually be part of the bulleted paragraph.
I think this whole section also fails to explain that the mode determination is based on the first token of each command statement and then applies to the remainder of the statement, noting that parenthesis and braces begin a new sub-statement. Instead this section implies that the mode is determine for each token (it mentions the tokens are interpreted independently, but they are not, as interpretation of all tokens after the first one depend on the first one's evaluation). Assuming a function named 'hello', hello $a-3, the token $a-3 is still treated as an expandable string, not an expression. An example in the doc also shows this, Write-Output $a/H.
Also, I think the word 'value' may have gotten used where 'token' should have been used, for consistency. The doc started off talking about 'tokens' and then switches to 'values' in the bulleted items.
Document Details
Do not edit this section. It is required for docs.microsoft.com GitHub issue linking.
- ID: efd8c446-9ff3-8331-a996-4fe6226f2c6d
- Version Independent ID: b9957906-f58b-86de-7907-cc2f94174af3
- Content: about_Parsing - PowerShell
- Content Source: reference/7.0/Microsoft.PowerShell.Core/About/about_Parsing.md
- Product: powershell
- Technology: powershell-conceptual
- GitHub Login: @SteveL-MSFT
- Microsoft Alias: slee