summaryrefslogtreecommitdiff
path: root/tex/context/base/cldf-prs.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-03-15 20:40:14 +0200
committerMarius <mariausol@gmail.com>2013-03-15 20:40:14 +0200
commit792b2ca2d206c2c90cc9967a8ae4916f53f902d7 (patch)
tree61a6b50fcad361326d0a7e6c305ab9d291d699e7 /tex/context/base/cldf-prs.lua
parent5649bfe8b7ccdd5a8b02951fc9f6a0dbbdf48256 (diff)
downloadcontext-792b2ca2d206c2c90cc9967a8ae4916f53f902d7.tar.gz
beta 2013.03.15 19:22
Diffstat (limited to 'tex/context/base/cldf-prs.lua')
-rw-r--r--tex/context/base/cldf-prs.lua27
1 files changed, 15 insertions, 12 deletions
diff --git a/tex/context/base/cldf-prs.lua b/tex/context/base/cldf-prs.lua
index 42757be19..be3f190f7 100644
--- a/tex/context/base/cldf-prs.lua
+++ b/tex/context/base/cldf-prs.lua
@@ -25,18 +25,21 @@ local superscript = P("^")
local utf8char = patterns.utf8char
local cardinal = patterns.cardinal
--- local content = Cs(csname + nested + sign^-1 * (csname + cardinal + utf8char))
--- local lowfirst = subscript * ( Cc("\\lohi{%s}{%s}") * content * superscript + Cc("\\low{%s}" ) ) * content / format
--- local highfirst = superscript * ( Cc("\\hilo{%s}{%s}") * content * subscript + Cc("\\high{%s}") ) * content / format
--- local scripts = Cs(lowfirst + highfirst)
+-- local scripts = P { "start",
+-- start = V("csname") + V("lowfirst") + V("highfirst"),
+-- csname = csname,
+-- content = Cs(V("csname") + nested + sign^-1 * (cardinal + utf8char)),
+-- lowfirst = subscript * ( Cc("\\lohi{%s}{%s}") * V("content") * superscript + Cc("\\low{%s}" ) ) * V("content") / format,
+-- highfirst = superscript * ( Cc("\\hilo{%s}{%s}") * V("content") * subscript + Cc("\\high{%s}") ) * V("content") / format,
+-- }
local scripts = P { "start",
- start = V("csname") + V("lowfirst") + V("highfirst"),
- csname = csname,
- content = Cs(V("csname") + nested + sign^-1 * (cardinal + utf8char)),
- lowfirst = subscript * ( Cc("\\lohi{%s}{%s}") * V("content") * superscript + Cc("\\low{%s}" ) ) * V("content") / format,
- highfirst = superscript * ( Cc("\\hilo{%s}{%s}") * V("content") * subscript + Cc("\\high{%s}") ) * V("content") / format,
- }
+ start = V("csname") + V("lowfirst") + V("highfirst"),
+ csname = csname,
+ content = Cs(V("csname") + nested + sign^-1 * (cardinal + utf8char)),
+ lowfirst = (subscript /"") * ( Cc("\\lohi{") * V("content") * Cc("}{") * (superscript/"") + Cc("\\low{" ) ) * V("content") * Cc("}"),
+ highfirst = (superscript/"") * ( Cc("\\hilo{") * V("content") * Cc("}{") * (subscript /"") + Cc("\\high{") ) * V("content") * Cc("}"),
+ }
local scripted = Cs((csname + scripts + utf8char)^0)
@@ -47,6 +50,6 @@ cpatterns.nested = nested
-- inspect(scripted)
--- print(lpegmatch(scripted,"10^-3"))
--- print(lpegmatch(scripted,"10^-a"))
+print(lpegmatch(scripted,"10^-3_x"))
+print(lpegmatch(scripted,"10^-a"))