From: Clifford Heath Date: 2008-07-13T10:15:41+09:00 Subject: Re: Treetop positive lookahead problem Tom Aadland wrote: > I have a problem that I think should be quite trivial. > > My test rule is: > > rule test > 'foo' &'bar' { > def value > text_value > end > } > end > > This should as I understand it parse the string "foobar" and return only > "foo". For some reason this returns nil. I tried the opposite (switched > '&' with '!') and that works like a charm. Tom, I don't think you've given us enough context answer the question. Positive lookahead *does* work in this situation, but when you say that something "returns nil". you're saying that the whole parse fails. The rule might succeed yet the parser may still fail and return nil for a different reason. For us to know why, you should post the entire grammar, together with the text you're parsing, and preferably also a snippet showing how you're calling the parser. Clifford Heath.