| 162 | } |
| 163 | |
| 164 | static Token getToken() |
| 165 | { |
| 166 | yyIdent.clear(); |
| 167 | yyComment.clear(); |
| 168 | yyString.clear(); |
| 169 | |
| 170 | while (yyCh != EOF) { |
| 171 | yyLineNo = yyCurLineNo; |
| 172 | |
| 173 | if (isalpha(yyCh) || yyCh == '_') { |
| 174 | do { |
| 175 | yyIdent += yyCh; |
| 176 | yyCh = getChar(); |
| 177 | } while (isalnum(yyCh) || yyCh == '_'); |
| 178 | |
| 179 | //qDebug() << "IDENT: " << yyIdent; |
| 180 | |
| 181 | switch (yyIdent.at(0).unicode()) { |
| 182 | case 'Q': |
| 183 | if (yyIdent == QLatin1String("Q_OBJECT")) |
| 184 | return Tok_Q_OBJECT; |
| 185 | if (yyIdent == QLatin1String("Q_DECLARE_TR_FUNCTIONS")) |
| 186 | return Tok_Q_DECLARE_TR_FUNCTIONS; |
| 187 | if (yyIdent == QLatin1String("QT_TR_NOOP")) |
| 188 | return Tok_tr; |
| 189 | if (yyIdent == QLatin1String("QT_TRANSLATE_NOOP")) |
| 190 | return Tok_translate; |
| 191 | if (yyIdent == QLatin1String("QT_TRANSLATE_NOOP3")) |
| 192 | return Tok_translate; |
| 193 | if (yyIdent == QLatin1String("QT_TR_NOOP_UTF8")) |
| 194 | return Tok_trUtf8; |
| 195 | if (yyIdent == QLatin1String("QT_TRANSLATE_NOOP_UTF8")) |
| 196 | return Tok_translateUtf8; |
| 197 | if (yyIdent == QLatin1String("QT_TRANSLATE_NOOP3_UTF8")) |
| 198 | return Tok_translateUtf8; |
| 199 | if (yyIdent == QLatin1String("QT_NT")) |
| 200 | return Tok_notranslate; |
| 201 | if (yyIdent == QLatin1String("QString_NT")) |
| 202 | return Tok_notranslate; |
| 203 | break; |
| 204 | case 'T': |
| 205 | // TR() for when all else fails |
| 206 | if (yyIdent.compare(QLatin1String("TR"), Qt::CaseInsensitive) == 0) { |
| 207 | return Tok_tr; |
| 208 | } |
| 209 | break; |
| 210 | case 'c': |
| 211 | if (yyIdent == QLatin1String("class")) |
| 212 | return Tok_class; |
| 213 | break; |
| 214 | case 'f': |
| 215 | /* |
| 216 | QTranslator::findMessage() has the same parameters as |
| 217 | QApplication::translate(). |
| 218 | */ |
| 219 | if (yyIdent == QLatin1String("findMessage")) |
| 220 | return Tok_translate; |
| 221 | break; |
no test coverage detected