Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LaTeX] Improve LaTeX #3575

Merged
merged 49 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
718926a
[LaTeX] Inherit LaTeX from TeX
deathaxe Nov 12, 2022
ccc0ab8
[Haskell] Fix Lterate Haskell
deathaxe Nov 13, 2022
9c49c16
[LaTeX] Remove macro-braces
deathaxe Nov 13, 2022
96d16df
[TeX] Move most basic prototype like contexts to the end
deathaxe Nov 13, 2022
d3fcbff
added a brace-pop utility context
ngc92 Nov 16, 2022
d789979
renamed
ngc92 Nov 18, 2022
874f1d3
Merge pull request #1 from ngc92/brace-pop
deathaxe Nov 19, 2022
4f2b78f
[LaTeX] Refactor braces contexts
deathaxe Nov 19, 2022
b81d2e3
Merge branch 'master' into pr/latex/extend-latex-from-tex
deathaxe Nov 19, 2022
2ddd55b
[TeX] Add more named groups
deathaxe Nov 19, 2022
714cd09
[LaTeX] Organize math expressions in named contexts
deathaxe Nov 19, 2022
7424049
[LaTeX] Re-arrange math contexts
deathaxe Nov 19, 2022
ea7bccd
[TeX] Reorganize macro braces
deathaxe Nov 19, 2022
2fb06e8
[Markdown] Adjust syntax tests
deathaxe Nov 19, 2022
13d3d35
[LaTeX] Rename remaining `inside-...` context
deathaxe Nov 19, 2022
ef5feea
Merge branch 'pr/latex/extend-latex-from-tex' into develop/latex
deathaxe Nov 19, 2022
ecef8eb
[TeX] Improved highlighting in macro definition bodies (#3576)
ngc92 Nov 19, 2022
8739aef
[TeX] improved handling of (cat)code family of commands (#3577)
ngc92 Nov 19, 2022
00c38f7
[TeX] Fix scoping error (#3582)
ngc92 Nov 20, 2022
700ed59
[TeX] added scoping of "constants" (#3581)
ngc92 Nov 20, 2022
d460764
[Tex] add \relax command (#3586)
ngc92 Nov 20, 2022
87ade17
[Tex] Fix \relax test case
deathaxe Nov 20, 2022
106c95e
[TeX] refactor LaTeX Log syntax (#3557)
jrappen Nov 24, 2022
45dc6d9
[TeX] Small formal tweaks for LaTeX Log syntax
deathaxe Nov 24, 2022
e4b0425
[LaTeX] xparse command definition support (#3585)
ngc92 Nov 26, 2022
07a4d04
[LaTeX] Adjust latex-newcommand context structure
deathaxe Nov 26, 2022
f459663
[LaTeX] Fixups for command names (#3594)
ngc92 Nov 26, 2022
d7a211d
[TeX] Modifiers for \def's (#3593)
ngc92 Nov 26, 2022
7e2f137
[TeX] improve register assignments (#3587)
ngc92 Nov 27, 2022
de22791
[TeX] Reorganize comments
deathaxe Nov 27, 2022
450ec3f
[TeX] Reorganize braces
deathaxe Nov 27, 2022
3f1bd42
[TeX] Reorganize command and control contexts
deathaxe Nov 27, 2022
de0a918
[TeX] Reorganize main keys
deathaxe Nov 27, 2022
ca683f7
[TeX] Move test files into test/ sub directory
deathaxe Nov 27, 2022
d5ac30e
[LaTeX] Scope all braced groups .tex (#3595)
deathaxe Nov 29, 2022
2f6dfd8
[TeX] Apply scope naming guidelines to math operators
deathaxe Dec 1, 2022
42c7b91
[TeX] Apply scope naming guidelines to math numbers
deathaxe Dec 1, 2022
cf2abb2
[TeX] rename math variables context
deathaxe Dec 1, 2022
88b7979
[TeX] Apply scope naming guidelines to math brackets
deathaxe Dec 1, 2022
561fb52
[LaTeX] Enhance math syntax tests
deathaxe Dec 1, 2022
e6cb8a7
[LaTeX] Fix register id scope
deathaxe Dec 1, 2022
3fa9066
fixed a scoping bug (#3609)
ngc92 Dec 7, 2022
c738529
[TeX] Improved integer handling (#3604)
ngc92 Dec 8, 2022
43b7f26
[LaTeX] Text formatting (#3618)
ngc92 Feb 1, 2023
a9932f8
[TeX.DocStrip] Basic DocStrip support (#3555)
ngc92 May 13, 2023
504a1a7
Revert to support.function scope (#3787)
ngc92 Jun 11, 2023
66dccdf
[LaTeX] Math scopes (#3608)
ngc92 Nov 1, 2023
28e4077
[LaTeX] sublime syntax version 2
deathaxe Nov 2, 2023
5af53cd
[LaTeX] Replace some ugly anonymous multi-push contexts
deathaxe Nov 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions Haskell/Literate Haskell.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,34 @@
# https://www.sublimetext.com/docs/syntax.html
name: Literate Haskell
scope: text.tex.latex.haskell
version: 2

extends: Packages/LaTeX/LaTeX.sublime-syntax

file_extensions:
- lhs

contexts:
plain-tex:
begin-end-commands:
- meta_prepend: true
- include: haskell-code

haskell-code:
- match: ((\\)begin)(\{)(code)(\})
- match: ((\\)begin)((\{)\s*(code)\s*(\}))
captures:
1: support.function.begin.latex keyword.control.block.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
3: meta.group.brace.tex
4: punctuation.definition.group.brace.begin.tex
5: variable.parameter.function.latex
6: punctuation.definition.group.brace.end.tex
embed: scope:source.haskell
embed_scope: source.haskell.embedded.latex
escape: ((\\)end)(\{)(code)(\})
escape: ((\\)end)((\{)\s*(code)\s*(\}))
escape_captures:
1: support.function.end.latex keyword.control.block.end.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
3: meta.group.brace.tex
4: punctuation.definition.group.brace.begin.tex
5: variable.parameter.function.latex
6: punctuation.definition.group.brace.end.tex
8 changes: 4 additions & 4 deletions Haskell/tests/syntax_test_literate.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
% ^ source.haskell.embedded.latex
% ^ punctuation.definition.backslash.latex
% ^^^^^^ support.function.begin.latex keyword.control.block.begin.latex
% ^ punctuation.definition.group.brace.begin.latex
% ^ punctuation.definition.group.brace.begin.tex
% ^^^^ variable.parameter.function.latex
% ^ punctuation.definition.group.brace.end.latex
% ^ punctuation.definition.group.brace.end.tex

{- comment -}
% ^^^^^^^^^^^^^ source.haskell.embedded.latex comment.block.haskell
Expand All @@ -23,6 +23,6 @@
% ^^^^^^^^^^^ - source.haskell
% ^ punctuation.definition.backslash.latex
% ^^^^ support.function.end.latex keyword.control.block.end.latex
% ^ punctuation.definition.group.brace.begin.latex
% ^ punctuation.definition.group.brace.begin.tex
% ^^^^ variable.parameter.function.latex
% ^ punctuation.definition.group.brace.end.latex
% ^ punctuation.definition.group.brace.end.tex
35 changes: 18 additions & 17 deletions LaTeX/Bibtex.sublime-syntax
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
%YAML 1.2
---
# Grammar based on description from
# http://artis.imag.fr/~Xavier.Decoret/resources/xdkbibtex/bibtex_summary.html#comment
#
# TODO: Does not support @preamble
name: BibTeX
scope: text.bibtex
comment: |
Grammar based on description from http://artis.imag.fr/~Xavier.Decoret/resources/xdkbibtex/bibtex_summary.html#comment

TODO: Does not support @preamble
version: 2

file_extensions:
- bib
Expand All @@ -25,7 +26,7 @@ contexts:
push:
- meta_scope: comment.line.at-sign.bibtex
- match: $\n?
pop: true
pop: 1
- match: '((@)[Ss]tring)\s*(\{)\s*({{var}})'
captures:
1: keyword.other.string-constant.bibtex
Expand All @@ -36,7 +37,7 @@ contexts:
- meta_scope: meta.string-constant.braces.bibtex
- match: '\}'
scope: punctuation.section.string-constant.end.bibtex
pop: true
pop: 1
- include: string_content
- include: variables
- include: operators
Expand All @@ -50,7 +51,7 @@ contexts:
- meta_scope: meta.string-constant.parenthesis.bibtex
- match: \)
scope: punctuation.section.string-constant.end.bibtex
pop: true
pop: 1
- include: string_content
- include: variables
- include: operators
Expand All @@ -65,7 +66,7 @@ contexts:
- meta_content_scope: meta.mapping.bibtex
- match: '\}'
scope: punctuation.section.entry.end.bibtex
pop: true
pop: 1
- match: '([a-zA-Z]+)(\s*(=)\s*)'
captures:
1: meta.mapping.key.bibtex string.unquoted.key.bibtex
Expand All @@ -74,8 +75,8 @@ contexts:
push:
- clear_scopes: 1
- meta_content_scope: meta.mapping.value.bibtex
- match: "(?=[,}])"
pop: true
- match: (?=[,}])
pop: 1
- include: string_content
- include: integer
- include: variables
Expand All @@ -93,7 +94,7 @@ contexts:
- meta_content_scope: meta.mapping.bibtex
- match: \)
scope: punctuation.section.entry.end.bibtex
pop: true
pop: 1
- match: '([a-zA-Z]+)(\s*(=)\s*)'
captures:
1: meta.mapping.key.bibtex string.unquoted.key.bibtex
Expand All @@ -102,8 +103,8 @@ contexts:
push:
- clear_scopes: 1
- meta_content_scope: meta.mapping.value.bibtex
- match: "(?=[,)])"
pop: true
- match: (?=[,)])
pop: 1
- include: string_content
- include: integer
- include: variables
Expand All @@ -114,7 +115,7 @@ contexts:
push:
- meta_scope: comment.block.bibtex
- match: (?=@)
pop: true
pop: 1
integer:
- match: \d+
scope: meta.number.integer.decimal.bibtex constant.numeric.value.bibtex
Expand All @@ -130,7 +131,7 @@ contexts:
push:
- match: '\}'
scope: punctuation.definition.group.end.bibtex
pop: true
pop: 1
- include: nested_braces
string_content:
- match: '"'
Expand All @@ -139,15 +140,15 @@ contexts:
- meta_scope: string.quoted.double.bibtex
- match: '"'
scope: punctuation.definition.string.end.bibtex
pop: true
pop: 1
- include: nested_braces
- match: '\{'
scope: punctuation.definition.string.begin.bibtex
push:
- meta_scope: string.quoted.other.braces.bibtex
- match: '\}'
scope: punctuation.definition.string.end.bibtex
pop: true
pop: 1
- match: "@"
scope: invalid.illegal.at-sign.bibtex
- include: nested_braces
97 changes: 97 additions & 0 deletions LaTeX/DocStrip.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
%YAML 1.2
---
# https://www.sublimetext.com/docs/syntax.html
# https://www.texlive.info/CTAN/macros/latex/base/docstrip.pdf
name: TeX (DocStrip)
scope: source.tex.docstrip
version: 2

extends: Packages/LaTeX/TeX.sublime-syntax

file_extensions:
- ins

contexts:
main:
- meta_prepend: true
- include: docstrip-preamble
- include: docstrip-config
- include: docstrip-user-io
- include: docstrip-keywords
- include: docstrip-constants

controls:
- meta_append: true
- match: (\\)endbatchfile{{endcs}}
scope: keyword.control.tex.docstrip
captures:
1: punctuation.definition.backslash.tex
- match: (\\)(?:batch)?input{{endcs}}
scope: meta.function.input.tex keyword.control.input.tex
captures:
1: punctuation.definition.backslash.tex
- match: (\\)ifToplevel{{endcs}}
scope: keyword.control.conditional.tex.docstrip
captures:
1: punctuation.definition.backslash.tex

docstrip-preamble:
- match: (\\)(?:declare)?(?:pre|post)amble{{endcs}}
scope: keyword.context.block.tex.docstrip
captures:
1: punctuation.definition.backslash.tex
push: docstrip-preamble-content

docstrip-preamble-content:
- meta_include_prototype: false
- meta_content_scope: markup.raw.verbatim.tex
- match: (\\)end(?:pre|post)amble{{endcs}}
scope: keyword.context.block.tex.docstrip
captures:
1: punctuation.definition.backslash.tex
pop: 1

docstrip-keywords:
- match: (\\)(?:file|from|generateFile){{endcs}}
scope: keyword.tex.docstrip
captures:
1: punctuation.definition.backslash.tex
push: docstrip-file-argument
- match: (\\)(?:generate|needed){{endcs}}
scope: keyword.tex.docstrip
captures:
1: punctuation.definition.backslash.tex

docstrip-file-argument:
- match: \{
scope: punctuation.definition.group.brace.begin.tex
set: docstrip-file-argument-path
- include: else-pop
- include: paragraph-pop

docstrip-file-argument-path:
- meta_content_scope: meta.path.tex.docstrip
- include: macro-braces-body

docstrip-config:
- match: (\\)(?:usedir|showdirectory|BaseDirectory|DeclareDir|UseTDS|maxfiles|maxoutfiles){{endcs}}
scope: support.function.tex.docstrip
captures:
1: punctuation.definition.backslash.tex

docstrip-user-io:
- match: (\\)(?:Msg|Ask){{endcs}}
scope: support.function.tex.docstrip
captures:
1: punctuation.definition.backslash.tex

docstrip-constants:
- match: (\\)(?:askforoverwrite(?:true|false)|askonceonly|(?:use|no)(?:pre|post)amble|showprogress|keepsilent){{endcs}}
scope: constant.language.tex.docstrip
captures:
1: punctuation.definition.backslash.tex

- match: (\\)(?:(?:Double)?perCent|MetaPrefix|empty){{endcs}}
scope: constant.language.tex.docstrip
captures:
1: punctuation.definition.backslash.tex
Loading