texlive[71244] Master/texmf-dist: piton (12may24)
commits+karl at tug.org
commits+karl at tug.org
Sun May 12 21:13:45 CEST 2024
Revision: 71244
https://tug.org/svn/texlive?view=revision&revision=71244
Author: karl
Date: 2024-05-12 21:13:44 +0200 (Sun, 12 May 2024)
Log Message:
-----------
piton (12may24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.pdf
trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex
trunk/Master/texmf-dist/doc/lualatex/piton/piton.pdf
trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx
trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua
trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty
Modified: trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex 2024-05-12 19:13:34 UTC (rev 71243)
+++ trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex 2024-05-12 19:13:44 UTC (rev 71244)
@@ -893,7 +893,7 @@
\endgroup
\bigskip
-Les clés de la commande |\lstdeflinelanguage| de \pkg{listings} prises en charge par |\NewPitonLanguage| sont :
+Les clés de la commande |\lstdefinelanguage| de \pkg{listings} prises en charge par |\NewPitonLanguage| sont :
|morekeywords|, |otherkeywords|, |sensitive|, |keywordsprefix|, |moretexcs|, |morestring| (avec les lettres |b|,
|d|, |s| et |m|), |morecomment| (avec les lettres |i|, |l|, |s| et |n|), |moredelim| (avec les lettres |i|,
|l|, |s|, |*| et |**|), |moredirectives|, |tag|, |alsodigit| et |alsoletter|.
@@ -2606,8 +2606,8 @@
\indexcommand{NewPitonLanguage}
\vspace{1cm}
-La commande |\NewPitonLanguage| qui permet de définir de nouveaux langages en utilisant la syntaxe de l'extension
-\pkg{listings} a été présentée p.~\pageref{NewPitonLanguage}.
+La commande |\NewPitonLanguage|, qui permet de définir de nouveaux langages en utilisant la syntaxe de l'extension
+\pkg{listings}, a été présentée p.~\pageref{NewPitonLanguage}.
Tous les langages définis avec la commande |\NewPitonLanguage| partagent les mêmes styles.
@@ -2619,13 +2619,15 @@
\normalfont Style & Usage \\
\midrule
Number & les nombres \\
-String.Long & les chaînes de caractères définies dans |\NewPitonLanguage| par la clé |morestring| \\
+String.Long & les chaînes de caractères définies dans |\NewPitonLanguage| par la clé |morestring| \\
Comment & les commentaires définis dans |\NewPitonLanguage| par la clé |morecomment| \\
Comment.LaTeX & les commentaires qui sont composés par \pkg{piton} comme du code LaTeX (et
appelés simplement «commentaires LaTeX» dans ce document) \\
-Keyword & les mots-clés, définis dans |\NewPitonLanguage| par les clés |morekeywords| et |moretexcs| (et également la
- clé |sensitive| qui indique si les mots-clés sont sensibles à la casse) \\
+Keyword & les mots-clés, définis dans |\NewPitonLanguage| par les clés |morekeywords| et |moretexcs| (et également
+ la clé |sensitive| qui indique si les mots-clés sont sensibles à la casse) \\
Directive & les directives définies dans |\NewPitonLanguage| par la clé |moredirectives| \\
+Tag & les «tags» définis par la clé |tag| (les lexèmes détectés à l'intérieur d'un tag seront
+ aussi composés avec leur propre style) \\
\bottomrule
\end{tabularx}
\end{center}
Modified: trunk/Master/texmf-dist/doc/lualatex/piton/piton.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx
===================================================================
--- trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx 2024-05-12 19:13:34 UTC (rev 71243)
+++ trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx 2024-05-12 19:13:44 UTC (rev 71244)
@@ -79,12 +79,12 @@
% \iffalse
%<*STY>
% \fi
-\def\PitonFileVersion{3.0}
-\def\PitonFileDate{2024/04/29}
+\def\PitonFileVersion{3.0a}
+\def\PitonFileDate{2024/05/12}
% \iffalse
%</STY>
%<*LUA>
-piton_version = "3.0" -- 2024/04/29
+piton_version = "3.0a" -- 2024/05/12
%</LUA>
%\fi
%
@@ -946,7 +946,7 @@
%
% \bigskip
-% The keys of the command |\lstdeflinelanguage| of \pkg{listings} supported by |\NewPitonLanguage| are:
+% The keys of the command |\lstdefinelanguage| of \pkg{listings} supported by |\NewPitonLanguage| are:
% |morekeywords|, |otherkeywords|, |sensitive|, |keywordsprefix|, |moretexcs|,
% |morestring| (with the letters |b|,
% |d|, |s| and |m|), |morecomment| (with the letters |i|, |l|, |s| and |n|),
@@ -2516,8 +2516,8 @@
% \subsection{The languages defined by \textbackslash NewPitonLanguage}
%
% \vspace{1cm}
-% The command |\NewPitonLanguage| which define new informatic languages with the
-% syntax of the extension \pkg{listings} has been described p.~\pageref{NewPitonLanguage}.
+% The command |\NewPitonLanguage|, which defines new informatic languages with the
+% syntax of the extension \pkg{listings}, has been described p.~\pageref{NewPitonLanguage}.
%
% All the languages defined by the command |\NewPitonLanguage| use the same styles.
% \vspace{1cm}
@@ -2534,7 +2534,10 @@
% Keyword & the keywords defined in |\NewPitonLanguage| by the keys |morekeywords|
% and |moretexcs| (and also the key |sensitive| which specifies whether
% the keywords are case-sensitive or not) \\
-% Directive & the directives defined in |\NewPitonLanguage| by the key |moredirectives| \\
+% Directive & the directives defined in |\NewPitonLanguage| by the key
+% |moredirectives| \\
+% Tag & the ``tags'' defines by the key |tag| (the lexical units detected within
+% the tag will also be formatted with their own style) \\
% \bottomrule
% \end{tabularx}
% \end{center}
@@ -4807,7 +4810,8 @@
String.Doc ,
String.Interpol ,
String.Long ,
- String.Short ,
+ String.Short ,
+ Tag ,
TypeParameter ,
UserFunction ,
% \end{macrocode}
@@ -4903,6 +4907,7 @@
Preproc = \color[HTML]{AA6600} \slshape ,
Identifier = \@@_identifier:n ,
Directive = \color[HTML]{AA6600} ,
+ Tag = \colorbox{gray!10},
UserFunction = ,
Prompt = ,
ParseAgain.noCR = \@@_piton_no_cr:n ,
@@ -5326,7 +5331,12 @@
local my_lpeg =
P { "E" ,
E = ( V "F" * ( "," * V "F" ) ^ 0 ) / add ,
- F = space ^ 0 * ( alpha ^ 1 ) / "\\%0" * space ^ 0
+% \end{macrocode}
+% Be careful: in Lua, \verb|/| has no priority over \verb|*|. Of course, we want
+% a behaviour for this comma-seperated list equal to the behaviour of a |clist|
+% of L3.
+% \begin{macrocode}
+ F = space ^ 0 * ( ( alpha ^ 1 ) / "\\%0" ) * space ^ 0
}
function piton.addListCommands( key_value )
piton.ListCommands = piton.ListCommands + my_lpeg : match ( key_value )
@@ -6095,6 +6105,8 @@
) ^ 0
* Q "'" )
+
+
local DoubleShortString =
WithStyle ( 'String.Short' ,
Q ( P "f\"" + "F\"" )
@@ -6125,7 +6137,15 @@
% \paragraph{Beamer}
%
% \begin{macrocode}
-local braces = Compute_braces ( ShortString )
+local braces =
+ Compute_braces
+ (
+ Q ( P "\"" + "r\"" + "R\"" + "f\"" + "F\"" )
+ * ( "\"" * ( P "\\\"" + 1 - S "\"" ) ^ 0 * "\"" )
+ +
+ Q ( P '\'' + 'r\'' + 'R\'' + 'f\'' + 'F\'' )
+ * ( '\'' * ( P '\\\'' + 1 - S '\'' ) ^ 0 * '\'' )
+ )
if piton.beamer then Beamer = Compute_Beamer ( 'python' , braces ) end
% \end{macrocode}
%
@@ -7743,6 +7763,15 @@
% \end{macrocode}
%
% \begin{macrocode}
+ local args_for_tag
+ = tex_option_arg
+ * space ^ 0
+ * tex_arg
+ * space ^ 0
+ * tex_arg
+% \end{macrocode}
+%
+% \begin{macrocode}
local args_for_morekeywords
= "[" * C ( ( 1 - P "]" ) ^ 0 ) * "]"
* space ^ 0
@@ -7768,18 +7797,7 @@
* C ( P ( 1 ) ^ 0 * -1 )
% \end{macrocode}
%
-% \begin{macrocode}
- local args_for_tag
- = ( P "*" ^ -2 )
- * space ^ 0
- * ( "[" * ( 1 - P "]" ) ^ 0 * "]" ) ^ 0
- * space ^ 0
- * tex_arg
- * space ^ 0
- * tex_arg
-% \end{macrocode}
%
-%
% \bigskip
% We scan the definition of the language (i.e. the table |def_table|) in order
% to detect the potential key |sensitive|. Indeed, we have to catch that key
@@ -7787,7 +7805,7 @@
% the potential keys |alsodigit|, |alsoletter| and |tag|.
% \begin{macrocode}
local sensitive = true
- local left_tag , right_tag
+ local style_tag , left_tag , right_tag
for _ , x in ipairs ( def_table ) do
if x[1] == "sensitive" then
if x[2] == nil or ( P "true" ) : match ( x[2] ) then
@@ -7799,7 +7817,8 @@
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] == "tag" then
- left_tag , right_tag = args_for_tag : match ( x[2] )
+ style_tag , left_tag , right_tag = args_for_tag : match ( x[2] )
+ style_tag = style_tag or [[\PitonStyle{Tag}]]
end
end
% \end{macrocode}
@@ -8063,12 +8082,8 @@
local Punct = Q ( S "=,:;!\\'\"" )
% \end{macrocode}
%
-%
+%
% \begin{macrocode}
-% \end{macrocode}
-%
-%
-% \begin{macrocode}
local Main =
space ^ 1 * -1
% \end{macrocode}
@@ -8101,15 +8116,7 @@
LPEG1[lang] = Main ^ 0
% \end{macrocode}
%
-%
-% \bigskip
-% If the key |tag| has been used, then |left_tag| (and also |right_tag|) is non nil.
-% \begin{macrocode}
- if left_tag then
- end
-% \end{macrocode}
%
-%
% The \textsc{lpeg} |LPEG2[lang]| is used to format general chunks of code.
% \begin{macrocode}
LPEG2[lang] =
@@ -8124,13 +8131,15 @@
)
% \end{macrocode}
%
-%
+% If the key |tag| has been used.
% \begin{macrocode}
if left_tag then
- local Tag = Q ( left_tag * other ^ 0 )
+ local Tag = Ct ( Cc "Open" * Cc ( "{" .. style_tag .. "{" ) * Cc "}}" )
+ * Q ( left_tag * other ^ 0 )
* ( ( ( 1 - P ( right_tag ) ) ^ 0 )
/ ( function ( x ) return LPEG0[lang] : match ( x ) end ) )
* Q ( right_tag )
+ * Ct ( Cc "Close" )
MainWithoutTag
= space ^ 1 * -1
+ space ^ 0 * EOL
Modified: trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua 2024-05-12 19:13:34 UTC (rev 71243)
+++ trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua 2024-05-12 19:13:44 UTC (rev 71244)
@@ -20,7 +20,7 @@
-- -------------------------------------------
--
-- This file is part of the LuaLaTeX package 'piton'.
-piton_version = "3.0" -- 2024/04/29
+piton_version = "3.0a" -- 2024/05/12
if piton.comment_latex == nil then piton.comment_latex = ">" end
@@ -380,7 +380,15 @@
* Q "\"" )
local ShortString = SingleShortString + DoubleShortString
-local braces = Compute_braces ( ShortString )
+local braces =
+ Compute_braces
+ (
+ Q ( P "\"" + "r\"" + "R\"" + "f\"" + "F\"" )
+ * ( "\"" * ( P "\\\"" + 1 - S "\"" ) ^ 0 * "\"" )
+ +
+ Q ( P '\'' + 'r\'' + 'R\'' + 'f\'' + 'F\'' )
+ * ( '\'' * ( P '\\\'' + 1 - S '\'' ) ^ 0 * '\'' )
+ )
if piton.beamer then Beamer = Compute_Beamer ( 'python' , braces ) end
DetectedCommands = Compute_DetectedCommands ( 'python' , braces )
LPEG_cleaner['python'] = Compute_LPEG_cleaner ( 'python' , braces )
@@ -1325,6 +1333,12 @@
local tex_braced_arg = "{" * C ( ( 1 - P "}" ) ^ 0 ) * "}"
local tex_arg = tex_braced_arg + C ( 1 )
local tex_option_arg = "[" * C ( ( 1 - P "]" ) ^ 0 ) * "]" + Cc ( nil )
+ local args_for_tag
+ = tex_option_arg
+ * space ^ 0
+ * tex_arg
+ * space ^ 0
+ * tex_arg
local args_for_morekeywords
= "[" * C ( ( 1 - P "]" ) ^ 0 ) * "]"
* space ^ 0
@@ -1342,16 +1356,8 @@
* tex_option_arg
* space ^ 0
* C ( P ( 1 ) ^ 0 * -1 )
- local args_for_tag
- = ( P "*" ^ -2 )
- * space ^ 0
- * ( "[" * ( 1 - P "]" ) ^ 0 * "]" ) ^ 0
- * space ^ 0
- * tex_arg
- * space ^ 0
- * tex_arg
local sensitive = true
- local left_tag , right_tag
+ local style_tag , left_tag , right_tag
for _ , x in ipairs ( def_table ) do
if x[1] == "sensitive" then
if x[2] == nil or ( P "true" ) : match ( x[2] ) then
@@ -1363,7 +1369,8 @@
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] == "tag" then
- left_tag , right_tag = args_for_tag : match ( x[2] )
+ style_tag , left_tag , right_tag = args_for_tag : match ( x[2] )
+ style_tag = style_tag or [[\PitonStyle{Tag}]]
end
end
local Number =
@@ -1577,8 +1584,6 @@
+ Number
+ Word
LPEG1[lang] = Main ^ 0
- if left_tag then
- end
LPEG2[lang] =
Ct (
( space ^ 0 * P "\r" ) ^ -1
@@ -1590,10 +1595,12 @@
* Lc [[\__piton_end_line:]]
)
if left_tag then
- local Tag = Q ( left_tag * other ^ 0 )
+ local Tag = Ct ( Cc "Open" * Cc ( "{" .. style_tag .. "{" ) * Cc "}}" )
+ * Q ( left_tag * other ^ 0 )
* ( ( ( 1 - P ( right_tag ) ) ^ 0 )
/ ( function ( x ) return LPEG0[lang] : match ( x ) end ) )
* Q ( right_tag )
+ * Ct ( Cc "Close" )
MainWithoutTag
= space ^ 1 * -1
+ space ^ 0 * EOL
Modified: trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty 2024-05-12 19:13:34 UTC (rev 71243)
+++ trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty 2024-05-12 19:13:44 UTC (rev 71244)
@@ -19,8 +19,8 @@
%% LaTeX version 2005/12/01 or later.
%% -------------------------------------------
%%
-\def\PitonFileVersion{3.0}
-\def\PitonFileDate{2024/04/29}
+\def\PitonFileVersion{3.0a}
+\def\PitonFileDate{2024/05/12}
\NeedsTeXFormat{LaTeX2e}
@@ -1200,6 +1200,7 @@
String.Interpol ,
String.Long ,
String.Short ,
+ Tag ,
TypeParameter ,
UserFunction ,
Directive
@@ -1269,6 +1270,7 @@
Preproc = \color[HTML]{AA6600} \slshape ,
Identifier = \__piton_identifier:n ,
Directive = \color[HTML]{AA6600} ,
+ Tag = \colorbox{gray!10},
UserFunction = ,
Prompt = ,
ParseAgain.noCR = \__piton_piton_no_cr:n ,
@@ -1525,7 +1527,7 @@
local my_lpeg =
P { "E" ,
E = ( V "F" * ( "," * V "F" ) ^ 0 ) / add ,
- F = space ^ 0 * ( alpha ^ 1 ) / "\\%0" * space ^ 0
+ F = space ^ 0 * ( ( alpha ^ 1 ) / "\\%0" ) * space ^ 0
}
function piton.addListCommands( key_value )
piton.ListCommands = piton.ListCommands + my_lpeg : match ( key_value )
More information about the tex-live-commits
mailing list.