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 < guillaume.larcheve...@gmail.com>: > > 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 <smallt...@jgfoster.net>: >> >> 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’. >> >> >> > > -- > *Guillaume Larcheveque* > > -- *Guillaume Larcheveque*