on master help sign in
replace Syslog dependency with a custom syntax
commit1537733e6b0d764e092b701565de94c51ef3ecf1 authorKeith Hall <kingkeith+github@gmail.com> dateSun 4 Apr 2021, 22:42 (6 years ago) parentba0d436
5 files changed+77−5
.gitmodules−4 CHANGELOG.md+2 assets/syntaxes/02_Extra/Syslog−1 assets/syntaxes/02_Extra/syslog.sublime-syntax+70 tests/syntax-tests/highlighted/Syslog/example.syslog+5
.gitmodules−4
@@ -97,10 +97,6 @@
9797[submodule "assets/syntaxes/Assembly (ARM)"]
9898 path = assets/syntaxes/02_Extra/Assembly (ARM)
9999 url = https://github.com/tvi/Sublime-ARM-Assembly
100−[submodule "assets/syntaxes/syslog-syntax"]
101− path = assets/syntaxes/02_Extra/Syslog
102− url = https://github.com/caos21/syslog-syntax.git
103− branch = master
104100[submodule "assets/syntaxes/protobuf-syntax-highlighting"]
105101 path = assets/syntaxes/02_Extra/Protobuf
106102 url = https://github.com/VcamX/protobuf-syntax-highlighting.git
CHANGELOG.md+2
@@ -12,6 +12,8 @@
1212
1313## Syntaxes
1414
15+- Improved the Syslog syntax highlighting, see #1606 (@keith-hall)
16+
1517## New themes
1618
1719## `bat` as a library
assets/syntaxes/02_Extra/Syslogdeleted−1

Submodule changed.

assets/syntaxes/02_Extra/syslog.sublime-syntaxnew file+70
@@ -0,0 +1,70 @@
1+%YAML 1.2
2+---
3+# http://www.sublimetext.com/docs/3/syntax.html
4+name: syslog
5+file_extensions:
6+ - syslog
7+scope: text.syslog
8+contexts:
9+ main:
10+ - match: '^\w+\s+\d+\s+\d{2}:\d{2}:\d{2}'
11+ scope: meta.datetime.syslog constant.numeric.syslog
12+ push: loghost
13+ loghost:
14+ - match: '[\w-]+'
15+ scope: entity.other.attribute-name.loghost.syslog
16+ set: process
17+ process:
18+ - match: ([\w-]+)(?:(\[)(\d+)(\]))?(:)
19+ captures:
20+ 1: support.function.process.syslog
21+ 2: punctuation.separator.pid.begin.syslog
22+ 3: meta.pid.syslog meta.number.integer.syslog constant.numeric.value.syslog
23+ 4: punctuation.separator.mapping.syslog
24+ set: structured-data
25+ structured-data:
26+ - match: '\['
27+ scope: punctuation.section.mapping.begin.syslog
28+ push:
29+ - match: \]
30+ scope: punctuation.section.mapping.end.syslog
31+ pop: true
32+ - match: \w+
33+ scope: variable.parameter.syslog
34+ - match: =
35+ scope: keyword.operator.assignment.syslog
36+ push:
37+ - match: '[^\s\]]+'
38+ scope: constant.other.syslog
39+ pop: true
40+ - match: (?=\])
41+ pop: true
42+ - match: (?=\S)
43+ set: text
44+ text:
45+ - match: (\w+)(=)
46+ captures:
47+ 1: variable.parameter.syslog
48+ 2: keyword.operator.assignment.syslog
49+ - match: (')([^']*)(')
50+ scope: string.quoted.single.syslog
51+ captures:
52+ 1: punctuation.definition.string.begin.syslog
53+ 3: punctuation.definition.string.end.syslog
54+ - match: (")([^"]*)(")
55+ scope: string.quoted.double.syslog
56+ captures:
57+ 1: punctuation.definition.string.begin.syslog
58+ 3: punctuation.definition.string.end.syslog
59+ - match: \d+
60+ scope: meta.number.integer.syslog constant.numeric.value.syslog
61+ - match: \b(CMD)\b\s+(\()
62+ captures:
63+ 1: entity.name.label.syslog
64+ 2: punctuation.section.block.begin.syslog
65+ embed: scope:source.shell.bash
66+ escape: \)
67+ escape_captures:
68+ 0: punctuation.section.block.end.syslog
69+ - match: $
70+ pop: true
tests/syntax-tests/highlighted/Syslog/example.syslognew file+5
@@ -0,0 +1,5 @@
1+Apr 4 00:00:01 hostname-here systemd[1]: logrotate.service: Succeeded.
2+Apr 4 00:00:01 hostname-here systemd[1]: Finished Rotate log files.
3+Apr 4 00:00:21 hostname-here kernel: [55604.908232] audit: type=1400 audit(1617483621.094:28): apparmor="DENIED" operation="capable" profile="/usr/sbin/cups-browsed" pid=59311 comm="cups-browsed" capability=23 capname="sys_nice"
4+Apr 4 09:30:01 hostname-here CRON[89278]: (root) CMD ([ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi)
5+Apr 4 22:00:45 hostname-here dbus-daemon[1094]: [session uid=1000 pid=1094] Successfully activated service 'io.github.celluloid_player.Celluloid'