replace Syslog dependency with a custom syntax

This commit is contained in:
Keith Hall 2021-04-04 22:42:13 +03:00
parent ba0d43672b
commit 1537733e6b
5 changed files with 77 additions and 5 deletions

4
.gitmodules vendored
View File

@ -97,10 +97,6 @@
[submodule "assets/syntaxes/Assembly (ARM)"]
path = assets/syntaxes/02_Extra/Assembly (ARM)
url = https://github.com/tvi/Sublime-ARM-Assembly
[submodule "assets/syntaxes/syslog-syntax"]
path = assets/syntaxes/02_Extra/Syslog
url = https://github.com/caos21/syslog-syntax.git
branch = master
[submodule "assets/syntaxes/protobuf-syntax-highlighting"]
path = assets/syntaxes/02_Extra/Protobuf
url = https://github.com/VcamX/protobuf-syntax-highlighting.git

View File

@ -12,6 +12,8 @@
## Syntaxes
- Improved the Syslog syntax highlighting, see #1606 (@keith-hall)
## New themes
## `bat` as a library

@ -1 +0,0 @@
Subproject commit 7628d4e0b89d3b4f0dcc014bfb4a3e3433f5133a

View File

@ -0,0 +1,70 @@
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: syslog
file_extensions:
- syslog
scope: text.syslog
contexts:
main:
- match: '^\w+\s+\d+\s+\d{2}:\d{2}:\d{2}'
scope: meta.datetime.syslog constant.numeric.syslog
push: loghost
loghost:
- match: '[\w-]+'
scope: entity.other.attribute-name.loghost.syslog
set: process
process:
- match: ([\w-]+)(?:(\[)(\d+)(\]))?(:)
captures:
1: support.function.process.syslog
2: punctuation.separator.pid.begin.syslog
3: meta.pid.syslog meta.number.integer.syslog constant.numeric.value.syslog
4: punctuation.separator.mapping.syslog
set: structured-data
structured-data:
- match: '\['
scope: punctuation.section.mapping.begin.syslog
push:
- match: \]
scope: punctuation.section.mapping.end.syslog
pop: true
- match: \w+
scope: variable.parameter.syslog
- match: =
scope: keyword.operator.assignment.syslog
push:
- match: '[^\s\]]+'
scope: constant.other.syslog
pop: true
- match: (?=\])
pop: true
- match: (?=\S)
set: text
text:
- match: (\w+)(=)
captures:
1: variable.parameter.syslog
2: keyword.operator.assignment.syslog
- match: (')([^']*)(')
scope: string.quoted.single.syslog
captures:
1: punctuation.definition.string.begin.syslog
3: punctuation.definition.string.end.syslog
- match: (")([^"]*)(")
scope: string.quoted.double.syslog
captures:
1: punctuation.definition.string.begin.syslog
3: punctuation.definition.string.end.syslog
- match: \d+
scope: meta.number.integer.syslog constant.numeric.value.syslog
- match: \b(CMD)\b\s+(\()
captures:
1: entity.name.label.syslog
2: punctuation.section.block.begin.syslog
embed: scope:source.shell.bash
escape: \)
escape_captures:
0: punctuation.section.block.end.syslog
- match: $
pop: true

View File

@ -0,0 +1,5 @@
Apr 4 00:00:01 hostname-here systemd[1]: logrotate.service: Succeeded.
Apr 4 00:00:01 hostname-here systemd[1]: Finished Rotate log files.
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"
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)
Apr 4 22:00:45 hostname-here dbus-daemon[1094]: [session uid=1000 pid=1094] Successfully activated service 'io.github.celluloid_player.Celluloid'