This project has moved and is read-only. For the latest updates, please go here.

AjaxDoc

Sep 11, 2011 at 9:18 AM

This is Off-Topic, but looking for the possibility of using this or related library as a Javascript parser
for extracting namespace, classes, methods and properties for documentation from Ajax library.

Currently, there is AjaxDoc, but the approach is not suitable for most uses.

Any suggestion is highly welcomed.

Best regards,
Paul. 

Sep 11, 2011 at 10:31 AM

I assume you don't actually want to run the code, just parse it and build an AST?  Jurassic as it stands can't do that, since all the parsing/AST code is marked internal.  However, it is reasonably self-contained and well documented so you could pull it out and use it as a starting point.

The files you would need are (at a minimum):

  • Compiler/Lexer/*.*
  • Compiler/Parser/*.*
  • Compiler/Expressions/*.*
  • Compiler/Statements/*.*

The code currently throws away comments, but that shouldn't be hard to fix.

All up, going this route would be a decent amount of work, but likely much less work than trying to do the same thing with V8 or Rhino.  There may be JS parsing libraries out there which would make life easier, but if so I haven't heard of them.

Sep 12, 2011 at 10:48 AM

Thanks for the reply. Since comments are not extracted by the parser if required, it might
take a little more time.

I have just found this, http://code.google.com/p/js-addin/

and exploring the possibility. If not possible, I will take a look at your parser and see if I can add
these features. 

Best regards,
Paul