rayrobdod / string-context-parser-combinator   0.1.0

Apache License 2.0 Website GitHub

a scala library for writing custom string interpolation implementations via parser combinators

Scala versions: 3.x 2.13 2.12
Scala.js versions: 1.x
Scala Native versions: 0.4

string context parser combinator

Build status Check

This is a scala library for writing custom string interpolation implementations via parser combinators.

The parser combinators, in addition to parser leaves that match on parts of a string, such as charWhere, include leaves that match on the 'hole' or 'arg' parts of interpolated strings. As such, this can be used to create compile-time checked string interpolators that accept holes; contrast literally, which cannot accept holes, or using s to turn the StringContext into a string then parsing the built string, which cannot be checked at compile-time. The parser can do this while still being easier and faster to create than a hand-rolled parser.

The maven coordinates are "name.rayrobdod" %% "string-context-parser-combinator" % "<version>"

The library itself is contained within the Base/ project. The other projects are sample uses of the library.

Documentation