projects
/
gnome.introspection-doc-generator
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JSDOC/TokenReader.js
[gnome.introspection-doc-generator]
/
JSDOC
/
Collapse.js
diff --git
a/JSDOC/Collapse.js
b/JSDOC/Collapse.js
index
d95925d
..
af58a91
100644
(file)
--- a/
JSDOC/Collapse.js
+++ b/
JSDOC/Collapse.js
@@
-1,11
+1,12
@@
//<script type="text/javscript">
//<script type="text/javscript">
-XObject = imports.XObject.XObject;
+
const
XObject = imports.XObject.XObject;
-console = imports.console.console;
+cons
t cons
ole = imports.console.console;
// make sure parent is loaded..
// make sure parent is loaded..
-TokenStream = imports.TokenStream.TokenStream;
+const TokenStream = imports.TokenStream.TokenStream;
+
/**
*
* base class for parsing segments of token array..
/**
*
* base class for parsing segments of token array..
@@
-31,14
+32,13
@@
TokenStream = imports.TokenStream.TokenStream;
*
*/
*
*/
-Collapse = XObject.define(
+
const
Collapse = XObject.define(
function (ar)
{
function (ar)
{
-
Collapse.superclass.constructor.call(this, ar);
this.spaces();
Collapse.superclass.constructor.call(this, ar);
this.spaces();
-
var
ar = this.collapse(this.tokens);
+ ar = this.collapse(this.tokens);
this.tokens = ar;
this.tokens = ar;
@@
-88,10
+88,10
@@
Collapse = XObject.define(
// Seed.print(TokenStream.toString(ret));
return ret;
}
// Seed.print(TokenStream.toString(ret));
return ret;
}
- console.log(tok.data);
+
//
console.log(tok.data);
switch(tok.type) {
case "VOID":
switch(tok.type) {
case "VOID":
- return; //EOF
+ return
ret
; //EOF
case "KEYW":
case "KEYW":
@@
-113,16
+113,16
@@
Collapse = XObject.define(
st.next(1);
var add = st.balance(tok.data);
if (!add) {
st.next(1);
var add = st.balance(tok.data);
if (!add) {
-
console.dump
(tok);
-
console.dump
(start + '...' + st.cursor);
-
console.dump
(st.tokens);
+
Seed.print
(tok);
+
Seed.print
(start + '...' + st.cursor);
+
Seed.print
(st.tokens);
}
if (add) {
add.shift();
}
}
if (add) {
add.shift();
}
- Seed.print("ADD");
- Seed.print(JSON.stringify(add, null,4));
+
//
Seed.print("ADD");
+
//
Seed.print(JSON.stringify(add, null,4));
@@
-130,6
+130,8
@@
Collapse = XObject.define(
tok.items = false;
tok.props = false;
tok.items = false;
tok.props = false;
+
+
if (tok.data != '{') {
// paramters or array elements..
tok.items = this.toItems(toks, [',']);
if (tok.data != '{') {
// paramters or array elements..
tok.items = this.toItems(toks, [',']);
@@
-192,6
+194,12
@@
Collapse = XObject.define(
g.push(ar[i]);
continue;
}
g.push(ar[i]);
continue;
}
+ // var a=..., b =...
+ if ((ar[i].data != ';') && g.length && (g[0].name == "VAR")) {;
+ g.push(ar[i]);
+ continue;
+ }
+
g.push(ar[i]);
ret.push(g);
g = [];
g.push(ar[i]);
ret.push(g);
g = [];
@@
-237,8
+245,9
@@
Collapse = XObject.define(
}
}
}
}
- // last..
- if (k.length) {
+ // last.. - if g.val.length is 0 then it's a trailing ','...
+ // we should really throw a syntax error in that case..
+ if (k.length && g.val.length) {
ret[k] = g;
}
return ret;
ret[k] = g;
}
return ret;
@@
-248,4
+257,4
@@
Collapse = XObject.define(
-});
\ No newline at end of file
+});