ignore<R> method

Parser<T> ignore<R>(
  1. Parser<R> parser
)
inherited

Suppresses newline sensitivity within parser by incrementing the bracket nesting depth, allowing physical newlines as whitespace.

Implementation

Parser<R> ignore<R>(Parser<R> parser) => seq3(
  epsilon().map((_) => _bracketNesting++, hasSideEffects: true),
  parser,
  epsilon().map((_) => _bracketNesting--, hasSideEffects: true),
).map3((_, body, _) => body);