From 128b005cd8b44483ce2a58bd0cf078318663c696 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 19 Feb 2016 08:10:26 +0100 Subject: [parsers] allow whitespace around combo elements This gives more leeway to the notation, allowing font definitions to become more readable: \font \f = "combo: 1 / \fontid\one, 2 / \fontid\two / 0x41-0x5a, 3 / \fontid\three / 0x42, 4 / \fontid\three / 0x54 * 69 * U+58" --- src/luaotfload-parsers.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/luaotfload-parsers.lua') diff --git a/src/luaotfload-parsers.lua b/src/luaotfload-parsers.lua index 5ebe8d5..0f87256 100644 --- a/src/luaotfload-parsers.lua +++ b/src/luaotfload-parsers.lua @@ -575,19 +575,22 @@ local modifier_list = Cg(Ct(modifier^0), "modifiers") --- | | --- chars : ------------+--------------+ --- +local comborowsep = ws * comma * ws +local combocolsep = ws * slash * ws +local comborangesep = ws * asterisk * ws local combohex = hex / tonumber local combouint = digit^1 / tonumber local tonumber16 = function (s) return tonumber (s, 16) end local combouni = P"U+" * (digit^1 / tonumber16) local combonum = combohex + combouni + combouint local comborange = Ct(combonum * dash * combonum) + combonum -local combochars = comborange * (asterisk * comborange)^0 -local combodef1 = Ct( Cg(combouint, "idx") --> no chars - * slash * Cg(combouint, "id" )) -local combodef = Ct( Cg(combouint, "idx" ) - * slash * Cg(combouint, "id" ) - * slash * Cg(Ct(combochars^1), "chars")) -local combolist = Ct(combodef1 * (comma * combodef)^1) +local combochars = comborange * (comborangesep * comborange)^0 +local combodef1 = Ct( Cg(combouint, "idx") --> no chars + * combocolsep * Cg(combouint, "id" )) +local combodef = Ct( Cg(combouint, "idx" ) + * combocolsep * Cg(combouint, "id" ) + * combocolsep * Cg(Ct(combochars^1), "chars")) +local combolist = Ct(combodef1 * (comborowsep * combodef)^1) --- lookups ----------------------------------------------------------- local fontname = C((1-S":(/")^1) --- like luatex-fonts local unsupported = Cmt((1-S":(")^1, check_garbage) -- cgit v1.2.3