summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-05-15 20:16:56 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2014-05-15 20:16:56 +0200
commitaeeb88565f5dfe856e22b92d7a76dda382622799 (patch)
treebd05cb1ae860308246486cb87bb145e1aba57c76
parent4d368cd58f64453777eb6ed52cd1e66d85c043bf (diff)
downloadlualibs-aeeb88565f5dfe856e22b92d7a76dda382622799.tar.gz
sync with Context as of 2014-05-15
-rw-r--r--lualibs-lpeg.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/lualibs-lpeg.lua b/lualibs-lpeg.lua
index 6feb708..666af21 100644
--- a/lualibs-lpeg.lua
+++ b/lualibs-lpeg.lua
@@ -107,7 +107,8 @@ local uppercase = R("AZ")
local underscore = P("_")
local hexdigit = digit + lowercase + uppercase
local cr, lf, crlf = P("\r"), P("\n"), P("\r\n")
-local newline = crlf + S("\r\n") -- cr + lf
+----- newline = crlf + S("\r\n") -- cr + lf
+local newline = P("\r") * (P("\n") + P(true)) + P("\n")
local escaped = P("\\") * anything
local squote = P("'")
local dquote = P('"')
@@ -141,8 +142,8 @@ patterns.utfbom_16_be = utfbom_16_be
patterns.utfbom_16_le = utfbom_16_le
patterns.utfbom_8 = utfbom_8
-patterns.utf_16_be_nl = P("\000\r\000\n") + P("\000\r") + P("\000\n")
-patterns.utf_16_le_nl = P("\r\000\n\000") + P("\r\000") + P("\n\000")
+patterns.utf_16_be_nl = P("\000\r\000\n") + P("\000\r") + P("\000\n") -- P("\000\r") * (P("\000\n") + P(true)) + P("\000\n")
+patterns.utf_16_le_nl = P("\r\000\n\000") + P("\r\000") + P("\n\000") -- P("\r\000") * (P("\n\000") + P(true)) + P("\n\000")
patterns.utf8one = R("\000\127")
patterns.utf8two = R("\194\223") * utf8next