forked from qt-creator/qt-creator
		
	CppHighlighter: highlight macro references.
Change-Id: I7c90957aa67e03a109af0a722160d4e1c759d716 Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
		
				
					committed by
					
						
						Leandro Melo
					
				
			
			
				
	
			
			
			
						parent
						
							85ce5aba62
						
					
				
				
					commit
					85609aff8e
				
			@@ -40,6 +40,7 @@
 | 
			
		||||
#include <QSet>
 | 
			
		||||
#include <QTextDocument>
 | 
			
		||||
#include <QTextCursor>
 | 
			
		||||
#include <QStringRef>
 | 
			
		||||
 | 
			
		||||
using namespace CPlusPlus;
 | 
			
		||||
 | 
			
		||||
@@ -131,5 +132,49 @@ bool isValidIdentifier(const QString &s)
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool isQtKeyword(const QStringRef &text)
 | 
			
		||||
{
 | 
			
		||||
    switch (text.length()) {
 | 
			
		||||
    case 4:
 | 
			
		||||
        switch (text.at(0).toLatin1()) {
 | 
			
		||||
        case 'e':
 | 
			
		||||
            if (text == QLatin1String("emit"))
 | 
			
		||||
                return true;
 | 
			
		||||
            break;
 | 
			
		||||
        case 'S':
 | 
			
		||||
            if (text == QLatin1String("SLOT"))
 | 
			
		||||
                return true;
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case 5:
 | 
			
		||||
        if (text.at(0) == QLatin1Char('s') && text == QLatin1String("slots"))
 | 
			
		||||
            return true;
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case 6:
 | 
			
		||||
        if (text.at(0) == QLatin1Char('S') && text == QLatin1String("SIGNAL"))
 | 
			
		||||
            return true;
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case 7:
 | 
			
		||||
        switch (text.at(0).toLatin1()) {
 | 
			
		||||
        case 's':
 | 
			
		||||
            if (text == QLatin1String("signals"))
 | 
			
		||||
                return true;
 | 
			
		||||
            break;
 | 
			
		||||
        case 'f':
 | 
			
		||||
            if (text == QLatin1String("foreach") || text ==  QLatin1String("forever"))
 | 
			
		||||
                return true;
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    default:
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // CppTools
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user