jscript: Rename JSREG_* defines to REG_*.
This commit is contained in:
parent
6b474b555e
commit
4c6a1d1d92
|
@ -165,7 +165,7 @@ HRESULT regexp_match_next(script_ctx_t *ctx, jsdisp_t *dispex, DWORD rem_flags,
|
||||||
heap_pool_t *mark;
|
heap_pool_t *mark;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
if((rem_flags & REM_CHECK_GLOBAL) && !(regexp->jsregexp->flags & JSREG_GLOB))
|
if((rem_flags & REM_CHECK_GLOBAL) && !(regexp->jsregexp->flags & REG_GLOB))
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
mark = heap_pool_mark(&ctx->tmp_heap);
|
mark = heap_pool_mark(&ctx->tmp_heap);
|
||||||
|
@ -216,7 +216,7 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *str, B
|
||||||
|
|
||||||
ret[i++] = cres;
|
ret[i++] = cres;
|
||||||
|
|
||||||
if(!gflag && !(This->jsregexp->flags & JSREG_GLOB)) {
|
if(!gflag && !(This->jsregexp->flags & REG_GLOB)) {
|
||||||
hres = S_OK;
|
hres = S_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ static HRESULT run_exec(script_ctx_t *ctx, vdisp_t *jsthis, jsval_t arg, jsstr_t
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
if(regexp->jsregexp->flags & JSREG_GLOB) {
|
if(regexp->jsregexp->flags & REG_GLOB) {
|
||||||
if(regexp->last_index < 0) {
|
if(regexp->last_index < 0) {
|
||||||
jsstr_release(string);
|
jsstr_release(string);
|
||||||
set_last_index(regexp, 0);
|
set_last_index(regexp, 0);
|
||||||
|
@ -668,7 +668,7 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, jsstr_t *str, jsval
|
||||||
jsdisp_t *array;
|
jsdisp_t *array;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
if(!(regexp->jsregexp->flags & JSREG_GLOB)) {
|
if(!(regexp->jsregexp->flags & REG_GLOB)) {
|
||||||
match_result_t match, *parens = NULL;
|
match_result_t match, *parens = NULL;
|
||||||
DWORD parens_cnt, parens_size = 0;
|
DWORD parens_cnt, parens_size = 0;
|
||||||
const WCHAR *cp = str->str;
|
const WCHAR *cp = str->str;
|
||||||
|
@ -991,16 +991,16 @@ HRESULT parse_regexp_flags(const WCHAR *str, DWORD str_len, DWORD *ret)
|
||||||
for (p = str; p < str+str_len; p++) {
|
for (p = str; p < str+str_len; p++) {
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case 'g':
|
case 'g':
|
||||||
flags |= JSREG_GLOB;
|
flags |= REG_GLOB;
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
flags |= JSREG_FOLD;
|
flags |= REG_FOLD;
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
flags |= JSREG_MULTILINE;
|
flags |= REG_MULTILINE;
|
||||||
break;
|
break;
|
||||||
case 'y':
|
case 'y':
|
||||||
flags |= JSREG_STICKY;
|
flags |= REG_STICKY;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARN("wrong flag %c\n", *p);
|
WARN("wrong flag %c\n", *p);
|
||||||
|
|
|
@ -638,14 +638,14 @@ EmitREBytecode(CompilerState *state, JSRegExp *re, size_t treeDepth,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (t->kid && t->u.flat.length > 1) {
|
if (t->kid && t->u.flat.length > 1) {
|
||||||
pc[-1] = (state->flags & JSREG_FOLD) ? REOP_FLATi : REOP_FLAT;
|
pc[-1] = (state->flags & REG_FOLD) ? REOP_FLATi : REOP_FLAT;
|
||||||
pc = WriteCompactIndex(pc, (WCHAR*)t->kid - state->cpbegin);
|
pc = WriteCompactIndex(pc, (WCHAR*)t->kid - state->cpbegin);
|
||||||
pc = WriteCompactIndex(pc, t->u.flat.length);
|
pc = WriteCompactIndex(pc, t->u.flat.length);
|
||||||
} else if (t->u.flat.chr < 256) {
|
} else if (t->u.flat.chr < 256) {
|
||||||
pc[-1] = (state->flags & JSREG_FOLD) ? REOP_FLAT1i : REOP_FLAT1;
|
pc[-1] = (state->flags & REG_FOLD) ? REOP_FLAT1i : REOP_FLAT1;
|
||||||
*pc++ = (jsbytecode) t->u.flat.chr;
|
*pc++ = (jsbytecode) t->u.flat.chr;
|
||||||
} else {
|
} else {
|
||||||
pc[-1] = (state->flags & JSREG_FOLD)
|
pc[-1] = (state->flags & REG_FOLD)
|
||||||
? REOP_UCFLAT1i
|
? REOP_UCFLAT1i
|
||||||
: REOP_UCFLAT1;
|
: REOP_UCFLAT1;
|
||||||
SET_ARG(pc, t->u.flat.chr);
|
SET_ARG(pc, t->u.flat.chr);
|
||||||
|
@ -804,7 +804,7 @@ ProcessOp(CompilerState *state, REOpData *opData, RENode **operandStack,
|
||||||
*/
|
*/
|
||||||
if (((RENode *) result->kid)->op == REOP_FLAT &&
|
if (((RENode *) result->kid)->op == REOP_FLAT &&
|
||||||
((RENode *) result->u.kid2)->op == REOP_FLAT &&
|
((RENode *) result->u.kid2)->op == REOP_FLAT &&
|
||||||
(state->flags & JSREG_FOLD) == 0) {
|
(state->flags & REG_FOLD) == 0) {
|
||||||
result->op = REOP_ALTPREREQ;
|
result->op = REOP_ALTPREREQ;
|
||||||
result->u.altprereq.ch1 = ((RENode *) result->kid)->u.flat.chr;
|
result->u.altprereq.ch1 = ((RENode *) result->kid)->u.flat.chr;
|
||||||
result->u.altprereq.ch2 = ((RENode *) result->u.kid2)->u.flat.chr;
|
result->u.altprereq.ch2 = ((RENode *) result->u.kid2)->u.flat.chr;
|
||||||
|
@ -816,7 +816,7 @@ ProcessOp(CompilerState *state, REOpData *opData, RENode **operandStack,
|
||||||
if (((RENode *) result->kid)->op == REOP_CLASS &&
|
if (((RENode *) result->kid)->op == REOP_CLASS &&
|
||||||
((RENode *) result->kid)->u.ucclass.index < 256 &&
|
((RENode *) result->kid)->u.ucclass.index < 256 &&
|
||||||
((RENode *) result->u.kid2)->op == REOP_FLAT &&
|
((RENode *) result->u.kid2)->op == REOP_FLAT &&
|
||||||
(state->flags & JSREG_FOLD) == 0) {
|
(state->flags & REG_FOLD) == 0) {
|
||||||
result->op = REOP_ALTPREREQ2;
|
result->op = REOP_ALTPREREQ2;
|
||||||
result->u.altprereq.ch1 = ((RENode *) result->u.kid2)->u.flat.chr;
|
result->u.altprereq.ch1 = ((RENode *) result->u.kid2)->u.flat.chr;
|
||||||
result->u.altprereq.ch2 = ((RENode *) result->kid)->u.ucclass.index;
|
result->u.altprereq.ch2 = ((RENode *) result->kid)->u.ucclass.index;
|
||||||
|
@ -828,7 +828,7 @@ ProcessOp(CompilerState *state, REOpData *opData, RENode **operandStack,
|
||||||
if (((RENode *) result->kid)->op == REOP_FLAT &&
|
if (((RENode *) result->kid)->op == REOP_FLAT &&
|
||||||
((RENode *) result->u.kid2)->op == REOP_CLASS &&
|
((RENode *) result->u.kid2)->op == REOP_CLASS &&
|
||||||
((RENode *) result->u.kid2)->u.ucclass.index < 256 &&
|
((RENode *) result->u.kid2)->u.ucclass.index < 256 &&
|
||||||
(state->flags & JSREG_FOLD) == 0) {
|
(state->flags & REG_FOLD) == 0) {
|
||||||
result->op = REOP_ALTPREREQ2;
|
result->op = REOP_ALTPREREQ2;
|
||||||
result->u.altprereq.ch1 = ((RENode *) result->kid)->u.flat.chr;
|
result->u.altprereq.ch1 = ((RENode *) result->kid)->u.flat.chr;
|
||||||
result->u.altprereq.ch2 =
|
result->u.altprereq.ch2 =
|
||||||
|
@ -1108,11 +1108,11 @@ lexHex:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (state->flags & JSREG_FOLD)
|
if (state->flags & REG_FOLD)
|
||||||
rangeStart = localMax; /* one run of the uc/dc loop below */
|
rangeStart = localMax; /* one run of the uc/dc loop below */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state->flags & JSREG_FOLD) {
|
if (state->flags & REG_FOLD) {
|
||||||
WCHAR maxch = localMax;
|
WCHAR maxch = localMax;
|
||||||
|
|
||||||
for (i = rangeStart; i <= localMax; i++) {
|
for (i = rangeStart; i <= localMax; i++) {
|
||||||
|
@ -2009,7 +2009,7 @@ BackrefMatcher(REGlobalData *gData, REMatchState *x, size_t parenIndex)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
parenContent = &gData->cpbegin[cap->index];
|
parenContent = &gData->cpbegin[cap->index];
|
||||||
if (gData->regexp->flags & JSREG_FOLD) {
|
if (gData->regexp->flags & REG_FOLD) {
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (toupperW(parenContent[i]) != toupperW(x->cp[i]))
|
if (toupperW(parenContent[i]) != toupperW(x->cp[i]))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2233,7 +2233,7 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
|
||||||
|
|
||||||
}
|
}
|
||||||
if (inRange) {
|
if (inRange) {
|
||||||
if (gData->regexp->flags & JSREG_FOLD) {
|
if (gData->regexp->flags & REG_FOLD) {
|
||||||
assert(rangeStart <= thisCh);
|
assert(rangeStart <= thisCh);
|
||||||
for (i = rangeStart; i <= thisCh; i++) {
|
for (i = rangeStart; i <= thisCh; i++) {
|
||||||
WCHAR uch, dch;
|
WCHAR uch, dch;
|
||||||
|
@ -2251,7 +2251,7 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
|
||||||
}
|
}
|
||||||
inRange = FALSE;
|
inRange = FALSE;
|
||||||
} else {
|
} else {
|
||||||
if (gData->regexp->flags & JSREG_FOLD) {
|
if (gData->regexp->flags & REG_FOLD) {
|
||||||
AddCharacterToCharSet(charSet, toupperW(thisCh));
|
AddCharacterToCharSet(charSet, toupperW(thisCh));
|
||||||
AddCharacterToCharSet(charSet, tolowerW(thisCh));
|
AddCharacterToCharSet(charSet, tolowerW(thisCh));
|
||||||
} else {
|
} else {
|
||||||
|
@ -2325,7 +2325,7 @@ SimpleMatch(REGlobalData *gData, REMatchState *x, REOp op,
|
||||||
case REOP_BOL:
|
case REOP_BOL:
|
||||||
if (x->cp != gData->cpbegin) {
|
if (x->cp != gData->cpbegin) {
|
||||||
if (/*!gData->cx->regExpStatics.multiline && FIXME !!! */
|
if (/*!gData->cx->regExpStatics.multiline && FIXME !!! */
|
||||||
!(gData->regexp->flags & JSREG_MULTILINE)) {
|
!(gData->regexp->flags & REG_MULTILINE)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!RE_IS_LINE_TERM(x->cp[-1]))
|
if (!RE_IS_LINE_TERM(x->cp[-1]))
|
||||||
|
@ -2336,7 +2336,7 @@ SimpleMatch(REGlobalData *gData, REMatchState *x, REOp op,
|
||||||
case REOP_EOL:
|
case REOP_EOL:
|
||||||
if (x->cp != gData->cpend) {
|
if (x->cp != gData->cpend) {
|
||||||
if (/*!gData->cx->regExpStatics.multiline &&*/
|
if (/*!gData->cx->regExpStatics.multiline &&*/
|
||||||
!(gData->regexp->flags & JSREG_MULTILINE)) {
|
!(gData->regexp->flags & REG_MULTILINE)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!RE_IS_LINE_TERM(*x->cp))
|
if (!RE_IS_LINE_TERM(*x->cp))
|
||||||
|
@ -2532,7 +2532,7 @@ ExecuteREBytecode(REGlobalData *gData, REMatchState *x)
|
||||||
* If the first node is a simple match, step the index into the string
|
* If the first node is a simple match, step the index into the string
|
||||||
* until that match is made, or fail if it can't be found at all.
|
* until that match is made, or fail if it can't be found at all.
|
||||||
*/
|
*/
|
||||||
if (REOP_IS_SIMPLE(op) && !(gData->regexp->flags & JSREG_STICKY)) {
|
if (REOP_IS_SIMPLE(op) && !(gData->regexp->flags & REG_STICKY)) {
|
||||||
anchor = FALSE;
|
anchor = FALSE;
|
||||||
while (x->cp <= gData->cpend) {
|
while (x->cp <= gData->cpend) {
|
||||||
nextpc = pc; /* reset back to start each time */
|
nextpc = pc; /* reset back to start each time */
|
||||||
|
@ -3063,7 +3063,7 @@ static REMatchState *MatchRegExp(REGlobalData *gData, REMatchState *x)
|
||||||
for (j = 0; j < gData->regexp->parenCount; j++)
|
for (j = 0; j < gData->regexp->parenCount; j++)
|
||||||
x->parens[j].index = -1;
|
x->parens[j].index = -1;
|
||||||
result = ExecuteREBytecode(gData, x);
|
result = ExecuteREBytecode(gData, x);
|
||||||
if (!gData->ok || result || (gData->regexp->flags & JSREG_STICKY))
|
if (!gData->ok || result || (gData->regexp->flags & REG_STICKY))
|
||||||
return result;
|
return result;
|
||||||
gData->backTrackSP = gData->backTrackStack;
|
gData->backTrackSP = gData->backTrackStack;
|
||||||
gData->cursz = 0;
|
gData->cursz = 0;
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
* the Initial Developer. All Rights Reserved.
|
* the Initial Developer. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define JSREG_FOLD 0x01 /* fold uppercase to lowercase */
|
#define REG_FOLD 0x01 /* fold uppercase to lowercase */
|
||||||
#define JSREG_GLOB 0x02 /* global exec, creates array of matches */
|
#define REG_GLOB 0x02 /* global exec, creates array of matches */
|
||||||
#define JSREG_MULTILINE 0x04 /* treat ^ and $ as begin and end of line */
|
#define REG_MULTILINE 0x04 /* treat ^ and $ as begin and end of line */
|
||||||
#define JSREG_STICKY 0x08 /* only match starting at lastIndex */
|
#define REG_STICKY 0x08 /* only match starting at lastIndex */
|
||||||
|
|
||||||
typedef struct RECapture {
|
typedef struct RECapture {
|
||||||
ptrdiff_t index; /* start of contents, -1 for empty */
|
ptrdiff_t index; /* start of contents, -1 for empty */
|
||||||
|
@ -73,7 +73,7 @@ typedef struct RECharSet {
|
||||||
} RECharSet;
|
} RECharSet;
|
||||||
|
|
||||||
typedef struct JSRegExp {
|
typedef struct JSRegExp {
|
||||||
WORD flags; /* flags, see jsapi.h's JSREG_* defines */
|
WORD flags; /* flags, see jsapi.h's REG_* defines */
|
||||||
size_t parenCount; /* number of parenthesized submatches */
|
size_t parenCount; /* number of parenthesized submatches */
|
||||||
size_t classCount; /* count [...] bitmaps */
|
size_t classCount; /* count [...] bitmaps */
|
||||||
RECharSet *classList; /* list of [...] bitmaps */
|
RECharSet *classList; /* list of [...] bitmaps */
|
||||||
|
|
Loading…
Reference in New Issue