summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-05-24 20:58:02 +0000
committerKarl Berry <karl@freefriends.org>2024-05-24 20:58:02 +0000
commit6f721b4f10063cb5f88e67439e327539f1c6eddd (patch)
tree18606ee648511775b283a00c6c32dcb7908aeb7a /Master/texmf-dist/tex/lualatex
parente09537ea977fce1df0aabc2da9126d5c2b1ec624 (diff)
piton (23may24)
git-svn-id: svn://tug.org/texlive/trunk@71343 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
-rw-r--r--Master/texmf-dist/tex/lualatex/piton/piton.lua73
-rw-r--r--Master/texmf-dist/tex/lualatex/piton/piton.sty34
2 files changed, 80 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/lualatex/piton/piton.lua b/Master/texmf-dist/tex/lualatex/piton/piton.lua
index f909eef28a3..6ec0442b73c 100644
--- a/Master/texmf-dist/tex/lualatex/piton/piton.lua
+++ b/Master/texmf-dist/tex/lualatex/piton/piton.lua
@@ -20,7 +20,8 @@
-- -------------------------------------------
--
-- This file is part of the LuaLaTeX package 'piton'.
-piton_version = "3.0a" -- 2024/05/12
+piton_version = "3.0b" -- 2024/05/23
+
if piton.comment_latex == nil then piton.comment_latex = ">" end
@@ -101,10 +102,21 @@ local Number =
)
local Word
if piton.begin_escape then
- Word = Q ( ( 1 - space - piton.begin_escape - piton.end_escape
- - S "'\"\r[({})]" - digit ) ^ 1 )
+ if piton.begin_escape_math then
+ Word = Q ( ( 1 - space - piton.begin_escape - piton.end_escape
+ - piton.begin_escape_math - piton.end_escape_math
+ - S "'\"\r[({})]" - digit ) ^ 1 )
+ else
+ Word = Q ( ( 1 - space - piton.begin_escape - piton.end_escape
+ - S "'\"\r[({})]" - digit ) ^ 1 )
+ end
else
- Word = Q ( ( 1 - space - S "'\"\r[({})]" - digit ) ^ 1 )
+ if piton.begin_escape_math then
+ Word = Q ( ( 1 - space - piton.begin_escape_math - piton.end_escape_math
+ - S "'\"\r[({})]" - digit ) ^ 1 )
+ else
+ Word = Q ( ( 1 - space - S "'\"\r[({})]" - digit ) ^ 1 )
+ end
end
local Space = Q " " ^ 1
@@ -494,7 +506,7 @@ local DefFunction =
* ( EOL + CommentLaTeX + Comment ) -- in all cases, that contains an EOL
* Tab ^ 0
* SkipSpace
- * StringDoc ^ 0 -- there may be additionnal docstrings
+ * StringDoc ^ 0 -- there may be additional docstrings
) ^ -1
local ExceptionInConsole = Exception * Q ( ( 1 - P "\r" ) ^ 0 ) * EOL
local Main =
@@ -1310,14 +1322,21 @@ end
function piton.new_language ( lang , definition )
lang = string.lower ( lang )
local alpha , digit = lpeg.alpha , lpeg.digit
- local letter = alpha + S "@_$" -- $
- local other = S "+-*/<>!?:;.()@[]~^=#&\"\'\\$" -- $
+ local extra_letters = { "@" , "_" , "$" } -- $
function add_to_letter ( c )
- if c ~= " " then letter = letter + c end
+ if c ~= " " then table.insert ( extra_letters , c ) end
end
function add_to_digit ( c )
if c ~= " " then digit = digit + c end
end
+ local other = S ":_@+-*/<>!?;.()[]~^=#&\"\'\\$" -- $
+ local extra_others = { }
+ function add_to_other ( c )
+ if c ~= " " then
+ extra_others[c] = true
+ other = other + P "c"
+ end
+ end
local strict_braces =
P { "E" ,
E = ( "{" * V "F" * "}" + ( 1 - S ",{}" ) ) ^ 0 ,
@@ -1368,6 +1387,7 @@ function piton.new_language ( lang , definition )
end
if x[1] == "alsodigit" then x[2] : gsub ( "." , add_to_digit ) end
if x[1] == "alsoletter" then x[2] : gsub ( "." , add_to_letter ) end
+ if x[1] == "alsoother" then x[2] : gsub ( "." , add_to_other ) end
if x[1] == "tag" then
style_tag , left_tag , right_tag = args_for_tag : match ( x[2] )
style_tag = style_tag or [[\PitonStyle{Tag}]]
@@ -1381,6 +1401,16 @@ function piton.new_language ( lang , definition )
* ( S "eE" * S "+-" ^ -1 * digit ^ 1 ) ^ -1
+ digit ^ 1
)
+ local string_extra_letters = ""
+ for _ , x in ipairs ( extra_letters ) do
+ if not ( extra_others[x] ) then
+ string_extra_letters = string_extra_letters .. x
+ end
+ end
+ local letter = alpha + S ( string_extra_letters )
+ + P "â" + "à" + "ç" + "é" + "è" + "ê" + "ë" + "ï" + "î"
+ + "ô" + "û" + "ü" + "Â" + "À" + "Ç" + "É" + "È" + "Ê" + "Ë"
+ + "Ï" + "Î" + "Ô" + "Û" + "Ü"
local alphanum = letter + digit
local identifier = letter * alphanum ^ 0
local Identifier = K ( 'Identifier' , identifier )
@@ -1401,6 +1431,7 @@ function piton.new_language ( lang , definition )
)
end
local Keyword = P ( false )
+ local PrefixedKeyword = P ( false )
for _ , x in ipairs ( def_table )
do if x[1] == "morekeywords"
or x[1] == "otherkeywords"
@@ -1430,7 +1461,8 @@ function piton.new_language ( lang , definition )
end
if x[1] == "keywordsprefix" then
local prefix = ( ( C ( 1 - P " " ) ^ 1 ) * P " " ^ 0 ) : match ( x[2] )
- Keyword = Keyword + K ( 'Keyword' , P ( prefix ) * alphanum ^ 0 )
+ PrefixedKeyword = PrefixedKeyword
+ + K ( 'Keyword' , P ( prefix ) * ( letter ^ 1 + other ) )
end
end
local long_string = P ( false )
@@ -1578,7 +1610,8 @@ function piton.new_language ( lang , definition )
+ CommentDelim
+ LongString
+ Delim
- + Keyword * ( Space + Punct + Delim + EOL + -1 )
+ + PrefixedKeyword
+ + Keyword * ( -1 + # ( 1 - alphanum ) )
+ Punct
+ K ( 'Identifier' , letter * alphanum ^ 0 )
+ Number
@@ -1596,7 +1629,7 @@ function piton.new_language ( lang , definition )
)
if left_tag then
local Tag = Ct ( Cc "Open" * Cc ( "{" .. style_tag .. "{" ) * Cc "}}" )
- * Q ( left_tag * other ^ 0 )
+ * Q ( left_tag * other ^ 0 ) -- $
* ( ( ( 1 - P ( right_tag ) ) ^ 0 )
/ ( function ( x ) return LPEG0[lang] : match ( x ) end ) )
* Q ( right_tag )
@@ -1613,27 +1646,21 @@ function piton.new_language ( lang , definition )
+ CommentDelim
+ Delim
+ LongString
- + Keyword * ( Space + Punct + Delim + EOL + -1 )
+ + PrefixedKeyword
+ + Keyword * ( -1 + # ( 1 - alphanum ) )
+ Punct
+ K ( 'Identifier' , letter * alphanum ^ 0 )
+ Number
+ Word
LPEG0[lang] = MainWithoutTag ^ 0
+ local LPEGaux = Tab + Escape + EscapeMath + CommentLaTeX
+ + Beamer + DetectedCommands + CommentDelim + Tag
MainWithTag
= space ^ 1 * -1
+ space ^ 0 * EOL
+ Space
- + Tab
- + Escape + EscapeMath
- + CommentLaTeX
- + Beamer
- + DetectedCommands
- + CommentDelim
- + Tag
- + Delim
- + Punct
- + K ( 'Identifier' , letter * alphanum ^ 0 )
- + Word
+ + LPEGaux
+ + Q ( ( 1 - EOL - LPEGaux ) ^ 1 )
LPEG1[lang] = MainWithTag ^ 0
LPEG2[lang] =
Ct (
diff --git a/Master/texmf-dist/tex/lualatex/piton/piton.sty b/Master/texmf-dist/tex/lualatex/piton/piton.sty
index 6f3929fc766..72591ea8baa 100644
--- a/Master/texmf-dist/tex/lualatex/piton/piton.sty
+++ b/Master/texmf-dist/tex/lualatex/piton/piton.sty
@@ -19,8 +19,9 @@
%% LaTeX version 2005/12/01 or later.
%% -------------------------------------------
%%
-\def\PitonFileVersion{3.0a}
-\def\PitonFileDate{2024/05/12}
+\def\PitonFileVersion{3.0b}
+\def\PitonFileDate{2024/05/23}
+
\NeedsTeXFormat{LaTeX2e}
@@ -72,7 +73,7 @@
\__piton_msg_new:nnn { piton.lua~not~found }
{
The~file~'piton.lua'~can't~be~found.\\
- This~eror~is~fatal.\\
+ This~error~is~fatal.\\
If~you~want~to~know~how~to~retrieve~the~file~'piton.lua',~type~H~<return>.
}
{
@@ -730,6 +731,23 @@
{ \__piton_NewPitonLanguage:nnnnn { #1 } { #2 } { #3 } }
}
\prop_new:N \g__piton_languages_prop
+\keys_define:nn { NewPitonLanguage }
+ {
+ morekeywords .code:n = ,
+ otherkeywords .code:n = ,
+ sensitive .code:n = ,
+ keywordsprefix .code:n = ,
+ moretexcs .code:n = ,
+ morestring .code:n = ,
+ morecomment .code:n = ,
+ moredelim .code:n = ,
+ moredirectives .code:n = ,
+ tag .code:n = ,
+ alsodigit .code:n = ,
+ alsoletter .code:n = ,
+ alsoother .code:n = ,
+ unknown .code:n = \__piton_error:n { Unknown~key~NewPitonLanguage }
+ }
\cs_new_protected:Npn \__piton_NewPitonLanguage:nnn #1 #2 #3
{
\tl_set:Nx \l_tmpa_tl
@@ -737,6 +755,7 @@
\tl_if_blank:nF { #1 } { [ \str_lowercase:n { #1 } ] }
\str_lowercase:n { #2 }
}
+ \keys_set:nn { NewPitonLanguage } { #3 }
\prop_gput:Non \g__piton_languages_prop \l_tmpa_tl { #3 }
\exp_args:NV \__piton_NewPitonLanguage:nn \l_tmpa_tl { #3 }
}
@@ -1362,7 +1381,7 @@
\__piton_msg_new:nn { Language~not~defined }
{
Language~not~defined \\
- The~language~'\l_tmpa_tl'~has~not~been~defined~previoulsy.\\
+ The~language~'\l_tmpa_tl'~has~not~been~defined~previously.\\
If~you~go~on,~your~command~\token_to_str:N \NewPitonLanguage\
will~be~ignored.
}
@@ -1373,6 +1392,12 @@
version~as~the~file~'piton.sty'.~You~can~go~on~but~you~should~
address~that~issue.
}
+\__piton_msg_new:nn { Unknown~key~NewPitonLanguage }
+ {
+ Unknown~key~for~\token_to_str:N \NewPitonLanguage.\\
+ The~key~'\l_keys_key_str'~is~unknown.\\
+ This~key~will~be~ignored.\\
+ }
\__piton_msg_new:nn { Unknown~key~for~SetPitonStyle }
{
The~style~'\l_keys_key_str'~is~unknown.\\
@@ -1449,6 +1474,7 @@
The~available~keys~are~(in~alphabetic~order):~
auto-gobble,~
background-color,~
+ begin-range,~
break-lines,~
break-lines-in-piton,~
break-lines-in-Piton,~