From 38ea8c3ead1a5b679621363b01dfd54c7b42cf75 Mon Sep 17 00:00:00 2001 From: Mathnerd314 Date: Wed, 21 Jan 2009 01:20:54 +0000 Subject: [PATCH] Rewrite spacing logic to properly handle comments SVN-Revision: 5830 --- src/tinygettext/tinygettext.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/tinygettext/tinygettext.cpp b/src/tinygettext/tinygettext.cpp index 21fea977f..7ba2c6064 100644 --- a/src/tinygettext/tinygettext.cpp +++ b/src/tinygettext/tinygettext.cpp @@ -619,15 +619,12 @@ public: if(c == EOF) return; - while(isspace(static_cast(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(c))) { + if(c == '#') { + while(c != '\n' && c != EOF) nextChar(); } + nextChar(); + } } inline bool expectToken(std::string type, Token wanted) { -- 2.11.0