break;
case "PUNC.LEFT_CURLY": // {
-
+ case "PUNC.LEFT_PAREN": // (
+ print('SCOPE-CURLY/PAREN:' + token.toString());
//println("<i>"+token.data+"</i>");
var curTS = this.ts;
if (token.props) {
break;
}
- print('SCOPE-CURLY:' + JSON.stringify(token,null,4));
+
var _this = this;
token.items.forEach(function(expr) {
_this.ts = new TokenStream(expr);
//this.log("EXP:" + token.data);
switch (token.type) {
case 'PUNC':
- print("EXPR-PUNC:" + JSON.stringify(token, null, 4));
+ print("EXPR-PUNC:" + token.toString());
switch(token.data) {
case ';':
+ print("<< EXIT EXPRESSION");
+ break;
+
case ',':
- if (this.braceNesting == expressionBraceNesting &&
- bracketNesting == 0 &&
- parensNesting == 0) {
- print("<< EXIT EXPRESSION");
- this.expN--;
- return;
- }
+
break;
-
+ case '(': //Token.LP:
case '{': //Token.LC:
- isObjectLitAr.push(false);
+ case '[': //Token.LB:
+ print('SCOPE-CURLY/PAREN/BRACE:' + token.toString());
+ //println("<i>"+token.data+"</i>");
+ var curTS = this.ts;
+ if (token.props) {
+
+ for (var prop in token.props) {
+ if (token.props[prop].val.data == 'function') {
+ // parse a function..
+ this.parseFunctProp(token.props[prop]);
+ continue;
+ }
+ // key value..
+
+ this.ts = new TokenStream(token.props[prop].val);
+ this.parseScope(currentScope);
+
+ }
+ this.ts = curTS;
+
+ // it's an object literal..
+ // the values could be replaced..
+ break;
+ }
+
- this.braceNesting++;
+ var _this = this;
+ token.items.forEach(function(expr) {
+ _this.ts = new TokenStream(expr);
+ _this.parseExpression()
+ });
+ this.ts = curTS;
+
+
+
///print(">>>>> EXP PUSH(false)"+this.braceNesting);
break;
- case '}': //Token.RC:
- this.braceNesting--;
- isObjectLitAr.pop();
- //print(">>>>> EXP POP" + this.braceNesting);
- // assert braceNesting >= expressionBraceNesting;
- break;
-
- case '[': //Token.LB:
+
- var ts = this.ts;
- var _this = this;
- token.items.forEach(function(ns) {
- print("EXPR-PUNC-MAKE:" + JSON.stringify(ns, null, 4));
- _this.ts = new TokenStream(ns);
- //_this.ts.cursor--;
- _this.parseExpression();
- });
- this.ts = ts;
+
- break;
-
+ case ')': //Token.RP:
case ']': //Token.RB:
+ case '}': //Token.RB:
print("<< EXIT EXPRESSION");
return;
- case '(': //Token.LP:
+
parensNesting++;
break;
- case ')': //Token.RP:
- parensNesting--;
- break;
+
+
}
break;