summaryrefslogtreecommitdiff
path: root/lualibs-util-prs.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lualibs-util-prs.lua')
-rw-r--r--lualibs-util-prs.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/lualibs-util-prs.lua b/lualibs-util-prs.lua
index 302b984..ea34c2c 100644
--- a/lualibs-util-prs.lua
+++ b/lualibs-util-prs.lua
@@ -333,7 +333,7 @@ end
-- for mtx-context etc: aaaa bbbb cccc=dddd eeee=ffff
-local str = C((1-whitespace-equal)^1)
+local str = Cs(lpegpatterns.unquoted) + C((1-whitespace-equal)^1)
local setting = Cf( Carg(1) * (whitespace^0 * Cg(str * whitespace^0 * (equal * whitespace^0 * str + Cc(""))))^1,rawset)
local splitter = setting^1
@@ -341,6 +341,12 @@ function utilities.parsers.options_to_hash(str,target)
return str and lpegmatch(splitter,str,1,target or { }) or { }
end
+local splitter = lpeg.tsplitat(" ")
+
+function utilities.parsers.options_to_array(str)
+ return str and lpegmatch(splitter,str) or { }
+end
+
-- for chem (currently one level)
local value = P(lbrace * C((nobrace + nestedbraces)^0) * rbrace)
@@ -524,7 +530,7 @@ function parsers.rfc4180splitter(specification)
local field = escaped + non_escaped + Cc("")
local record = Ct(field * (separator * field)^1)
local headerline = record * Cp()
- local wholeblob = Ct((newline^-1 * record)^0)
+ local wholeblob = Ct((newline^(specification.strict and -1 or 1) * record)^0)
return function(data,getheader)
if getheader then
local header, position = lpegmatch(headerline,data)