Getting started with classparser ?
Victor_Roeder at GMX.de
Sat Sep 15 12:47:04 UTC 2001
> I'd like to use the classparser for a part that I'm writing, but I cannot
> find a simple example or documentation of how to use it. Could somebody
> please give me some pointers/small examples ?
The usage of the ClassParser (Jonas' one) is pretty simple. You just call
parse("aHeaderFile") and you're off (that's what the documentation tells you).
The ClassParser parses the given file and stores the informations in the
ClassStore. That's what the ClassParser does.
> I'm interested right now in
> how to retrieve the symbols contained in a particular file, in a generic
> way, not olny C or C++ ( which I beleive the classparser is able to do ).
In this case the ClassParser (Jonas) isn't the right horse to ride. What you
need is I think a lexical scanner. You can generate a scanner with e.g. flex.
The ClassParser uses such a lexical scanner to retrieve the tokens (symbols)
in a given file.
Look at parts/cppsupport/tokenizer.l + .h: There you can specify the tokens
and then you can generate a scanner with flex by giving the specified infos
to flex => "flex -+ otokenizer.cpp tokenizer.l" (or so)
But look up the manpage of flex to get more informations.
When you have a lexical scanner you are able to write a parser for a
particular language and more.
> I know that there're several other parts tha are using the classparser, but
> I'm still not able to understand completely how to use it.
The use of the ClassParser is rather easy. Writing an other parser using flex
is more difficult.
> On a different but related topic, when I looked at the code, it seems that
> there're portions of it that're not finished ( like the portion that
> loads/save the database to disk in PersistenClassStore and so on ). Is that
> true or I'm too asleep ?
Yes, a persistent ClassStore isn't implemented yet. That's "the royal pain in
the ass of KDevelop" (Roland named it this way :-). There's something like an
interface definition of the PersistentClassStore but nothing more.
> Lastly, I remember that Sadny mentioned somewhere that the class parser is
> able to handle all the languages that Gideon curretnly supports ( including
> PHP, Java, Python ). How does that work ( from a developer point of view
> that wants to use the classparser ) ?
In Gideon their exist several seperated parser: The ClassParser from Jonas
for C/C++ (and a modified one for Java) and a "line-based" PHP Parser from
Sandy and Bernd (I think). "Line-based" means that this parser goes line
after line and "parses" the code with regular expressions. A "symbol-based"
parser is planned :-).
> I sent an e-mail to Jonas Nording <jonas.nordin at syncom.se> but the email
> bounced back ( could not look up destination domain (syncom.se), invalid
> domain name ). Jonas is the mainainer of the classparser, and that's the
> e-mail that shows up in the code.
I tried to get him via mail and I got no response, too. Maybe he got an other
I hope my answer helps you in some cases.
to unsubscribe from this list send an email to kdevelop-devel-request at kdevelop.org with the following body:
More information about the KDevelop-devel