given_ToExpr_Regex

halotukozak.regex.Regex.given_ToExpr_Regex
object given_ToExpr_Regex extends ToExpr[Regex]

Embeds the value's already-computed RegexEncoder.Encoded shape, reconstructed by RegexDecoder, instead of regenerating it through the public smart constructors (concat, alt, inter, star, unary_!, lookahead) at every call site - the same spirit as TokenMatcher's ToExpr embedding its DFA tables as plain data. The smart constructors exist to (re-)establish ACI normalization and merge Chars sets when building a tree from scratch; a Regex value reaching this given is already normalized, so re-running them at every macro call site - and again at every class load, since the generated code re-executes them - would just redo that work for a result that's already known. See RegexEncoder for why the encoding is flat data rather than nested constructor calls.

Attributes

Source
Regex.scala
Graph
Supertypes
trait ToExpr[Regex]
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply(r: Regex)(using Quotes): Expr[Regex]

Lift a value into an expression containing the construction of that value.

Lift a value into an expression containing the construction of that value.

Value parameters

x

the value to lift into a quoted expression

Attributes

Source
Regex.scala