0

I don't understand the comment:

/// Returns a parser that consumes nothing and succeeds.
///
/// For example, `char('a').or(epsilon())` is equivalent to
/// `char('a').optional()`.
@useResult
Parser<void> epsilon() => epsilonWith<void>(null);

Could someone give a specific example?

Gpack
  • 1,878
  • 3
  • 18
  • 45

1 Answers1

2

It appears to do exactly what it says. Instead of writing "foo = optional bar" you can define a step with "foo = bar or epsilon".

In the "indent" parser in the repo, I see it is used to attach .where and .map options with side-effects. You can check that out for details.

Randal Schwartz
  • 39,428
  • 4
  • 43
  • 70