New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ndoc

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ndoc - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

Makefile

8

HISTORY.md

@@ -0,1 +1,9 @@

1.0.0 / 2011-12-07
------------------
* Total refactoring + feature-compleete now
* Skin rewrite
* `Prototype` as test
0.1.0 / 2011-11-24

@@ -2,0 +10,0 @@ ------------------

521

lib/index.js

@@ -34,5 +34,15 @@ 'use strict';

//
// read source files and compose the document tree
//
/**
* class NDoc
*
* Handles documentation tree.
**/
/**
* new NDoc(files, options)
* - files (Array): array of source file paths
* - options (Hash): controlling options
*
* Read source `files` and compose the documentation tree.
**/
function NDoc(files, options) {

@@ -44,63 +54,196 @@

var tree = {};
// documentation tree consists of sections, which are populated with documents
var list = {
'': {
id: '',
type: 'section',
children: [],
description: '',
short_description: ''
}
};
// parse
// parse specified source files
files.forEach(function(file) {
var ndocs = parser.parse(Util.read(file));
for (var id in ndocs) {
ndocs[id].href = options.formatLink(file, ndocs[id].line);
var d = tree[id] = ndocs[id];
d.aliases = [];
if (d.type === 'namespace' || d.type === 'class' || d.type === 'mixin') {
d.namespaces = [];
d.classes = [];
d.mixins = [];
d.utilities = [];
d.constants = [];
d.class_methods = [];
d.class_properties = [];
d.instance_methods = [];
d.instance_properties = [];
console.log('Compiling file', file);
// parse file
try {
var text = Util.read(file);
// TODO: consider amending failing document inplace.
// Say, if it doesn't parse, insert a fake '*' line at failing `line` and retry
if (false) {
var ok = true;
do {
try {
var ndocs = parser.parse(text);
} catch(err) {
err.message.replace(/.*Parse error on line (\d+):.*/, function(all, line) {
line = Number(line);
var lines = text.split('\n');
console.error('Missing separator line at', line, lines.slice(line-1, line+1));
lines = lines.slice(0, line).concat(['*']).concat([lines[line]]).concat(['*']).concat(lines.slice(line+1));
text = lines.join('\n');
console.error('Trying with', lines.slice(line-2, line+2));
try {
ndocs = parser.parse(text);
} catch(err) {
lines = lines.slice(0, line-1).concat(['*']).concat([lines[line-1]]).concat(['*']).concat(lines.slice(line));
text = lines.join('\n');
console.error('Retrying with', lines.slice(line-2, line+2));
try {
ndocs = parser.parse(text);
} catch(err) {
ok = false;
}
}
});
}
} while(!ok);
}
var ndocs = parser.parse(text);
// do pre-distribute early work
for (var id in ndocs) {
var d = ndocs[id];
// assign hierarchy helpers
d.aliases = [];
d.children = [];
if (d.type === 'class') {
//d.superclass = null;
d.subclasses = [];
}
} else {
// collect sections
if (d.type === 'section') {
list[d.id] = d;
// collect flat list
} else {
// elements with undefined section get '' section,
// and will be resolved later, when we'll have full
// element list
list[(d.section || '') + '.' + d.id] = d;
// bound methods produce two methods with the same description but different signatures
// E.g. Element.foo(@element, a, b) becomes
// Element.foo(element, a, b) and Element#foo(a, b)
if (d.type === 'method' && d.bound) {
var d1 = extend(d);
d1.id = d.id.replace(/(.+)\.(.+)/, '$1#$2');
// link to methods
d.bound = d1.id;
d1.bound = d.id;
// insert bound method clone
list[(d.section || '') + '.' + d1.id] = d1;
}
}
// compose links to source files
if (options.formatLink) {
d.href = options.formatLink(file, d.line);
}
}
} catch(err) {
console.error('FATAL:', file, err.message || err);
process.exit(1);
}
});
// sort definitions, to help building hierarchy
var ids = Object.keys(tree).sort();
var nids = ids.length;
var sorted = {};
for (var i = 0; i < nids; ++i) sorted[ids[i]] = tree[ids[i]];
tree = sorted; sorted = null;
// TODO: section.related_to should mark related element as belonging to the section
/*for (var id in list) {
var d = list[id];
if (d.type === 'section' && d.related_to && list['.' + d.related_to]) {
var d1 = list['.' + d.related_to];
d1.id = d.id + '.' + d.related_to;
delete list['.' + d.related_to];
list[d1.id] = d1;
}
}*/
// build hierarchy
// N.B. Foo#a is child of Foo
// N.B. since we've sorted keys, Foo always comes before Foo#a
for (var i = 0; i < nids; ++i) {
var re = new RegExp('^' + ids[i] + '[#.]');
var cons = 'new ' + ids[i];
for (var j = i + 1; j < nids; ++j) {
if (ids[j].match(re)) {
tree[ids[j]].parent = ids[i];
} else if (ids[j] === cons) {
//tree[ids[j]].parent = ids[i];
//tree[ids[i]].new = ids[j];
// for each element with undefined section try to guess the section
// E.g. for ".Ajax.Updater" we try to find "SECTION.Ajax" element.
// If found, rename ".Ajax.Updater" to "SECTION.Ajax.Updater"
var t = Object.keys(list).sort();
var parted = t.map(function(id) {
return id.split(/[.#]/);
});
var len = parted.length;
// N.B. starting with 1 we skip "" section
for (var idx = 1; idx < len; ++idx) {
if (parted[idx][0] !== '') continue;
for (var i = idx + 1; i < len; ++i) {
if (parted[idx][1] === parted[i][1] && parted[i][0] !== '') {
var p = t[idx];
// prefix with guessed section
t[idx] = parted[i][0] + t[idx];
//if (!p) console.log('RENAME [%s] -> [%s]', p, t[idx], parted[idx], parted[i]);
// update flat list element, since key and value's id has been changed
var g = list[p];
delete list[p];
g.id = p = t[idx];
list[p] = g;
break;
}
}
if (tree[cons]) {
tree[cons].parent = ids[i];
}
// sort elements in case-insensitive manner
var tree = {};
t = t.sort(function(a, b) {
a = a.toLowerCase();
b = b.toLowerCase();
return a === b ? 0 : a < b ? -1 : 1;
});
t.forEach(function(id) {
tree[id] = list[id];
});
// rebuild the tree from the end to beginning.
// N.B. since the list we iterate over is sorted, we can determine precisely
// the parent of any element.
for (var i = t.length; --i >= 1; ) {
var id = t[i];
// parent name is this element's name without portion after the last '.' or '#'
var idx = Math.max(id.lastIndexOf('.'), id.lastIndexOf('#'));
// no '.' or '#' found? this is top level section. just skip it
if (idx < 0) continue;
// extract parent name
var pid = id.substring(0, idx);
// get parent element
var p = tree[pid];
// no parent element? skip this
if (!p) continue;
// parent element found. move this element to parent's children list, maintaing order
p.children.unshift(tree[id]);
//tree[id].parent = pid;
delete tree[id];
}
// cleanup list, reassign right ids after we resolved
// to which sections every element belongs
for (var id in list) {
var d = list[id];
delete list[id];
// compose new id
d.id = id.replace(/^[^.]*\./, '');
d.name = d.id.replace(/^.*[.#]/, '');
// sections have lowercased ids, to not clash with other elements
if (d.type === 'section') {
d.id = d.id.toLowerCase();
}
// prototype members have different paths
d.path = d.id.replace(/#/g, '.prototype.');
delete d.section;
// prune sections from list
if (d.type === 'section') {
continue;
}
//delete d.children;
list[d.id] = d;
}
// distribute methods and properties
for (var id in tree) {
var d = tree[id];
// assign aliases, subclasses, constructors
// correct method types (class or entity)
for (var id in list) {
var d = list[id];
// aliases
if (d.alias_of) {
tree[d.alias_of].aliases.push(d.id);
if (d.alias_of && list[d.alias_of]) {
list[d.alias_of].aliases.push(d.id);
}

@@ -110,64 +253,73 @@

if (d.type === 'class') {
if (d.superclass) {
tree[d.superclass].subclasses.push(d);
//if (d.superclass) console.log('SUPER', id, d.superclass)
if (d.superclass && list[d.superclass]) {
list[d.superclass].subclasses.push(d.id);
}
}
// members
if (d.type === 'method' || d.type === 'property' || d.type === 'constant') {
var register_in_parent_key = d.type === 'method' ? 'methods' : 'properties';
// methods and properties
if (d.type === 'method' || d.type === 'property') {
if (d.id.match(/^\$/)) {
d.type = 'utility';
}
if ((~d.id.indexOf('#'))) {
d.type = 'instance ' + d.type;
if (d.parent) {
tree[d.parent]['instance_' + register_in_parent_key].push(d.id);
if (d.bound) {
d.functionalized_self = d.parent;
}
}
} else {
} else if ((~d.id.indexOf('.'))) {
d.type = 'class ' + d.type;
if (d.parent) {
tree[d.parent]['class_' + register_in_parent_key].push(d.id);
if (d.bound) {
d.methodized_self = d.id;
}
}
}
// constructor
} else if (d.type === 'constructor') {
d.id = 'new ' + d.id.replace(/\.new$/, '');
}
// short names and paths
if (d.type === 'section' || d.type === 'namespace' || d.type === 'class' || d.type === 'mixin') {
d.name = d.id.replace(/^.*[.]/, '');
d.path = d.id;
} else if (d.type === 'constructor') {
d.name = 'new';
d.path = d.parent + '/new';
} else if (~d.type.indexOf('class ')) {
d.name = d.id.replace(/^.*[.]/, '');
d.path = d.parent + '/' + d.name;
} else if (~d.type.indexOf('instance ')) {
d.name = d.id.replace(/^.*[#]/, '');
d.path = d.parent + '/prototype/' + d.name;
}
// tree is hash of sections.
// convert sections to uniform children array of tree top level
var children = [];
for (var id in tree) {
if (id === '') {
children = children.concat(tree[id].children);
} else {
throw 'Unknown document type: ' + d.type;
children.push(tree[id]);
}
delete tree[id];
}
tree.children = children;
// store tree and flat list
this.list = list;
this.tree = tree;
}
/**
* NDoc#toJSON(options) -> String
*
* Renders this documentation tree to JSON string.
**/
NDoc.prototype.toJSON = function(options) {
return JSON.stringify({
var list = {};
for (var id in this.list) {
var d = this.list[id];
list[id] = {
id: d.id,
type: d.type,
name: d.name,
path: d.path,
parent: d.parent,
section: d.section,
};
}
return JSON.stringify(extend(options, {
list: this.list,
tree: this.tree,
packageName: options.packageName,
packageVersion: options.packageVersion,
date: (new Date).toUTCString(),
readme: options.index && Util.read(options.index),
sections: [],
src_code_text: options.viewSourceLabel,
src_code_href: options.linkFormat,
});
}));
};
/**
* NDoc#toHTML(options) -> String
*
* Renders this documentation tree to HTML string.
**/
NDoc.prototype.toHTML = function(options) {

@@ -177,4 +329,6 @@

var md2html = require('marked');
//var md2html = require('robotskirt').toHtmlSync;
//var highlight = require('highlight').Highlight;
// prepare rendering function
// TODO: store it for further reuse, and get rid of jade dependency?
var path = Util.join(options.skin, 'templates', 'layout.jade');

@@ -184,77 +338,99 @@ var str = Util.read(path);

filename: path,
pretty: true
pretty: false
});
var tree = this.tree;
for (var i in tree) {
// it's illegal to have slashes in HTML elements ids.
// replace them with dashes
var list = this.list;
for (var i in list) {
var obj = list[i];
// path should be HTML valid id
tree[i].path = tree[i].path.replace(/\//g, '-');
///console.log(i);
///tree[i].deprecated = true;
obj.path = obj.path.replace(/\//g, '-');
}
function htmlize(text) {
var r = md2html(text)//.toString('utf8')
// honor [[method-id]] short links
.replace(/\[\[(.+?)\]\]/g, function(all, id) { return short_link(id); });
// render link
// N.B. logic is way tricky to move to templates.
// beside, this function is used as parameter in some Array#map() operations
function link(obj, short, classes) {
if (typeof obj === 'string') obj = list[obj] || {id: obj};
// broken link. `options.brokenLinks` define action
if (!obj.path) {
return obj.id;
/*if (options.brokenLinks === 'throw') {
throw 'Link is broken: ' + obj.id;
}
return options.brokenLinks === 'show' ? '[[' + obj.id + ']]' : obj.id;*/
}
//
var r = '<a href="#' + obj.path
+ '" class="' + (classes||[]).join(' ')
+ '" title="' + obj.id + (obj.type ? ' (' + obj.type + ')' : '')
+ '" data-id="' + obj.id + '">';
r += typeof short === 'string' ? short : short ? obj.name : obj.id;
r += '</a>';
return r;
}
function breadcrumbs(obj) {
if (typeof obj === 'string') obj = tree[obj];
var r = [];
while (obj) {
r.unshift(obj);
obj = obj.parent && tree[obj.parent];
// convert markdown to HTML
function markdown(text, inline) {
var r = text;
// render markdown
r = md2html(r);
/* fixed
// restore &entities;
r = r.replace(/&amp;(\w+);/g, function(all, entity) {
return '&' + entity + ';';
});
*/
/* considered wrong
// trim content in <pre><code> CONTENT </code></pre>
r = r.replace(/<pre><code>([\s\S]*?)<\/code><\/pre>/g, function(all, content) {
return '<pre><code>' + content.trim() + '</code></pre>';
});
*/
// FIXME: highlight code
/*r = r.replace(/<code>([\s\S]*?)<\/code>/g, function(all, content) {
return '<code>' + highlight(content) + '</code>';
});*/
// inline markdown means to strip enclosing tag. <p /> in this case
if (inline) {
r = r.slice(3, -4);
}
// desugar [[foo#bar]] tokens into local links
// N.B. in order to not apply conversion in <code> blocks,
// we first store replace code blocks with nonces
var codes = {};
r = r.replace(/(<code>[\s\S]*?<\/code>)/g, function(all, def) {
var nonce = Math.random().toString().substring(2);
codes[nonce] = def;
return '@-=@=-@' + nonce + '@-=@=-@';
});
// convert [[link]] to links
r = r.replace(/\[\[([\s\S]+?)\]\]/g, function(all, def) {
var def = def.split(/\s+/);
var id = def.shift();
// invalid references don't produce links
if (!list[id]) {
if (options.brokenLinks === 'throw') {
throw 'Link is broken: ' + all + '\n' + r;
}
return options.brokenLinks === 'show' ? all : id;
}
//
var obj = extend(list[id], {
name: def.join(' ') || id
});
return link(obj, true, ['link-short']);
});
// restore code blocks, given previously stored nonces
r = r.replace(/@-=@=-@(\d+)@-=@=-@/g, function(all, nonce) {
return codes[nonce];
});
//
return r;
}
function get_children(obj) {
if (typeof obj === 'string') obj = tree[obj];
return ['new ' + obj.id]
.concat(obj.namespaces || [])
.concat(obj.classes || [])
.concat(obj.mixins || [])
.concat(obj.utilities || [])
.concat(obj.constants || [])
.concat(obj.class_methods || [])
.concat(obj.class_properties || [])
.concat(obj.instance_methods || [])
.concat(obj.instance_properties || [])
.map(function(id) {
return tree[id];
})
.filter(function(x) {
return !!x;
});
}
function class_for(obj, path) {
if (typeof obj === 'string') obj = tree[obj];
///console.error('CF', obj)
var r = [obj.type.replace(/ /g, '-')];
obj.path === path && r.push('current');
// TODO: current-parent for every parent
//var children = get_children(obj);
return r.join(' ');
}
function link(obj, short) {
if (typeof obj === 'string') {
if (!tree[obj]) return obj;
obj = tree[obj];
}
return '<code><a href="#' + obj.path + '" title="' + obj.id + ' (' + obj.type + ')" data-id="' + obj.id + '">' + (short ? obj.name : obj.id) + '</a></code>';
}
function short_link(obj) {
if (typeof obj === 'string') {
obj = tree[obj] || {id: obj, path: obj, type: 'instance method'};
}
return '<code><a href="#' + obj.path + '" title="' + obj.id + ' (' + obj.type + ')" class="link-method">' + obj.id + '</a></code>';
}
// given signature object, recompose its textual representation
function signature(obj, sig) {
if (typeof obj === 'string') obj = tree[obj];
if (typeof obj === 'string') obj = list[obj];
var r = obj.id;

@@ -264,6 +440,9 @@ if (sig.args) {

sig.args.forEach(function(arg, idx, args) {
// skip the first bound argument for prototype methods
var skip_first = obj.bound && ~obj.id.indexOf('#');
var a = arg.name;
if (obj.bound && !idx) a = '@' + a;
if (a.default_value) a = a + ' = ' + a.default_value;
if (idx) a = ', ' + a;
if (!idx && skip_first) return; //a = '@' + a;
if (arg.default_value) a = a + ' = ' + arg.default_value;
// compensate for possibly skipped first argument
if (idx > (skip_first ? 1 : 0)) a = ', ' + a;
if (arg.ellipsis) a += '...';

@@ -275,35 +454,19 @@ if (arg.optional) a = '[' + a + ']';

}
if (sig.returns) {
//r += ' &rarr; ' + sig.returns.map(link).join(' | ');
r += ' &rarr; ' + sig.returns.join(' | ');
}
return r;
}
function signatures(obj) {
return '<pre class="syntax">' + (obj.signatures || [{signature: obj.id, returns: obj.returns}]).map(signature.bind(null, obj)).join('\n').replace(/(^\s+|\s+$)/g, '') + '</pre>';
}
var vars = {
packageName: options.packageName,
packageVersion: options.packageVersion,
// collect context for rendering function
var vars = extend(options, {
list: this.list,
tree: this.tree,
date: (new Date).toUTCString(),
readme: options.index && Util.read(options.index),
sections: [],
src_code_text: options.viewSourceLabel,
src_code_href: options.linkFormat,
tree: tree,
path: '/',
htmlize: htmlize,
breadcrumbs: breadcrumbs,
get_children: get_children,
class_for: class_for,
//--
link: link,
short_link: short_link,
signature: signature,
signatures: signatures
};
markdown: markdown,
signature: signature
});
// render HTML
var html = fn(vars);
return html;
};

@@ -6,5 +6,5 @@ /* Jison generated parser */

yy: {},
symbols_: {"error":2,"file":3,"world":4,"EOF":5,"/**":6,"tags":7,"*":8,"ndoc_and_includes_and_fires":9,"comment":10,"**/":11,"tag_list":12,"tag":13,",":14,"DEPRECATED":15,":":16,"NUMBER":17,"..":18,"READONLY":19,"INTERNAL":20,"CHAINABLE":21,"SECTION":22,"name":23,"ALIASOF":24,"RELATEDTO":25,"BELONGSTO":26,"ndoc":27,"INCLUDES":28,"names":29,"FIRES":30,"events":31,"TEXT":32,"section":33,"namespace":34,"class":35,"mixin":36,"property":37,"constant":38,"signatures":39,"argument_descriptions":40,"argument_description":41,"*-":42,"(":43,"names_alternation":44,")":45,"):":46,"event":47,"NAME":48,".":49,"#":50,"?":51,"|":52,"value":53,"STRING":54,"BOOLEAN":55,"REGEXP":56,"[":57,"value_list":58,"]":59,"...":60,"{":61,"key_value_list":62,"}":63,"key":64,"name_or_value":65,"==":66,"CLASS":67,"<":68,"MIXIN":69,"->":70,"returns":71,"=":72,"signature":73,"method":74,"NEW":75,"args":76,"@":77,"arg":78,"$accept":0,"$end":1},
terminals_: {2:"error",5:"EOF",6:"/**",8:"*",11:"**/",14:",",15:"DEPRECATED",16:":",17:"NUMBER",18:"..",19:"READONLY",20:"INTERNAL",21:"CHAINABLE",22:"SECTION",24:"ALIASOF",25:"RELATEDTO",26:"BELONGSTO",28:"INCLUDES",30:"FIRES",32:"TEXT",42:"*-",43:"(",45:")",46:"):",48:"NAME",49:".",50:"#",51:"?",52:"|",54:"STRING",55:"BOOLEAN",56:"REGEXP",57:"[",59:"]",60:"...",61:"{",63:"}",66:"==",67:"CLASS",68:"<",69:"MIXIN",70:"->",72:"=",75:"NEW",77:"@"},
productions_: [0,[3,2],[4,0],[4,7],[7,0],[7,1],[12,1],[12,3],[13,1],[13,3],[13,5],[13,1],[13,1],[13,1],[13,3],[13,3],[13,3],[13,3],[9,1],[9,3],[9,3],[10,0],[10,1],[27,1],[27,1],[27,1],[27,1],[27,1],[27,1],[27,1],[27,2],[40,1],[40,2],[41,5],[41,6],[31,1],[31,3],[47,1],[47,3],[23,1],[23,3],[23,3],[29,1],[29,3],[44,1],[44,1],[44,3],[53,1],[53,1],[53,1],[53,1],[53,1],[53,3],[53,4],[53,3],[58,0],[58,1],[58,3],[62,0],[62,3],[62,5],[64,1],[64,1],[65,1],[34,1],[33,3],[35,2],[35,4],[36,2],[37,3],[38,3],[39,1],[39,3],[73,1],[73,3],[73,2],[74,4],[74,5],[71,1],[71,1],[71,3],[76,0],[76,1],[76,3],[76,4],[76,5],[76,5],[78,1],[78,3],[78,2]],
symbols_: {"error":2,"file":3,"world":4,"EOF":5,"/**":6,"tags":7,"ndoc_and_includes_and_fires":8,"comment":9,"**/":10,"tag_list":11,"tag":12,",":13,"DEPRECATED":14,":":15,"NUMBER":16,"..":17,"READONLY":18,"INTERNAL":19,"CHAINABLE":20,"SECTION":21,"name":22,"ALIASOF":23,"RELATEDTO":24,"BELONGSTO":25,"ndoc":26,"INCLUDES":27,"names":28,"FIRES":29,"events":30,"TEXT":31,"section":32,"namespace":33,"class":34,"mixin":35,"signatures":36,"argument_descriptions":37,"argument_description":38,"*-":39,"(":40,"names_alternation":41,")":42,"):":43,"event":44,"NAME":45,".":46,"#":47,"?":48,"|":49,"value":50,"STRING":51,"BOOLEAN":52,"REGEXP":53,"[":54,"value_list":55,"]":56,"...":57,"{":58,"key_value_list":59,"}":60,"key":61,"name_or_value":62,"==":63,"CLASS":64,"<":65,"MIXIN":66,"property":67,"->":68,"returns":69,"constant":70,"=":71,"signature":72,"method":73,"NEW":74,"args":75,"@":76,"arg":77,"$accept":0,"$end":1},
terminals_: {2:"error",5:"EOF",6:"/**",10:"**/",13:",",14:"DEPRECATED",15:":",16:"NUMBER",17:"..",18:"READONLY",19:"INTERNAL",20:"CHAINABLE",21:"SECTION",23:"ALIASOF",24:"RELATEDTO",25:"BELONGSTO",27:"INCLUDES",29:"FIRES",31:"TEXT",39:"*-",40:"(",42:")",43:"):",45:"NAME",46:".",47:"#",48:"?",49:"|",51:"STRING",52:"BOOLEAN",53:"REGEXP",54:"[",56:"]",57:"...",58:"{",60:"}",63:"==",64:"CLASS",65:"<",66:"MIXIN",68:"->",71:"=",74:"NEW",76:"@"},
productions_: [0,[3,2],[4,0],[4,6],[7,0],[7,1],[11,1],[11,3],[12,1],[12,3],[12,5],[12,1],[12,1],[12,1],[12,3],[12,3],[12,3],[12,3],[8,1],[8,3],[8,3],[9,0],[9,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,2],[37,1],[37,2],[38,5],[38,6],[30,1],[30,3],[44,1],[44,3],[22,1],[22,3],[22,3],[28,1],[28,3],[41,1],[41,1],[41,3],[50,1],[50,1],[50,1],[50,1],[50,1],[50,3],[50,4],[50,3],[55,0],[55,1],[55,3],[59,0],[59,3],[59,5],[61,1],[61,1],[62,1],[32,3],[33,1],[34,2],[34,4],[35,2],[67,3],[70,3],[36,1],[36,2],[72,1],[72,3],[72,1],[72,1],[72,2],[73,4],[73,5],[69,1],[69,1],[69,3],[75,0],[75,1],[75,3],[75,5],[75,4],[77,1],[77,3],[77,2]],
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {

@@ -20,8 +20,28 @@

var x = $$[$0-2];
for (var i in $$[$0-4]) x[i] = $$[$0-4][i];
x.description = $$[$0-1].text;
for (var i in $$[$0-3]) x[i] = $$[$0-3][i];
// amend description
var desq = $$[$0-1].text;
// strip leading *
desq = desq.replace(/\s*\n\s*\*/g, '\n').replace(/^\*\n*/, '');
// trim leading spaces from description
var lead = desq.match(/^\s+/);
if (lead) {
var re = new RegExp('\n' + lead[0], 'g');
desq = desq.substring(lead[0].length).replace(re, '\n');
}
x.description = desq.trim();
// short description lasts until the first empty line
x.short_description = x.description.replace(/\n\n[\s\S]*$/, '\n');
x.line = ($$[$0-1].line + 1);
// register
if (this.$[x.id]) {
console.error('name clash: ' + x.id);
}
this.$[x.id] = x;
// FIXME: remove once tree is build ok
/*this.$[x.id] = {
id: x.id,
type: x.type,
section: x.section
};*/

@@ -63,11 +83,11 @@ break;

break;
case 30: this.$.arguments = $$[$0]
case 28: this.$.arguments = $$[$0]
break;
case 31: this.$ = [$$[$0]]
case 29: this.$ = [$$[$0]]
break;
case 32: this.$.push($$[$0])
case 30: this.$.push($$[$0])
break;
case 33: this.$ = {name: $$[$0-3], types: $$[$0-1]}
case 31: this.$ = {name: $$[$0-3], types: $$[$0-1]}
break;
case 34:
case 32:
this.$ = {

@@ -80,63 +100,63 @@ name: $$[$0-4],

break;
case 35: this.$ = [$$[$0]]
case 33: this.$ = [$$[$0]]
break;
case 36: this.$ = $$[$0-2]; this.$.push($$[$0])
case 34: this.$ = $$[$0-2]; this.$.push($$[$0])
break;
case 36: this.$ += $$[$0-1] + $$[$0]
break;
case 38: this.$ += $$[$0-1] + $$[$0]
break;
case 40: this.$ += $$[$0-1] + $$[$0]
case 39: this.$ += $$[$0-1] + $$[$0]
break;
case 41: this.$ += $$[$0-1] + $$[$0]
case 40: this.$ = [$$[$0]]
break;
case 42: this.$ = [$$[$0]]
case 41: this.$ = $$[$0-2]; this.$.push($$[$0])
break;
case 43: this.$ = $$[$0-2]; this.$.push($$[$0])
case 42: this.$ = []
break;
case 44: this.$ = []
case 43: this.$ = [$$[$0]]
break;
case 45: this.$ = [$$[$0]]
case 44: this.$.push($$[$0])
break;
case 46: this.$.push($$[$0])
case 45: this.$ = String($$[$0])
break;
case 47: this.$ = String($$[$0])
case 46: this.$ = Number($$[$0])
break;
case 48: this.$ = Number($$[$0])
case 47: this.$ = Boolean($$[$0])
break;
case 49: this.$ = Boolean($$[$0])
case 48: this.$ = new RegExp($$[$0])
break;
case 50: this.$ = new RegExp($$[$0])
case 50: this.$ = $$[$0-1]; this.$.array = true
break;
case 51: this.$ = $$[$0-2]; this.$.array = true; this.$.ellipsis = true
break;
case 52: this.$ = $$[$0-1]
break;
case 53: this.$ = $$[$0-2]; this.$.ellipsis = true
case 53: this.$ = []
break;
case 54: this.$ = $$[$0-1]
case 54: this.$ = [$$[$0]]
break;
case 55: this.$ = []
case 55: this.$.push($$[$0])
break;
case 56: this.$ = [$$[$0]]
case 56: this.$ = {}
break;
case 57: this.$.push($$[$0])
case 57: this.$ = {}; this.$[$$[$0-2]] = $$[$0]
break;
case 58: this.$ = {}
case 58: this.$[$$[$0-2]] = $$[$0]
break;
case 59: this.$ = {}; this.$[$$[$0-2]] = $$[$0]
case 62: this.$ = {id: $$[$0-1], type: 'section'};
break;
case 60: this.$[$$[$0-2]] = $$[$0]
case 63: this.$ = {id: $$[$0], type: 'namespace'};
break;
case 64: this.$ = {id: $$[$0], type: 'namespace'};
case 64: this.$ = {id: $$[$0], type: 'class'};
break;
case 65: this.$ = {id: $$[$0-1], type: 'section'};
case 65: this.$ = {id: $$[$0-2], type: 'class', superclass: $$[$0]};
break;
case 66: this.$ = {id: $$[$0], type: 'class'};
case 66: this.$ = {id: $$[$0], type: 'mixin'}
break;
case 67: this.$ = {id: $$[$0-2], type: 'class', superclass: $$[$0]};
case 67: this.$ = {id: $$[$0-2], type: 'property', returns: $$[$0]}
break;
case 68: this.$ = {id: $$[$0], type: 'mixin'}
case 68: this.$ = {id: $$[$0-2], type: 'constant', returns: $$[$0]}
break;
case 69: this.$ = {id: $$[$0-2], type: 'property', returns: $$[$0]}
break;
case 70: this.$ = {id: $$[$0-2], type: 'constant', returns: $$[$0]}
break;
case 71:
case 69:
this.$ = $$[$0];

@@ -148,3 +168,3 @@ this.$.signatures = [{args: $$[$0].args, returns: $$[$0].returns}];

break;
case 72:
case 70:
this.$.signatures.push({args: $$[$0].args, returns: $$[$0].returns});

@@ -155,5 +175,5 @@ delete this.$.args;

break;
case 74: this.$.returns = $$[$0]
case 72: this.$.returns = $$[$0]
break;
case 75: this.$ = $$[$0]; this.$.id = $$[$0-1] + ' ' + this.$.id; this.$.type = 'constructor'
case 75: this.$ = $$[$0]; this.$.id = this.$.id + '.' + $$[$0-1]; this.$.type = 'constructor'
break;

@@ -164,7 +184,23 @@ case 76: this.$ = {id: $$[$0-3], type: 'method', args: $$[$0-1]}

break;
case 78: this.$ = []
case 78: this.$ = [{type: '?'}]
break;
case 79: this.$ = [$$[$0]]
case 79:
var x = $$[$0];
var ret = {
type: x
};
if (x.array) ret.array = x.array;
if (x.ellipsis) ret.ellipsis = x.ellipsis;
this.$ = [ret];
break;
case 80: this.$.push($$[$0])
case 80:
var x = $$[$0];
var ret = {
type: x
};
if (x.array) ret.array = x.array;
if (x.ellipsis) ret.ellipsis = x.ellipsis;
this.$.push(ret);
break;

@@ -177,7 +213,3 @@ case 81: this.$ = []

break;
case 84: $$[$0-1].optional = true; this.$.push($$[$0-1])
break;
case 85: $$[$0-1].optional = true; this.$.push($$[$0-1])
break;
case 86:
case 84:
$$[$0-1].forEach(function(a) {

@@ -189,12 +221,19 @@ a.optional = true;

break;
case 87: this.$ = {name: $$[$0]}
case 85:
$$[$0-1].forEach(function(a) {
a.optional = true;
$$[$0-3].push(a);
});
break;
case 88: this.$.default_value = $$[$0]
case 86: this.$ = {name: $$[$0]}
break;
case 89: this.$.ellipsis = true
case 87: this.$.default_value = $$[$0]
break;
case 88: this.$.ellipsis = true
break;
}
},
table: [{3:1,4:2,5:[2,2],6:[2,2]},{1:[3]},{5:[1,3],6:[1,4]},{1:[2,1]},{7:5,8:[2,4],12:6,13:7,15:[1,8],19:[1,9],20:[1,10],21:[1,11],22:[1,12],24:[1,13],25:[1,14],26:[1,15]},{8:[1,16]},{8:[2,5],14:[1,17]},{8:[2,6],14:[2,6]},{8:[2,8],14:[2,8],16:[1,18]},{8:[2,11],14:[2,11]},{8:[2,12],14:[2,12]},{8:[2,13],14:[2,13]},{16:[1,19]},{16:[1,20]},{16:[1,21]},{16:[1,22]},{9:23,23:33,27:24,33:25,34:26,35:27,36:28,37:29,38:30,39:31,48:[1,37],66:[1,32],67:[1,34],69:[1,35],73:36,74:38,75:[1,39]},{13:40,15:[1,8],19:[1,9],20:[1,10],21:[1,11],22:[1,12],24:[1,13],25:[1,14],26:[1,15]},{17:[1,41]},{23:42,48:[1,37]},{23:43,48:[1,37]},{23:44,48:[1,37]},{23:45,48:[1,37]},{10:46,11:[2,21],32:[1,47]},{11:[2,18],28:[1,48],30:[1,49],32:[2,18]},{11:[2,23],28:[2,23],30:[2,23],32:[2,23]},{11:[2,24],28:[2,24],30:[2,24],32:[2,24]},{11:[2,25],28:[2,25],30:[2,25],32:[2,25]},{11:[2,26],28:[2,26],30:[2,26],32:[2,26]},{11:[2,27],28:[2,27],30:[2,27],32:[2,27]},{11:[2,28],28:[2,28],30:[2,28],32:[2,28]},{8:[1,51],11:[2,29],28:[2,29],30:[2,29],32:[2,29],40:50,41:52,42:[1,53]},{23:54,48:[1,37]},{11:[2,64],28:[2,64],30:[2,64],32:[2,64],43:[1,59],49:[1,57],50:[1,58],70:[1,55],72:[1,56]},{23:60,48:[1,37]},{23:61,48:[1,37]},{8:[2,71],11:[2,71],28:[2,71],30:[2,71],32:[2,71],42:[2,71]},{8:[2,39],11:[2,39],14:[2,39],28:[2,39],30:[2,39],32:[2,39],42:[2,39],43:[2,39],45:[2,39],46:[2,39],49:[2,39],50:[2,39],52:[2,39],57:[2,39],59:[2,39],60:[2,39],63:[2,39],66:[2,39],68:[2,39],70:[2,39],72:[2,39]},{8:[2,73],11:[2,73],28:[2,73],30:[2,73],32:[2,73],42:[2,73],70:[1,62]},{23:64,48:[1,37],74:63},{8:[2,7],14:[2,7]},{8:[2,9],14:[2,9],18:[1,65]},{8:[2,14],14:[2,14],49:[1,57],50:[1,58]},{8:[2,15],14:[2,15],49:[1,57],50:[1,58]},{8:[2,16],14:[2,16],49:[1,57],50:[1,58]},{8:[2,17],14:[2,17],49:[1,57],50:[1,58]},{11:[1,66]},{11:[2,22]},{23:68,29:67,48:[1,37]},{31:69,47:70,48:[1,71]},{11:[2,30],28:[2,30],30:[2,30],32:[2,30],41:72,42:[1,53]},{23:64,48:[1,37],73:73,74:38,75:[1,39]},{11:[2,31],28:[2,31],30:[2,31],32:[2,31],42:[2,31]},{23:74,48:[1,37]},{49:[1,57],50:[1,58],66:[1,75]},{17:[1,81],23:84,48:[1,37],51:[1,77],53:79,54:[1,80],55:[1,82],56:[1,83],57:[1,85],61:[1,86],65:78,71:76},{17:[1,81],23:84,48:[1,37],53:79,54:[1,80],55:[1,82],56:[1,83],57:[1,85],61:[1,86],65:87},{48:[1,88]},{48:[1,89]},{14:[2,81],45:[2,81],48:[1,93],57:[2,81],76:90,77:[1,91],78:92},{11:[2,66],28:[2,66],30:[2,66],32:[2,66],49:[1,57],50:[1,58],68:[1,94]},{11:[2,68],28:[2,68],30:[2,68],32:[2,68],49:[1,57],50:[1,58]},{17:[1,81],23:84,48:[1,37],51:[1,77],53:79,54:[1,80],55:[1,82],56:[1,83],57:[1,85],61:[1,86],65:78,71:95},{8:[2,75],11:[2,75],28:[2,75],30:[2,75],32:[2,75],42:[2,75]},{43:[1,59],49:[1,57],50:[1,58]},{17:[1,96]},{5:[2,3],6:[2,3]},{11:[2,19],14:[1,97],32:[2,19]},{11:[2,42],14:[2,42],32:[2,42],49:[1,57],50:[1,58]},{11:[2,20],14:[1,98],32:[2,20]},{11:[2,35],14:[2,35],16:[1,99],32:[2,35]},{11:[2,37],14:[2,37],16:[2,37],32:[2,37]},{11:[2,32],28:[2,32],30:[2,32],32:[2,32],42:[2,32]},{8:[2,72],11:[2,72],28:[2,72],30:[2,72],32:[2,72],42:[2,72]},{43:[1,100],49:[1,57],50:[1,58]},{11:[2,65],28:[2,65],30:[2,65],32:[2,65]},{11:[2,69],28:[2,69],30:[2,69],32:[2,69],52:[1,101]},{8:[2,78],11:[2,78],28:[2,78],30:[2,78],32:[2,78],42:[2,78],52:[2,78]},{8:[2,79],11:[2,79],28:[2,79],30:[2,79],32:[2,79],42:[2,79],52:[2,79]},{8:[2,63],11:[2,63],14:[2,63],28:[2,63],30:[2,63],32:[2,63],42:[2,63],45:[2,63],52:[2,63],57:[2,63],59:[2,63],60:[2,63],72:[2,63]},{8:[2,47],11:[2,47],14:[2,47],28:[2,47],30:[2,47],32:[2,47],42:[2,47],45:[2,47],52:[2,47],57:[2,47],59:[2,47],60:[2,47],63:[2,47],72:[2,47]},{8:[2,48],11:[2,48],14:[2,48],28:[2,48],30:[2,48],32:[2,48],42:[2,48],45:[2,48],52:[2,48],57:[2,48],59:[2,48],60:[2,48],63:[2,48],72:[2,48]},{8:[2,49],11:[2,49],14:[2,49],28:[2,49],30:[2,49],32:[2,49],42:[2,49],45:[2,49],52:[2,49],57:[2,49],59:[2,49],60:[2,49],63:[2,49],72:[2,49]},{8:[2,50],11:[2,50],14:[2,50],28:[2,50],30:[2,50],32:[2,50],42:[2,50],45:[2,50],52:[2,50],57:[2,50],59:[2,50],60:[2,50],63:[2,50],72:[2,50]},{8:[2,51],11:[2,51],14:[2,51],28:[2,51],30:[2,51],32:[2,51],42:[2,51],45:[2,51],49:[1,57],50:[1,58],52:[2,51],57:[2,51],59:[2,51],60:[2,51],63:[2,51],72:[2,51]},{14:[2,55],17:[1,81],23:84,48:[1,37],53:103,54:[1,80],55:[1,82],56:[1,83],57:[1,85],58:102,59:[2,55],60:[2,55],61:[1,86]},{14:[2,58],48:[1,107],54:[1,106],62:104,63:[2,58],64:105},{11:[2,70],28:[2,70],30:[2,70],32:[2,70]},{8:[2,40],11:[2,40],14:[2,40],28:[2,40],30:[2,40],32:[2,40],42:[2,40],43:[2,40],45:[2,40],46:[2,40],49:[2,40],50:[2,40],52:[2,40],57:[2,40],59:[2,40],60:[2,40],63:[2,40],66:[2,40],68:[2,40],70:[2,40],72:[2,40]},{8:[2,41],11:[2,41],14:[2,41],28:[2,41],30:[2,41],32:[2,41],42:[2,41],43:[2,41],45:[2,41],46:[2,41],49:[2,41],50:[2,41],52:[2,41],57:[2,41],59:[2,41],60:[2,41],63:[2,41],66:[2,41],68:[2,41],70:[2,41],72:[2,41]},{14:[1,109],45:[1,108],57:[1,110]},{14:[2,81],45:[2,81],48:[1,93],57:[2,81],76:111,78:92},{14:[2,82],45:[2,82],57:[2,82],59:[2,82],60:[1,113],72:[1,112]},{14:[2,87],45:[2,87],57:[2,87],59:[2,87],60:[2,87],72:[2,87]},{23:114,48:[1,37]},{8:[2,74],11:[2,74],28:[2,74],30:[2,74],32:[2,74],42:[2,74],52:[1,101]},{8:[2,10],14:[2,10]},{23:115,48:[1,37]},{47:116,48:[1,71]},{48:[1,117]},{23:120,44:118,48:[1,37],51:[1,119]},{17:[1,81],23:84,48:[1,37],53:79,54:[1,80],55:[1,82],56:[1,83],57:[1,85],61:[1,86],65:121},{14:[1,124],59:[1,122],60:[1,123]},{14:[2,56],59:[2,56],60:[2,56]},{14:[1,126],63:[1,125]},{16:[1,127]},{16:[2,61]},{16:[2,62]},{8:[2,76],11:[2,76],28:[2,76],30:[2,76],32:[2,76],42:[2,76],70:[2,76]},{48:[1,93],57:[1,129],78:128},{14:[1,131],48:[1,93],78:130},{14:[1,109],45:[1,132],57:[1,110]},{17:[1,81],23:84,48:[1,37],53:79,54:[1,80],55:[1,82],56:[1,83],57:[1,85],61:[1,86],65:133},{14:[2,89],45:[2,89],57:[2,89],59:[2,89],60:[2,89],72:[2,89]},{11:[2,67],28:[2,67],30:[2,67],32:[2,67],49:[1,57],50:[1,58]},{11:[2,43],14:[2,43],32:[2,43],49:[1,57],50:[1,58]},{11:[2,36],14:[2,36],16:[1,99],32:[2,36]},{11:[2,38],14:[2,38],16:[2,38],32:[2,38]},{45:[1,134],46:[1,135],52:[1,136]},{45:[2,44],46:[2,44],52:[2,44]},{45:[2,45],46:[2,45],49:[1,57],50:[1,58],52:[2,45]},{8:[2,80],11:[2,80],28:[2,80],30:[2,80],32:[2,80],42:[2,80],52:[2,80]},{8:[2,52],11:[2,52],14:[2,52],28:[2,52],30:[2,52],32:[2,52],42:[2,52],45:[2,52],52:[2,52],57:[2,52],59:[2,52],60:[2,52],63:[2,52],72:[2,52]},{59:[1,137]},{17:[1,81],23:84,48:[1,37],53:138,54:[1,80],55:[1,82],56:[1,83],57:[1,85],61:[1,86]},{8:[2,54],11:[2,54],14:[2,54],28:[2,54],30:[2,54],32:[2,54],42:[2,54],45:[2,54],52:[2,54],57:[2,54],59:[2,54],60:[2,54],63:[2,54],72:[2,54]},{48:[1,107],54:[1,106],64:139},{17:[1,81],23:84,48:[1,37],53:140,54:[1,80],55:[1,82],56:[1,83],57:[1,85],61:[1,86]},{14:[2,83],45:[2,83],57:[2,83],59:[2,83],60:[1,113],72:[1,112]},{14:[2,81],48:[1,93],57:[2,81],59:[2,81],76:141,78:92},{59:[1,142],60:[1,113],72:[1,112]},{48:[1,93],78:143},{8:[2,77],11:[2,77],28:[2,77],30:[2,77],32:[2,77],42:[2,77],70:[2,77]},{14:[2,88],45:[2,88],57:[2,88],59:[2,88],60:[2,88],72:[2,88]},{11:[2,33],28:[2,33],30:[2,33],32:[2,33],42:[2,33]},{32:[1,144]},{23:145,48:[1,37]},{8:[2,53],11:[2,53],14:[2,53],28:[2,53],30:[2,53],32:[2,53],42:[2,53],45:[2,53],52:[2,53],57:[2,53],59:[2,53],60:[2,53],63:[2,53],72:[2,53]},{14:[2,57],59:[2,57],60:[2,57]},{16:[1,146]},{14:[2,59],63:[2,59]},{14:[1,109],57:[1,110],59:[1,147]},{14:[2,84],45:[2,84],57:[2,84],59:[2,84]},{59:[1,148],60:[1,113],72:[1,112]},{11:[2,34],28:[2,34],30:[2,34],32:[2,34],42:[2,34]},{45:[2,46],46:[2,46],49:[1,57],50:[1,58],52:[2,46]},{17:[1,81],23:84,48:[1,37],53:149,54:[1,80],55:[1,82],56:[1,83],57:[1,85],61:[1,86]},{14:[2,86],45:[2,86],57:[2,86],59:[2,86]},{14:[2,85],45:[2,85],57:[2,85],59:[2,85]},{14:[2,60],63:[2,60]}],
defaultActions: {3:[2,1],47:[2,22],106:[2,61],107:[2,62]},
table: [{3:1,4:2,5:[2,2],6:[2,2]},{1:[3]},{5:[1,3],6:[1,4]},{1:[2,1]},{7:5,11:6,12:7,14:[1,8],18:[1,9],19:[1,10],20:[1,11],21:[1,12],23:[1,13],24:[1,14],25:[1,15],45:[2,4],63:[2,4],64:[2,4],66:[2,4],74:[2,4]},{8:16,22:24,26:17,32:18,33:19,34:20,35:21,36:22,45:[1,28],63:[1,23],64:[1,25],66:[1,26],67:30,70:31,72:27,73:29,74:[1,32]},{13:[1,33],45:[2,5],63:[2,5],64:[2,5],66:[2,5],74:[2,5]},{13:[2,6],45:[2,6],63:[2,6],64:[2,6],66:[2,6],74:[2,6]},{13:[2,8],15:[1,34],45:[2,8],63:[2,8],64:[2,8],66:[2,8],74:[2,8]},{13:[2,11],45:[2,11],63:[2,11],64:[2,11],66:[2,11],74:[2,11]},{13:[2,12],45:[2,12],63:[2,12],64:[2,12],66:[2,12],74:[2,12]},{13:[2,13],45:[2,13],63:[2,13],64:[2,13],66:[2,13],74:[2,13]},{15:[1,35]},{15:[1,36]},{15:[1,37]},{15:[1,38]},{9:39,10:[2,21],31:[1,40]},{10:[2,18],27:[1,41],29:[1,42],31:[2,18]},{10:[2,23],27:[2,23],29:[2,23],31:[2,23]},{10:[2,24],27:[2,24],29:[2,24],31:[2,24]},{10:[2,25],27:[2,25],29:[2,25],31:[2,25]},{10:[2,26],27:[2,26],29:[2,26],31:[2,26]},{10:[2,27],22:47,27:[2,27],29:[2,27],31:[2,27],37:43,38:45,39:[1,46],45:[1,28],67:30,70:31,72:44,73:29,74:[1,32]},{22:48,45:[1,28]},{10:[2,63],27:[2,63],29:[2,63],31:[2,63],40:[1,51],46:[1,49],47:[1,50],68:[1,52],71:[1,53]},{22:54,45:[1,28]},{22:55,45:[1,28]},{10:[2,69],27:[2,69],29:[2,69],31:[2,69],39:[2,69],45:[2,69],74:[2,69]},{10:[2,37],13:[2,37],27:[2,37],29:[2,37],31:[2,37],39:[2,37],40:[2,37],42:[2,37],43:[2,37],45:[2,37],46:[2,37],47:[2,37],49:[2,37],54:[2,37],56:[2,37],57:[2,37],60:[2,37],63:[2,37],64:[2,37],65:[2,37],66:[2,37],68:[2,37],71:[2,37],74:[2,37]},{10:[2,71],27:[2,71],29:[2,71],31:[2,71],39:[2,71],45:[2,71],68:[1,56],74:[2,71]},{10:[2,73],27:[2,73],29:[2,73],31:[2,73],39:[2,73],45:[2,73],74:[2,73]},{10:[2,74],27:[2,74],29:[2,74],31:[2,74],39:[2,74],45:[2,74],74:[2,74]},{22:58,45:[1,28],73:57},{12:59,14:[1,8],18:[1,9],19:[1,10],20:[1,11],21:[1,12],23:[1,13],24:[1,14],25:[1,15]},{16:[1,60]},{22:61,45:[1,28]},{22:62,45:[1,28]},{22:63,45:[1,28]},{22:64,45:[1,28]},{10:[1,65]},{10:[2,22]},{22:67,28:66,45:[1,28]},{30:68,44:69,45:[1,70]},{10:[2,28],27:[2,28],29:[2,28],31:[2,28],38:71,39:[1,46]},{10:[2,70],27:[2,70],29:[2,70],31:[2,70],39:[2,70],45:[2,70],74:[2,70]},{10:[2,29],27:[2,29],29:[2,29],31:[2,29],39:[2,29]},{22:72,45:[1,28]},{40:[1,51],46:[1,49],47:[1,50],68:[1,52],71:[1,53]},{46:[1,49],47:[1,50],63:[1,73]},{45:[1,74]},{45:[1,75]},{13:[2,81],42:[2,81],45:[1,79],54:[2,81],75:76,76:[1,77],77:78},{16:[1,85],22:88,45:[1,28],48:[1,81],50:83,51:[1,84],52:[1,86],53:[1,87],54:[1,89],58:[1,90],62:82,69:80},{16:[1,85],22:88,45:[1,28],48:[1,81],50:83,51:[1,84],52:[1,86],53:[1,87],54:[1,89],58:[1,90],62:82,69:91},{10:[2,64],27:[2,64],29:[2,64],31:[2,64],46:[1,49],47:[1,50],65:[1,92]},{10:[2,66],27:[2,66],29:[2,66],31:[2,66],46:[1,49],47:[1,50]},{16:[1,85],22:88,45:[1,28],48:[1,81],50:83,51:[1,84],52:[1,86],53:[1,87],54:[1,89],58:[1,90],62:82,69:93},{10:[2,75],27:[2,75],29:[2,75],31:[2,75],39:[2,75],45:[2,75],74:[2,75]},{40:[1,51],46:[1,49],47:[1,50]},{13:[2,7],45:[2,7],63:[2,7],64:[2,7],66:[2,7],74:[2,7]},{13:[2,9],17:[1,94],45:[2,9],63:[2,9],64:[2,9],66:[2,9],74:[2,9]},{13:[2,14],45:[2,14],46:[1,49],47:[1,50],63:[2,14],64:[2,14],66:[2,14],74:[2,14]},{13:[2,15],45:[2,15],46:[1,49],47:[1,50],63:[2,15],64:[2,15],66:[2,15],74:[2,15]},{13:[2,16],45:[2,16],46:[1,49],47:[1,50],63:[2,16],64:[2,16],66:[2,16],74:[2,16]},{13:[2,17],45:[2,17],46:[1,49],47:[1,50],63:[2,17],64:[2,17],66:[2,17],74:[2,17]},{5:[2,3],6:[2,3]},{10:[2,19],13:[1,95],31:[2,19]},{10:[2,40],13:[2,40],31:[2,40],46:[1,49],47:[1,50]},{10:[2,20],13:[1,96],31:[2,20]},{10:[2,33],13:[2,33],15:[1,97],31:[2,33]},{10:[2,35],13:[2,35],15:[2,35],31:[2,35]},{10:[2,30],27:[2,30],29:[2,30],31:[2,30],39:[2,30]},{40:[1,98],46:[1,49],47:[1,50]},{10:[2,62],27:[2,62],29:[2,62],31:[2,62]},{10:[2,38],13:[2,38],27:[2,38],29:[2,38],31:[2,38],39:[2,38],40:[2,38],42:[2,38],43:[2,38],45:[2,38],46:[2,38],47:[2,38],49:[2,38],54:[2,38],56:[2,38],57:[2,38],60:[2,38],63:[2,38],64:[2,38],65:[2,38],66:[2,38],68:[2,38],71:[2,38],74:[2,38]},{10:[2,39],13:[2,39],27:[2,39],29:[2,39],31:[2,39],39:[2,39],40:[2,39],42:[2,39],43:[2,39],45:[2,39],46:[2,39],47:[2,39],49:[2,39],54:[2,39],56:[2,39],57:[2,39],60:[2,39],63:[2,39],64:[2,39],65:[2,39],66:[2,39],68:[2,39],71:[2,39],74:[2,39]},{13:[1,100],42:[1,99],54:[1,101]},{13:[2,81],42:[2,81],45:[1,79],54:[2,81],75:102,77:78},{13:[2,82],42:[2,82],54:[2,82],56:[2,82],57:[1,104],71:[1,103]},{13:[2,86],42:[2,86],54:[2,86],56:[2,86],57:[2,86],71:[2,86]},{10:[2,67],27:[2,67],29:[2,67],31:[2,67],39:[2,67],45:[2,67],49:[1,105],74:[2,67]},{10:[2,78],27:[2,78],29:[2,78],31:[2,78],39:[2,78],45:[2,78],49:[2,78],74:[2,78]},{10:[2,79],27:[2,79],29:[2,79],31:[2,79],39:[2,79],45:[2,79],49:[2,79],74:[2,79]},{10:[2,61],13:[2,61],27:[2,61],29:[2,61],31:[2,61],39:[2,61],42:[2,61],45:[2,61],49:[2,61],54:[2,61],56:[2,61],57:[2,61],71:[2,61],74:[2,61]},{10:[2,45],13:[2,45],27:[2,45],29:[2,45],31:[2,45],39:[2,45],42:[2,45],45:[2,45],49:[2,45],54:[2,45],56:[2,45],57:[2,45],60:[2,45],71:[2,45],74:[2,45]},{10:[2,46],13:[2,46],27:[2,46],29:[2,46],31:[2,46],39:[2,46],42:[2,46],45:[2,46],49:[2,46],54:[2,46],56:[2,46],57:[2,46],60:[2,46],71:[2,46],74:[2,46]},{10:[2,47],13:[2,47],27:[2,47],29:[2,47],31:[2,47],39:[2,47],42:[2,47],45:[2,47],49:[2,47],54:[2,47],56:[2,47],57:[2,47],60:[2,47],71:[2,47],74:[2,47]},{10:[2,48],13:[2,48],27:[2,48],29:[2,48],31:[2,48],39:[2,48],42:[2,48],45:[2,48],49:[2,48],54:[2,48],56:[2,48],57:[2,48],60:[2,48],71:[2,48],74:[2,48]},{10:[2,49],13:[2,49],27:[2,49],29:[2,49],31:[2,49],39:[2,49],42:[2,49],45:[2,49],46:[1,49],47:[1,50],49:[2,49],54:[2,49],56:[2,49],57:[2,49],60:[2,49],71:[2,49],74:[2,49]},{13:[2,53],16:[1,85],22:88,45:[1,28],50:107,51:[1,84],52:[1,86],53:[1,87],54:[1,89],55:106,56:[2,53],57:[2,53],58:[1,90]},{13:[2,56],45:[1,111],51:[1,110],59:108,60:[2,56],61:109},{10:[2,68],27:[2,68],29:[2,68],31:[2,68],39:[2,68],45:[2,68],49:[1,105],74:[2,68]},{22:112,45:[1,28]},{10:[2,72],27:[2,72],29:[2,72],31:[2,72],39:[2,72],45:[2,72],49:[1,105],74:[2,72]},{16:[1,113]},{22:114,45:[1,28]},{44:115,45:[1,70]},{45:[1,116]},{22:119,41:117,45:[1,28],48:[1,118]},{10:[2,76],27:[2,76],29:[2,76],31:[2,76],39:[2,76],45:[2,76],68:[2,76],74:[2,76]},{45:[1,79],54:[1,121],77:120},{13:[2,81],45:[1,79],54:[2,81],56:[2,81],75:122,77:78},{13:[1,100],42:[1,123],54:[1,101]},{16:[1,85],22:88,45:[1,28],50:83,51:[1,84],52:[1,86],53:[1,87],54:[1,89],58:[1,90],62:124},{13:[2,88],42:[2,88],54:[2,88],56:[2,88],57:[2,88],71:[2,88]},{16:[1,85],22:88,45:[1,28],50:83,51:[1,84],52:[1,86],53:[1,87],54:[1,89],58:[1,90],62:125},{13:[1,128],56:[1,126],57:[1,127]},{13:[2,54],56:[2,54],57:[2,54]},{13:[1,130],60:[1,129]},{15:[1,131]},{15:[2,59]},{15:[2,60]},{10:[2,65],27:[2,65],29:[2,65],31:[2,65],46:[1,49],47:[1,50]},{13:[2,10],45:[2,10],63:[2,10],64:[2,10],66:[2,10],74:[2,10]},{10:[2,41],13:[2,41],31:[2,41],46:[1,49],47:[1,50]},{10:[2,34],13:[2,34],15:[1,97],31:[2,34]},{10:[2,36],13:[2,36],15:[2,36],31:[2,36]},{42:[1,132],43:[1,133],49:[1,134]},{42:[2,42],43:[2,42],49:[2,42]},{42:[2,43],43:[2,43],46:[1,49],47:[1,50],49:[2,43]},{13:[2,83],42:[2,83],54:[2,83],56:[2,83],57:[1,104],71:[1,103]},{13:[2,81],45:[1,79],54:[2,81],56:[2,81],75:135,77:78},{13:[1,100],54:[1,101],56:[1,136]},{10:[2,77],27:[2,77],29:[2,77],31:[2,77],39:[2,77],45:[2,77],68:[2,77],74:[2,77]},{13:[2,87],42:[2,87],54:[2,87],56:[2,87],57:[2,87],71:[2,87]},{10:[2,80],27:[2,80],29:[2,80],31:[2,80],39:[2,80],45:[2,80],49:[2,80],74:[2,80]},{10:[2,50],13:[2,50],27:[2,50],29:[2,50],31:[2,50],39:[2,50],42:[2,50],45:[2,50],49:[2,50],54:[2,50],56:[2,50],57:[2,50],60:[2,50],71:[2,50],74:[2,50]},{56:[1,137]},{16:[1,85],22:88,45:[1,28],50:138,51:[1,84],52:[1,86],53:[1,87],54:[1,89],58:[1,90]},{10:[2,52],13:[2,52],27:[2,52],29:[2,52],31:[2,52],39:[2,52],42:[2,52],45:[2,52],49:[2,52],54:[2,52],56:[2,52],57:[2,52],60:[2,52],71:[2,52],74:[2,52]},{45:[1,111],51:[1,110],61:139},{16:[1,85],22:88,45:[1,28],50:140,51:[1,84],52:[1,86],53:[1,87],54:[1,89],58:[1,90]},{10:[2,31],27:[2,31],29:[2,31],31:[2,31],39:[2,31]},{31:[1,141]},{22:142,45:[1,28]},{13:[1,100],54:[1,101],56:[1,143]},{13:[2,85],42:[2,85],54:[2,85],56:[2,85]},{10:[2,51],13:[2,51],27:[2,51],29:[2,51],31:[2,51],39:[2,51],42:[2,51],45:[2,51],49:[2,51],54:[2,51],56:[2,51],57:[2,51],60:[2,51],71:[2,51],74:[2,51]},{13:[2,55],56:[2,55],57:[2,55]},{15:[1,144]},{13:[2,57],60:[2,57]},{10:[2,32],27:[2,32],29:[2,32],31:[2,32],39:[2,32]},{42:[2,44],43:[2,44],46:[1,49],47:[1,50],49:[2,44]},{13:[2,84],42:[2,84],54:[2,84],56:[2,84]},{16:[1,85],22:88,45:[1,28],50:145,51:[1,84],52:[1,86],53:[1,87],54:[1,89],58:[1,90]},{13:[2,58],60:[2,58]}],
defaultActions: {3:[2,1],40:[2,22],110:[2,59],111:[2,60]},
parseError: function parseError(str, hash) {

@@ -512,43 +551,43 @@ throw new Error(str);

break;
case 4:this.popState(); return 11
case 4:this.popState(); return 10
break;
case 5:this.popState(); this.begin('def')
break;
case 6:return 14 /* list separator */
case 6:return 13 /* list separator */
break;
case 7:return 16 /* key/value delimiter */
case 7:return 15 /* key/value delimiter */
break;
case 8:return 18 /* range */
case 8:return 17 /* range */
break;
case 9:return 50
case 9:return 47
break;
case 10:return 49
case 10:return 46
break;
case 11:/* skip whitespaces */
break;
case 12:return 17
case 12:return 16
break;
case 13:return 15
case 13:return 14
break;
case 14:return 19
case 14:return 18
break;
case 15:return 20
case 15:return 19
break;
case 16:return 21
case 16:return 20
break;
case 17:return 22
case 17:return 21
break;
case 18:return 24
case 18:return 23
break;
case 19:/* N.B. shouldn't it be ALIAS, and reversed sense */ return 24
case 19:/* N.B. shouldn't it be ALIAS, and reversed sense */ return 23
break;
case 20:return 25
case 20:return 24
break;
case 21:return 26
case 21:return 25
break;
case 22:return 48
case 22:return 45
break;
case 23:this.popState(); return 11
case 23:this.popState(); return 10
break;
case 24:yy_.yytext = yy_.yytext.replace(/\s*\n\s*\*/g, '\n').replace(/(^\*\s*|\s*$)/g, ''); return 32
case 24:return 31
break;

@@ -559,74 +598,76 @@ case 25:return 'NL'

break;
case 27:this.begin('arg'); return 46
case 27:this.begin('arg'); return 43
break;
case 28:return 42
case 28:return 39
break;
case 29:return 30
case 29:return 29
break;
case 30:return 28
case 30:return 27
break;
case 31:return 8
case 31:/*return '*'*/
break;
case 32:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 54
case 32:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 51
break;
case 33:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 54
case 33:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 51
break;
case 34:return 17
case 34:return 16
break;
case 35:return 56
case 35:return 53
break;
case 36:return 55
case 36:return 52
break;
case 37:return 55
case 37:return 52
break;
case 38:return 50
case 38:return 47
break;
case 39:return 77
case 39:return 76
break;
case 40:return 51
case 40:return 48
break;
case 41:return 60
case 41:return 57
break;
case 42:return 49
case 42:return 46
break;
case 43:return 14
case 43:return 13
break;
case 44:return 70
case 44:return 68
break;
case 45:return 66
case 45:return 63
break;
case 46:return 72
case 46:return 71
break;
case 47:return 68
case 47:return 65
break;
case 48:return 16
case 48:return 15
break;
case 49:return 43
case 49:return 40
break;
case 50:return 45
case 50:return 42
break;
case 51:return 57
case 51:return 54
break;
case 52:return 59
case 52:return 56
break;
case 53:return 61
case 53:return 58
break;
case 54:return 63
case 54:return 60
break;
case 55:return 52
case 55:return 49
break;
case 56:return 67
case 56:return 64
break;
case 57:return 69
case 57:return 66
break;
case 58:return 75
case 58:return 74
break;
case 59:return 48
case 59:return 45
break;
case 60:this.popState(); return 32
case 60:this.popState(); return 31
break;
case 61:this.popState(); console.log('LEFTCOMM'); return 31
break;
}
};
lexer.rules = [/^$/,/^\s+/,/^\/\*\*/,/^.*/,/^\*\*\//,/^\s*[\n]/,/^, /,/^: /,/^\.\./,/^#/,/^\./,/^\s+/,/^-?(?:[0-9]|[1-9][0-9]+)(?:\.[0-9]+)?(?:[eE][-+]?[0-9]+)?\b/,/^deprecated\b/,/^read-only\b/,/^internal\b/,/^chainable\b/,/^section\b/,/^alias of\b/,/^alias\b/,/^related to\b/,/^belongs to\b/,/^(?:[$_a-zA-Z][$_a-zA-Z0-9]*)/,/^\*\*\//,/^\*\s*[\n][\s\S]*?(?=\*\*\/)/,/^\*\s*[\n]123123123\b/,/^\s+/,/^\)\s*:/,/^\*\s*-/,/^\*\s*fires\b/,/^\*\s*includes\b/,/^\*/,/^"(?:\\["bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^"\\])*"/,/^'(?:\\["bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^'\\])*'/,/^-?(?:[0-9]|[1-9][0-9]+)(?:\.[0-9]+)?(?:[eE][-+]?[0-9]+)?\b/,/^\/(?:[^\/]|\\\/)*\//,/^true\b/,/^false\b/,/^#/,/^@/,/^\?/,/^\.\.\./,/^\./,/^,/,/^->/,/^==/,/^=/,/^</,/^:/,/^\(/,/^\)/,/^\[/,/^\]/,/^\{/,/^\}/,/^\|/,/^class\b/,/^mixin\b/,/^new\b/,/^(?:[$_a-zA-Z][$_a-zA-Z0-9]*)/,/^[\s\S]*?(?=(\*\s*[-\n]))/];
lexer.conditions = {"INITIAL":{"rules":[0,1,2,3],"inclusive":true},"tags":{"rules":[0,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22],"inclusive":false},"def":{"rules":[0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],"inclusive":false},"arg":{"rules":[0,60],"inclusive":false}};return lexer;})()
lexer.rules = [/^$/,/^\s+/,/^\/\*\*(?=([^/]))/,/^.*/,/^\*\*\//,/^\s*[\n]/,/^, /,/^: /,/^\.\./,/^#/,/^\./,/^\s+/,/^-?(?:[0-9]|[1-9][0-9]+)(?:\.[0-9]+)?(?:[eE][-+]?[0-9]+)?\b/,/^deprecated\b/,/^read-only\b/,/^internal\b/,/^chainable\b/,/^section\b/,/^alias of\b/,/^alias\b/,/^related to\b/,/^belongs to\b/,/^(?:[$_a-zA-Z][$_a-zA-Z0-9]*)/,/^\*\*\//,/^\*\s*?[\n][\s\S]*?(?=\*\*\/)/,/^\*\s*[\n]123123123\b/,/^\s+/,/^\)\s*:/,/^\*\s*-/,/^\*\s*fires\b/,/^\*\s*includes\b/,/^\*/,/^"(?:\\["bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^"\\])*"/,/^'(?:\\["bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^'\\])*'/,/^-?(?:[0-9]|[1-9][0-9]+)(?:\.[0-9]+)?(?:[eE][-+]?[0-9]+)?\b/,/^\/(?:[^\/]|\\\/)*\//,/^true\b/,/^false\b/,/^#/,/^@/,/^\?/,/^\.\.\./,/^\./,/^,/,/^->/,/^==/,/^=/,/^</,/^:/,/^\(/,/^\)/,/^\[/,/^\]/,/^\{/,/^\}/,/^\|/,/^class\b/,/^mixin\b/,/^new\b/,/^(?:[$_a-zA-Z][$_a-zA-Z0-9]*)/,/^[\s\S]*?(?=(\*\s*[-\n]))/,/^[\s\S]*?(?=\*\*\/)/];
lexer.conditions = {"INITIAL":{"rules":[0,1,2,3],"inclusive":true},"tags":{"rules":[0,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22],"inclusive":false},"def":{"rules":[0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],"inclusive":false},"arg":{"rules":[0,60],"inclusive":false},"comment":{"rules":[0,61],"inclusive":false}};return lexer;})()
parser.lexer = lexer;

@@ -633,0 +674,0 @@ return parser;

@@ -9,2 +9,3 @@ 'use strict';

var Path = require('path');
var FsTools = require('fs-tools');

@@ -32,2 +33,34 @@ /**

/**
* Util.walk_many(paths, pattern, iterator, callback)
* - paths (Array): array of paths to sequentially walk
*
* Other arguments correspond to those of [[FsTools.walk]]
**/
function walk_many(paths, pattern, iterator, callback) {
// don't touch original array
paths = paths.slice();
function next(err) {
var path;
// get next path
while (paths.length) {
path = paths.shift();
}
// skip empty path or report real error
if (err || !path) {
callback(err);
return;
}
// do walk path
FsTools.walk(path, pattern, iterator, next);
}
next();
}
module.exports = {

@@ -38,3 +71,5 @@ normalize: Path.normalize,

read: read,
write: write
write: write,
copy: FsTools.copy,
walk_many: walk_many,
};
{
"name" : "ndoc",
"description" : "pdoc made in node.js",
"version" : "0.1.0",
"version" : "1.0.0",
"homepage" : "https://github.com/nodeca/ndoc",

@@ -14,11 +14,12 @@ "author" : "Vladimir Dronnikov <dronnikov@gmail.com>",

"dependencies": {
"jison" : "https://github.com/zaach/jison/tarball/master",
"nomnom" : "1.5.1",
"jade" : "0.18.0",
"marked" : "0.1.2",
"simple-promise": "0.1.0",
"fs-tools" : "0.1.0",
"underscore": "1.2.2"
"marked" : "0.1.4",
"fs-tools" : "0.1.0"
},
"devDependencies": {
"jison" : "0.2.12",
"stylus" : "0.19.3"
},
"preferGlobal": true
}

@@ -0,17 +1,22 @@

# NDoc - JavaScript documentation generator
# JavaScript PDoc parser
NDoc is an inline comment parser and JavaScript documentation generator written in node.js.
This project is inspired by [PDoc](http://pdoc.org/syntax.html). It tries to keep compatibility,
but has some differences:
An attempt to parse [PDoc](http://pdoc.org/syntax.html) with [node.js](http://nodejs.org)
- NDoc is a CLI tool, not library. It doesn't require additional programming to execute.
- Clarified EBNF syntax. Definitions now **MUST** be separated with an empty line from the following comments.
- Added options for `deprecated` tag: you can set versions, when tag was deprecated and
when it will be removed.
- Added new tags: `read-only`, `internal`, `chainable`
## How to Install
Clone and have fun
We suppose that you already have `node.js` and `npm` installed.
If not - try [nvm](https://github.com/creationix/nvm). Then install NDoc globally
## Quick start
npm install -g ndoc
Go to your project's root directory and run
ndoc lib
open file://./doc/index.html
## Usage

@@ -21,3 +26,3 @@

path PATH Source files location
path PATH Source files location

@@ -31,15 +36,44 @@ Options:

-i, --index PATH Index file [README.md]
-l FMT, --link-format FMT String format for link to source file [{file}#L{line}]
-t, --title TITLE Documentation title
Supports interpolation. See notes for --link-format.
-l, --link-format FMT String format for link to source file [{file}#L{line}]
{url} is substituted with the URL of repository read from manifest file
{file} is substituted with the name of the source file
{line} is substituted with the line number within the source file
E.g. http://github.com/nodeca/ndoc/{file}#L{line}
--package-json PATH Package manifest [package.json]
--package-name NAME Package name
--package-version VER Project version
--package-title TITLE Package title
{package.XXX} is substituted with XXX key of package.json, if any
--view-source-label TXT Text for "View source" link
--skin PATH Custom templates
-b, --broken-links ACTION What to do if broken link occured. Can be one of 'show', 'hide', 'throw'.
Default is 'hide'
NDoc uses data from `package.json` in current folder, if found one. This helps to minimize number of options when building documentation for node.js projects. For example, you can just run:
ndoc ./lib
## Syntax
[NDoc Syntax](https://github.com/nodeca/ndoc/blob/master/syntax.md).
It is similar to [PDoc](https://github.com/tobie/pdoc) one, with some extentions (see start of this doc for details).
## For developers
If you like to make patches or develop skins - install NDoc in developer mode:
git clone [your_fork_url]
cd ndoc
npm install --dev
After installation is done you can generate prototype documentation for test:
bin/ndoc ./tests -o ./tests/doc
Then open `./test/doc/index.html`. Here is [hosted doc example](http://nodeca.github.com/ndoc/tests/doc/). There are also some shortcuts in [Makefile](https://github.com/nodeca/ndoc/blob/master/Makefile),
if you make skin changes and need to constantly rebuild samples.
## License
[MIT](https://github.com/nodeca/ndoc/blob/master/LICENSE)
This project is distributed under [MIT](https://github.com/nodeca/ndoc/blob/master/LICENSE) license.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc