Skip to content

saiashirwad/generators-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bad parsers, don't use (except for fun)

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,
});

About

FUN PARSERS WITH MANY BUGS!!!!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published