Jordan Justen <jljus...@gmail.com> writes:
> It looks like parser->last_token_was_newline will not be updated while
> skipping. Should we update that during the skipping even though we're
> not returning tokens?

Thanks for the careful review, Jordan.

While it would be more accurate to do that, I don't think it's worth the
extra code complexity, (that some state would be updated when skipping
while some would not).

And the side-effect from not being strictly accurate here is easy to
ignore. We're talking about EOF occurring while skipping, which is an
"unterminated #if" error that will be caught regardless. The only
effect of this state is whether the lexer correctly knows whether that
EOF occurred with or without a final newline, (and if it gets it wrong,
all it will do is emit an extra final newline).

I'll go ahead and add tests for EOF occurring within an "#if 0" and
within an "#if 1". (I just checked each of these and both work as they
should.)

>> +#define RETURN_STRING_TOKEN(token)                                     \
>> +       do {                                                            \
>> +               if (! parser->skipping) {                               \
>> +                       yylval->str = ralloc_strdup (yyextra, yytext);  \
>> +                       RETURN_TOKEN (token);                           \
>
> I guess this could use RETURN_TOKEN_NEVER_SKIP.

Sure. I'll do that.

Let me know if you'll offer a Reviewed-by given the explanation above.

-Carl

-- 
carl.d.wo...@intel.com

Attachment: pgpDbUuyKwC8g.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to