OLD | NEW |
1 Prism.languages.powershell = { | 1 Prism.languages.powershell = { |
2 'comment': [ | 2 'comment': [ |
3 { | 3 { |
4 pattern: /(^|[^`])<#[\w\W]*?#>/, | 4 pattern: /(^|[^`])<#[\w\W]*?#>/, |
5 lookbehind: true | 5 lookbehind: true |
6 }, | 6 }, |
7 { | 7 { |
8 » » » pattern: /(^|[^`])#.*?(\r?\n|$)/, | 8 » » » pattern: /(^|[^`])#.+/, |
9 lookbehind: true | 9 lookbehind: true |
10 } | 10 } |
11 ], | 11 ], |
12 » 'string': { | 12 » 'string': [ |
13 » » pattern: /("|')(`?[\w\W])*?\1/m, | 13 » » { |
14 » » inside: {} | 14 » » » pattern: /"(`?[\w\W])*?"/, |
15 » }, | 15 » » » inside: { |
| 16 » » » » 'function': { |
| 17 » » » » » pattern: /[^`]\$\(.*?\)/, |
| 18 » » » » » // Populated at end of file |
| 19 » » » » » inside: {} |
| 20 » » » » } |
| 21 » » » } |
| 22 » » }, |
| 23 » » /'([^']|'')*'/ |
| 24 » ], |
16 // Matches name spaces as well as casts, attribute decorators. Force sta
rting with letter to avoid matching array indices | 25 // Matches name spaces as well as casts, attribute decorators. Force sta
rting with letter to avoid matching array indices |
17 'namespace': /\[[a-z][\w\W]*?\]/i, | 26 'namespace': /\[[a-z][\w\W]*?\]/i, |
18 'boolean': /\$(true|false)\b/i, | 27 'boolean': /\$(true|false)\b/i, |
19 'variable': /\$\w+\b/i, | 28 'variable': /\$\w+\b/i, |
20 // per http://technet.microsoft.com/en-us/library/hh847744.aspx | |
21 'keyword': /\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicPa
ram|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|In|InlineSc
ript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Va
r|While|Workflow)\b/i, | |
22 // Cmdlets and aliases. Aliases should come last, otherwise "write" gets
preferred over "write-host" for example | 29 // Cmdlets and aliases. Aliases should come last, otherwise "write" gets
preferred over "write-host" for example |
23 // Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Cor
e|Management)" } | 30 // Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Cor
e|Management)" } |
24 // Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.Pow
erShell.(Util|Core|Management)" } | 31 // Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.Pow
erShell.(Util|Core|Management)" } |
25 » 'function': /\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Chec
kpoint-(Computer|Content|EventLog|History|Item|ItemProperty|Variable)|Compare-(O
bject)|Complete-(Transaction)|Connect-(PSSession)|ConvertFrom-(Csv|Json|StringDa
ta)|Convert-(Path)|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-
(Process)|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguratio
n)|Disconnect-(PSSession)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSess
ionConfiguration)|Enter-(PSSession)|Exit-(PSSession)|Export-(Alias|Clixml|Consol
e|Csv|FormatData|ModuleMember|PSSession)|ForEach-(Object)|Format-(Custom|List|Ta
ble|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanel
Item|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|Ho
tFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallSta
ck|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|T
raceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-(Obje
ct)|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Exp
ression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-(Path)|Limit-(EventLo
g)|Measure-(Command)|Measure-(Object)|Move-(Item|ItemProperty)|New-(Alias|Event|
EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSess
ionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable
|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-(Loca
tion)|Push-(Location)|Read-(Host)|Receive-(Job)|Receive-(PSSession)|Register-(En
gineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|Ev
entLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|Type
Data|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-(ComputerMach
inePassword)|Resolve-(Path)|Restart-(Computer|Service)|Restore-(Computer)|Resume
-(Job|Service)|Save-(Help)|Select-(Object|String|Xml)|Send-(MailMessage)|Set-(Al
ias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfig
uration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|Contr
olPanelItem|EventLog)|Sort-(Object)|Split-(Path)|Start-(Job|Process|Service|Slee
p|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-(Ob
ject)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfig
urationFile)|Trace-(Command)|Unblock-(File)|Undo-(Transaction)|Unregister-(Event
|PSSessionConfiguration)|Update-(FormatData)|Update-(Help|List|TypeData)|Use-(Tr
ansaction)|Wait-(Event|Job|Process)|Where-(Object)|Write-(Debug|Error|EventLog|H
ost|Output|Progress|Verbose|Warning)|ac|cat|cd|chdir|clc|cli|clp|clv|compare|cop
y|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|ga
l|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn
|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|p
ushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc
|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|w
rite)\b/i, | 32 » 'function': [ |
| 33 » » /\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoi
nt-Computer|Clear-(Content|EventLog|History|Item|ItemProperty|Variable)|Compare-
Object|Complete-Transaction|Connect-PSSession|ConvertFrom-(Csv|Json|StringData)|
Convert-Path|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-Proces
s|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disco
nnect-PSSession|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfigu
ration)|Enter-PSSession|Exit-PSSession|Export-(Alias|Clixml|Console|Csv|FormatDa
ta|ModuleMember|PSSession)|ForEach-Object|Format-(Custom|List|Table|Wide)|Get-(A
lias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Dat
e|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemPr
operty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSPro
vider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Trans
action|TypeData|UICulture|Unique|Variable|WmiObject)|Group-Object|Import-(Alias|
Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|It
em|RestMethod|WebRequest|WmiMethod)|Join-Path|Limit-EventLog|Measure-(Command|Ob
ject)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Modul
e|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOp
tion|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|F
ile|GridView|Host|Null|Printer|String)|Pop-Location|Push-Location|Read-Host|Rece
ive-(Job|PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|Wmi
Event)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint
|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|I
temProperty)|Reset-ComputerMachinePassword|Resolve-Path|Restart-(Computer|Servic
e)|Restore-Computer|Resume-(Job|Service)|Save-Help|Select-(Object|String|Xml)|Se
nd-MailMessage|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|P
SDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstanc
e)|Show-(Command|ControlPanelItem|EventLog)|Sort-Object|Split-Path|Start-(Job|Pr
ocess|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Jo
b|Service)|Tee-Object|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path
|PSSessionConfigurationFile)|Trace-Command|Unblock-File|Undo-Transaction|Unregis
ter-(Event|PSSessionConfiguration)|Update-(FormatData|Help|List|TypeData)|Use-Tr
ansaction|Wait-(Event|Job|Process)|Where-Object|Write-(Debug|Error|EventLog|Host
|Output|Progress|Verbose|Warning))\b/i, |
| 34 » » /\b(ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|db
p|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr
|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|l
p|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|
ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|
sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i |
| 35 » ], |
| 36 » // per http://technet.microsoft.com/en-us/library/hh847744.aspx |
| 37 » 'keyword': /\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicPa
ram|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScrip
t|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|W
hile|Workflow)\b/i, |
26 'operator': { | 38 'operator': { |
27 » » pattern: /(\W)-(and|x?or|not|eq|ne|gt|ge|lt|le|Like|(Not)?(Like|
Match|Contains|In)|Replace)\b/i, | 39 » » pattern: /(\W?)(!|-(eq|ne|gt|ge|lt|le|sh[lr]|not|b?(and|x?or)|(N
ot)?(Like|Match|Contains|In)|Replace|Join|is(Not)?|as)\b|-[-=]?|\+[+=]?|[*\/%]=?
)/i, |
28 lookbehind: true | 40 lookbehind: true |
29 }, | 41 }, |
30 'punctuation': /[|{}[\];(),.]/ | 42 'punctuation': /[|{}[\];(),.]/ |
31 }; | 43 }; |
32 // Variable interpolation inside strings | 44 |
33 Prism.languages.powershell.string.inside.boolean = Prism.languages.powershell.bo
olean; | 45 // Variable interpolation inside strings, and nested expressions |
34 Prism.languages.powershell.string.inside.variable = Prism.languages.powershell.v
ariable; | 46 Prism.languages.powershell.string[0].inside.boolean = Prism.languages.powershell
.boolean; |
| 47 Prism.languages.powershell.string[0].inside.variable = Prism.languages.powershel
l.variable; |
| 48 Prism.languages.powershell.string[0].inside.function.inside = Prism.util.clone(P
rism.languages.powershell); |
OLD | NEW |