diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-11-04 15:19:10 +0100 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-11-04 15:19:10 +0100 |
commit | 44ba990b30247a129dbb8b12e8c8154e37b5eb33 (patch) | |
tree | 1f45f18d03a9fda356ed8cb8c4acc590880f0305 /lualibs-util-str.lua | |
parent | 6934dad6de7ea5a8a4d0523d30437eca9843263b (diff) | |
download | lualibs-2.1.tar.gz |
sync with Context as of 2013-11-04v2.1
Diffstat (limited to 'lualibs-util-str.lua')
-rw-r--r-- | lualibs-util-str.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lualibs-util-str.lua b/lualibs-util-str.lua index 09fa26f..24a3f6e 100644 --- a/lualibs-util-str.lua +++ b/lualibs-util-str.lua @@ -614,6 +614,13 @@ end -- +local format_z = function(f) + n = n + (tonumber(f) or 1) + return "''" -- okay, not that efficient to append '' but a special case anyway +end + +-- + local format_rest = function(s) return format("%q",s) -- catches " and \n and such end @@ -671,6 +678,7 @@ local builder = Cs { "start", + V("A") -- new + V("j") + V("J") -- stripped e E + V("m") + V("M") -- new + + V("z") -- new -- + V("*") -- ignores probably messed up % ) @@ -720,6 +728,8 @@ local builder = Cs { "start", ["m"] = (prefix_tab * P("m")) / format_m, -- %m => xxx.xxx.xxx,xx (optional prefix instead of .) ["M"] = (prefix_tab * P("M")) / format_M, -- %M => xxx,xxx,xxx.xx (optional prefix instead of ,) -- + ["z"] = (prefix_any * P("z")) / format_z, -- %M => xxx,xxx,xxx.xx (optional prefix instead of ,) + -- ["a"] = (prefix_any * P("a")) / format_a, -- %a => '...' (forces tostring) ["A"] = (prefix_any * P("A")) / format_A, -- %A => "..." (forces tostring) -- @@ -750,7 +760,7 @@ local function make(t,str) p = lpegmatch(builder,str,1,"..",t._extensions_) -- after this we know n if n > 0 then p = format(template,preamble,t._preamble_,arguments[n],p) --- print("builder>",p) +-- print("builder>",p) f = loadstripped(p)() else f = function() return str end |