clattner at apple.com
Wed Jul 9 16:56:59 PDT 2008
On Jul 9, 2008, at 4:50 PM, Argiris Kirtzidis wrote:
>> I haven't looked at the code, I just want to make sure that
>> LookAhead(1) or LookAhead(2) doesn't get off-by-one due to the
>> peeked token.
> LookAhead isn't called recursively, it collects all tokens through
> Lex(), into the LookaheadTokens array.
> If a peeked token exists, like when calling "LookAhead(0);
> LookAhead(1);", it goes like this:
> There's a peeked token now.
> -LookAhead consumes through Lex() the peeked token
> -Peeked token is invalidated, Lex() will not use it again.
> -LookAhead consumes one more token by 'normal' Lex().
> -Previously peeked token plus one more enter the token stream.
> -Previously peeked token will be the next available token.
> So, everything works as expected :-)
ok, great! :)
More information about the cfe-dev