From 718926acebabe14385a5a24f0c727de2042cd420 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Sat, 12 Nov 2022 18:59:51 +0100 Subject: [PATCH 01/13] [LaTeX] Inherit LaTeX from TeX --- LaTeX/LaTeX.sublime-syntax | 84 +++++++------------------------------ LaTeX/TeX.sublime-syntax | 4 ++ LaTeX/syntax_test_latex.tex | 15 +++++-- 3 files changed, 30 insertions(+), 73 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 0f1adb8955..a76bf2ad83 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -4,6 +4,8 @@ name: LaTeX scope: text.tex.latex +extends: TeX.sublime-syntax + file_extensions: - tex - ltx @@ -14,18 +16,13 @@ first_line_match: |- ) contexts: - prototype: - - include: comments main: - - include: unique-latex + - meta_prepend: true + - include: latex - include: packages - - include: plain-tex - - include: begin-end-commands - - include: general-commands - - include: global-braces - unique-latex: + latex: - include: preamble - include: structure - include: includes @@ -39,19 +36,7 @@ contexts: - include: graphics - include: lists - plain-tex: - - include: macros - - include: scope:text.tex#controls - - include: scope:text.tex#catcode - - include: boxes - - include: block-math - - include: inline-math - - include: general-constants - - comments: - - include: scope:text.tex#comments - - global-braces: + braces: - match: \{ scope: punctuation.definition.group.brace.begin.latex push: @@ -72,7 +57,7 @@ contexts: pop: true - include: general-constants - include: general-commands - - include: global-braces + - include: braces - match: '[A-Za-z[:digit:]-]*(?=\s*\=)' scope: variable.parameter.bracket.latex @@ -83,20 +68,6 @@ contexts: pop: true - include: main - # matches any nospace and pops the context - else-pop: - - match: (?=\S) - pop: true - - immediately-pop: - - match: '' - pop: true - - # pops out of the current context if there is a new paragraph - paragraph-pop: - - match: ^(?=\s*$) - pop: true - argument: - match: \{ scope: punctuation.definition.group.brace.begin.latex @@ -121,7 +92,7 @@ contexts: - include: macro-braces macros: - - include: scope:text.tex#macros + - meta_append: true - match: (\\)(?:new|renew|provide)command(?:\*|(?![A-Za-z@])) scope: keyword.declaration.function.latex storage.modifier.newcommand.latex captures: @@ -246,6 +217,7 @@ contexts: - include: else-pop general-constants: + - meta_prepend: true - match: (\\\\)(?:(\[)\s*-?((?:[[:digit:]]|\.)*)\s*(\w*)\s*(\]))? captures: 1: constant.character.newline.latex @@ -253,9 +225,9 @@ contexts: 3: constant.numeric.newline.latex 4: keyword.other.newline.latex 5: punctuation.definition.group.bracket.begin.newline.latex - - include: scope:text.tex#general-constants general-commands: + - include: begin-end-commands - match: (\\)[A-Za-z@]+ scope: support.function.general.latex captures: @@ -495,33 +467,16 @@ contexts: - include: math-content math-content: - # unique to latex + - meta_prepend: true + - match: (?=\}) + pop: true - include: verb - include: text-decorators - include: references - include: begin-end-commands - # extended from tex - - include: scope:text.tex#math-builtin - - include: scope:text.tex#math-brackets - - include: math-braces - - include: boxes - - include: scope:text.tex#math-commands - - include: scope:text.tex#math-operators - - include: scope:text.tex#math-characters - - include: scope:text.tex#math-numerics - - include: general-constants - - match: (?=\}) - pop: true inline-math: - - match: \$ - scope: string.other.math.latex punctuation.definition.string.begin.latex - push: - - meta_scope: meta.environment.math.inline.dollar.latex - - match: \$ - scope: string.other.math.latex punctuation.definition.string.end.latex - pop: true - - include: math-content + - meta_append: true - match: ((\\)ensuremath)(\{) captures: 1: support.function.ensuremath.latex @@ -547,15 +502,7 @@ contexts: - include: math-content block-math: - - match: \$\$ - scope: string.other.math.latex punctuation.definition.string.begin.latex - push: - - meta_scope: meta.environment.math.block.dollar.latex - - match: \$\$ - scope: string.other.math.latex punctuation.definition.string.end.latex - pop: true - - include: math-content - + - meta_append: true - match: (\\\[) scope: string.other.math.latex punctuation.definition.string.begin.latex push: @@ -564,7 +511,6 @@ contexts: scope: string.other.math.latex punctuation.definition.string.end.latex pop: true - include: math-content - - match: |- (?x) ((\\)begin)(\{)\s*((?: diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index 667f1e5388..4a7277cbf6 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -85,6 +85,10 @@ contexts: - match: (?=\S) pop: true + immediately-pop: + - match: '' + pop: true + # pops out of the current context if there is a new paragraph paragraph-pop: - match: ^(?=\s*$) diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index 390a7bbfc0..7e051ca234 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -704,16 +704,16 @@ \subsubsection{name} % <- - meta.environment.math $f(x) = \} {} y$ -% ^^^^^^^^^^^^^ meta.environment.math.inline.dollar.latex +% ^^^^^^^^^^^^^ meta.environment.math.inline.dollar.tex $\alpha \cdot \beta \leq \cos( 5 )$ %^ punctuation.definition.backslash.tex %^^^^^^ keyword.other.math.greek.tex -% ^ punctuation.definition.backslash.tex +% ^ punctuation.definition.backslash.tex % ^^^^^ keyword.other.math.binary-operator.tex % ^^^^ keyword.other.math.relation.tex -% -$s \gets \sum_{\imath = 0}^10 \langle \hat{x}, x \rangle$ +% +$s \gets \sum_{\imath = 0}^10 \langle \hat{x}, x \rangle$ % ^^^^^ keyword.other.math.arrow.tex % ^^^^ keyword.other.math.large-operator.tex % ^^^^^^ keyword.other.math.symbol.tex @@ -721,6 +721,13 @@ \subsubsection{name} % ^^^^ keyword.other.math.accent.tex % ^^^^^^^ keyword.other.math.delimiter.tex +$$ + \begin{foo} +% ^^^^^^ keyword.control.flow.begin.latex + \end{foo} +% ^^^^ keyword.control.flow.end.latex +$$ + \end{document} % ^ support.function.end.latex keyword.control.flow.end.latex % ^ variable.parameter.function.latex From ccc0ab89b34142756b75832f51ce97ae3a870932 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sun, 13 Nov 2022 11:45:54 +0100 Subject: [PATCH 02/13] [Haskell] Fix Lterate Haskell This commit extends LaTeX's `begin-end-commands` context to support Haskell's `\begin{code} ... \end{code}` blocks. Formerly used `plain-tex` does no longer exist. --- Haskell/Literate Haskell.sublime-syntax | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Haskell/Literate Haskell.sublime-syntax b/Haskell/Literate Haskell.sublime-syntax index 1c993ebdc8..a947b402ba 100644 --- a/Haskell/Literate Haskell.sublime-syntax +++ b/Haskell/Literate Haskell.sublime-syntax @@ -10,7 +10,7 @@ file_extensions: - lhs contexts: - plain-tex: + begin-end-commands: - meta_prepend: true - include: haskell-code From 9c49c1631052dc702f895a4458760718da5a7736 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sun, 13 Nov 2022 12:18:14 +0100 Subject: [PATCH 03/13] [LaTeX] Remove macro-braces The same context with identical content is already defined in TeX. --- LaTeX/LaTeX.sublime-syntax | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index a76bf2ad83..6df1549da2 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -78,19 +78,6 @@ contexts: - include: general-optional-arguments - include: else-pop - # used in macros to prevent matching of \begin{env}...\end{env} - macro-braces: - - match: \{ - scope: punctuation.definition.group.brace.begin.latex - push: - - meta_scope: meta.group.brace.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true - - include: general-constants - - include: general-commands - - include: macro-braces - macros: - meta_append: true - match: (\\)(?:new|renew|provide)command(?:\*|(?![A-Za-z@])) From 96d16df15dbe57d71663e385bd1bcb854c534462 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sun, 13 Nov 2022 14:00:38 +0100 Subject: [PATCH 04/13] [TeX] Move most basic prototype like contexts to the end Apply an top-down principle to have most basic contexts at the end of a document and the organizational ones at the beginning - just like a tree. Readability may be improved by grouping contexts visually via delimiter comments. See also: Java, PHP, ... --- LaTeX/TeX.sublime-syntax | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index 4a7277cbf6..4de13c1de2 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -80,20 +80,6 @@ contexts: - include: general-constants - include: general-commands - # matches any nospace and pops the context - else-pop: - - match: (?=\S) - pop: true - - immediately-pop: - - match: '' - pop: true - - # pops out of the current context if there is a new paragraph - paragraph-pop: - - match: ^(?=\s*$) - pop: true - general-commands: - match: (\\){{letter}}+ scope: support.function.general.tex @@ -399,3 +385,19 @@ contexts: scope: string.other.math.tex punctuation.definition.string.end.tex pop: true - include: math-content + +###[ PROTOTYPES ]############################################################## + + # matches any nospace and pops the context + else-pop: + - match: (?=\S) + pop: true + + immediately-pop: + - match: '' + pop: true + + # pops out of the current context if there is a new paragraph + paragraph-pop: + - match: ^(?=\s*$) + pop: true From d3fcbff8faf74e474ef467959e52e4c01681f336 Mon Sep 17 00:00:00 2001 From: ngc92 <7938269+ngc92@users.noreply.github.com> Date: Wed, 16 Nov 2022 12:15:44 +0200 Subject: [PATCH 05/13] added a brace-pop utility context --- LaTeX/LaTeX.sublime-syntax | 84 ++++++++++---------------------------- LaTeX/TeX.sublime-syntax | 26 +++++------- 2 files changed, 32 insertions(+), 78 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 6df1549da2..e670f72657 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -306,9 +306,7 @@ contexts: 3: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.include.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop sections: - match: |- @@ -337,9 +335,7 @@ contexts: push: - meta_scope: meta.section.latex - meta_content_scope: entity.name.section.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: main structure: @@ -448,9 +444,7 @@ contexts: scope: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.group.brace.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: math-content math-content: @@ -472,9 +466,7 @@ contexts: push: - meta_scope: meta.function.ensuremath.latex - meta_content_scope: meta.environment.math.inline.ensuremath.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: math-content - match: (\\\() @@ -568,9 +560,7 @@ contexts: push: - meta_scope: meta.function.emph.latex - meta_content_scope: markup.italic.emph.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: main - match: ((\\)textit)(\{) captures: @@ -580,9 +570,7 @@ contexts: push: - meta_scope: meta.function.textit.latex - meta_content_scope: markup.italic.textit.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: main - match: ((\\)textbf)(\{) captures: @@ -592,9 +580,7 @@ contexts: push: - meta_scope: meta.function.textbf.latex - meta_content_scope: markup.bold.textbf.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: main - match: ((\\)texttt)(\{) captures: @@ -604,9 +590,7 @@ contexts: push: - meta_scope: meta.function.texttt.latex - meta_content_scope: markup.raw.texttt.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: main - match: ((\\)textsl)(\{) captures: @@ -616,9 +600,7 @@ contexts: push: - meta_scope: meta.function.textsl.latex - meta_content_scope: markup.italic.textsl.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: main - match: ((\\)text)(\{) captures: @@ -626,9 +608,7 @@ contexts: 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex push: - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: main - match: ((\\)underline)(\{) captures: @@ -638,9 +618,7 @@ contexts: push: - meta_scope: meta.function.underline.latex - meta_content_scope: markup.underline.underline.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: main footnote: @@ -656,9 +634,7 @@ contexts: set: - meta_scope: meta.function.footnote.latex meta.group.brace.latex - meta_content_scope: markup.italic.footnote.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: main - match: (?=\S) pop: true @@ -710,9 +686,7 @@ contexts: - meta_scope: meta.group.brace.latex - match: '[a-zA-Z0-9\.:/*!^_-]+' scope: constant.other.citation.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - match: '' pop: true - match: |- @@ -734,9 +708,7 @@ contexts: - meta_scope: meta.function.reference.latex meta.group.brace.latex - match: '[a-zA-Z0-9\.:/*!^_-]+' scope: constant.other.reference.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - match: '' pop: true - match: ((\\)label)(\{) @@ -748,9 +720,7 @@ contexts: - meta_scope: meta.function.label.latex - match: '[a-zA-Z0-9\.:/*!^_-]+' scope: entity.name.label.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop begin-end-commands: - match: ((\\)begin)(\{)\s*(\w*)\*?\s*(\}) @@ -1577,9 +1547,7 @@ contexts: push: - meta_include_prototype: false - meta_scope: meta.function.newcolumntype.latex - - match: '\}' - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: array-preamble @@ -1623,9 +1591,7 @@ contexts: - match: \{ scope: punctuation.definition.group.brace.begin.latex push: - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: general-constants - include: general-commands - include: array-preamble @@ -1645,9 +1611,7 @@ contexts: 2: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.before-column-decl.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: general-constants - include: general-commands - include: macro-braces @@ -1658,9 +1622,7 @@ contexts: 2: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.after-column-decl.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: general-constants - include: general-commands - include: macro-braces @@ -1674,9 +1636,7 @@ contexts: 2: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.inter-column-decl.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: general-constants - include: general-commands - include: macro-braces @@ -1687,9 +1647,7 @@ contexts: 2: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.inter-column-decl.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true + - include: brace-pop - include: general-constants - include: general-commands - include: macro-braces diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index 4de13c1de2..e1ba93d9fd 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -156,9 +156,7 @@ contexts: scope: punctuation.definition.group.brace.begin.tex push: - meta_scope: meta.group.brace.tex - - match: \} - scope: punctuation.definition.group.brace.end.tex - pop: true + - include: brace-pop - include: main # within macros, it is possible that only part of some nested struture @@ -169,9 +167,7 @@ contexts: scope: punctuation.definition.group.brace.begin.tex push: - meta_scope: meta.group.brace.tex - - match: \} - scope: punctuation.definition.group.brace.end.tex - pop: true + - include: brace-pop - include: general-constants - include: general-commands - include: macro-braces @@ -184,9 +180,7 @@ contexts: 3: punctuation.definition.group.brace.begin.tex push: - meta_scope: meta.function.box.tex - - match: \} - scope: punctuation.definition.group.brace.end.tex - pop: true + - include: brace-pop - include: main macros: @@ -244,9 +238,7 @@ contexts: def-definition-body: - meta_scope: meta.function.body.tex meta.group.brace.tex - - match: \} - scope: punctuation.definition.group.brace.end.tex - pop: 1 + - include: brace-pop - include: general-constants - include: general-commands - include: macro-braces @@ -332,9 +324,7 @@ contexts: scope: punctuation.definition.group.brace.begin.tex push: - meta_scope: meta.group.brace.tex - - match: \} - scope: punctuation.definition.group.brace.end.tex - pop: true + - include: brace-pop - include: math-content math-brackets: @@ -393,6 +383,12 @@ contexts: - match: (?=\S) pop: true + # matches a closing brace pops the context + brace-pop: + - match: \} + scope: punctuation.definition.group.brace.end.tex + pop: true + immediately-pop: - match: '' pop: true From d789979a6e1ffb8c30ef4a1d0bd44d62a846a025 Mon Sep 17 00:00:00 2001 From: ngc92 <7938269+ngc92@users.noreply.github.com> Date: Fri, 18 Nov 2022 22:53:09 +0200 Subject: [PATCH 06/13] renamed --- LaTeX/LaTeX.sublime-syntax | 42 +++++++++++++++++++------------------- LaTeX/TeX.sublime-syntax | 14 ++++++------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index e670f72657..9a8a943ed8 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -306,7 +306,7 @@ contexts: 3: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.include.latex - - include: brace-pop + - include: brace-group-end sections: - match: |- @@ -335,7 +335,7 @@ contexts: push: - meta_scope: meta.section.latex - meta_content_scope: entity.name.section.latex - - include: brace-pop + - include: brace-group-end - include: main structure: @@ -444,7 +444,7 @@ contexts: scope: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.group.brace.latex - - include: brace-pop + - include: brace-group-end - include: math-content math-content: @@ -466,7 +466,7 @@ contexts: push: - meta_scope: meta.function.ensuremath.latex - meta_content_scope: meta.environment.math.inline.ensuremath.latex - - include: brace-pop + - include: brace-group-end - include: math-content - match: (\\\() @@ -560,7 +560,7 @@ contexts: push: - meta_scope: meta.function.emph.latex - meta_content_scope: markup.italic.emph.latex - - include: brace-pop + - include: brace-group-end - include: main - match: ((\\)textit)(\{) captures: @@ -570,7 +570,7 @@ contexts: push: - meta_scope: meta.function.textit.latex - meta_content_scope: markup.italic.textit.latex - - include: brace-pop + - include: brace-group-end - include: main - match: ((\\)textbf)(\{) captures: @@ -580,7 +580,7 @@ contexts: push: - meta_scope: meta.function.textbf.latex - meta_content_scope: markup.bold.textbf.latex - - include: brace-pop + - include: brace-group-end - include: main - match: ((\\)texttt)(\{) captures: @@ -590,7 +590,7 @@ contexts: push: - meta_scope: meta.function.texttt.latex - meta_content_scope: markup.raw.texttt.latex - - include: brace-pop + - include: brace-group-end - include: main - match: ((\\)textsl)(\{) captures: @@ -600,7 +600,7 @@ contexts: push: - meta_scope: meta.function.textsl.latex - meta_content_scope: markup.italic.textsl.latex - - include: brace-pop + - include: brace-group-end - include: main - match: ((\\)text)(\{) captures: @@ -608,7 +608,7 @@ contexts: 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex push: - - include: brace-pop + - include: brace-group-end - include: main - match: ((\\)underline)(\{) captures: @@ -618,7 +618,7 @@ contexts: push: - meta_scope: meta.function.underline.latex - meta_content_scope: markup.underline.underline.latex - - include: brace-pop + - include: brace-group-end - include: main footnote: @@ -634,7 +634,7 @@ contexts: set: - meta_scope: meta.function.footnote.latex meta.group.brace.latex - meta_content_scope: markup.italic.footnote.latex - - include: brace-pop + - include: brace-group-end - include: main - match: (?=\S) pop: true @@ -686,7 +686,7 @@ contexts: - meta_scope: meta.group.brace.latex - match: '[a-zA-Z0-9\.:/*!^_-]+' scope: constant.other.citation.latex - - include: brace-pop + - include: brace-group-end - match: '' pop: true - match: |- @@ -708,7 +708,7 @@ contexts: - meta_scope: meta.function.reference.latex meta.group.brace.latex - match: '[a-zA-Z0-9\.:/*!^_-]+' scope: constant.other.reference.latex - - include: brace-pop + - include: brace-group-end - match: '' pop: true - match: ((\\)label)(\{) @@ -720,7 +720,7 @@ contexts: - meta_scope: meta.function.label.latex - match: '[a-zA-Z0-9\.:/*!^_-]+' scope: entity.name.label.latex - - include: brace-pop + - include: brace-group-end begin-end-commands: - match: ((\\)begin)(\{)\s*(\w*)\*?\s*(\}) @@ -1547,7 +1547,7 @@ contexts: push: - meta_include_prototype: false - meta_scope: meta.function.newcolumntype.latex - - include: brace-pop + - include: brace-group-end - include: array-preamble @@ -1591,7 +1591,7 @@ contexts: - match: \{ scope: punctuation.definition.group.brace.begin.latex push: - - include: brace-pop + - include: brace-group-end - include: general-constants - include: general-commands - include: array-preamble @@ -1611,7 +1611,7 @@ contexts: 2: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.before-column-decl.latex - - include: brace-pop + - include: brace-group-end - include: general-constants - include: general-commands - include: macro-braces @@ -1622,7 +1622,7 @@ contexts: 2: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.after-column-decl.latex - - include: brace-pop + - include: brace-group-end - include: general-constants - include: general-commands - include: macro-braces @@ -1636,7 +1636,7 @@ contexts: 2: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.inter-column-decl.latex - - include: brace-pop + - include: brace-group-end - include: general-constants - include: general-commands - include: macro-braces @@ -1647,7 +1647,7 @@ contexts: 2: punctuation.definition.group.brace.begin.latex push: - meta_scope: meta.function.inter-column-decl.latex - - include: brace-pop + - include: brace-group-end - include: general-constants - include: general-commands - include: macro-braces diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index e1ba93d9fd..255b19cf03 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -156,7 +156,7 @@ contexts: scope: punctuation.definition.group.brace.begin.tex push: - meta_scope: meta.group.brace.tex - - include: brace-pop + - include: brace-group-end - include: main # within macros, it is possible that only part of some nested struture @@ -167,7 +167,7 @@ contexts: scope: punctuation.definition.group.brace.begin.tex push: - meta_scope: meta.group.brace.tex - - include: brace-pop + - include: brace-group-end - include: general-constants - include: general-commands - include: macro-braces @@ -180,7 +180,7 @@ contexts: 3: punctuation.definition.group.brace.begin.tex push: - meta_scope: meta.function.box.tex - - include: brace-pop + - include: brace-group-end - include: main macros: @@ -238,7 +238,7 @@ contexts: def-definition-body: - meta_scope: meta.function.body.tex meta.group.brace.tex - - include: brace-pop + - include: brace-group-end - include: general-constants - include: general-commands - include: macro-braces @@ -324,7 +324,7 @@ contexts: scope: punctuation.definition.group.brace.begin.tex push: - meta_scope: meta.group.brace.tex - - include: brace-pop + - include: brace-group-end - include: math-content math-brackets: @@ -383,8 +383,8 @@ contexts: - match: (?=\S) pop: true - # matches a closing brace pops the context - brace-pop: + # matches a closing brace and pops the context + brace-group-end: - match: \} scope: punctuation.definition.group.brace.end.tex pop: true From 4f2b78fbffc611cab16da8268494b5697b234dcc Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sat, 19 Nov 2022 11:20:29 +0100 Subject: [PATCH 07/13] [LaTeX] Refactor braces contexts Illustrate how `braces` are implemented in both TeX & LaTeX with same content but different sub-scopes. Re-implementing a context without meta_prepend/meta_append overrides it completely. --- LaTeX/LaTeX.sublime-syntax | 17 +++++++++++------ LaTeX/TeX.sublime-syntax | 21 +++++++++++---------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 9a8a943ed8..bfc552aae6 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -39,12 +39,17 @@ contexts: braces: - match: \{ scope: punctuation.definition.group.brace.begin.latex - push: - - meta_scope: meta.group.brace.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true - - include: main + push: brace-group-body + + brace-group-body: + - meta_scope: meta.group.brace.latex + - include: brace-group-end + - include: main + + brace-group-end: + - match: \} + scope: punctuation.definition.group.brace.end.latex + pop: true # these are used to identify arguments in commands general-optional-arguments: diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index 255b19cf03..a773088707 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -154,10 +154,17 @@ contexts: braces: - match: \{ scope: punctuation.definition.group.brace.begin.tex - push: - - meta_scope: meta.group.brace.tex - - include: brace-group-end - - include: main + push: brace-group-body + + brace-group-body: + - meta_scope: meta.group.brace.tex + - include: brace-group-end + - include: main + + brace-group-end: + - match: \} + scope: punctuation.definition.group.brace.end.tex + pop: true # within macros, it is possible that only part of some nested struture # is present. To prevent this from causing problems, here we only match @@ -383,12 +390,6 @@ contexts: - match: (?=\S) pop: true - # matches a closing brace and pops the context - brace-group-end: - - match: \} - scope: punctuation.definition.group.brace.end.tex - pop: true - immediately-pop: - match: '' pop: true From 2ddd55b85b41aad43df351ec9e289740fcb6fc77 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sat, 19 Nov 2022 11:30:03 +0100 Subject: [PATCH 08/13] [TeX] Add more named groups --- LaTeX/TeX.sublime-syntax | 50 ++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index e165f8b130..e637938e6c 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -224,12 +224,14 @@ contexts: macro-braces: - match: \{ scope: punctuation.definition.group.brace.begin.tex - push: - - meta_scope: meta.group.brace.tex - - include: brace-group-end - - include: general-constants - - include: general-commands - - include: macro-braces + push: macro-brace-group-body + + macro-brace-group-body: + - meta_scope: meta.group.brace.tex + - include: brace-group-end + - include: general-constants + - include: general-commands + - include: macro-braces boxes: - match: ((\\)[hv]box)\s*(\{) @@ -237,10 +239,12 @@ contexts: 1: support.function.box.tex 2: punctuation.definition.backslash.tex 3: punctuation.definition.group.brace.begin.tex - push: - - meta_scope: meta.function.box.tex - - include: brace-group-end - - include: main + push: box-body + + box-body: + - meta_scope: meta.function.box.tex + - include: brace-group-end + - include: main macros: # Note \edef and \xdef have slightly different syntax, in that they do not @@ -252,21 +256,23 @@ contexts: scope: keyword.declaration.function.tex storage.modifier.definition.tex captures: 1: punctuation.definition.backslash.tex - push: def-commandname + push: def-maybe-commandname - def-commandname: + def-maybe-commandname: - meta_scope: meta.function.tex - match: (?=\\) - set: - - clear_scopes: 1 - - meta_scope: meta.function.identifier.tex - - match: (\\){{cmdname}} - scope: entity.name.definition.tex - captures: - 1: punctuation.definition.backslash.tex - set: def-argspec - - include: paragraph-pop - - include: else-pop + set: def-commandname + - include: paragraph-pop + - include: else-pop + + def-commandname: + - clear_scopes: 1 + - meta_scope: meta.function.identifier.tex + - match: (\\){{cmdname}} + scope: entity.name.definition.tex + captures: + 1: punctuation.definition.backslash.tex + set: def-argspec - include: paragraph-pop - include: else-pop From 714cd09c4b7da14fbb1765a9481c4936351c8239 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sat, 19 Nov 2022 11:41:58 +0100 Subject: [PATCH 09/13] [LaTeX] Organize math expressions in named contexts --- LaTeX/LaTeX.sublime-syntax | 115 +++++++++++++++++++++++-------------- LaTeX/TeX.sublime-syntax | 44 ++++++++------ 2 files changed, 99 insertions(+), 60 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index bfc552aae6..1248698cc0 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -447,10 +447,12 @@ contexts: math-braces: - match: \{ scope: punctuation.definition.group.brace.begin.latex - push: - - meta_scope: meta.group.brace.latex - - include: brace-group-end - - include: math-content + push: math-brace-group-body + + math-brace-group-body: + - meta_scope: meta.group.brace.latex + - include: brace-group-end + - include: math-content math-content: - meta_prepend: true @@ -463,63 +465,88 @@ contexts: inline-math: - meta_append: true + - include: inline-math-parens + - include: inline-math-ensuremath + + inline-math-ensuremath: - match: ((\\)ensuremath)(\{) captures: 1: support.function.ensuremath.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex - push: - - meta_scope: meta.function.ensuremath.latex - - meta_content_scope: meta.environment.math.inline.ensuremath.latex - - include: brace-group-end - - include: math-content + push: inline-math-ensuremath-body - - match: (\\\() - scope: string.other.math.latex - captures: - 1: punctuation.definition.string.begin.latex - push: - - meta_scope: meta.environment.math.inline.paren.latex - - match: (\\\)) - scope: string.other.math.latex punctuation.definition.string.end.latex - pop: true - - include: math-content + inline-math-ensuremath-body: + - meta_scope: meta.function.ensuremath.latex + - meta_content_scope: meta.environment.math.inline.ensuremath.latex + - include: brace-group-end + - include: math-content + + inline-math-parens: + - match: \\\( + scope: string.other.math.latex punctuation.definition.string.begin.latex + push: inline-math-parens-body + + inline-math-parens-body: + - meta_scope: meta.environment.math.inline.paren.latex + - include: inline-math-parens-end + - include: math-content + + inline-math-parens-end: + - match: \\\) + scope: string.other.math.latex punctuation.definition.string.end.latex + pop: true block-math: - meta_append: true - - match: (\\\[) - scope: string.other.math.latex punctuation.definition.string.begin.latex - push: - - meta_scope: meta.environment.math.block.bracket.latex - - match: (\\\]) - scope: string.other.math.latex punctuation.definition.string.end.latex - pop: true - - include: math-content + - include: block-math-brackets + - include: block-math-begin-end-command + + block-math-begin-end-command: - match: |- (?x) - ((\\)begin)(\{)\s*((?: - align|alignat|aligned|alignedat|displaymath - |eqnarray|equation|flalign|gather|gathered - |math|multline|x?xalignat|split - |dmath|dseries|dgroup|darray|dsuspend - )\*?)\s*(\}) + ((\\)begin) (\{) \s* ( + (?: align | alignat | aligned | alignedat | displaymath | eqnarray + | equation | flalign | gather | gathered | math | multline | x?xalignat + | split | dmath | dseries | dgroup | darray | dsuspend )\*? + ) \s* (\}) captures: 1: support.function.begin.latex keyword.control.flow.begin.latex 2: punctuation.definition.backslash.latex 3: punctuation.definition.group.brace.begin.latex 4: variable.parameter.function.latex 5: punctuation.definition.group.brace.end.latex - push: - - meta_content_scope: meta.environment.math.block.be.latex - - match: ((\\)end)(\{)\s*(\4)\s*(\}) - captures: - 1: support.function.end.latex keyword.control.flow.begin.latex - 2: punctuation.definition.backslash.latex - 3: punctuation.definition.group.brace.begin.latex - 4: variable.parameter.function.latex - 5: punctuation.definition.group.brace.end.latex - pop: true - - include: math-content + push: block-math-begin-end-command-body + + block-math-begin-end-command-body: + - meta_content_scope: meta.environment.math.block.be.latex + - include: block-math-begin-end-command-end + - include: math-content + + block-math-begin-end-command-end: + - match: ((\\)end)(\{)\s*(\4)\s*(\}) + captures: + 1: support.function.end.latex keyword.control.flow.begin.latex + 2: punctuation.definition.backslash.latex + 3: punctuation.definition.group.brace.begin.latex + 4: variable.parameter.function.latex + 5: punctuation.definition.group.brace.end.latex + pop: true + + block-math-brackets: + - match: \\\[ + scope: string.other.math.latex punctuation.definition.string.begin.latex + push: block-math-brackets-body + + block-math-brackets-body: + - meta_scope: meta.environment.math.block.bracket.latex + - include: block-math-brackets-end + - include: math-content + + block-math-brackets-end: + - match: \\\] + scope: string.other.math.latex punctuation.definition.string.end.latex + pop: true graphics: - match: ((\\)includegraphics)\b diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index e637938e6c..d7a611f677 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -382,10 +382,12 @@ contexts: math-braces: - match: \{ scope: punctuation.definition.group.brace.begin.tex - push: - - meta_scope: meta.group.brace.tex - - include: brace-group-end - - include: math-content + push: math-brace-group-body + + math-brace-group-body: + - meta_scope: meta.group.brace.tex + - include: brace-group-end + - include: math-content math-brackets: - match: '[\(\)]' @@ -419,22 +421,32 @@ contexts: inline-math: - match: \$ scope: string.other.math.tex punctuation.definition.string.begin.tex - push: - - meta_scope: meta.environment.math.inline.dollar.tex - - match: \$ - scope: string.other.math.tex punctuation.definition.string.end.tex - pop: true - - include: math-content + push: inline-math-dollar-body + + inline-math-dollar-body: + - meta_scope: meta.environment.math.inline.dollar.tex + - include: inline-math-dollar-end + - include: math-content + + inline-math-dollar-end: + - match: \$ + scope: string.other.math.tex punctuation.definition.string.end.tex + pop: true block-math: - match: \$\$ scope: string.other.math.tex punctuation.definition.string.begin.tex - push: - - meta_scope: meta.environment.math.block.dollar.tex - - match: \$\$ - scope: string.other.math.tex punctuation.definition.string.end.tex - pop: true - - include: math-content + push: block-math-dollar-body + + block-math-dollar-body: + - meta_scope: meta.environment.math.block.dollar.tex + - include: block-math-dollar-end + - include: math-content + + block-math-dollar-end: + - match: \$\$ + scope: string.other.math.tex punctuation.definition.string.end.tex + pop: true ###[ PROTOTYPES ]############################################################## From 7424049963a6ef640282eba5d9499008751d3111 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sat, 19 Nov 2022 11:51:40 +0100 Subject: [PATCH 10/13] [LaTeX] Re-arrange math contexts Re-arrange contexts to implement the top-down principle. --- LaTeX/LaTeX.sublime-syntax | 30 ++++++-------- LaTeX/TeX.sublime-syntax | 83 +++++++++++++++++++------------------- 2 files changed, 54 insertions(+), 59 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 1248698cc0..a5f6f0afeb 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -444,24 +444,7 @@ contexts: pop: true - include: main - math-braces: - - match: \{ - scope: punctuation.definition.group.brace.begin.latex - push: math-brace-group-body - - math-brace-group-body: - - meta_scope: meta.group.brace.latex - - include: brace-group-end - - include: math-content - - math-content: - - meta_prepend: true - - match: (?=\}) - pop: true - - include: verb - - include: text-decorators - - include: references - - include: begin-end-commands +###[ MATH ]#################################################################### inline-math: - meta_append: true @@ -548,6 +531,17 @@ contexts: scope: string.other.math.latex punctuation.definition.string.end.latex pop: true + math-content: + - meta_prepend: true + - match: (?=\}) + pop: true + - include: verb + - include: text-decorators + - include: references + - include: begin-end-commands + +###[ OTHER ]################################################################### + graphics: - match: ((\\)includegraphics)\b captures: diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index d7a611f677..96b2a10fa3 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -303,6 +303,48 @@ contexts: - include: general-commands - include: macro-braces +###[ MATH ]#################################################################### + + inline-math: + - match: \$ + scope: string.other.math.tex punctuation.definition.string.begin.tex + push: inline-math-dollar-body + + inline-math-dollar-body: + - meta_scope: meta.environment.math.inline.dollar.tex + - include: inline-math-dollar-end + - include: math-content + + inline-math-dollar-end: + - match: \$ + scope: string.other.math.tex punctuation.definition.string.end.tex + pop: true + + block-math: + - match: \$\$ + scope: string.other.math.tex punctuation.definition.string.begin.tex + push: block-math-dollar-body + + block-math-dollar-body: + - meta_scope: meta.environment.math.block.dollar.tex + - include: block-math-dollar-end + - include: math-content + + block-math-dollar-end: + - match: \$\$ + scope: string.other.math.tex punctuation.definition.string.end.tex + pop: true + + math-content: + - include: math-builtin + - include: math-brackets + - include: math-braces + - include: boxes + - include: math-commands + - include: math-operators + - include: math-characters + - include: math-numerics + - include: general-constants math-builtin: - include: math-greeks @@ -407,47 +449,6 @@ contexts: - match: '[A-Za-z]+' scope: variable.other.math.tex - math-content: - - include: math-builtin - - include: math-brackets - - include: math-braces - - include: boxes - - include: math-commands - - include: math-operators - - include: math-characters - - include: math-numerics - - include: general-constants - - inline-math: - - match: \$ - scope: string.other.math.tex punctuation.definition.string.begin.tex - push: inline-math-dollar-body - - inline-math-dollar-body: - - meta_scope: meta.environment.math.inline.dollar.tex - - include: inline-math-dollar-end - - include: math-content - - inline-math-dollar-end: - - match: \$ - scope: string.other.math.tex punctuation.definition.string.end.tex - pop: true - - block-math: - - match: \$\$ - scope: string.other.math.tex punctuation.definition.string.begin.tex - push: block-math-dollar-body - - block-math-dollar-body: - - meta_scope: meta.environment.math.block.dollar.tex - - include: block-math-dollar-end - - include: math-content - - block-math-dollar-end: - - match: \$\$ - scope: string.other.math.tex punctuation.definition.string.end.tex - pop: true - ###[ PROTOTYPES ]############################################################## # matches any nospace and pops the context From ea7bccdef1c4e5d235b4edb4705fc4d8f70a8ebc Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sat, 19 Nov 2022 11:57:56 +0100 Subject: [PATCH 11/13] [TeX] Reorganize macro braces Group macro related contexts in a MACROS section --- LaTeX/TeX.sublime-syntax | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index 96b2a10fa3..e7399f6be2 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -218,21 +218,6 @@ contexts: scope: punctuation.definition.group.brace.end.tex pop: true - # within macros, it is possible that only part of some nested struture - # is present. To prevent this from causing problems, here we only match - # elements that are simple, i.e. that do not push to the stack. - macro-braces: - - match: \{ - scope: punctuation.definition.group.brace.begin.tex - push: macro-brace-group-body - - macro-brace-group-body: - - meta_scope: meta.group.brace.tex - - include: brace-group-end - - include: general-constants - - include: general-commands - - include: macro-braces - boxes: - match: ((\\)[hv]box)\s*(\{) captures: @@ -246,6 +231,8 @@ contexts: - include: brace-group-end - include: main +###[ MACROS ]################################################################## + macros: # Note \edef and \xdef have slightly different syntax, in that they do not # allow for arguments. However, every valid \edef could be a valid \def, @@ -298,6 +285,18 @@ contexts: def-definition-body: - meta_scope: meta.function.body.tex meta.group.brace.tex + - include: macro-brace-group-body + + # within macros, it is possible that only part of some nested struture + # is present. To prevent this from causing problems, here we only match + # elements that are simple, i.e. that do not push to the stack. + macro-braces: + - match: \{ + scope: punctuation.definition.group.brace.begin.tex + push: macro-brace-group-body + + macro-brace-group-body: + - meta_scope: meta.group.brace.tex - include: brace-group-end - include: general-constants - include: general-commands From 2fb06e89a914ec0eede191c2ba65337a63d47f60 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sat, 19 Nov 2022 12:14:02 +0100 Subject: [PATCH 12/13] [Markdown] Adjust syntax tests Some final sub scopes changed from .latex to tex due to inheritance. Hence make Markdown syntax tests a bit more lazy. --- Markdown/tests/syntax_test_markdown.md | 58 +++++++++++++------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/Markdown/tests/syntax_test_markdown.md b/Markdown/tests/syntax_test_markdown.md index 11ace0245b..c08bd934c8 100644 --- a/Markdown/tests/syntax_test_markdown.md +++ b/Markdown/tests/syntax_test_markdown.md @@ -8036,24 +8036,24 @@ $$ |^ punctuation.definition.math.begin.latex | ^ - punctuation foo = 1 + 2 * \sqrt{a^2+b^2} -| <- markup.math.block.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar.latex variable.other.math.tex -|^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.math.block.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar.latex -| ^ keyword.operator.math.tex -| ^ constant.numeric.math.tex -| ^ keyword.operator.math.tex -| ^ constant.numeric.math.tex -| ^ keyword.operator.math.tex -| ^^^^^ support.function.math.tex -| ^^^^^^^^^ meta.group.brace.latex -| ^ punctuation.definition.group.brace.begin.latex -| ^ variable.other.math.tex -| ^ keyword.operator.math.tex -| ^ constant.numeric.math.tex -| ^ keyword.operator.math.tex -| ^ variable.other.math.tex -| ^ keyword.operator.math.tex -| ^ constant.numeric.math.tex -| ^ punctuation.definition.group.brace.end.latex +| <- markup.math.block.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar variable.other.math +|^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.math.block.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar +| ^ keyword.operator.math +| ^ constant.numeric.math +| ^ keyword.operator.math +| ^ constant.numeric.math +| ^ keyword.operator.math +| ^^^^^ support.function.math +| ^^^^^^^^^ meta.group.brace +| ^ punctuation.definition.group.brace.begin +| ^ variable.other.math +| ^ keyword.operator.math +| ^ constant.numeric.math +| ^ keyword.operator.math +| ^ variable.other.math +| ^ keyword.operator.math +| ^ constant.numeric.math +| ^ punctuation.definition.group.brace.end $$ | <- markup.math.block.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar.latex punctuation.definition.math.end.latex |^ markup.math.block.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar.latex punctuation.definition.math.end.latex @@ -8211,11 +8211,11 @@ b$ math. |^^^^^^^^ meta.paragraph.markdown - markup.math Handle incomplete $\sqrt{b$ expressions well. -| ^^^^^^^^^ meta.paragraph.markdown markup.math.inline.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar.latex -| ^ punctuation.definition.math.begin.latex -| ^^^^^ support.function.math.tex -| ^^ meta.group.brace.latex -| ^ punctuation.definition.math.end.latex - meta.group +| ^^^^^^^^^ meta.paragraph.markdown markup.math.inline.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar +| ^ punctuation.definition.math.begin +| ^^^^^ support.function.math +| ^^ meta.group.brace +| ^ punctuation.definition.math.end - meta.group | ^ meta.paragraph.markdown - markup.math 1. ordered list $\sqrt{b}$ equation $1+ @@ -8238,12 +8238,12 @@ Handle incomplete $\sqrt{b$ expressions well. | ^^^^^^ - markup.math - meta.tag + unordered $\sqrt{b}$ equation - | ^^^^^^^^^^ markup.list.numbered.markdown meta.paragraph.list.markdown markup.math.inline.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar.latex + | ^^^^^^^^^^ markup.list.numbered.markdown meta.paragraph.list.markdown markup.math.inline.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar Handle incomplete $\sqrt{b$ expressions well. - | ^^^^^^^^^ meta.paragraph.list.markdown markup.math.inline.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar.latex - | ^ punctuation.definition.math.begin.latex - | ^^^^^ support.function.math.tex - | ^^ meta.group.brace.latex - | ^ punctuation.definition.math.end.latex - meta.group + | ^^^^^^^^^ meta.paragraph.list.markdown markup.math.inline.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar + | ^ punctuation.definition.math.begin + | ^^^^^ support.function.math + | ^^ meta.group.brace + | ^ punctuation.definition.math.end - meta.group | ^ meta.paragraph.list.markdown - markup.math From 13d3d352779faa0d140a5d309563c44c8ea93162 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Sat, 19 Nov 2022 12:16:14 +0100 Subject: [PATCH 13/13] [LaTeX] Rename remaining `inside-...` context --- LaTeX/TeX.sublime-syntax | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index e7399f6be2..110ff623b5 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -134,7 +134,7 @@ contexts: def-registername: - match: \{ scope: punctuation.definition.group.brace.begin.tex - push: inside-register-name-group + push: register-name-group-body - match: (\\){{cmdname}} scope: entity.name.constant.tex captures: @@ -143,7 +143,7 @@ contexts: - include: paragraph-pop - include: else-pop - inside-register-name-group: + register-name-group-body: - meta_scope: meta.group.brace.latex - match: \} scope: punctuation.definition.group.brace.end.tex