summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2020-06-19 12:25:31 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2020-06-19 12:25:31 +0200
commit63bb70d210dc6e8a17959c4e056fe41da3f1c398 (patch)
treeeec8ab8eea553b8c5beea443624d725bb8d4f07e /tex
parentf46fe99c7c361a66c68987b22d235fe9f793fad6 (diff)
downloadcontext-63bb70d210dc6e8a17959c4e056fe41da3f1c398.tar.gz
2020-06-19 11:07:00
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/attr-ini.mkiv31
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkxl2
-rw-r--r--tex/context/base/mkiv/lang-def.mkiv7
-rw-r--r--tex/context/base/mkiv/lxml-ini.lua1
-rw-r--r--tex/context/base/mkiv/lxml-tex.lua24
-rw-r--r--tex/context/base/mkiv/mult-prm.lua5
-rw-r--r--tex/context/base/mkiv/mult-sys.mkiv1
-rw-r--r--tex/context/base/mkiv/node-nut.lua22
-rw-r--r--tex/context/base/mkiv/scrp-cjk.lua59
-rw-r--r--tex/context/base/mkiv/scrp-eth.lua12
-rw-r--r--tex/context/base/mkiv/scrp-ini.lua243
-rw-r--r--tex/context/base/mkiv/scrp-ini.mkiv44
-rw-r--r--tex/context/base/mkiv/scrp-tib.lua31
-rw-r--r--tex/context/base/mkiv/sort-lan.lua46
-rw-r--r--tex/context/base/mkiv/spac-ver.mkxl4
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin27767 -> 27770 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin253280 -> 253570 bytes
-rw-r--r--tex/context/base/mkiv/syst-lua.lua352
-rw-r--r--tex/context/base/mkiv/tabl-tbl.mkxl2
-rw-r--r--tex/context/base/mkiv/toks-ini.lua82
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
25 files changed, 568 insertions, 410 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 3f7db0e5d..4bf551395 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2020.06.17 18:56}
+\newcontextversion{2020.06.19 11:04}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index 595650caf..207c010fa 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.06.17 18:56}
+\edef\contextversion{2020.06.19 11:04}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/attr-ini.mkiv b/tex/context/base/mkiv/attr-ini.mkiv
index 6889f9e63..4002ac416 100644
--- a/tex/context/base/mkiv/attr-ini.mkiv
+++ b/tex/context/base/mkiv/attr-ini.mkiv
@@ -61,33 +61,6 @@
% here public means 'visible' so it's not to be confused with 'public' at the lua end
-% \def\attr_basics_define_indeed#1[#2][#3]%
-% {\ifcsname\??attributecount#2\endcsname\else
-% \scratchcounter\clf_defineattribute{#2}{#1}\relax
-% %\writestatus\m!system{defining #1 attribute #2 with number \number\scratchcounter}%
-% \expandafter\attributedef\csname\??attributecount#2\endcsname\scratchcounter
-% \expandafter\newconstant \csname\??attributeid#2\endcsname
-% \csname\??attributeid#2\endcsname\scratchcounter
-% % some attributes are always global
-% \doifelseinset\s!global{#3}%
-% {\etoksapp\t_attr_list_global{\csname\??attributecount#2\endcsname\attributeunsetvalue}}%
-% {\etoksapp\t_attr_list_local {\csname\??attributecount#2\endcsname\attributeunsetvalue}}%
-% \doifinset\s!nomath{#3}%
-% {\etoksapp\t_attr_list_nomath{\csname\??attributecount#2\endcsname\attributeunsetvalue}}%
-% \doifinset\s!public{#3}%
-% {\expandafter\let\csname#2\s!attribute\expandafter\endcsname\csname\??attributeid#2\endcsname}%
-% \doifinset\s!pickup{#3}%
-% {\expandafter\newconstant\csname\??attributepickup#2\endcsname
-% \csname\??attributepickup#2\endcsname\attributeunsetvalue
-% \etoksapp\t_attr_list_pickup{\csname\??attributecount#2\endcsname\csname\??attributepickup#2\endcsname}%
-% \ifcsname#2\s!attribute\endcsname
-% \expandafter\edef\csname\s!pickup#2\s!attribute\endcsname
-% {\csname\??attributepickup#2\endcsname\csname\??attributecount#2\endcsname}%
-% \expandafter\edef\csname\s!forget#2\s!attribute\endcsname
-% {\csname\??attributepickup#2\endcsname\attributeunsetvalue}%
-% \fi}%
-% \fi}
-
\def\attr_basics_define_indeed#1[#2][#3]%
{\ifcsname\??attributecount#2\endcsname\else
\scratchcounter\clf_defineattribute{#2}{#1}\relax
@@ -145,8 +118,8 @@
\unexpanded\def\resetglobalattributes{\the\t_attr_list_global\attribute\zerocount\zerocount}
\unexpanded\def\resetlocalattributes {\the\t_attr_list_local \attribute\zerocount\zerocount}
\else
- \unexpanded\def\resetglobalattributes{\the\t_attr_list_global\glyphdatafield \zerocount}
- \unexpanded\def\resetlocalattributes {\the\t_attr_list_local \glyphdatafield \zerocount}
+ \unexpanded\def\resetglobalattributes{\the\t_attr_list_global\glyphdatafield\zerocount\glyphscriptfield\zerocount}
+ \unexpanded\def\resetlocalattributes {\the\t_attr_list_local \glyphdatafield\zerocount\glyphscriptfield\zerocount}
\fi
\let\resetallattributes\resetlocalattributes
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 397aed038..761c6b20d 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2020.06.17 18:56}
+\newcontextversion{2020.06.19 11:04}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index dec0327ff..5bed82008 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.06.17 18:56}
+\edef\contextversion{2020.06.19 11:04}
\edef\contextkind {beta}
%D Kind of special:
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index 0ca2406ea..db5e170f0 100644
--- a/tex/context/base/mkiv/context.mkxl
+++ b/tex/context/base/mkiv/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.06.17 18:56}
+\edef\contextversion{2020.06.19 11:04}
\edef\contextkind {beta}
%D Kind of special:
diff --git a/tex/context/base/mkiv/lang-def.mkiv b/tex/context/base/mkiv/lang-def.mkiv
index 7f3e85f08..35a634644 100644
--- a/tex/context/base/mkiv/lang-def.mkiv
+++ b/tex/context/base/mkiv/lang-def.mkiv
@@ -413,7 +413,12 @@
\c!rightquotation=\upperrightdoubleninequote,
\c!date={\v!day,\space,\v!month,{،\space},\v!year}]
-\installlanguage [\s!hebrew] [\s!he]
+\installlanguage % same as arabic now .. someone needs to fix this
+ [\s!yi]
+ [\s!he]
+
+\installlanguage [\s!hebrew] [\s!he]
+\installlanguage [\s!yiddish] [\s!yi]
% Arabic Languages
diff --git a/tex/context/base/mkiv/lxml-ini.lua b/tex/context/base/mkiv/lxml-ini.lua
index f9ba96ece..77cc8717c 100644
--- a/tex/context/base/mkiv/lxml-ini.lua
+++ b/tex/context/base/mkiv/lxml-ini.lua
@@ -56,6 +56,7 @@ implement { name = "xmlconcatrange", actions = lxml.concatr
--------- { name = "xmlconcatrange", actions = lxml.concatrange, arguments = { "string", "string", "string", "string", "verbatim" } }
implement { name = "xmlcontext", public = true, actions = lxml.context, arguments = "2 strings" }
implement { name = "xmlcount", public = true, actions = lxml.count, arguments = "2 strings" }
+implement { name = "xmldepth", public = true, actions = lxml.depth, arguments = "string" }
implement { name = "xmldelete", public = true, actions = lxml.delete, arguments = "2 strings" }
implement { name = "xmldirect", public = true, actions = lxml.direct, arguments = "string" }
implement { name = "xmldirectives", public = true, actions = lxml.directives.setup, arguments = "string" }
diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua
index 079ab29da..00bff7873 100644
--- a/tex/context/base/mkiv/lxml-tex.lua
+++ b/tex/context/base/mkiv/lxml-tex.lua
@@ -14,7 +14,7 @@ local concat, insert, remove, sortedkeys, reversed = table.concat, table.insert,
local format, sub, gsub, find, gmatch, match = string.format, string.sub, string.gsub, string.find, string.gmatch, string.match
local type, next, tonumber, tostring, select = type, next, tonumber, tostring, select
local lpegmatch = lpeg.match
-local P, S, C, Cc, Cs = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Cs
+local P, S, C = lpeg.P, lpeg.S, lpeg.C
local patterns = lpeg.patterns
local setmetatableindex = table.setmetatableindex
local formatters, strip = string.formatters, string.strip
@@ -1755,6 +1755,23 @@ local function concatlist(collected,separator,lastseparator,textonly) -- test th
concatrange(collected,false,false,separator,lastseparator,textonly)
end
+local function depth(collected)
+ local d = 0
+ if collected then
+ local c = collected and collected[1]
+ if c.tg then
+ while c do
+ d = d + 1
+ c = c.__p__
+ if not c then
+ break
+ end
+ end
+ end
+ end
+ contextsprint(ctxcatcodes,d)
+end
+
texfinalizers.first = first
texfinalizers.last = last
texfinalizers.all = all
@@ -1778,6 +1795,7 @@ texfinalizers.concatrange = concatrange
texfinalizers.chainattribute = chainattribute
texfinalizers.chainpath = chainpath
texfinalizers.default = all -- !!
+texfinalizers.depth = depth
function texfinalizers.tag(collected,n)
if collected then
@@ -1863,6 +1881,10 @@ lxml.verbatim = verbatim
-- helpers
+function lxml.depth(id)
+ depth { getid(id) }
+end
+
function lxml.first(id,pattern)
local collected = xmlapplylpath(getid(id),pattern)
if collected then
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index e4ff584b4..85b33a02a 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -289,6 +289,8 @@ return {
"glet",
"glyphdatafield",
"glyphdimensionsmode",
+ "glyphscriptfield",
+ "glyphstatefield",
"gtoksapp",
"gtokspre",
"hjcode",
@@ -375,6 +377,7 @@ return {
"noligs",
"nospaces",
"novrule",
+ "orelse",
"outputbox",
"pardirection",
"postexhyphenchar",
@@ -680,7 +683,6 @@ return {
"leqno",
"let",
"limits",
- "linepar",
"linepenalty",
"lineskip",
"lineskiplimit",
@@ -732,7 +734,6 @@ return {
"openin",
"or",
"ordlimits",
- "orelse",
"outer",
"output",
"outputpenalty",
diff --git a/tex/context/base/mkiv/mult-sys.mkiv b/tex/context/base/mkiv/mult-sys.mkiv
index 8f8794df7..f04f986fe 100644
--- a/tex/context/base/mkiv/mult-sys.mkiv
+++ b/tex/context/base/mkiv/mult-sys.mkiv
@@ -63,6 +63,7 @@
\definesystemconstant {german} \definesystemconstant {de}
\definesystemconstant {greek} \definesystemconstant {gr}
\definesystemconstant {hebrew} \definesystemconstant {he}
+\definesystemconstant {yiddish} \definesystemconstant {yi}
\definesystemconstant {hungarian} \definesystemconstant {hu}
\definesystemconstant {italian} \definesystemconstant {it}
\definesystemconstant {japanese} \definesystemconstant {ja}
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua
index b809ceb7a..e9bb71b80 100644
--- a/tex/context/base/mkiv/node-nut.lua
+++ b/tex/context/base/mkiv/node-nut.lua
@@ -864,6 +864,17 @@ local getstate = direct.getstate
local setstate = direct.setstate
if not setstate or not getstate then
+ -- setstate = function(n,v)
+ -- setprop(n,"state",v)
+ -- end
+ -- getstate = function(n,v)
+ -- local s = getprop(n,"state")
+ -- if v then
+ -- return s == v
+ -- else
+ -- return s
+ -- end
+ -- end
setstate = function(n,v)
local p = propertydata[n]
if p then
@@ -884,10 +895,17 @@ if not setstate or not getstate then
return nil
end
end
- nuts.setstate = setstate
- nuts.getstate = getstate
end
+nuts.setstate = setstate
+nuts.getstate = getstate
+
+local getscript = direct.getscript or function(n,v) end -- elsewhere
+local setscript = direct.setscript or function(n,v) end -- elsewhere
+
+nuts.setscript = getscript
+nuts.getscript = setscript
+
nuts.isdone = function(n,k)
local p = propertydata[n]
if not p then
diff --git a/tex/context/base/mkiv/scrp-cjk.lua b/tex/context/base/mkiv/scrp-cjk.lua
index 83eecf6a3..9e6e24f4d 100644
--- a/tex/context/base/mkiv/scrp-cjk.lua
+++ b/tex/context/base/mkiv/scrp-cjk.lua
@@ -30,7 +30,6 @@ local getprev = nuts.getprev
local getfont = nuts.getfont
local getchar = nuts.getchar
local getid = nuts.getid
-local getattr = nuts.getattr
local getsubtype = nuts.getsubtype
local getwidth = nuts.getwidth
@@ -51,13 +50,11 @@ local userskip_code = gluecodes.userskip
local spaceskip_code = gluecodes.spaceskip
local xspaceskip_code = gluecodes.xspaceskip
-local a_scriptstatus = attributes.private('scriptstatus')
-local a_scriptinjection = attributes.private('scriptinjection')
-
-local categorytonumber = scripts.categorytonumber
-local numbertocategory = scripts.numbertocategory
local hash = scripts.hash
-local numbertodataset = scripts.numbertodataset
+
+local getscriptstatus = scripts.getstatus
+local getscriptdata = scripts.getdata
+local scriptcolors = scripts.colors
local fonthashes = fonts.hashes
local quaddata = fonthashes.quads
@@ -440,6 +437,21 @@ local injectors = { -- [previous] [current]
half_width_close = korean_5,
}
+scriptcolors.korean = "trace:0"
+scriptcolors.chinese = "trace:0"
+scriptcolors.katakana = "trace:0"
+scriptcolors.hiragana = "trace:0"
+scriptcolors.full_width_open = "trace:1"
+scriptcolors.full_width_close = "trace:2"
+scriptcolors.half_width_open = "trace:3"
+scriptcolors.half_width_close = "trace:4"
+scriptcolors.full_width_punct = "trace:5"
+------------.hyphen = "trace:5"
+scriptcolors.non_starter = "trace:6"
+scriptcolors.jamo_initial = "trace:7"
+scriptcolors.jamo_medial = "trace:8"
+scriptcolors.jamo_final = "trace:9"
+
local function process(head,first,last)
if first ~= last then
local lastfont = nil
@@ -449,8 +461,7 @@ local function process(head,first,last)
local upcoming = getnext(first)
local id = getid(first)
if id == glyph_code then
- local a = getattr(first,a_scriptstatus)
- local current = numbertocategory[a]
+ local current = getscriptstatus(first)
local action = injectors[previous]
if action then
action = action[current]
@@ -458,7 +469,7 @@ local function process(head,first,last)
local font = getfont(first)
if font ~= lastfont then
lastfont = font
- set_parameters(font,numbertodataset[getattr(first,a_scriptinjection)])
+ set_parameters(font,getscriptdata(first))
end
action(head,first)
end
@@ -471,10 +482,8 @@ local function process(head,first,last)
local pid = getid(p)
local nid = getid(n)
if pid == glyph_code and nid == glyph_code then
- local pa = getattr(p,a_scriptstatus)
- local na = getattr(n,a_scriptstatus)
- local pcjk = pa and numbertocategory[pa]
- local ncjk = na and numbertocategory[na]
+ local pcjk = getscriptstatus(p)
+ local ncjk = getscriptstatus(n)
if not pcjk or not ncjk
or pcjk == "korean" or ncjk == "korean"
or pcjk == "other" or ncjk == "other"
@@ -711,8 +720,7 @@ local function process(head,first,last)
local upcoming = getnext(first)
local id = getid(first)
if id == glyph_code then
- local a = getattr(first,a_scriptstatus)
- local current = numbertocategory[a]
+ local current = getscriptstatus(first)
local action = injectors[previous]
if action then
action = action[current]
@@ -720,7 +728,7 @@ local function process(head,first,last)
local font = getfont(first)
if font ~= lastfont then
lastfont = font
- set_parameters(font,numbertodataset[getattr(first,a_scriptinjection)])
+ set_parameters(font,getscriptdata(first))
end
action(head,first)
end
@@ -733,10 +741,8 @@ local function process(head,first,last)
local pid = getid(p)
local nid = getid(n)
if pid == glyph_code and nid == glyph_code then
- local pa = getattr(p,a_scriptstatus)
- local na = getattr(n,a_scriptstatus)
- local pcjk = pa and numbertocategory[pa]
- local ncjk = na and numbertocategory[na]
+ local pcjk = getscriptstatus(p)
+ local ncjk = getscriptstatus(n)
if not pcjk or not ncjk
or pcjk == "korean" or ncjk == "korean"
or pcjk == "other" or ncjk == "other"
@@ -940,8 +946,7 @@ local function process(head,first,last)
local upcoming = getnext(first)
local id = getid(first)
if id == glyph_code then
- local a = getattr(first,a_scriptstatus)
- local current = numbertocategory[a]
+ local current = getscriptstatus(first)
local action = injectors[previous]
if action then
action = action[current]
@@ -949,7 +954,7 @@ local function process(head,first,last)
local font = getfont(first)
if font ~= lastfont then
lastfont = font
- set_parameters(font,numbertodataset[getattr(first,a_scriptinjection)])
+ set_parameters(font,getscriptdata(first))
end
action(head,first)
end
@@ -965,10 +970,8 @@ local function process(head,first,last)
local pid = getid(p)
local nid = getid(n)
if pid == glyph_code and nid == glyph_code then
- local pa = getattr(p,a_scriptstatus)
- local na = getattr(n,a_scriptstatus)
- local pcjk = pa and numbertocategory[pa]
- local ncjk = na and numbertocategory[na]
+ local pcjk = getscriptstatus(p)
+ local ncjk = getscriptstatus(n)
if not pcjk or not ncjk
or pcjk == "korean" or ncjk == "korean"
or pcjk == "other" or ncjk == "other"
diff --git a/tex/context/base/mkiv/scrp-eth.lua b/tex/context/base/mkiv/scrp-eth.lua
index f6a994b88..f20d4b9f5 100644
--- a/tex/context/base/mkiv/scrp-eth.lua
+++ b/tex/context/base/mkiv/scrp-eth.lua
@@ -18,10 +18,10 @@ local getattr = nuts.getattr
local nodecodes = nodes.nodecodes
local glyph_code = nodecodes.glyph
-local a_scriptstatus = attributes.private('scriptstatus')
+local getscriptstatus = scripts.getstatus
-local numbertocategory = scripts.numbertocategory
local inserters = scripts.inserters
+local colors = scripts.colors
-- syllable [zerowidthspace] syllable
-- syllable [zerowidthspace] word
@@ -33,7 +33,6 @@ local inserters = scripts.inserters
-- sentence [space] word
-- sentence [space] sentence
-
local injectors = { -- [previous] [current]
ethiopic_syllable = {
ethiopic_syllable = inserters.zerowidthspace_before,
@@ -52,6 +51,10 @@ local injectors = { -- [previous] [current]
},
}
+colors.ethiopic_syllable = "trace:1"
+colors.ethiopic_word = "trace:2"
+colors.ethiopic_sentence = "trace:3"
+
local function process(head,first,last)
if first ~= last then
local injector = false
@@ -59,8 +62,7 @@ local function process(head,first,last)
while current do
local char, id = ischar(current)
if char then
- local scriptstatus = getattr(current,a_scriptstatus)
- local category = numbertocategory[scriptstatus]
+ local category = getscriptstatus(current)
if injector then
local action = injector[category]
if action then
diff --git a/tex/context/base/mkiv/scrp-ini.lua b/tex/context/base/mkiv/scrp-ini.lua
index 3d3aa4406..6829cf898 100644
--- a/tex/context/base/mkiv/scrp-ini.lua
+++ b/tex/context/base/mkiv/scrp-ini.lua
@@ -10,6 +10,9 @@ if not modules then modules = { } end modules ['scrp-ini'] = {
-- is finished.
local tonumber, next = tonumber, next
+local setmetatableindex = table.setmetatableindex
+local utfbyte, utfsplit = utf.byte, utf.split
+local gmatch = string.gmatch
local trace_analyzing = false trackers.register("scripts.analyzing", function(v) trace_analyzing = v end)
local trace_injections = false trackers.register("scripts.injections", function(v) trace_injections = v end)
@@ -19,17 +22,12 @@ local trace_splitdetails = false trackers.register("scripts.splitting.details",
local report_preprocessing = logs.reporter("scripts","preprocessing")
local report_splitting = logs.reporter("scripts","splitting")
-local utfbyte, utfsplit = utf.byte, utf.split
-local gmatch = string.gmatch
local attributes = attributes
local nodes = nodes
local context = context
-local texsetattribute = tex.setattribute
-
local nodecodes = nodes.nodecodes
-local unsetvalue = attributes.unsetvalue
local implement = interfaces.implement
@@ -39,14 +37,11 @@ local glue_code = nodecodes.glue
local emwidths = fonts.hashes.emwidths
local exheights = fonts.hashes.exheights
-local a_scriptinjection = attributes.private('scriptinjection')
-local a_scriptsplitting = attributes.private('scriptsplitting')
-local a_scriptstatus = attributes.private('scriptstatus')
+local a_script = attributes.private('script')
local fontdata = fonts.hashes.identifiers
local allocate = utilities.storage.allocate
local setnodecolor = nodes.tracers.colors.set
-local setmetatableindex = table.setmetatableindex
local enableaction = nodes.tasks.enableaction
local disableaction = nodes.tasks.disableaction
@@ -58,9 +53,7 @@ local getchar = nuts.getchar
local getfont = nuts.getfont
local getid = nuts.getid
local getglyphdata = nuts.getglyphdata
-
-local getattr = nuts.getattr
-local setattr = nuts.setattr
+local setglyphdata = nuts.setglyphdata
local isglyph = nuts.isglyph
@@ -69,8 +62,6 @@ local insert_node_before = nuts.insert_before
local first_glyph = nuts.first_glyph
------ traverse_id = nuts.traverse_id
------ traverse_char = nuts.traverse_char
local nextglyph = nuts.traversers.glyph
local nextchar = nuts.traversers.char
@@ -95,6 +86,36 @@ scripts.injectors = handlers
local splitters = allocate()
scripts.splitters = splitters
+-- we need to fake it in luatex
+
+local getscript = node.direct.getscript
+local texsetglyphscript = tex.setglyphscript
+
+if not getscript then
+
+ local getattr = nuts.getattr
+ local texsetattribute = tex.setattribute
+ local unsetvalue = attributes.unsetvalue
+
+ getscript = function(n)
+ local a = getattr(n,a_script)
+ if a and a ~= unsetvalue and a > 0 then
+ return a
+ end
+ end
+
+ texsetglyphscript = function(a)
+ if not a or a == 0 then
+ a = unsetvalue
+ end
+ texsetattribute(a_script,a)
+ end
+
+ nuts.getscript = getscript
+ tex .setglyphscript = texsetglyphscript
+
+end
+
local hash = { -- we could put these presets in char-def.lua
--
-- half width opening parenthesis
@@ -270,6 +291,8 @@ local defaults = {
scripts.defaults = defaults -- so we can add more
+-- todo: copy more efficient than metatable
+
function scripts.installmethod(handler)
local name = handler.name
handlers[name] = handler
@@ -283,20 +306,18 @@ function scripts.installmethod(handler)
for k, v in next, datasets do
setmetatableindex(v,defaults)
end
- setmetatable(attributes, {
- __index = function(t,k)
- local v = datasets[k] or datasets.default
- local a = unsetvalue
- if v then
- v.name = name -- for tracing
- a = #numbertodataset + 1
- numbertodataset[a] = v
- numbertohandler[a] = handler
- end
- t[k] = a
- return a
+ setmetatableindex(attributes, function(t,k)
+ local v = datasets[k] or datasets.default
+ local a = 0
+ if v then
+ v.name = name -- for tracing
+ a = #numbertodataset + 1
+ numbertodataset[a] = v
+ numbertohandler[a] = handler
end
- } )
+ t[k] = a
+ return a
+ end)
handler.attributes = attributes
end
@@ -346,96 +367,124 @@ end
local injectorenabled = false
local splitterenabled = false
+local function getscriptdata(n)
+ local s = getscript(n)
+ if s then
+ return s and numbertodataset[s]
+ end
+end
+
+local function getinjector(n)
+ local s = getscript(n)
+ if s then
+ s = numbertohandler[s]
+ return s and s.injector
+ end
+end
+
+local function getsplitter(n)
+ local s = getscript(n)
+ if s then
+ s = numbertodataset[s]
+ return s and s.splitter
+ end
+end
+
+scripts.getdata = getscriptdata
+scripts.getinjector = getinjector
+scripts.getsplitter = getsplitter
+
function scripts.set(name,method,preset)
local handler = handlers[method]
if handler then
+ local index = handler.attributes[preset]
if handler.injector then
if not injectorenabled then
enableaction("processors","scripts.injectors.handler")
injectorenabled = true
end
- texsetattribute(a_scriptinjection,handler.attributes[preset] or unsetvalue)
end
if handler.splitter then
if not splitterenabled then
enableaction("processors","scripts.splitters.handler")
splitterenabled = true
end
- texsetattribute(a_scriptsplitting,handler.attributes[preset] or unsetvalue)
end
if handler.initializer then
handler.initializer(handler)
handler.initializer = nil
end
+ texsetglyphscript(index)
else
- texsetattribute(a_scriptinjection,unsetvalue)
- texsetattribute(a_scriptsplitting,unsetvalue)
+ texsetglyphscript()
end
end
function scripts.reset()
- texsetattribute(a_scriptinjection,unsetvalue)
- texsetattribute(a_scriptsplitting,unsetvalue)
+ texsetglyphscript()
end
--- the following tables will become a proper installer (move to cjk/eth)
---
-- 0=gray 1=red 2=green 3=blue 4=yellow 5=magenta 6=cyan 7=x-yellow 8=x-magenta 9=x-cyan
-local scriptcolors = allocate { -- todo: just named colors
- korean = "trace:0",
- chinese = "trace:0",
- katakana = "trace:0",
- hiragana = "trace:0",
- full_width_open = "trace:1",
- full_width_close = "trace:2",
- half_width_open = "trace:3",
- half_width_close = "trace:4",
- full_width_punct = "trace:5",
- hyphen = "trace:5",
- non_starter = "trace:6",
- jamo_initial = "trace:7",
- jamo_medial = "trace:8",
- jamo_final = "trace:9",
- ethiopic_syllable = "trace:1",
- ethiopic_word = "trace:2",
- ethiopic_sentence = "trace:3",
- breaking_tsheg = "trace:1",
- nonbreaking_tsheg = "trace:2",
+-- local categories = allocate { -- rather bound to cjk ... will be generalized
+-- "korean",
+-- "chinese",
+-- "katakana",
+-- "hiragana",
+-- "full_width_open",
+-- "full_width_close",
+-- "half_width_open",
+-- "half_width_close",
+-- "full_width_punct",
+-- "hyphen",
+-- "non_starter",
+-- "jamo_initial",
+-- "jamo_medial",
+-- "jamo_final",
+-- "ethiopic_syllable",
+-- "ethiopic_word",
+-- "ethiopic_sentence",
+-- "breaking_tsheg",
+-- "nonbreaking_tsheg",
+-- }
+--
+-- scripts.categories = categories
+
+local scriptcolors = allocate {
+ -- todo: just named colors
+ hyphen = "trace:5",
}
scripts.colors = scriptcolors
-local numbertocategory = allocate { -- rather bound to cjk ... will be generalized
- "korean",
- "chinese",
- "katakana",
- "hiragana",
- "full_width_open",
- "full_width_close",
- "half_width_open",
- "half_width_close",
- "full_width_punct",
- "hyphen",
- "non_starter",
- "jamo_initial",
- "jamo_medial",
- "jamo_final",
- "ethiopic_syllable",
- "ethiopic_word",
- "ethiopic_sentence",
- "breaking_tsheg",
- "nonbreaking_tsheg",
-}
+-- this can become setprop ...
-local categorytonumber = allocate(table.swapped(numbertocategory)) -- could be one table
+local propertydata = nodes.properties.data
-scripts.categorytonumber = categorytonumber
-scripts.numbertocategory = numbertocategory
+local function setscriptstatus(n,s)
+ local p = propertydata[n]
+ if p then
+ p.scriptstatus = s
+ else
+ propertydata[n] = { scriptstatus = s }
+ end
+end
+
+function getscriptstatus(n)
+ local p = propertydata[n]
+ if p then
+ return p.scriptstatus
+ end
+end
+
+scripts.setstatus = setscriptstatus
+scripts.getstatus = getscriptstatus
+
+--
local function colorize(start,stop)
for n in nextglyph, start do
- local kind = numbertocategory[getattr(n,a_scriptstatus)]
+ local kind = getscriptstatus(n)
if kind then
local ac = scriptcolors[kind]
if ac then
@@ -459,13 +508,6 @@ local function traced_process(head,first,last,process,a)
end
end
--- eventually we might end up with more extensive parsing
--- todo: pass t[start..stop] == original
---
--- one of the time consuming functions:
-
--- we can have a fonts.hashes.originals
-
function scripts.injectors.handler(head)
local start = first_glyph(head) -- we already have glyphs here (subtype 1)
if not start then
@@ -476,7 +518,8 @@ function scripts.injectors.handler(head)
while start do
local char, id = isglyph(start)
if char then
- local a = getattr(start,a_scriptinjection)
+ -- local a = getinjector(start)
+ local a = getscript(start)
if a then
if a ~= last_a then
if first then
@@ -494,8 +537,8 @@ function scripts.injectors.handler(head)
first, last = nil, nil
end
last_a = a
- local handler = numbertohandler[a]
- normal_process = handler.injector
+ -- normal_process = a
+ normal_process = getinjector(start)
end
if normal_process then
-- id == font
@@ -513,7 +556,7 @@ function scripts.injectors.handler(head)
end
local h = hash[char]
if h then
- setattr(start,a_scriptstatus,categorytonumber[h])
+ setscriptstatus(start,h)
if not first then
first, last = start, start
else
@@ -750,13 +793,13 @@ function splitters.handler(head) -- todo: also first_glyph test
local current = head
while current do
if getid(current) == glyph_code then
- local a = getattr(current,a_scriptsplitting)
+ local a = getsplitter(current)
if a then
if a ~= attr then
local handler = numbertohandler[a]
tree = handler.tree or { }
attr = a
- proc = handler.splitter
+ proc = a
end
if proc then
local root = tree[getchar(current)]
@@ -813,10 +856,10 @@ end
local last_a, last_f, last_s, last_q
function splitters.insertafter(handler,head,first,last,detail)
- local a = getattr(first,a_scriptsplitting)
+ local a = getscriptdata(first)
local f = getfont(first)
- if a ~= last_a or f ~= last_f then
- last_s = emwidths[f] * numbertodataset[a].inter_word_stretch_factor
+ if a and a ~= last_a or f ~= last_f then
+ last_s = emwidths[f] * data.inter_word_stretch_factor
last_a = a
last_f = f
end
@@ -892,7 +935,7 @@ setmetatableindex(cache_nop,function(t,k) local v = { } t[k] = v return v end)
function autofontfeature.handler(head)
for n, char, font in nextchar, head do
- -- if getattr(n,a_scriptinjection) then
+ -- if getscript(n) then
-- -- already tagged by script feature, maybe some day adapt
-- else
local script = otfscripts[char]
@@ -923,7 +966,7 @@ function autofontfeature.handler(head)
end
end
if attr ~= 0 then
- setattr(n,0,attr)
+ setglyphdata(n,attr)
-- maybe set scriptinjection when associated
end
end
@@ -965,7 +1008,6 @@ implement {
-- some common helpers
-
do
local parameters = fonts.hashes.parameters
@@ -977,7 +1019,8 @@ do
local inter_character_shrink_factor = 1
local function space_glue(current)
- local data = numbertodataset[getattr(current,a_scriptinjection)]
+ -- local data = numbertodataset[getattr(current,a_scriptinjection)]
+ local data = getscriptdata(current)
if data then
inter_character_space_factor = data.inter_character_space_factor or 1
inter_character_stretch_factor = data.inter_character_stretch_factor or 1
diff --git a/tex/context/base/mkiv/scrp-ini.mkiv b/tex/context/base/mkiv/scrp-ini.mkiv
index f2d1da627..dccea2ee0 100644
--- a/tex/context/base/mkiv/scrp-ini.mkiv
+++ b/tex/context/base/mkiv/scrp-ini.mkiv
@@ -11,7 +11,30 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-% here we collect code from other places (was organized differently)
+%D The script handler has been upgraded mid June 2020 so there might be issues as I
+%D didn't test everything (yet). It should all be a bit more efficient now in
+%D \LUAMETATEX, although not spectacular. We use no attributes in \LUAMETATEX\ and
+%D only one in \LUATEX\ now.
+%D
+%D A glyph can have (an dget) all kind of properties. Except from the state, these
+%D are assigned within \TEX's grouping model!
+%D
+%D \startitemize
+%D \startitem font \stopitem
+%D \startitem character \stopitem
+%D \startitem language (4 properties packed in an unsigned integer) \stopitem
+%D \startitem data (used for dynamics) \stopitem
+%D \startitem script (used for special script processing) \stopitem
+%D \startitem state (used for analyzing, related to font features) \stopitem
+%D \stopitemize
+%D
+%D Additional properties are set via node list handlers. The state is stored in the
+%D glyph, but additional properties are stored in a node's property table. In the
+%D future the state might get used for something else, in which case we will stire
+%D the state in the property table too. On the other hand, we can now (if we want)
+%D influence the state at the\TEX\ end (not that we do that yet).
+
+%D Todo: as in bidi mode we need a way to globally keep the setting.
\registerctxluafile{scrp-ini}{}
\registerctxluafile{scrp-cjk}{}
@@ -19,13 +42,12 @@
\registerctxluafile{scrp-tha}{}
\registerctxluafile{scrp-tib}{}
-\definesystemattribute[scriptinjection][public,pickup]
-\definesystemattribute[scriptsplitting][public,pickup]
-\definesystemattribute[scriptstatus] [public,pickup]
+\ifcase \contextlmtxmode
+ \definesystemattribute[script][public,pickup]
+\fi
-%D Since scripts need specific \LUA\ code we use hard coded attribute
-%D values, but we might have more tricks at some time, so we use a
-%D proper define macro too.
+%D Since scripts need specific \LUA\ code we use hard coded attribute values, but we
+%D might have more tricks at some time, so we use a proper define macro too.
\unprotect
@@ -44,16 +66,10 @@
\unexpanded\def\scripts_basics_set
{\clf_setscript{\currentscript}{\scriptparameter\c!method}{\scriptparameter\c!preset}}
-% \unexpanded\def\setscript[#1]%
-% {\edef\currentscript{#1}%
-% \scripts_basics_set}
-
\unexpanded\def\setglobalscript[#1]%
{\edef\currentscript{#1}%
\scripts_basics_set
- \pickupscriptinjectionattribute
- \pickupscriptsplittingattribute
- \pickupscriptstatusattribute}
+ \pickupscriptattribute}
\unexpanded\def\setlocalscript[#1]%
{\edef\currentscript{#1}%
diff --git a/tex/context/base/mkiv/scrp-tib.lua b/tex/context/base/mkiv/scrp-tib.lua
index b67f69648..b1d50a469 100644
--- a/tex/context/base/mkiv/scrp-tib.lua
+++ b/tex/context/base/mkiv/scrp-tib.lua
@@ -12,25 +12,17 @@ local getnext = nuts.getnext
local getattr = nuts.getattr
local ischar = nuts.ischar
-local a_scriptstatus = attributes.private('scriptstatus')
+local getscriptstatus = scripts.getstatus
-local numbertocategory = scripts.numbertocategory
local inserters = scripts.inserters
+local colors = scripts.colors
local injectors = {
- breaking_tsheg = inserters.space_after,
+ breaking_tsheg = inserters.space_after
}
--- more efficient is to check directly
---
--- local b_tsheg = 0x0F0B -- breaking
--- local n_tsheg = 0x0F0C -- nonbreaking
---
--- if char == b_tsheg then
--- head, current = insert_space_after(head,current)
--- end
---
--- but this is more general
+colors.breaking_tsheg = "trace:1"
+colors.nonbreaking_tsheg = "trace:2"
local function process(head,first,last)
if first ~= last then
@@ -38,14 +30,11 @@ local function process(head,first,last)
while current do
local char, id = ischar(current)
if char then
- local scriptstatus = getattr(current,a_scriptstatus)
- if scriptstatus and scriptstatus > 0 then
- local category = numbertocategory[scriptstatus]
- if category then
- local injector = injectors[category]
- if injector then
- head, current = injector(head,current)
- end
+ local category = getscriptstatus(current)
+ if category then
+ local injector = injectors[category]
+ if injector then
+ head, current = injector(head,current)
end
end
end
diff --git a/tex/context/base/mkiv/sort-lan.lua b/tex/context/base/mkiv/sort-lan.lua
index b27798966..35116f1f6 100644
--- a/tex/context/base/mkiv/sort-lan.lua
+++ b/tex/context/base/mkiv/sort-lan.lua
@@ -11,10 +11,9 @@ if not modules then modules = { } end modules ['sort-lan'] = {
-- to finish in winter.
-- todo: U+1E9E (german SS)
--- Many vectors were supplied by Wolfgang Schuster and Philipp
--- Gesang. However this is a quite adapted and reformatted variant
--- so it needs some checking. Other users provides tables and
--- corrections as well.
+-- Many vectors were supplied by Wolfgang Schuster and Philipp Gesang. However this is
+-- a quite adapted and reformatted variant so it needs some checking. Other users
+-- provides tables and corrections as well.
local utfchar, utfbyte = utf.char, utf.byte
local sorters = sorters
@@ -973,3 +972,42 @@ definitions["jp"] = {
"ら", "り", "る", "れ", "ろ", "わ", "ゐ", "ゑ", "を", "ん",
}
}
+
+-- Hebrew and Jiddish (Marc Trius)
+
+definitions['he'] = {
+ entries = {
+ ['א'] = 'א', ['ב'] = 'ב', ['ג'] = 'ג', ['ד'] = 'ד', ['ה'] = 'ה',
+ ['ו'] = 'ו', ['ז'] = 'ז', ['ח'] = 'ח', ['ט'] = 'ט', ['י'] = 'י',
+ ['כ'] = 'כ', ['ל'] = 'ל', ['מ'] = 'מ', ['נ'] = 'נ', ['ס'] = 'ס',
+ ['ע'] = 'ע', ['פ'] = 'פ', ['צ'] = 'צ', ['ק'] = 'ק', ['ר'] = 'ר',
+ ['ש'] = 'ש', ['ת'] = 'ת',
+ },
+ orders = {
+ "א", "ב", "ג", "ד", "ה", "ו", "ז", "ח", "ט", "י", "כ",
+ "ל", "מ", "נ", "ס", "ע", "פ", "צ", "ק", "ר", "ש", "ת",
+ }
+}
+
+definitions["yi"] = {
+ parent = "he",
+ entries = {
+ ['א'] = 'א', ['ב'] = 'ב', ['בֿ'] = 'בֿ', ['ג'] = 'ג', ['ד'] = 'ד',
+ ['ה'] = 'ה', ['ו'] = 'ו', ['ז'] = 'ז', ['ח'] = 'ח', ['ט'] = 'ט',
+ ['י'] = 'י', ['כּ'] = 'כּ', ['כ'] = 'כ', ['ל'] = 'ל', ['מ'] = 'מ',
+ ['נ'] = 'נ', ['ס'] = 'ס', ['ע'] = 'ע', ['פ'] = 'פ', ['פֿ'] = 'פֿ',
+ ['צ'] = 'צ', ['ק'] = 'ק', ['ר'] = 'ר', ['ש'] = 'ש', ['שׂ'] = 'שׂ',
+ ['תּ'] = 'תּ', ['ת'] = 'ת',
+ },
+ orders = {
+ "א", "ב", "בֿ", "ג", "ד", "ה", "ו", "ז", "ח", "ט", "י", "כּ", "כ", "ל",
+ "מ", "נ", "ס", "ע", "פּ", "פֿ", "צ", "ק", "ר", "ש", "שׂ", "תּ", "ת",
+ },
+ replacements = {
+ { "אַ", "א" }, { "אָ", "א" }, { "בּ", "ב" }, { "בֿ", "בֿ" }, { "וּ", "ו" },
+ { "װ", "וו" }, { "ױ", "וי" }, { "יִ", "י" }, { "ײ", "יי" }, { "ײַ", "יי" },
+ { "כּ", "כּ" }, { "ך", "כ" }, { "ם", "מ" }, { "ן", "נ" }, { "פּ", "פּ" },
+ { "פ", "פּ" }, { "פֿ", "פֿ" }, { "ף", "פֿ" }, { "ץ", "צ" }, { "שׁ", "ש" },
+ { "שׂ", "שׂ" }, { "תּ", "תּ" },
+ },
+}
diff --git a/tex/context/base/mkiv/spac-ver.mkxl b/tex/context/base/mkiv/spac-ver.mkxl
index 22878941d..5b18ea7d3 100644
--- a/tex/context/base/mkiv/spac-ver.mkxl
+++ b/tex/context/base/mkiv/spac-ver.mkxl
@@ -150,8 +150,8 @@
\unexpanded\def\spac_linespacing_setup_use
{\ifcsname\namedinterlinespacehash\m_spac_interlinespace\s!parent\endcsname
- \let\currentinterlinespace\m_spac_interlinespace
- \spac_linespacing_setup_specified_interline_space
+ \let\currentinterlinespace\m_spac_interlinespace
+ \spac_linespacing_setup_specified_interline_space
% \else
% we only support named interlinespaces
\fi}
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 9ef6ddd19..c104e942f 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index e967a7798..e0e2be91e 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/syst-lua.lua b/tex/context/base/mkiv/syst-lua.lua
index d42ef946c..77960def7 100644
--- a/tex/context/base/mkiv/syst-lua.lua
+++ b/tex/context/base/mkiv/syst-lua.lua
@@ -204,194 +204,208 @@ local function unexpected(c)
report("unexpected token %a",c)
end
-local function expression()
- local w = 0
- local r = 1
- while true do
- local t = get_next()
- local n = get_command(t)
- local c = cmd[n]
- -- todo, helper: returns number
- if c == "letter" then
- w = w + 1 ; word[w] = utfchar(get_mode(t))
- else
- if w > 0 then
- local s = concat(word,"",1,w)
- local d = dimenfactors[s]
- if d then
- r = r + 1 ; result[r] = "*"
- r = r + 1 ; result[r] = 1/d
- else
- if xmath[s] then
- r = r + 1 ; result[r] = "xmath."
- elseif xcomplex[s] then
- r = r + 1 ; result[r] = "xcomplex."
+local expression
+
+if CONTEXTLMTXMODE == 0 then
+
+ expression = function()
+ local w = 0
+ local r = 1
+ while true do
+ local t = get_next()
+ local n = get_command(t)
+ local c = cmd[n]
+ -- todo, helper: returns number
+ if c == "letter" then
+ w = w + 1 ; word[w] = utfchar(get_mode(t))
+ else
+ if w > 0 then
+ local s = concat(word,"",1,w)
+ local d = dimenfactors[s]
+ if d then
+ r = r + 1 ; result[r] = "*"
+ r = r + 1 ; result[r] = 1/d
+ else
+ if xmath[s] then
+ r = r + 1 ; result[r] = "xmath."
+ elseif xcomplex[s] then
+ r = r + 1 ; result[r] = "xcomplex."
+ end
+ r = r + 1 ; result[r] = s
end
- r = r + 1 ; result[r] = s
+ w = 0
end
- w = 0
- end
- if c == "other_char" then
- r = r + 1 ; result[r] = utfchar(get_mode(t))
- elseif c == "spacer" then
- -- r = r + 1 ; result[r] = " "
- elseif c == "relax" then
- break
- elseif c == "assign_int" then
- r = r + 1 ; result[r] = getcount(get_index(t))
- elseif c == "assign_dimen" then
- r = r + 1 ; result[r] = getdimen(get_index(t))
- elseif c == "assign_glue" then
- r = r + 1 ; result[r] = getglue(get_index(t))
- elseif c == "assign_toks" then
- r = r + 1 ; result[r] = gettoks(get_index(t))
- elseif c == "char_given" or c == "math_given" or c == "xmath_given" then
- r = r + 1 ; result[r] = get_mode(t)
- elseif c == "last_item" then
- local n = get_csname(t)
- if n then
- local s = gettex(n)
- if s then
- r = r + 1 ; result[r] = s
+ if c == "other_char" then
+ r = r + 1 ; result[r] = utfchar(get_mode(t))
+ elseif c == "spacer" then
+ -- r = r + 1 ; result[r] = " "
+ elseif c == "relax" then
+ break
+ elseif c == "assign_int" then
+ r = r + 1 ; result[r] = getcount(get_index(t))
+ elseif c == "assign_dimen" then
+ r = r + 1 ; result[r] = getdimen(get_index(t))
+ elseif c == "assign_glue" then
+ r = r + 1 ; result[r] = getglue(get_index(t))
+ elseif c == "assign_toks" then
+ r = r + 1 ; result[r] = gettoks(get_index(t))
+ elseif c == "char_given" or c == "math_given" or c == "xmath_given" then
+ r = r + 1 ; result[r] = get_mode(t)
+ elseif c == "last_item" then
+ local n = get_csname(t)
+ if n then
+ local s = gettex(n)
+ if s then
+ r = r + 1 ; result[r] = s
+ else
+ unexpected(c)
+ end
+ else
+ unexpected(c)
+ end
+ elseif c == "call" then
+ local n = get_csname(t)
+ if n then
+ local s = get_macro(n)
+ if s then
+ r = r + 1 ; result[r] = s
+ else
+ unexpected(c)
+ end
else
unexpected(c)
end
+ elseif c == "the" or c == "convert" or c == "lua_expandable_call" then
+ put_next(t)
+ scan_token() -- expands
else
unexpected(c)
end
- elseif c == "call" then
- local n = get_csname(t)
- if n then
- local s = get_macro(n)
- if s then
+ end
+ end
+ local code = concat(result,"",1,r)
+ local func = load(code)
+ if type(func) == "function" then
+ context(func())
+ else
+ report("invalid lua %a",code)
+ end
+ end
+
+else
+
+ local get_cmdchrcs = tokens.get_cmdchrcs or token.get_cmdchrcs
+
+ local letter_code = cmd.letter
+ local other_char_code = cmd.other_char
+ local spacer_code = cmd.spacer
+ local other_char_code = cmd.other_char
+ local relax_code = cmd.relax
+ local register_int_code = cmd.register_int
+ local internal_int_code = cmd.internal_int
+ local register_dimen_code = cmd.register_dimen
+ local internal_dimen_code = cmd.internal_dimen
+ local register_glue_code = cmd.register_glue
+ local internal_glue_code = cmd.internal_glue
+ local register_toks_code = cmd.register_toks
+ local internal_toks_code = cmd.internal_toks
+ local char_given_code = cmd.char_given
+ local math_given_code = cmd.math_given
+ local xmath_given_code = cmd.xmath_given
+ local some_item_code = cmd.some_item
+ local call_code = cmd.call
+ local the_code = cmd.the
+ local convert_code = cmd.convert
+ local lua_expandable_call_code = cmd.lua_expandable_call
+
+ local function unexpected(c)
+ report("unexpected token %a",c)
+ end
+
+ expression = function()
+ local w = 0
+ local r = 1
+ while true do
+ local t = get_next()
+ local n, i = get_cmdchrcs(t)
+ if n == letter_code then
+ w = w + 1 ; word[w] = utfchar(i)
+ else
+ if w > 0 then
+ -- we could use a metatable for all math, complex and factors
+ local s = concat(word,"",1,w)
+ local d = dimenfactors[s]
+ if d then
+ r = r + 1 ; result[r] = "*"
+ r = r + 1 ; result[r] = 1/d
+ else
+ if xmath[s] then
+ r = r + 1 ; result[r] = "xmath."
+ elseif xcomplex[s] then
+ r = r + 1 ; result[r] = "xcomplex."
+ end
r = r + 1 ; result[r] = s
+ end
+ w = 0
+ end
+ if n == other_char_code then
+ r = r + 1 ; result[r] = utfchar(i)
+ elseif n == spacer_code then
+ -- r = r + 1 ; result[r] = " "
+ elseif n == relax_code then
+ break
+ elseif n == register_int_code or n == internal_int_code then
+ r = r + 1 ; result[r] = getcount(i)
+ elseif n == register_dimen_code or n == internal_dimen_code then
+ r = r + 1 ; result[r] = getdimen(i)
+ elseif n == register_glue_code or n == n == register_dimen_code_glue_code then
+ r = r + 1 ; result[r] = getglue(i)
+ elseif n == register_toks_code or n == n == register_dimen_code_toks_code then
+ r = r + 1 ; result[r] = gettoks(i)
+ elseif n == char_given_code or n == math_given_code or n == xmath_given_code then
+ r = r + 1 ; result[r] = i
+ elseif n == some_item_code then
+ local n = get_csname(t)
+ if n then
+ local s = gettex(n)
+ if s then
+ r = r + 1 ; result[r] = s
+ else
+ unexpected(c)
+ end
+ else
+ unexpected(c)
+ end
+ elseif n == call_code then
+ local n = get_csname(t)
+ if n then
+ local s = get_macro(n)
+ if s then
+ r = r + 1 ; result[r] = s
+ else
+ unexpected(c)
+ end
else
unexpected(c)
end
+ elseif n == the_code or n == convert_code or n == lua_expandable_call_code then
+ put_next(t)
+ scan_token() -- expands
else
unexpected(c)
end
- elseif c == "the" or c == "convert" or c == "lua_expandable_call" then
- put_next(t)
- scan_token() -- expands
- else
- unexpected(c)
end
end
+ local code = concat(result,"",1,r)
+ local func = load(code)
+ if type(func) == "function" then
+ context(func())
+ else
+ report("invalid lua %a",code)
+ end
end
- local code = concat(result,"",1,r)
- local func = load(code)
- if type(func) == "function" then
- context(func())
- else
- report("invalid lua %a",code)
- end
-end
--- local letter_code = cmd.letter
--- local other_char_code = cmd.other_char
--- local spacer_code = cmd.spacer
--- local other_char_code = cmd.other_char
--- local relax_code = cmd.relax
--- local assign_int_code = cmd.assign_int
--- local assign_dimen_code = cmd.assign_dimen
--- local assign_glue_code = cmd.assign_glue
--- local assign_toks_code = cmd.assign_toks
--- local char_given_code = cmd.char_given
--- local math_given_code = cmd.math_given
--- local xmath_given_code = cmd.xmath_given
--- local last_item_code = cmd.last_item
--- local call_code = cmd.call
--- local the_code = cmd.the
--- local convert_code = cmd.convert
--- local lua_expandable_call_code = cmd.lua_expandable_call
---
--- local function unexpected(c)
--- report("unexpected token %a",c)
--- end
---
--- local function expression()
--- local w = 0
--- local r = 1
--- while true do
--- local t = get_next()
--- local n = get_command(t)
--- if n == letter_code then
--- w = w + 1 ; word[w] = utfchar(get_mode(t))
--- else
--- if w > 0 then
--- -- we could use a metatable for all math, complex and factors
--- local s = concat(word,"",1,w)
--- local d = dimenfactors[s]
--- if d then
--- r = r + 1 ; result[r] = "*"
--- r = r + 1 ; result[r] = 1/d
--- else
--- if xmath[s] then
--- r = r + 1 ; result[r] = "xmath."
--- elseif xcomplex[s] then
--- r = r + 1 ; result[r] = "xcomplex."
--- end
--- r = r + 1 ; result[r] = s
--- end
--- w = 0
--- end
--- if n == other_char_code then
--- r = r + 1 ; result[r] = utfchar(get_mode(t))
--- elseif n == spacer_code then
--- -- r = r + 1 ; result[r] = " "
--- elseif n == relax_code then
--- break
--- elseif n == assign_int_code then
--- r = r + 1 ; result[r] = getcount(get_index(t))
--- elseif n == assign_dimen_code then
--- r = r + 1 ; result[r] = getdimen(get_index(t))
--- elseif n == assign_glue_code then
--- r = r + 1 ; result[r] = getglue(get_index(t))
--- elseif n == assign_toks_code then
--- r = r + 1 ; result[r] = gettoks(get_index(t))
--- elseif n == char_given_code or n == math_given_code or n == xmath_given_code then
--- r = r + 1 ; result[r] = get_mode(t)
--- elseif n == last_item_code then
--- local n = get_csname(t)
--- if n then
--- local s = gettex(n)
--- if s then
--- r = r + 1 ; result[r] = s
--- else
--- unexpected(c)
--- end
--- else
--- unexpected(c)
--- end
--- elseif n == call_code then
--- local n = get_csname(t)
--- if n then
--- local s = get_macro(n)
--- if s then
--- r = r + 1 ; result[r] = s
--- else
--- unexpected(c)
--- end
--- else
--- unexpected(c)
--- end
--- elseif n == the_code or n == convert_code or n == lua_expandable_call_code then
--- put_next(t)
--- scan_token() -- expands
--- else
--- unexpected(c)
--- end
--- end
--- end
--- local code = concat(result,"",1,r)
--- local func = load(code)
--- if type(func) == "function" then
--- context(func())
--- else
--- report("invalid lua %a",code)
--- end
--- end
+end
implement {
public = true,
diff --git a/tex/context/base/mkiv/tabl-tbl.mkxl b/tex/context/base/mkiv/tabl-tbl.mkxl
index 3a1d835ea..cacaa52bf 100644
--- a/tex/context/base/mkiv/tabl-tbl.mkxl
+++ b/tex/context/base/mkiv/tabl-tbl.mkxl
@@ -260,7 +260,7 @@
\to \t_tabl_tabulate_initializers_second
\prependtoks
- \global\advance\c_tabl_tabulate_nofrealrows\plusone
+ \global\advance\c_tabl_tabulate_nofrealrows\plusone
\to \t_tabl_tabulate_every_real_row
\def\b_tabl_tabulate_current#1%
diff --git a/tex/context/base/mkiv/toks-ini.lua b/tex/context/base/mkiv/toks-ini.lua
index 8fc60335e..0ac5dcc50 100644
--- a/tex/context/base/mkiv/toks-ini.lua
+++ b/tex/context/base/mkiv/toks-ini.lua
@@ -260,33 +260,65 @@ if setinspector then
local simple = { letter = "letter", other_char = "other" }
- local function astable(t)
- if t and is_token(t) then
- local cmdname = t.cmdname
- local simple = simple[cmdname]
- if simple then
- return {
- category = simple,
- character = utfchar(t.mode) or nil,
- }
- else
- return {
- command = t.command,
- id = t.id,
- tok = t.tok,
- csname = t.csname,
- active = t.active,
- expandable = t.expandable,
- protected = t.protected,
- frozen = t.frozen,
- mode = t.mode,
- index = t.index,
- user = t.user,
- cmdname = cmdname,
- }
+ local astable = CONTEXTLMTXMODE == 0 and
+
+ function(t)
+ if t and is_token(t) then
+ local cmdname = t.cmdname
+ local simple = simple[cmdname]
+ if simple then
+ return {
+ id = t.id,
+ category = simple,
+ character = utfchar(t.mode) or nil,
+ }
+ else
+ return {
+ command = t.command,
+ id = t.id,
+ tok = t.tok,
+ csname = t.csname,
+ active = t.active,
+ expandable = t.expandable,
+ protected = t.protected,
+ frozen = t.frozen,
+ mode = t.mode,
+ index = t.index,
+ user = t.user,
+ cmdname = cmdname,
+ }
+ end
+ end
+ end
+
+ or
+
+ function(t)
+ if t and is_token(t) then
+ local cmdname = t.cmdname
+ local simple = simple[cmdname]
+ if simple then
+ return {
+ id = t.id,
+ category = simple,
+ character = utfchar(t.index) or nil,
+ }
+ else
+ return {
+ id = t.id,
+ command = t.command,
+ index = t.index,
+ csname = t.csname,
+ cmdname = cmdname,
+ active = t.active,
+ expandable = t.expandable,
+ protected = t.protected,
+ frozen = t.frozen,
+ user = t.user,
+ }
+ end
end
end
- end
tokens.astable = astable
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index a1c027064..6c990f409 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 2020-06-17 18:56
+-- merge date : 2020-06-19 11:04
do -- begin closure to overcome local limits and interference