Skip to content

Commit

Permalink
[TeX] Move most basic prototype like contexts to the end
Browse files Browse the repository at this point in the history
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, ...
  • Loading branch information
deathaxe committed Nov 13, 2022
1 parent 9c49c16 commit 96d16df
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions LaTeX/TeX.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 96d16df

Please sign in to comment.