Patch #1934 2007-03-29 13:14

devilsclaw

Code Completion Parser Fix -- Can now load current SVN of CB
Download
1934-Code_Completio.patch (2.6 KB)
Category
 
Status
Rejected
Close date
2007-04-09 09:44
Assigned to
 
--- tokenizer.cpp    2007-03-29 06:09:12.000000000 -0700
+++ tokenizer.cpp    2007-03-29 06:05:37.000000000 -0700
@@ -301,36 +301,34 @@
         default : return false;
     }

-    MoveToNextChar();
     int count = 1; // counter for nested blocks (xxx())
+
     while (NotEOF())
     {
         bool noMove = false;
-        if (CurrentChar() == '/')
-            SkipComment(); // this will decide if it is a comment
+      if (CurrentChar() == '/')
+      {
+          SkipComment(); // this will decide if it is a comment
+      }

-        if (CurrentChar() == '"' || CurrentChar() == '\'')
-        {
-            // this is the case that match is inside a string!
-            char ch = CurrentChar();
-            MoveToNextChar();
-            SkipToChar(ch);
-            MoveToNextChar();
-            // don't move to next char below if concatenating strings (e.g. printf("" ""))
-            if (CurrentChar() == '"' || CurrentChar() == '\'')
-                noMove = true;
-        }
-        if (CurrentChar() == ch)
-            ++count;
-        else if (CurrentChar() == match)
-            --count;
-        if (!noMove)
-            MoveToNextChar();
-        if (count == 0)
-            break;
+      if (CurrentChar() == '"' || CurrentChar() == '\'')
+      {
+          // this is the case that match is inside a string!
+          char tch = CurrentChar();
+          MoveToNextChar();
+          SkipToChar(tch);
+          MoveToNextChar();
+
+          // don't move to next char below if concatenating strings (e.g. printf("" ""))
+          if (CurrentChar() == '"' || CurrentChar() == '\'' || CurrentChar() == '+') noMove = true;
+      }
+
+      if (CurrentChar() == match) return true;
+      if (!noMove) MoveToNextChar();
+      if (count == 0) break;
     }
-    if (IsEOF())
-        return false;
+
+    if (IsEOF()) return false;
     return true;
 }

@@ -338,8 +336,7 @@
 {
     // C/C++ style comments
     bool is_comment = CurrentChar() == '/' && (NextChar() == '/' || NextChar() == '*');
-    if (!is_comment)
-        return true;
+    if (!is_comment)return true;

     bool cstyle = NextChar() == '*';
     MoveToNextChar(2);
@@ -348,8 +345,7 @@
     {
         if (!cstyle)
         {
-            if (!SkipToEOL(false))
-                return false;
+            if (!SkipToEOL(false)) return false;
             MoveToNextChar();
             break;
         }
@@ -368,10 +364,8 @@
                 return false;
         }
     }
-    if (IsEOF())
-        return false;
-    if (!SkipWhiteSpace())
-        return false;
+    if (IsEOF()) return false;
+    if (!SkipWhiteSpace()) return false;
     return true;
 }
devilsclaw 2007-03-29 21:36

This code needs Revemped.. its supposed to support nesting after reviewing it but he never updated it to and thats what the count variable was for.

biplab 2007-04-01 08:29

Are you re-writing the code. I can find more edited code than any real addition.