1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
37 using namespace CPlusPlus;
39 static inline int classify3(const char *s) {
47 else if (s[0] == 't') {
57 static inline int classify4(const char *s) {
70 static inline int classify5(const char *s) {
81 else if (s[1] == 'l') {
91 else if (s[0] == 't') {
105 static inline int classify6(const char *s) {
119 else if (s[0] == 'p') {
135 static inline int classify7(const char *s) {
151 else if (s[0] == 'f') {
166 else if (s[0] == 'p') {
180 else if (s[1] == 'r') {
197 static inline int classify8(const char *s) {
206 return T_AT_OPTIONAL;
215 else if (s[0] == 'p') {
223 return T_AT_PROPERTY;
229 else if (s[3] == 't') {
234 return T_AT_PROTOCOL;
243 else if (s[0] == 'r') {
251 return T_AT_REQUIRED;
260 else if (s[0] == 's') {
268 return T_AT_SELECTOR;
280 static inline int classify9(const char *s) {
290 return T_AT_INTERFACE;
300 else if (s[0] == 'p') {
309 return T_AT_PROTECTED;
322 static inline int classify10(const char *s) {
333 return T_AT_SYNTHESIZE;
347 static inline int classify11(const char *s) {
359 return T_AT_NOT_KEYWORD;
374 static inline int classify12(const char *s) {
387 return T_AT_SYNCHRONIZED;
403 static inline int classify14(const char *s) {
418 return T_AT_IMPLEMENTATION;
436 static inline int classify19(const char *s) {
456 return T_AT_COMPATIBILITY_ALIAS;
479 int Lexer::classifyObjCAtKeyword(const char *s, int n) {
481 case 3: return classify3(s);
482 case 4: return classify4(s);
483 case 5: return classify5(s);
484 case 6: return classify6(s);
485 case 7: return classify7(s);
486 case 8: return classify8(s);
487 case 9: return classify9(s);
488 case 10: return classify10(s);
489 case 11: return classify11(s);
490 case 12: return classify12(s);
491 case 14: return classify14(s);
492 case 19: return classify19(s);
493 default: return T_ERROR;