Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-core-dev] CDT C/C++ Parser


The parser has several different modes that generate different types of results:
  • ParserMode.QUICK_PARSE matches the structural syntax of a translation unit without parsing includes or going into function bodies.  This is the type of parse that is used to drive the outline view in the CDT.  It is fairly fast but is not completely accurate, as there is no way to resolve certain ambiguities in the C++ language without maintaining a symbol table.
  • ParserMode.STRUCTURAL_PARSE uses a symbol table to help develop a more accurate model of the code.  This type of parse follows includes but does not enter into function bodies.  
  • ParserMode.COMPLETE_PARSE parses function bodies, follows inclusions, maintains a symbol table and reports cross-references to the client.  
  • ParserMode.COMPLETION_PARSE parses some function bodies, follows inclusions, maintains a symbol table and returns a context (IASTCompletionNode) to the user that can be used to provide our content assist feature.  Cross-references are not reported.   In order to optimize the parse, we do not parse function bodies that are not near the offset where completion is requested.  
  • ParserMode.SELECTION_PARSE is similar to COMPLETION_PARSE, except it returns an result which tells you what code element resides in the editor selected between two offsets.  This mode is used to provide selection search/open declaration-type features.  

For what you are doing, I would suggest either STRUCTURAL_PARSE or COMPLETE_PARSE, depending on whether or not you require explicit cross-reference reporting, and whether or not you need to go into function bodies.  

Hope this helps,
JohnC
www.eclipse.org/cdt


cdt-core-dev-admin@xxxxxxxxxxx wrote on 05/28/2004 01:16:23 AM:

> Hi,
>
> We try to create a plug-in to plug the WS2WSDL tool in Axis C++ into CDT.
> For that we need to use the c/c++ parser. We saw that the parser doesn't
> provide the much more information like function types, parameters, return
> types etc.
>
> Source:
> http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/cdt-core-
> home/docs/rationalProposals/Parser.html?cvsroot=Tools_Project
>
> "The CDT Parser implements a parser callback.  However this callback
> presents very little information about the code.  It currently only
> supports functions, fields, classes, inclusion directives, and macro
> definitions.  It does not provide information about function bodies nor
> type information about functions and fields.  It is also does not cover
> C++ concepts such as namespaces, templates, and exceptions and does not
> cover typedefs."
>
> But we need following information:
> - about included header files
> - function name
> - reutrn type
> - parameter/type
> - variables
>
> Is there any possibility to extract those information by the existing parser?
>
> Pls help us by giving comments and references about this regard.
>
> Thanx.
> Reagards,
> Project Team(LSF - SriLanka)
> _______________________________________________
> cdt-core-dev mailing list
> cdt-core-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/cdt-core-dev

Back to the top