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