summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/char-tex.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-06-02 23:42:05 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-06-02 23:42:05 +0200
commitac0e3262fb027e4ab586204bf2d5a05e9a831933 (patch)
treeaa43c752abe60ee65a9a9b09b32fa19ee10bd787 /tex/context/base/mkiv/char-tex.lua
parente52e58ff4a7007ca774905727391e5f78135f98d (diff)
downloadcontext-ac0e3262fb027e4ab586204bf2d5a05e9a831933.tar.gz
2018-06-02 22:41:00
Diffstat (limited to 'tex/context/base/mkiv/char-tex.lua')
-rw-r--r--tex/context/base/mkiv/char-tex.lua18
1 files changed, 13 insertions, 5 deletions
diff --git a/tex/context/base/mkiv/char-tex.lua b/tex/context/base/mkiv/char-tex.lua
index 065152881..66997a647 100644
--- a/tex/context/base/mkiv/char-tex.lua
+++ b/tex/context/base/mkiv/char-tex.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['char-tex'] = {
local lpeg = lpeg
local tonumber, next, type = tonumber, next, type
-local format, find, gmatch = string.format, string.find, string.gmatch
+local format, find, gmatch, match = string.format, string.find, string.gmatch, string.match
local utfchar, utfbyte = utf.char, utf.byte
local concat, tohash = table.concat, table.tohash
local P, C, R, S, V, Cs, Cc = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.V, lpeg.Cs, lpeg.Cc
@@ -462,16 +462,24 @@ function commands.makeactive(n,name) -- not used
-- context("\\catcode%s=13\\unexpanded\\def %s{\\%s}",n,utfchar(n),name)
end
+local function to_number(s)
+ local n = tonumber(s)
+ if n then
+ return n
+ end
+ return tonumber(match(s,'^"(.*)$'),16) or 0
+end
+
implement {
name = "utfchar",
- actions = { utfchar, contextsprint },
- arguments = "integer"
+ actions = { to_number, utfchar, contextsprint },
+ arguments = "string"
}
implement {
name = "safechar",
- actions = { texcharacters.safechar, contextsprint },
- arguments = "integer"
+ actions = { to_number, texcharacters.safechar, contextsprint },
+ arguments = "string"
}
implement {