Quantcast

Example of using a RuleOption in scala?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Example of using a RuleOption in scala?

chrisl
Hi,

I was wondering if there was a an example of applying a RuleOption (like MemoMismatches) available somewhere? The standard examples don't seem to use these anywhere.

Cheers,
Chris
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Example of using a RuleOption in scala?

mathias
Administrator
Chris,

the `rule` methods (the one you use to wrap you rule definition with) has an optional `options` parameter containing a number of RuleOption instances you can mark the rule with:
https://github.com/sirthias/parboiled/blob/master/parboiled-scala/src/main/scala/org/parboiled/scala/RuleOption.scala

I think this is what you are looking for…

Cheers,
Mathias

---
[hidden email]
http://www.parboiled.org

On 15.04.2013, at 18:30, "chrisl [via parboiled users]" <[hidden email]> wrote:

>
>
> Hi,
>
> I was wondering if there was a an example of applying a RuleOption (like
> MemoMismatches) available somewhere? The standard examples don't seem to use
> these anywhere.
>
> Cheers,
> Chris
>
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://users.parboiled.org/Example-of-using-a-RuleOption-in-scala-tp4024174.html
> To start a new topic under parboiled users, email [hidden email]
> To unsubscribe from parboiled users, visit
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Example of using a RuleOption in scala?

chrisl
Thanks Mattias.

I also worked out that I could write it like:

def foo : Rule0 = rule {
 ("Foo" | "Bar") memoMismatches
}
Loading...