-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Support ternary operator in PowerShell language #10367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7da8121
ce0db4d
c0508e2
bd26ce6
ca13df1
b82e011
e50d289
b2961f2
77ffa81
8acb7f1
a2662e7
cceb44a
77f957e
99638f9
81caabb
58bc98d
a03d358
0c58cdb
274d1a8
5e49fdb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -374,13 +374,26 @@ internal static bool ForceStartNewToken(this char c) | |
| return c.IsWhitespace(); | ||
| } | ||
|
|
||
| // Return true if the character ends the current number token. This allows the tokenizer | ||
| // to scan '7z' as a single token, but '7+' as 2 tokens. | ||
| internal static bool ForceStartNewTokenAfterNumber(this char c) | ||
| /// <summary> | ||
| /// Check if the current character forces to end scanning a number token. | ||
| /// This allows the tokenizer to scan '7z' as a single token, but '7+' as 2 tokens. | ||
| /// </summary> | ||
| /// <param name="c">The character to check.</param> | ||
| /// <param name="forceEndNumberOnTernaryOperatorChars"> | ||
| /// In some cases, we want '?' and ':' to end a number token too, so they can be | ||
| /// treated as the ternary operator tokens. | ||
| /// </param> | ||
| /// <returns>Return true if the character ends the current number token.</returns> | ||
| internal static bool ForceStartNewTokenAfterNumber(this char c, bool forceEndNumberOnTernaryOperatorChars) | ||
| { | ||
| if (c < 128) | ||
| { | ||
| return (s_traits[c] & CharTraits.ForceStartNewTokenAfterNumber) != 0; | ||
| if ((s_traits[c] & CharTraits.ForceStartNewTokenAfterNumber) != 0) | ||
| { | ||
| return true; | ||
| } | ||
|
|
||
| return forceEndNumberOnTernaryOperatorChars && (c == '?' || c == ':'); | ||
|
||
| } | ||
|
|
||
| return c.IsDash(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.