summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/piton
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/piton')
-rw-r--r--Master/texmf-dist/tex/lualatex/piton/piton.lua37
-rw-r--r--Master/texmf-dist/tex/lualatex/piton/piton.sty8
2 files changed, 27 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/lualatex/piton/piton.lua b/Master/texmf-dist/tex/lualatex/piton/piton.lua
index 358019aa4f4..f909eef28a3 100644
--- a/Master/texmf-dist/tex/lualatex/piton/piton.lua
+++ b/Master/texmf-dist/tex/lualatex/piton/piton.lua
@@ -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 @@ local DoubleShortString =
* 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 @@ function piton.new_language ( lang , definition )
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 @@ function piton.new_language ( lang , definition )
* 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 @@ function piton.new_language ( lang , definition )
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 @@ function piton.new_language ( lang , definition )
+ Number
+ Word
LPEG1[lang] = Main ^ 0
- if left_tag then
- end
LPEG2[lang] =
Ct (
( space ^ 0 * P "\r" ) ^ -1
@@ -1590,10 +1595,12 @@ function piton.new_language ( lang , definition )
* 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
diff --git a/Master/texmf-dist/tex/lualatex/piton/piton.sty b/Master/texmf-dist/tex/lualatex/piton/piton.sty
index a08dfe9a85d..6f3929fc766 100644
--- a/Master/texmf-dist/tex/lualatex/piton/piton.sty
+++ b/Master/texmf-dist/tex/lualatex/piton/piton.sty
@@ -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 )