//print("MATCH!?");
var _t = this;
+ var regex = new GLib.Regex ("eval:var:([a-z_]+)",GLib.RegexCompileFlags.CASELESS );
+
+
- token.prefix.replace(/eval:var:([a-z_]+)/ig, function(m, a) {
- //print("GOT: " + a);
- var hi = _t.getIdentifier(a, scope, token);
- // println("PROTECT "+a+" from munge" + (hi ? "FOUND" : "MISSING"));
- if (hi) {
+ regex.replace_eval (token.prefix, token.prefix.length, 0, 0, (match_info, result) => {
+ var a = match_info.fetch(0);
+ var hi = this.getIdentifier(a, scope, token);
+ // println("PROTECT "+a+" from munge" + (hi ? "FOUND" : "MISSING"));
+ if (hi.length > 0) {
// print("PROTECT "+a+" from munge");
//print(JSON.stringify(hi,null,4));
hi.toMunge = false;
//assert scope.getParentScope() == globalScope;
scope.preventMunging();
- },
+ }
- string getIdentifier(string symbol, Scope scope, Token token)
+ Token getIdentifier(string symbol, Scope in_scope, Token token)
{
string identifier;
+ var scope = in_scope;
while (scope != null) {
identifier = scope.getIdentifier(symbol, token);
//println("ScopeParser.getIdentgetUsedSymbols("+symbol+")=" + scope.getUsedSymbols().join(','));
}
return "";
}
-};
+}