diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 6df1549da2..9a8a943ed8 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-group-end 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-group-end - 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-group-end - 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-group-end - 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-group-end - 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-group-end - 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-group-end - 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-group-end - 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-group-end - 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-group-end - 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-group-end - 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-group-end - 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-group-end - 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-group-end - 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-group-end 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-group-end - 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-group-end - 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-group-end - 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-group-end - 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-group-end - 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-group-end - include: general-constants - include: general-commands - include: macro-braces diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index 4de13c1de2..255b19cf03 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-group-end - 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-group-end - 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-group-end - 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-group-end - 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-group-end - include: math-content math-brackets: @@ -393,6 +383,12 @@ 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