Skip to content

Commit

Permalink
[LaTeX] Replace some ugly anonymous multi-push contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Nov 2, 2023
1 parent 28e4077 commit 5af53cd
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions LaTeX/LaTeX.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -363,24 +363,22 @@ contexts:
3: punctuation.definition.group.brace.begin.tex
push:
- meta_scope: meta.function.box.latex
- match: \}
scope: punctuation.definition.group.brace.end.tex
pop: 1
- include: brace-group-end
- include: main
- match: ((\\)(?:framebox|makebox))\b
captures:
1: support.function.box.latex
2: punctuation.definition.backslash.latex
push:
- [{meta_scope: meta.function.box.latex}, {match: '', pop: 1}]
- box-meta
- argument
- optional-arguments
- match: ((\\)parbox)\b
captures:
1: support.function.box.latex
2: punctuation.definition.backslash.latex
push:
- [{meta_scope: meta.function.box.latex}, {match: '', pop: 1}]
- box-meta
- argument
- argument
- optional-arguments
Expand All @@ -389,10 +387,15 @@ contexts:
1: support.function.box.latex
2: punctuation.definition.backslash.latex
push:
- [{meta_scope: meta.function.box.latex}, {match: '', pop: 1}]
- box-meta
- argument
- optional-arguments

box-meta:
- meta_include_prototype: false
- meta_scope: meta.function.box.latex
- include: immediately-pop

preamble:
- match: (\\)documentclass\b
scope: meta.preamble.documentclass.latex keyword.control.preamble.latex
Expand Down Expand Up @@ -680,10 +683,15 @@ contexts:
1: support.function.includegraphics.latex
2: punctuation.definition.backslash.latex
push:
- [{meta_scope: meta.function.includegraphics.latex}, {match: '', pop: 1}]
- includegraphics-meta
- argument
- optional-arguments

includegraphics-meta:
- meta_include_prototype: false
- meta_scope: meta.function.includegraphics.latex
- include: immediately-pop

url:
- match: ((\\)(?:url|href|path))(\{)([^}]*)(\})
scope: meta.function.link.url.latex
Expand Down Expand Up @@ -1024,9 +1032,7 @@ contexts:
# utility that waits for the brace, and pops the three contexts
# we push for each \text... command otherwise
expect-text-markup-open-brace:
- match: \{
scope: punctuation.definition.group.brace.begin.tex
pop: 1
- include: brace-group-begin
- match: (?=\S)
pop: 3

Expand Down

0 comments on commit 5af53cd

Please sign in to comment.