if (seenmonthname) { if (mday >= 70 && year >= 70 || mday < 70 && year < 70) { goto syntax; } if (mday > year) { temp = year; year = mday; mday = temp; } if (year >= 70 && year < 100) { year += 1900; } } else if (mon < 70) {  if (year < 100) { year += 1900; } } else if (mon < 100) {  if (mday < 70) { temp = year; year = mon + 1900; mon = mday; mday = temp; } else { goto syntax; } } else {  if (mday < 70) { temp = year; year = mon; mon = mday; mday = temp; } else { goto syntax; } } mon -= 1;
date_parseString(JSString *str, jsdouble *result){    jsdouble msec;    const jschar *s = JSSTRING_CHARS(str);    size_t limit = JSSTRING_LENGTH(str);    size_t i = 0;    int year = -1;    int mon = -1;    int mday = -1;    int hour = -1;    int min = -1;    int sec = -1;    int c = -1;    int n = -1;    jsdouble tzoffset = -1;  /* was an int, overflowed on win16!!! */    int prevc = 0;    JSBool seenplusminus = JS_FALSE;    if (limit == 0)        goto syntax;    while (i < limit) {        c = s[i];        i++;        if (c <= ' ' || c == ',' || c == '-') {            if (c == '-' && '0' <= s[i] && s[i] <= '9') {              prevc = c;            }            continue;        }        if (c == '(') { /* comments) */            int depth = 1;            while (i < limit) {                c = s[i];                i++;                if (c == '(') depth++;                else if (c == ')')                    if (--depth <= 0)                        break;            }            continue;        }        if ('0' <= c && c <= '9') {            n = c - '0';            while (i < limit && '0' <= (c = s[i]) && c <= '9') {                n = n * 10 + c - '0';                i++;            }            /* allow TZA before the year, so             * 'Wed Nov 05 21:49:11 GMT-0800 1997'             * works */            /* uses of seenplusminus allow : in TZA, so Java             * no-timezone style of GMT+4:30 works             */            if ((prevc == '+' || prevc == '-')/*  && year>=0 */) {                /* make ':' case below change tzoffset */                seenplusminus = JS_TRUE;                /* offset */                if (n < 24)                    n = n * 60; /* EG. "GMT-3" */                else                    n = n % 100 + n / 100 * 60; /* eg "GMT-0430" */                if (prevc == '+')       /* plus means east of GMT */                    n = -n;                if (tzoffset != 0 && tzoffset != -1)                    goto syntax;                tzoffset = n;            } else if (n >= 70 ||                       (prevc == '/' && mon >= 0 && mday >= 0 && year < 0)) {                if (mday < 0)                    mday = n;                else if (year >= 0)                    goto syntax;                else if (c <= ' ' || c == ',' || c == '/' || i >= limit)                    year = n < 100 ? n + 1900 : n;                else                    goto syntax;            } else if (c == ':') {                if (hour < 0)                    hour = /*byte*/ n;                else if (min < 0)                    min = /*byte*/ n;                else                    goto syntax;            } else if (c == '/') {                if (mon < 0)                    mon = /*byte*/ n-1;                else if (mday < 0)                    mday = /*byte*/ n;                else                    goto syntax;            } else if (i < limit && c != ',' && c > ' ' && c != '-') {                goto syntax;            } else if (seenplusminus && n < 60) {  /* handle GMT-3:30 */                if (tzoffset < 0)                    tzoffset -= n;                else                    tzoffset += n;            } else if (hour >= 0 && min < 0) {                min = /*byte*/ n;            } else if (min >= 0 && sec < 0) {                sec = /*byte*/ n;            } else if (mday < 0) {                mday = /*byte*/ n;            } else {                goto syntax;            }            prevc = 0;        } else if (c == '/' || c == ':' || c == '+' || c == '-') {            prevc = c;        } else {            size_t st = i - 1;            int k;            while (i < limit) {                c = s[i];                if (!(('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')))                    break;                i++;            }            if (i <= st + 1)                goto syntax;            for (k = (sizeof(wtb)/sizeof(char*)); --k >= 0;)                if (date_regionMatches(wtb[k], 0, s, st, i-st, 1)) {                    int action = ttb[k];                    if (action != 0) {                        if (action < 0) {                            /*                             * AM/PM. Count 12:30 AM as 00:30, 12:30 PM as                             * 12:30, instead of blindly adding 12 if PM.                             */                            JS_ASSERT(action == -1 || action == -2);                            if (hour > 12 || hour < 0) {                                goto syntax;                            } else {                                if (action == -1 && hour == 12) { /* am */                                    hour = 0;                                } else if (action == -2 && hour != 12) { /* pm */                                    hour += 12;                                }                            }                        } else if (action <= 13) { /* month! */                            if (mon < 0) {                                mon = /*byte*/ (action - 2);                            } else {                                goto syntax;                            }                        } else {                            tzoffset = action - 10000;                        }                    }                    break;                }            if (k < 0)                goto syntax;            prevc = 0;        }    }    if (year < 0 || mon < 0 || mday < 0)        goto syntax;    if (sec < 0)        sec = 0;    if (min < 0)        min = 0;    if (hour < 0)        hour = 0;    if (tzoffset == -1) { /* no time zone specified, have to use local */        jsdouble msec_time;        msec_time = date_msecFromDate(year, mon, mday, hour, min, sec, 0);        *result = UTC(msec_time);        return JS_TRUE;    }    msec = date_msecFromDate(year, mon, mday, hour, min, sec, 0);    msec += tzoffset * msPerMinute;    *result = msec;    return JS_TRUE;syntax:    /* syntax error */    *result = 0;    return JS_FALSE;}