| 1 |
# PowerShell syntax highlighting file for micro - https://micro-editor.github.io/ |
| 2 |
# PowerShell syntax taken from: https://github.com/PowerShell/EditorSyntax |
| 3 |
|
| 4 |
filetype: powershell |
| 5 |
|
| 6 |
detect: |
| 7 |
filename: "\\.ps(1|m1|d1)$" |
| 8 |
|
| 9 |
rules: |
| 10 |
# - comment.block: # Block Comment |
| 11 |
# - comment.doc: # Doc Comment |
| 12 |
# - comment.line: # Line Comment |
| 13 |
# - comment.shebang: # Shebang Line |
| 14 |
|
| 15 |
# - constant: # Constant |
| 16 |
# - constant.bool: # Constant (true, false) |
| 17 |
# - constant.interpolation: |
| 18 |
# - constant.number: # Constant (null) |
| 19 |
# - constant.specialChar: |
| 20 |
# - constant.string: # String |
| 21 |
# - constant.string.char: |
| 22 |
# - constant.string.url: # Uri |
| 23 |
# - constant.unicode: |
| 24 |
|
| 25 |
# - identifier: # Also used for functions |
| 26 |
# - identifier.class: # Also used for functions |
| 27 |
# - identifier.macro: |
| 28 |
# - identifier.var: |
| 29 |
|
| 30 |
# - preproc: # Preprocessor |
| 31 |
# - preproc.DebugIdentifier: # Preprocessor |
| 32 |
# - preproc.shebang: # The #! at the beginning of a file that tells the os what script interpreter to use |
| 33 |
|
| 34 |
# - special: # Special (global|local|private|script|using|workflow) |
| 35 |
|
| 36 |
# - statement: # Statements Keywords |
| 37 |
# - statement.built_in: |
| 38 |
# - statement.declaration: # Declaration Keywords |
| 39 |
# - statement.meta: # Meta |
| 40 |
# - statement.reserved: # Reserved Keywords |
| 41 |
|
| 42 |
# - symbol |
| 43 |
# - symbol.brackets: # {}()[] and sometimes <> |
| 44 |
# - symbol.operator: # Operators |
| 45 |
# - symbol.tag: # For html tags, among other things |
| 46 |
|
| 47 |
# - type |
| 48 |
# - type.collections: # Collections (array, hashtable) |
| 49 |
# - type.ctypes: # CTypes (CBool, CChar, etc.) |
| 50 |
# - type.keyword: # If you want a special highlight for keywords like 'private' |
| 51 |
# - type.storage: # Storage Types (int, uint, string, etc.) |
| 52 |
|
| 53 |
# Class |
| 54 |
- identifier.class: "class +[A-Za-z0-9]+ *((:) +[A-Za-z0-9.]+)?" |
| 55 |
- identifier.class: "(function)(?:([[:space:]][A-Za-z0-9]+[[:space:]]*))" |
| 56 |
|
| 57 |
# Verbs taken from PwSh 6.0.2 |
| 58 |
- identifier: "(Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy)[-][A-Za-z0-9]+" |
| 59 |
- identifier: "(Debug|Deny|Deploy|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide)[-][A-Za-z0-9]+" |
| 60 |
- identifier: "(Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push)[-][A-Za-z0-9]+" |
| 61 |
- identifier: "(Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke)[-][A-Za-z0-9]+" |
| 62 |
- identifier: "(Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace)[-][A-Za-z0-9]+" |
| 63 |
- identifier: "(Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write)[-][A-Za-z0-9]+" |
| 64 |
- identifier.var: "\\$(?i)((Global|Local|Private|Script|Using|Workflow)[:])?[A-Za-z0-9]*" |
| 65 |
|
| 66 |
|
| 67 |
# Expression and types |
| 68 |
- type: "\\[\\b([A-Za-z]+|[A-Za-z]+[0-9]+)\\b\\]" |
| 69 |
|
| 70 |
# Keywords |
| 71 |
- statement: "\\b(alias|as|begin|break|catch|continue|data|default|define|do|dynamicparam)\\b" |
| 72 |
- statement: "\\b(else|elseif|end|exit|finally|for|foreach|foreach-object|from|if|in|inlinescript)\\b" |
| 73 |
- statement: "\\b(parallel|param|process|return|switch|throw|trap|try|until|using|var|where|where-object|while)\\b" |
| 74 |
|
| 75 |
# Special Keywords |
| 76 |
- special: "\\b(break|continue|exit)\\b" |
| 77 |
|
| 78 |
- symbol.brackets: "(\\{|\\})" |
| 79 |
- symbol.brackets: "(\\(|\\))" |
| 80 |
- symbol.brackets: "(\\[|\\])" |
| 81 |
- symbol.operator: "[\\-+/*=<>?:!~%&|]" |
| 82 |
- symbol.operator: "[[:space:]][-](ne|eq|gt|ge|lt|le|like|notlike|match|notmatch|contains|notcontains|in|notin|replace|is|isnot)[[:space:]]" |
| 83 |
|
| 84 |
# Constants |
| 85 |
- constant.bool: "\\b\\$(true|false|null)\\b" |
| 86 |
- constant.number: "\\b([0-9._]+|0x[A-Fa-f0-9_]+|0b[0-1_]+)[FL]?\\b" |
| 87 |
|
| 88 |
# Expression Mode String |
| 89 |
- constant.string: |
| 90 |
start: "\"" |
| 91 |
end: "\"" |
| 92 |
#skip: "\\\\." |
| 93 |
rules: |
| 94 |
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)" |
| 95 |
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}" |
| 96 |
|
| 97 |
# Argument Mode String |
| 98 |
- constant.string: |
| 99 |
start: "'" |
| 100 |
end: "'" |
| 101 |
#skip: "\\\\." |
| 102 |
rules: |
| 103 |
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)" |
| 104 |
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}" |
| 105 |
|
| 106 |
# Line Comment |
| 107 |
- comment: |
| 108 |
start: "#" |
| 109 |
end: "$" |
| 110 |
rules: |
| 111 |
- todo: "(TODO|XXX|FIXME|BUG):?" |
| 112 |
|
| 113 |
# Block Comment |
| 114 |
- comment: |
| 115 |
start: "<#" |
| 116 |
end: "#>" |
| 117 |
rules: |
| 118 |
- todo: "(TODO|XXX|FIXME|BUG):?" |
| 119 |
|
| 120 |
# Embedded C# |
| 121 |
- default: |
| 122 |
start: "@\"" |
| 123 |
end: "\"@" |
| 124 |
rules: |
| 125 |
- include: "csharp" |
| 126 |
|
| 127 |
# Todo |
| 128 |
- todo: "(TODO|XXX|FIXME|BUG):?" |