Skip to content

Commit

Permalink
Merge pull request #94 from muzimuzhi/latex3-quarks
Browse files Browse the repository at this point in the history
Highlight LaTeX 3 quarks & scan marks (\q_xxx & \s_xxx)
  • Loading branch information
jlelong committed Jul 25, 2024
2 parents 1deac8f + bceab95 commit 4795be4
Show file tree
Hide file tree
Showing 5 changed files with 276 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/LaTeX.tmLanguage.base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ patterns:
- captures:
'1':
name: punctuation.definition.variable.latex
match: (\\)[cgl](?:[_\p{Alphabetic}@]+)+_[a-z]+
match: (\\)(?:[cgl]_+[_\p{Alphabetic}@]+_[a-z]+|[qs]_[_\p{Alphabetic}@]+[\p{Alphabetic}@])
name: variable.other.latex3.latex
- captures:
'1':
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/DocTeX.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -3104,7 +3104,7 @@
"name": "punctuation.definition.variable.latex"
}
},
"match": "(\\\\)[cgl](?:[_\\p{Alphabetic}@]+)+_[a-z]+",
"match": "(\\\\)(?:[cgl]_+[_\\p{Alphabetic}@]+_[a-z]+|[qs]_[_\\p{Alphabetic}@]+[\\p{Alphabetic}@])",
"name": "variable.other.latex3.latex"
},
{
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/LaTeX.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -3043,7 +3043,7 @@
"name": "punctuation.definition.variable.latex"
}
},
"match": "(\\\\)[cgl](?:[_\\p{Alphabetic}@]+)+_[a-z]+",
"match": "(\\\\)(?:[cgl]_+[_\\p{Alphabetic}@]+_[a-z]+|[qs]_[_\\p{Alphabetic}@]+[\\p{Alphabetic}@])",
"name": "variable.other.latex3.latex"
},
{
Expand Down
33 changes: 33 additions & 0 deletions test/colorize-fixtures/basic-commands.tex
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,37 @@ \section{title \LaTeX{} some text \LaTeX{}}

Some texte with `a single' quote.

\ExplSyntaxOn
\c__
\s__

\c_tmpa_tl
\g_tmpa_tl
\l_tmpa_tl
\l__mymod_tmp_cctab
\l_@@_prop
\l_@@_tmp_bitsec
\q_mark
\q_no_value
\s_stop
\s__quark
\s__mymod_tmp_mark
\s_@@
\s_@@_mark

\c___tl
\c___mymod_tl
\s___mymod_mark

\tl_set:Nn
\tl_if_empty:NTF
\tl_if_empty_p:N
\cs_new:Npn
\__kernel_chk_if_free_cs:N
\tex_relax:D
\mymod_all_arg_types:cVvoxef
\__mymod_fun:
\@@_fun:
\ExplSyntaxOff

\end{document}
240 changes: 240 additions & 0 deletions test/colorize-results/basic-commands_tex.json
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,246 @@
"c": "Some texte with `a single' quote.",
"t": "text.tex.latex"
},
{
"c": "\\",
"t": "text.tex.latex support.function.general.tex punctuation.definition.function.tex"
},
{
"c": "ExplSyntaxOn",
"t": "text.tex.latex support.function.general.tex"
},
{
"c": "\\",
"t": "text.tex.latex support.function.general.tex punctuation.definition.function.tex"
},
{
"c": "c",
"t": "text.tex.latex support.function.general.tex"
},
{
"c": "__",
"t": "text.tex.latex"
},
{
"c": "\\",
"t": "text.tex.latex support.function.general.tex punctuation.definition.function.tex"
},
{
"c": "s",
"t": "text.tex.latex support.function.general.tex"
},
{
"c": "__",
"t": "text.tex.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "c_tmpa_tl",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "g_tmpa_tl",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "l_tmpa_tl",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "l__mymod_tmp_cctab",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "l_@@_prop",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "l_@@_tmp_bitsec",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "q_mark",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "q_no_value",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "s_stop",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "s__quark",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "s__mymod_tmp_mark",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "s_@@",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "s_@@_mark",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "c___tl",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "c___mymod_tl",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex variable.other.latex3.latex punctuation.definition.variable.latex"
},
{
"c": "s___mymod_mark",
"t": "text.tex.latex variable.other.latex3.latex"
},
{
"c": "\\",
"t": "text.tex.latex support.class.general.latex3.tex punctuation.definition.function.tex"
},
{
"c": "tl_set:Nn",
"t": "text.tex.latex support.class.general.latex3.tex"
},
{
"c": "\\",
"t": "text.tex.latex support.class.general.latex3.tex punctuation.definition.function.tex"
},
{
"c": "tl_if_empty:NTF",
"t": "text.tex.latex support.class.general.latex3.tex"
},
{
"c": "\\",
"t": "text.tex.latex support.class.general.latex3.tex punctuation.definition.function.tex"
},
{
"c": "tl_if_empty_p:N",
"t": "text.tex.latex support.class.general.latex3.tex"
},
{
"c": "\\",
"t": "text.tex.latex support.class.general.latex3.tex punctuation.definition.function.tex"
},
{
"c": "cs_new:Npn",
"t": "text.tex.latex support.class.general.latex3.tex"
},
{
"c": "\\",
"t": "text.tex.latex support.class.general.latex3.tex punctuation.definition.function.tex"
},
{
"c": "__kernel_chk_if_free_cs:N",
"t": "text.tex.latex support.class.general.latex3.tex"
},
{
"c": "\\",
"t": "text.tex.latex support.class.general.latex3.tex punctuation.definition.function.tex"
},
{
"c": "tex_relax:D",
"t": "text.tex.latex support.class.general.latex3.tex"
},
{
"c": "\\",
"t": "text.tex.latex support.class.general.latex3.tex punctuation.definition.function.tex"
},
{
"c": "mymod_all_arg_types:cVvoxef",
"t": "text.tex.latex support.class.general.latex3.tex"
},
{
"c": "\\",
"t": "text.tex.latex support.class.general.latex3.tex punctuation.definition.function.tex"
},
{
"c": "__mymod_fun:",
"t": "text.tex.latex support.class.general.latex3.tex"
},
{
"c": "\\",
"t": "text.tex.latex support.class.general.latex3.tex punctuation.definition.function.tex"
},
{
"c": "@@_fun:",
"t": "text.tex.latex support.class.general.latex3.tex"
},
{
"c": "\\",
"t": "text.tex.latex support.function.general.tex punctuation.definition.function.tex"
},
{
"c": "ExplSyntaxOff",
"t": "text.tex.latex support.function.general.tex"
},
{
"c": "\\",
"t": "text.tex.latex meta.function.end-document.latex support.function.be.latex punctuation.definition.function.latex"
Expand Down

0 comments on commit 4795be4

Please sign in to comment.