[Uml-devel] KDE/kdesdk/umbrello/umbrello/codeimport/kdevcppparser

Jean Vittor jean.vittor at free.fr
Wed Apr 2 15:30:07 UTC 2008


SVN commit 792923 by jvittor:

Use a rule to skip ignored lines

 M  +4 -6      lexer.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/kdevcppparser/lexer.cpp #792922:792923
@@ -232,6 +232,9 @@
 Lexer::CharRule gr_whiteSpace = blank_p | (ch_p('\\') >> eol_p);
 Lexer::CharRule gr_lineComment = (str_p("//") >> (*(anychar_p - eol_p)));
 Lexer::CharRule gr_multiLineComment = confix_p( "/*", *anychar_p, "*/");
+Lexer::CharRule gr_skipTillEol =
+  *(gr_whiteSpace | gr_lineComment | gr_multiLineComment | charLiteral_g
+    | gr_stringLiteral | (anychar_p - '\\' - eol_p) | (ch_p('\\') >> eol_p));
 
 Token::Token()
   : m_type( -1 ),
@@ -422,12 +425,7 @@
     m_source.set_startLine( false);
     bool ppe = m_preprocessorEnabled;
     m_preprocessorEnabled = false;
-    while( !m_source.currentChar().isNull()
-	   && m_source.currentChar() != '\n'
-	   && m_source.currentChar() != '\r') {
-      Token tok;
-      nextToken( tok);
-    }
+    m_source.parse( gr_skipTillEol);
     m_source.set_startLine( true);
     m_preprocessorEnabled = ppe;
     return;




More information about the umbrello-devel mailing list