Changeset 846 for trunk/tools/linguist/lupdate/java.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/tools/linguist/lupdate/java.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 51 51 #include <QtCore/QString> 52 52 #include <QtCore/QTextCodec> 53 #include <QtCore/QCoreApplication> 54 55 #include <iostream> 53 56 54 57 #include <ctype.h> 55 58 56 59 QT_BEGIN_NAMESPACE 60 61 class LU { 62 Q_DECLARE_TR_FUNCTIONS(LUpdate) 63 }; 57 64 58 65 enum { Tok_Eof, Tok_class, Tok_return, Tok_tr, … … 107 114 static QStack<Scope*> yyScope; 108 115 static QString yyDefaultContext; 116 117 std::ostream &yyMsg(int line = 0) 118 { 119 return std::cerr << qPrintable(yyFileName) << ':' << (line ? line : yyLineNo) << ": "; 120 } 109 121 110 122 static QChar getChar() … … 190 202 yyCh = getChar(); 191 203 if ( yyCh == EOF ) { 192 qFatal( "%s: Unterminated Java comment starting at" 193 " line %d\n", 194 qPrintable(yyFileName), yyLineNo ); 195 204 yyMsg() << qPrintable(LU::tr("Unterminated Java comment.\n")); 196 205 return Tok_Comment; 197 206 } … … 229 238 int sub(yyCh.toLower().toAscii() - 87); 230 239 if( sub > 15 || sub < 10) { 231 qFatal( "%s:%d: Invalid Unicode",232 qPrintable(yyFileName), yyLineNo );240 yyMsg() << qPrintable(LU::tr("Invalid Unicode value.\n")); 241 break; 233 242 } 234 243 unicode += sub; … … 252 261 253 262 if ( yyCh != QLatin1Char('"') ) 254 qFatal( "%s:%d: Unterminated string", 255 qPrintable(yyFileName), yyLineNo ); 263 yyMsg() << qPrintable(LU::tr("Unterminated string.\n")); 256 264 257 265 yyCh = getChar(); … … 366 374 s += yyString; 367 375 else { 368 qWarning( "%s:%d: String used in translation can only contain strings"369 " concatenated with other strings, not expressions or numbers.",370 qPrintable(yyFileName), yyLineNo);376 yyMsg() << qPrintable(LU::tr( 377 "String used in translation can contain only literals" 378 " concatenated with other literals, not expressions or numbers.\n")); 371 379 return false; 372 380 } … … 476 484 } 477 485 else { 478 qFatal( "%s:%d: Class must be followed by a classname",479 qPrintable(yyFileName), yyLineNo );486 yyMsg() << qPrintable(LU::tr("'class' must be followed by a class name.\n")); 487 break; 480 488 } 481 489 while (!match(Tok_LeftBrace)) { … … 548 556 case Tok_RightBrace: 549 557 if ( yyScope.isEmpty() ) { 550 qFatal( "%s:%d: Unbalanced right brace in Java code\n", 551 qPrintable(yyFileName), yyLineNo ); 558 yyMsg() << qPrintable(LU::tr("Excess closing brace.\n")); 552 559 } 553 560 else … … 578 585 break; 579 586 default: 580 qFatal( "%s:%d: Package keyword should be followed by com.package.name;", 581 qPrintable(yyFileName), yyLineNo ); 587 yyMsg() << qPrintable(LU::tr("'package' must be followed by package name.\n")); 582 588 break; 583 589 } … … 592 598 593 599 if ( !yyScope.isEmpty() ) 594 qFatal( "%s:%d: Unbalanced braces in Java code\n", 595 qPrintable(yyFileName), yyScope.top()->line ); 600 yyMsg(yyScope.top()->line) << qPrintable(LU::tr("Unbalanced opening brace.\n")); 596 601 else if ( yyParenDepth != 0 ) 597 qFatal( "%s:%d: Unbalanced parentheses in Java code\n", 598 qPrintable(yyFileName), yyParenLineNo ); 602 yyMsg(yyParenLineNo) << qPrintable(LU::tr("Unbalanced opening parenthesis.\n")); 599 603 } 600 604 … … 604 608 QFile file(filename); 605 609 if (!file.open(QIODevice::ReadOnly)) { 606 cd.appendError(QString::fromLatin1("Cannot open %1: %2") 607 .arg(filename, file.errorString())); 610 cd.appendError(LU::tr("Cannot open %1: %2").arg(filename, file.errorString())); 608 611 return false; 609 612 }
Note:
See TracChangeset
for help on using the changeset viewer.