File: PowerShell.yaml

package info (click to toggle)
micro 2.0.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,828 kB
  • sloc: sh: 247; makefile: 77; xml: 53
file content (128 lines) | stat: -rw-r--r-- 5,028 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# PowerShell syntax highlighting file for micro - https://micro-editor.github.io/
# PowerShell syntax taken from: https://github.com/PowerShell/EditorSyntax

filetype: powershell

detect:
    filename: "\\.ps(1|m1|d1)$"

rules:
    # - comment.block:           # Block Comment
    # - comment.doc:             # Doc Comment
    # - comment.line:            # Line Comment
    # - comment.shebang:         # Shebang Line

    # - constant:                # Constant
    # - constant.bool:           # Constant (true, false)
    # - constant.interpolation:
    # - constant.number:         # Constant (null)
    # - constant.specialChar:
    # - constant.string:         # String
    # - constant.string.char:
    # - constant.string.url:     # Uri
    # - constant.unicode:

    # - identifier:              # Also used for functions
    # - identifier.class:        # Also used for functions
    # - identifier.macro:
    # - identifier.var:

    # - preproc:                 # Preprocessor
    # - preproc.DebugIdentifier: # Preprocessor
    # - preproc.shebang:         # The #! at the beginning of a file that tells the os what script interpreter to use

    # - special:                 # Special (global|local|private|script|using|workflow)

    # - statement:               # Statements Keywords
    # - statement.built_in:
    # - statement.declaration:   # Declaration Keywords
    # - statement.meta:          # Meta
    # - statement.reserved:      # Reserved Keywords

    # - symbol
    # - symbol.brackets:         # {}()[] and sometimes <>
    # - symbol.operator:         # Operators
    # - symbol.tag:              # For html tags, among other things

    # - type
    # - type.collections:        # Collections (array, hashtable)
    # - type.ctypes:             # CTypes (CBool, CChar, etc.)
    # - type.keyword:            # If you want a special highlight for keywords like 'private'
    # - type.storage:            # Storage Types (int, uint, string, etc.)

    # Class
    - identifier.class: "class +[A-Za-z0-9]+ *((:) +[A-Za-z0-9.]+)?"
    - identifier.class: "(function)(?:([[:space:]][A-Za-z0-9]+[[:space:]]*))"

    # Verbs taken from PwSh 6.0.2
    - identifier: "(Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy)[-][A-Za-z0-9]+"
    - identifier: "(Debug|Deny|Deploy|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide)[-][A-Za-z0-9]+"
    - 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]+"
    - identifier: "(Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke)[-][A-Za-z0-9]+"
    - identifier: "(Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace)[-][A-Za-z0-9]+"
    - identifier: "(Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write)[-][A-Za-z0-9]+"
    - identifier.var: "\\$(?i)((Global|Local|Private|Script|Using|Workflow)[:])?[A-Za-z0-9]*"


    # Expression and types
    - type: "\\[\\b([A-Za-z]+|[A-Za-z]+[0-9]+)\\b\\]"

    # Keywords
    - statement: "\\b(alias|as|begin|break|catch|continue|data|default|define|do|dynamicparam)\\b"
    - statement: "\\b(else|elseif|end|exit|finally|for|foreach|foreach-object|from|if|in|inlinescript)\\b"
    - statement: "\\b(parallel|param|process|return|switch|throw|trap|try|until|using|var|where|where-object|while)\\b"

    # Special Keywords
    - special: "\\b(break|continue|exit)\\b"

    - symbol.brackets: "(\\{|\\})"
    - symbol.brackets: "(\\(|\\))"
    - symbol.brackets: "(\\[|\\])"
    - symbol.operator: "[\\-+/*=<>?:!~%&|]"
    - symbol.operator: "[[:space:]][-](ne|eq|gt|ge|lt|le|like|notlike|match|notmatch|contains|notcontains|in|notin|replace|is|isnot)[[:space:]]"

    # Constants
    - constant.bool: "\\b\\$(true|false|null)\\b"
    - constant.number: "\\b([0-9._]+|0x[A-Fa-f0-9_]+|0b[0-1_]+)[FL]?\\b"

    # Expression Mode String
    - constant.string:
        start: "\""
        end: "\""
        #skip: "\\\\."
        rules:
            - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
            - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"

    # Argument Mode String
    - constant.string:
        start: "'"
        end: "'"
        #skip: "\\\\."
        rules:
            - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
            - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"

    # Line Comment
    - comment:
        start: "#"
        end: "$"
        rules:
            - todo: "(TODO|XXX|FIXME|BUG):?"

    # Block Comment
    - comment:
        start: "<#"
        end: "#>"
        rules:
            - todo: "(TODO|XXX|FIXME|BUG):?"

    # Embedded C#
    - default:
        start: "@\""
        end: "\"@"
        rules:
            - include: "csharp"

    # Todo
    - todo: "(TODO|XXX|FIXME|BUG):?"