Hei Li, When parsing the string 'ab', the rule4 use of rule1 will consume 'a', leaving 'b' in the input string. Then it will try to match rule1 (for rule1.present?) again - but the input string at that point just contains 'b', so :b2 matches and is consumed, yielding a successful match.
> So 'present?' can not span rules? In my real application, the problem is > more complicated, so I can not just merge 'rule3' and 'rule4'. #present? protects subsequent matches in the same sequence from matching unless the atom given to present is available at that point. So no, it doesn't somehow span multiple rules, it has very local action. You will need to formulate this differently. If you post a piece of your parser, maybe the list will help you reformulate what you want so that present? works? cheers! kaspar
