Error reporting bug in kdev-pg?

Roberto Raggi roberto.raggi at gmail.com
Fri Jul 13 15:35:26 UTC 2007


Il giorno 13/lug/07, alle ore 17:14, Andreas Pakulat ha scritto:
> Uhm, then somethings wrong with the parser. As I said currently the
> qmake parser only recognizes NEWLINE tokens, but the example file
> contains no newline in the first 3 tokens.
>
> All I'm asking is to get an error message telling me on which token  
> the
> error occurs, not the one after that and the error occurs when the
> parser expects NEWLINE but gets something different (IDENTIFIER in  
> this
> case, while it reports PLUSEQ).
>
> I hope its clear I'm not asking for the last recognized token, I'm
> asking to get the last unexpected token.

oops! I see. The problem is the token_stream's next_token()

   inline int kdev_pg_token_stream::next_token() {
     return _M_token_buffer[_M_index++].kind;
   }

see? _M_index points to the next token and not to the look-ahead.  
This is so unintuitive! I hate myself ;-) well, add a function (e.g.  
yytoken_index() or something like that) to kdev_pg_token_stream. The  
function should return `0' if _M_index is `0'  and _M_index - 1 when  
_M_index is valid.

ciao robe





More information about the KDevelop-devel mailing list