runtime(tex): improve syntax highlighting
this change includes the following changes:
- a macro option must be #1–#9
- add \providecommand
- add starred versions of \newcommand, \newenvironment, and their
variants
- add number of arguments to \(re)newenvironment
Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/testdir/dumps/tex_02_00.dump b/runtime/syntax/testdir/dumps/tex_02_00.dump
new file mode 100644
index 0000000..5c79b8f
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/tex_02_00.dump
@@ -0,0 +1,20 @@
+>\+0#af5f00255#ffffff0|d|o|c|u|m|e|n|t|c|l|a|s@1|{+0#e000e06&|a|r|t|i|c|l|e|}| +0#0000000&@51
+|\+0#af5f00255&|n|e|w|c|o|m@1|a|n|d|{+0#e000e06&|\+0#af5f00255&|f|o@1|}+0#e000e06&|{|}| +0#0000000&@55
+|\+0#af5f00255&|r|e|n|e|w|c|o|m@1|a|n|d|*|{+0#e000e06&|\+0#af5f00255&|f|o@1|}+0#e000e06&|[|1+0#e000002&|]+0#e000e06&|{|#|1|0+0#0000000&|}+0#e000e06&| +0#0000000&@46
+|\+0#af5f00255&|p|r|o|v|i|d|e|c|o|m@1|a|n|d|{+0#e000e06&|\+0#af5f00255&|f|o@1|}+0#e000e06&|[|1+0#e000002&|]+0#e000e06&|[|d+0#0000000&|e|f|a|u|l|t|]+0#e000e06&|{|#|1|1+0#0000000&|}+0#e000e06&| +0#0000000&@36
+|\+0#af5f00255&|n|e|w|e|n|v|i|r|o|n|m|e|n|t|*|{+0#e000e06&|b+0#0000000&|a|z|}+0#e000e06&|{|S+0#0000000&|T|A|R|T|}+0#e000e06&|{|S+0#0000000&|T|O|P|}+0#e000e06&| +0#0000000&@40
+|\+0#af5f00255&|r|e|n|e|w|e|n|v|i|r|o|n|m|e|n|t|{+0#e000e06&|b+0#0000000&|a|z|}+0#e000e06&|[|1+0#e000002&|]+0#e000e06&|{|H+0#0000000&|E|A|D| |o|f| |#+0#e000e06&|1|2+0#0000000&|:|}+0#e000e06&|{|T+0#0000000&|A|I|L|}+0#e000e06&| +0#0000000&@29
+|\+0#af5f00255&|r|e|n|e|w|e|n|v|i|r|o|n|m|e|n|t|*|{+0#e000e06&|b+0#0000000&|a|z|}+0#e000e06&|[|1+0#e000002&|]+0#e000e06&|[|d+0#0000000&|e|f|a|u|l|t|]+0#e000e06&|{|B+0#0000000&|E|G|I|N@1|I|N|G| |o|f| |#+0#e000e06&|1|2+0#0000000&|:|}+0#e000e06&|{|E+0#0000000&|N|D|}+0#e000e06&| +0#0000000&@15
+|\+0#e000e06&|b|e|g|i|n|{|d|o|c|u|m|e|n|t|}| +0#0000000&@58
+|\+0#af5f00255&|f|o@1|{+0#e000e06&|T+0#0000000&|e|X|}+0#e000e06&| +0#0000000&@1|%+0#0000e05&| |-|>| |T|e|X|0| +0#0000000&@54
+|\+0#af5f00255&|b|e|g|i|n|{+0#e000e06&|b|a|z|}| +0#0000000&|t|e|x| |\+0#af5f00255&|e|n|d|{+0#e000e06&|b|a|z|}| +0#0000000&@1|%+0#0000e05&| |-|>| |B|E|G|I|N@1|I|N|G| |o|f| |d|e|f|a|u|l|t|2|:|t|e|x| |E|N|D| +0#0000000&@13
+|\+0#e000e06&|e|n|d|{|d|o|c|u|m|e|n|t|}| +0#0000000&@60
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1|
diff --git a/runtime/syntax/testdir/input/tex_02.tex b/runtime/syntax/testdir/input/tex_02.tex
new file mode 100644
index 0000000..0d6e92a
--- /dev/null
+++ b/runtime/syntax/testdir/input/tex_02.tex
@@ -0,0 +1,11 @@
+\documentclass{article}
+\newcommand{\foo}{}
+\renewcommand*{\foo}[1]{#10}
+\providecommand{\foo}[1][default]{#11}
+\newenvironment*{baz}{START}{STOP}
+\renewenvironment{baz}[1]{HEAD of #12:}{TAIL}
+\renewenvironment*{baz}[1][default]{BEGINNING of #12:}{END}
+\begin{document}
+\foo{TeX} % -> TeX0
+\begin{baz} tex \end{baz} % -> BEGINNING of default2:tex END
+\end{document}