summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/toks-map.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-12 17:15:07 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-12 17:15:07 +0100
commit8d8d528d2ad52599f11250cfc567fea4f37f2a8b (patch)
tree94286bc131ef7d994f9432febaf03fe23d10eef8 /tex/context/base/mkiv/toks-map.lua
parentf5aed2e51223c36c84c5f25a6cad238b2af59087 (diff)
downloadcontext-8d8d528d2ad52599f11250cfc567fea4f37f2a8b.tar.gz
2016-01-12 16:26:00
Diffstat (limited to 'tex/context/base/mkiv/toks-map.lua')
-rw-r--r--tex/context/base/mkiv/toks-map.lua70
1 files changed, 70 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/toks-map.lua b/tex/context/base/mkiv/toks-map.lua
new file mode 100644
index 000000000..9120c2084
--- /dev/null
+++ b/tex/context/base/mkiv/toks-map.lua
@@ -0,0 +1,70 @@
+if not modules then modules = { } end modules ['toks-map'] = {
+ version = 1.001,
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- Even more experimental ... this used to be part of toks-ini but as
+-- this kind of remapping has not much use it is not loaded in the
+-- core. We just keep it here for old times sake.
+
+-- local remapper = { } -- namespace
+-- collectors.remapper = remapper
+--
+-- local remapperdata = { } -- user mappings
+-- remapper.data = remapperdata
+--
+-- function remapper.store(tag,class,key)
+-- local s = remapperdata[class]
+-- if not s then
+-- s = { }
+-- remapperdata[class] = s
+-- end
+-- s[key] = collectordata[tag]
+-- collectordata[tag] = nil
+-- end
+--
+-- function remapper.convert(tag,toks)
+-- local data = remapperdata[tag]
+-- local leftbracket = utfbyte('[')
+-- local rightbracket = utfbyte(']')
+-- local skipping = 0
+-- -- todo: math
+-- if data then
+-- local t, n = { }, 0
+-- for s=1,#toks do
+-- local tok = toks[s]
+-- local one, two = tok[1], tok[2]
+-- if one == 11 or one == 12 then
+-- if two == leftbracket then
+-- skipping = skipping + 1
+-- n = n + 1 ; t[n] = tok
+-- elseif two == rightbracket then
+-- skipping = skipping - 1
+-- n = n + 1 ; t[n] = tok
+-- elseif skipping == 0 then
+-- local new = data[two]
+-- if new then
+-- if #new > 1 then
+-- for n=1,#new do
+-- n = n + 1 ; t[n] = new[n]
+-- end
+-- else
+-- n = n + 1 ; t[n] = new[1]
+-- end
+-- else
+-- n = n + 1 ; t[n] = tok
+-- end
+-- else
+-- n = n + 1 ; t[n] = tok
+-- end
+-- else
+-- n = n + 1 ; t[n] = tok
+-- end
+-- end
+-- return t
+-- else
+-- return toks
+-- end
+-- end