File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 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 {
102102 def filter (f : T => Boolean )
103103 (implicit ctx : P [Any ]): P [T ] = macro MacroImpls .filterMacro[T ]
104104
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+
105111 /**
106112 * Transforms the result of this parser using the given partial function,
107113 * 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 {
3838 inline def filter (f : T => Boolean )(using ctx : P [Any ]): P [T ] =
3939 MacroInlineImpls .filterInline[T ](parse0)(f)(ctx)
4040
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+
4146 /** Either-or operator: tries to parse the left-hand-side, and if that
4247 * fails it backtracks and tries to pass the right-hand-side. Can be
4348 * chained more than once to parse larger numbers of alternatives.
You can’t perform that action at this time.
0 commit comments