package stringContextParserCombinator
A library for implementing custom string interpolation implementations using Parser Combinators
- Alphabetic
- By Inheritance
- stringContextParserCombinator
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
- package typeclass
Implicit values used by branch combinators that allow combinations of input types to have more ergonomic return types.
Implicit values used by branch combinators that allow combinations of input types to have more ergonomic return types.
Each of the typeclasses defined in this package fit into a matrix, where one dimension is which type of parser the typeclass is used with and the other dimension is the method that uses an instance of the type
method
Covariant (Interpolator)
Contravariant (Extractor)
Invariant (Parser)
andThen
orElse
repeat
optionally
Thus, if you are only working with interpolators, then you'll only need to work with the unprefixed typeclasses.
Each of these traits has a companion object that defines a generic instance of the trait, and a few instances for more specific types. For instance, each typeclass includes a instance that will avoid wrapping
scala.Unit
values in a collection or tuple.Defining custom instances of these types is supported. Making custom given instances can significantly reduce the number of explicit
map
calls required when writing a parser, however the usual advice with given instances applies: keep types specific, or keep the scope of a given instance to the minimum viable to prevent given instances from becoming confusing.
Type Members
- final class CodePoint extends AnyRef
Represents a unicode codepoint
- final class Extractor[Expr[_], Type[_], -A] extends VersionSpecificExtractor[Expr, Type, A]
Parses an interpolated string expression into some extractor
Parses an interpolated string expression into some extractor
- Expr
the macro-level expression type
- Type
the macro-level type type
- A
the type of the parsed result
- type Id[+A] = A
An identity context - for parsing outside of a macro
- type IdToExpr[A] = =:=[A, A]
An identity function for lifting into the identity context
- final class Interpolator[-Expr, +A] extends VersionSpecificInterpolator[Expr, A]
Parses an interpolated string expression into some value
Parses an interpolated string expression into some value
- Expr
the macro-level expression type.
- A
the type of the parsed result
- trait LiftFunction[U <: Context with Singleton, -CC[_], +Z] extends AnyRef
Support for Interpolator.contextInterpolators.lifted; represents a macro-level function that combines a CC[A] and an A.
- final class ParseException extends RuntimeException
Thrown by Id-using parse methods when the parser fails to parse the string context
Thrown by Id-using parse methods when the parser fails to parse the string context
The Expr-using parse methods will fail at compile time instead, and thus don't throw
- final class Parser[Expr[_], Type[_], A] extends VersionSpecificParser[Expr, Type, A]
Parses an interpolated string expression into some value
Parses an interpolated string expression into some value
- Expr
the macro-level expression type
- Type
the macro-level type type
- A
the type of the parsed result
- trait PartialExprFunction[+Expr[_], -A, +Z] extends AnyRef
A partial function which is valid according to an
Expr[Boolean]
instead of a plainBoolean
- sealed trait RepeatStrategy extends AnyRef
Describes how much a Repeat will attempt to match
- sealed trait Unapply[-A] extends AnyRef
An object that can be a pattern match pattern
Value Members
- object CodePoint
- object Extractor extends VersionSpecificExtractorModule
- object Interpolator extends VersionSpecificInterpolatorModule with ExprIndependentInterpolators[Any]
- object Parser extends VersionSpecificParserModule
- object PartialExprFunction
- object RepeatStrategy
The instances of the RepeatStrategy enum
- object Unapply
The types of pattern match objects
A library for writing custom string interpolation implementations via parser combinators
## Entry Points
If the string context should create an object: Create leaf parsers using the methods in the Interpolator companion object, combine and manipulate them with the methods in Interpolator, then interpolate using the final
Interpolator
'sinterpolate
method.If the string context should create an extractor: Create leaf parsers using the methods in the Extractor companion object, combine and manipulate them with the methods in Extractor, then interpolate using the final
Extractor
'sextractor
method.If the string context should do both: Create leaf parsers using the methods in the Parser companion object, combine and manipulate them with the methods in Parser, then interpolate using the final
Parser
'sinterpolate
andextractor
methods.