zeroOrMore and optional don't seem to work as documented.

18 views
Skip to first unread message

Rusty Phillips

unread,
Jun 12, 2019, 4:41:29 PM6/12/19
to parboiled2.org User List

Using parboiled_2.12 v2.16

This:

 def TestZero: Rule1[Seq[String]] = rule (
    zeroOrMore(capture("aa"))
  )

and this:

 def TestZero: Rule1[Seq[String]] = rule (
    optional(oneOrMore(capture("aa")))
  )

Both produce this error:
Expression of type Rule[HNil, StrictOut] doesn't conform to expected type Parboiled2.Rule1[Seq[String]]

In contrast, this does work:

 def TestZero: Rule1[Seq[String]] = rule (
    oneOrMore(capture("aa"))
  )

According to the docs, all three of these options are being used correctly (as far as I can tell).

What am I missing?

Thomas Suckow

unread,
Jun 12, 2019, 9:01:12 PM6/12/19
to parboil...@googlegroups.com
Pretty sure you want Option[Seq[String]]]

--
You received this message because you are subscribed to the Google Groups "parboiled2.org User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to parboiled-use...@googlegroups.com.
Visit this group at https://groups.google.com/group/parboiled-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/parboiled-user/399c7e3e-031c-47ea-aea3-e065cedc6416%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages