JS_ReportError(state->context, "invalid range in character class");
JS_ReportErrorNumber(state->context, NULL, JSMSG_BAD_CLASS_RANGE);
EmitRegExp(CompilerState *state, RENode *ren, JSRegExp *re){    REOp op;    jsbytecode *pc, fill;    RENode *next;    ptrdiff_t diff;    jschar *cp, *end, *ocp;    uintN b, c, i, j, n, lastc, foldc, nchars;    JSBool inrange;    do {	op = REOP(ren);	if (op == REOP_END)	    return JS_TRUE;	pc = &re->program[state->progLength];	state->progLength += reopsize[ren->op];	pc[0] = ren->op;	next = ren->next;	switch (op) {	  case REOP_ALT:	    diff = next->offset - ren->offset;	    SET_JUMP_OFFSET(pc, diff);	    if (!EmitRegExp(state, ren->kid, re))		return JS_FALSE;	    break;	  case REOP_QUANT:	    diff = next->offset - ren->offset;	    SET_JUMP_OFFSET(pc, diff);	    pc += 2;	    SET_ARGNO(pc, ren->u.range.min);	    pc += 2;	    SET_ARGNO(pc, ren->u.range.max);	    if (!EmitRegExp(state, ren->kid, re))		return JS_FALSE;	    break;	  case REOP_STAR:	  case REOP_PLUS:	  case REOP_OPT:	  case REOP_ANCHOR1:	    if (!EmitRegExp(state, ren->kid, re))		return JS_FALSE;	    break;	  case REOP_LPAREN:	    SET_ARGNO(pc, ren->u.num);	    if (!EmitRegExp(state, ren->kid, re))		return JS_FALSE;	    break;	  case REOP_RPAREN:	    SET_ARGNO(pc, ren->u.num);	    break;	  case REOP_CCLASS:	  case REOP_UCCLASS:	    cp = ren->kid;	    if (*cp == '^') {		pc[0] = (jsbytecode)			((op == REOP_CCLASS) ? REOP_NCCLASS : REOP_NUCCLASS);		fill = 0xff;		cp++;	    } else {		fill = 0;	    }	    pc++;	    if (op == REOP_CCLASS) {		end = ren->u.kid2;		for (i = 0; i < CCLASS_CHARSET_SIZE / PR_BITS_PER_BYTE; i++)		    pc[i] = fill;		nchars = CCLASS_CHARSET_SIZE;	    } else {		end = cp + ren->u.ucclass.kidlen;		n = (uintN)ren->u.ucclass.bmsize;		*pc++ = (jsbytecode)(n >> 8);		*pc++ = (jsbytecode)n;		state->progLength += n;		for (i = 0; i < n; i++)		    pc[i] = fill;		nchars = n * PR_BITS_PER_BYTE;	    }/* Split ops up into statements to keep MSVC1.52 from crashing. */#define MATCH_BIT(c)    { i = (c) >> 3; b = (c) & 7; b = 1 << b;              \			  if (fill) pc[i] &= ~b; else pc[i] |= b; }	    lastc = nchars;	    inrange = JS_FALSE;	    while (cp < end) {		c = (uintN) *cp++;		if (c == '\\') {		    c = *cp++;		    switch (c) {		      case 'b':		      case 'f':		      case 'n':		      case 'r':		      case 't':		      case 'v':			c = js_strchr(js_EscapeMap, (jschar)c)[-1];			break;#define CHECK_RANGE() if (inrange) { MATCH_BIT(lastc); MATCH_BIT('-');        \				     inrange = JS_FALSE; }		      case 'd':			CHECK_RANGE();			for (c = '0'; c <= '9'; c++)			    MATCH_BIT(c);			continue;		      case 'D':			CHECK_RANGE();			for (c = 0; c < '0'; c++)			    MATCH_BIT(c);			for (c = '9' + 1; c < nchars; c++)			    MATCH_BIT(c);			continue;		      case 'w':			CHECK_RANGE();			for (c = 0; c < nchars; c++)			    if (JS_ISWORD(c))				MATCH_BIT(c);			continue;		      case 'W':			CHECK_RANGE();			for (c = 0; c < nchars; c++)			    if (!JS_ISWORD(c))				MATCH_BIT(c);			continue;		      case 's':			CHECK_RANGE();			for (c = 0; c < nchars; c++)			    if (JS_ISSPACE(c))				MATCH_BIT(c);			continue;		      case 'S':			CHECK_RANGE();			for (c = 0; c < nchars; c++)			    if (!JS_ISSPACE(c))				MATCH_BIT(c);			continue;#undef CHECK_RANGE		      case '0':		      case '1':		      case '2':		      case '3':		      case '4':		      case '5':		      case '6':		      case '7':			n = JS7_UNDEC(c);			ocp = cp - 2;			c = *cp;			if ('0' <= c && c <= '7') {			    cp++;			    n = 8 * n + JS7_UNDEC(c);			    c = *cp;			    if ('0' <= c && c <= '7') {				cp++;				i = 8 * n + JS7_UNDEC(c);				if (i <= 0377)				    n = i;				else				    cp--;			    }			}			c = n;			break;		      case 'x':			ocp = cp;			c = *cp++;			if (JS7_ISHEX(c)) {			    n = JS7_UNHEX(c);			    c = *cp++;			    if (JS7_ISHEX(c)) {				n <<= 4;				n += JS7_UNHEX(c);			    }			} else {			    cp = ocp;	/* \xZZ is xZZ (Perl does \0ZZ!) */			    n = 'x';			}			c = n;			break;		      case 'u':			if (JS7_ISHEX(cp[0]) && JS7_ISHEX(cp[1]) &&			    JS7_ISHEX(cp[2]) && JS7_ISHEX(cp[3])) {			    n = (((((JS7_UNHEX(cp[0]) << 4)				    + JS7_UNHEX(cp[1])) << 4)				  + JS7_UNHEX(cp[2])) << 4)				+ JS7_UNHEX(cp[3]);			    c = n;			    cp += 4;			}			break;		      case 'c':			c = *cp++;			c = JS_TOUPPER(c);			c = JS_TOCTRL(c);			break;		    }		}		if (inrange) {		    if (lastc > c) {			JS_ReportError(state->context,				       "invalid range in character class");			return JS_FALSE;		    }		    inrange = JS_FALSE;		} else {		    /* Set lastc so we match just c's bit in the for loop. */		    lastc = c;		    /* [balance: */		    if (*cp == '-' && cp + 1 < end && cp[1] != ']') {			cp++;			inrange = JS_TRUE;			continue;		    }		}		/* Match characters in the range [lastc, c]. */		for (; lastc <= c; lastc++) {		    MATCH_BIT(lastc);		    if (state->flags & JSREG_FOLD) {			/*			 * Must do both upper and lower for Turkish dotless i,			 * Georgian, etc.			 */			foldc = JS_TOUPPER(lastc);			MATCH_BIT(foldc);			foldc = JS_TOLOWER(foldc);			MATCH_BIT(foldc);		    }		}		lastc = c;	    }#undef MATCH_BIT	    break;	  case REOP_BACKREF:	    if (state->flags & JSREG_FOLD)		pc[0] = (jsbytecode)REOP_BACKREFi;	    pc[1] = (jsbytecode)ren->u.num;	    break;	  case REOP_FLAT:	    if (state->flags & JSREG_FOLD)		pc[0] = (jsbytecode)REOP_FLATi;	    goto emit_flat;	  case REOP_UCFLAT:	    if (state->flags & JSREG_FOLD)		pc[0] = (jsbytecode)REOP_UCFLATi;	  emit_flat:	    cp = ren->kid;	    diff = (jschar *)ren->u.kid2 - cp;	    pc[1] = (jsbytecode)diff;	    pc += 2;	    state->progLength += diff;	    if (op == REOP_UCFLAT)		state->progLength += diff;	    for (i = j = 0; i < (uintN)diff; i++, j++) {		c = (uintN)cp[i];		/*		 * Lay down immediate chars in native byte order so memcmp		 * with a JSString's chars works.		 */#if IS_BIG_ENDIAN		if (op == REOP_UCFLAT)		    pc[j++] = (jsbytecode)(c >> 8);#endif		pc[j] = (jsbytecode)c;#if IS_LITTLE_ENDIAN		if (op == REOP_UCFLAT)		    pc[j++] = (jsbytecode)(c >> 8);#endif	    }	    break;	  case REOP_FLAT1:	    if (state->flags & JSREG_FOLD)		pc[0] = (jsbytecode)REOP_FLAT1i;	    pc[1] = (jsbytecode)ren->u.chr;	    break;	  case REOP_UCFLAT1:	    if (state->flags & JSREG_FOLD)		pc[0] = (jsbytecode)REOP_UCFLAT1i;	    c = (uintN)ren->u.chr;	    pc[1] = (jsbytecode)(c >> 8);	    pc[2] = (jsbytecode)c;	    break;	  case REOP_JUMP:	    diff = next->offset - ren->offset;	    SET_JUMP_OFFSET(pc, diff);	    break;	  default:;	}	if (!(ren->flags & RENODE_GOODNEXT))	    break;    } while ((ren = next) != NULL);    return JS_TRUE;}