Skip to content

v3.0.0 - Token combinators and performance improvements

Choose a tag to compare

@github-actions github-actions released this 18 Sep 10:51
· 136 commits to main since this release
7ba95a9

Performance was improved by a 25% at least.

Also, added token combinators that allows you to calculate value immediately, without AST:

builder.CreateToken("string")
	// 'Between' token pattern matches a sequence of three elements,
	// but calculates and propogates intermediate value of second element
	.Between(
		b => b.Literal('"'),
		b => b.TextUntil('"'),
		b => b.Literal('"'));

builder.CreateToken("boolean")
	// 'Map' token pattern applies intermediate value transformer to child's value
	.Map<string>(b => b.LiteralChoice("true", "false"), m => m == "true");

builder.CreateToken("null")
	// 'Return' does not calculates value for child element, just returns 'null' here
	.Return(b => b.Literal("null"), null);

// And more...