Issue with KDevelop: Is it using different parsers in parallell for different puropuses?

Erik Sigra sigra at home.se
Tue Aug 15 18:18:57 UTC 2006


> Från: Jakob Petsovits <jpetso at gmx.at>
> class MyClass
> {
>   int main()
>   {
>      return ((int) bla == |
>   }
> };
> 
> where "|" is the cursor and you haven't finished the line yet.
> Nevertheless, 
> Katepart highlights everything correctly, including the "return" and "int" 
> tokens which are part of a statement that can't be parsed correctly.

I think the code is correct until the "|" and it should be highlighted correctly until there. Then it is OK to highlight the following "}" and "};" (and the rest of the text) in red (as in syntax error), because it is not valid and it would be too complex to guess the meaning. Then when you have finished typing the statement, the following lines will be rehighlighted "correctly". I do not expect any more advanced behaviour than that.

To put it in other words, I expect the highlighting to be correct to the point where g++ would complain about the first syntax error. The rest can be considered a syntax error and highlighted as such. I know that g++ tries to parse beyond the first error, but then it has to guess what the programmer meant, and it is really bad at guessing, because it is such a complex task. A proof of that is that error messages beyond the first are usually useless. Fixing the first error will "fix" the other "errors" as well. Seeing how bad g++ is at guessing beyond the first error, I do not expect KDevelop developers to try it.

What I expect is 100% correct highlighting of correct code. Kate gives 90% correct highlighting of correct and incorrect code.

Gratis Bredbandsabonnemang från Spray. Beställ på www.spray.se/bredband eller 020-266 000


More information about the KDevelop-devel mailing list