projects
/
gnome.introspection-doc-generator
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JsTemplate/Template.js
[gnome.introspection-doc-generator]
/
JSDOC
/
ScopeParser.js
diff --git
a/JSDOC/ScopeParser.js
b/JSDOC/ScopeParser.js
index
6fd8d7d
..
1b315b0
100644
(file)
--- a/
JSDOC/ScopeParser.js
+++ b/
JSDOC/ScopeParser.js
@@
-98,7
+98,7
@@
ScopeParser.prototype = {
},
warn: function(s) {
},
warn: function(s) {
- print('****************' + s);
+
//
print('****************' + s);
this.warnings.push(s);
//println("WARNING:" + htmlescape(s) + "<BR>");
},
this.warnings.push(s);
//println("WARNING:" + htmlescape(s) + "<BR>");
},
@@
-133,7
+133,7
@@
ScopeParser.prototype = {
this.mode = 'BUILDING_SYMBOL_TREE';
this.parseScope(this.globalScope);
this.mode = 'BUILDING_SYMBOL_TREE';
this.parseScope(this.globalScope);
- print("---------------END PASS 1 ---------------- ");
+
//
print("---------------END PASS 1 ---------------- ");
},
mungeSymboltree : function()
},
mungeSymboltree : function()
@@
-178,7
+178,9
@@
ScopeParser.prototype = {
log : function(str)
{
log : function(str)
{
- //println("<B>LOG:</B>" + htmlescape(str) + "<BR/>\n");
+ print (" ".substring(0, this.braceNesting*2) + str);
+
+ //println("<B>LOG:</B>" + htmlescape(str) + "<BR/>\n");
},
logR : function(str)
{
},
logR : function(str)
{
@@
-193,14
+195,14
@@
ScopeParser.prototype = {
parseScope : function(scope) // parse a token stream..
{
//this.timerPrint("parseScope EnterScope");
parseScope : function(scope) // parse a token stream..
{
//this.timerPrint("parseScope EnterScope");
-
print
(">>> ENTER SCOPE" + this.scopes.length);
+
//this.log
(">>> ENTER SCOPE" + this.scopes.length);
var symbol;
var token;
var identifier;
var expressionBraceNesting = this.braceNesting;
var symbol;
var token;
var identifier;
var expressionBraceNesting = this.braceNesting;
- var bracketNesting = 0;
+
var parensNesting = 0;
var isObjectLitAr = [ false ];
var parensNesting = 0;
var isObjectLitAr = [ false ];
@@
-210,7
+212,10
@@
ScopeParser.prototype = {
while (token) {
// this.timerPrint("parseScope AFTER lookT: " + token.toString());
while (token) {
// this.timerPrint("parseScope AFTER lookT: " + token.toString());
- !this.debug|| print(token.type + '.' + token.name+ ":" + token.data);
+ //this.log(token.data);
+ if (token.type == 'NAME') {
+ // print('*' + token.data);
+ }
switch(token.type + '.' + token.name) {
case "KEYW.VAR":
case "KEYW.CONST": // not really relivant as it's only mozzy that does this.
switch(token.type + '.' + token.name) {
case "KEYW.VAR":
case "KEYW.CONST": // not really relivant as it's only mozzy that does this.
@@
-223,12
+228,15
@@
ScopeParser.prototype = {
if (!token) { // can return false at EOF!
break;
}
if (!token) { // can return false at EOF!
break;
}
- if (token.name == "VAR") { // kludge..
+ if (token.name == "VAR"
|| token.data == ','
) { // kludge..
continue;
}
//this.logR("parseScope GOT VAR : <B>" + token.toString() + "</B>");
if (token.type !="NAME") {
continue;
}
//this.logR("parseScope GOT VAR : <B>" + token.toString() + "</B>");
if (token.type !="NAME") {
- print(token.toString());
+ for(var i = Math.max(this.ts.cursor-10,0); i < this.ts.cursor+1; i++) {
+ print(this.ts.tokens[i].toString());
+ }
+
print( "var without ident");
Seed.quit()
}
print( "var without ident");
Seed.quit()
}
@@
-256,7
+264,9
@@
ScopeParser.prototype = {
if (token.name == "IN") {
break;
} else {
if (token.name == "IN") {
break;
} else {
+ //var bn = this.braceNesting;
this.parseExpression();
this.parseExpression();
+ //this.braceNesting = bn;
//this.logR("parseScope DONE : <B>ParseExpression</B> - tok is:" + this.ts.lookT(0).toString());
token = this.ts.lookTok(1);
//this.logR("parseScope DONE : <B>ParseExpression</B> - tok is:" + this.ts.lookT(0).toString());
token = this.ts.lookTok(1);
@@
-269,27
+279,35
@@
ScopeParser.prototype = {
break;
case "KEYW.FUNCTION":
//println("<i>"+token.data+"</i>");
break;
case "KEYW.FUNCTION":
//println("<i>"+token.data+"</i>");
+ var bn = this.braceNesting;
this.parseFunctionDeclaration();
this.parseFunctionDeclaration();
+ this.braceNesting = bn;
break;
case "PUNC.LEFT_CURLY": // {
//println("<i>"+token.data+"</i>");
isObjectLitAr.push(false);
break;
case "PUNC.LEFT_CURLY": // {
//println("<i>"+token.data+"</i>");
isObjectLitAr.push(false);
- print(">>>>>> OBJLIT PUSH(false)");
this.braceNesting++;
this.braceNesting++;
+
+ //print(">>>>>> OBJLIT PUSH(false)" + this.braceNesting);
break;
case "PUNC.RIGHT_CURLY": // }
//println("<i>"+token.data+"</i>");
this.braceNesting--;
isObjectLitAr.pop();
break;
case "PUNC.RIGHT_CURLY": // }
//println("<i>"+token.data+"</i>");
this.braceNesting--;
isObjectLitAr.pop();
- print(">>>>>> OBJLIT POP"+ this.braceNesting);
+
//
print(">>>>>> OBJLIT POP"+ this.braceNesting);
//assert braceNesting >= scope.getBra ceNesting();
//assert braceNesting >= scope.getBra ceNesting();
- if (this.braceNesting
==
expressionBraceNesting) {
+ if (this.braceNesting
<
expressionBraceNesting) {
var ls = this.scopes.pop();
ls.getUsedSymbols();
var ls = this.scopes.pop();
ls.getUsedSymbols();
- print("<<<<<<<EXIT SCOPE" +this.scopes.length);
+ // eat symbol if we are currently at {
+ if (this.ts.look(0).data == '{') {
+ this.ts.nextTok();
+ }
+
+ //print("<<<<<<<EXIT SCOPE" +this.scopes.length);
return;
}
break;
return;
}
break;
@@
-327,7
+345,7
@@
ScopeParser.prototype = {
// then we are in an object lit.. -> we need to flag the brace as such...
isObjectLitAr.pop();
isObjectLitAr.push(true);
// then we are in an object lit.. -> we need to flag the brace as such...
isObjectLitAr.pop();
isObjectLitAr.push(true);
-
print(">>>>>> OBJLIT
PUSH(true)");
+
//print(">>>>>> OBJLIT RE
PUSH(true)");
}
isInObjectLitAr = isObjectLitAr[isObjectLitAr.length-1];
}
isInObjectLitAr = isObjectLitAr[isObjectLitAr.length-1];
@@
-358,7
+376,7
@@
ScopeParser.prototype = {
if ((this.ts.lookTok(-1).data == "{") && (this.ts.lookTok(1).data == ":")) {
isObjectLitAr.pop();
isObjectLitAr.push(true);
if ((this.ts.lookTok(-1).data == "{") && (this.ts.lookTok(1).data == ":")) {
isObjectLitAr.pop();
isObjectLitAr.push(true);
-
print(">>>>>> OBJLIT
PUSH(true)");
+
//print(">>>>>> OBJLIT RE
PUSH(true)");
//println("<i>"+token.data+"</i>");
break;
}
//println("<i>"+token.data+"</i>");
break;
}
@@
-459,7
+477,7
@@
ScopeParser.prototype = {
//if (this.ts.nextT()) break;
}
//if (this.ts.nextT()) break;
}
- print("<<<<<<<EXIT SCOPE ERR?" +this.scopes.length);
+
//
print("<<<<<<<EXIT SCOPE ERR?" +this.scopes.length);
},
},
@@
-487,7
+505,7
@@
ScopeParser.prototype = {
currentScope = this.scopes[this.scopes.length-1];
//println("<i>"+token.data+"</i>");
currentScope = this.scopes[this.scopes.length-1];
//println("<i>"+token.data+"</i>");
-
!this.debug|| print ("EXP" + token.toString()
);
+
//this.log("EXP:" + token.data
);
switch (token.type) {
case 'PUNC':
switch(token.data) {
switch (token.type) {
case 'PUNC':
switch(token.data) {
@@
-506,14
+524,15
@@
ScopeParser.prototype = {
case '{': //Token.LC:
isObjectLitAr.push(false);
case '{': //Token.LC:
isObjectLitAr.push(false);
- print(">>>>> OBJ PUSH(false)");
+
this.braceNesting++;
this.braceNesting++;
+ ///print(">>>>> EXP PUSH(false)"+this.braceNesting);
break;
case '}': //Token.RC:
this.braceNesting--;
isObjectLitAr.pop();
break;
case '}': //Token.RC:
this.braceNesting--;
isObjectLitAr.pop();
-
print(">>>>> OBJ POP"
);
+
//print(">>>>> EXP POP" + this.braceNesting
);
// assert braceNesting >= expressionBraceNesting;
break;
// assert braceNesting >= expressionBraceNesting;
break;
@@
-540,7
+559,7
@@
ScopeParser.prototype = {
// then we are in an object lit.. -> we need to flag the brace as such...
isObjectLitAr.pop();
isObjectLitAr.push(true);
// then we are in an object lit.. -> we need to flag the brace as such...
isObjectLitAr.pop();
isObjectLitAr.push(true);
-
print(">>>>> OBJ
PUSH(true)");
+
//print(">>>>> EXP
PUSH(true)");
}
}
@@
-566,19
+585,20
@@
ScopeParser.prototype = {
case 'NAME':
symbol = token.data;
case 'NAME':
symbol = token.data;
- if (this.ts.lookTok(-1).data == "{" && this.ts.lookTok(1).data == ":") {
+
+ if (this.ts.look(0).data == "{" && this.ts.lookTok(2).data == ":") {
// then we are in an object lit.. -> we need to flag the brace as such...
isObjectLitAr.pop();
isObjectLitAr.push(true);
// then we are in an object lit.. -> we need to flag the brace as such...
isObjectLitAr.pop();
isObjectLitAr.push(true);
-
print(">>>>> OBJ
PUSH(true)");
+
//print(">>>>> EXP
PUSH(true)");
break;
}
isInObjectLitAr = isObjectLitAr[isObjectLitAr.length-1];
break;
}
isInObjectLitAr = isObjectLitAr[isObjectLitAr.length-1];
- if (isInObjectLitAr && this.ts.lookTok(
-1).data == "," && this.ts.lookTok(1
).data == ":") {
+ if (isInObjectLitAr && this.ts.lookTok(
0).data == "," && this.ts.lookTok(2
).data == ":") {
break;
}
break;
}
-
- if (this.ts.lookTok(
-1
).data == ".") {
+ //print(this.ts.lookTok(0).data);
+ if (this.ts.lookTok(
0
).data == ".") {
//skip '.'
break;
}
//skip '.'
break;
}
@@
-723,7
+743,7
@@
ScopeParser.prototype = {
this.indexedScopes[this.ts.cursor] = fnScope;
} else {
this.indexedScopes[this.ts.cursor] = fnScope;
} else {
- //
print
ln("FETCHING SCOPE" + this.ts.cursor);
+ //
q
ln("FETCHING SCOPE" + this.ts.cursor);
fnScope = this.indexedScopes[this.ts.cursor];
}
fnScope = this.indexedScopes[this.ts.cursor];
}