Hi Emerson,
this is quite interesting, since I have completed one myself last month,
too. My script is based on Perl and creates output primary for Doxygen
(JavaDoc like for C++ and Java). While it produces currently pseudo C++ as
step in between, it is no problem to generate pseudo Java, too. The script
is able to analyse the JavaScript code and can decide on its own, whether
you wrote just a function or you're using that function as a class
definition. It is also able to detect inheritance and supports a JavaScript
syntax for interfaces.
See example for commented source at:
http://cvs.berlios.de/cgi-bin/cvsweb.cgi/jsunit/lib/JsUnit.js?rev=1.16
<http://cvs.berlios.de/cgi-bin/cvsweb.cgi/jsunit/lib/JsUnit.js?rev=1.16&cont
ent-type=text/x-cvsweb-markup&cvsroot=jsunit>
&content-type=text/x-cvsweb-markup&cvsroot=jsunit
See the perdoc manual for the script:
JS2DOXY(1) User Contributed Perl Documentation JS2DOXY(1)
NAME
js2doxy - utility to convert JavaScript into something
Doxygen can understand
SYNOPSIS
js2doxy.pl < file.js > file.cpp
js2doxy.pl [Options] file.js
Options:
-? Print usage
-d, --debug Debug mode
-h, --help Show manual
-v, --version Print version
OPTIONS
-? Prints the usage of the script.
--debug Prints internal states to the error stream.
States are triggered by single bits:
Bit 0: Dump (1)
Bit 1: Database (2)
Bit 2: Detector (4)
Bit 3: Parser (8)
Bit 4: Scanner (16)
--help Shows the manual pages of the script using perl-
doc.
--version
Print the version of the utility and exits.
DESCRIPTION
This program will read from standard input or from the
given input file and convert the input into pseudo C++
that can be understood by help generator Doxygen. The
program parses the JavaScript and tries to attach the cor-
rect documentation comments. Any unattached comment is
placed into file scope.
HELP COMMANDS
The program will accept some additional help commands to
produce better C++:
\ctor This command starts the description of the con-
structor. It can be placed within the documenta-
tion comment for a class. It may be used also as
first command in such a comment.
\tparam TYPE PARAM COMMENT
This command sets the type of a parameter. It is
replaced in the documentation comment with the
\param PARAM COMMENT command (without the TYPE).
The program will use the type information in the
generated C++ code. It may not be the first com-
mand in a documentation comment.
\tparam TYPE COMMENT
This command sets the return type of a function.
It is replaced in the documentation comment with
the \return COMMENT command (without the TYPE).
The program will use the type information in the
generated C++ code. It may not be the first com-
mand in a documentation comment. This comand is a
short cut of the normal \return command and the
\type command supported by this program.
\type TYPE
This command sets the type of a variable or the
return type of a function. It may not be the first
command in a documentation comment.
LIMITATIONS
The program uses internally a has map for the database.
Therefore the sequence of the identified elements is by
chance and the grouping commands of Doxygen are not sup-
ported.
The program does currently not support single line docu-
mentation blocks or documentation blocks that *follow* the
declaration:
///
//!
/**< */
///<
/*!< */
//!< */
2002-06-07 perl v5.6.1 JS2DOXY(1)
-----Original Message-----
From: Emerson Cargnin - MSA [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 06, 2002 11:18 PM
To: [EMAIL PROTECTED]; Ant Users List
Subject: Task to generate Javascript Documentation
Me and my group are working in a tool to generate javadoc style
documentation for javascript files (.js files)
The tool is ready, we are just adapting it to an Ant Task. Are people
interested in it be submitted to ant optional tasks?
Emerson Cargnin - MSA
SICREDI - Ramal 3358-4860