|
15 | 15 | { |
16 | 16 | pattern: /"(?:`[\s\S]|[^`"])*"/, |
17 | 17 | greedy: true, |
18 | | - inside: { |
19 | | - 'function': { |
20 | | - // Allow for one level of nesting |
21 | | - pattern: /(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/, |
22 | | - lookbehind: true, |
23 | | - // Populated at end of file |
24 | | - inside: {} |
25 | | - } |
26 | | - } |
| 18 | + inside: null // see below |
27 | 19 | }, |
28 | 20 | { |
29 | 21 | pattern: /'(?:[^']|'')*'/, |
|
45 | 37 | // per http://technet.microsoft.com/en-us/library/hh847744.aspx |
46 | 38 | 'keyword': /\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i, |
47 | 39 | 'operator': { |
48 | | - pattern: /(\W?)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i, |
| 40 | + pattern: /(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i, |
49 | 41 | lookbehind: true |
50 | 42 | }, |
51 | 43 | 'punctuation': /[|{}[\];(),.]/ |
52 | 44 | }; |
53 | 45 |
|
54 | 46 | // Variable interpolation inside strings, and nested expressions |
55 | | - var stringInside = powershell.string[0].inside; |
56 | | - stringInside.boolean = powershell.boolean; |
57 | | - stringInside.variable = powershell.variable; |
58 | | - stringInside.function.inside = powershell; |
| 47 | + powershell.string[0].inside = { |
| 48 | + 'function': { |
| 49 | + // Allow for one level of nesting |
| 50 | + pattern: /(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/, |
| 51 | + lookbehind: true, |
| 52 | + inside: powershell |
| 53 | + }, |
| 54 | + 'boolean': powershell.boolean, |
| 55 | + 'variable': powershell.variable, |
| 56 | + }; |
59 | 57 |
|
60 | 58 | }(Prism)); |
0 commit comments