languages/cpp/parser: lexer error

Hamish Rodda rodda at kde.org
Mon Aug 25 23:19:30 UTC 2008


Hi Marek,

On Tuesday 26 August 2008 02:40:22 Marek Jasovsky wrote:
> Hi
>
> I found this weird behavior in cpp lexer in kdev4 while struggling to
> learn something about  duchain.
>
> in kdevplatform/plugins/duchainviewer/duchainmodel.cpp
>
> QModelIndex DUChainModel::index(int row, int column, const QModelIndex
> & parent) const // line 147
> { //line 148
>                                                            #               
> # if (row < 0 || column < 0 || column > 0 || !m_chain) //line 149
>     return QModelIndex(); //line 150
>
> kdev4 problems view gives me  2 errors marked with # above the line...
> (3rd zero and last closing brace, but code gets compiled without
> errors.
>
> first: Expected token ')' after '>' found 'number_literal' (Lexer)
> 2nd: Unexpected token ')'

This is a known issue, it's because there is an ambiguity in c++, that there 
_could_ be a template class called "column" with the arguments inside the <>.

I emailed Roberto about it a while back but his suggestions are technically 
difficult at the moment, it will need more thinking about before we can 
properly fix it.

Cheers,
Hamish.




More information about the KDevelop-devel mailing list