forked from robballou/sublimetext-sshconfig
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKnown Hosts.sublime-syntax
85 lines (76 loc) · 2.54 KB
/
Known Hosts.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
%YAML 1.2
---
# https://www.sublimetext.com/docs/syntax.html
# https://man7.org/linux/man-pages/man8/sshd.8.html#SSH_KNOWN_HOSTS_FILE_FORMAT
# https://man.openbsd.org/sshd.8#SSH_KNOWN_HOSTS_FILE_FORMAT
name: Known Hosts
scope: text.known_hosts
version: 2
extends: SSH Crypto.sublime-syntax
file_extensions:
- known_hosts
hidden_file_extensions:
- known_hosts.old
contexts:
main:
- include: comments-number-sign
- match: ^((@)(?:revoked|cert-authority))?
captures:
1: meta.annotation.known_hosts
variable.annotation.known_hosts
2: punctuation.definition.annotation.known_hosts
push:
- meta_scope: meta.line.known-host.known_hosts
- include: pop-before-nl
- include: pop-nl
- include: punctuation-comma-sequence
- include: ssh-fingerprint-with-label
- include: ssh-key-types
- include: hostname-or-ip-value
hostname-or-ip-value:
# Negation
- include: operator-exclamation
# Bracketed host
- match: \[
scope: punctuation.definition.string.begin.known_hosts
push:
- meta_scope: meta.brackets.host.known_hosts
- match: (\])(?:(:)({{zero_to_65535}}))?
captures:
1: punctuation.definition.string.end.known_hosts
2: punctuation.separator.sequence.known_hosts
3: meta.number.integer.decimal.known_hosts
constant.numeric.port-number.known_hosts
pop: 1
- include: operator-exclamation
- include: ip-addresses
- match: ''
push:
- meta_scope: meta.string.host.known_hosts
string.quoted.other.known_hosts
- match: (?=,|\])
pop: 1
- include: wildcards
- include: punctuation-dot-sequence
# IP
- include: ip-addresses
# Hashed host
- match: (\|)(\d+)(\|)({{base64_char}}{27}=)(\|)({{base64_char}}{27}=)
scope: meta.string.host.obfuscated.known_hosts
captures:
1: punctuation.definition.known_hosts
2: constant.numeric.integer.algorithm.known_hosts
3: punctuation.definition.known_hosts
4: string.unquoted.salt.known_hosts
5: punctuation.definition.known_hosts
6: string.unquoted.hash.known_hosts
# Normal host
- match: (?=\S)
push: hostname
hostname:
- meta_content_scope: meta.string.host.known_hosts
string.unquoted.known_hosts
- match: (?=[,\[\s])
pop: 1
- include: wildcards
- include: punctuation-dot-sequence