-
Notifications
You must be signed in to change notification settings - Fork 586
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] Support highlighting \ExplSyntaxOn and \ExplSyntaxOff code blocks #2196
Comments
Here is an attempt at making an expl3 sub-language. This does not allow for switching between syntaxes with %YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Expl3
scope: text.tex.latex.expl3
file_extensions:
- sty
- cls
- tex
extends: Packages/LaTeX/LaTeX.sublime-syntax
variables:
scoped_var_name: '(__)?(_)?(?:([A-Za-z]+)(_))?([A-Za-z_]+)(_)(bool|box|cctab|clist|coffin|dim|fp|ior|iow|int|muskip|prop|seq|skip|str|tl)'
contexts:
general-commands:
- meta_prepend: true
- include: expl3-fun
- include: expl3-var
general-constants:
- meta_prepend: true
# we need to ensure that \__ will be matched as the start of a command name,
# not as an escaped underscore !
- match: '(?=(\\)__)'
push:
# try to match a function, and immediately leave the context
- include: expl3-fun
- match: ''
pop: true
expl3-fun:
- match: '(\\)(__)?([A-Za-z]+)(_)([A-Za-z_]+)(:)([nNpTFDwcVvxefo]+)'
scope: variable.function.expl3
captures:
1: punctuation.definition.backslash.expl3
2: storage.modifier.private.expl3
3: entity.name.namespace.expl3
4: punctuation.accessor.underscore.expl3
6: punctuation.separator.annotation.expl3
7: meta.annotation.parameters.expl3
expl3-var:
- match: '(\\)([lg]){{scoped_var_name}}'
scope: variable.other.readwrite.expl3 support.function.expl3
captures:
1: punctuation.definition.backslash.expl3
2: storage.modifier.expl3
3: storage.modifier.expl3
4: punctuation.separator.expl3
5: entity.name.namespace.expl3
6: punctuation.separator.expl3
8: punctuation.separator.annotation.expl3
9: variable.annotation.expl3
- match: '(\\)(c){{scoped_var_name}}'
scope: variable.other.constant.expl3 support.function.expl3
captures:
1: punctuation.definition.backslash.expl3
2: storage.modifier.expl3
3: storage.modifier.expl3
4: punctuation.separator.expl3
5: entity.name.namespace.expl3
6: punctuation.separator.expl3
8: punctuation.separator.annotation.expl3
9: variable.annotation.expl3 |
Nice Are there any chances of adding this to the latex syntax highlighting? That would be really great for viewing the lots of LaTeX3 code that exists nowadays. Given that @ngc92’s syntax definition is rather precise and the fact that |
10 build 15063 x64
1920x1080
1.0
3207
Example code:
References:
The text was updated successfully, but these errors were encountered: