mirror of
https://github.com/sharkdp/bat.git
synced 2026-10-26 20:16:33 +00:00
Merge pull request #3876 from Matei02355/fix-log-syntax-performance-3866
fix(syntax): avoid repeated log level scans
This commit is contained in:
3 files changed
+35
-5
No files matched your search
@@ -24,6 +24,7 @@
|
|||||||
- Syntax highlighting for Python files using uv as script runner in shebang #3689 (@janlarres)
|
- Syntax highlighting for Python files using uv as script runner in shebang #3689 (@janlarres)
|
||||||
|
|
||||||
## Bugfixes
|
## Bugfixes
|
||||||
|
- Avoid repeated scans of long lines in Log syntax highlighting, see #3876 (@Matei02355)
|
||||||
- Fix `--list-languages` respecting `--paging=never`, see #3828 (@cyphercodes)
|
- Fix `--list-languages` respecting `--paging=never`, see #3828 (@cyphercodes)
|
||||||
- Fix `--sanitize` passing through the bidi control characters U+200E, U+200F and U+061C, see #3862 (@lenamonj)
|
- Fix `--sanitize` passing through the bidi control characters U+200E, U+200F and U+061C, see #3862 (@lenamonj)
|
||||||
- `--strip-ansi`: also strip 8-bit C1 introducers (U+0090, U+0098, U+009B, U+009D, U+009E, U+009F) and DCS/SOS/PM/APC sequence bodies, which previously passed through. See #3729 (@curious-rabbit)
|
- `--strip-ansi`: also strip 8-bit C1 introducers (U+0090, U+0098, U+009B, U+009D, U+009E, U+009F) and DCS/SOS/PM/APC sequence bodies, which previously passed through. See #3729 (@curious-rabbit)
|
||||||
|
|||||||
+23
-4
@@ -38,22 +38,41 @@ contexts:
|
|||||||
scope: markup.underline.link.scheme.log
|
scope: markup.underline.link.scheme.log
|
||||||
push: url-host
|
push: url-host
|
||||||
log_level_lines:
|
log_level_lines:
|
||||||
- match: (?=.*{{error}})
|
# Prevent retrying each lookahead at every position.
|
||||||
|
- match: ^(?=.*{{error}})
|
||||||
push:
|
push:
|
||||||
- error_line_meta
|
- error_line_meta
|
||||||
- main_pop_at_eol
|
- main_pop_at_eol
|
||||||
- match: (?=.*{{warning}})
|
- match: ^(?=.*{{warning}})
|
||||||
push:
|
push:
|
||||||
- warning_line_meta
|
- warning_line_meta
|
||||||
- main_pop_at_eol
|
- main_pop_at_eol
|
||||||
- match: (?=.*{{info}})
|
- match: ^(?=.*{{info}})
|
||||||
push:
|
push:
|
||||||
- info_line_meta
|
- info_line_meta
|
||||||
- main_pop_at_eol
|
- main_pop_at_eol
|
||||||
- match: (?=.*{{debug}})
|
- match: ^(?=.*{{debug}})
|
||||||
push:
|
push:
|
||||||
- debug_line_meta
|
- debug_line_meta
|
||||||
- main_pop_at_eol
|
- main_pop_at_eol
|
||||||
|
# For syntaxes that embed Log after consuming a prefix. Call this context once.
|
||||||
|
log_level_lines_at_current_position:
|
||||||
|
- match: (?=.*{{error}})
|
||||||
|
set:
|
||||||
|
- error_line_meta
|
||||||
|
- main_pop_at_eol
|
||||||
|
- match: (?=.*{{warning}})
|
||||||
|
set:
|
||||||
|
- warning_line_meta
|
||||||
|
- main_pop_at_eol
|
||||||
|
- match: (?=.*{{info}})
|
||||||
|
set:
|
||||||
|
- info_line_meta
|
||||||
|
- main_pop_at_eol
|
||||||
|
- match: (?=.*{{debug}})
|
||||||
|
set:
|
||||||
|
- debug_line_meta
|
||||||
|
- main_pop_at_eol
|
||||||
log_levels:
|
log_levels:
|
||||||
- match: '{{error}}'
|
- match: '{{error}}'
|
||||||
scope: markup.error.log
|
scope: markup.error.log
|
||||||
|
|||||||
+11
-1
@@ -50,6 +50,17 @@ contexts:
|
|||||||
- match: (?=\])
|
- match: (?=\])
|
||||||
pop: true
|
pop: true
|
||||||
text:
|
text:
|
||||||
|
- include: text_special
|
||||||
|
- match: ''
|
||||||
|
set: classify_log_text
|
||||||
|
classify_log_text:
|
||||||
|
- include: scope:text.log#log_level_lines_at_current_position
|
||||||
|
- match: ''
|
||||||
|
set: text_body
|
||||||
|
text_body:
|
||||||
|
- include: text_special
|
||||||
|
- include: scope:text.log
|
||||||
|
text_special:
|
||||||
- match: $
|
- match: $
|
||||||
pop: true
|
pop: true
|
||||||
- match: '<\w+>'
|
- match: '<\w+>'
|
||||||
@@ -62,4 +73,3 @@ contexts:
|
|||||||
escape: \)$
|
escape: \)$
|
||||||
escape_captures:
|
escape_captures:
|
||||||
0: punctuation.section.block.end.syslog
|
0: punctuation.section.block.end.syslog
|
||||||
- include: scope:text.log
|
|
||||||
Reference in new issue
Block a user