diff options
author | Marius <mariausol@gmail.com> | 2012-08-27 18:20:19 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-08-27 18:20:19 +0300 |
commit | 47d1a628ec1cbebf26ac6eeac1cdbdb71009e3fc (patch) | |
tree | 03b44a3953c1c3ae1665f96556bc7022a3eb81aa /scripts | |
parent | ef3bfc9ea7ed3326ea07cd48ccf2c3d8d55ea435 (diff) | |
download | context-47d1a628ec1cbebf26ac6eeac1cdbdb71009e3fc.tar.gz |
beta 2012.08.27 17:12
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 28 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 28 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 28 |
3 files changed, 69 insertions, 15 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index ec6c9c520..234dec9a1 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -1164,7 +1164,22 @@ local report = texio and texio.write_nl or print -- -- local p = C("@") * C("!") / "%2%1" -- lpeg.print(p) print(lpeg.match(p,"@!")) - +-- +-- TRICKY: +-- +-- local P, R, Cs = lpeg.P, lpeg.R, lpeg.Cs +-- +-- local p = Cs(P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end +-- print(lpeg.match(Cs(p),"+10")) +-- +-- local p = P("+")^0 * R("09")^1 * P(-1) / function(s) return "l==" .. s end +-- print(lpeg.match(Cs(p),"+10")) +-- +-- local p = Cs(P("+")^0 * R("09")^1 * P(-1)) / "l==%1" +-- print(lpeg.match(Cs(p),"+10")) +-- +-- local p = P("+")^0 * R("09")^1 * P(-1) / "l==%1" +-- print(lpeg.match(Cs(p),"+10")) -- local lpmatch = lpeg.match -- local lpprint = lpeg.print @@ -9198,10 +9213,13 @@ local lp_builtin = P ( local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * ((R("az","AZ") + S("-_:"))^1) * Cc("'])") ------ lp_fastpos_p = (P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end ------ lp_fastpos_n = (P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end -local lp_fastpos_p = (P("+")^0 * R("09")^1 * P(-1)) / "l==%1" -local lp_fastpos_n = (P("-") * R("09")^1 * P(-1)) / "(%1<0 and (#list+%1==l))" +-- lp_fastpos_p = (P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end +-- lp_fastpos_n = (P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end +-- +-- Cs really needed here: + +lp_fastpos_p = C(P("+")^0 * R("09")^1 * P(-1)) / "l==%1" +lp_fastpos_n = C(P("-") * R("09")^1 * P(-1)) / "(%1<0 and (#list+%1==l))" local lp_fastpos = lp_fastpos_n + lp_fastpos_p diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index ec6c9c520..234dec9a1 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -1164,7 +1164,22 @@ local report = texio and texio.write_nl or print -- -- local p = C("@") * C("!") / "%2%1" -- lpeg.print(p) print(lpeg.match(p,"@!")) - +-- +-- TRICKY: +-- +-- local P, R, Cs = lpeg.P, lpeg.R, lpeg.Cs +-- +-- local p = Cs(P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end +-- print(lpeg.match(Cs(p),"+10")) +-- +-- local p = P("+")^0 * R("09")^1 * P(-1) / function(s) return "l==" .. s end +-- print(lpeg.match(Cs(p),"+10")) +-- +-- local p = Cs(P("+")^0 * R("09")^1 * P(-1)) / "l==%1" +-- print(lpeg.match(Cs(p),"+10")) +-- +-- local p = P("+")^0 * R("09")^1 * P(-1) / "l==%1" +-- print(lpeg.match(Cs(p),"+10")) -- local lpmatch = lpeg.match -- local lpprint = lpeg.print @@ -9198,10 +9213,13 @@ local lp_builtin = P ( local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * ((R("az","AZ") + S("-_:"))^1) * Cc("'])") ------ lp_fastpos_p = (P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end ------ lp_fastpos_n = (P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end -local lp_fastpos_p = (P("+")^0 * R("09")^1 * P(-1)) / "l==%1" -local lp_fastpos_n = (P("-") * R("09")^1 * P(-1)) / "(%1<0 and (#list+%1==l))" +-- lp_fastpos_p = (P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end +-- lp_fastpos_n = (P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end +-- +-- Cs really needed here: + +lp_fastpos_p = C(P("+")^0 * R("09")^1 * P(-1)) / "l==%1" +lp_fastpos_n = C(P("-") * R("09")^1 * P(-1)) / "(%1<0 and (#list+%1==l))" local lp_fastpos = lp_fastpos_n + lp_fastpos_p diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index ec6c9c520..234dec9a1 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -1164,7 +1164,22 @@ local report = texio and texio.write_nl or print -- -- local p = C("@") * C("!") / "%2%1" -- lpeg.print(p) print(lpeg.match(p,"@!")) - +-- +-- TRICKY: +-- +-- local P, R, Cs = lpeg.P, lpeg.R, lpeg.Cs +-- +-- local p = Cs(P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end +-- print(lpeg.match(Cs(p),"+10")) +-- +-- local p = P("+")^0 * R("09")^1 * P(-1) / function(s) return "l==" .. s end +-- print(lpeg.match(Cs(p),"+10")) +-- +-- local p = Cs(P("+")^0 * R("09")^1 * P(-1)) / "l==%1" +-- print(lpeg.match(Cs(p),"+10")) +-- +-- local p = P("+")^0 * R("09")^1 * P(-1) / "l==%1" +-- print(lpeg.match(Cs(p),"+10")) -- local lpmatch = lpeg.match -- local lpprint = lpeg.print @@ -9198,10 +9213,13 @@ local lp_builtin = P ( local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * ((R("az","AZ") + S("-_:"))^1) * Cc("'])") ------ lp_fastpos_p = (P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end ------ lp_fastpos_n = (P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end -local lp_fastpos_p = (P("+")^0 * R("09")^1 * P(-1)) / "l==%1" -local lp_fastpos_n = (P("-") * R("09")^1 * P(-1)) / "(%1<0 and (#list+%1==l))" +-- lp_fastpos_p = (P("+")^0 * R("09")^1 * P(-1)) / function(s) return "l==" .. s end +-- lp_fastpos_n = (P("-") * R("09")^1 * P(-1)) / function(s) return "(" .. s .. "<0 and (#list+".. s .. "==l))" end +-- +-- Cs really needed here: + +lp_fastpos_p = C(P("+")^0 * R("09")^1 * P(-1)) / "l==%1" +lp_fastpos_n = C(P("-") * R("09")^1 * P(-1)) / "(%1<0 and (#list+%1==l))" local lp_fastpos = lp_fastpos_n + lp_fastpos_p |