|
599 | 599 | <key>include</key> |
600 | 600 | <string>#commentBlock</string> |
601 | 601 | </dict> |
| 602 | + <dict> |
| 603 | + <key>comment</key> |
| 604 | + <string>normally provided by command mode, but thats not available here</string> |
| 605 | + <key>match</key> |
| 606 | + <string>`\n</string> |
| 607 | + <key>name</key> |
| 608 | + <string>constant.character.escape.powershell</string> |
| 609 | + </dict> |
602 | 610 | </array> |
603 | 611 | </dict> |
604 | 612 | <dict> |
|
752 | 760 | </dict> |
753 | 761 | <dict> |
754 | 762 | <key>comment</key> |
755 | | - <string>do,for,foreach,while: allow a `:label` that must start the statement; A `:label` before a loop looks just like a function, and its possible to put the loop keyword on a later line! Here we just see if a valid label appears to be the only useful thing on a single line</string> |
| 763 | + <string>do,for,foreach,switch,while: allow a `:label` that must start the statement; A `:label` before a loop looks just like a function, and its possible to put the loop keyword on a later line! Here we just see if a valid label appears to be the only useful thing on a single line</string> |
756 | 764 | <key>match</key> |
757 | | - <string>(?>(:)([\p{L}_]\w*)(?![^\s{(,;&|)}]))(?=(?>(?:`\s|\s*<#.*?#>)*)\s*(?:(?i:do|for(?:each)?|while)(?![^\s{(,;&|)}])|#|<#.*$|`?$))</string> |
| 765 | + <string>(?>(:)([\p{L}_]\w*)(?![^\s{(,;&|)}]))(?=(?>(?:`\s|\s*<#.*?#>)*)\s*(?:(?i:do|for(?:each)?|switch|while)(?![^\s{(,;&|)}])|#|<#.*$|`?$))</string> |
758 | 766 | <key>captures</key> |
759 | 767 | <dict> |
760 | 768 | <key>1</key> |
|
1014 | 1022 | <key>comment</key> |
1015 | 1023 | <string>-parallel parameter can only be used in a workflow, consider using meta scopes, and an injection to properly catch this</string> |
1016 | 1024 | <key>match</key> |
1017 | | - <string>(?i:[\x{2013}-\x{2015}-]parallel)</string> |
1018 | | - <key>name</key> |
1019 | | - <string>entity.name.parameter.foreach-parallel.powershell</string> |
| 1025 | + <string>(?i:[\x{2013}-\x{2015}-]parallel)(?:(:)?|(?![^\s{(,;&|)}]))</string> |
| 1026 | + <key>beginCaptures</key> |
| 1027 | + <dict> |
| 1028 | + <key>1</key> |
| 1029 | + <dict> |
| 1030 | + <key>name</key> |
| 1031 | + <string>entity.name.parameter.foreach-parallel.powershell</string> |
| 1032 | + </dict> |
| 1033 | + <key>2</key> |
| 1034 | + <dict> |
| 1035 | + <key>name</key> |
| 1036 | + <string>punctuation.separator.parameter-value.powershell</string> |
| 1037 | + </dict> |
| 1038 | + </dict> |
1020 | 1039 | </dict> |
1021 | 1040 | <dict> |
1022 | 1041 | <key>include</key> |
|
1815 | 1834 | <array> |
1816 | 1835 | <dict> |
1817 | 1836 | <key>match</key> |
1818 | | - <string>(?i:[\x{2013}-\x{2015}-](regex|wildcard|exact|casesensitive))</string> |
1819 | | - <key>name</key> |
1820 | | - <string>entity.name.parameter.switch-$0.powershell</string> |
| 1837 | + <string>((?i:[\x{2013}-\x{2015}-](regex|wildcard|exact|casesensitive)))(?:(:)?|(?![^\s{(,;&|)}]))</string> |
| 1838 | + <key>captures</key> |
| 1839 | + <dict> |
| 1840 | + <key>1</key> |
| 1841 | + <dict> |
| 1842 | + <key>name</key> |
| 1843 | + <string>entity.name.parameter.switch-$2.powershell</string> |
| 1844 | + </dict> |
| 1845 | + <key>3</key> |
| 1846 | + <dict> |
| 1847 | + <key>name</key> |
| 1848 | + <string>punctuation.separator.parameter-value.powershell</string> |
| 1849 | + </dict> |
| 1850 | + </dict> |
1821 | 1851 | </dict> |
1822 | 1852 | <dict> |
1823 | 1853 | <key>comment</key> |
1824 | 1854 | <string>-file is special case, needs file argument, no condition expression</string> |
1825 | 1855 | <key>begin</key> |
1826 | | - <string>((?i:[\x{2013}-\x{2015}-]file))(:)?</string> |
| 1856 | + <string>((?i:[\x{2013}-\x{2015}-]file))(?:(:)?|(?![^\s{(,;&|)}]))</string> |
1827 | 1857 | <key>beginCaptures</key> |
1828 | 1858 | <dict> |
1829 | 1859 | <key>1</key> |
|
2155 | 2185 | <key>comment</key> |
2156 | 2186 | <string>-supportedcommand is special case, array of arguments</string> |
2157 | 2187 | <key>begin</key> |
2158 | | - <string>((?i:[\x{2013}-\x{2015}-]supportedcommand))(:)?</string> |
| 2188 | + <string>((?i:[\x{2013}-\x{2015}-]supportedcommand))(?:(:)?|(?![^\s{(,;&|)}]))</string> |
2159 | 2189 | <key>beginCaptures</key> |
2160 | 2190 | <dict> |
2161 | 2191 | <key>1</key> |
|
2484 | 2514 | <dict> |
2485 | 2515 | <key>comment</key> |
2486 | 2516 | <string>Next token needs to be an operand for the operator, not the actual command, but an expression or unquoted expandable string that describes the command's name.</string> |
2487 | | - <key>include</key> |
2488 | | - <string>#argument_mode</string> |
| 2517 | + <key>begin</key> |
| 2518 | + <string>\G(?![,;&|)}<>])</string> |
| 2519 | + <key>end</key> |
| 2520 | + <string>(?=.|$)</string> |
| 2521 | + <key>applyEndPatternLast</key> |
| 2522 | + <true/> |
| 2523 | + <key>patterns</key> |
| 2524 | + <array> |
| 2525 | + <dict> |
| 2526 | + <key>include</key> |
| 2527 | + <string>#advanceToToken</string> |
| 2528 | + </dict> |
| 2529 | + <dict> |
| 2530 | + <key>begin</key> |
| 2531 | + <string>(?<=[\s>]|\G|^)(?![\s#,;&|)}<>]|<#|$)</string> |
| 2532 | + <key>end</key> |
| 2533 | + <string>(?!\G)</string> |
| 2534 | + <key>name</key> |
| 2535 | + <string>meta.argument.invoke-or-source.powershell</string> |
| 2536 | + <key>patterns</key> |
| 2537 | + <array> |
| 2538 | + <dict> |
| 2539 | + <key>include</key> |
| 2540 | + <string>#argument</string> |
| 2541 | + </dict> |
| 2542 | + </array> |
| 2543 | + </dict> |
| 2544 | + </array> |
| 2545 | + </dict> |
| 2546 | + <dict> |
| 2547 | + <key>comment</key> |
| 2548 | + <string>Next token needs to be an operand for the operator, not the actual command, but an expression or unquoted expandable string that describes the command's name.</string> |
| 2549 | + <key>begin</key> |
| 2550 | + <string>(?![\n;)}\]])</string> |
| 2551 | + <key>end</key> |
| 2552 | + <string>$(?=\n)|(?=[;)}\]])</string> |
| 2553 | + <key>patterns</key> |
| 2554 | + <array> |
| 2555 | + <dict> |
| 2556 | + <key>include</key> |
| 2557 | + <string>#argument_mode</string> |
| 2558 | + </dict> |
| 2559 | + </array> |
2489 | 2560 | </dict> |
2490 | 2561 | </array> |
2491 | 2562 | </dict> |
|
2590 | 2661 | <key>include</key> |
2591 | 2662 | <string>#command_name</string> |
2592 | 2663 | </dict> |
| 2664 | + <dict> |
| 2665 | + <key>comment</key> |
| 2666 | + <string>catch that which didn't match elsewhere</string> |
| 2667 | + <key>match</key> |
| 2668 | + <string>[^\s]</string> |
| 2669 | + <key>name</key> |
| 2670 | + <string>invalid.source.powershell</string> |
| 2671 | + </dict> |
2593 | 2672 | </array> |
2594 | 2673 | </dict> |
2595 | 2674 | <key>command_name</key> |
|
2891 | 2970 | <string>#operators</string> |
2892 | 2971 | </dict> |
2893 | 2972 | <dict> |
2894 | | - <key>include</key> |
2895 | | - <string>#notCode</string> |
2896 | | - </dict> |
2897 | | - <dict> |
2898 | | - <key>match</key> |
| 2973 | + <key>ignore</key> |
2899 | 2974 | <string>`</string> |
2900 | 2975 | <key>name</key> |
2901 | 2976 | <string>invalid.character.escape.powershell</string> |
2902 | 2977 | </dict> |
| 2978 | + <dict> |
| 2979 | + <key>include</key> |
| 2980 | + <string>#notCode</string> |
| 2981 | + </dict> |
2903 | 2982 | </array> |
2904 | 2983 | </dict> |
2905 | 2984 | <key>operand</key> |
|
6551 | 6630 | <key>comment</key> |
6552 | 6631 | <string>when nothing else matches in usual tokenizing, consume it to prevent other patterns from striking in the middle of what might be a command name.</string> |
6553 | 6632 | <key>begin</key> |
6554 | | - <string>(?=[^\[\s{(,;&)}])</string> |
6555 | | - <key>alternateBegin</key> |
6556 | | - <string>(?=[^\x{2018}-\x{201B}"\x{201C}-\x{201E}\s\[(){},;&|$@])|(?<=\S)(?=[$@<>])</string> |
| 6633 | + <string>(?=[^\[\s{(,;&|)}])</string> |
6557 | 6634 | <key>end</key> |
6558 | | - <string>(?=[\s{(,;&)}])</string> |
| 6635 | + <string>(?=[\s{(,;&|)}])</string> |
6559 | 6636 | <key>contentName</key> |
6560 | 6637 | <string>invalid.source.powershell</string> |
6561 | 6638 | <key>patterns</key> |
|
0 commit comments