Diffstat (limited to 'development/translation/opie-lupdate/fetchtr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | development/translation/opie-lupdate/fetchtr.cpp | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/development/translation/opie-lupdate/fetchtr.cpp b/development/translation/opie-lupdate/fetchtr.cpp index d1f5881..a137628 100644 --- a/development/translation/opie-lupdate/fetchtr.cpp +++ b/development/translation/opie-lupdate/fetchtr.cpp @@ -10,2 +10,6 @@ ** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE @@ -14,2 +18,4 @@ ** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. ** @@ -82,2 +88,3 @@ static size_t yyStringLen; static QValueStack<int> yySavedBraceDepth; +static QValueStack<int> yySavedParenDepth; static int yyBraceDepth; @@ -86,2 +93,4 @@ static int yyLineNo; static int yyCurLineNo; +static int yyBraceLineNo; +static int yyParenLineNo; @@ -121,2 +130,3 @@ static void startTokenizer( const char *fileName, int (*getCharFunc)() ) yySavedBraceDepth.clear(); + yySavedParenDepth.clear(); yyBraceDepth = 0; @@ -124,2 +134,4 @@ static void startTokenizer( const char *fileName, int (*getCharFunc)() ) yyCurLineNo = 1; + yyBraceLineNo = 1; + yyParenLineNo = 1; } @@ -166,2 +178,15 @@ static int getToken() break; + case 'f': + /* + QTranslator::findMessage() has the same parameters as + QApplication::translate(). + */ + if ( strcmp(yyIdent + 1, "indMessage") == 0 ) + return Tok_translate; + break; + case 'i': + /* FOR KDE APPS */ + if ( strcmp( yyIdent + 1, "8n") == 0 ) + return Tok_translate; + break; case 'n': @@ -178,5 +203,2 @@ static int getToken() break; - case 'i': - if( strcmp(yyIdent + 1, "18n") == 0 ) - return Tok_tr; case 't': @@ -224,2 +246,3 @@ static int getToken() yySavedBraceDepth.push( yyBraceDepth ); + yySavedParenDepth.push( yyParenDepth ); } @@ -230,8 +253,12 @@ static int getToken() // elif, else - if ( !yySavedBraceDepth.isEmpty() ) + if ( !yySavedBraceDepth.isEmpty() ) { yyBraceDepth = yySavedBraceDepth.top(); + yyParenDepth = yySavedParenDepth.top(); + } } else if ( yyCh == 'n' ) { // endif - if ( !yySavedBraceDepth.isEmpty() ) + if ( !yySavedBraceDepth.isEmpty() ) { yySavedBraceDepth.pop(); + yySavedParenDepth.pop(); + } } @@ -358,2 +385,4 @@ static int getToken() case '{': + if (yyBraceDepth == 0) + yyBraceLineNo = yyCurLineNo; yyBraceDepth++; @@ -362,2 +391,4 @@ static int getToken() case '}': + if (yyBraceDepth == 0) + yyBraceLineNo = yyCurLineNo; yyBraceDepth--; @@ -366,2 +397,4 @@ static int getToken() case '(': + if (yyParenDepth == 0) + yyParenLineNo = yyCurLineNo; yyParenDepth++; @@ -370,2 +403,4 @@ static int getToken() case ')': + if (yyParenDepth == 0) + yyParenLineNo = yyCurLineNo; yyParenDepth--; @@ -623,10 +658,10 @@ static void parse( MetaTranslator *tor, const char *initialContext, fprintf( stderr, - "%s: Unbalanced braces in C++ code (or abuse of the C++" + "%s:%d: Unbalanced braces in C++ code (or abuse of the C++" " preprocessor)\n", - (const char *) yyFileName ); - if ( yyParenDepth != 0 ) + (const char *)yyFileName, yyBraceLineNo ); + else if ( yyParenDepth != 0 ) fprintf( stderr, - "%s: Unbalanced parentheses in C++ code (or abuse of the C++" + "%s:%d: Unbalanced parentheses in C++ code (or abuse of the C++" " preprocessor)\n", - (const char *) yyFileName ); + (const char *)yyFileName, yyParenLineNo ); } |