[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdevelop/languages/cpp/parser/rpp
From:       David Nolden <david.nolden.kde () art-master ! de>
Date:       2007-11-01 1:38:40
Message-ID: 1193881120.734715.19133.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 731574 by zwabel:

When no closing-bracket is found while expanding a function-like macro, seek back and \
do not apply the macro. This will allow argument-hints for macros.



 M  +14 -0     pp-macro-expander.cpp  


--- trunk/KDE/kdevelop/languages/cpp/parser/rpp/pp-macro-expander.cpp #731573:731574
@@ -254,6 +254,10 @@
 
         skip_whitespaces(input, devnull());
 
+        //In case expansion fails, we can skip back to this position
+        int openingPosition = input.pos();
+        int openingPositionLine = input.inputLineNumber();
+        
         // function like macro
         if (input.atEnd() || input != '(')
         {
@@ -310,6 +314,16 @@
           }
         }
 
+        if( input != ')' ) {
+          //Failed to expand the macro. Output the macro name and continue normal
+          //processing behind it.(Code completion depends on this behavior when \
expanding +          //incomplete input-lines)
+          output << name;
+          input.seek(openingPosition);
+          input.setInputLineNumber(openingPositionLine);
+          kDebug() << "seeking back";
+          continue;
+        }
         //Q_ASSERT(!input.atEnd() && input == ')');
 
         ++input; // skip ')'


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic