From ab8e46360b80aad85d32f634ab84aa254e2099a6 Mon Sep 17 00:00:00 2001 From: msftrncs Date: Sat, 30 Mar 2019 17:36:26 -0500 Subject: [PATCH] dot source and unquoted argument updates --- PowerShellSyntax.tmLanguage | 117 +++++++++++++++++++++++++++++++----- 1 file changed, 101 insertions(+), 16 deletions(-) diff --git a/PowerShellSyntax.tmLanguage b/PowerShellSyntax.tmLanguage index f8d2055..32b79fd 100644 --- a/PowerShellSyntax.tmLanguage +++ b/PowerShellSyntax.tmLanguage @@ -2584,7 +2584,7 @@ comment (dot) source operator, requires trailing space, or invoke operator begin - &|\.(?=\*?[\s,;&|{}\(\)]|\$[\p{L}$?^:_{]) + &|\.(?=[\s{(,;&|)}"\x{201C}-\x{201E}'\x{2018}-\x{201B}]|\$[\p{L}$?^:_{(]) beginCaptures 0 @@ -2860,10 +2860,6 @@ include #expressionGroup - - include - #substatement - include #hashtable @@ -2874,15 +2870,81 @@ include - #variable + #quotedStrings_Members include - #quotedStrings_Members + #numericConstant_argumentMode + + + comment + could be variable reference, if it doesn't have member reference, its the start of an unquoted expandable string + begin + (?=\$(?!\()) + end + (?=.|$) + applyEndPatternLast + + patterns + + + comment + check out the first variable reference + begin + \G(?=\$) + end + (?!\G) + patterns + + + include + #variableNoProperty + + + + + comment + if a member access doesn't occur after variable, finish as an unquoted expandable string argument. + begin + (?=[^\s{(,;&|)}])(?!(?=\.(?!\.)|::|\[)) + end + (?=.|$) + applyEndPatternLast + + patterns + + + include + #unquotedArgument + + + + + begin + (?=\.(?!\.)|::|\[) + end + (?=.|$) + applyEndPatternLast + + patterns + + + include + #accessors + + + comment + attempt another argument after member access + include + #argument + + + + include - #numericConstant_argumentMode + #substatement include @@ -2996,6 +3058,12 @@ name invalid.character.escape.powershell + + match + \.(?=\$) + name + string.unquoted.argument.powershell + begin (?=[^\s{(,;&|)}]) @@ -5746,14 +5814,14 @@ begin (?=\$(?:(?>[\w][\w?]*:(?!:)|:)?(?:[\w?](?:[\w?]|:(?!:))*|:(?!:))|[$^:]|\{)) end - (?=.|$) + (?!\G) applyEndPatternLast - + patterns begin - \$(?:(?>[\w][\w?]*:(?!:)|:)?(?:[\w?](?:[\w?]|:(?!:))*|:(?!:))|[$^:])(?=\.(?!\.)|::|\[) + \G\$(?:(?>[\w][\w?]*:(?!:)|:)?(?:[\w?](?:[\w?]|:(?!:))*|:(?!:))|[$^:])(?=\.(?!\.)|::|\[) beginCaptures 0 @@ -5781,7 +5849,7 @@ match - \$(?:(?>[\w][\w?]*:(?!:)|:)?(?:[\w?](?:[\w?]|:(?!:))*|:(?!:))|[$^:]) + \G\$(?:(?>[\w][\w?]*:(?!:)|:)?(?:[\w?](?:[\w?]|:(?!:))*|:(?!:))|[$^:]) captures 0 @@ -5806,7 +5874,7 @@ comment splatting cannot have members and certain characters following, including no line comment match - (?>@(?:(?>[\w][\w?]*:(?!:)|:)?(?:[\w?](?:[\w?]|:(?!:))*|:(?!:))|[$^:]))(?![~`!@#$%^*<>\]\\/"\x{201C}-\x{201E}'\x{2018}-\x{201B}+-]) + \G(?>@(?:(?>[\w][\w?]*:(?!:)|:)?(?:[\w?](?:[\w?]|:(?!:))*|:(?!:))|[$^:]))(?![~`!@#$%^*<>\]\\/"\x{201C}-\x{201E}'\x{2018}-\x{201B}+-]) captures 0 @@ -5828,14 +5896,14 @@ begin (?=\$(?:(?>[\w][\w?]*:(?!:)|:)?(?:[\w?](?:[\w?]|:(?!:))*|:(?!:))|[$^:]|\{)) end - (?=.|$) + (?!\G) applyEndPatternLast - + patterns match - \$(?:(?>[\w][\w?]*:(?!:)|:)?(?:[\w?](?:[\w?]|:(?!:))*|:(?!:))|[$^:]) + \G\$(?:(?>[\w][\w?]*:(?!:)|:)?(?:[\w?](?:[\w?]|:(?!:))*|:(?!:))|[$^:]) captures 0 @@ -6255,6 +6323,23 @@ + + begin + \$\{ + end + } + patterns + + + match + \$ + + + include + #functionName + + + unquotedStrings_text