OLD | NEW |
1 // | 1 // |
2 // file: regexcmp.cpp | 2 // file: regexcmp.cpp |
3 // | 3 // |
4 // Copyright (C) 2002-2014 International Business Machines Corporation and othe
rs. | 4 // Copyright (C) 2002-2014 International Business Machines Corporation and othe
rs. |
5 // All Rights Reserved. | 5 // All Rights Reserved. |
6 // | 6 // |
7 // This file contains the ICU regular expression compiler, which is responsible | 7 // This file contains the ICU regular expression compiler, which is responsible |
8 // for processing a regular expression pattern into the compiled form that | 8 // for processing a regular expression pattern into the compiled form that |
9 // is used by the match finding engine. | 9 // is used by the match finding engine. |
10 // | 10 // |
(...skipping 3453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3464 // then multiply the result by the maximum loop count. | 3464 // then multiply the result by the maximum loop count. |
3465 { | 3465 { |
3466 int32_t loopEndLoc = URX_VAL(fRXPat->fCompiledPat->elementAti(l
oc+1)); | 3466 int32_t loopEndLoc = URX_VAL(fRXPat->fCompiledPat->elementAti(l
oc+1)); |
3467 if (loopEndLoc == loc+4) { | 3467 if (loopEndLoc == loc+4) { |
3468 // Loop has an empty body. No affect on max match length. | 3468 // Loop has an empty body. No affect on max match length. |
3469 // Continue processing with code after the loop end. | 3469 // Continue processing with code after the loop end. |
3470 loc = loopEndLoc; | 3470 loc = loopEndLoc; |
3471 break; | 3471 break; |
3472 } | 3472 } |
3473 | 3473 |
3474 int32_t maxLoopCount = fRXPat->fCompiledPat->elementAti(loc+3); | 3474 int32_t maxLoopCount = static_cast<int32_t>(fRXPat->fCompiledPat
->elementAti(loc+3)); |
3475 if (maxLoopCount == -1) { | 3475 if (maxLoopCount == -1) { |
3476 // Unbounded Loop. No upper bound on match length. | 3476 // Unbounded Loop. No upper bound on match length. |
3477 currentLen = INT32_MAX; | 3477 currentLen = INT32_MAX; |
3478 break; | 3478 break; |
3479 } | 3479 } |
3480 | 3480 |
3481 U_ASSERT(loopEndLoc >= loc+4); | 3481 U_ASSERT(loopEndLoc >= loc+4); |
3482 int32_t blockLen = maxMatchLength(loc+4, loopEndLoc-1); // Rec
ursive call. | 3482 int32_t blockLen = maxMatchLength(loc+4, loopEndLoc-1); // Rec
ursive call. |
3483 if (blockLen == INT32_MAX) { | 3483 if (blockLen == INT32_MAX) { |
3484 currentLen = blockLen; | 3484 currentLen = blockLen; |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4449 | 4449 |
4450 void RegexCompile::setPushOp(int32_t op) { | 4450 void RegexCompile::setPushOp(int32_t op) { |
4451 setEval(op); | 4451 setEval(op); |
4452 fSetOpStack.push(op, *fStatus); | 4452 fSetOpStack.push(op, *fStatus); |
4453 fSetStack.push(new UnicodeSet(), *fStatus); | 4453 fSetStack.push(new UnicodeSet(), *fStatus); |
4454 } | 4454 } |
4455 | 4455 |
4456 U_NAMESPACE_END | 4456 U_NAMESPACE_END |
4457 #endif // !UCONFIG_NO_REGULAR_EXPRESSIONS | 4457 #endif // !UCONFIG_NO_REGULAR_EXPRESSIONS |
4458 | 4458 |
OLD | NEW |