Skip to content

Commit e502b21

Browse files
committed
Fix line wrapped latex commands in logfile syntax
1 parent 43c54f5 commit e502b21

File tree

2 files changed

+97
-16
lines changed

2 files changed

+97
-16
lines changed

LaTeXTools Log.sublime-syntax

Lines changed: 78 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -324,49 +324,111 @@ contexts:
324324
- meta_scope: meta.error.log
325325
- match: (?:^|\.)$
326326
pop: 1
327-
- include: content
327+
- include: log-content
328328

329329
log-exception-body:
330330
- meta_scope: meta.exception.log
331331
- match: ^$
332332
pop: 1
333-
- include: content
333+
- include: log-content
334334

335335
log-fatal-body:
336336
- meta_scope: meta.error.log
337337
- match: (?:^|\.)$
338338
set:
339339
- log-fatal-hint-body
340340
- log-fatal-desc-body
341-
- include: content
341+
- include: log-content
342342

343343
log-fatal-desc-body:
344344
# expect line, starting with fatal error location (line number e.g.: l.10)
345345
- match: ^l\.\d+\b
346346
pop: 1
347-
- include: content
347+
- include: log-content
348348

349349
log-fatal-hint-body:
350350
- meta_content_scope: meta.error.log meta.description.log
351351
- match: ^$
352352
pop: 1
353-
- include: content
353+
- include: log-content
354354

355355
log-info-body:
356356
- meta_scope: meta.info.log
357357
- match: (?:^|\.)$
358358
pop: 1
359-
- include: content
359+
- include: log-content
360360

361361
log-warning-body:
362362
- meta_scope: meta.warning.log
363363
- match: (?:^|\.)$
364364
pop: 1
365-
- include: content
365+
- include: log-content
366366

367367
log-box-warning-body:
368368
- meta_scope: meta.warning.box.log
369-
- include: content
369+
- include: log-content
370+
371+
log-content:
372+
- include: parens
373+
- include: brackets
374+
- include: comments
375+
- include: log-cmds
376+
- include: constants
377+
- include: strings
378+
379+
log-cmds:
380+
- match: (\\)[\w@]+
381+
scope: support.function.latex
382+
captures:
383+
1: punctuation.definition.variable.latex
384+
push: log-cmd-args
385+
- match: :?=
386+
scope: keyword.operator.assignment.latex
387+
push: value
388+
- match: ;
389+
scope: punctuation.separator.latex
390+
391+
log-cmd-args:
392+
- meta_scope: meta.function-call.latex
393+
- include: comments
394+
- match: \s*(\{)
395+
captures:
396+
1: meta.braces.log punctuation.section.braces.begin.log
397+
push: log-cmd-args-body
398+
- match: \s*(\[)
399+
captures:
400+
1: meta.brackets.log punctuation.section.brackets.begin.log
401+
push: log-bracket-body
402+
- match: \s*(\()
403+
captures:
404+
1: meta.parens.log punctuation.section.parens.begin.log
405+
push: log-paren-body
406+
- match: ^|(?=\s*\S)
407+
pop: 1
408+
409+
log-cmd-args-body:
410+
- meta_content_scope: meta.braces.log
411+
- match: \}
412+
scope: meta.braces.log punctuation.section.braces.end.log
413+
pop: 1
414+
- include: log-content
415+
416+
log-bracket-body:
417+
- meta_content_scope: meta.brackets.log
418+
- match: \]
419+
scope: meta.brackets.log punctuation.section.brackets.end.log
420+
pop: 1
421+
- include: log-content
422+
423+
log-paren-body:
424+
- meta_content_scope: meta.parens.log
425+
- match: \)
426+
scope: meta.parens.log punctuation.section.parens.end.log
427+
pop: 1
428+
- include: log-entries
429+
- include: log-content
430+
431+
###[ COMMANDS ]#################################################################
370432

371433
commands:
372434
- match: (\\)[\w@]+
@@ -382,13 +444,13 @@ contexts:
382444

383445
cmd-args:
384446
- meta_scope: meta.function-call.latex
385-
- include: brackets
386-
- include: parens
387447
- match: \{
388448
scope: punctuation.section.braces.begin.log
389449
push: cmd-args-body
390-
- match: ''
391-
pop: 1
450+
- include: comments
451+
- include: brackets
452+
- include: parens
453+
- include: immediately-pop
392454

393455
cmd-args-body:
394456
- meta_scope: meta.braces.log
@@ -488,3 +550,7 @@ contexts:
488550
bol-pop:
489551
- match: ^
490552
pop: 1
553+
554+
immediately-pop:
555+
- match: ''
556+
pop: 1

tests/syntax/syntax_test_latex.log

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,20 @@ File: untxsyc.fd 2012/04/12 Fontinst v1.933 font definitions for U/ntxsyc.
618618
)
619619
# <- meta.block.log punctuation.section.block.end.log
620620

621+
(D:\User\Documents\latex\texmfs\install\tex\latex\memoir\memoir.cls
622+
Document Class: memoir 2016/05/16 v3.7f configurable book, report, article docu
623+
ment class
624+
\c@@memmarkcntra=\count80
625+
(D:\latex\texmfs\install\tex\generic\oberdiek\ifpdf.sty
626+
# <- meta.block.log meta.block.log punctuation.section.block.begin.log
627+
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log entity.name.section.filename.log
628+
)
629+
# <- meta.block.log meta.block.log punctuation.section.block.end.log
630+
#^ meta.block.log - meta.block meta.block
631+
)
632+
# <- meta.block.log punctuation.section.block.end.log
633+
#^ - meta.block
634+
621635
# -----------------------------------------------------------------------------
622636
# Parentheses
623637
# -----------------------------------------------------------------------------
@@ -770,10 +784,11 @@ l.5 \section\textit
770784
# ^ punctuation.definition.variable.latex
771785
# ^ punctuation.definition.variable.latex
772786
{\uwave{Intr\{oduction}}
773-
# ^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.other.log
774-
# ^ punctuation.definition.string.begin.log
775-
# ^^^^^^^^^^^^^^^^^^^^^^ - constant - punctuation
776-
# ^ punctuation.definition.string.end.log
787+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.exception.log meta.function-call.latex
788+
# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.braces.log
789+
# ^ punctuation.section.braces.begin.log
790+
# ^ punctuation.section.braces.begin.log
791+
# ^^ punctuation.section.braces.end.log
777792

778793
# ----------
779794
# Issue 1233

0 commit comments

Comments
 (0)