ignore : false,
-
- canonize : function(scope, isStatic) {
- var s = scope.split('|');
- var ret = [];
- var brace = 0;
- s.forEach(function(n) {
- if (ret === false || ret.length > 1) {
- ret = false;
- return true;
- }
- if (n == '$global$') {
- return false;
- }
- if (n == '{') {
- brace++;
- }
- if (brace > 1) {
- ret = false;
- return true;
- }
- if (n =='(' || n == 'FUNCTION(' || n == '{') {
- return false;
- }
- if (n.match(/[^a-z\.]+/i)) {
- ret = false;
- return true;
- }
- if (n.match(/\.prototype$/g)) {
- isStatic = false;
- }
- n = n.replace( /\.prototype$/g,'');
-
- ret.push(n);
- return false;
- });
-
-
- if (!ret || ret.length > 2) {
- return false;
- }
- var r = ret.join(isStatic ? '.' : '#');
-
- if (r.split('#').length > 1 ) {
- return false;
- }
-
- print("ADD:" + scope + ' => ' + r);
- //print("CANON:" + r);
-
- return r;
-
- },
-
+
-
- /**
- * same as symbol ctr...
- */
- addTokenSymbol : function( token ) {
-
- if (!token.scopeName) {
- return;
- }
-
- var isa = typeof(token.args) == 'undefined' ? 'OBJECT' : 'FUNCTION' ; // or a function if we are sure...
- print("CREATE symbol: " + isa + ' => ' + token.scopeName );
-
- if (token.jsdoc && token.jsdoc.getTag('event').length) {
- // make sure it get's a distinct name..
- var last = token.scopeName.split(/[.#]/).pop();
-
- token.scopeName= token.scopeName.replace(new RegExp(last+'$'), '!'+ last);
-
- }
-
- var symbol = new Symbol( token.scopeName, token.args || [] , isa ,
- token.jsdoc || false);
-
- symbol._token = token;
- ScopeNamer.addSymbol(symbol, token.jsdoc);
- },
-
-
+
walkStatements: function(scope, statements)
{
var symbol = new Symbol( scope , args || [] , "FUNCTION" , jsdocTok.jsdoc);
symbol._token = jsdocTok;
- ScopeNamer.addSymbol(symbol, jsdocTok.jsdoc);
+ this.addSymbol(symbol, jsdocTok.jsdoc);
var sn = new ScopeNamer(this);
sn.walkStatements(scope, stmts);
symbol._token = jsdocTok;
// extends = arg[1]
- ScopeNamer.addSymbol(symbol, jsdocTok.jsdoc);
+ this.addSymbol(symbol, jsdocTok.jsdoc);
var sn = new ScopeNamer(this);
var symbol = new Symbol( scope , false , "OBJECT" , jsdocTok.jsdoc);
symbol._token = jsdocTok;
- ScopeNamer.addSymbol(symbol, jsdocTok.jsdoc);
+ this.addSymbol(symbol, jsdocTok.jsdoc);
}
var symbol = new Symbol( scope +'.'+ k , val[1].args || [] , "PROPERTY" , key.jsdoc);
symbol._token = key;
- ScopeNamer.addSymbol(key, key.jsdoc);
+ this.addSymbol(key, key.jsdoc);
continue;
}
- }
+ },
+
+
+
+
+
+
+ addSymbol: function(symbol, comment)
+ {
+ //print("PARSER addSYMBOL : " + symbol.alias);
+
+ // if a symbol alias is documented more than once the last one with the user docs wins
+ if (ScopeNamer.symbols.hasSymbol(symbol.alias)) {
+
+ if (!comment) { // we do not have a comment, and it's registered.
+ return;
+ }
+ var oldSymbol = ScopeNamer.symbols.getSymbol(symbol.alias);
+
+ if (oldSymbol.comment && oldSymbol.comment.isUserComment && !oldSymbol.comment.hasTags) {
+ if (symbol.comment.isUserComment) { // old and new are both documented
+ this.LOG.warn("The symbol '"+symbol.alias+"' is documented more than once.");
+ }
+ else { // old is documented but new isn't
+ return;
+ }
+ }
+ }
+
+ // we don't document anonymous things
+ //if (this.conf.ignoreAnonymous && symbol.name.match(/\$anonymous\b/)) return;
+
+ // uderscored things may be treated as if they were marked private, this cascades
+ //if (this.conf.treatUnderscoredAsPrivate && symbol.name.match(/[.#-]_[^.#-]+$/)) {
+ // symbol.isPrivate = true;
+ //}
+
+ // -p flag is required to document private things
+ if ((symbol.isInner || symbol.isPrivate) && !this.docPrivate) return;
+
+ // ignored things are not documented, this doesn't cascade
+ if (symbol.isIgnored) return;
+
+
+ //print("ADD symbol: " + symbol.isa + ' => ' + symbol.alias );
+ print("ADD symbol: " + JSON.stringify( symbol, null, 4));
+
+ // add it to the file's list... (for dumping later..)
+ if (this.srcFile) {
+ ScopeNamer.filesSymbols[Symbol.srcFile].addSymbol(symbol);
+ }
+
+ ScopeNamer.symbols.addSymbol(symbol);
+ },
+ addBuiltin : function(name) {
+
+ var builtin = new Symbol(name, [], "CONSTRUCTOR", new imports.DocComment.DocComment(""));
+ builtin.isNamespace = false;
+ builtin.srcFile = "";
+ builtin.isPrivate = false;
+ this.addSymbol(builtin);
+ return builtin;
+ };
+
-
}
);
-ScopeNamer.addSymbol = function(symbol, comment)
-{
- //print("PARSER addSYMBOL : " + symbol.alias);
-
- // if a symbol alias is documented more than once the last one with the user docs wins
- if (ScopeNamer.symbols.hasSymbol(symbol.alias)) {
-
- if (!comment) { // we do not have a comment, and it's registered.
- return;
- }
- var oldSymbol = ScopeNamer.symbols.getSymbol(symbol.alias);
-
- if (oldSymbol.comment && oldSymbol.comment.isUserComment && !oldSymbol.comment.hasTags) {
- if (symbol.comment.isUserComment) { // old and new are both documented
- this.LOG.warn("The symbol '"+symbol.alias+"' is documented more than once.");
- }
- else { // old is documented but new isn't
- return;
- }
- }
- }
-
- // we don't document anonymous things
- //if (this.conf.ignoreAnonymous && symbol.name.match(/\$anonymous\b/)) return;
-
- // uderscored things may be treated as if they were marked private, this cascades
- //if (this.conf.treatUnderscoredAsPrivate && symbol.name.match(/[.#-]_[^.#-]+$/)) {
- // symbol.isPrivate = true;
- //}
-
- // -p flag is required to document private things
- if ((symbol.isInner || symbol.isPrivate) && !this.docPrivate) return;
-
- // ignored things are not documented, this doesn't cascade
- if (symbol.isIgnored) return;
-
-
- //print("ADD symbol: " + symbol.isa + ' => ' + symbol.alias );
- print("ADD symbol: " + JSON.stringify( symbol, null, 4));
-
- // add it to the file's list... (for dumping later..)
- if (this.srcFile) {
- ScopeNamer.filesSymbols[Symbol.srcFile].addSymbol(symbol);
- }
-
- ScopeNamer.symbols.addSymbol(symbol);
-};
-
-ScopeNamer.addBuiltin = function(name) {
-
- var builtin = new Symbol(name, [], "CONSTRUCTOR", new imports.DocComment.DocComment(""));
- builtin.isNamespace = false;
- builtin.srcFile = "";
- builtin.isPrivate = false;
- this.addSymbol(builtin);
- return builtin;
-};
-
+ScopeNamer.addSymbol = ScopeNamer.prototype.addSymbol;
+ScopeNamer.addBuiltin = ScopeNamer.prototype.addBuiltin;
\ No newline at end of file