Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] some questions about CDT c/cpp parsing


> (d) is there a way to hook into the parser to allow for vendor
> specific language customizations? (or at least tell the parser some
> sections are safe to ignore)

> > This has always been on our wish list and I don’t think we have a
> formal way of doing that yet. One problem would be knowing which
> parser to use for a given file since we are currently triggering of
> ContentType which would need to be different depending on what
> compiler you were using. The next would be how add rules to the
> parsers, or would you create a whole new parser.


There was a little work done at least as far as separating ANSI & GNU.  
Look at ICPPParserExtensionConfiguration and ICParserExtensionConfiguration as well as the ISourceCodeParser hierarchy.
Whether or not this actually is enough would depend on your customizations.  This is separate from knowing which parser to use in the first place.

> (g) are there different levels of parsing, for picking up a summary
> of the members of a source file? (I've seen there are constants for
> not following includes, but not e.g. skipping parsing the body of a
> function, assuming this is feasible)

> > In the old parser, we had the concept of Quick Parse which skipped
> over headers and function bodies and that is what we use to populate
> the CModel. I don’t think we have full support for that mode in the
> new DOM parser, at least the skipping function body part. As
> mentioned earlier, the Fast parse mode skips over headers if it can
> find information about them in the PDOM. Skipping function bodies
> would need to be done before we can use it for the CModel.
>
The DOM parser does skip optionally skip function bodies depending on the parse mode.

QUICK_PARSE, and STRUCTURAL_PARSE skip, COMPLETION_PARSE and SELECTION_PARSE skip if we are in a header file.
This also applies to a couple of other compound statement types, see the callers of AbstractGNUSourceCodeParser#skipOverCompoundStatement()

-Andrew

Back to the top