A very primitive PHP docblock parser

Well, as I mentioned in a previous post, I’d pined for a PHP 5.3 documentation generator that could handle Nephtali’s core API long enough, so I recently cobbled a very, very primitive PHP docblock parser that does the job.  There’s no formal markup generator. I’m just using Nephtali to generate a rudimentary display of the documentation.

The parser is currently being used to generate Nephtali’s API documentation, and so far it appears acceptable.  Now, upfront, let me assert the following:

  1. I’m not a great (or even average) parser writer.  Some might even label my skills poor or non-existant.
  2. Nephtali’s core API only makes use of namespaced contants and functions, so I didn’t have to add handling for classes (although I did carve out some space for their future implementation.)  For instance, it’s so specialized now that the only namespaces it recognizes are block namespaces (as is used in ncore.php.)
  3. I did this in a few days after being fed up, not after careful deliberation throughout a well conceived design process.

You just hand the nlib\doc_generator\start_parsing() some string code and a nlib\doc_generator\DocNode object, and the object will be filled up with the available namespaces. Each namespace will contain its corresponding constant and function objects.  Each function will posess a nlib\doc_generator\Doc object, which contains all of the appropriate doc block properties.  Again, very, very primitive.

Currently, the parser and dev tools are included with the Nephtali download in the nlib/doc_generator directory, although I’ll eventually pull this out into its own project.

So, if any of you have feedback, let me know.