summaryrefslogtreecommitdiff
path: root/script-beta/parser/split.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script-beta/parser/split.lua')
-rw-r--r--script-beta/parser/split.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/script-beta/parser/split.lua b/script-beta/parser/split.lua
new file mode 100644
index 00000000..6ce4a4e7
--- /dev/null
+++ b/script-beta/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