Adding location info to the C++ parser
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Wed Mar 22 11:08:14 UTC 2006
On Tuesday 21 March 2006 13:56, Roberto Raggi wrote:
> > hmm, yes, this is a good idea too. However, Richard Dale came up with a
> > nice idea of having two sets of tokens, which i quote below:
>
> hmm, you don't need two set of tokens (or token positions).. token streams
> are very expensive, and column poisitions are *unstable* only in code
> generated by a substitution. Maybe you can generate a #pragma directive
> before the expanded code. The #pragma directive needs some information. For
> instance,
> - the original position
> - the macro definition (useful for code refactoring)
> - the start position of the actual arguments
> - ...
I wasn't meaning to suggest having duplicate sets of tokens streams, just a
way of telling whether a particular C++ token had originated via a
pre-processor expansion or whether it was in the original source. You can
even have nested pre-processor expansions, and it isn't obvious what to do
about them.
-- Richard
More information about the KDevelop-devel
mailing list