diff --git a/.gitmodules b/.gitmodules index 4b6bc34e..5cafb38e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b02eb41..75e73ed8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ ## Syntaxes +- Improved the Syslog syntax highlighting, see #1606 (@keith-hall) + ## New themes ## `bat` as a library diff --git a/assets/syntaxes/02_Extra/Syslog b/assets/syntaxes/02_Extra/Syslog deleted file mode 160000 index 7628d4e0..00000000 --- a/assets/syntaxes/02_Extra/Syslog +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7628d4e0b89d3b4f0dcc014bfb4a3e3433f5133a diff --git a/assets/syntaxes/02_Extra/syslog.sublime-syntax b/assets/syntaxes/02_Extra/syslog.sublime-syntax new file mode 100644 index 00000000..6233da17 --- /dev/null +++ b/assets/syntaxes/02_Extra/syslog.sublime-syntax @@ -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 diff --git a/tests/syntax-tests/highlighted/Syslog/example.syslog b/tests/syntax-tests/highlighted/Syslog/example.syslog new file mode 100644 index 00000000..5ea6d9eb --- /dev/null +++ b/tests/syntax-tests/highlighted/Syslog/example.syslog @@ -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'