short-jsdoc
Version:
short and simple jsdoc Object Oriented syntax format and implementation
65 lines (24 loc) • 2.06 kB
Markdown
#JsDoc syntax
The Shortjsdoc tool has its own jsdoc - like language and this document try to describe it.
The following are the facts you should know for using this language:
##Object Oriented
This tool will generate an abstract syntax tree (AST) containing information about modules that contain classes that contains methods and properties, etc. This information is extracted from the comments.
## top to bottom file reading
The parser reads the comments from *top to bottom* to make the AST. For jsdoc specificly some nodes are priorized over others to form the tree. So for example when is found, then all the following in the source will belong to that module. When a is found then all the following nodes will belong to that class.
#Auto Contenible files
Files should be *auto contenible* - you can't make any assumptions about file parsing order. This means that if you are going to talk about a method in some source code file, then you must make sure that you specify the full tree path in that file at least once:
Backbone Backbone.View render now I can talk about render and Backbone.View class....
## free
You are free to include any custom to define your custom semantics. Those will be outputed in the generated AST as children of the 'parent/current' node. for example:
fly ro the moon {Number} 2014-02-03
Flexible:
#Modules
#Classes
#Methods
(Object Oriented concept). In JavaScript, a method is a function associated with context object, the 'this' name. This context object will be an instance of the class the method's belong to.
In JavaScript, very often, methods are defined as functions of the class prototype, for example:
MyClass.prototype.sayHi = function()....
We can also have static methods, this is functions associated to a class and not to any instance, for example,
MyClass.utilityMethod = function()...
#Functions
(JavaScript concept, not Object oriented)