diff options
author | Karl Berry <karl@freefriends.org> | 2024-04-29 20:32:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-04-29 20:32:02 +0000 |
commit | c7cc17c4b70a12974669d90a37188ec0eff62ae3 (patch) | |
tree | d322d36ffcf83f8c90cc7e452ce53b2f519c5e42 /Master/texmf-dist/tex/lualatex/piton/piton.lua | |
parent | 047e6229117493c0edfbdfc514e20e162e2b1752 (diff) |
piton (29apr24)
git-svn-id: svn://tug.org/texlive/trunk@71132 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/piton/piton.lua')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/piton/piton.lua | 75 |
1 files changed, 35 insertions, 40 deletions
diff --git a/Master/texmf-dist/tex/lualatex/piton/piton.lua b/Master/texmf-dist/tex/lualatex/piton/piton.lua index 0aa6bf2ae6f..358019aa4f4 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 = "2.8" -- 2024/04/14 +piton_version = "3.0" -- 2024/04/29 if piton.comment_latex == nil then piton.comment_latex = ">" end @@ -801,7 +801,7 @@ local Type = K ( 'Name.Type' , P "bool" + "char" + "char16_t" + "char32_t" + "double" + "float" + "int" + "int8_t" + "int16_t" + "int32_t" + "int64_t" + "long" + "short" + "signed" - + "unsigned" + "void" + "wchar_t" ) + + "unsigned" + "void" + "wchar_t" ) * Q "*" ^ 0 local DefFunction = Type @@ -1401,16 +1401,16 @@ function piton.new_language ( lang , definition ) or x[1] == "moretexcs" then local keywords = P ( false ) - local style = [[ \PitonStyle{Keyword} ]] - if x[1] == "moredirectives" then style = [[ \PitonStyle{directive} ]] end + local style = [[\PitonStyle{Keyword}]] + if x[1] == "moredirectives" then style = [[ \PitonStyle{Directive} ]] end style = tex_option_arg : match ( x[2] ) or style - local n = tonumber (style ) + local n = tonumber ( style ) if n then - if n > 1 then style = [[ \PitonStyle{Keyword ]] .. style .. "}" end + if n > 1 then style = [[\PitonStyle{Keyword]] .. style .. "}" end end for _ , word in ipairs ( split_clist : match ( x[2] ) ) do if x[1] == "moretexcs" then - keywords = Q ( [[ \ ]] .. word ) + keywords + keywords = Q ( [[\]] .. word ) + keywords else if sensitive then keywords = Q ( word ) + keywords @@ -1432,35 +1432,30 @@ function piton.new_language ( lang , definition ) for _ , x in ipairs ( def_table ) do if x[1] == "morestring" then arg1 , arg2 , arg3 , arg4 = args_for_morekeywords : match ( x[2] ) - arg2 = arg2 or [[ \PitonStyle{String.Long} ]] - if arg1 == "s" then - long_string = - Q ( arg3 ) - * ( Q ( ( 1 - P ( arg4 ) - S "$\r" ) ^ 1 ) -- $ - + EOL - ) ^ 0 - * Q ( arg4 ) - else - central_pattern = 1 - S ( " \r" .. arg3 ) - if arg1 : match "b" then - central_pattern = P ( [[ \ ]] .. arg3 ) + central_pattern - end - if arg1 : match "d" or arg1 == "m" then - central_pattern = P ( arg3 .. arg3 ) + central_pattern - end - if arg1 == "m" - then prefix = P ( false ) - else prefix = lpeg.B ( 1 - letter - ")" - "]" ) - end - long_string = long_string + - prefix - * Q ( arg3 ) - * ( VisualSpace + Q ( central_pattern ^ 1 ) + EOL ) ^ 0 - * Q ( arg3 ) + arg2 = arg2 or [[\PitonStyle{String.Long}]] + if arg1 ~= "s" then + arg4 = arg3 end + central_pattern = 1 - S ( " \r" .. arg4 ) + if arg1 : match "b" then + central_pattern = P ( [[\]] .. arg3 ) + central_pattern + end + if arg1 : match "d" or arg1 == "m" then + central_pattern = P ( arg3 .. arg3 ) + central_pattern + end + if arg1 == "m" + then prefix = lpeg.B ( 1 - letter - ")" - "]" ) + else prefix = P ( true ) + end + local pattern = + prefix + * Q ( arg3 ) + * ( VisualSpace + Q ( central_pattern ^ 1 ) + EOL ) ^ 0 + * Q ( arg4 ) + long_string = long_string + pattern LongString = LongString + Ct ( Cc "Open" * Cc ( "{" .. arg2 .. "{" ) * Cc "}}" ) - * long_string + * pattern * Ct ( Cc "Close" ) end end @@ -1476,8 +1471,8 @@ function piton.new_language ( lang , definition ) for _ , x in ipairs ( def_table ) do if x[1] == "morecomment" then local arg1 , arg2 , other_args = args_for_morecomment : match ( x[2] ) - arg2 = arg2 or [[ \PitonStyle{Comment} ]] - if arg1 : match "i" then arg2 = [[ \PitonStyle{Discard} ]] end + arg2 = arg2 or [[\PitonStyle{Comment}]] + if arg1 : match "i" then arg2 = [[\PitonStyle{Discard}]] end if arg1 : match "l" then local arg3 = ( tex_braced_arg + C ( P ( 1 ) ^ 0 * -1 ) ) : match ( other_args ) @@ -1574,8 +1569,8 @@ function piton.new_language ( lang , definition ) + Beamer + DetectedCommands + CommentDelim - + Delim + LongString + + Delim + Keyword * ( Space + Punct + Delim + EOL + -1 ) + Punct + K ( 'Identifier' , letter * alphanum ^ 0 ) @@ -1588,11 +1583,11 @@ function piton.new_language ( lang , definition ) Ct ( ( space ^ 0 * P "\r" ) ^ -1 * BeamerBeginEnvironments - * Lc [[ \__piton_begin_line: ]] + * Lc [[\__piton_begin_line:]] * SpaceIndentation ^ 0 * LPEG1[lang] * -1 - * Lc [[ \__piton_end_line: ]] + * Lc [[\__piton_end_line:]] ) if left_tag then local Tag = Q ( left_tag * other ^ 0 ) @@ -1637,11 +1632,11 @@ function piton.new_language ( lang , definition ) Ct ( ( space ^ 0 * P "\r" ) ^ -1 * BeamerBeginEnvironments - * Lc [[ \__piton_begin_line: ]] + * Lc [[\__piton_begin_line:]] * SpaceIndentation ^ 0 * LPEG1[lang] * -1 - * Lc [[ \__piton_end_line: ]] + * Lc [[\__piton_end_line:]] ) end end |