@@ -5,18 +5,18 @@ import scala.quoted.matching._
5
5
6
6
/**
7
7
* Provides the `hex` string interpolator, which returns `ByteVector` instances from hexadecimal strings.
8
- *
8
+ *
9
9
* @example {{{
10
10
* scala> val b = hex"deadbeef"
11
11
* val b: scodec.bits.ByteVector = ByteVector(4 bytes, 0xdeadbeef)
12
12
* }}}
13
13
*/
14
- inline def (ctx : StringContext ).hex (inline args : ByteVector * ): ByteVector =
14
+ inline def (inline ctx : StringContext ).hex (inline args : ByteVector * ): ByteVector =
15
15
$ {hexInterpolator(' ctx , ' args )}
16
16
17
17
private def hexInterpolator (strCtxExpr : Expr [StringContext ], argsExpr : Expr [Seq [ByteVector ]])(using qctx : QuoteContext ): Expr [ByteVector ] = {
18
18
(strCtxExpr, argsExpr) match {
19
- case (' { StringContext ($ {ExprSeq (parts)}: _* ) }, ExprSeq (args)) =>
19
+ case (' { StringContext ($ {Varargs (parts)}: _* ) }, Varargs (args)) =>
20
20
val partValues : Seq [String ] = parts.map { case p @ Const (part) =>
21
21
if (ByteVector .fromHex(part).isEmpty)
22
22
qctx.error(" hexadecimal string literal may only contain characters [0-9a-fA-f]" , p)
@@ -42,12 +42,12 @@ private def hexInterpolator(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[
42
42
* val b: scodec.bits.BitVector = BitVector(10 bits, 0xaa8)
43
43
* }}}
44
44
*/
45
- inline def (ctx : StringContext ).bin (inline args : BitVector * ): BitVector =
45
+ inline def (inline ctx : StringContext ).bin (inline args : BitVector * ): BitVector =
46
46
$ {binInterpolator(' ctx , ' args )}
47
47
48
48
private def binInterpolator (strCtxExpr : Expr [StringContext ], argsExpr : Expr [Seq [BitVector ]])(using qctx : QuoteContext ): Expr [BitVector ] = {
49
49
(strCtxExpr, argsExpr) match {
50
- case (' { StringContext ($ {ExprSeq (parts)}: _* ) }, ExprSeq (args)) =>
50
+ case (' { StringContext ($ {Varargs (parts)}: _* ) }, Varargs (args)) =>
51
51
val partValues : Seq [String ] = parts.map { case p @ Const (part) =>
52
52
if (BitVector .fromBin(part).isEmpty)
53
53
qctx.error(" binary string literal may only contain characters [0, 1]" , p)
0 commit comments