You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
461 B
JavaScript
18 lines
461 B
JavaScript
2 years ago
|
"use strict";
|
||
|
|
||
|
const { either, EndOfInput } = require("../../operations");
|
||
|
const Newline = require("./newline");
|
||
|
const untilDelimiter = require("../../combinator/until-delimiter");
|
||
|
|
||
|
function createRestOfLine(newlineRule) {
|
||
|
return function* RestOfLine() {
|
||
|
return yield untilDelimiter(either([ newlineRule, EndOfInput ]));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
LF: createRestOfLine(Newline.LF),
|
||
|
CR: createRestOfLine(Newline.CR),
|
||
|
CRLF: createRestOfLine(Newline.CRLF),
|
||
|
};
|