Parse docblocks

Niko Sams niko.sams at gmail.com
Tue Jul 8 06:32:01 UTC 2008


> Would you mind telling what "docblocks" are? (I'm guessing its similar
> to pythons docstrings, i.e. multi-line documentation in the source,
> especially used right after the function/class declaration).
oh, sorry.
It's basically the same as apidocs in c++, it's useful in this example:
/**
 * @return A
 **/
function getA() {
    $class = 'A';
    return new $class;
}

>> useful information the code itself doesn't provide (php is a dynamic language).
>>
>> But where could I implement this? The Lexer allready produces the
>> correct token-kinds,
>> but they are not filled into the TokenStream. Doing so (as Tokens) is
>> not really possible as
>> the parser can't deal with them.
>
> Whats the problem with doing this? Does it make the parser too complex?
As those comments are valid everywhere I can't handle them with the
current parser.

> Maybe we could extend kdev-pg or the existing token-stream to handle
> this?
do you think this could be implemented?
(DOCBLOCK | 0)
FUNCTION indentifier BRACE arguments RBRACE functionBody
-> functionDeclaration ;;

and at any other place the DOCBLOCK token has to be skipped. We have
to define that in the grammar.

niko




More information about the KDevelop-devel mailing list