Permalink
Browse files

removed JSDoc.pm

  • Loading branch information...
1 parent 546de8e commit aba1523dbc0e80c9331bb517f3c4d45f1cab8a98 @sstrigler committed Sep 7, 2012
View
47 utils/JSDoc/.jsdoc_config
@@ -1,47 +0,0 @@
-#
-# Configuration file for JSDoc
-#
-# The following hashes are used for supplying user-defined @attribute tags
-# that will be parsed. Non-standard attributes (such as @subclass) can be
-# added into these hashes, along with a code reference. The return value
-# from the code reference will be included in the documentation. All
-# non-standard tags that are not in the below hashes will be ignored.
-# The code reference will receive a reference to an array of
-# values that were supplied with the @... tag
-#
-
-# Class attributes
-#eval {
-# $CLASS_ATTRS_MAP{subclass} =
-# # subclass is the name of the @... tag
-# sub {
-# # Body from which a string is returned
-# '<DT><B>Subclasses:</B><DD>-' .
-# join('<DD>-',
-# map ({"<A HREF=\"$_.html\">$_</A>"}
-# map ( { s/\s*(\w+)\s*/$1/; $_} @{@_->[0]})
-# )
-# ) . '<P>'
-# };
-#
-# $CLASS_ATTRS_MAP{with} =
-# sub {
-# 'This class has a \'@with\' attribute'
-# };
-#};
-
-# Method attributes
-# eval {
-#
-# Uncomment this to allow the filename to be displayed for
-# each function
-#
-# $METHOD_ATTRS_MAP{filename} =
-# sub {
-# '<DT><B>Filename:</B> ' . $_[0] . '<P>'
-# };
-# $CLASS_ATTRS_MAP{filename} = $METHOD_ATTRS_MAP{filename};
-#
-# };
-#
-
View
622 utils/JSDoc/CHANGES
@@ -1,622 +0,0 @@
-JSDoc 1.10.2
-============
-
-- Fixed broken links to non-existant classes
-
-JSDoc 1.10.1
-============
-
-- Added support for @singleton tag, as supplied by Jeffrey To
-- Fixes to constants templates as supplied by Jeffrey To
-
-JSDoc 1.10
-==========
-
-- Added nested directory structure, as requested by Nitobi
-- Added @implements tag, as requested by Nitobi
-
-JSDoc 1.9.9.2
-=============
-
-- Fixed disappearing argument list for package-style class constructors
-
-JSDoc 1.9.9.1
-=============
-
-- Fixed bug in template dir designation that caused JSDoc to crash if
- run from an absolute path
-
-JSDoc 1.9.9
-===========
-
-- Added a commandline parameter for supplying a template directory
-
-- Adding sorting of class names on overview-summary-$filename.js
- (sf.net bug #1416564)
-
-- Fix for broken anchors from the overview-summary-$filename page to static
- methods (SF.net bug #1416543)
-
-JSDoc 1.9.8.1
-=============
-
-- Don't touch the file source (src) when processing the file overview data
-
-- Pick up functions as constructors of the @class tag is used
-
-JSDoc 1.9.8
-===========
-
-- Allow the @base tag to accept the form: @base ClassName URL (RFE 1114510)
-
-- Be more lenient with @param and @return types (RFE 1104728)
-
-- Corrected CSS error, changed "pts" to "pt"
-
-JSDoc 1.9.7
-===========
-
-- Added "--no-lexical-privates" option to ignore locally-defined values
- from within constructors
-
-- Fixed linking to static fields/methods
-
-JSDoc 1.9.6.2
-=============
-
-- Set correct permissions on files in packaging script
-
-- Fixed compile error on some versions of perl
-
-- Create distinct anchors for static methods and fields in HTML so that
- if there is a static and instance method of the same name, the links work
- correctly
-
-JSDoc 1.9.6.1
-=============
-
-- Updated unit tests for clearing of function contents
-
-- Removed collapsing of string literals; this was originally added for version
- 1.9.5.1 to avoid segfaults, but the decision has been made that it is up
- to the user to use a version of perl that doesn't segfault instead of
- trying to work around it in perl code.
-
-- Added (experimental) @exec tag for initialization blocks that should be 'run'
-
-JSDoc 1.9.6
-===========
-
-- Fix for incorrect return type and parameter types for static method
- listing in file overview
-
-- Clear out unused nested functions with the preprocessor to avoid problems
-
-JSDoc 1.9.5.8
-=============
-
-- Yet another fix for __defineGetter__ and __defineSetter__
-
-JSDoc 1.9.5.7
-=============
-
-- Fixed bug in syntax highlighting for single-line inline comments
-
-- Fixed bug in preprocessing of __defineGetter__ and __defineSetter__
-
-JSDoc 1.9.5.6
-=============
-
-- Fixed incorrect listing of private classes when --private not enabled
-
-JSDoc 1.9.5.4
-=============
-
-- Corrected bug with function assignment inside constructor
-
-JSDoc 1.9.5.3
-=============
-
-- Added ability to specify different file extensions on commandline
-
-JSDoc 1.9.5.2
-=============
-
-- Fixed formatted text munging for @class description
-
-- Added support for @package tag to be used with XMI export
-
-JSDoc 1.9.5.1
-=============
-
-- Added collapsing of string literals during preprocessing
-
-JSDoc 1.9.5
-===========
-
-- Added listing of global (static) methods to file overview summary, code
- submitted by Jeremy Gillick
-
-- Allow a global variable to be defined as a class from an anonymous
- function declaration
-
-JSDoc 1.9.4.2.1
-===============
-
-- Further fix for typed parameter names starting with a dollar sign
-
-JSDoc 1.9.4.2
-=============
-
-- Added ability to handle parameter names starting with a dollar sign
-
-JSDoc 1.9.4.1
-=============
-
-- Only use the first sentence for file and class summary on the
- overview pages
-
-- Add a non-breaking space in the overview summary tables when there is no
- appropriate value to display
-
-JSDoc 1.9.4
-===========
-
-- If there are multiple source files documented, the index page defaults
- to the overview summary for the main frame
-
-- Made JSDoc site link open in parent frame
-
-- Added overview and file summary tables (similar to package overview table
- in JavaDoc)
-
-JSDoc 1.9.3.1
-=============
-
-- Fixed duplicate class-tree output
-
-JSDoc 1.9.3
-===========
-
-- Added alpha release of XML and XMI output formats
-
-- Upgrade a function to a class if the @base tag is used
-
-- Fixed issue with sub-package nested classes requiring the @addon tag
-
-- Added the implicit "Object" class to the inheritance tree, as well as
- other classes that are referenced but not defined
-
-JSDoc 1.9.2.1
-=============
-
-- Added @addon tag, which is used when adding static methods to core classes
- or classes not defined within the files being documented
-
-- Fix for the base class of nested classes not being properly set
-
-- Fix for infinite recursion when all classes are private
-
-
-JSDoc 1.9.2
-===========
-
-- Removed unecessary table from overview-summary.tmpl
-
-- Added the @ignore tag to allow total hiding of functions
-
-- Fix for incorrect marking of methods as void when the return value is
- enclosed in parentheses
-
-- Fix so that methods with a @return tag but without a return statement
- are not marked as void
-
-- Fixed issue with not all files being listed in the file listing
-
-
-JSDoc 1.9.1.3
-=============
-
-- Fixed issue with backslashes in path
-
-- Fixed issue with <pre> tags and JavaScript code within fileoverview sections
-
-- Made documented versions of a method take precedence over a
- non-documented version
-
-- Added support for prototype assignment without parentheses
-
-- Added new @return label {type typeLink} Description... syntax
-
-JSDoc 1.9.1.2
-=============
-
-- Further improvements to mark_void_method
-
-- Improved handling of dynamically-bound methods within functions
-
-- Improved handling of erroneous documenting of 'this'
-
-- Fixed quoting on error message
-
-- Added a few new unit tests for testing general behaviour
-
-JSDoc 1.9.1.1
-=============
-
-- Fix for embarrassing bug in mark_void_method
-
-JSDoc 1.9.1
-===========
-
-- Fix for the incorrect void marking of methods that return a string literal
-
-- Fix to stop dynamic prototyping from adding non-dynamic classes
-
-- Added ability to add a link to parameter-type data, as follows:
- @param {TypeName http://my.link.com/} myParam Description of parameter
-
-JSDoc 1.9
-=========
-
-- Added support for a Constant Values page like in Javadoc
-
-- Added support for private classes (by marking the constructor with
- the @private attribute)
-
-- Added a "File" page with links to it in the navbar. The "File" page includes
- the file overview if one has been supplied, as well as the source view
- (unless jsdoc has been invoked with the --no-sources flag)
-
-- Added a --no-sources commandline option to not show the sourcecode for
- the JavaScript files
-
-- Added --package-naming commandline option, which specifies that the path
- leading to each source file will be preserved. This allows for the same
- filename to be used in different directories. Using the same class name
- in different packages is _not_ supported (yet)
-
-- Added JSDoc link and creation time in the footer of each page
-
-- Added support for @member tag to explicitly mark a method as a member of
- a class
-
-JSDoc 1.8.4
-===========
-
-- Added step in prepocessing to attempt to add missing @constructor tags where
- the 'new' operator is used in combination with a function name elsewhere
- in the source.
-
-- Only the first @extends marking (or assignment of an instance to a sub-
- class's prototype) will be used in determining the base class of a class.
-
-- Updated test.js to show off more features of JSDoc, as well as a general
- clean-up.
-
-- Changed the parser to consider a method to be a class declaration if its
- documentation contains a @class tag (in addition to the @constructor tag)
-
-JSDoc 1.8.3.1
-=============
-
-- Some general code cleanup and refactoring.
-
-- Properly fixed marking of void/non-void methods, and at the same time
- re-introduced recursive regexes (this time non-dynamic, as dynamic seem
- to be much too unstable)
-
-JSDoc 1.8.3
-===========
-
-- Changed the handling for __defineGetter__ and __defineSetter__
- to define a property instead of a method in the documentation
-
-- Fixed bug in parse_jsdoc_comment that didn't allow for email addresses
- to be entered verbatim (instead, the domain of the address was parsed
- as a tag)
-
-- Re-did the @fileoverview parsing, now other tags and inner {@link...}
- tags are included. Additionally, if only one file is processed and there
- is no project overview file included, the file's overview (if it exists)
- is used as the project overview. Thanks to Robert Flaherty for input
- and bug reports on this issue.
-
-JSDoc 1.8.2.1
-=============
-
-- Got rid of extra '*' with @fileoverview
-
-JSDoc 1.8.2
-=============
-
-- Fixed bug where other @tags were included as part of the @fileoverview
-
-- Added support for @version in method documentation
-
-- Partial fix for incorrect marking of void methods
-
-- Made field and return @type handling more robust and flexible
-
-JSDoc 1.8.1
-===========
-
-- Added @extends as a synonym for @base
-
-- Fixed doubled-up <UL> tags in hierarchy tree code (thanks to Robert Flaherty)
-
-- Fixed bug where a class's base class would not get recorded if
- there was a forward assignment of a static value to the class
- (thanks to Robert Flaherty)
-
-
-JSDoc 1.8
-=========
-
-- Remove the GLOBALS class if it is empty
-
-- Fixed case-sensitive sort in index
-
-- Added support for comments with long blocks of '*'s in the opening and
- closing of the doc string
-
-- Added sourcecode view
-
-- Fixed bug where named anonymous functions were not recognized as methods
- when assigned to prototypes
-
-- Allow for singletons to be declared with var
-
-- Allow for binding static properties to classes before they are defined
-
-- Added @overviewfile attribute for class documentation, inlines html or
- textfiles into the documentation
-
-- Added beginnings of unit testing
-
-- Don't add 'constructor' as an instance or class property
-
-- Added an @overviewfile tag which can be put in an independent
- jsdoc-comment block at the top of each file. This results in a project
- overview page for each file with an overview, similar to JavaDoc's
- package pages.
-
-- Added support for Mozilla's __defineGetter__ and __defineSetter__
-
-- Return type for methods is now Object, and is displayed instead of the
- 'function' declaration. The 'void' type is shown if no return can be
- found in the function and no other type is defined. The defaulting to
- Object also goes for fields, and is shown instead of the 'var' declaration
-
-- Allow usage of the {@link url label} construct for the @type tag
-
-
-JSDoc 1.7.2.1
-=============
-
-- Fixed segfault problem in huge constructors with deconstruct_constructor
- selection regex
-
-
-JSDoc 1.7.2
-===========
-
-- Added a @class tag to constructors, for providing class-specific information
-
-- Added handling for Singleton classes
-
-- Added handler for @base tag to denote inheritance
-
-JSDoc 1.7.1.4
-=============
-
-- Fixed bug introduced by refactoring of &format_link
-
-JSDoc 1.7.1.3
-=============
-
-- Added workaround in &format_link for apparent bug in some builds of
- perl 5.8.0
-
-- Fixed bug in handling of --recursive (was always recursive)
-
-JSDoc 1.7.1.2
-=============
-
-- Fixed problems with new preprocessor when confronted with nested classes
-
-JSDoc 1.7.1.1
-=============
-
-- Fixed bug where {@link}s inside of @params weren't processed
-
-JSDoc 1.7.1
-===========
-
-- Added --quiet switch and message to signify ending of successful execution
-
-- Fixed problem with perl segfaulting on big class prototype block definitions
-
-- Fixed incorrectly formatted {@link}s nested in other @attributes
-
-- Added preprocessor for handling private methods to replace bulky
- and buggy evaluate_constructor method
-
-JSDoc 1.7
-=========
-
-- Added usage of strict and warnings in JSDoc.pm
-
-- Added ability to set type information for method parameters
- (e.g. /** @param {String} userName The name of the current user */ )
-
-- Added support for class prototype initialization blocks (finally!)
-
-JSDoc 1.6.3.1
-=============
-
-- Fixed bug where static fields initialized to 0 are not picked up
-
-JSDoc 1.6.3
-===========
-
-- Removed the constraint that a nested class constructor must be marked
- with the @constructor attribute
-
-- Allow @constructor attribute to mark nested class constructors which would
- otherwise be considered static methods
-
-- Allow newlines as well as semi-colon for line-endings
-
-- Allow a leading '$' for field names
-
-
-JSDoc 1.6.2.1
-=============
-
-- Fixed splicing error for nested classes, thanks again to jdber
-
-
-JSDoc 1.6.2
-===========
-
-- Carry over overridden method description attributes even if there is
- no text description to carry over
-
-- Improved HTML in main.tmpl
-
-- Fixed infinite loop and recognition for when static inner class construct is
- used (thanks to jdber for the patch)
-
-- Added a Nested Class Summary section to the output documentation to display
- inner classes
-
-JSDoc 1.6.1.1
-=============
-
-- Fixed bug in carrying over description of overridden methods
-
-JSDoc 1.6.1
-===========
-
-- Improved the format_link function in jsdoc.pl so that {@links} will
- not be made to non-existent resources, and parentheses are not placed
- after a field name (as opposed to a method name)
-
-- Carry over method documentation for overridden methods if no new
- documentation has been supplied for the method. This is in following with
- javadoc functionality
-
-- Fixed /* functionality(whatever) bug
-
-- Fixed remaining problems with comments inside of parameter lists
-
-JSDoc 1.6
-=========
-
-- Big cleanup in jsdoc.pl in terms of writing templates to file
-
-- Fixed bug where multi-line @params don't work
-
-- Added filename-scoped frame, as well as the name of the filename for
- each class
-
-- Improved the linking implementation for @link and @see to do a better job
- in terms of not building broken links
-
-JSDoc 1.5.2
-===========
-
-- Changed the name '[default context]' for non-class functions to be
- GLOBALS, also made this name configurable with command-line parameters
-
-- Made jsdoc easily runnable from anywhere on the filesystem, without
- requiring installing JSDoc.pm in the @INC
-
-JSDoc 1.5.1
-===========
-
-- Added support for @requires in methods
-
-- Generic '@' attributes now work for constructors, such as @see and @throws.
- Also added support for @return and @returns for constructors
-
-- Fixed the @link construct to allow custom labels
-
-- Added standard support for @author in methods as well as classes
- (Thanks for Rainer Eschen for bringing me to my senses)
-
-- Fixed spacing for @author attributes
-
-
-JSDoc 1.5
-===========
-
-- Fixed bug that would break HTML links within documentation
-
-- Fixed bug in path to logo in IMG tags
-
-- Added support for type information for both methods and fields
-
-- Added suppport for @private in instance fields
-
-- Fixed bug where private methods would show up in the inherited methods list
- in subclasses
-
-- Private class methods are now also supported
-
-- Method parameters details are displayed in the same order as the parameter
- list for a method
-
-- Moved more info into the 'vars' member of methods, and away from the parser
-
-- Added @final (with synonym @const) for class and instance properties
-
-- Fix in parser where string literals bound to classes in a constructor were
- not caught by the parser
-
-
-
-JSDoc 1.4
-=========
-
-- Added @attributes: @author, @deprecated, @see, @version, @requires, @throws
-
-- Updated pod (removed documentation for non-existant parse_jsdoc_source,
-added a small example)
-
-- Added function to reset the parser (reset_parser)
-
-- Fixed bug where the same property could be bound to a class's prototype
-more than once
-
-- Fixed bug where embedded // comments would break the parser
-
-- Added ability to set project name, page footer, logo and project summary
-(thanks to Jeff Conrad for code and suggestions)
-
-- Added overview summary (thanks to Jeff Conrad for code)
-
-- Split up loading/parsing of sources file to prevent crashes that were caused
-by overloading the regex engine
-
-- Added overview-tree (thanks to Jeff Conrad for the code contribution)
-
-- Fixed bug where some assignments of methods to instances in a constructor
-would get lost
-
-- Fix in doc-parsing where a line with only a star and a newline would get
-passed over
-
-- Added ability to 'hide' methods with @private
-
-
-JSDoc 1.3
-=========
-
-- When a function is marked with @constructor, it will always be dealt
-with as a class
-
-- Improved doc regex
-
-- Added recursive directory handling
View
340 utils/JSDoc/COPYING
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
View
1,090 utils/JSDoc/JSDoc.pm
@@ -1,1090 +0,0 @@
-package JSDoc;
-
-=head1 NAME
-
-JSDoc - parse JavaScript source file for JSDoc comments
-
-=head1 SYNOPSIS
-
-Create JavaScript sourcefiles commented in a manner similar to javadoc
-(ie. with documentation starting with '/**' and then pass a list of references
-to JavaScript source to parse_code_tree:
-
- /**
- * This is a class for example purposes
- * @param name Name for the new object
- * @constructor
- */
- function MyClass(name){
- this.name = name;
- }
-
- $code_tree = parse_code_tree(@src_refs);
-
-A tree structure describing the code layout, inheritance and documentation
-is returned
-
-To clear the cache of classes and functions in the parser:
-
- reset_parser();
-
-
-=head1 DESCRIPTION
-
-The C<parse_code_tree> function requires a ref to a string holding the
-souce code of a javascript object file or files. It returns a data structure
-that describes the object hierarchy contained in the source file, as well
-as included documentation for all fields and methods. The resulting
-data structure has the following form (for each class):
-
- Class
- |
- +- classname
- |
- +- constructor_args
- |
- +- extends
- |
- +- constructor_detail
- |
- +- constructor_vars
- |
- +- class_methods
- | |
- | +- description
- | |
- | +- mapped_name
- | |
- | +- argument_list
- | |
- | +- vars
- |
- +- instance_methods
- | |
- | +- description
- | |
- | +- mapped_name
- | |
- | +- argument_list
- | |
- | +- vars
- |
- +- class_fields
- | |
- | +- field_description
- | |
- | +- field_name
- | |
- | +- field_value
- | |
- | +- field_vars
- |
- +- instance_fields
- | |
- | +- field_description
- | |
- | +- field_name
- | |
- | +- field_value
- | |
- | +- field_vars
- |
- +- inner_classes
- | |
- | +- class_name
- |
- +- inherits
- |
- +- Class
- |
- +- instance_fields
- |
- +- instance_methods
-
-
-There is also an additional entry under the key __FILES__ that contains
-keyed entries for each @tag that was defined in the first JSDoc comment
-block with a @fileoverview tag. Each entry under __FILES__ is keyed by
-filename, and is a hash reference.
-
-=head1 AUTHORS
-
-Gabriel Reid gab_reid@users.sourceforge.net,
-Michael Mathews michael@mathews.net
-
-=cut
-
-require 5.000;
-use strict;
-use warnings;
-use Exporter;
-
-# Recursion limit for recursive regexes
-use constant RECURSION => 10;
-
-use vars qw/ @ISA @EXPORT /;
-
-@ISA = qw(Exporter);
-@EXPORT = qw(parse_code_tree configure_parser reset_parser);
-
-# State
-use vars qw/ %CLASSES %FUNCTIONS %CONFIG $CTX_FILE /;
-
-# Regexes
-use vars qw/ $BAL_PAREN $BAL_BRACE $BAL_SQUAR $SQUOTE $DQUOTE $NONQUOTE
- $FUNC_DEF $RET_FUNC_DEF $ANON_FUNCTION $LITERAL $FUNC_CALL
- $JSDOC_COMMENT $MLINE_COMMENT $SLINE_COMMENT /;
-
-# This limits nested braces to 30 levels, but is much more
-# stable than using a dynamic regex
-$BAL_BRACE = qr/\{(?:[^\{\}])*\}/;
-$BAL_PAREN = qr/\((?:[^()])*\)/;
-$BAL_SQUAR = qr/\[(?:[^[\]])*\]/;
-for (1..RECURSION){
- $BAL_BRACE = qr/\{(?:[^\{\}]|$BAL_BRACE)*\}/;
- $BAL_PAREN = qr/\((?:[^()]|$BAL_PAREN)*\)/;
- $BAL_SQUAR = qr/\[(?:[^[\]]|$BAL_SQUAR)*\]/;
-}
-$SQUOTE = qr{'[^'\\]*(?:\\.[^'\\]*)*'};
-$DQUOTE = qr{"[^"\\]*(?:\\.[^"\\]*)*"};
-$NONQUOTE = qr{[^"'/]};
-$FUNC_DEF = qr/function\s+\w+(?:\.\w+)*\s*$BAL_PAREN\s*$BAL_BRACE/;
-$RET_FUNC_DEF = qr/function\s+(\w+(?:\.\w+)*)\s*($BAL_PAREN)\s*($BAL_BRACE)/;
-$ANON_FUNCTION = qr/function\s*$BAL_PAREN\s*$BAL_BRACE/;
-$LITERAL = qr/$DQUOTE|$SQUOTE|\d+/;
-$FUNC_CALL = qr/(?:new\s+)?\w+(?:\.\w+)*\s*$BAL_PAREN/;
-$JSDOC_COMMENT = qr{/\*\*[^*]*\*+(?:[^/*][^*]*\*+)*/};
-$MLINE_COMMENT = qr{/\*[^*]*\*+(?:[^/*][^*]*\*+)*/};
-$SLINE_COMMENT = qr{//[^\n]*};
-
-
-#
-# Public function that returns a datastructure representing the JS classes
-# and their documentation
-#
-sub parse_code_tree {
-
- &initialize_parser;
-
- #
- # This (I mean the "<<$_>>") is pretty hacky, but I've made it this
- # way to maintain backwards compatibility with anyone who's automatically
- # expecting this to work when they throw an array of refs to it. If you're
- # using this for your own work, please don't expect to be able to
- # put the context file in like this in the future
- #
- for my $js_src (map { ref and ${$_} or "<<$_>>" } @_){
- if ($js_src =~ /^<<(.+)>>$/){
- $CTX_FILE = $1;
- next;
- }
-
- # perlify os line-endings
- $js_src =~ s/(\r\n|\r)/\n/g;
-
- &parse_file_info($js_src);
- $js_src = &preprocess_source($js_src);
- &fetch_funcs_and_classes($js_src);
- }
-
- &map_all_properties();
- &build_class_hierarchy();
- &set_class_constructors();
- &filter_globals;
-
- while (my ($classname, $class) = each %CLASSES){
- delete $class->{_class_properties};
- delete $class->{_instance_properties};
- $class->{classname} = $classname unless $classname eq '__FILES__';
- }
- return \%CLASSES;
-}
-
-#
-# Parses up a a jsdoc comment into its component parts
-# PARAM: The document string to be parsed
-#
-sub parse_jsdoc_comment {
- my ($doc, $raw) = @_;
-
- # Remove excess '*' characters
- $doc =~ s/^[*\s]*([^*].*?)[*\s]*$/$1/s;
- $doc =~ s/^\s*\*//gm;
-
- my %parsed = (); # remember each part that is parsed
-
- # the first paragraph could be a summary statement
- # a paragraph may follow of variable defs (variable names start with "@")
- my ($summary, $variable_str) = $doc =~
- /^\s*
- (
- (?:[^{@]|(?:\{[^@]))*
- (?:\{\@
- (?:[^{@]|(?:\{[^@]))*)*
- )
- \s*
- (.*)
- $/xs;
- $summary =~ s/^\s*(\S.*?)\s*$/$1/s;
- $parsed{summary} = $summary;
-
- # two types of variable def can be dealt with here:
- # a @argument has a two-part value -- the arg name and a description
- # all other @<variables> only have a single value each (although there may
- # be many variables with the same name)
- if($variable_str) {
- my %vars = ();
- while ($variable_str =~ /
- (?<![\{\w])\@(\w+) # The @attribute, but not a {@link}
- \s*
- ((?:\{\@|\w\@|[^\@])*) # Everything up to the next @attribute
- /gsx) {
- my ($name, $val) = ($1, $2);
- $vars{$name} = [] unless defined $vars{$name};
- $val =~ s/\n/ /g unless $raw or $name eq 'class';
- push(@{$vars{$name}}, ($val =~ /^\s*(.*)\s*$/s)[0]);
- }
- $parsed{vars} = \%vars;
- }
- return \%parsed;
-}
-
-#
-# Builds up the global FUNCTION and CLASSES hashes
-# with the names of functions and classes
-#
-sub fetch_funcs_and_classes {
- my $js_src = shift;
-
- while ($js_src =~ m!
- # Documentation
- (?:
- /\*\* # Opening of docs
- ([^/]+
- (?:(?:[^*]/)+[^/]+)*
- )
- \*/\s*\n\s* # Closing of docs
- )?
-
- # Function
- (?:(?:function\s+(\w+)\s*(\(.*?\))\s*\{)|
-
- # Anonymous function
- (?:(\w+(?:\.\w+)*?)(\.prototype)?\.(\w+)\s*=\s*function\s*
- (?:\w+\s*)?(\(.*?\)))|
-
- # Instance property
- (?:(\w+(?:\.\w+)*?)\.prototype\.(\$?\w+)\s*=\s*(.*?)\s*[;\n])|
-
- #Inheritance
- (?:(\w+(?:\.\w+)*?)\.prototype\s*=
- \s*new\s*(\w+(?:\.\w+)*?)(?:\(.*?\))?\s*[;\n])|
-
- # Class property
- (?:(\w+(?:\.\w+)*?)\.(\$?\w+)\s*=\s*(.*?)\s*[;\n]))
- !gsx){
-
- my ($doc, $fname1, $arglist1, $cname1, $prototype, $fname2, $arglist2)
- = ($1 || '', $2, $3, $4, $5, $6, $7);
- my ($cname2, $propname1, $propval1) = ($8, $9, $10);
- my ($cname3, $baseclass) = ($11, $12);
- my ($cname4, $propname2, $propval2) = ($13, $14, $15);
- next if $doc =~ /\@ignore\b/;
-
- if ($fname1){
- &add_function($doc, $fname1, $arglist1);
- if ($doc =~ /\@(?:constructor|class|base)\b/){
- # Add all @constructor and @class methods as classes
- &add_class($fname1, $doc);
- }
- } elsif ($cname1 && $fname2 && $FUNCTIONS{$cname1}){
- # Anonymous functions added onto a class or class prototype
- &add_anonymous_function($doc, $cname1, $fname2,
- $arglist2, not defined($prototype));
-
- } elsif ($cname1 && $fname2 && not defined($FUNCTIONS{$cname1})){
- if ($doc =~ /\@(addon|base|constructor)\b/
- || $prototype || $CLASSES{$cname1}){
- # Called for methods added to the prototype of core classes
- &add_anonymous_function($doc, $cname1, $fname2,
- $arglist2, not defined($prototype));
- }
-
- } elsif ($cname2 && $propname1 && defined($propval1)) {
- &add_property($doc, $cname2, $propname1, $propval1, 0);
- } elsif ($cname3 && $baseclass){
- &set_base_class($cname3, $baseclass);
- } elsif ($cname4 && $propname2 && defined($propval2)
- && $propname2 ne 'prototype'
- && $cname4 ne 'this'){
-
- if ($FUNCTIONS{$cname4}
- || $CLASSES{$cname4}
- || $js_src =~ /function\s*\Q$cname4\E\b/){
- &add_property($doc, $cname4, $propname2, $propval2, 1);
- }
- }
- }
-}
-
-#
-# Add a function that is given as Class.prototype.blah = function(){...}
-#
-sub add_anonymous_function {
- my ($doc, $class, $function_name, $arg_list, $is_class_prop) = @_;
-
- # Just get out if the class is called 'this'. Reason for this is that
- # binding methods to 'this' should already be converted to binding methods
- # to the prototype, therefore binding to 'this' is only possible in
- # member functions, and is therefore not considered static or consistent
- # enough to be documented.
- return unless $class ne 'this';
- &add_class($class);
- my $fake_name = "__$class.$function_name";
-
- # This is dirty
- my $is_private = $doc =~ /\@private\b/;
-
- &add_function($doc, $fake_name, $arg_list, $is_private) and
- &add_property($doc, $class, $function_name, $fake_name, $is_class_prop);
-
- &add_class("$class.$function_name", $doc)
- if $doc =~ /\@(?:constructor|class)\b/;
-}
-
-
-#
-# Add a class to the global CLASSES hash
-#
-sub add_class {
- my $class = shift;
- warn "Can't add 'this' as a class, please file a bug report!"
- if $class eq 'this';
- my $class_doc = shift || '';
- if (!$CLASSES{$class}){
- $CLASSES{$class} = {};
- $CLASSES{$class}->{$_} = [] for qw(instance_fields class_fields
- instance_methods class_methods
- inner_classes);
- }
- unless ($CLASSES{$class}->{extends}){
- &set_base_class($class, $1)
- if $class_doc =~ /\@base\s+(\w+(?:\.\w+)*)/;
- }
-}
-
-#
-# Set the base class for a given class
-#
-sub set_base_class {
- my ($class, $base_class) = @_;
- &add_class($class);
- $CLASSES{$class}->{extends} = $base_class
- unless $CLASSES{$class}->{extends};
-}
-
-#
-# Add a property, either a class or instance method or field
-#
-sub add_property {
- my ($doc, $class, $property, $value, $is_class_property) = @_;
- &add_class($class);
- return if $property eq 'constructor';
- my $parsed_doc = &parse_jsdoc_comment($doc);
- $doc = $parsed_doc->{summary};
- my $key = $is_class_property ? '_class_properties' : '_instance_properties';
- for my $classref (@{$CLASSES{$class}->{$key}}){
- if ($classref->{property_name} eq $property){
- # Whine about rebinding functions to classes
- if ($FUNCTIONS{$value}){
- warn "Already bound property '$property' to '$class'\n";
- return;
- }
-
- # Only take on new attributes
- $classref->{property_doc} ||= $doc;
- $classref->{property_vars} ||= $parsed_doc->{vars};
- return;
- }
- }
-
- push @{$CLASSES{$class}->{$key}}, {
- property_doc => $doc,
- property_name => $property,
- property_value => $value,
- property_vars => $parsed_doc->{vars}
- };
-}
-
-
-#
-# Add a function and its documentation to the global FUNCTION hash
-#
-sub add_function {
- my ($doc, $function, $arg_list, $is_private) = @_;
-
- # clean remaining comments out of arg list
- # (all others are already gone)
- # Again, taken from Jeffrey Friedl's "Mastering Regular Expressions"
- {
- no warnings;
- $arg_list =~ s/
- ($NONQUOTE+|
- $DQUOTE$NONQUOTE*|
- $SQUOTE$NONQUOTE*)
- |$MLINE_COMMENT|$SLINE_COMMENT/$1/gx;
- }
-
- if ($FUNCTIONS{$function}){
- warn "Function '$function' already declared\n";
- unless ($doc && !$FUNCTIONS{$function}->{documentation}->{summary}){
- return 0;
- }
- }
- $FUNCTIONS{$function} = {};
- my $func = $FUNCTIONS{$function};
- $arg_list and $func->{argument_list} = join(" ", split("\\s+", $arg_list))
- or $func->{argument_list} = "()";
-
- my $documentation = parse_jsdoc_comment($doc);
- if ($documentation->{vars}->{member}){
- my ($classname) = map { s/^\s*(\S*)\s*$/$1/; $_ }
- @{$documentation->{vars}->{member}};
- &add_property($doc, $classname, $function, $function, 0)
- if $classname =~ /\w+/;
- }
- my $function_ref = $FUNCTIONS{$function};
-
- $function_ref->{documentation} = $documentation;
- $function_ref->{description} = $documentation->{summary};
- $function_ref->{vars} = $function_ref->{documentation}->{vars};
- $function_ref->{vars}->{filename} = $CTX_FILE;
- $function_ref->{vars}->{private} = 1 if $is_private;
- 1;
-}
-
-
-#
-# Map all the class and instance properties to their implementation
-#
-sub map_all_properties {
- for my $type (qw(_class_properties _instance_properties)){
- for my $class (keys %CLASSES){
- &map_single_property(
- $class,
- $_->{property_name},
- $_->{property_value},
- $_->{property_doc},
- $_->{property_vars}, $type eq '_class_properties')
- for @{$CLASSES{$class}->{$type}}
- }
- }
-
- # Map all the unattached functions
- my $classname = $CONFIG{GLOBALS_NAME} || 'GLOBALS';
- &add_class($classname);
- for my $function
- (grep !($FUNCTIONS{$_}->{is_mapped} || $CLASSES{$_}), keys %FUNCTIONS){
- &map_single_property(
- $classname, $function, $function, '', undef, 1);
- }
-
- # Map static inner classes
- for $classname (keys %CLASSES){
- my $i = 0;
- my @to_remove;
- for my $cprop (@{$CLASSES{$classname}->{class_methods}}){
- my $propname = $cprop->{mapped_name};
- if ($CLASSES{"$classname.$propname"}){
- push @to_remove, $i;
- push @{$CLASSES{$classname}->{inner_classes}},
- {class_name => "$classname." . $cprop->{mapped_name}};
- $FUNCTIONS{"$classname.$propname"} =
- delete $FUNCTIONS{"__$classname.$propname"};
- }
- $i++;
- }
- splice(@{$CLASSES{$classname}->{class_methods}}, $_, 1)
- for reverse @to_remove;
- }
-}
-
-#
-# Map a single instance or class field or method
-#
-sub map_single_property {
- my ($class, $prop_name, $prop_val,
- $description, $vars, $is_class_prop) = @_;
- if (!$FUNCTIONS{$prop_val}){
- push @{$CLASSES{$class}->{$is_class_prop
- ? 'class_fields' : 'instance_fields'}}, {
- field_name => $prop_name,
- field_description => $description,
- field_value => $prop_val,
- field_vars => $vars };
- return;
- }
- my %method;
- my $function = $FUNCTIONS{$prop_val};
- $function->{is_mapped} = 1;
- $method{mapped_name} = $prop_name;
-
- $method{$_} = $function->{$_} for
- qw/ argument_list description vars /;
-
- push @{$CLASSES{$class}->{$is_class_prop
- ? 'class_methods'
- : 'instance_methods'}}, \%method;
-}
-
-
-
-#
-# Build up the full hierarchy of classes, including figuring out
-# what methods are overridden by subclasses, etc
-# PARAM: The JS source code
-#
-sub build_class_hierarchy {
- # Find out what is inherited
- for my $class (map($CLASSES{$_}, sort keys %CLASSES)){
- my $superclassname = $class->{extends};
- !$superclassname and next;
- my $superclass = $CLASSES{$superclassname};
- $class->{inherits} = {};
- while ($superclass){
- $class->{inherits}->{$superclassname} = {};
- my @instance_fields;
- my @instance_methods;
-
- &handle_instance_methods($superclass, $superclassname,
- $class, \@instance_methods);
-
- &handle_instance_fields($superclass, $superclassname,
- $class, \@instance_fields);
-
- $superclassname = $superclass->{extends};
- $superclass = $superclassname ? $CLASSES{$superclassname} : undef;
- }
- }
-}
-
-#
-# This is just a helper function for build_class_hierarchy
-# because that function was getting way oversized
-#
-sub handle_instance_methods {
- my ($superclass, $superclassname, $class, $instance_methods) = @_;
- if ($superclass->{instance_methods}){
- INSTANCE_METHODS:
- for my $base_method (@{$superclass->{instance_methods}}){
- for my $method (@{$class->{instance_methods}}){
- if ($$base_method{mapped_name} eq $$method{mapped_name}){
-
- # Carry over the description for overridden methods with
- # no description (to be javadoc compliant)
- if (($base_method->{description} or $base_method->{vars})
- and not $method->{description}){
-
- $method->{description} = $base_method->{description};
- for my $varkey (keys(%{$base_method->{vars}})){
- $method->{vars}->{$varkey}
- = $base_method->{vars}->{$varkey}
- unless $method->{vars}->{$varkey};
- }
- }
- next INSTANCE_METHODS;
- }
- }
- for (keys %{$class->{inherits}}){
- my $inherited = $class->{inherits}->{$_};
- for my $method (@{$inherited->{instance_methods}}){
- next INSTANCE_METHODS
- if $$base_method{mapped_name} eq $method;
- }
- }
- push @$instance_methods, $$base_method{mapped_name};
- }
- $class->{inherits}->{$superclassname}->{instance_methods}
- = $instance_methods;
- }
-}
-
-#
-# This is just a helper function for build_class_hierarchy
-# because that function was getting way oversized
-#
-sub handle_instance_fields {
- my ($superclass, $superclassname, $class, $instance_fields) = @_;
- if ($superclass->{instance_fields}){
- INSTANCE_FIELDS:
- for my $base_field (@{$superclass->{instance_fields}}){
- for my $field (@{$class->{instance_fields}}){
- next INSTANCE_FIELDS if $field eq $base_field;
- }
- push @$instance_fields, $base_field->{field_name};
- }
- $class->{inherits}->{$superclassname}->{instance_fields}
- = $instance_fields;
- }
-}
-
-#
-# Set all the class constructors
-#
-sub set_class_constructors {
- for my $classname (keys %CLASSES){
- my $constructor = $FUNCTIONS{$classname};
- $CLASSES{$classname}->{constructor_args} =
- $constructor->{argument_list};
- $CLASSES{$classname}->{constructor_detail}
- = $constructor->{description};
-
- $CLASSES{$classname}->{constructor_vars} = $constructor->{vars} || {};
- }
-}
-
-#
-# Clear out everything from the parsed classes and functions
-#
-sub reset_parser {
- %CLASSES = ();
- %FUNCTIONS = ();
-}
-
-#
-# Set global parameters for the parser
-#
-sub configure_parser {
- %CONFIG = @_;
-}
-
-#
-# Set the initial defaults for the parser
-#
-sub initialize_parser {
- $CONFIG{GLOBALS_NAME} ||= 'GLOBALS';
-}
-
-#
-# Run through the source and convert 'confusing' JavaScript constructs
-# into ones that are understood by the parser, as well as stripping
-# out unwanted comment blocks.
-#
-# For example:
-#
-# Foo.prototype = {
-# bar: function(){ return "Eep!"; },
-# baz: "Ha!"
-# }
-#
-# becomes
-#
-# Foo.prototype.bar = function(){ return "Eep!"; };
-# Foo.prototype.baz = "Ha!";
-#
-sub preprocess_source {
- my ($src) = @_;
-
- # Make all the @extends tags into @base tags
- $src =~ s/\@extends\b/\@base/g;
-
- # This had better not break anything!
- $src = &deconstruct_getset($src);
-
- # Convert:
- # /** @singleton */
- # Foo = {...};
- # to:
- # /** @singleton */
- # Foo = function(){}
- # Foo.prototype = {...};
- $src =~ s!
- ($JSDOC_COMMENT\s*)
- (?:var\s*)?(\w+(?:\.\w+)*?)
- \s*=\s*{
- !index($1, '@singleton') == -1 ? "$1$2 = {" : "$1$2 = function(){}\n$2.prototype = {"!egx;
-
-
- # Convert:
- # /** @constructor */
- # Foo.Bar = function(){...}
- # to:
- # /** @constroctor */
- # Foo.Bar = function(){}
- # /** @constructor */
- # function Foo.Bar(){...}
- #
- # Note that we have to keep the original declaration so that Foo.Bar
- # can be recognized as a nested class. Yes, I know it's bad...
- $src =~ s!
- ($JSDOC_COMMENT\s*)
- (?:var\s*)?(\w+(?:\.\w+)*?)
- \s*=
- (\s*function)(?=\s*($BAL_PAREN)\s*\{)
- !index($1, '@constructor') == -1 ? "$1$2 = $3" : "$1$2 = function$4 {};\n$1$3 $2"!egx;
-
- # remove all uninteresting comments, but only if they're not inside
- # of other comments
- # (adapted from Jeffrey Friedl's "Mastering Regular Expressions"
- {
- no warnings;
- $src =~ s/
- ($NONQUOTE+|
- $JSDOC_COMMENT$NONQUOTE*|
- $DQUOTE$NONQUOTE*|
- $SQUOTE$NONQUOTE*)
- |$MLINE_COMMENT|$SLINE_COMMENT/$1/gx;
-
- 1 while $src =~ s/$JSDOC_COMMENT\s*($JSDOC_COMMENT)/$1/g;
- }
-
- # Alter the prototype-initialization blocks
- $src =~ s/
- (\w+(?:\.\w+)*)\.prototype
- \s*=\s*($BAL_BRACE)/deconstruct_prototype($1, $2)/egx;
-
- # Mark all constructors based on 'new' statements
- my %seen;
- my @classnames = grep { not $seen{$_}++ }
- $src =~ /\bnew\s+(\w+(?:\.\w+)*)\s*\(/g;
- for my $cname (@classnames){
- $src =~ s/($JSDOC_COMMENT?)
- (?=\s*function\s+\Q$cname\E\s*$BAL_PAREN
- \s*$BAL_BRACE)
- /&annotate_comment($1, '@constructor')/ex;
- }
-
- $src =~ s/
- ($JSDOC_COMMENT?)\s*
- (function\s+\w+(?:\.\w+)*\s*$BAL_PAREN\s*)
- ($BAL_BRACE)
- /&deconstruct_constructor($1, "$2$3")/egx;
-
- $src =~ s!
- (?:var\s+)?(\w+(?:\.\w+)*)
- \s*=\s*
- new\s+
- ($ANON_FUNCTION)!&deconstruct_singleton($1, $2)!egx;
-
- $src = &remove_dynamic_bindings($src);
-
- # Mark all void methods with "@type void"
- $src =~ s/($JSDOC_COMMENT?)\s*
- ((?:
- (?:function\s+\w+(?:\.\w+)*\s*$BAL_PAREN\s*)
- |
- (?:\w+(?:\.\w+)*\s*=\s*function\s*(?:\w+\s*)?$BAL_PAREN\s*)
- )$BAL_BRACE)
- /&mark_void_method($1, $2)/egx;
-
- # Clear nested functions (will save trouble later on)
- $src =~ s/($JSDOC_COMMENT?)\s*
- (\w+(?:\.\w+)*\s*=\s*)?
- (function(?:\s+\w+(?:\.\w+)*)?\s*$BAL_PAREN\s*)
- ($BAL_BRACE)
- /&clear_nested($1, $2, $3, $4)/egx;
-
- return $src;
-}
-
-sub clear_nested {
- my ($doc, $assign_to, $declaration, $funcbody) = @_;
- $assign_to ||= '';
- if ($doc =~ /^(?=.*\@constructor|\@class)(?=.*\@exec)/){
- warn "\@constructor or \@class can't be used together with \@exec\n";
- }
- if ($doc !~ /\@(constructor|class|exec)/
- or $assign_to =~ /^\w+\.prototype\./) {
- return "$doc\n$assign_to$declaration" . "{}\n";
- } elsif ($doc =~ /\@(constructor|class)/) {
- return "$doc\n$assign_to$declaration$funcbody";
- } else {
- my @visible_funcs = $funcbody =~ /
- ((?:$JSDOC_COMMENT)?
- (?:\w+\.\w+(?:\.\w+)*)\s*=\s*
- (?:
- $FUNC_DEF
- |
- $ANON_FUNCTION
- |
- $FUNC_CALL
- |
- \w+
- )\s*;)/gx;
- return join("\n", @visible_funcs);
- }
-}
-
-#
-# Remove dynamic binding.
-# Change this:
-#
-# function MyFunc(class){
-# var x = 2;
-# class.prototype.func = function(){};
-# return x;
-# }
-#
-# to:
-#
-# function MyFunc(class){
-# var x = 2;
-#
-# return x;
-# }
-#
-# and change this:
-#
-# function BindMethod(obj){
-# obj.someFunc = function(){ return null; };
-# return obj;
-# }
-#
-# to:
-#
-# function BindMethod(obj){
-#
-# return obj;
-# }
-#
-sub remove_dynamic_bindings {
- my ($src) = @_;
- while ($src =~ /$RET_FUNC_DEF/g){
- my ($fname, $params, $definition) = ($1, $2, $3);
- next unless $definition =~ /\bfunction\b|\w+\.prototype\./;
- my @params = split(/\s*,\s*/, substr($params, 1, length($params) - 2));
- for my $param (@params){
- $src =~ s/\b$param\.prototype\.[^;\n]*[;\n]//g;
- $src =~ s/\b$param\.\w+ = $ANON_FUNCTION//g;
- }
- }
- $src;
-}
-
-#
-# Annotate a method as being void if no @type can be found, and there is no
-# statement to return a value in the method itself.
-#
-sub mark_void_method {
- my ($doc, $funcdef) = @_;
- return "$doc\n$funcdef" if $doc =~ /\@(constructor|type|returns?)\b/;
- my ($fbody) = $funcdef =~ /^[^{]*($BAL_BRACE)/;
- $fbody =~ s/$FUNC_DEF/function x(){}/g;
- $fbody =~ s/$ANON_FUNCTION/function (){}/g;
- $doc = &annotate_comment($doc, '@type void')
- if $fbody !~ /\breturn\s+(?:(?:\w+)|(?:(["']).*?\1)|$BAL_PAREN)/;
- "$doc\n$funcdef";
-}
-
-#
-# A helper to change singleton declarations like
-#
-# MySingleton = new function(){this.x=function(){}}
-#
-# into:
-#
-# function MySingleton(){}
-# MySingleton.prototype.x = function(){};
-#
-sub deconstruct_singleton {
- my ($classname, $definition) = @_;
- $definition =~ s/function\s*$BAL_PAREN\s*\{(.*)\}\s*$/$1/s;
- $definition =~ s/\bthis\./$classname.prototype\./g;
- qq#
- function $classname(){}
- $definition;
- #;
-}
-
-#
-# A helper to preprocess_source, change prototype-initialization
-# blocks into multiple prototype-property assignments
-#
-sub deconstruct_prototype {
- my ($class, $src) = @_;
- $src =~ s/^\{(.*)\}$/$1/s;
- $src =~ s!
- (\w+)
- \s*:\s*
- (
- $ANON_FUNCTION
- |
- $FUNC_DEF
- |
- $FUNC_CALL
- |
- $LITERAL
- |
- $BAL_SQUAR
- |
- $BAL_BRACE
- |
- [-\w.+]+
- )
- \s*,?
- !$class.prototype.$1 = $2;!gsx;
-
- $src;
-}
-
-#
-# Unpacks a constructor into separate calls
-#
-sub deconstruct_constructor {
- my ($doc, $func_def) = @_;
- return "$doc$func_def" unless $doc =~ /\@(constructor|class)/;
- my ($classname) = $func_def =~ /function\s+(\w+(?:\.\w+)*)/;
- $func_def =~ s/
- (\{.*\})$
- /&deconstruct_inner_constructor($classname, $1)/esx;
- "$doc$func_def";
-}
-
-sub deconstruct_inner_constructor {
- my ($classname, $inner_src) = @_;
- $inner_src = substr($inner_src, 1, -1);
- my @doc_n_fnames = $inner_src =~ /($JSDOC_COMMENT?)\s*function\s+(\w+)/g;
-
- unless ($CONFIG{NO_LEXICAL_PRIVATES}){
- $inner_src =~ s/
- ($JSDOC_COMMENT)?
- \s*
- var
- \s+
- (\w+)/&annotate_comment($1) . "\n$classname\.prototype\.$2"/egx;
-
- $inner_src =~ s/
- ($JSDOC_COMMENT)?\s*
- ^\s*
- function
- \s+
- (\w+)
- /&annotate_comment($1) .
- "\n$classname\.prototype\.$2 = function"/egmx;
- }
-
- {
- no warnings;
- $inner_src =~ s/
- ($JSDOC_COMMENT\s*)?
- ^\s*this(?=\.)
- /$1$classname.prototype/gmx;
- }
-
- # Replace all bindings of private methods to public names
- for (my $i = 0; $i < @doc_n_fnames; $i += 2)
- {
- my ($doc, $fname) = @doc_n_fnames[$i, $i + 1];
- $inner_src =~ s/
- ($JSDOC_COMMENT\s*
- $classname\.prototype\.\w+)
- \s*=\s*
- $fname\s*[\n;]
- /$1 = function(){}/gx;
-
- $inner_src =~ s/
- ($classname\.prototype\.\w+)
- \s*=\s*
- $fname\s*[\n;]
- /$doc\n$1 = function(){}/gx;
- }
- "{}\n$inner_src";
-}
-
-#
-# Deconstruct mozilla's __defineGetter__ and __defineSetter__
-# (Yes, I know this goes against my principles...)
-#
-sub deconstruct_getset {
- my ($src) = @_;
- # Crack open the assignments for define(Getter|Setter)
- my $crack = sub {
- my $code = shift; $code =~ s/^.(.*).$/$1/s;
- my ($name) = split ",", $code;
- $name = ($name =~ /.*?(['"])([^'"]+)\1/)[1];
- $name;
- };
- for my $prefix ('get', 'set'){
- my $fname = "define\u${prefix}ter";
- $src =~ s/
- (\w+(?:\.\w+)*
- \.prototype)
- \.__${fname}__\s*($BAL_PAREN)/
- my $name = $crack->($2);
- "$1.$name = null"/gex;
- }
- $src;
-}
-
-
-#
-# Add an annotation (@tag) to a documentation block. The block is assumed to
-# be a valid JSDoc documentation block ==> /^\/\*\*.*\*\/$/
-# and no checking is done to verify this
-#
-sub annotate_comment {
- my $annotation = $_[1] || '@private';
- return "\n/** $annotation */" unless $_[0];
- substr($_[0], 0, -2) . " \n$annotation \n*/";
-}
-
-#
-# This is here to stop perl from segfaulting from deep recursion in regexes
-# The first character in the text _should_ be open_token, as everything
-# before open_token will be discarded, unless there is no matching text
-# at all.
-#
-sub find_balanced_block {
- my ($open_token, $close_token, $text) = @_;
- my ($count, $open, $close) = (0, 0, 0);
- return ('', $text) unless $text =~ /\Q$open_token\E/;
- $text =~ s/^.*?(?=\Q$open_token\E)//s;
- for (split //, $text){
- $count++;
- $open++ if $_ eq $open_token;
- $close++ if $_ eq $close_token;
- last unless ($open != $close);
- }
- warn "Unbalanced block\n" if ($open != $close);
- (substr($text, 0, $count), substr($text, $count));
-}
-
-#
-# Remove the $CONFIG{GLOBALS_NAME} class if it doesn't contain anything
-#
-sub filter_globals {
- my $global = $CLASSES{$CONFIG{GLOBALS_NAME}};
- delete $CLASSES{$CONFIG{GLOBALS_NAME}} if
- not (defined $global->{constructor_args} ||
- defined $global->{constructor_detail})
- && not (@{$global->{instance_methods}} ||
- @{$global->{instance_fields}} ||
- @{$global->{class_methods}} ||
- @{$global->{class_fields}});
-
- # Also get rid of extra info under the '__files__' key
- delete $CLASSES{__FILES__}->{$_} for qw(constructor_params constructor_args
- constructor_detail class_methods
- constructor_vars);
-}
-
-
-#
-# Try to grab the first block comment from the file that has a @fileoverview
-# tag in it, and get the file info from there
-#
-sub parse_file_info {
- my ($src) = @_;
- my %fileinfo = ( src => $src );
- while ($src =~ /($JSDOC_COMMENT)/g){
- local $_ = substr($1, 3, length($1) - 5); # Get the actual content
- if (/\@fileoverview\b/){
- my $doc = parse_jsdoc_comment($_, 1);
- %fileinfo = (%{$doc->{vars}}, %fileinfo);
- last;
- }
- }
- $CLASSES{__FILES__}->{$CTX_FILE} = \%fileinfo if $CTX_FILE;
-}
-
-1;
View
291 utils/JSDoc/JSDoc/XMI.pm
@@ -1,291 +0,0 @@
-package JSDoc::XMI;
-
-use strict;
-use warnings;
-use HTML::Template;
-use Data::Dumper;
-
-=head1 DESCRIPTION
-
- @packages
-
- @classes
- $classname
- $classid
- $classuuid
- $classvisibility (public|protected|private)
-
- @specializationids
- $specializationid
-
- $generalizationid
-
- @attributes
- $attributeid
- $attributeuuid
- $attributename
- $attributevisibility (public|protected|private)
- $ownerscope (instance|classifier)
- $classid
- $typeid
-
- @methods
- $methodid
- $methoduuid
- $methodname
- $methodvisibility (public|protected|private)
- $ownerscope (instance|classifier)
- $returnid
- $returnuuid
- $returntypeid
-
- @datatypes
- $datatypeid
- $datatypeuuid
- $datatypename
-
- @generalizations
- $generalizationid
- $generalizationuuid
- $generalizationchild
- $generalizationparent
-
-=cut
-
-sub new {
- my ($package, $location) = @_;
- bless {
- location => "${location}JSDoc/",
- idcounter => 2,
- types => {},
- classes => {},
- generalizations => {}
- }, $package;
-}
-
-sub output {
- my ($self, $classes) = @_;
-
- my $template = HTML::Template->new(
- filename => $self->{location} . 'xmi.tmpl',
- die_on_bad_params => 1);
-
- my @packages = $self->get_packages($classes);
- my @datatypes = $self->get_datatypes;
- my @generalizations = $self->get_generalizations;
-
- $template->param(
- packages => \@packages,
- datatypes => \@datatypes,
- generalizations => \@generalizations );
- return $template->output;
-}
-
-sub get_id {
- 'xmi.' . shift->{idcounter}++;
-}
-
-sub get_uuid {
- my @chars = ('A'..'Z', 'a'..'z', 0..9);
- my @uuid;
- for (1..32){
- push @uuid, $chars[rand(@chars)];
- }
- join("", @uuid);
-}
-
-sub get_packages {
- my ($self, $classes) = @_;
- my %packages;
- push(@{$packages{$_->{package}}}, $_)
- for $self->get_classes($classes);
- map {
- name => $_,
- classes => $packages{$_},
- packageid => $self->get_id,
- packageuuid => $self->get_uuid
- }, keys %packages;
-}
-
-sub get_classes {
- my ($self, $classes) = @_;
- my @classes;
-
- # Store all the class-ids before we start on anything else
- $self->add_class($_) for keys %$classes;
-
- for my $cname (keys %$classes){
- my $class = {
- classname => $cname,
- classid => $self->add_class($cname),
- classuuid => $self->get_uuid,
- classvisibility =>
- defined($classes->{$cname}->{constructor_vars}->{private})
- ? 'private' : 'public'
- };
- $class->{attributes} = $self->get_attributes(
- $class->{classid},
- $classes->{$cname});
-
- $class->{methods} = $self->get_methods(
- $class->{classid},
- $classes->{$cname});
-
- $class->{generalizationid} =
- $self->get_generalizationid($classes->{$cname});
-
- $class->{package} =
- defined($classes->{$cname}->{constructor_vars}->{package})
- ? $classes->{$cname}->{constructor_vars}->{package}->[0] : '';
-
- push @classes, $class;
- }
-
- for my $class (@classes){
- $class->{specializationids} = $self->get_specializationids($class);
- }
-
- @classes;
-}
-
-sub get_methods {
- my ($self, $classid, $class) = @_;
- my @methods;
-
- for my $k (qw(instance class)){
- for my $method (@{$class->{"${k}_methods"}}){
- my $type = defined($method->{vars}->{type})
- ? $method->{vars}->{type}->[0] : 'Object';
- my $meth = {
- methodid => $self->get_id,
- methoduuid => $self->get_uuid,
- methodname => $method->{mapped_name},
- methodvisibility =>
- defined($method->{vars}->{private})
- ? 'private' : 'public',
- ownerscope =>
- $k eq 'class' ? 'classifier' : 'instance',
- returnid => $self->get_id,
- returnuuid => $self->get_uuid,
- returntypeid => $self->add_type($type)
- };
- push @methods, $meth;
- }
- }
- return \@methods;
-}
-
-sub get_attributes {
- my ($self, $classid, $class) = @_;
- my @attributes;
- for my $k (qw(instance class)){
- for my $field (@{$class->{"${k}_fields"}}){
- my $type = defined($field->{field_vars}->{type})
- ? $field->{field_vars}->{type}->[0] : 'Object';
- my $attr = {
- attributeid => $self->get_id,
- attributeuuid => $self->get_uuid,
- attributename => $field->{field_name},
- attributevisibility =>
- defined($field->{field_vars}->{private})
- ? 'private' : 'public',
- ownerscope =>
- $k eq 'class' ? 'classifier' : 'instance',
- classid => $classid,
- typeid => $self->add_type($type)
- };
- push @attributes, $attr;
- }
- }
- \@attributes;
-}
-
-sub get_generalizationid {
- my ($self, $class) = @_;
-
- if ($class->{extends}){
- return $self->add_generalization(
- $class->{classname},
- $class->{extends});
- }
- '';
-}
-
-sub get_specializationids {
- my ($self, $class) = @_;
- my $cname = $class->{classname};
- my $cid = $self->add_class($cname);
-
- my @specializationids;
-
- for my $id (keys %{$self->{generalizations}}){
- my $generalization = $self->{generalizations}->{$id};
- if ($generalization->{parent} eq $cid){
- push @specializationids, { specializationid => $id };
- }
- }
- \@specializationids;
-}
-
-sub get_datatypes {
- my ($self) = @_;
- my @datatypes;
-
- while (my ($type, $id) = each(%{$self->{types}})){
- push @datatypes, {
- datatypeid => $id,
- datatypeuuid => $self->get_uuid,
- datatypename => $type };
- }
- @datatypes;
-}
-
-sub get_generalizations {
- my ($self) = @_;
- my @generalizations;
-
- while (my ($id, $generalization) = each(%{$self->{generalizations}})){
- push @generalizations, {
- generalizationid => $id,
- generalizationuuid => $self->get_uuid,
- generalizationchild => $generalization->{parent},
- generalizationparent => $generalization->{child}};
- }
- @generalizations;
-}
-
-sub add_type {
- my ($self, $type) = @_;
- $type =~ s/^\s*(\S+)\s*$/$1/;
- if (defined($self->{classes}->{$type})){
- return $self->add_class($type);
- } elsif (defined($self->{types}->{$type})){
- return $self->{types}->{$type};
- }
- $self->{types}->{$type} = $self->get_id;
-}
-
-sub add_class {
- my ($self, $class) = @_;
- $class =~ s/^\s*(\S+)\s*$/$1/;
- if (defined($self->{classes}->{$class})){
- return $self->{classes}->{$class};
- }
- $self->{classes}->{$class} = $self->get_id;
-}
-
-sub add_generalization {
- my ($self, $subclassname, $superclassname) = @_;
- my $subclassid = $self->add_class($subclassname);
- my $superclassid = $self->add_class($superclassname);
-
- my $generalization = {
- child => $subclassid,
- parent => $superclassid };
-
- my $generalizationid = $self->get_id;
- $self->{generalizations}->{$generalizationid} = $generalization;
- $generalizationid;
-}
-
-1;
View
72 utils/JSDoc/JSDoc/XML.pm
@@ -1,72 +0,0 @@
-package JSDoc::XML;
-
-use strict;
-use warnings;
-use HTML::Template;
-
-sub new {
- my ($package, $location) = @_;
- bless { location => "${location}JSDoc/" }, $package;
-}
-
-sub output {
- my ($self, $classes) = @_;
- my @classes = _preprocess(
- grep {defined($_->{classname})} values %$classes);
- my $template = HTML::Template->new(
- filename => $self->{location} . 'xml.tmpl',
- die_on_bad_params => 1);
-
- $template->param(classes => \@classes);
- return $template->output;
-}
-
-sub _preprocess {
- my @classes = @_;
- for (@classes){
- $_->{inherits} = _preprocess_inherits($_->{inherits});
- $_->{constructor_vars} = _preprocess_vars($_->{constructor_vars});
- for my $method (@{$_->{instance_methods}}, @{$_->{class_methods}}){
- $method->{vars} = _preprocess_vars($method->{vars});
- }
- for my $field (@{$_->{instance_fields}}, @{$_->{class_fields}}){
- $field->{field_vars} = _preprocess_vars($field->{field_vars});
- }
- }
- @classes;
-}
-
-sub _preprocess_inherits {
- my ($inherits) = @_;
- my @inherits;
- for my $class (keys %$inherits){
- my $inherit = {
- class => $class,
- methods => [map { name => $_ },
- @{$inherits->{$class}->{instance_methods}}]};
- push @inherits, $inherit;
- }
- \@inherits;
-}
-
-sub _preprocess_vars {
- my ($vars) = @_;
- return $vars if ref($vars) eq 'ARRAY';
- my @vars;
- for my $key (keys %$vars){
- my $var;
- if (ref($vars->{$key}) eq 'ARRAY'){
- $var = {
- '@name' => $key,
- values => [map { val => $_ }, @{$vars->{$key}}] };
- } else {
- $var = {
- '@name' => $key,
- values => [ { val => $vars->{$key} } ] };
- }
- push @vars, $var;
- }
- \@vars;
-}
-
-1;
View
250 utils/JSDoc/JSDoc/xmi.tmpl
@@ -1,250 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<XMI xmi.version="1.0">
- <XMI.header>
- <XMI.documentation>
- <XMI.exporter>JSDoc XMI Export</XMI.exporter>
- <XMI.exporterVersion>0.1</XMI.exporterVersion>
- </XMI.documentation>
- <XMI.metamodel xmi.name="UML" xmi.version="1.3"/>
- </XMI.header>
- <XMI.content>
- <Model_Management.Model xmi.id="xmi.1" xmi.uuid="10-0-0-5-3605f878:101c2e18bff:-8000">
- <Foundation.Core.ModelElement.name>JSDoc</Foundation.Core.ModelElement.name>
- <Foundation.Core.ModelElement.isSpecification xmi.value="false"/>