}
//this.logR("parseScope GOT VAR : <B>" + token.toString() + "</B>");
if (token.type != "NAME") {
- for(var i = Math.max(this.ts.cursor-10,0); i < this.ts.cursor+1; i++) {
+
+ for(var i = Int.max(this.ts.cursor-10,0); i < this.ts.cursor+1; i++) {
print(this.ts.tokens[i].toString());
}
print( "var without ident");
- Seed.quit()
+ GLib.Process.exit (0);
}
- if (this.mode == "BUILDING_SYMBOL_TREE") {
- identifier = scope.getIdentifier(token.data,token) ;
+ if (this.mode == ScopeParserMode.BUILDING_SYMBOL_TREE) {
+ var identifier = scope.getIdentifier(token.data,token) ;
if (identifier == false) {
scope.declareIdentifier(token.data, token);
} else {
token.identifier = identifier;
- this.warn("(SCOPE) The variable " + token.data + ' (line:' + token.line + ") has already been declared in the same scope...");
+ this.warn("(SCOPE) The variable " + token.data + " (line:" + token.line + ") has already been declared in the same scope...");
}
}
token = this.ts.nextTok();
- !this.debug|| print(token.toString());
+ //!this.debug|| print(token.toString());
/*
assert token.getType() == Token.SEMI ||
token.getType() == Token.ASSIGN ||
} else {
//var bn = this.braceNesting;
var bn = this.braceNesting;
- var nts = [];
+ var nts = new Gee.ArrayList<Token>();
while (true) {
- if (!token || token.type == 'VOID' || token.data == ',') {
+ if (!token || token.type == "VOID" || token.data == ",") {
break;
}
- nts.push(token);
+ nts.add(token);
token = this.ts.nextTok();
}
- if (nts.length) {
+ if (nts.size > 0) {
var TS = this.ts;
this.ts = new TokenStream(nts);
this.parseExpression(scope);
token = this.ts.lookTok(1);
//!this.debug||
// print("AFTER EXP: " + token.toString());
- if (token.data == ';') {
+ if (token.data == ";") {
break;
}
}
//print('SCOPE-CURLY/PAREN:' + token.toString());
//println("<i>"+token.data+"</i>");
var curTS = this.ts;
- if (token.props) {
+ if (token.props.size() > 0) {
// { a : ... , c : .... }
+ var iter = token.props.map_iterator();
- for (var prop in token.props) {
+ while(iter.next()) {
+
+ TokenKeyMap val = iter.get_value(); // TokenKeyMap
// print('SCOPE-PROPS:' + JSON.stringify(token.props[prop],null,4));
- if (token.props[prop].val[0].data == 'function') {
+ if (val.vals.get(0).data == "function") {
// parse a function..
- this.ts = new TokenStream(token.props[prop].val);
+ this.ts = new TokenStream(val.vals);
this.ts.nextTok();
this.parseFunctionDeclaration(scope);
}
// key value..
- this.ts = new TokenStream(token.props[prop].val);
+ this.ts = new TokenStream(val.vals);
this.parseExpression(scope);
}
// ( ... ) or { .... } not object literals..
- var _this = this;
- for (var xx =0; xx < token.items.length; xx++) {
- expr = token.items[xx];
+
+ for (var xx =0; xx < token.items.size; xx++) {
+ expr = token.items.get(xx);
//token.items.forEach(function(expr) {
//print(expr.toString());
- _this.ts = new TokenStream(expr);
+ this.ts = new TokenStream(expr);
//if (curTS.data == '(') {
- _this.parseScope(scope)
+ this.parseScope(scope);
//} else {
// _this.parseExpression(scope)
//}
case "KEYW.WITH":
//print('SCOPE-WITH:' + token.toString());
//println("<i>"+token.data+"</i>");
- if (this.mode == "BUILDING_SYMBOL_TREE") {
+ if (this.mode == ScopeParserMode.BUILDING_SYMBOL_TREE) {
// Inside a 'with' block, it is impossible to figure out
// statically whether a symbol is a local variable or an
// object member. As a consequence, the only thing we can
// print('SCOPE-STRING:' + token.toString());
//println("<i>"+token.data+"</i>");
- if (this.ts.lookTok(-1).data == '{' && this.ts.lookTok(1).data == ':') {
+ if (this.ts.lookTok(-1).data == "{" && this.ts.lookTok(1).data == ":") {
// then we are in an object lit.. -> we need to flag the brace as such...
- isObjectLitAr.pop();
- isObjectLitAr.push(true);
+ isObjectLitAr.remove_at(isObjectLitAr.size-1);
+ isObjectLitAr.add(true);
//print(">>>>>> OBJLIT REPUSH(true)");
}
- isInObjectLitAr = isObjectLitAr[isObjectLitAr.length-1];
+ isInObjectLitAr = isObjectLitAr.get(isObjectLitAr.size-1);
- if (isInObjectLitAr && this.ts.lookTok(1).data == ':' &&
- ( this.ts.lookTok(-1).data == '{' || this.ts.lookTok(-1).data == ':' )) {
+ if (isInObjectLitAr && this.ts.lookTok(1).data == ":" &&
+ ( this.ts.lookTok(-1).data == "{" || this.ts.lookTok(-1).data == ":" )) {
// see if we can replace..
// remove the quotes..
// should do a bit more checking!!!! (what about wierd char's in the string..
var str = token.data.substring(1,token.data.length-1);
- if (/^[a-z_]+$/i.test(str) && ScopeParser.idents.indexOf(str) < 0) {
+
+ if (Regex.match_simple ("^[a-z_]+$", str) && this.idents.index_of(str) < 0) {
token.outData = str;
}
//print("SYMBOL: " + token.toString());
symbol = token.data;
- if (symbol == 'this') {
+ if (symbol == "this") {
break;
}
if (this.mode == 'PASS2_SYMBOL_TREE') {