name.rayrobdod.stringContextParserCombinator

A library for implementing custom string interpolation implementations using Parser Combinators

Attributes

Members list

Packages

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 Sequenced ContraSequenced BiSequenced
orElse Eithered ContraEithered BiEithered
repeat Repeated ContraRepeated BiRepeated
optionally Optionally ContraOptionally BiOptionally

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.

Attributes

Type members

Classlikes

final class CodePoint

Represents a unicode codepoint

Represents a unicode codepoint

Attributes

Companion
object
Source
CodePoint.scala
Supertypes
class Object
trait Matchable
class Any
object CodePoint

Attributes

Companion
class
Source
CodePoint.scala
Supertypes
class Object
trait Matchable
class Any
Self type
CodePoint.type
final class Extractor[Expr[_], Type[_], -A]

Parses an interpolated string expression into some extractor

Parses an interpolated string expression into some extractor

Type parameters

A

the type of the parsed result

Expr

the macro-level expression type

Type

the macro-level type type

Attributes

Companion
object
Source
Extractor.scala
Supertypes
class Object
trait Matchable
class Any
object Extractor

Attributes

Companion
class
Source
Extractor.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Extractor.type
final class Interpolator[-Expr, +A]

Parses an interpolated string expression into some value

Parses an interpolated string expression into some value

Type parameters

A

the type of the parsed result

Expr

the macro-level expression type.

Attributes

Companion
object
Source
Interpolator.scala
Supertypes
class Object
trait Matchable
class Any
object Interpolator

Attributes

Companion
class
Source
Interpolator.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait LiftFunction[-CC[_], +Z]

Support for Interpolator.lifted; represents a macro-level function that combines a CC[A] and an A.

Support for Interpolator.lifted; represents a macro-level function that combines a CC[A] and an A.

Attributes

Source
package.scala
Supertypes
class Object
trait Matchable
class Any
final class ParseException(msg: String) 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

Attributes

Source
ParseException.scala
Supertypes
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
final class Parser[Expr[_], Type[_], A]

Parses an interpolated string expression into some value

Parses an interpolated string expression into some value

Type parameters

A

the type of the parsed result

Expr

the macro-level expression type

Type

the macro-level type type

Attributes

Companion
object
Source
Parser.scala
Supertypes
class Object
trait Matchable
class Any
object Parser

Attributes

Companion
class
Source
Parser.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Parser.type
trait PartialExprFunction[+Expr[_], -A, +Z]

A partial function which is valid according to an Expr[Boolean] instead of a plain Boolean

A partial function which is valid according to an Expr[Boolean] instead of a plain Boolean

Attributes

Companion
object
Source
PartialExprFunction.scala
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Source
PartialExprFunction.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Describes how much a Repeat will attempt to match

Describes how much a Repeat will attempt to match

Attributes

Source
RepeatStrategy.scala
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait Unapply[-A]

An object that can be a pattern match pattern

An object that can be a pattern match pattern

Attributes

Companion
object
Source
Unapply.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Fixed[A, Z]
trait FixedIrrefutable[A, Z]
trait Seq[A, Z]
trait SeqIrrefutable[A, Z]
trait Zero[A]
object Unapply

The types of pattern match objects

The types of pattern match objects

Attributes

Companion
trait
Source
Unapply.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Unapply.type

Types

type Id[+A] = A

An identity context - for parsing outside of a macro

An identity context - for parsing outside of a macro

Attributes

Source
package.scala
type IdToExpr[A] = A =:= A

An identity function for lifting into the identity context

An identity function for lifting into the identity context

Attributes

Source
package.scala