Adding location info to the C++ parser
Matt Rogers
mattr at kde.org
Fri Mar 17 04:55:25 UTC 2006
Hi,
I've come up with a plan that I intend to use to modify the c++ parser so that
it provides proper location info for use in KDevelop. I submit my plan here
so that it can be reviewed, suggestions can be provided, or i can be flat out
told I'm wrong. :)
==========================
Plan:
Change: Modify the preprocessor so it does not strip indentation or blank
lines (blank lines are mostly when comments are being removed)
Reason: Proper column information is needed and if the preprocessor removes
indentation that will mess up column information. If the preprocessor removes
comments and the newline that follows them, then the line information is
automatically thrown off.
Change: Verify the preprocessor outputs line number markers similar to those
output by gcc -E and if it does not, modify the preprocessor to output line
number markers similar to the output of gcc -E
Reason: This needs to be done to ensure that the parser (via the tokenizer)
has proper line numbers to work with.
Change: Modify the tokenizer to store line and column information within the
tokens
Reason: This needs to be done so that the parser can add this information to
the code model via the binder
==========================
Please let me know what you think, if i'm on the right track, if i'm just
completely wrong, if i've left out something, etc. I would appreciate any
feedback. I will attempt to keep the parser as fast as it is now, but i can't
guarantee anything.
Thanks
--
Matt
More information about the KDevelop-devel
mailing list