Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Invoking the DOM parser

The parser does not run (at least not out of the box) outside of the
eclipse environment. You best use create an eclipse plugin for your code
and run it together with the cdt-plugins in an eclipse application.

I recommend creating a CDT project containing your code. With that
creating an AST is easy: ITranslationUnit.getAST(...).

If that is not an option for you, you have to deal with a bunch of
   // For CDT 7.0, similar in previous releases
   ILanguage lang= GPPLanguage.getDefault();
   IncludeFileContentProvider fileCreator=
   IScannerInfo scannerInfo= new ExtendedScannerInfo();
   FileContent content=
   IParserLogService log= new DefaultLogService();
   IASTTranslationUnit ast= lang.getASTTranslationUnit(content,
                        fileCreator, null, 0, log); 


> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx 
> [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Stefan Holdermans
> Sent: Thursday, May 20, 2010 4:19 PM
> To: cdt-dev@xxxxxxxxxxx
> Subject: [cdt-dev] Invoking the DOM parser
> Importance: Low
> Hi all,
> Can someone provide me with some pointers on how to invoke 
> the CDT DOM parser on an arbitrary C source file on disc? 
> Searching Google has left me with some hints, but so far I 
> haven't been able to put together anything useful.
> It seems that I should start off by constructing a 
> CodeReader. But where do I find the .class file for 
> CodeReader, i.e., which .jar file do I have to include in my project?
> Thanks in advance,
>   Stefan_______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx

Back to the top