JSDOC/ScopeParser.vala
authorAlan Knowles <alan@roojs.com>
Mon, 9 Nov 2015 10:08:41 +0000 (18:08 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 9 Nov 2015 10:08:41 +0000 (18:08 +0800)
JSDOC/ScopeParser.vala

index 37a2a1d..f40bf6a 100644 (file)
@@ -774,26 +774,24 @@ namespace JSDOC {
                            
                            if (token.name == "EVAL") {
                            
-                            Regex.match_simple ("s[ai]mple", "This is a simple sample.",GLib.RegexCompileFlags.CASELESS);
-                             var regex = new GLib.Regex ("eval:var:([a-z_]+)",GLib.RegexCompileFlags.CASELESS );
-                                   regex.replace_eval (token.prefix, token.prefix.length, 0, 0, (match_info, result) => {
-                       
                            
                                //print(JSON.stringify(token,null,4));
                                
-                               if (token.prefix.length > 0 && token.prefix.match(/eval:var:/g)) {
+                               if (token.prefix.length > 0 && Regex.match_simple ("eval:var:", token.prefix,GLib.RegexCompileFlags.CASELESS)) {
                                    // look for eval:var:noreplace\n
                                   // print("GOT MATCH?");
-                                   var _t = this;
-                                   token.prefix.replace(/eval:var:([a-z]+)/ig, function(m, a) {
-                                       
+
+                                   
+                                  var regex = new GLib.Regex ("eval:var:([a-z_]+)",GLib.RegexCompileFlags.CASELESS );
+                                   regex.replace_eval (token.prefix, token.prefix.length, 0, 0, (match_info, result) => {
+                                               var a = match_info.fetch(0);
                                        //print("PROTECT: " + a);
                                        
                                        
-                                       var hi = _t.getIdentifier(a, scope, token);
+                                       var hi = this.getIdentifier(a, scope, token);
                                       //println("PROTECT "+a+" from munge" + (hi ? "FOUND" : "MISSING"));
-                                       if (hi) {
+                                       if (hi != null) {
                                          //  println("PROTECT "+a+" from munge");
                                            hi.toMunge = false;
                                        }