summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-05-17 10:05:53 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-05-17 10:05:53 +0200
commitaa85ede2a8508b44b819f968999e84f9f0de11b5 (patch)
tree9253b16ccb90875e6ec4fc59baa4f05453fb1b7e
parent614b92cfbea4cd9f3200ba839574b81b329e5f46 (diff)
downloadlualibs-aa85ede2a8508b44b819f968999e84f9f0de11b5.tar.gz
sync with Context as of 2013-05-17
-rw-r--r--lualibs-util-prs.lua41
-rw-r--r--lualibs.dtx2
2 files changed, 37 insertions, 6 deletions
diff --git a/lualibs-util-prs.lua b/lualibs-util-prs.lua
index 31e7ffa..cdf4975 100644
--- a/lualibs-util-prs.lua
+++ b/lualibs-util-prs.lua
@@ -93,7 +93,9 @@ patterns.settings_to_hash_b = pattern_b_s
patterns.settings_to_hash_c = pattern_c_s
function parsers.make_settings_to_hash_pattern(set,how)
- if how == "strict" then
+ if type(str) == "table" then
+ return set
+ elseif how == "strict" then
return (pattern_c/set)^1
elseif how == "tolerant" then
return (pattern_b/set)^1
@@ -103,7 +105,16 @@ function parsers.make_settings_to_hash_pattern(set,how)
end
function parsers.settings_to_hash(str,existing)
- if str and str ~= "" then
+ if type(str) == "table" then
+ if existing then
+ for k, v in next, str do
+ existing[k] = v
+ end
+ return exiting
+ else
+ return str
+ end
+ elseif str and str ~= "" then
hash = existing or { }
lpegmatch(pattern_a_s,str)
return hash
@@ -113,7 +124,16 @@ function parsers.settings_to_hash(str,existing)
end
function parsers.settings_to_hash_tolerant(str,existing)
- if str and str ~= "" then
+ if type(str) == "table" then
+ if existing then
+ for k, v in next, str do
+ existing[k] = v
+ end
+ return exiting
+ else
+ return str
+ end
+ elseif str and str ~= "" then
hash = existing or { }
lpegmatch(pattern_b_s,str)
return hash
@@ -123,7 +143,16 @@ function parsers.settings_to_hash_tolerant(str,existing)
end
function parsers.settings_to_hash_strict(str,existing)
- if str and str ~= "" then
+ if type(str) == "table" then
+ if existing then
+ for k, v in next, str do
+ existing[k] = v
+ end
+ return exiting
+ else
+ return str
+ end
+ elseif str and str ~= "" then
hash = existing or { }
lpegmatch(pattern_c_s,str)
return next(hash) and hash
@@ -144,7 +173,9 @@ patterns.settings_to_array = pattern
-- we could use a weak table as cache
function parsers.settings_to_array(str,strict)
- if not str or str == "" then
+ if type(str) == "table" then
+ return str
+ elseif not str or str == "" then
return { }
elseif strict then
if find(str,"{") then
diff --git a/lualibs.dtx b/lualibs.dtx
index b3e6bdb..bc466e1 100644
--- a/lualibs.dtx
+++ b/lualibs.dtx
@@ -533,7 +533,7 @@ end
--- This restores the default of loading everything should a package
--- have requested otherwise. Will be gone once there is a canonical
--- interface for parameterized loading of libraries.
-lualibs.load_extended = true
+config.lualibs.load_extended = true
-- vim:tw=71:sw=2:ts=2:expandtab