Diffstat (limited to 'development/translation/opie-lupdate/fetchtr.cpp') (more/less context) (show 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 | |||
@@ -9,8 +9,14 @@ | |||
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | ||
12 | ** licenses may use this file in accordance with the Qt Commercial License | ||
13 | ** Agreement provided with the Software. | ||
14 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 15 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 16 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 17 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 18 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
19 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
20 | ** information about Qt Commercial License Agreements. | ||
15 | ** | 21 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 22 | ** Contact info@trolltech.com if any conditions of this licensing are |
@@ -81,8 +87,11 @@ static char yyString[16384]; | |||
81 | static size_t yyStringLen; | 87 | static size_t yyStringLen; |
82 | static QValueStack<int> yySavedBraceDepth; | 88 | static QValueStack<int> yySavedBraceDepth; |
89 | static QValueStack<int> yySavedParenDepth; | ||
83 | static int yyBraceDepth; | 90 | static int yyBraceDepth; |
84 | static int yyParenDepth; | 91 | static int yyParenDepth; |
85 | static int yyLineNo; | 92 | static int yyLineNo; |
86 | static int yyCurLineNo; | 93 | static int yyCurLineNo; |
94 | static int yyBraceLineNo; | ||
95 | static int yyParenLineNo; | ||
87 | 96 | ||
88 | // the file to read from (if reading from a file) | 97 | // the file to read from (if reading from a file) |
@@ -120,7 +129,10 @@ static void startTokenizer( const char *fileName, int (*getCharFunc)() ) | |||
120 | yyCh = getChar(); | 129 | yyCh = getChar(); |
121 | yySavedBraceDepth.clear(); | 130 | yySavedBraceDepth.clear(); |
131 | yySavedParenDepth.clear(); | ||
122 | yyBraceDepth = 0; | 132 | yyBraceDepth = 0; |
123 | yyParenDepth = 0; | 133 | yyParenDepth = 0; |
124 | yyCurLineNo = 1; | 134 | yyCurLineNo = 1; |
135 | yyBraceLineNo = 1; | ||
136 | yyParenLineNo = 1; | ||
125 | } | 137 | } |
126 | 138 | ||
@@ -165,4 +177,17 @@ static int getToken() | |||
165 | return Tok_class; | 177 | return Tok_class; |
166 | break; | 178 | break; |
179 | case 'f': | ||
180 | /* | ||
181 | QTranslator::findMessage() has the same parameters as | ||
182 | QApplication::translate(). | ||
183 | */ | ||
184 | if ( strcmp(yyIdent + 1, "indMessage") == 0 ) | ||
185 | return Tok_translate; | ||
186 | break; | ||
187 | case 'i': | ||
188 | /* FOR KDE APPS */ | ||
189 | if ( strcmp( yyIdent + 1, "8n") == 0 ) | ||
190 | return Tok_translate; | ||
191 | break; | ||
167 | case 'n': | 192 | case 'n': |
168 | if ( strcmp(yyIdent + 1, "amespace") == 0 ) | 193 | if ( strcmp(yyIdent + 1, "amespace") == 0 ) |
@@ -177,7 +202,4 @@ static int getToken() | |||
177 | return Tok_class; | 202 | return Tok_class; |
178 | break; | 203 | break; |
179 | case 'i': | ||
180 | if( strcmp(yyIdent + 1, "18n") == 0 ) | ||
181 | return Tok_tr; | ||
182 | case 't': | 204 | case 't': |
183 | if ( strcmp(yyIdent + 1, "r") == 0 ) { | 205 | if ( strcmp(yyIdent + 1, "r") == 0 ) { |
@@ -223,4 +245,5 @@ static int getToken() | |||
223 | // if, ifdef, ifndef | 245 | // if, ifdef, ifndef |
224 | yySavedBraceDepth.push( yyBraceDepth ); | 246 | yySavedBraceDepth.push( yyBraceDepth ); |
247 | yySavedParenDepth.push( yyParenDepth ); | ||
225 | } | 248 | } |
226 | break; | 249 | break; |
@@ -229,10 +252,14 @@ static int getToken() | |||
229 | if ( yyCh == 'l' ) { | 252 | if ( yyCh == 'l' ) { |
230 | // elif, else | 253 | // elif, else |
231 | if ( !yySavedBraceDepth.isEmpty() ) | 254 | if ( !yySavedBraceDepth.isEmpty() ) { |
232 | yyBraceDepth = yySavedBraceDepth.top(); | 255 | yyBraceDepth = yySavedBraceDepth.top(); |
256 | yyParenDepth = yySavedParenDepth.top(); | ||
257 | } | ||
233 | } else if ( yyCh == 'n' ) { | 258 | } else if ( yyCh == 'n' ) { |
234 | // endif | 259 | // endif |
235 | if ( !yySavedBraceDepth.isEmpty() ) | 260 | if ( !yySavedBraceDepth.isEmpty() ) { |
236 | yySavedBraceDepth.pop(); | 261 | yySavedBraceDepth.pop(); |
262 | yySavedParenDepth.pop(); | ||
263 | } | ||
237 | } | 264 | } |
238 | } | 265 | } |
@@ -357,16 +384,24 @@ static int getToken() | |||
357 | break; | 384 | break; |
358 | case '{': | 385 | case '{': |
386 | if (yyBraceDepth == 0) | ||
387 | yyBraceLineNo = yyCurLineNo; | ||
359 | yyBraceDepth++; | 388 | yyBraceDepth++; |
360 | yyCh = getChar(); | 389 | yyCh = getChar(); |
361 | return Tok_LeftBrace; | 390 | return Tok_LeftBrace; |
362 | case '}': | 391 | case '}': |
392 | if (yyBraceDepth == 0) | ||
393 | yyBraceLineNo = yyCurLineNo; | ||
363 | yyBraceDepth--; | 394 | yyBraceDepth--; |
364 | yyCh = getChar(); | 395 | yyCh = getChar(); |
365 | return Tok_RightBrace; | 396 | return Tok_RightBrace; |
366 | case '(': | 397 | case '(': |
398 | if (yyParenDepth == 0) | ||
399 | yyParenLineNo = yyCurLineNo; | ||
367 | yyParenDepth++; | 400 | yyParenDepth++; |
368 | yyCh = getChar(); | 401 | yyCh = getChar(); |
369 | return Tok_LeftParen; | 402 | return Tok_LeftParen; |
370 | case ')': | 403 | case ')': |
404 | if (yyParenDepth == 0) | ||
405 | yyParenLineNo = yyCurLineNo; | ||
371 | yyParenDepth--; | 406 | yyParenDepth--; |
372 | yyCh = getChar(); | 407 | yyCh = getChar(); |
@@ -622,12 +657,12 @@ static void parse( MetaTranslator *tor, const char *initialContext, | |||
622 | if ( yyBraceDepth != 0 ) | 657 | if ( yyBraceDepth != 0 ) |
623 | fprintf( stderr, | 658 | fprintf( stderr, |
624 | "%s: Unbalanced braces in C++ code (or abuse of the C++" | 659 | "%s:%d: Unbalanced braces in C++ code (or abuse of the C++" |
625 | " preprocessor)\n", | 660 | " preprocessor)\n", |
626 | (const char *) yyFileName ); | 661 | (const char *)yyFileName, yyBraceLineNo ); |
627 | if ( yyParenDepth != 0 ) | 662 | else if ( yyParenDepth != 0 ) |
628 | fprintf( stderr, | 663 | fprintf( stderr, |
629 | "%s: Unbalanced parentheses in C++ code (or abuse of the C++" | 664 | "%s:%d: Unbalanced parentheses in C++ code (or abuse of the C++" |
630 | " preprocessor)\n", | 665 | " preprocessor)\n", |
631 | (const char *) yyFileName ); | 666 | (const char *)yyFileName, yyParenLineNo ); |
632 | } | 667 | } |
633 | 668 | ||