diff options
Diffstat (limited to 'src')
24 files changed, 728 insertions, 458 deletions
diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index 1f4621e970..06655b0960 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -109,6 +109,7 @@ Document::Document(const QString &fileName) localFileName.size()); _translationUnit = new TranslationUnit(_control, fileId); _translationUnit->setQtMocRunEnabled(true); + _translationUnit->setObjCEnabled(true); (void) _control->switchTranslationUnit(_translationUnit); } diff --git a/src/libs/cplusplus/SimpleLexer.cpp b/src/libs/cplusplus/SimpleLexer.cpp index 62ecaa174e..5efa1f02d8 100644 --- a/src/libs/cplusplus/SimpleLexer.cpp +++ b/src/libs/cplusplus/SimpleLexer.cpp @@ -59,7 +59,9 @@ SimpleLexer::SimpleLexer() _skipComments(false), _qtMocRunEnabled(true), _objCEnabled(false) -{ } +{ + setObjCEnabled(true); +} SimpleLexer::~SimpleLexer() { } diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index e7d3011a76..974af656a6 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -727,6 +727,7 @@ void Preprocessor::processDirective(TokenIterator firstToken, TokenIterator last case PP_INCLUDE: case PP_INCLUDE_NEXT: + case PP_IMPORT: if (! skipping()) processInclude(d == PP_INCLUDE_NEXT, firstToken, lastToken); break; @@ -1069,6 +1070,8 @@ Preprocessor::PP_DIRECTIVE_TYPE Preprocessor::classifyDirective (const QByteArra case 6: if (__directive[0] == 'i' && __directive == "ifndef") return PP_IFNDEF; + else if (__directive[0] == 'i' && __directive == "import") + return PP_IMPORT; else if (__directive[0] == 'd' && __directive == "define") return PP_DEFINE; break; diff --git a/src/libs/cplusplus/pp-engine.h b/src/libs/cplusplus/pp-engine.h index 24e1ac13de..033db4cb93 100644 --- a/src/libs/cplusplus/pp-engine.h +++ b/src/libs/cplusplus/pp-engine.h @@ -150,6 +150,7 @@ namespace CPlusPlus { { PP_UNKNOWN_DIRECTIVE, PP_DEFINE, + PP_IMPORT, PP_INCLUDE, PP_INCLUDE_NEXT, PP_ELIF, diff --git a/src/plugins/bineditor/BinEditor.mimetypes.xml b/src/plugins/bineditor/BinEditor.mimetypes.xml index 4fcd960365..7791d07203 100644 --- a/src/plugins/bineditor/BinEditor.mimetypes.xml +++ b/src/plugins/bineditor/BinEditor.mimetypes.xml @@ -2,38 +2,5 @@ <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> <mime-type type="application/octet-stream"> <comment>unknown</comment> - <comment xml:lang="bg">Неизвестен тип</comment> - <comment xml:lang="ca">desconegut</comment> - <comment xml:lang="cs">Neznámý</comment> - <comment xml:lang="cy">Anhysbys</comment> - <comment xml:lang="da">ukendt</comment> - <comment xml:lang="de">unbekannt</comment> - <comment xml:lang="el">αγνωστο</comment> - <comment xml:lang="eo">nekonata</comment> - <comment xml:lang="es">desconocido</comment> - <comment xml:lang="eu">ezezaguna</comment> - <comment xml:lang="fi">tuntematon</comment> - <comment xml:lang="fr">inconnu</comment> - <comment xml:lang="hu">ismeretlen</comment> - <comment xml:lang="it">Sconosciuto</comment> - <comment xml:lang="ja">不明</comment> - <comment xml:lang="ko">알 수 없음</comment> - <comment xml:lang="lt">nežinoma</comment> - <comment xml:lang="ms">Entah</comment> - <comment xml:lang="nb">ukjent</comment> - <comment xml:lang="nl">onbekend</comment> - <comment xml:lang="nn">ukjend</comment> - <comment xml:lang="pl">nieznany typ</comment> - <comment xml:lang="pt">desconhecido</comment> - <comment xml:lang="pt_BR">Desconhecido</comment> - <comment xml:lang="ru">неизвестный</comment> - <comment xml:lang="rw">itazwi</comment> - <comment xml:lang="sq">nuk njihet</comment> - <comment xml:lang="sr">непознато</comment> - <comment xml:lang="sv">okänd</comment> - <comment xml:lang="uk">невідомо</comment> - <comment xml:lang="vi">không rõ</comment> - <comment xml:lang="zh_CN">未知</comment> - <comment xml:lang="zh_TW">不明</comment> </mime-type> </mime-info> diff --git a/src/plugins/cppeditor/CppEditor.mimetypes.xml b/src/plugins/cppeditor/CppEditor.mimetypes.xml index 0c58890e9b..04046a2847 100644 --- a/src/plugins/cppeditor/CppEditor.mimetypes.xml +++ b/src/plugins/cppeditor/CppEditor.mimetypes.xml @@ -3,37 +3,6 @@ <mime-type type="text/x-csrc"> <sub-class-of type="text/plain"/> <comment>C Source file</comment> - <comment xml:lang="bg">Изходен код на C</comment> - <comment xml:lang="ca">codi font en C</comment> - <comment xml:lang="cs">Zdrojový kód v C</comment> - <comment xml:lang="cy">Ffynhonnell Rhaglen C</comment> - <comment xml:lang="da">C-kildekode</comment> - <comment xml:lang="de">C-Quelltext</comment> - <comment xml:lang="el">πηγαίος κώδικας C</comment> - <comment xml:lang="eo">C-fontkodo</comment> - <comment xml:lang="es">código fuente en C</comment> - <comment xml:lang="eu">C iturburu-kodea</comment> - <comment xml:lang="fi">C-lähdekoodi</comment> - <comment xml:lang="fr">code source C</comment> - <comment xml:lang="hu">C-forráskód</comment> - <comment xml:lang="it">Codice sorgente C</comment> - <comment xml:lang="ja">C ソースコード</comment> - <comment xml:lang="ko">C 소스 코드</comment> - <comment xml:lang="lt">C pradinis kodas</comment> - <comment xml:lang="ms">Kod sumber C</comment> - <comment xml:lang="nb">C-kildekode</comment> - <comment xml:lang="nl">C-broncode</comment> - <comment xml:lang="nn">C-kjeldekode</comment> - <comment xml:lang="pl">Kod źródłowy w C</comment> - <comment xml:lang="pt">código fonte C</comment> - <comment xml:lang="pt_BR">Código fonte C</comment> - <comment xml:lang="ru">программа на языке C</comment> - <comment xml:lang="sq">Kod burues C</comment> - <comment xml:lang="sr">C изворни ко̂д</comment> - <comment xml:lang="sv">C-källkod</comment> - <comment xml:lang="uk">Вихідний код на мові C</comment> - <comment xml:lang="zh_CN">C 源代码</comment> - <comment xml:lang="zh_TW">C 源代碼</comment> <glob pattern="*.c"/> </mime-type> @@ -41,21 +10,6 @@ <mime-type type="text/x-chdr"> <sub-class-of type="text/x-csrc"/> <comment>C Header file</comment> - <comment xml:lang="bg">Заглавен файл на C</comment> - <comment xml:lang="cs">Hlavička v C</comment> - <comment xml:lang="de">C-Header</comment> - <comment xml:lang="es">cabecera de código fuente en C</comment> - <comment xml:lang="eu">C goiburua</comment> - <comment xml:lang="fi">C-otsake</comment> - <comment xml:lang="fr">en-tête C</comment> - <comment xml:lang="hu">C fejléc</comment> - <comment xml:lang="it">Header C</comment> - <comment xml:lang="ko">C 헤더</comment> - <comment xml:lang="nb">C-kildekodeheader</comment> - <comment xml:lang="nn">C-hovud</comment> - <comment xml:lang="pl">Plik nagłówkowy w C</comment> - <comment xml:lang="sv">C-huvud</comment> - <comment xml:lang="uk">Файл заголовків на C</comment> <glob pattern="*.h"/> </mime-type> @@ -65,20 +19,6 @@ <sub-class-of type="text/x-chdr"/> <comment>C++ Header file</comment> <comment>C++ header</comment> - <comment xml:lang="bg">Заглавен файл на C++</comment> - <comment xml:lang="cs">Hlavička v C++</comment> - <comment xml:lang="de">C++-Header</comment> - <comment xml:lang="es">cabecera de código fuente en C++</comment> - <comment xml:lang="eu">C++ goiburua</comment> - <comment xml:lang="fi">C++-otsake</comment> - <comment xml:lang="fr">en-tête C++</comment> - <comment xml:lang="hu">C++ fejléc</comment> - <comment xml:lang="it">Header C++</comment> - <comment xml:lang="nb">C++-kildekodeheader</comment> - <comment xml:lang="nn">C++-hovud</comment> - <comment xml:lang="pl">Plik nagłówkowy w C++</comment> - <comment xml:lang="sv">C++-huvud</comment> - <comment xml:lang="uk">Файл заголовків на C++</comment> <glob pattern="*.h"/> <glob pattern="*.hh"/> <glob pattern="*.hxx"/> @@ -97,37 +37,6 @@ <comment>C++ Source file</comment> <sub-class-of type="text/x-csrc"/> <comment>C++ source code</comment> - <comment xml:lang="bg">Изходен код на C++</comment> - <comment xml:lang="ca">codi font en C++</comment> - <comment xml:lang="cs">Zdrojový kód v C++</comment> - <comment xml:lang="cy">Ffynhonnell Rhaglen C++</comment> - <comment xml:lang="da">C++-kildekode</comment> - <comment xml:lang="de">C++-Quelltext</comment> - <comment xml:lang="el">πηγαίος κώδικας C++</comment> - <comment xml:lang="eo">C++-fontkodo</comment> - <comment xml:lang="es">código fuente en C++</comment> - <comment xml:lang="eu">C++ iturburu-kodea</comment> - <comment xml:lang="fi">C++-lähdekoodi</comment> - <comment xml:lang="fr">code source C++</comment> - <comment xml:lang="hu">C++-forráskód</comment> - <comment xml:lang="it">Codice sorgente C++</comment> - <comment xml:lang="ja">C++ ソースコード</comment> - <comment xml:lang="ko">C++ 소스 코드</comment> - <comment xml:lang="lt">C++ pradinis kodas</comment> - <comment xml:lang="ms">Kod sumber C++</comment> - <comment xml:lang="nb">C++-kildekode</comment> - <comment xml:lang="nl">C++-broncode</comment> - <comment xml:lang="nn">C++-kjeldekode</comment> - <comment xml:lang="pl">Kod źródłowy w C++</comment> - <comment xml:lang="pt">código fonte C++</comment> - <comment xml:lang="pt_BR">Código fonte C++</comment> - <comment xml:lang="ru">программа на языке C++</comment> - <comment xml:lang="sq">Kod burues C++</comment> - <comment xml:lang="sr">C++ изворни ко̂д</comment> - <comment xml:lang="sv">C++-källkod</comment> - <comment xml:lang="uk">Вихідний код на мові C++</comment> - <comment xml:lang="zh_CN">C++ 源代码</comment> - <comment xml:lang="zh_TW">C++ 源代碼</comment> <glob pattern="*.cpp"/> <glob pattern="*.cc"/> <glob pattern="*.cxx"/> @@ -135,4 +44,15 @@ <glob pattern="*.C"/> <glob pattern="*.inl"/> </mime-type> + + <mime-type type="text/x-objcsrc"> + <comment>Objective-C source code</comment> + <sub-class-of type="text/x-csrc"/> + <magic priority="30"> + <match value="#import" type="string" offset="0"/> + </magic> + <glob pattern="*.m"/> + <glob pattern="*.mm"/> + </mime-type> + </mime-info> diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index f7d12b0add..511cb56c8b 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -230,6 +230,8 @@ bool CppHighlighter::isPPKeyword(const QStringRef &text) const case 6: if (text.at(0) == 'i' && text == QLatin1String("ifndef")) return true; + if (text.at(0) == 'i' && text == QLatin1String("import")) + return true; else if (text.at(0) == 'd' && text == QLatin1String("define")) return true; else if (text.at(0) == 'p' && text == QLatin1String("pragma")) diff --git a/src/plugins/cpptools/completionsettingspage.ui b/src/plugins/cpptools/completionsettingspage.ui index c71a2abc82..a044376bc7 100644 --- a/src/plugins/cpptools/completionsettingspage.ui +++ b/src/plugins/cpptools/completionsettingspage.ui @@ -17,11 +17,14 @@ <item> <widget class="QGroupBox" name="groupBox"> <property name="title"> - <string>Completion Settings</string> + <string>Code Completion</string> </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> <widget class="QCheckBox" name="caseSensitive"> + <property name="toolTip"> + <string>Do a case-sensitive match for completion items.</string> + </property> <property name="text"> <string>&Case-sensitive completion</string> </property> @@ -32,6 +35,9 @@ </item> <item> <widget class="QCheckBox" name="autoInsertBraces"> + <property name="toolTip"> + <string>Automatically insert (, ) and ; when appropriate.</string> + </property> <property name="text"> <string>&Automatically insert braces</string> </property> @@ -42,6 +48,9 @@ </item> <item> <widget class="QCheckBox" name="partiallyComplete"> + <property name="toolTip"> + <string>Insert the common prefix of available completion items.</string> + </property> <property name="text"> <string>Autocomplete common &prefix</string> </property> diff --git a/src/plugins/designer/Designer.mimetypes.xml b/src/plugins/designer/Designer.mimetypes.xml index f093afb0e1..a593f240d1 100644 --- a/src/plugins/designer/Designer.mimetypes.xml +++ b/src/plugins/designer/Designer.mimetypes.xml @@ -4,34 +4,5 @@ <sub-class-of type="application/xml"/> <comment>Qt Designer file</comment> <glob pattern="*.ui"/> - <comment xml:lang="bg">Файл, формат Qt Designer</comment> - <comment xml:lang="ca">fitxer de Qt Designer</comment> - <comment xml:lang="cs">Soubor Qt Designeru</comment> - <comment xml:lang="cy">Ffeil Qt Designer</comment> - <comment xml:lang="da">Qt Designer-fil</comment> - <comment xml:lang="de">QT Designer-Datei</comment> - <comment xml:lang="el">αρχείο Qt Designer</comment> - <comment xml:lang="eo">dosiero de Qt Designer</comment> - <comment xml:lang="es">fichero de Qt Designer</comment> - <comment xml:lang="eu">Qt Designer Fitxategia</comment> - <comment xml:lang="fi">Qt Designer -tiedosto</comment> - <comment xml:lang="fr">fichier Qt Designer</comment> - <comment xml:lang="hu">Qt Designer-fájl</comment> - <comment xml:lang="it">File Qt Designer</comment> - <comment xml:lang="ja">Qt Designer ファイル</comment> - <comment xml:lang="ko">Qt 디자이너 파일</comment> - <comment xml:lang="lt">Qt Designer rinkmena</comment> - <comment xml:lang="ms">Fail Qt Designer</comment> - <comment xml:lang="nb">Qt Designer-fil</comment> - <comment xml:lang="nl">Qt Designer-bestand</comment> - <comment xml:lang="nn">Qt Designer-fil</comment> - <comment xml:lang="pl">Plik Qt Designera</comment> - <comment xml:lang="pt">ficheiro do Qt Designer</comment> - <comment xml:lang="pt_BR">Arquivo do Qt Designer</comment> - <comment xml:lang="ru">файл Qt Designer</comment> - <comment xml:lang="sq">File Qt Designer</comment> - <comment xml:lang="sr">Qt Designer датотека</comment> - <comment xml:lang="sv">Qt Designer-fil</comment> - <comment xml:lang="uk">Файл програми Qt-дизайнер</comment> </mime-type> </mime-info> diff --git a/src/plugins/qtscripteditor/QtScriptEditor.mimetypes.xml b/src/plugins/qtscripteditor/QtScriptEditor.mimetypes.xml index 45f6c0b00b..cd60086773 100644 --- a/src/plugins/qtscripteditor/QtScriptEditor.mimetypes.xml +++ b/src/plugins/qtscripteditor/QtScriptEditor.mimetypes.xml @@ -5,37 +5,6 @@ <alias type="text/javascript"/> <sub-class-of type="text/plain"/> <comment>Qt Script file</comment> - <comment xml:lang="bg">Програма на JavaScript</comment> - <comment xml:lang="ca">programa JavaScript</comment> - <comment xml:lang="cs">Program v JavaScriptu</comment> - <comment xml:lang="da">JavaScript-program</comment> - <comment xml:lang="de">JavaScript-Programm</comment> - <comment xml:lang="el">πρόγραμμα JavaScript</comment> - <comment xml:lang="eo">JavaScript-programo</comment> - <comment xml:lang="es">programa en JavaScript</comment> - <comment xml:lang="eu">JavaScript programa</comment> - <comment xml:lang="fi">JavaScript-ohjelma</comment> - <comment xml:lang="fr">programme JavaScript</comment> - <comment xml:lang="hu">JavaScript-program</comment> - <comment xml:lang="it">Programma JavaScript</comment> - <comment xml:lang="ja">JavaScript プログラム</comment> - <comment xml:lang="ko">자바스크립트 프로그램</comment> - <comment xml:lang="lt">JavaScript programa</comment> - <comment xml:lang="ms">Program JavaScript</comment> - <comment xml:lang="nb">JavaScript-program</comment> - <comment xml:lang="nl">JavaScript-programma</comment> - <comment xml:lang="nn">JavaScript-program</comment> - <comment xml:lang="pl">Pogram JavaScript</comment> - <comment xml:lang="pt">programa JavaScript</comment> - <comment xml:lang="pt_BR">Programa JavaScript</comment> - <comment xml:lang="ru">программа JavaScript</comment> - <comment xml:lang="sq">program JavaScript</comment> - <comment xml:lang="sr">Јаваскрипт програм</comment> - <comment xml:lang="sv">JavaScript-program</comment> - <comment xml:lang="uk">Програма на мові JavaScript</comment> - <comment xml:lang="vi">Chương trình JavaScript</comment> - <comment xml:lang="zh_CN">JavaScript 程序</comment> - <comment xml:lang="zh_TW">JavaScript 程式</comment> <glob pattern="*.js"/> </mime-type> </mime-info> diff --git a/src/plugins/texteditor/TextEditor.mimetypes.xml b/src/plugins/texteditor/TextEditor.mimetypes.xml index e78754da68..913b9fe0eb 100644 --- a/src/plugins/texteditor/TextEditor.mimetypes.xml +++ b/src/plugins/texteditor/TextEditor.mimetypes.xml @@ -3,36 +3,6 @@ <mime-type type="text/plain"> <comment>Plain text document</comment> <sub-class-of type="application/octet-stream"/> - <comment xml:lang="bg">Документ с неформатиран текст</comment> - <comment xml:lang="ca">document de text pla</comment> - <comment xml:lang="cs">Prostý textový dokument</comment> - <comment xml:lang="da">ren tekst-dokument</comment> - <comment xml:lang="de">einfaches Textdokument</comment> - <comment xml:lang="el">έγγραφο απλού κειμένου</comment> - <comment xml:lang="eo">plata teksta dokumento</comment> - <comment xml:lang="es">documento de texto sencillo</comment> - <comment xml:lang="eu">testu soileko dokumentua</comment> - <comment xml:lang="fi">perustekstiasiakirja</comment> - <comment xml:lang="fr">document plein texte</comment> - <comment xml:lang="hu">egyszerű szöveg</comment> - <comment xml:lang="it">Documento in testo semplice</comment> - <comment xml:lang="ja">平文テキストドキュメント</comment> - <comment xml:lang="ko">보통 text 문서</comment> - <comment xml:lang="lt">paprastas tekstinis dokumentas</comment> - <comment xml:lang="ms">Dokumen teks jernih</comment> - <comment xml:lang="nb">vanlig tekstdokument</comment> - <comment xml:lang="nl">platte tekst document</comment> - <comment xml:lang="nn">vanleg tekstdokument</comment> - <comment xml:lang="pl">zwykły dokument tekstowy</comment> - <comment xml:lang="pt">documento em texto simples</comment> - <comment xml:lang="pt_BR">Documento somente texto</comment> - <comment xml:lang="sq">dokument teksti i thjeshtë</comment> - <comment xml:lang="sr">обичан текстуални документ</comment> - <comment xml:lang="sv">vanligt textdokument</comment> - <comment xml:lang="uk">звичайний текстовий документ</comment> - <comment xml:lang="vi">thư nhập thô (văn bản không có kiểu dáng)</comment> - <comment xml:lang="zh_CN">纯文本文档</comment> - <comment xml:lang="zh_TW">普通文本檔</comment> <glob pattern="*.txt"/> </mime-type> <mime-type type="application/xml"> diff --git a/src/plugins/texteditor/behaviorsettingspage.ui b/src/plugins/texteditor/behaviorsettingspage.ui index e6414918c2..64febb27e5 100644 --- a/src/plugins/texteditor/behaviorsettingspage.ui +++ b/src/plugins/texteditor/behaviorsettingspage.ui @@ -6,27 +6,144 @@ <rect> <x>0</x> <y>0</y> - <width>484</width> - <height>398</height> + <width>428</width> + <height>384</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupBoxTabAndIndentSettings"> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBoxStorageSettings"> <property name="title"> - <string>Tab/Indent Settings</string> + <string>Storage</string> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QCheckBox" name="cleanWhitespace"> + <property name="toolTip"> + <string>Removes trailing whitespace on saving.</string> + </property> + <property name="text"> + <string>&Clean whitespace</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="inEntireDocument"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Clean whitespace in entire document instead of only for changed parts.</string> + </property> + <property name="text"> + <string>In entire &document</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="cleanIndentationLayout"> + <item> + <spacer name="cleanIndentationSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="cleanIndentation"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Correct leading whitespace according to tab settings.</string> + </property> + <property name="text"> + <string>Clean indentation</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QCheckBox" name="addFinalNewLine"> + <property name="text"> + <string>&Ensure newline at end of file</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="2" column="0"> + <widget class="QGroupBox" name="groupBoxInteractionSettings"> + <property name="title"> + <string>Interaction</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> <item row="0" column="0"> - <widget class="QCheckBox" name="autoIndent"> + <widget class="QCheckBox" name="useVim"> + <property name="toolTip"> + <string/> + </property> <property name="text"> - <string>Enable automatic &indentation</string> + <string>Use "vi" style editing</string> </property> </widget> </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>8</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBoxTabAndIndentSettings"> + <property name="title"> + <string>Tabs and Indentation</string> + </property> + <layout class="QGridLayout" name="gridLayout"> <item row="0" column="2"> <layout class="QHBoxLayout" name="horizontalLayout_3"> <item> @@ -89,13 +206,6 @@ </property> </spacer> </item> - <item row="1" column="0"> - <widget class="QCheckBox" name="insertSpaces"> - <property name="text"> - <string>Insert &spaces instead of tabs</string> - </property> - </widget> - </item> <item row="1" column="2"> <layout class="QHBoxLayout" name="horizontalLayout_4"> <item> @@ -145,8 +255,11 @@ </item> </layout> </item> - <item row="2" column="0"> + <item row="3" column="0"> <widget class="QCheckBox" name="smartBackspace"> + <property name="toolTip"> + <string>Backspace will go back one indentation level instead of one space.</string> + </property> <property name="text"> <string>&Backspace follows indentation</string> </property> @@ -168,121 +281,23 @@ </property> </spacer> </item> - </layout> - </widget> - </item> - <item row="1" column="0"> - <widget class="QGroupBox" name="groupBoxStorageSettings"> - <property name="title"> - <string>Storage Settings</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QCheckBox" name="cleanWhitespace"> - <property name="text"> - <string>&Clean whitespace</string> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>30</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QCheckBox" name="inEntireDocument"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>In entire &document</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="cleanIndentationLayout"> - <item> - <spacer name="cleanIndentationSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>30</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QCheckBox" name="cleanIndentation"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Clean indentation</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QCheckBox" name="addFinalNewLine"> + <item row="0" column="0"> + <widget class="QCheckBox" name="insertSpaces"> <property name="text"> - <string>&Ensure newline at end of file</string> + <string>Insert &spaces instead of tabs</string> </property> </widget> </item> - </layout> - </widget> - </item> - <item row="2" column="0"> - <widget class="QGroupBox" name="groupBoxInteractionSettings"> - <property name="title"> - <string>Interaction Settings</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QCheckBox" name="useVim"> + <item row="1" column="0"> + <widget class="QCheckBox" name="autoIndent"> <property name="text"> - <string>Use "vi" style editing</string> + <string>Enable automatic &indentation</string> </property> </widget> </item> </layout> </widget> </item> - <item row="3" column="0"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>8</height> - </size> - </property> - </spacer> - </item> </layout> </widget> <resources/> diff --git a/src/plugins/texteditor/displaysettingspage.ui b/src/plugins/texteditor/displaysettingspage.ui index 30fdf5cf93..59c8d676b2 100644 --- a/src/plugins/texteditor/displaysettingspage.ui +++ b/src/plugins/texteditor/displaysettingspage.ui @@ -6,70 +6,58 @@ <rect> <x>0</x> <y>0</y> - <width>514</width> - <height>194</height> + <width>381</width> + <height>279</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupBoxDisplaySettings"> + <item row="2" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>8</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox"> <property name="title"> - <string>Display Settings</string> + <string>Display</string> </property> - <layout class="QGridLayout"> - <item row="0" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QCheckBox" name="showWrapColumn"> - <property name="text"> - <string>Display right &margin at column</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="wrapColumn"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - </layout> - </item> + <layout class="QGridLayout" name="gridLayout_2"> <item row="0" column="0"> - <widget class="QCheckBox" name="enableTextWrapping"> - <property name="text"> - <string>Enable text &wrapping</string> - </property> - </widget> - </item> - <item row="3" column="0"> <widget class="QCheckBox" name="displayLineNumbers"> <property name="text"> <string>Display line &numbers</string> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QCheckBox" name="visualizeWhitespace"> + <item row="1" column="0"> + <widget class="QCheckBox" name="displayFoldingMarkers"> <property name="text"> - <string>&Visualize whitespace</string> + <string>Display &folding markers</string> </property> </widget> </item> - <item row="4" column="0"> - <widget class="QCheckBox" name="displayFoldingMarkers"> + <item row="2" column="0"> + <widget class="QCheckBox" name="visualizeWhitespace"> + <property name="toolTip"> + <string>Show tabs and spaces.</string> + </property> <property name="text"> - <string>Display &folding markers</string> + <string>&Visualize whitespace</string> </property> </widget> </item> - <item row="4" column="1"> + <item row="3" column="0"> <widget class="QCheckBox" name="highlightCurrentLine"> <property name="text"> <string>Highlight current &line</string> @@ -79,18 +67,55 @@ </layout> </widget> </item> - <item row="1" column="0"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>8</height> - </size> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBoxDisplaySettings"> + <property name="title"> + <string>Text Wrapping</string> </property> - </spacer> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QCheckBox" name="enableTextWrapping"> + <property name="text"> + <string>Enable text &wrapping</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QCheckBox" name="showWrapColumn"> + <property name="text"> + <string>Display right &margin at column:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="wrapColumn"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maximum"> + <number>999</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> </item> </layout> </widget> diff --git a/src/plugins/texteditor/fontsettingspage.ui b/src/plugins/texteditor/fontsettingspage.ui index 770d5e2935..8aafb751b2 100644 --- a/src/plugins/texteditor/fontsettingspage.ui +++ b/src/plugins/texteditor/fontsettingspage.ui @@ -23,7 +23,7 @@ <item> <widget class="QGroupBox" name="groupBox"> <property name="title"> - <string>General Font Settings</string> + <string>Font</string> </property> <layout class="QHBoxLayout"> <property name="spacing"> @@ -119,7 +119,7 @@ </sizepolicy> </property> <property name="title"> - <string>Item Specific Settings</string> + <string>Color Scheme</string> </property> <layout class="QHBoxLayout"> <property name="spacing"> diff --git a/src/plugins/vcsbase/VCSBase.mimetypes.xml b/src/plugins/vcsbase/VCSBase.mimetypes.xml index 1c97052174..b5821a75a6 100644 --- a/src/plugins/vcsbase/VCSBase.mimetypes.xml +++ b/src/plugins/vcsbase/VCSBase.mimetypes.xml @@ -3,37 +3,6 @@ <mime-type type="text/x-patch"> <sub-class-of type="text/plain"/> <comment>Differences between files</comment> - <glob pattern="*.diff"/> <comment xml:lang="bg">Разлики между файлове</comment> - <comment xml:lang="ca">diferències entre fitxers</comment> - <comment xml:lang="cs">Rozdíly mezi soubory</comment> - <comment xml:lang="da">forskel mellem filer</comment> - <comment xml:lang="de">Unterschied zwischen Dateien</comment> - <comment xml:lang="el">διαφορές μεταξύ αρχείων</comment> - <comment xml:lang="eo">diferencoj inter dosieroj</comment> - <comment xml:lang="es">diferencias entre ficheros</comment> - <comment xml:lang="eu">fitxategien arteko ezberdintasunak</comment> - <comment xml:lang="fi">tiedostojen väliset erot</comment> - <comment xml:lang="fr">différences entre fichiers</comment> - <comment xml:lang="hu">diff-különbségfájl</comment> - <comment xml:lang="it">Differenze tra file</comment> - <comment xml:lang="ja">ファイル間差分</comment> - <comment xml:lang="ko">파일사이의 바뀐점</comment> - <comment xml:lang="lt">skirtumai tarp rinkmenų</comment> - <comment xml:lang="ms">Perbezaan antara fail</comment> - <comment xml:lang="nb">forskjeller mellom filer</comment> - <comment xml:lang="nl">verschillen tussen bestanden</comment> - <comment xml:lang="nn">skilnader mellom filer</comment> - <comment xml:lang="pl">różnica pomiędzy plikami</comment> - <comment xml:lang="pt">diferenças entre ficheiros</comment> - <comment xml:lang="pt_BR">Diferenças entre arquivos</comment> - <comment xml:lang="ru">различия между файлами</comment> - <comment xml:lang="sq">diferenca midis files</comment> - <comment xml:lang="sr">разлике међу датотекама</comment> - <comment xml:lang="sv">skillnader mellan filer</comment> - <comment xml:lang="uk">різниця між файлами</comment> - <comment xml:lang="vi">khác biệt giữa nhiều tập tin</comment> - <comment xml:lang="zh_CN">文件的区别</comment> - <comment xml:lang="zh_TW">檔案內容差異</comment> <glob pattern="*.patch"/> </mime-type> </mime-info> diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp index 3d710db366..d0ac090099 100644 --- a/src/shared/cplusplus/AST.cpp +++ b/src/shared/cplusplus/AST.cpp @@ -611,8 +611,7 @@ AsmDefinitionAST *AsmDefinitionAST::clone(MemoryPool *pool) const { AsmDefinitionAST *ast = new (pool) AsmDefinitionAST; ast->asm_token = asm_token; - if (cv_qualifier_seq) - ast->cv_qualifier_seq = cv_qualifier_seq->clone(pool); + ast->volatile_token = volatile_token; ast->lparen_token = lparen_token; ast->rparen_token = rparen_token; ast->semicolon_token = semicolon_token; @@ -622,9 +621,7 @@ AsmDefinitionAST *AsmDefinitionAST::clone(MemoryPool *pool) const void AsmDefinitionAST::accept0(ASTVisitor *visitor) { if (visitor->visit(this)) { - for (SpecifierAST *spec = cv_qualifier_seq; spec; - spec = spec->next) - accept(spec, visitor); + // ### accept the asm operand list. } } @@ -641,11 +638,8 @@ unsigned AsmDefinitionAST::lastToken() const return rparen_token + 1; else if (lparen_token) return lparen_token + 1; - for (SpecifierAST *it = cv_qualifier_seq; it; it = it->next) { - if (! it->next) - return it->lastToken(); - } - + else if (volatile_token) + return volatile_token + 1; return asm_token + 1; } diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h index d7f346c5b0..1918ee7953 100644 --- a/src/shared/cplusplus/AST.h +++ b/src/shared/cplusplus/AST.h @@ -397,8 +397,10 @@ class CPLUSPLUS_EXPORT AsmDefinitionAST: public DeclarationAST { public: unsigned asm_token; - SpecifierAST *cv_qualifier_seq; + unsigned volatile_token; unsigned lparen_token; + // ### string literals + // ### asm operand list unsigned rparen_token; unsigned semicolon_token; diff --git a/src/shared/cplusplus/ObjectiveCTypeQualifiers.cpp b/src/shared/cplusplus/ObjectiveCTypeQualifiers.cpp new file mode 100644 index 0000000000..0bcff3202c --- /dev/null +++ b/src/shared/cplusplus/ObjectiveCTypeQualifiers.cpp @@ -0,0 +1,124 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#include "ObjectiveCTypeQualifiers.h" + +CPLUSPLUS_BEGIN_NAMESPACE + +static inline int classify2(const char *s) { + if (s[0] == 'i') { + if (s[1] == 'n') { + return Token_in; + } + } + return Token_identifier; +} + +static inline int classify3(const char *s) { + if (s[0] == 'o') { + if (s[1] == 'u') { + if (s[2] == 't') { + return Token_out; + } + } + } + return Token_identifier; +} + +static inline int classify5(const char *s) { + if (s[0] == 'b') { + if (s[1] == 'y') { + if (s[2] == 'r') { + if (s[3] == 'e') { + if (s[4] == 'f') { + return Token_byref; + } + } + } + } + } + else if (s[0] == 'i') { + if (s[1] == 'n') { + if (s[2] == 'o') { + if (s[3] == 'u') { + if (s[4] == 't') { + return Token_inout; + } + } + } + } + } + return Token_identifier; +} + +static inline int classify6(const char *s) { + if (s[0] == 'b') { + if (s[1] == 'y') { + if (s[2] == 'c') { + if (s[3] == 'o') { + if (s[4] == 'p') { + if (s[5] == 'y') { + return Token_bycopy; + } + } + } + } + } + } + else if (s[0] == 'o') { + if (s[1] == 'n') { + if (s[2] == 'e') { + if (s[3] == 'w') { + if (s[4] == 'a') { + if (s[5] == 'y') { + return Token_oneway; + } + } + } + } + } + } + return Token_identifier; +} + +int classifyObjectiveCTypeQualifiers(const char *s, int n) { + switch (n) { + case 2: return classify2(s); + case 3: return classify3(s); + case 5: return classify5(s); + case 6: return classify6(s); + default: return Token_identifier; + } // switch +} + +CPLUSPLUS_END_NAMESPACE diff --git a/src/shared/cplusplus/ObjectiveCTypeQualifiers.h b/src/shared/cplusplus/ObjectiveCTypeQualifiers.h new file mode 100644 index 0000000000..5dd7a7609b --- /dev/null +++ b/src/shared/cplusplus/ObjectiveCTypeQualifiers.h @@ -0,0 +1,56 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ +#ifndef CPLUSPLUS_OBJC_TYPEQUALIFIERS_H +#define CPLUSPLUS_OBJC_TYPEQUALIFIERS_H + +#include "CPlusPlusForwardDeclarations.h" + +CPLUSPLUS_BEGIN_HEADER +CPLUSPLUS_BEGIN_NAMESPACE + +enum { + Token_in, + Token_out, + Token_byref, + Token_inout, + Token_bycopy, + Token_oneway, + Token_identifier +}; + +CPLUSPLUS_EXPORT int classifyObjectiveCTypeQualifiers(const char *s, int n); + +CPLUSPLUS_END_NAMESPACE +CPLUSPLUS_END_HEADER + +#endif // CPLUSPLUS_OBJC_TYPEQUALIFIERS_H diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index 572c9f6665..6fb2da600d 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -56,6 +56,7 @@ #include "Control.h" #include "AST.h" #include "Literals.h" +#include "ObjectiveCTypeQualifiers.h" #include <cstdlib> #include <cstring> #include <cassert> @@ -627,22 +628,92 @@ bool Parser::parseTemplateArgumentList(TemplateArgumentListAST *&node) bool Parser::parseAsmDefinition(DeclarationAST *&node) { - if (LA() == T_ASM) { - AsmDefinitionAST *ast = new (_pool) AsmDefinitionAST; - ast->asm_token = consumeToken(); - parseCvQualifiers(ast->cv_qualifier_seq); - if (LA() == T_LPAREN) { - ast->lparen_token = cursor(); - if (skip(T_LPAREN, T_RPAREN)) - ast->rparen_token = consumeToken(); + if (LA() != T_ASM) + return false; + + AsmDefinitionAST *ast = new (_pool) AsmDefinitionAST; + ast->asm_token = consumeToken(); + + if (LA() == T_VOLATILE) + ast->volatile_token = consumeToken(); + + match(T_LPAREN, &ast->lparen_token); + unsigned string_literal_token = 0; + match(T_STRING_LITERAL, &string_literal_token); + while (LA() == T_STRING_LITERAL) { + consumeToken(); + } + if (LA() == T_COLON) { + consumeToken(); // skip T_COLON + parseAsmOperandList(); + if (LA() == T_COLON) { + consumeToken(); + parseAsmOperandList(); + if (LA() == T_COLON) { + consumeToken(); + parseAsmClobberList(); + } + } else if (LA() == T_COLON_COLON) { + consumeToken(); + parseAsmClobberList(); + } + } else if (LA() == T_COLON_COLON) { + consumeToken(); + parseAsmClobberList(); + } + match(T_RPAREN, &ast->rparen_token); + match(T_SEMICOLON, &ast->semicolon_token); + node = ast; + return true; +} + +bool Parser::parseAsmOperandList() +{ + if (parseAsmOperand()) { + while (LA() == T_COMMA) { + consumeToken(); + parseAsmOperand(); } - match(T_SEMICOLON, &ast->semicolon_token); - node = ast; return true; } return false; } +bool Parser::parseAsmOperand() +{ + unsigned string_literal_token = 0; + match(T_STRING_LITERAL, &string_literal_token); + + if (LA() == T_LBRACKET) { + /*unsigned lbracket_token = */ consumeToken(); + match(T_STRING_LITERAL, &string_literal_token); + unsigned rbracket_token = 0; + match(T_RBRACKET, &rbracket_token); + } + + unsigned lparen_token = 0, rparen_token = 0; + match(T_LPAREN, &lparen_token); + ExpressionAST *expression = 0; + parseExpression(expression); + match(T_RPAREN, &rparen_token); + return true; +} + +bool Parser::parseAsmClobberList() +{ + if (LA() != T_STRING_LITERAL) + return false; + + unsigned string_literal_token = consumeToken(); + + while (LA() == T_COMMA) { + consumeToken(); + match(T_STRING_LITERAL, &string_literal_token); + } + + return true; +} + bool Parser::parseTemplateDeclaration(DeclarationAST *&node) { if (! (LA(1) == T_TEMPLATE || ((LA(1) == T_EXPORT || LA(1) == T_EXTERN) @@ -2556,6 +2627,13 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node) case T_SLOT: return parseQtMethod(node); + case T_LBRACKET: + case T_AT_STRING_LITERAL: + case T_AT_ENCODE: + case T_AT_PROTOCOL: + case T_AT_SELECTOR: + return parseObjCExpression(node); + default: { NameAST *name = 0; if (parseNameId(name)) { @@ -2570,6 +2648,151 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node) return false; } +bool Parser::parseObjCExpression(ExpressionAST *&node) +{ + switch (LA()) { + case T_AT_ENCODE: + return parseObjCEncodeExpression(node); + + case T_AT_PROTOCOL: + return parseObjCProtocolExpression(node); + + case T_AT_SELECTOR: + return parseObjCSelectorExpression(node); + + case T_LBRACKET: + return parseObjCMessageExpression(node); + + case T_AT_STRING_LITERAL: + return parseObjCStringLiteral(node); + + default: + break; + } // switch + return false; +} + +bool Parser::parseObjCStringLiteral(ExpressionAST *&node) +{ + if (LA() != T_AT_STRING_LITERAL) + return false; + + StringLiteralAST **ast = reinterpret_cast<StringLiteralAST **> (&node); + + while (LA() == T_AT_STRING_LITERAL) { + *ast = new (_pool) StringLiteralAST; + (*ast)->token = consumeToken(); + ast = &(*ast)->next; + } + return true; +} + +bool Parser::parseObjCEncodeExpression(ExpressionAST *&) +{ + if (LA() != T_AT_ENCODE) + return false; + + /*unsigned encode_token = */ consumeToken(); + parseObjCTypeName(); + return true; +} + +bool Parser::parseObjCProtocolExpression(ExpressionAST *&) +{ + if (LA() != T_AT_PROTOCOL) + return false; + + /*unsigned protocol_token = */ consumeToken(); + unsigned lparen_token = 0, identifier_token = 0, rparen_token = 0; + match(T_LPAREN, &lparen_token); + match(T_IDENTIFIER, &identifier_token); + match(T_RPAREN, &rparen_token); + return true; +} + +bool Parser::parseObjCSelectorExpression(ExpressionAST *&) +{ + if (LA() != T_AT_SELECTOR) + return false; + + /*unsigned selector_token = */consumeToken(); + unsigned lparen_token = 0, rparen_token = 0; + match(T_LPAREN, &lparen_token); + parseObjCMethodSignature(); + match(T_RPAREN, &rparen_token); + return true; +} + +bool Parser::parseObjCMessageExpression(ExpressionAST *&) +{ + if (LA() != T_LBRACKET) + return false; + + /*unsigned lbracket_token = */ consumeToken(); + + parseObjCMessageReceiver(); + parseObjCMessageArguments(); + + unsigned rbracket_token = 0; + match(T_RBRACKET, &rbracket_token); + return true; +} + +bool Parser::parseObjCMessageReceiver() +{ + ExpressionAST *expression = 0; + return parseExpression(expression); +} + +bool Parser::parseObjCMessageArguments() +{ + if (LA() == T_RBRACKET) + return false; // nothing to do. + + unsigned start = cursor(); + + if (parseObjCSelectorArgs()) { + while (parseObjCSelectorArgs()) { + // accept the selector args. + } + } else { + rewind(start); + parseObjCSelector(); + } + + while (LA() == T_COMMA) { + consumeToken(); // skip T_COMMA + ExpressionAST *expression = 0; + parseAssignmentExpression(expression); + } + return true; +} + +bool Parser::parseObjCSelectorArgs() +{ + parseObjCSelector(); + if (LA() != T_COLON) + return false; + + /*unsigned colon_token = */consumeToken(); + + ExpressionAST *expression = 0; + parseAssignmentExpression(expression); + return true; +} + +bool Parser::parseObjCMethodSignature() +{ + if (parseObjCSelector()) { + while (LA() == T_COMMA) { + consumeToken(); // skip T_COMMA + parseObjCSelector(); + } + return true; + } + return false; +} + bool Parser::parseNameId(NameAST *&name) { unsigned start = cursor(); @@ -3522,6 +3745,42 @@ bool Parser::parseObjCImplementation(DeclarationAST *&) } parseObjClassInstanceVariables(); + parseObjCMethodDefinitionList(); + return true; +} + +bool Parser::parseObjCMethodDefinitionList() +{ + while (LA() && LA() != T_AT_END) { + unsigned start = cursor(); + + switch (LA()) { + case T_PLUS: + case T_MINUS: + parseObjCMethodDefinition(); + + if (start == cursor()) + consumeToken(); + break; + + default: + // ### warning message + consumeToken(); + break; + } // switch + } + + return true; +} + +bool Parser::parseObjCMethodDefinition() +{ + if (LA() != T_MINUS && LA() != T_PLUS) + return false; + + parseObjCMethodSignature(); + StatementAST *function_body = 0; + parseFunctionBody(function_body); return true; } @@ -3785,16 +4044,11 @@ bool Parser::parseObjCTypeQualifiers() return false; Identifier *id = tok().identifier; - if (! strcmp("in", id->chars()) || - ! strcmp("out", id->chars()) || - ! strcmp("inout", id->chars()) || - ! strcmp("bycopy", id->chars()) || - ! strcmp("byref", id->chars()) || - ! strcmp("oneway", id->chars())) { - consumeToken(); - return true; - } - return false; + const int k = classifyObjectiveCTypeQualifiers(id->chars(), id->size()); + if (k == Token_identifier) + return false; + consumeToken(); + return true; } // objc-end: T_AT_END diff --git a/src/shared/cplusplus/Parser.h b/src/shared/cplusplus/Parser.h index d99d8d27fc..e6a29d199e 100644 --- a/src/shared/cplusplus/Parser.h +++ b/src/shared/cplusplus/Parser.h @@ -85,6 +85,9 @@ public: bool parseAdditiveExpression(ExpressionAST *&node); bool parseAndExpression(ExpressionAST *&node); bool parseAsmDefinition(DeclarationAST *&node); + bool parseAsmOperandList(); + bool parseAsmOperand(); + bool parseAsmClobberList(); bool parseAssignmentExpression(ExpressionAST *&node); bool parseBaseClause(BaseSpecifierAST *&node); bool parseBaseSpecifier(BaseSpecifierAST *&node); @@ -211,12 +214,25 @@ public: bool parseQtMethod(ExpressionAST *&node); // ObjC++ + bool parseObjCExpression(ExpressionAST *&node); bool parseObjCClassDeclaration(DeclarationAST *&node); bool parseObjCInterface(DeclarationAST *&node, SpecifierAST *attributes = 0); bool parseObjCProtocol(DeclarationAST *&node, SpecifierAST *attributes = 0); + bool parseObjCEncodeExpression(ExpressionAST *&node); + bool parseObjCProtocolExpression(ExpressionAST *&node); + bool parseObjCSelectorExpression(ExpressionAST *&node); + bool parseObjCStringLiteral(ExpressionAST *&node); + bool parseObjCMethodSignature(); + bool parseObjCMessageExpression(ExpressionAST *&node); + bool parseObjCMessageReceiver(); + bool parseObjCMessageArguments(); + bool parseObjCSelectorArgs(); + bool parseObjCMethodDefinitionList(); + bool parseObjCMethodDefinition(); + bool parseObjCProtocolRefs(); bool parseObjClassInstanceVariables(); bool parseObjCInterfaceMemberDeclaration(); diff --git a/src/shared/cplusplus/PrettyPrinter.cpp b/src/shared/cplusplus/PrettyPrinter.cpp index 6acb109dcf..d6c604c3ab 100644 --- a/src/shared/cplusplus/PrettyPrinter.cpp +++ b/src/shared/cplusplus/PrettyPrinter.cpp @@ -101,10 +101,8 @@ bool PrettyPrinter::visit(ArrayInitializerAST *ast) bool PrettyPrinter::visit(AsmDefinitionAST *ast) { out << spell(ast->asm_token); - for (SpecifierAST *it = ast->cv_qualifier_seq; it; it = it->next) { - out << ' '; - accept(it); - } + if (ast->volatile_token) + out << ' ' << spell(ast->volatile_token) << ' '; out << '('; out << "/* ### implement me */"; out << ");"; diff --git a/src/shared/cplusplus/cplusplus.pri b/src/shared/cplusplus/cplusplus.pri index 041aff67be..3a62ed6b7d 100644 --- a/src/shared/cplusplus/cplusplus.pri +++ b/src/shared/cplusplus/cplusplus.pri @@ -36,8 +36,8 @@ HEADERS += \ $$PWD/TranslationUnit.h \ $$PWD/Type.h \ $$PWD/TypeVisitor.h \ - $$PWD/PrettyPrinter.h - + $$PWD/PrettyPrinter.h \ + $$PWD/ObjectiveCTypeQualifiers.h SOURCES += \ $$PWD/AST.cpp \ @@ -55,6 +55,7 @@ SOURCES += \ $$PWD/FullySpecifiedType.cpp \ $$PWD/Keywords.cpp \ $$PWD/ObjectiveCAtKeywords.cpp \ + $$PWD/ObjectiveCTypeQualifiers.cpp \ $$PWD/Lexer.cpp \ $$PWD/LiteralTable.cpp \ $$PWD/Literals.cpp \ diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 28a30f2a03..c54b75a1e2 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -719,6 +719,7 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value) // The following two blocks fix bug 180128 by making all "interesting" // file name absolute in each .pro file, not just the top most one if (varName == QLatin1String("SOURCES") + || varName == QLatin1String("OBJECTIVE_SOURCES") || varName == QLatin1String("HEADERS") || varName == QLatin1String("INTERFACES") || varName == QLatin1String("FORMS") |
