JSDOC/ScopeParser.vala
[gnome.introspection-doc-generator] / JSDOC / ScopeParser.vala
index 4f46dbd..013db13 100644 (file)
@@ -264,7 +264,7 @@ namespace JSDOC {
                            if (this.mode == ScopeParserMode.BUILDING_SYMBOL_TREE) {
                                var identifier = scope.getIdentifier(token.data,token) ;
                                
-                               if (identifier == false) {
+                               if (identifier == null) {
                                    scope.declareIdentifier(token.data, token);
                                } else {
                                    token.identifier = identifier;
@@ -434,7 +434,7 @@ namespace JSDOC {
                            // 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 (Regex.match_simple ("^[a-z_]+$", str) && this.idents.index_of(str) < 0) {
+                           if (Regex.match_simple ("^[a-z_]+$", str,GLib.RegexCompileFlags.CASELESS) && this.idents.index_of(str) < 0) {
                                token.outData = str;
                            }
                            
@@ -472,9 +472,9 @@ namespace JSDOC {
                            //println("GOT IDENT: <B>" + symbol + "</B><BR/>");
                                 
                                //println("GOT IDENT (2): <B>" + symbol + "</B><BR/>");
-                           identifier = this.getIdentifier(symbol, scope, token);
+                           var identifier = this.getIdentifier(symbol, scope, token);
                            
-                           if (identifier == false) {
+                           if (identifier == null) {
 // BUG!find out where builtin is defined...
                                if (symbol.length <= 3 &&  Scope.builtin.indexOf(symbol) < 0) {
                                    // Here, we found an undeclared and un-namespaced symbol that is
@@ -516,9 +516,7 @@ namespace JSDOC {
                                    var _t = this;
                                    
                                    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);
                                        var hi = this.getIdentifier(a, scope, token);
@@ -730,7 +728,7 @@ namespace JSDOC {
 
                            var identifier = this.getIdentifier(symbol, scope, token);
                            //println("<B>??</B>");
-                           if (identifier == false) {
+                           if (identifier == null) {
 
                                if (symbol.length <= 3 &&  Scope.builtin.indexOf(symbol) < 0) {
                                    // Here, we found an undeclared and un-namespaced symbol that is
@@ -775,19 +773,25 @@ namespace JSDOC {
                        if (this.mode == ScopeParserMode.BUILDING_SYMBOL_TREE) {
                            
                            if (token.name == "EVAL") {
+                           
+                           
                                //print(JSON.stringify(token,null,4));
-                               if (token.prefix && 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;
                                        }
@@ -816,7 +820,7 @@ namespace JSDOC {
        }
 
 
-       void parseCatch(scope) {
+       void parseCatch(Scoope scope) {
 
            
            //token = getToken(-1);