summaryrefslogtreecommitdiff
path: root/lualibs-util-prs.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-02-02 01:10:08 -0800
committerPhilipp Gesang <phg42.2a@gmail.com>2014-02-02 01:10:08 -0800
commitd758aba692b362c8653e1e4b1b5c13df4346652b (patch)
tree85352d4c1c48f6df474ff9f330cf7207f726d1a5 /lualibs-util-prs.lua
parent954d59d0e7c66cbeb72c9d323706dafdd7ac3a5b (diff)
parent43ffeea64e686e25807959575d07162bc8bb02b6 (diff)
downloadlualibs-d758aba692b362c8653e1e4b1b5c13df4346652b.tar.gz
Merge pull request #23 from phi-gamma/master
sync with Context
Diffstat (limited to 'lualibs-util-prs.lua')
-rw-r--r--lualibs-util-prs.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/lualibs-util-prs.lua b/lualibs-util-prs.lua
index 29a57e0..e5b35a7 100644
--- a/lualibs-util-prs.lua
+++ b/lualibs-util-prs.lua
@@ -184,8 +184,10 @@ function parsers.settings_to_array(str,strict)
else
return { str }
end
- else
+ elseif find(str,",") then
return lpegmatch(pattern,str)
+ else
+ return { str }
end
end
@@ -483,8 +485,8 @@ function parsers.rfc4180splitter(specification)
* Cs((dquotechar + (1 - quotechar))^0)
* quotechar
local non_escaped = C((1 - quotechar - newline - separator)^1)
- local field = escaped + non_escaped
- local record = Ct((field * separator^-1)^1)
+ local field = escaped + non_escaped + Cc("")
+ local record = Ct(field * (separator * field)^1)
local headerline = record * Cp()
local wholeblob = Ct((newline^-1 * record)^0)
return function(data,getheader)