Skip to content

Commit 43c54f5

Browse files
committed
Add meta scopes for log entry content in logfile syntax
1 parent b75baad commit 43c54f5

File tree

2 files changed

+145
-34
lines changed

2 files changed

+145
-34
lines changed

LaTeXTools Log.sublime-syntax

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,33 +285,86 @@ contexts:
285285
# single-line meta information
286286
- match: ^(?:Dictionary|Document Class|File|Language|Package):.+
287287
scope: comment.line.log
288+
# exceptions
289+
- match: '^! [^:]*Error:'
290+
scope: markup.error.log
291+
push: log-fatal-body
292+
- match: '^! .*'
293+
scope: markup.error.log
294+
push: log-exception-body
288295
# errors
289296
- match: '^[^:]*Error:'
290297
scope: markup.error.log
291-
- match: '^!.*'
292-
scope: markup.error.log
298+
push: log-error-body
293299
# warnings
294300
- match: '^[^:]*(?:Overfull|Underfull)'
295301
scope: markup.warning.log
296-
embed: box-warning-content
302+
embed: log-box-warning-body
297303
escape: \[\]$|(?=^\s*(?:\[(?:\d+|[^\]]+\])$)|Overfull|Underfull\b)
298304
escape_captures:
299305
0: meta.warning.box.log punctuation.terminator.log
300306
- match: '^[^:]*(?:Warning|warning \([^)]*\)):'
301307
scope: markup.warning.log
308+
push: log-warning-body
302309
- match: '^[^:]*:\d*:.*'
303310
scope: markup.warning.log
311+
push: log-warning-body
304312
# info
305313
- match: '^[^:]*(?:Info|Note|Summary):'
306314
scope: markup.info.log
315+
push: log-info-body
307316

308317
block-comment-body:
309318
- meta_scope: comment.line.log
310319
- match: ^.{79}\n # consume anything which has 79 chars
311320
- match: \n
312321
pop: 1
313322

314-
box-warning-content:
323+
log-error-body:
324+
- meta_scope: meta.error.log
325+
- match: (?:^|\.)$
326+
pop: 1
327+
- include: content
328+
329+
log-exception-body:
330+
- meta_scope: meta.exception.log
331+
- match: ^$
332+
pop: 1
333+
- include: content
334+
335+
log-fatal-body:
336+
- meta_scope: meta.error.log
337+
- match: (?:^|\.)$
338+
set:
339+
- log-fatal-hint-body
340+
- log-fatal-desc-body
341+
- include: content
342+
343+
log-fatal-desc-body:
344+
# expect line, starting with fatal error location (line number e.g.: l.10)
345+
- match: ^l\.\d+\b
346+
pop: 1
347+
- include: content
348+
349+
log-fatal-hint-body:
350+
- meta_content_scope: meta.error.log meta.description.log
351+
- match: ^$
352+
pop: 1
353+
- include: content
354+
355+
log-info-body:
356+
- meta_scope: meta.info.log
357+
- match: (?:^|\.)$
358+
pop: 1
359+
- include: content
360+
361+
log-warning-body:
362+
- meta_scope: meta.warning.log
363+
- match: (?:^|\.)$
364+
pop: 1
365+
- include: content
366+
367+
log-box-warning-body:
315368
- meta_scope: meta.warning.box.log
316369
- include: content
317370

tests/syntax/syntax_test_latex.log

Lines changed: 88 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,8 @@ command)
656656
# -----------------------------------------------------------------------------
657657

658658
! Emergency stop.
659-
# <- markup.error.log
660-
#^^^^^^^^^^^^^^^^ markup.error.log
659+
# <- meta.exception.log markup.error.log
660+
#^^^^^^^^^^^^^^^^ meta.exception.log markup.error.log
661661

662662
Package foo Error: This is a message.
663663
# <- markup.error.log
@@ -684,41 +684,88 @@ LaTeX Info: Redefining \( and \) on input line 2958.
684684
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.brackets - punctuation
685685

686686
LaTeX Info: Redefining \{ and \} on input line 2959.
687-
#^^^^^^^^^^ markup.info.log
688-
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.brackets - punctuation
687+
# <- meta.info.log markup.info.log
688+
#^^^^^^^^^^ meta.info.log markup.info.log
689+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.info.log - markup
690+
691+
# ----------
692+
693+
! LaTeX Error: Missing \begin{document}.
694+
695+
See the LaTeX manual or LaTeX Companion for explanation.
696+
Type H <return> for immediate help.
697+
...
698+
699+
l.1 \section{C
700+
hapter 1}
701+
You're in trouble here. Try typing <return> to proceed.
702+
If that doesn't work, type X <return> to quit.
703+
# <- meta.error.log meta.description.log
704+
705+
# <- - meta.error
689706

690707
# ----------
691708
# Issue 1105: Support FiXme package
692709

693710
FiXme Summary: Number of notes: 1,
694-
#^^^^^^^^^^^^^ markup.info.log
711+
# <- meta.info.log markup.info.log
712+
#^^^^^^^^^^^^^ meta.info.log markup.info.log
713+
# ^^^^^^^^^^^^^^^^^^^^^ meta.info.log - markup
695714
(FiXme) Number of warnings: 1,
696715
(FiXme) Number of errors: 1,
697716
(FiXme) Number of fatal errors: 1,
698717
(FiXme) Total: 4.
718+
# <- meta.info.log meta.parens.log punctuation.section.parens.begin.log
719+
#^^^^^^ meta.info.log meta.parens.log
720+
# ^^^^^^^^^^^^^^^^^ meta.info.log - meta.parens
721+
722+
# <- - meta.info
699723

700724
FiXme Note: 'NOTE' on input line 7.
701-
#^^^^^^^^^^ markup.info.log
725+
# <- meta.info.log markup.info.log
726+
#^^^^^^^^^^ meta.info.log markup.info.log
727+
# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.info.log - markup
728+
729+
# <- - meta.info
702730

703731
FiXme Warning: 'WARNING' on input line 8.
704-
#^^^^^^^^^^^^^ markup.warning.log
732+
# <- meta.warning.log markup.warning.log
733+
#^^^^^^^^^^^^^ meta.warning.log markup.warning.log
734+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.warning.log - markup
735+
736+
# <- - meta.warning
705737

706738
FiXme Error: 'ERROR' on input line 9.
707-
#^^^^^^^^^^^ markup.error.log
739+
# <- meta.error.log markup.error.log
740+
#^^^^^^^^^^^ meta.error.log markup.error.log
741+
# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.error.log - markup
742+
743+
# <- - meta.error
708744

709745
! Package FiXme Error: 'FATAL' fatal error left in final version.
710-
#^^^^^^^^^^^^^^^^^^^^^ markup.error.log
746+
# <- meta.error.log markup.error.log
747+
#^^^^^^^^^^^^^^^^^^^^^ meta.error.log markup.error.log
748+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.error.log - markup
749+
750+
l.20
751+
# <- meta.error.log meta.description.log
752+
#^^^^ meta.error.log meta.description.log
753+
754+
# <- - meta.error
711755

712756
! Argument of \textit has an extra }.
713-
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.error.log
757+
# <- meta.exception.log markup.error.log
758+
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.exception.log markup.error.log
714759
<inserted text>
715-
# <- string.quoted.other.log punctuation.definition.string.begin.log
716-
#^^^^^^^^^^^^^^ string.quoted.other.log
760+
# <- meta.exception.log string.quoted.other.log punctuation.definition.string.begin.log
761+
#^^^^^^^^^^^^^^ meta.exception.log string.quoted.other.log
717762
# ^ punctuation.definition.string.end.log
718763
\par
719764
# ^^^^ meta.function-call.latex support.function.latex
720765
# ^ punctuation.definition.variable.latex
721766
l.5 \section\textit
767+
# <- meta.exception.log
768+
#^^^^^^^^^^^^^^^^^^^ meta.exception.log
722769
# ^^^^^^^^^^^^^^^ meta.function-call.latex support.function.latex
723770
# ^ punctuation.definition.variable.latex
724771
# ^ punctuation.definition.variable.latex
@@ -732,12 +779,15 @@ l.5 \section\textit
732779
# Issue 1233
733780

734781
pdfTeX warning (dest): name{summary} has been referenced but does not exist,
735-
#^^^^^^^^^^^^^^^^^^^^^ markup.warning.log
782+
# <- meta.warning.log markup.warning.log
783+
#^^^^^^^^^^^^^^^^^^^^^ meta.warning.log markup.warning.log
784+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.warning.log - markup
736785
# ^^^^^^^^^ string.quoted.other.log
737786
# ^ punctuation.definition.string.begin.log
738787
# ^ punctuation.definition.string.end.log
739788
replaced by a fixed one
740-
# <- - markup
789+
# <- meta.warning.log - markup
790+
#^^^^^^^^^^^^^^^^^^^^^^^ meta.warning.log - markup
741791

742792
# -----------------------------------------------------------------------------
743793
# nested log entries
@@ -748,43 +798,50 @@ replaced by a fixed one
748798
#^^^^^^^^^^^^^^^^^^^^ meta.block.log entity.name.section.filename.log
749799

750800
! fatal error.
751-
#^^^^^^^^^^^^ meta.block.log markup.error.log
801+
# <- meta.exception.log markup.error.log
802+
#^^^^^^^^^^^^^ meta.exception.log markup.error.log
752803

753804
Error: This is a message.
754-
# <- markup.error.log
755-
#^^^^^ markup.error.log
805+
# <- meta.error.log markup.error.log
806+
#^^^^^ meta.error.log markup.error.log
807+
# ^^^^^^^^^^^^^^^^^^^ meta.error.log - markup
756808

757809
Warning: This is a message.
758-
# <- markup.warning.log
759-
#^^^^^^^ markup.warning.log
810+
# <- meta.warning.log markup.warning.log
811+
#^^^^^^^ meta.warning.log markup.warning.log
812+
# ^^^^^^^^^^^^^^^^^^^ meta.warning.log - markup
760813

761814
Info: This is a message.
762-
# <- markup.info.log
763-
#^^^^ markup.info.log
815+
# <- meta.info.log markup.info.log
816+
#^^^^ meta.info.log markup.info.log
817+
# ^^^^^^^^^^^^^^^^^^^ meta.info.log - markup
764818

765819
Note: This is a message.
766-
# <- markup.info.log
767-
#^^^^ markup.info.log
820+
# <- meta.info.log markup.info.log
821+
#^^^^ meta.info.log markup.info.log
822+
# ^^^^^^^^^^^^^^^^^^^ meta.info.log - markup
768823

769824
(/opt/TeX/texmf-dist/tex/latex/hyperref/hyperref.sty
770825
# <- meta.block.log meta.block.log punctuation.section.block.begin.log
771826
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log entity.name.section.filename.log
772827
Package hyperref Error: Option `pdfauthor' not found,
773828
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log
774-
#^^^^^^^^^^^^^^^^^^^^^^ markup.error.log
829+
#^^^^^^^^^^^^^^^^^^^^^^ meta.error.log markup.error.log
830+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.error.log - markup
775831
# ^^^^^^^^^^^ string.quoted.single.log
776832
# ^ punctuation.definition.string.begin.log
777833
# ^ punctuation.definition.string.end.log
778834

779835
Package hyperref Warning: Option `pdfauthor' has already been used,
780836
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log
781-
#^^^^^^^^^^^^^^^^^^^^^^^^ markup.warning.log
837+
#^^^^^^^^^^^^^^^^^^^^^^^^ meta.warning.log markup.warning.log
838+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.warning.log - markup
782839
# ^^^^^^^^^^^ string.quoted.single.log
783840
# ^ punctuation.definition.string.begin.log
784841
# ^ punctuation.definition.string.end.log
785842
(hyperref) setting the option has no effect on input line 13.
786843
# <- meta.block.log meta.block.log meta.parens.log punctuation.section.parens.begin.log
787-
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log
844+
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log meta.warning.log - markup
788845
#^^^^^^^^^ meta.parens.log
789846
# ^ punctuation.section.parens.end.log
790847
)
@@ -796,20 +853,21 @@ Document Class: scrbook 2023/07/07 v3.41 KOMA-Script document class (book)
796853
# <- meta.block.log meta.block.log comment.line.log
797854
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log comment.line.log
798855
Class scrbook Info: using compatibility default ``runin=bysign''
799-
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log
800-
#^^^^^^^^^^^^^^^^^^ markup.info.log
856+
#^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log meta.info.log markup.info.log
857+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log meta.info.log - markup
801858
# ^^^^^^^^^^^^^^^^ string.quoted.double.log
802859
# ^^ punctuation.definition.string.begin.log
803860
# ^^ punctuation.definition.string.end.log
804861
(scrbook) for `\section on input line 6001.
805-
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log
862+
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log meta.info.log - markup
806863
#^^^^^^^^ meta.parens.log
807864
# ^ punctuation.section.parens.end.log
808865
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.single.log
809866
# ^ punctuation.definition.string.begin.log
810867
# ^ punctuation.definition.string.end.log
868+
811869
)
812-
# <- meta.block.log meta.block.log punctuation.section.block.end.log
870+
# <- meta.block.log meta.block.log punctuation.section.block.end.log - meta.info
813871
#^ meta.block.log - meta.block meta.block - punctuation
814872

815873
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)