diff options
Diffstat (limited to 'tex')
28 files changed, 755 insertions, 247 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 39423bd25..2460e83ce 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.05.08 20:46} +\newcontextversion{2020.05.12 16:17} %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 9dd4c03e5..41553e217 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.05.08 20:46} +\edef\contextversion{2020.05.12 16:17} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua index 5f33f9c2a..ac3a1a2fe 100644 --- a/tex/context/base/mkiv/cldf-ini.lua +++ b/tex/context/base/mkiv/cldf-ini.lua @@ -392,7 +392,7 @@ local interfacescanners = setmetatablenewindex(function(t,k,v) -- rawset(t,k,v) end) -function interfaces.registerscanner(name,action,protected,public,valuetype) +function interfaces.registerscanner(name,action,protected,public,value) rawset(interfacescanners,name,action) if storedscanners[name] then -- report_cld("warning: scanner %a is already set (mode 2a)",name) @@ -405,7 +405,7 @@ function interfaces.registerscanner(name,action,protected,public,valuetype) local n = registerfunction("interfaces.scanners."..name,true) storedscanners[name] = n local name = public and name or ("clf_" .. name) - setluatoken(name,n,"global",protected and "protected" or "",valuetype or "") + setluatoken(name,n,"global",protected and "protected" or "",value and "value" or "") else storedscanners[name] = true -- report_cld("installing interface scanner: %s (mode 2c)",name) diff --git a/tex/context/base/mkiv/cldf-lmt.lua b/tex/context/base/mkiv/cldf-lmt.lua new file mode 100644 index 000000000..74ba5c224 --- /dev/null +++ b/tex/context/base/mkiv/cldf-lmt.lua @@ -0,0 +1,399 @@ +if not modules then modules = { } end modules ['cldf-lmt'] = { + version = 1.001, + comment = "companion to toks-scn.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local random = math.random +local randomseed = math.randomseed +local round = math.round +local abs = math.abs + +local scanners = tokens.scanners +local scanword = scanners.word +local scanstring = scanners.string +local scanboolean = scanners.boolean +local scandimen = scanners.dimen +local scanfloat = scanners.float +local scancount = scanners.integer +local scaninteger = scanners.luainteger +local scancardinal = scanners.luacardinal +local scannumber = scanners.luanumber +local scanargument = scanners.argument +local scantoken = scanners.token +local getindex = token.get_index +local texsetdimen = tex.setdimen + +local values = tokens.values +local none_code = values.none +local integer_code = values.integer +local cardinal_code = values.cardinal +local dimension_code = values.dimension +local skip_code = values.skip +local boolean_code = values.boolean +local float_code = values.float + +local context = context + +local floats = { } +local integers = { } +local cardinals = { } +local numbers = { } + +-- variables -- + +interfaces.implement { + name = "luafloat", + public = true, + value = true, + actions = function(b) + local n = scanword() + if b then + context("%.99g",floats[n] or 0) + else + floats[n] = scannumber(true) + -- floats[n] = scanfloat(true) + end + end, +} + +interfaces.implement { + name = "luainteger", + public = true, + value = true, + actions = function(b) + local n = scanword() + if b then + context("%i",integers[n] or 0) + else + integers[n] = scaninteger(true) + end + end, +} + +interfaces.implement { + name = "luacount", + public = true, + value = true, + actions = function(b) + local n = scanword() + if b then + return integer_code, integers[n] or 0 + else + integers[n] = scancount(true) + end + end, +} + +interfaces.implement { + name = "luadimen", + public = true, + value = true, + actions = function(b) + local n = scanword() + if b then + return dimension_code, integers[n] or 0 + else + integers[n] = scandimen(false,false,true) + end + end, +} + +interfaces.implement { + name = "luacardinal", + public = true, + value = true, + actions = function(b) + local n = scanword() + if b then + context("%d",cardinals[n] or 0) + else + cardinals[n] = scancardinal(true) + end + end, +} + +interfaces.implement { + name = "luanumber", + public = true, + value = true, + actions = function(b) + local n = scanword() + if b then + context("%d",floats[n] or integers[n] or cardinals[n] or 0) + else + -- floats[n] = scanfloat(true) + floats[n] = scannumber(true) + end + end, +} + +interfaces.implement { + name = "luarandom", + public = true, + value = true, + actions = function(b) + if b then + return integer_code, random(scaninteger(),scaninteger()) + else + randomseed(scaninteger(true)) + end + end, +} + +interfaces.floats = floats +interfaces.integers = integers +interfaces.cardinals = cardinals + +interfaces.numbers = table.setmetatableindex(function(t,k) + return floats[k] or integers[k] or cardinals[k] +end) + +-- arrays -- + +local arrays = { } + +interfaces.arrays = arrays + +local newindex = lua.newindex + +interfaces.implement { + name = "newarray", + public = true, + protected = true, + arguments = { { + { "name", "string" }, + { "nx", "integer" }, + { "ny", "integer" }, + { "type", "string" }, + } }, + actions = function(t) + local name = t.name + if t.name then + local nx = t.nx + local ny = t.ny + local ty = t.type or "integer" + local df = nil + if ty == "integer" or ty == "float" or ty == "dimension" then + df = 0 + elseif ty == "boolean" then + df = false + else + ty = nil + end + if nx and ty ~= nil then + local data + if ny then + data = newindex(t.ny) + for i=1,ny do + data[i] = newindex(nx,df) + end + else + data = newindex(nx,df) + end + arrays[name] = data + data.nx = nx + data.ny = ny + data.type = ty + if ty == "integer" then + data.scanner = scancount + elseif ty == "boolean" then + data.scanner = scanboolean + elseif ty == "dimension" then + data.scanner = scandimen + elseif ty == "float" then + data.scanner = scanfloat + end + if ty == "integer" then + data.code = integer_code + elseif ty == "boolean" then + data.code = boolean_code + elseif ty == "dimension" then + data.code = dimension_code + elseif ty == "float" then + data.code = float_code + end + end + end + end, +} + +interfaces.implement { + name = "arrayvalue", + public = true, + value = true, + actions = function(b) + local name = scanstring() + if name then + local a = arrays[name] + if a then + local nx = a.nx + local ny = a.ny + local d = a + if ny then + d = d[scaninteger()] + end + local x = scaninteger() + if b then + local code = a.code + if code == float_code then + context("%.99g",d[x]) + else + return code, d[x] + end + else + d[x] = a.scanner() + end + end + end + end, +} + + +interfaces.implement { + name = "arrayequals", + public = true, + value = true, + actions = function(b) + local name = scanstring() + if name then + local a = arrays[name] + if a then + local nx = a.nx + local ny = a.ny + local d = a + if ny then + d = d[scaninteger()] + end + local x = scaninteger() + if b then + return boolean_code, a.scanner() == d[x] + end + end + end + end, +} + +interfaces.implement { + name = "arraycompare", + public = true, + value = true, + actions = function(b) + local name = scanstring() + if name then + local a = arrays[name] + if a then + local nx = a.nx + local ny = a.ny + local d = a + if ny then + d = d[scaninteger()] + end + local x = scaninteger() + if b then + local v = a.scanner() + local d = d[x] + if d < v then + return integer_code, 0 + elseif d == v then + return integer_code, 1 + else + return integer_code, 2 + end + end + end + end + end, +} + +interfaces.implement { + name = "showarray", + public = true, + protected = true, + actions = function() + local name = scanstring() + if name then + inspect(arrays[name]) + end + end, +} + +-- expressions -- + +local cache = table.setmetatableindex(function(t,k) + local code = "return function() local n = interfaces.numbers local a = interfaces.arrays return " .. k .. " end" + code = loadstring(code) + if code then + code = code() + end + t[k] = code or false + return code +end) + +table.makeweak(cache) + +interfaces.implement { + name = "luaexpression", + public = true, + actions = function() + local how = scanword() + local code = cache[scanargument()] + if code then + local result = code() + if result then + if not how then + context(tostring(code())) + elseif how == "float" then + context("%.99g",result) + elseif how == "integer" then + context("%i",round(result)) + elseif how == "cardinal" then + context("%d",abs(round(result))) + elseif how == "dimen" then + context("%p",result) + elseif how == "boolean" then + context("%d",result and 1 or 0) + elseif how == "lua" then + context("%q",result) + else + context(tostring(code())) + end + end + end + end +} + +local dimenfactors = number.dimenfactors + +interfaces.implement { + name = "nodimen", + public = true, + value = true, + actions = function(b) + if b then + local how = scanword() + local what = scandimen() + if how then + local factor = dimenfactors[how] + if factor then + context("%.6N%s",factor*what,how) + else + return dimension_code, what + end + else + return dimension_code, what + end + else + local t = scantoken() + if t then + local i = getindex(t) + if i then + local d = scandimen(false,false,true) + texsetdimen(i,d) + end + end + end + end, +} diff --git a/tex/context/base/mkiv/cldf-scn.lua b/tex/context/base/mkiv/cldf-scn.lua index d79383866..1e5fe221d 100644 --- a/tex/context/base/mkiv/cldf-scn.lua +++ b/tex/context/base/mkiv/cldf-scn.lua @@ -77,7 +77,7 @@ function interfaces.implement(specification) if scanners[name] and not specification.overload then report("warning: 'scanners.%s' is redefined",name) end - register(name,scanner,specification.protected,specification.public,specification.valuetype) + register(name,scanner,specification.protected,specification.public,specification.value) if private then return end diff --git a/tex/context/base/mkiv/colo-ini.mkxl b/tex/context/base/mkiv/colo-ini.mkxl index 47d6cc8a1..ee2dc64a6 100644 --- a/tex/context/base/mkiv/colo-ini.mkxl +++ b/tex/context/base/mkiv/colo-ini.mkxl @@ -229,7 +229,7 @@ \unexpanded\def\directcolored[#1]% {\colo_basics_defined_and_activated{#1}} -\unexpanded\def\fastcolor [#1]#2% +\unexpanded\def\fastcolor[#1]#2% {\begingroup % is this command still needed? \edef\currentcolorname{#1}% \ifx\currentcolorprefix\empty @@ -760,9 +760,11 @@ \def\colo_helpers_activate#1% two-step is not that much faster but less tracing {\edef\currentcolorname{#1}% \ifx\currentcolorprefix\empty - \expandafter\colo_helpers_activate_nop + %\expandafter + \colo_helpers_activate_nop \else - \expandafter\colo_helpers_activate_yes + %\expandafter + \colo_helpers_activate_yes \fi} \def\colo_helpers_activate_yes diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 01f0e472f..93fc7b12c 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.05.08 20:46} +\newcontextversion{2020.05.12 16:17} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index af6b5780d..7adad8602 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.05.08 20:46} +\edef\contextversion{2020.05.12 16:17} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index f79fc0980..1e4d4b45c 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.05.08 20:46} +\edef\contextversion{2020.05.12 16:17} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/data-ini.lua b/tex/context/base/mkiv/data-ini.lua index 3c1531019..6cf5669b3 100644 --- a/tex/context/base/mkiv/data-ini.lua +++ b/tex/context/base/mkiv/data-ini.lua @@ -73,7 +73,7 @@ end -- Next comes the user's home path. We need this as later on we have -- to replace ~ with its value. -do +if not environment.homedir then local oldhome = osgetenv('HOME') local homedir = osgetenv(ostype == "windows" and 'USERPROFILE' or 'HOME') or '' diff --git a/tex/context/base/mkiv/driv-shp.lua b/tex/context/base/mkiv/driv-shp.lua index 47cb57dd7..e7f19aea0 100644 --- a/tex/context/base/mkiv/driv-shp.lua +++ b/tex/context/base/mkiv/driv-shp.lua @@ -73,41 +73,41 @@ local dircodes = nodes.dircodes local dirvalues = nodes.dirvalues local subtypes = nodes.subtypes -local normaldir_code <const> = dircodes.normal - -local lefttoright_code <const> = dirvalues.lefttoright -local righttoleft_code <const> = dirvalues.righttoleft - -local glyph_code <const> = nodecodes.glyph -local kern_code <const> = nodecodes.kern -local glue_code <const> = nodecodes.glue -local hlist_code <const> = nodecodes.hlist -local vlist_code <const> = nodecodes.vlist -local dir_code <const> = nodecodes.dir -local disc_code <const> = nodecodes.disc -local math_code <const> = nodecodes.math -local rule_code <const> = nodecodes.rule -local whatsit_code <const> = nodecodes.whatsit ------ penalty_code <const> = nodecodes.penalty ------ boundary_code <const> = nodecodes.boundary - -local leaders_code <const> = leadercodes.leaders -local cleaders_code <const> = leadercodes.cleaders -local xleaders_code <const> = leadercodes.xleaders -local gleaders_code <const> = leadercodes.gleaders - -local spaceskip_code <const> = gluecodes.spaceskip - -local saveposwhatsit_code <const> = whatsitcodes.savepos -local userdefinedwhatsit_code <const> = whatsitcodes.userdefined -local openwhatsit_code <const> = whatsitcodes.open -local writewhatsit_code <const> = whatsitcodes.write -local closewhatsit_code <const> = whatsitcodes.close -local lateluawhatsit_code <const> = whatsitcodes.latelua -local literalwhatsit_code <const> = whatsitcodes.literal -local setmatrixwhatsit_code <const> = whatsitcodes.setmatrix -local savewhatsit_code <const> = whatsitcodes.save -local restorewhatsit_code <const> = whatsitcodes.restore +local normaldir_code = dircodes.normal + +local lefttoright_code = dirvalues.lefttoright +local righttoleft_code = dirvalues.righttoleft + +local glyph_code = nodecodes.glyph +local kern_code = nodecodes.kern +local glue_code = nodecodes.glue +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local dir_code = nodecodes.dir +local disc_code = nodecodes.disc +local math_code = nodecodes.math +local rule_code = nodecodes.rule +local whatsit_code = nodecodes.whatsit +----- penalty_code = nodecodes.penalty +----- boundary_code = nodecodes.boundary + +local leaders_code = leadercodes.leaders +local cleaders_code = leadercodes.cleaders +local xleaders_code = leadercodes.xleaders +local gleaders_code = leadercodes.gleaders + +local spaceskip_code = gluecodes.spaceskip + +local saveposwhatsit_code = whatsitcodes.savepos +local userdefinedwhatsit_code = whatsitcodes.userdefined +local openwhatsit_code = whatsitcodes.open +local writewhatsit_code = whatsitcodes.write +local closewhatsit_code = whatsitcodes.close +local lateluawhatsit_code = whatsitcodes.latelua +local literalwhatsit_code = whatsitcodes.literal +local setmatrixwhatsit_code = whatsitcodes.setmatrix +local savewhatsit_code = whatsitcodes.save +local restorewhatsit_code = whatsitcodes.restore local getpagedimensions getpagedimensions = function() getpagedimensions = backends.codeinjections.getpagedimensions diff --git a/tex/context/base/mkiv/lpdf-lmt.lua b/tex/context/base/mkiv/lpdf-lmt.lua index ab07e984d..f4e30274a 100644 --- a/tex/context/base/mkiv/lpdf-lmt.lua +++ b/tex/context/base/mkiv/lpdf-lmt.lua @@ -39,7 +39,7 @@ local concat, sortedhash = table.concat, table.sortedhash local setmetatableindex = table.setmetatableindex local loaddata = io.loaddata -local bpfactor <const> = number.dimenfactors.bp +local bpfactor = number.dimenfactors.bp local md5HEX = md5.HEX local osuuid = os.uuid @@ -153,11 +153,11 @@ local fontproperties local usedcharacters = setmetatableindex("table") local pdfcharacters -local horizontalmode = true ------ widefontmode = true -local scalefactor = 1 -local threshold = 655360 -local tjfactor <const> = 100 / 65536 +local horizontalmode = true +----- widefontmode = true +local scalefactor = 1 +local threshold = 655360 +local tjfactor = 100 / 65536 lpdf.usedcharacters = usedcharacters @@ -515,8 +515,8 @@ local flushcharacter do local f_mode = formatters["%i Tr"] -- can be hash local f_font = formatters["/F%i %.6N Tf"] -- can be hash - local s_width <const> = "0 w" - local s_mode <const> = "0 Tr" + local s_width = "0 w" + local s_mode = "0 Tr" local function set_font() -- if need_width and need_width ~= 0 then @@ -660,15 +660,15 @@ end local flushliteral do - local nodeproperties <const> = nodes.properties.data - local literalvalues <const> = nodes.literalvalues + local nodeproperties = nodes.properties.data + local literalvalues = nodes.literalvalues - local originliteral_code <const> = literalvalues.origin - local pageliteral_code <const> = literalvalues.page - local alwaysliteral_code <const> = literalvalues.always - local rawliteral_code <const> = literalvalues.raw - local textliteral_code <const> = literalvalues.text - local fontliteral_code <const> = literalvalues.font + local originliteral_code = literalvalues.origin + local pageliteral_code = literalvalues.page + local alwaysliteral_code = literalvalues.always + local rawliteral_code = literalvalues.raw + local textliteral_code = literalvalues.text + local fontliteral_code = literalvalues.font flushliteral = function(current,pos_h,pos_v,mode,str) if mode then @@ -908,16 +908,16 @@ local flushrule, flushsimplerule, flushimage, flushgroup do local setprop = nuts.setprop local getprop = nuts.getprop - local normalrule_code <const> = rulecodes.normal - local boxrule_code <const> = rulecodes.box - local imagerule_code <const> = rulecodes.image - local emptyrule_code <const> = rulecodes.empty - local userrule_code <const> = rulecodes.user - local overrule_code <const> = rulecodes.over - local underrule_code <const> = rulecodes.under - local fractionrule_code <const> = rulecodes.fraction - local radicalrule_code <const> = rulecodes.radical - local outlinerule_code <const> = rulecodes.outline + local normalrule_code = rulecodes.normal + local boxrule_code = rulecodes.box + local imagerule_code = rulecodes.image + local emptyrule_code = rulecodes.empty + local userrule_code = rulecodes.user + local overrule_code = rulecodes.over + local underrule_code = rulecodes.under + local fractionrule_code = rulecodes.fraction + local radicalrule_code = rulecodes.radical + local outlinerule_code = rulecodes.outline local rule_callback = callbacks.functions.process_rule @@ -925,8 +925,8 @@ local flushrule, flushsimplerule, flushimage, flushgroup do local f_im = formatters["/Im%d Do"] local f_gr = formatters["/Gp%d Do"] - local s_b <const> = "q" - local s_e <const> = "Q" + local s_b = "q" + local s_e = "Q" local f_v = formatters["[] 0 d 0 J %.6N w 0 0 m %.6N 0 l S"] local f_h = formatters["[] 0 d 0 J %.6N w 0 0 m 0 %.6N l S"] @@ -1071,7 +1071,7 @@ local flushrule, flushsimplerule, flushimage, flushgroup do local img_stream = imagetypes.stream local img_memstream = imagetypes.memstream - local one_bp <const> = 65536 * bpfactor + local one_bp = 65536 * bpfactor local imageresources, n = { }, 0 @@ -1820,8 +1820,8 @@ local f_stream_b_d_u = formatters["%i 0 obj\010<< %s /Length %i >>\010stream\010 local f_stream_b_d_c = formatters["%i 0 obj\010<< %s /Filter /FlateDecode /Length %i >>\010stream\010"] local f_stream_b_d_r = formatters["%i 0 obj\010<< %s >>\010stream\010"] ------ s_object_e <const> = "\010endobj\010" -local s_stream_e <const> = "\010endstream\010endobj\010" +----- s_object_e = "\010endobj\010" +local s_stream_e = "\010endstream\010endobj\010" do @@ -1874,8 +1874,8 @@ local addtocache, flushcache, cache do local coffset = 0 local indices = { } - local maxsize <const> = 32 * 1024 -- uncompressed - local maxcount <const> = 0xFF + local maxsize = 32 * 1024 -- uncompressed + local maxcount = 0xFF addtocache = function(n,str) local size = #str @@ -2457,8 +2457,8 @@ updaters.register("backend.update.pdf",function() local lastindex = 0 local indices = { } - local bpfactor <const> = number.dimenfactors.bp - local imagerule_code <const> = rulecodes.image + local bpfactor = number.dimenfactors.bp + local imagerule_code = rulecodes.image function codeinjections.newimage(specification) return specification diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv index 5b3b0e41e..f624f8bc6 100644 --- a/tex/context/base/mkiv/math-ini.mkiv +++ b/tex/context/base/mkiv/math-ini.mkiv @@ -2780,8 +2780,9 @@ % % 0x002B=plus 0x2212=minus 0x2013=endash -\unexpanded\def\mathplus {+} -\unexpanded\def\mathminus{\ifmmode –\else\iffontchar\font`−−\else –\fi\fi} +\unexpanded\def\mathplus {+} +\unexpanded\def\mathminus {\ifmmode –\else\iffontchar\font`−−\else –\fi\fi} +\unexpanded\def\mathplusminus{±} %D The \type {\displaywidth} is only known inside a display formula, so we need to catch %D it when still zero. diff --git a/tex/context/base/mkiv/math-ini.mkxl b/tex/context/base/mkiv/math-ini.mkxl index 92fea4ce1..00f70cf07 100644 --- a/tex/context/base/mkiv/math-ini.mkxl +++ b/tex/context/base/mkiv/math-ini.mkxl @@ -2740,8 +2740,9 @@ % % 0x002B=plus 0x2212=minus 0x2013=endash -\unexpanded\def\mathplus {+} -\unexpanded\def\mathminus{\ifmmode –\orelse\iffontchar\font`−−\else –\fi} +\unexpanded\def\mathplus {+} +\unexpanded\def\mathminus {\ifmmode –\else\iffontchar\font`−−\else –\fi\fi} +\unexpanded\def\mathplusminus{±} %D The \type {\displaywidth} is only known inside a display formula, so we need to catch %D it when still zero. @@ -2956,6 +2957,27 @@ %D %D we also need the next line to disable character escaping via \type {^} in %D math mode: +%D +%D \startbuffer +%D \blank \hbox{ +%D \ruledhbox{${\tf X} ^1 _2 ^^3 __4$} +%D \ruledhbox{${\tf X} ^1 $} +%D \ruledhbox{${\tf X} _2 $} +%D \ruledhbox{${\tf X} ^^3 $} +%D \ruledhbox{${\tf X} __4$} +%D \ruledhbox{${\tf X} ^1 _2 $} +%D \ruledhbox{${\tf X} ^1 ^^3 $} +%D \ruledhbox{${\tf X} ^1 __4$} +%D \ruledhbox{${\tf X} _2 ^^3 $} +%D \ruledhbox{${\tf X} _2 __4$} +%D \ruledhbox{${\tf X} ^1 _2 ^^3 $} +%D \ruledhbox{${\tf X} ^1 _2 __4$} +%D \ruledhbox{${\tf X} _2 ^^3 $} +%D \ruledhbox{${\tf X} _2 ^^3 __4$} +%D \ruledhbox{${\tf X} ^^3 __4$} +%D } \blank +%D +%D \typebuffer \getbuffer \normalsupmarkmode\plusone % 2 also disable ^[^+] in text mode diff --git a/tex/context/base/mkiv/mlib-scn.lua b/tex/context/base/mkiv/mlib-scn.lua index cb70091b4..5655c507d 100644 --- a/tex/context/base/mkiv/mlib-scn.lua +++ b/tex/context/base/mkiv/mlib-scn.lua @@ -74,22 +74,22 @@ local injecttransform = injectors.transform local report = logs.reporter("metapost") -local semicolon_code <const> = codes.semicolon -local equals_code <const> = codes.equals -local comma_code <const> = codes.comma -local colon_code <const> = codes.colon -local leftbrace_code <const> = codes.leftbrace -local rightbrace_code <const> = codes.rightbrace -local leftbracket_code <const> = codes.leftbracket -local rightbracket_code <const> = codes.rightbracket -local leftdelimiter_code <const> = codes.leftdelimiter -local rightdelimiter_code <const> = codes.rightdelimiter -local numeric_code <const> = codes.numeric -local string_code <const> = codes.string -local capsule_code <const> = codes.capsule -local nullary_code <const> = codes.nullary -local tag_code <const> = codes.tag -local definedmacro_code <const> = codes.definedmacro +local semicolon_code = codes.semicolon +local equals_code = codes.equals +local comma_code = codes.comma +local colon_code = codes.colon +local leftbrace_code = codes.leftbrace +local rightbrace_code = codes.rightbrace +local leftbracket_code = codes.leftbracket +local rightbracket_code = codes.rightbracket +local leftdelimiter_code = codes.leftdelimiter +local rightdelimiter_code = codes.rightdelimiter +local numeric_code = codes.numeric +local string_code = codes.string +local capsule_code = codes.capsule +local nullary_code = codes.nullary +local tag_code = codes.tag +local definedmacro_code = codes.definedmacro local typescanners = nil local tokenscanners = nil @@ -750,9 +750,9 @@ local scandimension = scanners.dimension local definitions = { } -local bpfactor <const> = number.dimenfactors.bp -local comma <const> = byte(",") -local close <const> = byte("]") +local bpfactor = number.dimenfactors.bp +local comma = byte(",") +local close = byte("]") local scanrest = function() return scanvalue(comma,close) or "" end local scandimension = function() return scandimension() * bpfactor end diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index ae7c750bd..ec65d6a7c 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -413,6 +413,7 @@ return { "startdmath", "stopdmath", "normalstartdmath", "normalstopdmath", "normalsuperscript", "normalsubscript", "normalnosuperscript", "normalnosubscript", "superscript", "subscript", "nosuperscript", "nosubscript", + "superprescript", "subprescript", "nosuperprescript", "nosubsprecript", -- "uncramped", "cramped", "mathstyletrigger", "triggermathstyle", diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index bd772bbe8..5a77349c5 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -293,6 +293,7 @@ return { "hyphenpenaltymode", "ifabsdim", "ifabsnum", + "ifboolean", "ifchkdim", "ifchknum", "ifcmpdim", @@ -327,16 +328,14 @@ return { "luabytecode", "luabytecodecall", "luacopyinputnodes", - "luacountfunction", "luadef", - "luadimenfunction", "luaescapestring", "luafunction", "luafunctioncall", - "luaskipfunction", "luatexbanner", "luatexrevision", "luatexversion", + "luavaluefunction", "mathdelimitersmode", "mathdirection", "mathdisplayskipmode", diff --git a/tex/context/base/mkiv/phys-dim.lua b/tex/context/base/mkiv/phys-dim.lua index 363b4a79c..54f6c3c83 100644 --- a/tex/context/base/mkiv/phys-dim.lua +++ b/tex/context/base/mkiv/phys-dim.lua @@ -68,7 +68,10 @@ local math_one = Cs((P("$") /"") * (1-P("$"))^1 * (P("$")/"")) / contex local math_two = Cs((P("\\m {")/"") * (1-P("}"))^1 * (P("}")/"")) / context.m -- watch the space after \m local digit = R("09") -local sign = S("+-") +local plus = P("+") +local minus = P("-") +local plusminus = P("±") +local sign = plus + minus local power = S("^e") local digitspace = S("~@_") local comma = P(",") @@ -80,8 +83,6 @@ local positive = P("++") -- was p local negative = P("--") -- was n local highspace = P("//") -- was s local padding = P("=") -local plus = P("+") -local minus = P("-") local space = P(" ") local lparent = P("(") local rparent = P(")") @@ -111,6 +112,7 @@ local dnegative = negative / "" / context.digitsnegative local dhighspace = highspace / "" / context.digitshighspace local dsomesign = plus / "" / context.digitsplus + minus / "" / context.digitsminus + + plusminus / "" / context.digitsplusminus local dpower = power / "" * ( powerdigits + lbrace * powerdigits * rbrace ) local dpadding = padding / "" / context.digitszeropadding -- todo @@ -152,7 +154,8 @@ local c_p = (ddigitspace^1 * dskipcomma)^0 -- ___, * (ddigitspace^0 * ddigit * dintercomma)^0 -- _00, 000, * ddigitspace^0 * ddigit^0 -- _00 000 * ( - dfinalperiod * ddigit * (dintercomma * ddigit)^0 -- .00 + dfinalperiod * ddigit^1 * dpadding^1 -- .0= + + dfinalperiod * ddigit * (dintercomma * ddigit)^0 -- .00 + dskipperiod * dpadding^1 -- .== + dsemiperiod * ddigit * (dintercomma * ddigit)^0 -- :00 + dsemiperiod * dpadding^1 -- :== @@ -163,7 +166,8 @@ local p_c = (ddigitspace^1 * dskipperiod)^0 -- ___. * (ddigitspace^0 * ddigit * dinterperiod)^0 -- _00. 000. * ddigitspace^0 * ddigit^0 -- _00 000 * ( - dfinalcomma * ddigit * (dinterperiod * ddigit)^0 -- 00 + dfinalcomma * ddigit^1 * dpadding^1 -- ,0= + + dfinalcomma * ddigit * (dinterperiod * ddigit)^0 -- 00 + dskipcomma * dpadding^1 -- ,== + dsemicomma * ddigit * (dinterperiod * ddigit)^0 -- :00 + dsemicomma * dpadding^1 -- :== @@ -531,9 +535,14 @@ local ctx_unitsO = context.unitsO local ctx_unitsN = context.unitsN local ctx_unitsC = context.unitsC local ctx_unitsQ = context.unitsQ +local ctx_unitsRPM = context.unitsRPM +local ctx_unitsRTO = context.unitsRTO +local ctx_unitsRabout = context.unitsRabout local ctx_unitsNstart = context.unitsNstart local ctx_unitsNstop = context.unitsNstop local ctx_unitsNspace = context.unitsNspace +local ctx_unitsPopen = context.unitsPopen +local ctx_unitsPclose = context.unitsPclose local labels = languages.data.labels @@ -856,35 +865,58 @@ local function update_parsers() -- todo: don't remap utf sequences )^1, } + -- todo: avoid \ctx_unitsNstart\ctx_unitsNstop (weird that it can happen .. now catched at tex end) -- local number = lpeg.patterns.number - local number = Cs( P("$") * (1-P("$"))^1 * P("$") + P([[\m{]]) * (1-P("}"))^1 * P("}") + (1-R("az","AZ")-P(" "))^1 -- todo: catch { } -- not ok ) / ctx_unitsN - local start = Cc(nil) / ctx_unitsNstart - local stop = Cc(nil) / ctx_unitsNstop - local space = Cc(nil) / ctx_unitsNspace - - -- todo: avoid \ctx_unitsNstart\ctx_unitsNstop (weird that it can happen .. now catched at tex end) - - local p_c_combinedparser = P { "start", - number = start * dleader * (p_c_dparser + number) * stop, - rule = V("number")^-1 * unitparser, - space = space, - start = V("rule") * (V("space") * V("rule"))^0 + V("number") - } - - local c_p_combinedparser = P { "start", - number = start * dleader * (c_p_dparser + number) * stop, - rule = V("number")^-1 * unitparser, - space = space, - start = V("rule") * (V("space") * V("rule"))^0 + V("number") - } + local start = Cc(nil) / ctx_unitsNstart + local stop = Cc(nil) / ctx_unitsNstop + local space = P(" ") * Cc(nil) / ctx_unitsNspace + local open = P("(") * Cc(nil) / ctx_unitsPopen + local close = P(")") * Cc(nil) / ctx_unitsPclose + + local range = somespace + * ( (P("±") + P("pm")) / "" / ctx_unitsRPM + + (P("–") + P("to")) / "" / ctx_unitsRTO ) + * somespace + + local about = (P("±") + P("pm")) / "" / ctx_unitsRabout + * somespace + + -- todo: start / stop + + local function combine(parser) + return P { "start", + number = start * dleader * (parser + number) * stop, + anumber = space + * open + * V("about")^-1 + * V("number") + * close, + rule = V("number")^-1 + * (V("range") * V("number") + V("anumber"))^-1, + unit = unitparser, + about = about, + range = range, + space = space, + start = V("rule") + * V("unit") + * (V("space") * V("rule") * V("unit"))^0 + + open + * V("number") + * (V("range") * V("number"))^-1 + * close + * dtrailer^-1 + * V("unit") + + V("number") + } + end - return p_c_combinedparser, c_p_combinedparser + return combine(p_c_dparser), combine(c_p_dparser) end local p_c_parser = nil diff --git a/tex/context/base/mkiv/phys-dim.mkiv b/tex/context/base/mkiv/phys-dim.mkiv index 1eb1f37f7..f17861405 100644 --- a/tex/context/base/mkiv/phys-dim.mkiv +++ b/tex/context/base/mkiv/phys-dim.mkiv @@ -86,7 +86,6 @@ %D the grouped call. %D %D \starttabulate[|l|l|l|] -%D \starttabulate[|l|l|l|] %D \NC \type{.} \NC , . \NC comma or period \NC \NR %D \NC \type{,} \NC , . \NC comma or period \NC \NR %D \NC \type{:} \NC \NC invisible period \NC \NR @@ -100,7 +99,6 @@ %D \NC \type{++} \NC $\positive$ \NC high plus sign \NC \NR %D \NC \type{=} \NC $\zeroamount$ \NC zero padding \NC \NR %D \stoptabulate -%D \stoptabulate %D %D These triggers are used in the following examples. %D @@ -172,10 +170,12 @@ % \definesymbol[units][times][\ifmmode\cdot\else\kern.2\emwidth\cdot\kern.2\emwidth\fi] \unexpanded\def\digitstextbinop#1% assumes preceding - {\fourperemspace\nobreak\times\fourperemspace} + {\ifmmode#1\else\fourperemspace\nobreak#1\fourperemspace\fi} %def\digitstimessymbol{\ifmmode\cdot\else\digitstextbinop\cdot\fi} -\def\digitstimessymbol{\ifmmode\times\else\digitstextbinop\times\fi} +\def\digitstimessymbol{\digitstextbinop\times} + +\unexpanded\def\mathplusminus{±} % will be in math-ini \unexpanded\def\digitszeropadding {\hphantom{0}} \unexpanded\def\digitsnegative {\phys_digits_normalized{0}{\phys_digits_raised{\textminus}}} @@ -185,7 +185,8 @@ %unexpanded\def\digitsminus {\phys_digits_normalized{0}{\mathematics{-}}} %unexpanded\def\digitsplus {\phys_digits_normalized{0}{\mathematics{+}}} \unexpanded\def\digitsminus {\phys_digits_normalized{0}{\mathminus}} -\unexpanded\def\digitsplus {\phys_digits_normalized{0}{\mathplus }} +\unexpanded\def\digitsplus {\phys_digits_normalized{0}{\mathplus}} +\unexpanded\def\digitsplusminus {\phys_digits_normalized{0}{\mathplusminus}} \unexpanded\def\digitsspace {\hphantom{0}} \unexpanded\def\digitsseparatorspace{\hphantom{.}} \unexpanded\def\digitssignspace {\hphantom{\digitsminus}} @@ -522,6 +523,9 @@ {\edef\p_order{\unitparameter\c!order}% \ifx\p_order\v!reverse\expandafter\clf_unit_reverse\else\expandafter\clf_unit_normal\fi{\detokenize{#1}}} +\unexpanded\def\digitstextbinnop#1% + {\ifmmode#1\else#1\fourperemspace\fi} + \unexpanded\def\unitsPUS#1#2#3{\phys_units_next\prefixtext{#1}\unittext{#2}\unitsraise{\suffixtext{#3}}\c_phys_units_state\plusone} % suffix \unexpanded\def\unitsPU #1#2{\phys_units_next\prefixtext{#1}\unittext{#2}\c_phys_units_state\plusthree} % unit \unexpanded\def\unitsPS #1#2{\phys_units_next\prefixtext{#1}\unitsraise{\suffixtext{#2}}\c_phys_units_state\plusone} % suffix @@ -531,8 +535,28 @@ \unexpanded\def\unitsS #1{\phys_units_start{}\unitsraise{\suffixtext{#1}}\c_phys_units_state\plusone} % suffix \unexpanded\def\unitsO #1{\phys_units_start\operatortext{#1}\c_phys_units_state\plustwo} % operator \unexpanded\def\unitsN #1{\phys_units_start#1\c_phys_units_state\plusfive} % number -\unexpanded\def\unitsC #1{\removeunwantedspaces\unittext{#1}\c_phys_units_state\plussix} % connected -\unexpanded\def\unitsQ #1{\removeunwantedspaces\unitslower{#1}\c_phys_units_state\zerocount} % +\unexpanded\def\unitsC #1{\removeunwantedspaces\unittext{#1}\c_phys_units_state\plussix} % connected +\unexpanded\def\unitsQ #1{\removeunwantedspaces\unitslower{#1}\c_phys_units_state\zerocount} +\unexpanded\def\unitsR #1#2{% todo: tagging + \ifmmode + #2% + \else\ifnum#1=\plusone + \digitstextbinop{#2}% before and after + \else + \digitstextbinnop{#2}% after + \fi\fi + \c_phys_units_state\zerocount + \setfalse\c_phys_units_dospace + \setfalse\c_phys_units_number + \setfalse\c_phys_units_quantity} + +\unexpanded\def\unitsRPM {\unitsR\plusone {±}} % todo: symbols +\unexpanded\def\unitsRTO {\unitsR\plusone {–}} % todo: symbols +\unexpanded\def\unitsRabout {\unitsR\zerocount{±}} % todo: symbols +\unexpanded\def\unitsPopen {(} +\unexpanded\def\unitsPclose {)} + +\unexpanded\def\unitrange#1{} % Fonts can have a celsius and lack a fahrenheit symbol and as we want % to be consistent so we check for the counterparts as well. It's slow diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 36d0aefae..fe106c62b 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 75a0e6ac8..551550e7d 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/supp-mat.mkiv b/tex/context/base/mkiv/supp-mat.mkiv index f3b94f735..bb2488494 100644 --- a/tex/context/base/mkiv/supp-mat.mkiv +++ b/tex/context/base/mkiv/supp-mat.mkiv @@ -319,4 +319,11 @@ \let\nosuperscript\Unosuperscript \let\nosubscript \Unosubscript +% only in luametatex: + +\let\superprescript \Usuperprescript +\let\subprescript \Usubprescript +\let\nosuperprescript\Unosuperprescript +\let\nosubsprecript \Unosubprescript + \protect \endinput diff --git a/tex/context/base/mkiv/syst-lua.lua b/tex/context/base/mkiv/syst-lua.lua index 5911d7f00..d42ef946c 100644 --- a/tex/context/base/mkiv/syst-lua.lua +++ b/tex/context/base/mkiv/syst-lua.lua @@ -288,23 +288,23 @@ local function expression() end end --- local letter_code <const> = cmd.letter --- local other_char_code <const> = cmd.other_char --- local spacer_code <const> = cmd.spacer --- local other_char_code <const> = cmd.other_char --- local relax_code <const> = cmd.relax --- local assign_int_code <const> = cmd.assign_int --- local assign_dimen_code <const> = cmd.assign_dimen --- local assign_glue_code <const> = cmd.assign_glue --- local assign_toks_code <const> = cmd.assign_toks --- local char_given_code <const> = cmd.char_given --- local math_given_code <const> = cmd.math_given --- local xmath_given_code <const> = cmd.xmath_given --- local last_item_code <const> = cmd.last_item --- local call_code <const> = cmd.call --- local the_code <const> = cmd.the --- local convert_code <const> = cmd.convert --- local lua_expandable_call_code <const> = cmd.lua_expandable_call +-- 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) diff --git a/tex/context/base/mkiv/syst-lua.mkxl b/tex/context/base/mkiv/syst-lua.mkxl index cf20c3341..ae0de0f22 100644 --- a/tex/context/base/mkiv/syst-lua.mkxl +++ b/tex/context/base/mkiv/syst-lua.mkxl @@ -50,7 +50,7 @@ %D We can omit the tex.ctxcatcodes here as nowadays we seldom change the regime at %D the \TEX\ end: -%def\luaexpr#1{\ctxlua{context (tostring(#1))}} % more efficient: +%def\luaexpr#1{\ctxlua{context (tostring(#1))}} % more efficient: \def\luaexpr#1{\ctxlua{tex.print(tostring(#1))}} % no use is shortcutting has to be compiled %D But as we only use write 16 we could as well do all in \LUA\ and ignore the rest. diff --git a/tex/context/base/mkiv/toks-ini.lua b/tex/context/base/mkiv/toks-ini.lua index 594fb4743..f38cf915f 100644 --- a/tex/context/base/mkiv/toks-ini.lua +++ b/tex/context/base/mkiv/toks-ini.lua @@ -18,64 +18,77 @@ local printtable = table.print local concat = table.concat local format = string.format -if token.commands then +if token.values then - local commands = token.commands() + local commands = token.values("command") + local values = token.values("value") + values.dimen = values.dimension + values.count = values.integer + tokens.values = utilities.storage.allocate(table.swapped(values, values)) + tokens.commands = utilities.storage.allocate(table.swapped(commands,commands)) + +elseif token.commands then + local commands = token.commands() tokens.commands = utilities.storage.allocate(table.swapped(commands,commands)) + tokens.values = { } else tokens.commands = { } + tokens.values = { } end -local scan_toks = token.scan_toks -local scan_string = token.scan_string -local scan_argument = token.scan_argument -local scan_tokenlist = token.scan_tokenlist -local scan_int = token.scan_int -local scan_code = token.scan_code -local scan_token_code = token.scan_token_code -local scan_dimen = token.scan_dimen -local scan_glue = token.scan_glue -local scan_gluespec = token.scan_skip -local scan_keyword = token.scan_keyword -local scan_keyword_cs = token.scan_keyword_cs or scan_keyword -local scan_token = token.scan_token -local scan_box = token.scan_box -local scan_word = token.scan_word -local scan_key = token.scan_key -local scan_value = token.scan_value -local scan_char = token.scan_char -local scan_number = token.scan_number -local scan_csname = token.scan_csname -local scan_real = token.scan_real -local scan_float = token.scan_float - -local get_next = token.get_next -local get_next_token = token.get_next_token -local skip_next = token.skip_next -local peek_next_char = token.peek_next_char -local is_next_char = token.is_next_char - -local set_macro = token.set_macro -local get_macro = token.get_macro -local get_meaning = token.get_meaning -local get_cmdname = token.get_cmdname -local set_char = token.set_char -local set_lua = token.set_lua - -local create_token = token.create -local new_token = token.new -local is_defined = token.is_defined -local is_token = token.is_token - -tokens.new = new_token -tokens.create = create_token -tokens.istoken = is_token -tokens.isdefined = is_defined -tokens.defined = is_defined +local scan_toks = token.scan_toks +local scan_string = token.scan_string +local scan_argument = token.scan_argument +local scan_tokenlist = token.scan_tokenlist +local scan_int = token.scan_int +local scan_code = token.scan_code +local scan_token_code = token.scan_token_code +local scan_dimen = token.scan_dimen +local scan_glue = token.scan_glue +local scan_gluespec = token.scan_skip +local scan_keyword = token.scan_keyword +local scan_keyword_cs = token.scan_keyword_cs or scan_keyword +local scan_token = token.scan_token +local scan_box = token.scan_box +local scan_word = token.scan_word +local scan_key = token.scan_key +local scan_value = token.scan_value +local scan_char = token.scan_char +local scan_number = token.scan_number -- not defined +local scan_csname = token.scan_csname +local scan_real = token.scan_real +local scan_float = token.scan_float +local scan_luanumber = token.scan_luanumber or scan_float -- only lmtx +local scan_luainteger = token.scan_luainteger or scan_int -- only lmtx +local scan_luacardinal = token.scan_luacardinal or scan_int -- only lmtx + +local get_next = token.get_next +local get_next_token = token.get_next_token +local skip_next = token.skip_next +local peek_next_char = token.peek_next_char +local is_next_char = token.is_next_char + +local set_macro = token.set_macro +local get_macro = token.get_macro +local get_meaning = token.get_meaning +local get_cmdname = token.get_cmdname +local set_char = token.set_char +local set_lua = token.set_lua + +local create_token = token.create +local new_token = token.new +local is_defined = token.is_defined +local is_token = token.is_token + +tokens.new = new_token +tokens.create = create_token +tokens.istoken = is_token +tokens.isdefined = is_defined +tokens.defined = is_defined local bits = { escape = 0x00000001, -- 2^00 @@ -155,39 +168,42 @@ if not scan_box then end tokens.scanners = { -- these expand - token = scan_token, - toks = scan_toks, - tokens = scan_toks, - box = scan_box, - hbox = function() return scan_box("hbox") end, - vbox = function() return scan_box("vbox") end, - vtop = function() return scan_box("vtop") end, - dimen = scan_dimen, - dimension = scan_dimen, - glue = scan_glue, - gluespec = scan_gluespec, - integer = scan_int, - real = scan_real, - float = scan_float, - count = scan_int, - string = scan_string, - argument = scan_argument, - tokenlist = scan_tokenlist, - verbatim = scan_verbatim, - code = scan_code, - tokencode = scan_token_code, - word = scan_word, - key = scan_key, - value = scan_value, - char = scan_char, - number = scan_number, - boolean = scan_boolean, - keyword = scan_keyword, - keywordcs = scan_keyword_cs, - csname = scan_csname, - peek = peek_next_char, - skip = skip_next, - ischar = is_next_char, + token = scan_token, + toks = scan_toks, + tokens = scan_toks, + box = scan_box, + hbox = function() return scan_box("hbox") end, + vbox = function() return scan_box("vbox") end, + vtop = function() return scan_box("vtop") end, + dimen = scan_dimen, + dimension = scan_dimen, + glue = scan_glue, + gluespec = scan_gluespec, + integer = scan_int, + real = scan_real, + float = scan_float, + luanumber = scan_luanumber, + luainteger = scan_luainteger, + luacardinal = scan_luacardinal, + count = scan_int, + string = scan_string, + argument = scan_argument, + tokenlist = scan_tokenlist, + verbatim = scan_verbatim, + code = scan_code, + tokencode = scan_token_code, + word = scan_word, + key = scan_key, + value = scan_value, + char = scan_char, + number = scan_number, + boolean = scan_boolean, + keyword = scan_keyword, + keywordcs = scan_keyword_cs, + csname = scan_csname, + peek = peek_next_char, + skip = skip_next, + ischar = is_next_char, } tokens.getters = { -- these don't expand diff --git a/tex/context/base/mkiv/toks-scn.lua b/tex/context/base/mkiv/toks-scn.lua index fcbdec5a0..09c3e13b2 100644 --- a/tex/context/base/mkiv/toks-scn.lua +++ b/tex/context/base/mkiv/toks-scn.lua @@ -115,7 +115,8 @@ local function scantable(t,data) end local wrapped = scanopen() while true do - local key = scanword() +-- local key = scanword() + local key = scanword(true) if key then local get = t[key] if get then @@ -253,12 +254,12 @@ local f_scan_c = formatters["%s(scan%s())"] ----- f_if_c = formatters[" local key = scanword() if key == '' then break elseif key == '%s' then data['%s'] = %s(scan%s())"] ----- f_elseif_c = formatters[" elseif k == '%s' then data['%s'] = %s(scan%s())"] -local f_any = formatters[" else local key = scanword() if key then data[key] = scan%s() else break end end"] -local f_any_c = formatters[" else local key = scanword() if key then data[key] = %s(scan%s()) else break end end"] +local f_any = formatters[" else local key = scanword(true) if key then data[key] = scan%s() else break end end"] +local f_any_c = formatters[" else local key = scanword(true) if key then data[key] = %s(scan%s()) else break end end"] local s_done = " else break end" -local f_any_all = formatters[" local key = scanword() if key then data[key] = scan%s() else break end"] -local f_any_all_c= formatters[" local key = scanword() if key then data[key] = %s(scan%s()) else break end"] +local f_any_all = formatters[" local key = scanword(true) if key then data[key] = scan%s() else break end"] +local f_any_all_c= formatters[" local key = scanword(true) if key then data[key] = %s(scan%s()) else break end"] local f_table = formatters["%\nt\nreturn function()\n local data = { }\n%s\n return %s\nend\n"] local f_sequence = formatters["%\nt\n%\nt\n%\nt\nreturn function()\n return %s\nend\n"] @@ -440,7 +441,7 @@ function tokens.compile(specification) return scanners[ti] end elseif #t == 0 then - if specification.valuetype then + if specification.value then code = "b" args = "_,b" else diff --git a/tex/context/base/mkiv/toks-scn.mkiv b/tex/context/base/mkiv/toks-scn.mkiv index 49edf0c24..12abf0cb8 100644 --- a/tex/context/base/mkiv/toks-scn.mkiv +++ b/tex/context/base/mkiv/toks-scn.mkiv @@ -19,4 +19,8 @@ \registerctxluafile{cldf-scn}{} \registerctxluafile{cldf-stp}{} +\ifcase \contextlmtxmode \else + \registerctxluafile{cldf-lmt}{} +\fi + \protect \endinput diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index ee6621f44..6c07e67f2 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-05-08 20:46 +-- merge date : 2020-05-12 16:17 do -- begin closure to overcome local limits and interference |