Fwd: Attention: Project: KActionWorkShop - A Standalone App for Visually edit XML KDE rc files

Roberto Raggi raggi at cli.di.unipi.it
Sat Dec 14 10:54:02 UTC 2002


Hi Serge,

On Saturday 14 December 2002 00:27, Serge Lussier wrote:
> There is only one thing I can tell is an important missing feature:
> A Class parser to be able to help me locate things into sources files as
> the Kdevelop classparser does. I can't import the Kdevelop ClassParser
> subdir into my project because of screwed Automake/Autoconf and Makifile.am
> troubles with
> Flex/yacc generated files in this subdir. That means I will have to code my
> own classparser (for .h/.cpp )...Unless someone tells me about how to
> well integrate the Classparser into my project ;-);-);-)
> I have error like: "lex.yy.c generated by tokenizer.c and tokenizer.cc..."

you can use my c++ parser.. you must copy parser.* lexer.* ast.* driver.* from 
cppsupport to your application, and remove all references to ProblemReporter 
in parser and lexer.. 

This is a simple test that prints toplevel declarations


    Driver driver;
    Lexer lexer;
    lexer.setSource( m_source );
    Parser parser( &driver,  &lexer );
    parser.setFileName( "<filename>" );

    TranslationUnitAST::Node translationUnit;
    parser.parseTranslationUnit( translationUnit );

    QPtrList<DeclarationAST> decls = translationUnit->declarations();

    QPtrListIterator<DeclarationAST> it( decls );
    while( it.current() ){
       DeclarationAST* decl = it.current();
       ++it;
       int startLine, startCol, endLine, endCol;
       decl->getStartPosition( &startLine, &startCol );
       decl->getEndPosition( &endLine, &endCol );

       kdDebug(9007) << "decl() = " << endl
                     << " startLine = " << startLine
                     << " startCol = " << startCol
                     << " endLine = " << endLine
                     << " endCol = " << endCol
                     << endl
                     << endl;
    }

please, note that the AST isn't finished yet!! and a few rules in the parser 
needs cleanup(especially Parser::parsedeclaration()), but if you need it you 
can help me to finish it ;)

ciao robe





More information about the KDevelop-devel mailing list