Ignore:
Timestamp:
Jun 14, 2008, 11:23:50 PM (17 years ago)
Author:
Darin Adler
Message:

2008-06-14 Darin Adler <Darin Adler>

Rubber stamped by Sam.

  • rename a bunch of local symbols within the regular expression code to follow our usual coding style, and do a few other name tweaks
  • pcre/pcre_compile.cpp: (CompileData::CompileData): (checkEscape): (readRepeatCounts): (compileBranch): (compileBracket): (calculateCompiledPatternLength): (returnError): (jsRegExpCompile):
  • pcre/pcre_exec.cpp: (MatchStack::MatchStack): (MatchStack::canUseStackBufferForNextFrame): (MatchStack::popCurrentFrame): (match): (tryFirstByteOptimization): (tryRequiredByteOptimization): (jsRegExpExecute):
  • pcre/pcre_internal.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/pcre/pcre_compile.cpp

    r31454 r34560  
    136136struct CompileData {
    137137    CompileData() {
    138         top_backref = 0;
     138        topBackref = 0;
    139139        backrefMap = 0;
    140         req_varyopt = 0;
     140        reqVaryOpt = 0;
    141141        needOuterBracket = false;
    142142        numCapturingBrackets = 0;
    143143    }
    144     int top_backref;            /* Maximum back reference */
     144    int topBackref;            /* Maximum back reference */
    145145    unsigned backrefMap;       /* Bitmap of low back refs */
    146     int req_varyopt;            /* "After variable item" flag for reqbyte */
     146    int reqVaryOpt;            /* "After variable item" flag for reqByte */
    147147    bool needOuterBracket;
    148148    int numCapturingBrackets;
     
    167167
    168168Arguments:
    169   ptrptr         points to the pattern position pointer
    170   errorcodeptr   points to the errorcode variable
     169  ptrPtr         points to the pattern position pointer
     170  errorCodePtr   points to the errorcode variable
    171171  bracount       number of previous extracting brackets
    172172  options        the options bits
    173   isclass        true if inside a character class
     173  isClass        true if inside a character class
    174174
    175175Returns:         zero or positive => a data character
    176176                 negative => a special escape sequence
    177                  on error, errorptr is set
     177                 on error, errorPtr is set
    178178*/
    179179
    180 static int checkEscape(const UChar** ptrptr, const UChar* patternEnd, ErrorCode* errorcodeptr, int bracount, bool isclass)
     180static int checkEscape(const UChar** ptrPtr, const UChar* patternEnd, ErrorCode* errorCodePtr, int bracount, bool isClass)
    181181{
    182     const UChar* ptr = *ptrptr + 1;
     182    const UChar* ptr = *ptrPtr + 1;
    183183
    184184    /* If backslash is at the end of the pattern, it's an error. */
    185185    if (ptr == patternEnd) {
    186         *errorcodeptr = ERR1;
    187         *ptrptr = ptr;
     186        *errorCodePtr = ERR1;
     187        *ptrPtr = ptr;
    188188        return 0;
    189189    }
     
    198198    } else if (int escapeValue = escapes[c - '0']) {
    199199        c = escapeValue;
    200         if (isclass) {
     200        if (isClass) {
    201201            if (-c == ESC_b)
    202202                c = '\b'; /* \b is backslash in a class */
     
    222222                 or when we overflow 0-255, whichever comes first. */
    223223               
    224                 if (!isclass) {
     224                if (!isClass) {
    225225                    const UChar* oldptr = ptr;
    226226                    c -= '0';
     
    296296            case 'c':
    297297                if (++ptr == patternEnd) {
    298                     *errorcodeptr = ERR2;
     298                    *errorCodePtr = ERR2;
    299299                    return 0;
    300300                }
     
    308308    }
    309309   
    310     *ptrptr = ptr;
     310    *ptrPtr = ptr;
    311311    return c;
    312312}
     
    364364  maxp           pointer to int for max
    365365                 returned as -1 if no max
    366   errorcodeptr   points to error code variable
     366  errorCodePtr   points to error code variable
    367367
    368368Returns:         pointer to '}' on success;
    369                  current ptr on error, with errorcodeptr set non-zero
     369                 current ptr on error, with errorCodePtr set non-zero
    370370*/
    371371
    372 static const UChar* readRepeatCounts(const UChar* p, int* minp, int* maxp, ErrorCode* errorcodeptr)
     372static const UChar* readRepeatCounts(const UChar* p, int* minp, int* maxp, ErrorCode* errorCodePtr)
    373373{
    374374    int min = 0;
     
    381381        min = min * 10 + *p++ - '0';
    382382    if (min < 0 || min > 65535) {
    383         *errorcodeptr = ERR5;
     383        *errorCodePtr = ERR5;
    384384        return p;
    385385    }
     
    396396                max = max * 10 + *p++ - '0';
    397397            if (max < 0 || max > 65535) {
    398                 *errorcodeptr = ERR5;
     398                *errorCodePtr = ERR5;
    399399                return p;
    400400            }
    401401            if (max < min) {
    402                 *errorcodeptr = ERR4;
     402                *errorCodePtr = ERR4;
    403403                return p;
    404404            }
     
    538538  options        the option bits
    539539  brackets       points to number of extracting brackets used
    540   codeptr        points to the pointer to the current code point
    541   ptrptr         points to the current pattern pointer
    542   errorcodeptr   points to error code variable
     540  codePtr        points to the pointer to the current code point
     541  ptrPtr         points to the current pattern pointer
     542  errorCodePtr   points to error code variable
    543543  firstbyteptr   set to initial literal character, or < 0 (REQ_UNSET, REQ_NONE)
    544544  reqbyteptr     set to the last literal character required, else < 0
     
    546546
    547547Returns:         true on success
    548                  false, with *errorcodeptr set non-zero on error
     548                 false, with *errorCodePtr set non-zero on error
    549549*/
    550550
     
    555555
    556556static bool
    557 compileBranch(int options, int* brackets, unsigned char** codeptr,
    558                const UChar** ptrptr, const UChar* patternEnd, ErrorCode* errorcodeptr, int *firstbyteptr,
     557compileBranch(int options, int* brackets, unsigned char** codePtr,
     558               const UChar** ptrPtr, const UChar* patternEnd, ErrorCode* errorCodePtr, int *firstbyteptr,
    559559               int* reqbyteptr, CompileData& cd)
    560560{
    561     int repeat_type, op_type;
    562     int repeat_min = 0, repeat_max = 0;      /* To please picky compilers */
     561    int repeatType, opType;
     562    int repeatMin = 0, repeat_max = 0;      /* To please picky compilers */
    563563    int bravalue = 0;
    564564    int reqvary, tempreqvary;
    565565    int c;
    566     unsigned char* code = *codeptr;
     566    unsigned char* code = *codePtr;
    567567    unsigned char* tempcode;
    568     bool groupsetfirstbyte = false;
    569     const UChar* ptr = *ptrptr;
     568    bool didGroupSetFirstByte = false;
     569    const UChar* ptr = *ptrPtr;
    570570    const UChar* tempptr;
    571571    unsigned char* previous = NULL;
     
    578578    /* Initialize no first byte, no required byte. REQ_UNSET means "no char
    579579     matching encountered yet". It gets changed to REQ_NONE if we hit something that
    580      matches a non-fixed char first char; reqbyte just remains unset if we never
     580     matches a non-fixed char first char; reqByte just remains unset if we never
    581581     find one.
    582582     
    583583     When we hit a repeat whose minimum is zero, we may have to adjust these values
    584584     to take the zero repeat into account. This is implemented by setting them to
    585      zerofirstbyte and zeroreqbyte when such a repeat is encountered. The individual
     585     zeroFirstByte and zeroReqByte when such a repeat is encountered. The individual
    586586     item types that can be repeated set these backoff variables appropriately. */
    587587   
    588     int firstbyte = REQ_UNSET;
    589     int reqbyte = REQ_UNSET;
    590     int zeroreqbyte = REQ_UNSET;
    591     int zerofirstbyte = REQ_UNSET;
    592    
    593     /* The variable req_caseopt contains either the REQ_IGNORE_CASE value or zero,
     588    int firstByte = REQ_UNSET;
     589    int reqByte = REQ_UNSET;
     590    int zeroReqByte = REQ_UNSET;
     591    int zeroFirstByte = REQ_UNSET;
     592   
     593    /* The variable reqCaseOpt contains either the REQ_IGNORE_CASE value or zero,
    594594     according to the current setting of the ignores-case flag. REQ_IGNORE_CASE is a bit
    595      value > 255. It is added into the firstbyte or reqbyte variables to record the
     595     value > 255. It is added into the firstByte or reqByte variables to record the
    596596     case status of the value. This is used only for ASCII characters. */
    597597   
    598     int req_caseopt = (options & IgnoreCaseOption) ? REQ_IGNORE_CASE : 0;
     598    int reqCaseOpt = (options & IgnoreCaseOption) ? REQ_IGNORE_CASE : 0;
    599599   
    600600    /* Switch on next character until the end of the branch */
    601601   
    602602    for (;; ptr++) {
    603         bool negate_class;
    604         bool should_flip_negation; /* If a negative special such as \S is used, we should negate the whole class to properly support Unicode. */
    605         int class_charcount;
    606         int class_lastchar;
    607         int skipbytes;
    608         int subreqbyte;
    609         int subfirstbyte;
    610         int mclength;
     603        bool negateClass;
     604        bool shouldFlipNegation; /* If a negative special such as \S is used, we should negate the whole class to properly support Unicode. */
     605        int classCharCount;
     606        int classLastChar;
     607        int skipBytes;
     608        int subReqByte;
     609        int subFirstByte;
     610        int mcLength;
    611611        unsigned char mcbuffer[8];
    612612       
     
    618618         a quantifier. */
    619619       
    620         bool is_quantifier = c == '*' || c == '+' || c == '?' || (c == '{' && isCountedRepeat(ptr + 1, patternEnd));
     620        bool isQuantifier = c == '*' || c == '+' || c == '?' || (c == '{' && isCountedRepeat(ptr + 1, patternEnd));
    621621       
    622622        switch (c) {
     
    629629            case '|':
    630630            case ')':
    631                 *firstbyteptr = firstbyte;
    632                 *reqbyteptr = reqbyte;
    633                 *codeptr = code;
    634                 *ptrptr = ptr;
     631                *firstbyteptr = firstByte;
     632                *reqbyteptr = reqByte;
     633                *codePtr = code;
     634                *ptrPtr = ptr;
    635635                return true;
    636636               
     
    640640            case '^':
    641641                if (options & MatchAcrossMultipleLinesOption) {
    642                     if (firstbyte == REQ_UNSET)
    643                         firstbyte = REQ_NONE;
     642                    if (firstByte == REQ_UNSET)
     643                        firstByte = REQ_NONE;
    644644                    *code++ = OP_BOL;
    645645                } else
     
    657657
    658658            /* There can never be a first char if '.' is first, whatever happens about
    659              repeats. The value of reqbyte doesn't change either. */
     659             repeats. The value of reqByte doesn't change either. */
    660660
    661661            case '.':
    662                 if (firstbyte == REQ_UNSET)
    663                     firstbyte = REQ_NONE;
    664                 zerofirstbyte = firstbyte;
    665                 zeroreqbyte = reqbyte;
     662                if (firstByte == REQ_UNSET)
     663                    firstByte = REQ_NONE;
     664                zeroFirstByte = firstByte;
     665                zeroReqByte = reqByte;
    666666                previous = code;
    667667                *code++ = OP_NOT_NEWLINE;
     
    682682            case '[': {
    683683                previous = code;
    684                 should_flip_negation = false;
     684                shouldFlipNegation = false;
    685685               
    686686                /* PCRE supports POSIX class stuff inside a class. Perl gives an error if
     
    690690
    691691                if (ptr + 1 >= patternEnd) {
    692                     *errorcodeptr = ERR6;
     692                    *errorCodePtr = ERR6;
    693693                    return false;
    694694                }
    695695
    696696                if (ptr[1] == '^') {
    697                     negate_class = true;
     697                    negateClass = true;
    698698                    ++ptr;
    699699                } else
    700                     negate_class = false;
     700                    negateClass = false;
    701701               
    702702                /* Keep a count of chars with values < 256 so that we can optimize the case
     
    704704                 characters, we don't yet do any optimization. */
    705705               
    706                 class_charcount = 0;
    707                 class_lastchar = -1;
     706                classCharCount = 0;
     707                classLastChar = -1;
    708708               
    709709                class_utf8 = false;                       /* No chars >= 256 */
     
    729729                     it marks a word boundary. Other escapes have preset maps ready to
    730730                     or into the one we are building. We assume they have more than one
    731                      character in them, so set class_charcount bigger than one. */
     731                     character in them, so set classCharCount bigger than one. */
    732732                   
    733733                    if (c == '\\') {
    734                         c = checkEscape(&ptr, patternEnd, errorcodeptr, cd.numCapturingBrackets, true);
     734                        c = checkEscape(&ptr, patternEnd, errorCodePtr, cd.numCapturingBrackets, true);
    735735                        if (c < 0) {
    736                             class_charcount += 2;     /* Greater than 1 is what matters */
     736                            classCharCount += 2;     /* Greater than 1 is what matters */
    737737                            switch (-c) {
    738738                                case ESC_d:
     
    742742                                   
    743743                                case ESC_D:
    744                                     should_flip_negation = true;
     744                                    shouldFlipNegation = true;
    745745                                    for (c = 0; c < 32; c++)
    746746                                        classbits[c] |= ~classBitmapForChar(c + cbit_digit);
     
    753753                                   
    754754                                case ESC_W:
    755                                     should_flip_negation = true;
     755                                    shouldFlipNegation = true;
    756756                                    for (c = 0; c < 32; c++)
    757757                                        classbits[c] |= ~classBitmapForChar(c + cbit_word);
     
    764764                                   
    765765                                case ESC_S:
    766                                     should_flip_negation = true;
     766                                    shouldFlipNegation = true;
    767767                                    for (c = 0; c < 32; c++)
    768768                                         classbits[c] |= ~classBitmapForChar(c + cbit_space);
     
    775775                                default:
    776776                                    c = *ptr;              /* The final character */
    777                                     class_charcount -= 2;  /* Undo the default count from above */
     777                                    classCharCount -= 2;  /* Undo the default count from above */
    778778                            }
    779779                        }
     
    799799                        if (d == '\\') {
    800800                            const UChar* oldptr = ptr;
    801                             d = checkEscape(&ptr, patternEnd, errorcodeptr, cd.numCapturingBrackets, true);
     801                            d = checkEscape(&ptr, patternEnd, errorCodePtr, cd.numCapturingBrackets, true);
    802802                           
    803803                            /* \X is literal X; any other special means the '-' was literal */
     
    879879                                classbits[uc/8] |= (1 << (uc&7));
    880880                            }
    881                             class_charcount++;                /* in case a one-char range */
    882                             class_lastchar = c;
     881                            classCharCount++;                /* in case a one-char range */
     882                            classLastChar = c;
    883883                        }
    884884                       
     
    913913                            classbits[c/8] |= (1 << (c&7));
    914914                        }
    915                         class_charcount++;
    916                         class_lastchar = c;
    917                     }
    918                 }
    919                
    920                 /* If class_charcount is 1, we saw precisely one character whose value is
     915                        classCharCount++;
     916                        classLastChar = c;
     917                    }
     918                }
     919               
     920                /* If classCharCount is 1, we saw precisely one character whose value is
    921921                 less than 256. In non-UTF-8 mode we can always optimize. In UTF-8 mode, we
    922922                 can optimize the negative case only if there were no characters >= 128
     
    928928                 1-character OP_CHAR[NC] if it's positive, or OP_NOT if it's negative. Note
    929929                 that OP_NOT does not support multibyte characters. In the positive case, it
    930                  can cause firstbyte to be set. Otherwise, there can be no first char if
     930                 can cause firstByte to be set. Otherwise, there can be no first char if
    931931                 this item is first, whatever repeat count may follow. In the case of
    932                  reqbyte, save the previous value for reinstating. */
    933                
    934                 if (class_charcount == 1 && (!class_utf8 && (!negate_class || class_lastchar < 128))) {
    935                     zeroreqbyte = reqbyte;
     932                 reqByte, save the previous value for reinstating. */
     933               
     934                if (classCharCount == 1 && (!class_utf8 && (!negateClass || classLastChar < 128))) {
     935                    zeroReqByte = reqByte;
    936936                   
    937937                    /* The OP_NOT opcode works on one-byte characters only. */
    938938                   
    939                     if (negate_class) {
    940                         if (firstbyte == REQ_UNSET)
    941                             firstbyte = REQ_NONE;
    942                         zerofirstbyte = firstbyte;
     939                    if (negateClass) {
     940                        if (firstByte == REQ_UNSET)
     941                            firstByte = REQ_NONE;
     942                        zeroFirstByte = firstByte;
    943943                        *code++ = OP_NOT;
    944                         *code++ = class_lastchar;
     944                        *code++ = classLastChar;
    945945                        break;
    946946                    }
     
    949949                     then we can handle this with the normal one-character code. */
    950950                   
    951                     c = class_lastchar;
     951                    c = classLastChar;
    952952                    goto NORMAL_CHAR;
    953953                }       /* End of 1-char optimization */
     
    955955                /* The general case - not the one-char optimization. If this is the first
    956956                 thing in the branch, there can be no first char setting, whatever the
    957                  repeat count. Any reqbyte setting must remain unchanged after any kind of
     957                 repeat count. Any reqByte setting must remain unchanged after any kind of
    958958                 repeat. */
    959959               
    960                 if (firstbyte == REQ_UNSET) firstbyte = REQ_NONE;
    961                 zerofirstbyte = firstbyte;
    962                 zeroreqbyte = reqbyte;
     960                if (firstByte == REQ_UNSET) firstByte = REQ_NONE;
     961                zeroFirstByte = firstByte;
     962                zeroReqByte = reqByte;
    963963               
    964964                /* If there are characters with values > 255, we have to compile an
     
    966966                 we can omit the bitmap. */
    967967               
    968                 if (class_utf8 && !should_flip_negation) {
     968                if (class_utf8 && !shouldFlipNegation) {
    969969                    *class_utf8data++ = XCL_END;    /* Marks the end of extra data */
    970970                    *code++ = OP_XCLASS;
    971971                    code += LINK_SIZE;
    972                     *code = negate_class? XCL_NOT : 0;
     972                    *code = negateClass? XCL_NOT : 0;
    973973                   
    974974                    /* If the map is required, install it, and move on to the end of
    975975                     the extra data */
    976976                   
    977                     if (class_charcount > 0) {
     977                    if (classCharCount > 0) {
    978978                        *code++ |= XCL_MAP;
    979979                        memcpy(code, classbits, 32);
     
    997997                /* If there are no characters > 255, negate the 32-byte map if necessary,
    998998                 and copy it into the code vector. If this is the first thing in the branch,
    999                  there can be no first char setting, whatever the repeat count. Any reqbyte
     999                 there can be no first char setting, whatever the repeat count. Any reqByte
    10001000                 setting must remain unchanged after any kind of repeat. */
    10011001               
    1002                 *code++ = (negate_class == should_flip_negation) ? OP_CLASS : OP_NCLASS;
    1003                 if (negate_class)
     1002                *code++ = (negateClass == shouldFlipNegation) ? OP_CLASS : OP_NCLASS;
     1003                if (negateClass)
    10041004                    for (c = 0; c < 32; c++)
    10051005                        code[c] = ~classbits[c];
     
    10141014
    10151015            case '{':
    1016                 if (!is_quantifier)
     1016                if (!isQuantifier)
    10171017                    goto NORMAL_CHAR;
    1018                 ptr = readRepeatCounts(ptr + 1, &repeat_min, &repeat_max, errorcodeptr);
    1019                 if (*errorcodeptr)
     1018                ptr = readRepeatCounts(ptr + 1, &repeatMin, &repeat_max, errorCodePtr);
     1019                if (*errorCodePtr)
    10201020                    goto FAILED;
    10211021                goto REPEAT;
    10221022               
    10231023            case '*':
    1024                 repeat_min = 0;
     1024                repeatMin = 0;
    10251025                repeat_max = -1;
    10261026                goto REPEAT;
    10271027               
    10281028            case '+':
    1029                 repeat_min = 1;
     1029                repeatMin = 1;
    10301030                repeat_max = -1;
    10311031                goto REPEAT;
    10321032               
    10331033            case '?':
    1034                 repeat_min = 0;
     1034                repeatMin = 0;
    10351035                repeat_max = 1;
    10361036               
    10371037            REPEAT:
    10381038                if (!previous) {
    1039                     *errorcodeptr = ERR9;
     1039                    *errorCodePtr = ERR9;
    10401040                    goto FAILED;
    10411041                }
    10421042               
    1043                 if (repeat_min == 0) {
    1044                     firstbyte = zerofirstbyte;    /* Adjust for zero repeat */
    1045                     reqbyte = zeroreqbyte;        /* Ditto */
     1043                if (repeatMin == 0) {
     1044                    firstByte = zeroFirstByte;    /* Adjust for zero repeat */
     1045                    reqByte = zeroReqByte;        /* Ditto */
    10461046                }
    10471047               
    10481048                /* Remember whether this is a variable length repeat */
    10491049               
    1050                 reqvary = (repeat_min == repeat_max) ? 0 : REQ_VARY;
    1051                
    1052                 op_type = 0;                    /* Default single-char op codes */
     1050                reqvary = (repeatMin == repeat_max) ? 0 : REQ_VARY;
     1051               
     1052                opType = 0;                    /* Default single-char op codes */
    10531053               
    10541054                /* Save start of previous item, in case we have to move it up to make space
     
    10651065               
    10661066                if (safelyCheckNextChar(ptr, patternEnd, '?')) {
    1067                     repeat_type = 1;
     1067                    repeatType = 1;
    10681068                    ptr++;
    10691069                } else
    1070                     repeat_type = 0;
     1070                    repeatType = 0;
    10711071               
    10721072                /* If previous was a character match, abolish the item and generate a
    10731073                 repeat item instead. If a char item has a minumum of more than one, ensure
    1074                  that it is set in reqbyte - it might not be if a sequence such as x{3} is
    1075                  the first thing in a branch because the x will have gone into firstbyte
     1074                 that it is set in reqByte - it might not be if a sequence such as x{3} is
     1075                 the first thing in a branch because the x will have gone into firstByte
    10761076                 instead.  */
    10771077               
     
    10921092                    else {
    10931093                        c = code[-1];
    1094                         if (repeat_min > 1)
    1095                             reqbyte = c | req_caseopt | cd.req_varyopt;
     1094                        if (repeatMin > 1)
     1095                            reqByte = c | reqCaseOpt | cd.reqVaryOpt;
    10961096                    }
    10971097                   
     
    11011101                else if (*previous == OP_ASCII_CHAR || *previous == OP_ASCII_LETTER_IGNORING_CASE) {
    11021102                    c = previous[1];
    1103                     if (repeat_min > 1)
    1104                         reqbyte = c | req_caseopt | cd.req_varyopt;
     1103                    if (repeatMin > 1)
     1104                        reqByte = c | reqCaseOpt | cd.reqVaryOpt;
    11051105                    goto OUTPUT_SINGLE_REPEAT;
    11061106                }
     
    11091109                 one of the special opcodes, replacing it. The code is shared with single-
    11101110                 character repeats by setting opt_type to add a suitable offset into
    1111                  repeat_type. OP_NOT is currently used only for single-byte chars. */
     1111                 repeatType. OP_NOT is currently used only for single-byte chars. */
    11121112               
    11131113                else if (*previous == OP_NOT) {
    1114                     op_type = OP_NOTSTAR - OP_STAR;  /* Use "not" opcodes */
     1114                    opType = OP_NOTSTAR - OP_STAR;  /* Use "not" opcodes */
    11151115                    c = previous[1];
    11161116                    goto OUTPUT_SINGLE_REPEAT;
     
    11191119                /* If previous was a character type match (\d or similar), abolish it and
    11201120                 create a suitable repeat item. The code is shared with single-character
    1121                  repeats by setting op_type to add a suitable offset into repeat_type. */
     1121                 repeats by setting opType to add a suitable offset into repeatType. */
    11221122               
    11231123                else if (*previous <= OP_NOT_NEWLINE) {
    1124                     op_type = OP_TYPESTAR - OP_STAR;  /* Use type opcodes */
     1124                    opType = OP_TYPESTAR - OP_STAR;  /* Use type opcodes */
    11251125                    c = *previous;
    11261126                   
     
    11381138                        goto END_REPEAT;
    11391139                   
    1140                     /* Combine the op_type with the repeat_type */
    1141                    
    1142                     repeat_type += op_type;
     1140                    /* Combine the opType with the repeatType */
     1141                   
     1142                    repeatType += opType;
    11431143                   
    11441144                    /* A minimum of zero is handled either as the special case * or ?, or as
    11451145                     an UPTO, with the maximum given. */
    11461146                   
    1147                     if (repeat_min == 0) {
     1147                    if (repeatMin == 0) {
    11481148                        if (repeat_max == -1)
    1149                             *code++ = OP_STAR + repeat_type;
     1149                            *code++ = OP_STAR + repeatType;
    11501150                        else if (repeat_max == 1)
    1151                             *code++ = OP_QUERY + repeat_type;
     1151                            *code++ = OP_QUERY + repeatType;
    11521152                        else {
    1153                             *code++ = OP_UPTO + repeat_type;
     1153                            *code++ = OP_UPTO + repeatType;
    11541154                            put2ByteValueAndAdvance(code, repeat_max);
    11551155                        }
     
    11611161                     one less than the maximum. */
    11621162                   
    1163                     else if (repeat_min == 1) {
     1163                    else if (repeatMin == 1) {
    11641164                        if (repeat_max == -1)
    1165                             *code++ = OP_PLUS + repeat_type;
     1165                            *code++ = OP_PLUS + repeatType;
    11661166                        else {
    11671167                            code = oldcode;                 /* leave previous item in place */
    11681168                            if (repeat_max == 1)
    11691169                                goto END_REPEAT;
    1170                             *code++ = OP_UPTO + repeat_type;
     1170                            *code++ = OP_UPTO + repeatType;
    11711171                            put2ByteValueAndAdvance(code, repeat_max - 1);
    11721172                        }
     
    11771177                   
    11781178                    else {
    1179                         *code++ = OP_EXACT + op_type;  /* NB EXACT doesn't have repeat_type */
    1180                         put2ByteValueAndAdvance(code, repeat_min);
     1179                        *code++ = OP_EXACT + opType;  /* NB EXACT doesn't have repeatType */
     1180                        put2ByteValueAndAdvance(code, repeatMin);
    11811181                       
    11821182                        /* If the maximum is unlimited, insert an OP_STAR. Before doing so,
     
    11971197                                }
    11981198                            }
    1199                             *code++ = OP_STAR + repeat_type;
     1199                            *code++ = OP_STAR + repeatType;
    12001200                        }
    12011201                       
     
    12031203                         preceded by the character, for the previously inserted code. */
    12041204                       
    1205                         else if (repeat_max != repeat_min) {
     1205                        else if (repeat_max != repeatMin) {
    12061206                            if (c >= 128) {
    12071207                                memcpy(code, utf8_char, c & 7);
     
    12131213                                *code++ = prop_value;
    12141214                            }
    1215                             repeat_max -= repeat_min;
    1216                             *code++ = OP_UPTO + repeat_type;
     1215                            repeat_max -= repeatMin;
     1216                            *code++ = OP_UPTO + repeatType;
    12171217                            put2ByteValueAndAdvance(code, repeat_max);
    12181218                        }
     
    12491249                    }
    12501250                   
    1251                     if (repeat_min == 0 && repeat_max == -1)
    1252                         *code++ = OP_CRSTAR + repeat_type;
    1253                     else if (repeat_min == 1 && repeat_max == -1)
    1254                         *code++ = OP_CRPLUS + repeat_type;
    1255                     else if (repeat_min == 0 && repeat_max == 1)
    1256                         *code++ = OP_CRQUERY + repeat_type;
     1251                    if (repeatMin == 0 && repeat_max == -1)
     1252                        *code++ = OP_CRSTAR + repeatType;
     1253                    else if (repeatMin == 1 && repeat_max == -1)
     1254                        *code++ = OP_CRPLUS + repeatType;
     1255                    else if (repeatMin == 0 && repeat_max == 1)
     1256                        *code++ = OP_CRQUERY + repeatType;
    12571257                    else {
    1258                         *code++ = OP_CRRANGE + repeat_type;
    1259                         put2ByteValueAndAdvance(code, repeat_min);
     1258                        *code++ = OP_CRRANGE + repeatType;
     1259                        put2ByteValueAndAdvance(code, repeatMin);
    12601260                        if (repeat_max == -1)
    12611261                            repeat_max = 0;  /* 2-byte encoding for max */
     
    12911291                     minimum is zero. */
    12921292                   
    1293                     if (repeat_min == 0) {
     1293                    if (repeatMin == 0) {
    12941294                        /* If the maximum is also zero, we just omit the group from the output
    12951295                         altogether. */
     
    13101310                            memmove(previous+1, previous, len);
    13111311                            code++;
    1312                             *previous++ = OP_BRAZERO + repeat_type;
     1312                            *previous++ = OP_BRAZERO + repeatType;
    13131313                        }
    13141314                       
     
    13241324                            memmove(previous + 2 + LINK_SIZE, previous, len);
    13251325                            code += 2 + LINK_SIZE;
    1326                             *previous++ = OP_BRAZERO + repeat_type;
     1326                            *previous++ = OP_BRAZERO + repeatType;
    13271327                            *previous++ = OP_BRA;
    13281328                           
     
    13441344                   
    13451345                    else {
    1346                         if (repeat_min > 1) {
    1347                             if (groupsetfirstbyte && reqbyte < 0)
    1348                                 reqbyte = firstbyte;
    1349                             for (int i = 1; i < repeat_min; i++) {
     1346                        if (repeatMin > 1) {
     1347                            if (didGroupSetFirstByte && reqByte < 0)
     1348                                reqByte = firstByte;
     1349                            for (int i = 1; i < repeatMin; i++) {
    13501350                                memcpy(code, previous, len);
    13511351                                code += len;
     
    13531353                        }
    13541354                        if (repeat_max > 0)
    1355                             repeat_max -= repeat_min;
     1355                            repeat_max -= repeatMin;
    13561356                    }
    13571357                   
     
    13641364                    if (repeat_max >= 0) {
    13651365                        for (int i = repeat_max - 1; i >= 0; i--) {
    1366                             *code++ = OP_BRAZERO + repeat_type;
     1366                            *code++ = OP_BRAZERO + repeatType;
    13671367                           
    13681368                            /* All but the final copy start a new nesting, maintaining the
     
    14001400                   
    14011401                    else
    1402                         code[-ketoffset] = OP_KETRMAX + repeat_type;
     1402                        code[-ketoffset] = OP_KETRMAX + repeatType;
    14031403                }
    14041404               
     
    14061406               
    14071407                else {
    1408                     *errorcodeptr = ERR11;
     1408                    *errorCodePtr = ERR11;
    14091409                    goto FAILED;
    14101410                }
     
    14161416            END_REPEAT:
    14171417                previous = NULL;
    1418                 cd.req_varyopt |= reqvary;
     1418                cd.reqVaryOpt |= reqvary;
    14191419                break;
    14201420               
     
    14271427               
    14281428            case '(':
    1429                 skipbytes = 0;
     1429                skipBytes = 0;
    14301430               
    14311431                if (*(++ptr) == '?') {
     
    14491449                           
    14501450                        default:
    1451                             *errorcodeptr = ERR12;
     1451                            *errorCodePtr = ERR12;
    14521452                            goto FAILED;
    14531453                        }
     
    14631463                        code[1 + LINK_SIZE] = OP_BRANUMBER;
    14641464                        put2ByteValue(code + 2 + LINK_SIZE, *brackets);
    1465                         skipbytes = 3;
     1465                        skipBytes = 3;
    14661466                    }
    14671467                    else
     
    14771477                *code = bravalue;
    14781478                tempcode = code;
    1479                 tempreqvary = cd.req_varyopt;     /* Save value before bracket */
     1479                tempreqvary = cd.reqVaryOpt;     /* Save value before bracket */
    14801480               
    14811481                if (!compileBracket(
     
    14851485                                   &ptr,                         /* Input pointer (updated) */
    14861486                                   patternEnd,
    1487                                    errorcodeptr,                 /* Where to put an error message */
    1488                                    skipbytes,                    /* Skip over OP_BRANUMBER */
    1489                                    &subfirstbyte,                /* For possible first char */
    1490                                    &subreqbyte,                  /* For possible last char */
     1487                                   errorCodePtr,                 /* Where to put an error message */
     1488                                   skipBytes,                    /* Skip over OP_BRANUMBER */
     1489                                   &subFirstByte,                /* For possible first char */
     1490                                   &subReqByte,                  /* For possible last char */
    14911491                                   cd))                          /* Tables block */
    14921492                    goto FAILED;
     
    15001500                 brackets of all kinds, and conditions with two branches (see code above).
    15011501                 If the bracket is followed by a quantifier with zero repeat, we have to
    1502                  back off. Hence the definition of zeroreqbyte and zerofirstbyte outside the
     1502                 back off. Hence the definition of zeroReqByte and zeroFirstByte outside the
    15031503                 main loop so that they can be accessed for the back off. */
    15041504               
    1505                 zeroreqbyte = reqbyte;
    1506                 zerofirstbyte = firstbyte;
    1507                 groupsetfirstbyte = false;
     1505                zeroReqByte = reqByte;
     1506                zeroFirstByte = firstByte;
     1507                didGroupSetFirstByte = false;
    15081508               
    15091509                if (bravalue >= OP_BRA) {
    1510                     /* If we have not yet set a firstbyte in this branch, take it from the
     1510                    /* If we have not yet set a firstByte in this branch, take it from the
    15111511                     subpattern, remembering that it was set here so that a repeat of more
    1512                      than one can replicate it as reqbyte if necessary. If the subpattern has
    1513                      no firstbyte, set "none" for the whole branch. In both cases, a zero
    1514                      repeat forces firstbyte to "none". */
    1515                    
    1516                     if (firstbyte == REQ_UNSET) {
    1517                         if (subfirstbyte >= 0) {
    1518                             firstbyte = subfirstbyte;
    1519                             groupsetfirstbyte = true;
     1512                     than one can replicate it as reqByte if necessary. If the subpattern has
     1513                     no firstByte, set "none" for the whole branch. In both cases, a zero
     1514                     repeat forces firstByte to "none". */
     1515                   
     1516                    if (firstByte == REQ_UNSET) {
     1517                        if (subFirstByte >= 0) {
     1518                            firstByte = subFirstByte;
     1519                            didGroupSetFirstByte = true;
    15201520                        }
    15211521                        else
    1522                             firstbyte = REQ_NONE;
    1523                         zerofirstbyte = REQ_NONE;
    1524                     }
    1525                    
    1526                     /* If firstbyte was previously set, convert the subpattern's firstbyte
    1527                      into reqbyte if there wasn't one, using the vary flag that was in
     1522                            firstByte = REQ_NONE;
     1523                        zeroFirstByte = REQ_NONE;
     1524                    }
     1525                   
     1526                    /* If firstByte was previously set, convert the subpattern's firstByte
     1527                     into reqByte if there wasn't one, using the vary flag that was in
    15281528                     existence beforehand. */
    15291529                   
    1530                     else if (subfirstbyte >= 0 && subreqbyte < 0)
    1531                         subreqbyte = subfirstbyte | tempreqvary;
     1530                    else if (subFirstByte >= 0 && subReqByte < 0)
     1531                        subReqByte = subFirstByte | tempreqvary;
    15321532                   
    15331533                    /* If the subpattern set a required byte (or set a first byte that isn't
    15341534                     really the first byte - see above), set it. */
    15351535                   
    1536                     if (subreqbyte >= 0)
    1537                         reqbyte = subreqbyte;
    1538                 }
    1539                
    1540                 /* For a forward assertion, we take the reqbyte, if set. This can be
     1536                    if (subReqByte >= 0)
     1537                        reqByte = subReqByte;
     1538                }
     1539               
     1540                /* For a forward assertion, we take the reqByte, if set. This can be
    15411541                 helpful if the pattern that follows the assertion doesn't set a different
    1542                  char. For example, it's useful for /(?=abcde).+/. We can't set firstbyte
     1542                 char. For example, it's useful for /(?=abcde).+/. We can't set firstByte
    15431543                 for an assertion, however because it leads to incorrect effect for patterns
    1544                  such as /(?=a)a.+/ when the "real" "a" would then become a reqbyte instead
    1545                  of a firstbyte. This is overcome by a scan at the end if there's no
    1546                  firstbyte, looking for an asserted first char. */
    1547                
    1548                 else if (bravalue == OP_ASSERT && subreqbyte >= 0)
    1549                     reqbyte = subreqbyte;
     1544                 such as /(?=a)a.+/ when the "real" "a" would then become a reqByte instead
     1545                 of a firstByte. This is overcome by a scan at the end if there's no
     1546                 firstByte, looking for an asserted first char. */
     1547               
     1548                else if (bravalue == OP_ASSERT && subReqByte >= 0)
     1549                    reqByte = subReqByte;
    15501550               
    15511551                /* Now update the main code pointer to the end of the group. */
     
    15561556               
    15571557                if (ptr >= patternEnd || *ptr != ')') {
    1558                     *errorcodeptr = ERR14;
     1558                    *errorCodePtr = ERR14;
    15591559                    goto FAILED;
    15601560                }
     
    15671567            case '\\':
    15681568                tempptr = ptr;
    1569                 c = checkEscape(&ptr, patternEnd, errorcodeptr, cd.numCapturingBrackets, false);
     1569                c = checkEscape(&ptr, patternEnd, errorCodePtr, cd.numCapturingBrackets, false);
    15701570               
    15711571                /* Handle metacharacters introduced by \. For ones like \d, the ESC_ values
     
    15801580                     setting of a first character if it hasn't already been set. */
    15811581                   
    1582                     if (firstbyte == REQ_UNSET && -c > ESC_b && -c <= ESC_w)
    1583                         firstbyte = REQ_NONE;
     1582                    if (firstByte == REQ_UNSET && -c > ESC_b && -c <= ESC_w)
     1583                        firstByte = REQ_NONE;
    15841584                   
    15851585                    /* Set values to reset to if this is followed by a zero repeat. */
    15861586                   
    1587                     zerofirstbyte = firstbyte;
    1588                     zeroreqbyte = reqbyte;
     1587                    zeroFirstByte = firstByte;
     1588                    zeroReqByte = reqByte;
    15891589                   
    15901590                    /* Back references are handled specially */
     
    16191619               
    16201620                if (c < 128) {
    1621                     mclength = 1;
     1621                    mcLength = 1;
    16221622                    mcbuffer[0] = c;
    16231623                   
     
    16301630                    }
    16311631                } else {
    1632                     mclength = encodeUTF8(c, mcbuffer);
     1632                    mcLength = encodeUTF8(c, mcbuffer);
    16331633                   
    16341634                    *code++ = (options & IgnoreCaseOption) ? OP_CHAR_IGNORING_CASE : OP_CHAR;
    1635                     for (c = 0; c < mclength; c++)
     1635                    for (c = 0; c < mcLength; c++)
    16361636                        *code++ = mcbuffer[c];
    16371637                }
     
    16391639                /* Set the first and required bytes appropriately. If no previous first
    16401640                 byte, set it from this character, but revert to none on a zero repeat.
    1641                  Otherwise, leave the firstbyte value alone, and don't change it on a zero
     1641                 Otherwise, leave the firstByte value alone, and don't change it on a zero
    16421642                 repeat. */
    16431643               
    1644                 if (firstbyte == REQ_UNSET) {
    1645                     zerofirstbyte = REQ_NONE;
    1646                     zeroreqbyte = reqbyte;
    1647                    
    1648                     /* If the character is more than one byte long, we can set firstbyte
     1644                if (firstByte == REQ_UNSET) {
     1645                    zeroFirstByte = REQ_NONE;
     1646                    zeroReqByte = reqByte;
     1647                   
     1648                    /* If the character is more than one byte long, we can set firstByte
    16491649                     only if it is not to be matched caselessly. */
    16501650                   
    1651                     if (mclength == 1 || req_caseopt == 0) {
    1652                         firstbyte = mcbuffer[0] | req_caseopt;
    1653                         if (mclength != 1)
    1654                             reqbyte = code[-1] | cd.req_varyopt;
     1651                    if (mcLength == 1 || reqCaseOpt == 0) {
     1652                        firstByte = mcbuffer[0] | reqCaseOpt;
     1653                        if (mcLength != 1)
     1654                            reqByte = code[-1] | cd.reqVaryOpt;
    16551655                    }
    16561656                    else
    1657                         firstbyte = reqbyte = REQ_NONE;
    1658                 }
    1659                
    1660                 /* firstbyte was previously set; we can set reqbyte only the length is
     1657                        firstByte = reqByte = REQ_NONE;
     1658                }
     1659               
     1660                /* firstByte was previously set; we can set reqByte only the length is
    16611661                 1 or the matching is caseful. */
    16621662               
    16631663                else {
    1664                     zerofirstbyte = firstbyte;
    1665                     zeroreqbyte = reqbyte;
    1666                     if (mclength == 1 || req_caseopt == 0)
    1667                         reqbyte = code[-1] | req_caseopt | cd.req_varyopt;
     1664                    zeroFirstByte = firstByte;
     1665                    zeroReqByte = reqByte;
     1666                    if (mcLength == 1 || reqCaseOpt == 0)
     1667                        reqByte = code[-1] | reqCaseOpt | cd.reqVaryOpt;
    16681668                }
    16691669               
     
    16771677   
    16781678FAILED:
    1679     *ptrptr = ptr;
     1679    *ptrPtr = ptr;
    16801680    return false;
    16811681}
     
    16961696  options        option bits, including any changes for this subpattern
    16971697  brackets       -> int containing the number of extracting brackets used
    1698   codeptr        -> the address of the current code pointer
    1699   ptrptr         -> the address of the current pattern pointer
    1700   errorcodeptr   -> pointer to error code variable
    1701   skipbytes      skip this many bytes at start (for OP_BRANUMBER)
     1698  codePtr        -> the address of the current code pointer
     1699  ptrPtr         -> the address of the current pattern pointer
     1700  errorCodePtr   -> pointer to error code variable
     1701  skipBytes      skip this many bytes at start (for OP_BRANUMBER)
    17021702  firstbyteptr   place to put the first required character, or a negative number
    17031703  reqbyteptr     place to put the last required character, or a negative number
     
    17081708
    17091709static bool
    1710 compileBracket(int options, int* brackets, unsigned char** codeptr,
    1711     const UChar** ptrptr, const UChar* patternEnd, ErrorCode* errorcodeptr, int skipbytes,
     1710compileBracket(int options, int* brackets, unsigned char** codePtr,
     1711    const UChar** ptrPtr, const UChar* patternEnd, ErrorCode* errorCodePtr, int skipBytes,
    17121712    int* firstbyteptr, int* reqbyteptr, CompileData& cd)
    17131713{
    1714     const UChar* ptr = *ptrptr;
    1715     unsigned char* code = *codeptr;
    1716     unsigned char* last_branch = code;
     1714    const UChar* ptr = *ptrPtr;
     1715    unsigned char* code = *codePtr;
     1716    unsigned char* lastBranch = code;
    17171717    unsigned char* start_bracket = code;
    1718     int firstbyte = REQ_UNSET;
    1719     int reqbyte = REQ_UNSET;
     1718    int firstByte = REQ_UNSET;
     1719    int reqByte = REQ_UNSET;
    17201720   
    17211721    /* Offset is set zero to mark that this bracket is still open */
    17221722   
    17231723    putLinkValueAllowZero(code + 1, 0);
    1724     code += 1 + LINK_SIZE + skipbytes;
     1724    code += 1 + LINK_SIZE + skipBytes;
    17251725   
    17261726    /* Loop for each alternative branch */
     
    17291729        /* Now compile the branch */
    17301730       
    1731         int branchfirstbyte;
    1732         int branchreqbyte;
    1733         if (!compileBranch(options, brackets, &code, &ptr, patternEnd, errorcodeptr,
    1734                             &branchfirstbyte, &branchreqbyte, cd)) {
    1735             *ptrptr = ptr;
     1731        int branchFirstByte;
     1732        int branchReqByte;
     1733        if (!compileBranch(options, brackets, &code, &ptr, patternEnd, errorCodePtr,
     1734                            &branchFirstByte, &branchReqByte, cd)) {
     1735            *ptrPtr = ptr;
    17361736            return false;
    17371737        }
    17381738       
    1739         /* If this is the first branch, the firstbyte and reqbyte values for the
     1739        /* If this is the first branch, the firstByte and reqByte values for the
    17401740         branch become the values for the regex. */
    17411741       
    1742         if (*last_branch != OP_ALT) {
    1743             firstbyte = branchfirstbyte;
    1744             reqbyte = branchreqbyte;
     1742        if (*lastBranch != OP_ALT) {
     1743            firstByte = branchFirstByte;
     1744            reqByte = branchReqByte;
    17451745        }
    17461746       
    1747         /* If this is not the first branch, the first char and reqbyte have to
     1747        /* If this is not the first branch, the first char and reqByte have to
    17481748         match the values from all the previous branches, except that if the previous
    1749          value for reqbyte didn't have REQ_VARY set, it can still match, and we set
     1749         value for reqByte didn't have REQ_VARY set, it can still match, and we set
    17501750         REQ_VARY for the regex. */
    17511751       
    17521752        else {
    1753             /* If we previously had a firstbyte, but it doesn't match the new branch,
    1754              we have to abandon the firstbyte for the regex, but if there was previously
    1755              no reqbyte, it takes on the value of the old firstbyte. */
     1753            /* If we previously had a firstByte, but it doesn't match the new branch,
     1754             we have to abandon the firstByte for the regex, but if there was previously
     1755             no reqByte, it takes on the value of the old firstByte. */
    17561756           
    1757             if (firstbyte >= 0 && firstbyte != branchfirstbyte) {
    1758                 if (reqbyte < 0)
    1759                     reqbyte = firstbyte;
    1760                 firstbyte = REQ_NONE;
     1757            if (firstByte >= 0 && firstByte != branchFirstByte) {
     1758                if (reqByte < 0)
     1759                    reqByte = firstByte;
     1760                firstByte = REQ_NONE;
    17611761            }
    17621762           
    1763             /* If we (now or from before) have no firstbyte, a firstbyte from the
    1764              branch becomes a reqbyte if there isn't a branch reqbyte. */
     1763            /* If we (now or from before) have no firstByte, a firstByte from the
     1764             branch becomes a reqByte if there isn't a branch reqByte. */
    17651765           
    1766             if (firstbyte < 0 && branchfirstbyte >= 0 && branchreqbyte < 0)
    1767                 branchreqbyte = branchfirstbyte;
     1766            if (firstByte < 0 && branchFirstByte >= 0 && branchReqByte < 0)
     1767                branchReqByte = branchFirstByte;
    17681768           
    17691769            /* Now ensure that the reqbytes match */
    17701770           
    1771             if ((reqbyte & ~REQ_VARY) != (branchreqbyte & ~REQ_VARY))
    1772                 reqbyte = REQ_NONE;
     1771            if ((reqByte & ~REQ_VARY) != (branchReqByte & ~REQ_VARY))
     1772                reqByte = REQ_NONE;
    17731773            else
    1774                 reqbyte |= branchreqbyte;   /* To "or" REQ_VARY */
     1774                reqByte |= branchReqByte;   /* To "or" REQ_VARY */
    17751775        }
    17761776       
     
    17851785       
    17861786        if (ptr >= patternEnd || *ptr != '|') {
    1787             int length = code - last_branch;
     1787            int length = code - lastBranch;
    17881788            do {
    1789                 int prev_length = getLinkValueAllowZero(last_branch + 1);
    1790                 putLinkValue(last_branch + 1, length);
    1791                 length = prev_length;
    1792                 last_branch -= length;
     1789                int prevLength = getLinkValueAllowZero(lastBranch + 1);
     1790                putLinkValue(lastBranch + 1, length);
     1791                length = prevLength;
     1792                lastBranch -= length;
    17931793            } while (length > 0);
    17941794           
     
    18011801            /* Set values to pass back */
    18021802           
    1803             *codeptr = code;
    1804             *ptrptr = ptr;
    1805             *firstbyteptr = firstbyte;
    1806             *reqbyteptr = reqbyte;
     1803            *codePtr = code;
     1804            *ptrPtr = ptr;
     1805            *firstbyteptr = firstByte;
     1806            *reqbyteptr = reqByte;
    18071807            return true;
    18081808        }
     
    18141814       
    18151815        *code = OP_ALT;
    1816         putLinkValue(code + 1, code - last_branch);
    1817         last_branch = code;
     1816        putLinkValue(code + 1, code - lastBranch);
     1817        lastBranch = code;
    18181818        code += 1 + LINK_SIZE;
    18191819        ptr++;
     
    20622062                    int refnum = -c - ESC_REF;
    20632063                    cd.backrefMap |= (refnum < 32) ? (1 << refnum) : 1;
    2064                     if (refnum > cd.top_backref)
    2065                         cd.top_backref = refnum;
     2064                    if (refnum > cd.topBackref)
     2065                        cd.topBackref = refnum;
    20662066                    length += 2;   /* For single back reference */
    20672067                    if (safelyCheckNextChar(ptr, patternEnd, '{') && isCountedRepeat(ptr + 2, patternEnd)) {
     
    25252525  pattern       the regular expression
    25262526  options       various option bits
    2527   errorcodeptr  pointer to error code variable (pcre_compile2() only)
     2527  errorCodePtr  pointer to error code variable (pcre_compile2() only)
    25282528                  can be NULL if you don't want a code value
    2529   errorptr      pointer to pointer to error text
     2529  errorPtr      pointer to pointer to error text
    25302530  erroroffset   ptr offset in pattern where error was detected
    25312531  tables        pointer to character tables or NULL
    25322532
    25332533Returns:        pointer to compiled data block, or NULL on error,
    2534                 with errorptr and erroroffset set
     2534                with errorPtr and erroroffset set
    25352535*/
    25362536
    2537 static inline JSRegExp* returnError(ErrorCode errorcode, const char** errorptr)
     2537static inline JSRegExp* returnError(ErrorCode errorcode, const char** errorPtr)
    25382538{
    2539     *errorptr = errorText(errorcode);
     2539    *errorPtr = errorText(errorcode);
    25402540    return 0;
    25412541}
     
    25432543JSRegExp* jsRegExpCompile(const UChar* pattern, int patternLength,
    25442544                JSRegExpIgnoreCaseOption ignoreCase, JSRegExpMultilineOption multiline,
    2545                 unsigned* numSubpatterns, const char** errorptr)
     2545                unsigned* numSubpatterns, const char** errorPtr)
    25462546{
    2547     /* We can't pass back an error message if errorptr is NULL; I guess the best we
     2547    /* We can't pass back an error message if errorPtr is NULL; I guess the best we
    25482548     can do is just return NULL, but we can set a code value if there is a code pointer. */
    2549     if (!errorptr)
     2549    if (!errorPtr)
    25502550        return 0;
    2551     *errorptr = NULL;
     2551    *errorPtr = NULL;
    25522552   
    25532553    CompileData cd;
     
    25592559    int length = calculateCompiledPatternLength(pattern, patternLength, ignoreCase, cd, errorcode);
    25602560    if (errorcode)
    2561         return returnError(errorcode, errorptr);
     2561        return returnError(errorcode, errorPtr);
    25622562   
    25632563    if (length > MAX_PATTERN_SIZE)
    2564         return returnError(ERR16, errorptr);
     2564        return returnError(ERR16, errorPtr);
    25652565   
    25662566    size_t size = length + sizeof(JSRegExp);
     
    25682568   
    25692569    if (!re)
    2570         return returnError(ERR13, errorptr);
     2570        return returnError(ERR13, errorPtr);
    25712571   
    25722572    re->options = (ignoreCase ? IgnoreCaseOption : 0) | (multiline ? MatchAcrossMultipleLinesOption : 0);
     
    25842584    const UChar* patternEnd = pattern + patternLength;
    25852585    unsigned char* code = (unsigned char*)codeStart;
    2586     int firstbyte, reqbyte;
     2586    int firstByte, reqByte;
    25872587    int bracketCount = 0;
    25882588    if (!cd.needOuterBracket)
    2589         compileBranch(re->options, &bracketCount, &code, &ptr, patternEnd, &errorcode, &firstbyte, &reqbyte, cd);
     2589        compileBranch(re->options, &bracketCount, &code, &ptr, patternEnd, &errorcode, &firstByte, &reqByte, cd);
    25902590    else {
    25912591        *code = OP_BRA;
    2592         compileBracket(re->options, &bracketCount, &code, &ptr, patternEnd, &errorcode, 0, &firstbyte, &reqbyte, cd);
     2592        compileBracket(re->options, &bracketCount, &code, &ptr, patternEnd, &errorcode, 0, &firstByte, &reqByte, cd);
    25932593    }
    2594     re->top_bracket = bracketCount;
    2595     re->top_backref = cd.top_backref;
     2594    re->topBracket = bracketCount;
     2595    re->topBackref = cd.topBackref;
    25962596   
    25972597    /* If not reached end of pattern on success, there's an excess bracket. */
     
    26122612     subpattern. */
    26132613   
    2614     if (re->top_backref > re->top_bracket)
     2614    if (re->topBackref > re->topBracket)
    26152615        errorcode = ERR15;
    26162616   
     
    26192619    if (errorcode != ERR0) {
    26202620        delete [] reinterpret_cast<char*>(re);
    2621         return returnError(errorcode, errorptr);
     2621        return returnError(errorcode, errorPtr);
    26222622    }
    26232623   
     
    26352635        re->options |= IsAnchoredOption;
    26362636    else {
    2637         if (firstbyte < 0) {
    2638             firstbyte = (cd.needOuterBracket
     2637        if (firstByte < 0) {
     2638            firstByte = (cd.needOuterBracket
    26392639                    ? bracketFindFirstAssertedCharacter(codeStart, false)
    26402640                    : branchFindFirstAssertedCharacter(codeStart, false))
    26412641                | ((re->options & IgnoreCaseOption) ? REQ_IGNORE_CASE : 0);
    26422642        }
    2643         if (firstbyte >= 0) {
    2644             int ch = firstbyte & 255;
     2643        if (firstByte >= 0) {
     2644            int ch = firstByte & 255;
    26452645            if (ch < 127) {
    2646                 re->first_byte = ((firstbyte & REQ_IGNORE_CASE) && flipCase(ch) == ch) ? ch : firstbyte;
     2646                re->firstByte = ((firstByte & REQ_IGNORE_CASE) && flipCase(ch) == ch) ? ch : firstByte;
    26472647                re->options |= UseFirstByteOptimizationOption;
    26482648            }
     
    26572657     bytes. */
    26582658   
    2659     if (reqbyte >= 0 && (!(re->options & IsAnchoredOption) || (reqbyte & REQ_VARY))) {
    2660         int ch = reqbyte & 255;
     2659    if (reqByte >= 0 && (!(re->options & IsAnchoredOption) || (reqByte & REQ_VARY))) {
     2660        int ch = reqByte & 255;
    26612661        if (ch < 127) {
    2662             re->req_byte = ((reqbyte & REQ_IGNORE_CASE) && flipCase(ch) == ch) ? (reqbyte & ~REQ_IGNORE_CASE) : reqbyte;
     2662            re->reqByte = ((reqByte & REQ_IGNORE_CASE) && flipCase(ch) == ch) ? (reqByte & ~REQ_IGNORE_CASE) : reqByte;
    26632663            re->options |= UseRequiredByteOptimizationOption;
    26642664        }
     
    26662666   
    26672667    if (numSubpatterns)
    2668         *numSubpatterns = re->top_bracket;
     2668        *numSubpatterns = re->topBracket;
    26692669    return re;
    26702670}
Note: See TracChangeset for help on using the changeset viewer.