const smolParser = Parser.gen(function* () {
const hs = yield* many(char("h"));
const ts = yield* many(char("t"));
const v = yield* char("v");
return { hs, ts, v };
});
const parseTexoport = Parser.gen(function* () {
for (const i of "texoport") {
yield* char(i);
}
return "texoport acquired" as const;
});
const bigParser = Parser.gen(function* () {
const smol = yield* smolParser;
const texStatus = yield* parseTexoport;
return {
smol,
texStatus,
};
});
const lol = bigParser.run("hhhtttvtexoport");
// ^ ParserResult<{ smol: { hs: string[]; ts: string[]; v: string }, texStatus: "texoport acquired" }>
Either.match(lol, {
onRight: console.log,
onLeft: console.log,
});
forked from saiashirwad/generators-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Frank-III/fun-parser-combinator
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
FUN PARSERS WITH MANY BUGS!!!!
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- TypeScript 100.0%