There is something about plus that I don’t understand. In the following code if I parse for (x , x) then I get what I expect. If I parse for (x plus) then the image hangs. What am I doing wrong?
James | a notA x y | a := $a asParser. notA := $a asParser negate star flatten. x := a / notA. y := x , x. “works fine” y := x plus. “never finishes” ^y end parse: 'ab’. |
With x, x it will only go to 2 level deep. With the plus you allow to go as far as the x rule succeed and your x rule always succeed because notA always succeed due to the star without consuming anything so you fall into infinite loop. 2014-12-18 6:47 GMT+01:00 James Foster <[hidden email]>: There is something about plus that I don’t understand. In the following code if I parse for (x , x) then I get what I expect. If I parse for (x plus) then the image hangs. What am I doing wrong? Guillaume Larcheveque
|
So you just have to remove the #star in notA or replace it by #plus to makes it succeed only when it consume at least one character 2014-12-18 7:54 GMT+01:00 Guillaume Larcheveque <[hidden email]>:
Guillaume Larcheveque
|
Exactly... Cheers,This happens so often that we should add some warning somewhere in these cases.... On 18 December 2014 at 08:36, Guillaume Larcheveque <[hidden email]> wrote:
|
In reply to this post by Guillaume Larcheveque
That did it and it makes sense. Thanks so much!
|
In reply to this post by kurs.jan
Could one of you write a small paragraph for the petit parser
chapter?
Le 18/12/14 09:07, Jan Kurš a écrit :
|
You mean deep into pharo? Or something else? I can do this... On 21 December 2014 at 13:27, stepharo <[hidden email]> wrote:
|
Le 31/12/14 16:37, Jan Kurš a écrit :
Yes I mean let us improve **OUR** documentation. Soon we will release an official version of Deep into Pharo. Then we will convert it to pillar and this means that we will all the Pharo books online and on different formats. Stef
|
Free forum by Nabble | Edit this page |