summaryrefslogtreecommitdiff
path: root/server/src/parser/split.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/parser/split.lua')
-rw-r--r--server/src/parser/split.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/server/src/parser/split.lua b/server/src/parser/split.lua
new file mode 100644
index 00000000..6ce4a4e7
--- /dev/null
+++ b/server/src/parser/split.lua
@@ -0,0 +1,9 @@
+local m = require 'lpeglabel'
+
+local NL = m.P'\r\n' + m.S'\r\n'
+local LINE = m.C(1 - NL)
+
+return function (str)
+ local MATCH = m.Ct((LINE * NL)^0 * LINE)
+ return MATCH:match(str)
+end