Skip to content

Commit 209d6ba

Browse files
committed
Fix exception termination after commands in logfile syntax
1 parent d5eb80f commit 209d6ba

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

LaTeXTools Log.sublime-syntax

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ variables:
1515
file_ext_char: '[a-zA-Z0-9]'
1616
file_break: (?:\n|(?=\s*[()]))
1717

18+
end_of_block: '[\s\)]*\)\s*[(\n]'
19+
1820
################################################################################
1921

2022
contexts:
@@ -308,7 +310,7 @@ contexts:
308310
# `[1` or `[anytext]`
309311
\s* \[ (?: \d+ | [^\]]+\] )$)
310312
# end of block
311-
| [\s\)]* \) \s* [(\n]
313+
| {{end_of_block}}
312314
# exceptions
313315
| ![ ]\w
314316
# errors/info/warnings
@@ -388,8 +390,12 @@ contexts:
388390
pop: 1
389391

390392
log-paragraph-end:
393+
# empty line
391394
- match: ^$
392395
pop: 1
396+
# end of block
397+
- match: ^(?={{end_of_block}})
398+
pop: 1
393399

394400
log-item-continuations:
395401
# Terminate log items before final line feed as `view.find_by_selector()`
@@ -407,7 +413,7 @@ contexts:
407413
(?x)
408414
^(?=
409415
# end of block
410-
[\s\)]* \) \s* [(\n]
416+
{{end_of_block}}
411417
# exceptions
412418
| ![ ]\w
413419
# errors/info/warnings
@@ -454,6 +460,7 @@ contexts:
454460
push: log-paren-body
455461
- match: ^|(?=\s*\S)
456462
pop: 1
463+
- include: log-item-continuations
457464

458465
log-cmd-args-body:
459466
- meta_content_scope: meta.braces.log

tests/syntax/syntax_test_latex.log

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,23 @@ Package aclass Info: An unterminated info message
990990
# ^ meta.block.log meta.block.log punctuation.section.block.end.log
991991
# ^ meta.block.log - meta.block meta.block
992992

993+
(test-log-termination-at-block-end-06.tex
994+
! LaTeX Error: \begin{document} ended by \end{sequencediagram}.
995+
996+
See the LaTeX manual or LaTeX Companion for explanation.
997+
Type H <return> for immediate help.
998+
...
999+
1000+
l.8 \end{sequencediagram}
1001+
! LaTeX Error: \begin{document} ended by \end{sequencediagram}.
1002+
# <- meta.block.log meta.block.log meta.exception.log markup.error.log
1003+
#^^^^^^^^^^^^^ meta.block.log meta.block.log meta.exception.log markup.error.log
1004+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log meta.exception.log - markup
1005+
1006+
l.9 \end{sequencediagram}
1007+
)
1008+
# <- meta.block.log meta.block.log punctuation.section.block.end.log
1009+
9931010
# -----------------------------------------------------------------------------
9941011
# badbox messages
9951012
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)