Quantcast

Confused about FirstOf

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

Confused about FirstOf

Ygor
This post was updated on .
Hey, I just started to play with Parboiled. I'm still learning so sorry if it's a trivial question.

https://gist.github.com/migore/cea1d3a160a5708fe785

The test with a problem is in line 23.

I debugged and in the parseErrors there are 3 failedMatchers:
Expression/Component/Sequence/Expression/Component/Number/Sequence/TestNot/a..z
Expression/Component/Sequence/Expression/Component/Number/Sequence/Digit
Expression/Component/Sequence/Expression/EOI

and the start index is 2.

I was expecting to the input to match the Sequence in line 38.

Why it is not matching the Sequence rule? Am I doing something wrong?

Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Confused about FirstOf

tsuckow
It would expect an EOI after the 4. Try replacing (expression) with (component)
Thomas Suckow


On Wed, May 15, 2013 at 5:58 PM, Ygor [via parboiled users]
<[hidden email]> wrote:

> Hey, I just started to play with Parboiled. I'm still learning so sorry if
> it's a trivial question.
>
> https://gist.github.com/migore/cea1d3a160a5708fe785
>
> The test with a problem is in line 23.
>
> I debugged and in the parseErrors there are 3 failedMatchers:
> Expression/Component/Sequence/Expression/Component/Number/Sequence/TestNot/a..z
> Expression/Component/Sequence/Expression/Component/Number/Sequence/Digit
> Expression/Component/Sequence/Expression/EOI
>
> and the start index is 2.
>
> I was expecting to the input to match the Sequence in line 38.
>
> Why it is not matching the Sequence rule?
>
> Thanks
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://users.parboiled.org/Confused-about-FirstOf-tp4024193.html
> To start a new topic under parboiled users, email
> [hidden email]
> To unsubscribe from parboiled users, click here.
> NAML
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Confused about FirstOf

Ygor
Ouch, didn't catch that. Thanks!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Confused about FirstOf

tsuckow

You're welcome. It is easy to get lost in the rules. Especially when you try to verify that all combinations make sense, but that often gets flushed out when you traverse the ast.

On May 16, 2013 3:19 AM, "Ygor [via parboiled users]" <[hidden email]> wrote:
Ouch, didn't catch that. Thanks!


If you reply to this email, your message will be added to the discussion below:
http://users.parboiled.org/Confused-about-FirstOf-tp4024193p4024195.html
To start a new topic under parboiled users, email [hidden email]
To unsubscribe from parboiled users, click here.
NAML
Loading...