Rewrite spacing logic to properly handle comments
authorMathnerd314 <man.is.allan@gmail.com>
Wed, 21 Jan 2009 01:20:54 +0000 (01:20 +0000)
committerMathnerd314 <man.is.allan@gmail.com>
Wed, 21 Jan 2009 01:20:54 +0000 (01:20 +0000)
SVN-Revision: 5830

src/tinygettext/tinygettext.cpp

index 21fea97..7ba2c60 100644 (file)
@@ -619,15 +619,12 @@ public:
     if(c == EOF)
       return;
 
-    while(isspace(static_cast<unsigned char>(c))) nextChar();
-
-    // Comments are whitespace too (remove if we ever parse comments)
-    if (c == '#')
-      {
-        do {
-            nextChar();
-        } while(c != '\n' && c != EOF);
+    while(c == '#' || isspace(static_cast<unsigned char>(c))) {
+      if(c == '#') {
+        while(c != '\n' && c != EOF) nextChar();
       }
+      nextChar();
+    }
   }
 
   inline bool expectToken(std::string type, Token wanted) {