How to temporarily prevent Rule1 from pushing value to stack?

23 views
Skip to first unread message

Cao Zhijun

unread,
Apr 11, 2016, 3:34:26 AM4/11/16
to parboiled2.org User List
I have a Rule1 defined well, most of the times I need it to produce value to stack however sometimes I just want it to match and forget (no value pushed). How can I achieve this please? Must I copy code and define another Rule0 ? 

Mathias Doenitz

unread,
Apr 11, 2016, 3:46:11 AM4/11/16
to parboil...@googlegroups.com
Cao,

you can simply follow it with `~ drop[Int]` for example, if the value you want to drop is an `Int`.
If you want to drop more than one value you can say something like `~ drop[Int :: String :: Double :: HNil]`.

Cheers,
Mathias

---
mat...@parboiled.org
http://www.parboiled.org

> On 10. 4 2016, at 17:10, Cao Zhijun <zhij...@gmail.com> wrote:
>
> I have a Rule1 defined well, most of the times I need it to produce value to stack however sometimes I just want it to match and forget (no value pushed). How can I achieve this please? Must I copy code and define another Rule0 ?
>
> --
> 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/e188dce8-0240-4c8e-8cdd-ab48d42d7cf7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages