forked from robballou/sublimetext-sshconfig
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Authorized Keys.sublime-syntax
149 lines (136 loc) · 4.94 KB
/
Authorized Keys.sublime-syntax
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
%YAML 1.2
---
# https://www.sublimetext.com/docs/syntax.html
# https://man7.org/linux/man-pages/man8/sshd.8.html#AUTHORIZED_KEYS_FILE_FORMAT
# https://man.openbsd.org/sshd.8#AUTHORIZED_KEYS_FILE_FORMAT
name: Authorized Keys
scope: text.authorized_keys
file_extensions:
- authorized_keys
- pub
hidden_file_extensions:
- authorized_keys2
contexts:
main:
- include: SSH Common.sublime-syntax#comments-number-sign
- match: ^
push:
- meta_scope: meta.line.authorized-key.authorized_keys
- include: SSH Common.sublime-syntax#pop-before-nl
- include: SSH Common.sublime-syntax#pop-nl
- include: SSH Crypto.sublime-syntax#ssh-key-types
- include: SSH Common.sublime-syntax#ssh-fingerprint-with-label
- include: flag-options
- include: value-options
- include: strings
- match: =
scope: keyword.operator.assignment.authorized_keys
- match: ','
scope: punctuation.separator.sequence.authorized_keys
flag-options:
- match: (?:no-)?(?:pty|user-rc|(?:agent|port|X11)-forwarding)
scope: keyword.other.authorized_keys
- match: (?:no-touch-required|cert-authority|restrict)
scope: keyword.other.authorized_keys
value-options:
- match: (principals)(=)
captures:
1: keyword.other.authorized_keys
2: keyword.operator.assignment.authorized_keys
with_prototype:
- match: ','
scope: punctuation.separator.sequence.authorized_keys
push: value-option-body
- match: (tunnel)(=)
captures:
1: keyword.other.authorized_keys
2: keyword.operator.assignment.authorized_keys
with_prototype:
- match: \d{1,3}
scope: constant.numeric.integer.decimal.authorized_keys
push: value-option-body
- match: (?:(expiry-time)|(valid-before))(=)
captures:
1: keyword.other.authorized_keys
2: invalid.deprecated.authorized_keys
3: keyword.operator.assignment.authorized_keys
with_prototype:
- match: \d{4}[012]\d[0-3]\d(?:[012]\d(?:[0-5]\d){1,2})?
scope: constant.numeric.integer.date.authorized_keys
push: value-option-body
- match: (permitlisten)(=)
captures:
1: keyword.other.authorized_keys
2: keyword.operator.assignment.authorized_keys
with_prototype:
# Host is optional
- match: (?:([^"]+)(:))?(?:(\d{1,5})|(\*))
captures:
1: meta.string.host.authorized_keys
2: punctuation.separator.sequence.authorized_keys
3: constant.numeric.integer.decimal.authorized_keys
4: variable.language.wildcard.authorized_keys
push: value-option-body
- match: (permitopen)(=)
captures:
1: keyword.other.authorized_keys
2: keyword.operator.assignment.authorized_keys
with_prototype:
# Host is required
- match: ([^"]+)(:)(?:(\d{1,5})|(\*))
captures:
1: meta.string.host.authorized_keys
2: punctuation.separator.sequence.authorized_keys
3: constant.numeric.integer.decimal.authorized_keys
4: variable.language.wildcard.authorized_keys
push: value-option-body
- match: (from)(=)
captures:
1: keyword.other.authorized_keys
2: keyword.operator.assignment.authorized_keys
with_prototype:
- match: '!'
scope: keyword.operator.logical.authorized_keys
- match: ','
scope: punctuation.separator.sequence.authorized_keys
- match: '[*?]'
scope: keyword.operator.wildcard.authorized_keys
push: value-option-body
- match: (environment)(=)
captures:
1: keyword.other.authorized_keys
2: keyword.operator.assignment.authorized_keys
with_prototype:
- match: (\w+)(=)
captures:
1: variable.other.readwrite.authorized_keys
2: keyword.operator.assignment.authorized_keys
push: value-option-body
- match: (command)(=)(")
captures:
1: keyword.other.authorized_keys
2: keyword.operator.assignment.authorized_keys
3: string.quoted.double.authorized_keys punctuation.definition.string.begin.authorized_keys
# TODO: Allow escaped double-quote
embed: scope:source.shell.bash
embed_scope: source.shell.embedded
escape: '"|(?=$)'
escape_captures:
0: string.quoted.double.authorized_keys punctuation.definition.string.end.authorized_keys
value-option-body:
- include: strings
- match: (?=,|\s)
pop: true
- match: .
scope: invalid.illegal.authorized_keys
pop: true
strings:
- match: '"'
scope: punctuation.definition.string.begin.authorized_keys
push:
- meta_scope: string.quoted.double.authorized_keys
- match: \\"
scope: constant.character.escape.authorized_keys
- match: '"'
scope: punctuation.definition.string.end.authorized_keys
pop: true