File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,12 @@ package object fastparse extends fastparse.SharedPackageDefs {
102
102
def filter (f : T => Boolean )
103
103
(implicit ctx : P [Any ]): P [T ] = macro MacroImpls .filterMacro[T ]
104
104
105
+ /**
106
+ * Used by for-comprehensions.
107
+ */
108
+ def withFilter (f : T => Boolean )
109
+ (implicit ctx : P [Any ]): P [T ] = macro MacroImpls .filterMacro[T ]
110
+
105
111
/**
106
112
* Transforms the result of this parser using the given partial function,
107
113
* failing the parse if the partial function is not defined on the result
Original file line number Diff line number Diff line change @@ -38,6 +38,11 @@ package object fastparse extends fastparse.SharedPackageDefs {
38
38
inline def filter (f : T => Boolean )(using ctx : P [Any ]): P [T ] =
39
39
MacroInlineImpls .filterInline[T ](parse0)(f)(ctx)
40
40
41
+ /**
42
+ * Used by for-comprehensions.
43
+ */
44
+ inline def withFilter (f : T => Boolean )(using ctx : P [Any ]): P [T ] = MacroInlineImpls .filterInline[T ](parse0)(f)(ctx)
45
+
41
46
/** Either-or operator: tries to parse the left-hand-side, and if that
42
47
* fails it backtracks and tries to pass the right-hand-side. Can be
43
48
* chained more than once to parse larger numbers of alternatives.
You can’t perform that action at this time.
0 commit comments