Exemple #1
0
Token* Scanner::NextToken() {
	while (ch == ' ' ||
			ch == 10 || ch == 13
	) NextCh();

	int recKind = noSym;
	int recEnd = pos;
	t = CreateToken();
	t->pos = pos; t->col = col; t->line = line; t->charPos = charPos;
	int state = start.state(ch);
	tlen = 0; AddCh();

	switch (state) {
		case -1: { t->kind = eofSym; break; } // NextCh already done
		case 0: {
			case_0:
			if (recKind != noSym) {
				tlen = recEnd - t->pos;
				SetScannerBehindT();
			}
			t->kind = recKind; break;
		} // NextCh already done
		case 1:
			case_1:
			recEnd = pos; recKind = 1;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_1;}
			else {t->kind = 1; break;}
		case 2:
			if (ch == L'a') {AddCh(); goto case_3;}
			else {goto case_0;}
		case 3:
			case_3:
			if (ch == L'l') {AddCh(); goto case_4;}
			else {goto case_0;}
		case 4:
			case_4:
			if (ch == L'c') {AddCh(); goto case_5;}
			else {goto case_0;}
		case 5:
			case_5:
			{t->kind = 2; break;}
		case 6:
			{t->kind = 3; break;}
		case 7:
			{t->kind = 4; break;}
		case 8:
			{t->kind = 5; break;}
		case 9:
			{t->kind = 6; break;}
		case 10:
			{t->kind = 7; break;}
		case 11:
			{t->kind = 8; break;}

	}
	AppendVal(t);
	return t;
}
void CButton::DoDraw()
{
    if (Focused() || has_colors())
    {
        int y = (Height()-1)/2; // Center
        AddCh(this, 0, y, '<');
        AddCh(this, Width()-1, y, '>');
    }
}
Token* Scanner::NextToken() {
	while (ch == ' ' ||
			ch == 10 || ch == 13
	) NextCh();

	int recKind = noSym;
	int recEnd = pos;
	t = CreateToken();
	t->pos = pos; t->col = col; t->line = line;
	int state = start.state(ch);
	tlen = 0; AddCh();

	switch (state) {
		case -1: { t->kind = eofSym; break; } // NextCh already done
		case 0: {
			case_0:
			if (recKind != noSym) {
				tlen = recEnd - t->pos;
				SetScannerBehindT();
			}
			t->kind = recKind; break;
		} // NextCh already done
		case 1:
			case_1:
			recEnd = pos; recKind = 1;
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_1;}
			else {t->kind = 1; wchar_t *literal = coco_string_create(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 2:
			case_2:
			recEnd = pos; recKind = 2;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_2;}
			else {t->kind = 2; break;}
		case 3:
			if (ch == L'=') {AddCh(); goto case_4;}
			else {goto case_0;}
		case 4:
			case_4:
			{t->kind = 3; break;}
		case 5:
			{t->kind = 4; break;}
		case 6:
			{t->kind = 5; break;}
		case 7:
			{t->kind = 6; break;}
		case 8:
			{t->kind = 8; break;}
		case 9:
			{t->kind = 9; break;}

	}
	AppendVal(t);
	return t;
}
static void print_bit_string(OE oe, Data bs) {

	char buf[512] = {0};
	uint idx = 0;
	uint i = 0;
	uint length = (sizeof(buf)-2) > bs->ldata*8 ? bs->ldata*8 : sizeof(buf)-2;

	AddCh(buf,'\n',idx);
	for(i = 0; i < bs->ldata*8 && idx < sizeof(buf)-2;++i) {
		byte bit = get_bit(bs->data,i);
		// add white space
		if (i > 0 && i % 24 == 0) {
			AddCh(buf,'\n',idx);
		} else {
			if (i > 0 && i % 8 == 0) {
				AddCh(buf,' ',idx);
			}
		}
		if (bit == 1) {
			AddCh(buf,'1',idx);
		} else {
			AddCh(buf,'0',idx);
		}
	}
	AddCh(buf,'\n',idx);
	AddCh(buf,0,idx);
	oe->p(buf);
}
static void
printcard(int value)
{
    AddCh(' ');
    if (value == NOCARD) {
	(void) addstr("   ");
    } else {
	int which = (value / SUIT_LENGTH);
	int isuit = (value % SUIT_LENGTH);
	chtype color = (chtype) COLOR_PAIR(((which % 2) == 0)
					   ? RED_ON_WHITE
					   : BLACK_ON_WHITE);

	AddCh(ranks[isuit][0] | (chtype) COLOR_PAIR(BLUE_ON_WHITE));
	AddCh(ranks[isuit][1] | (chtype) COLOR_PAIR(BLUE_ON_WHITE));

#ifdef NCURSES_VERSION
	(attron) ((int) color);	/* quieter compiler warnings */
#else
	attron(color);		/* PDCurses, etc., either no macro or wrong */
#endif
#if USE_WIDEC_SUPPORT
	{
	    wchar_t values[2];
	    values[0] = (wchar_t) suits[which];
	    values[1] = 0;
	    addwstr(values);
	}
#else
	AddCh(suits[which]);
#endif
#ifdef NCURSES_VERSION
	(attroff) ((int) color);
#else
	attroff(color);
#endif
    }
    AddCh(' ');
}
void CProgressBar::DoDraw()
{
    float maxw = SafeConvert<float>(Width()) - 2.0f; // -2 for the borders
    const float range = m_fMax - m_fMin;
    float fac = (range > 0.0f) ? (m_fCurrent / range) : 0.0f;
    
    EnableColors(true);
    
    int fill = SafeConvert<int>(maxw * fac);
    
    for (int i=0; i<fill; i++)
        AddCh(this, i+1, 1, ' ');
    
    EnableColors(false);
}
Exemple #7
0
/* "valid" string.                                              */
wchar_t
prompt_char(int row, int col, const char *promptstr, const char *valid)
{
	wchar_t *w_prompt, *w_valid=NULL, ch;
   
	int code;

	w_prompt = mbstowcs_alloc(promptstr);

	/* if w_promptstr == NULL ?? .... */

	/* Print the prompt.                                        */
	mvaddwstr(row, col, w_prompt);
	clrtoeol();
	refresh();

    if ( valid  != NULL ) {
            w_valid  = mbstowcs_alloc(valid);
    }
	/* Read characters...                                       */
	while ((code = get_wch(&ch)) != ERR) {
		/* If it's not a valid one, beep and get another one.   */
		/* if (index(valid, c) == NULL) { */
        if ( valid  != NULL ) {
		    if (wcsrchr(w_valid, ch) == NULL) {	/* CHANGED !! */
			    beep();
			    continue;
		    }

		    /* Add the character to the screen, and return it.      */
		    AddCh((chtype) ch);
		    refresh();
        }
		goto _exit;
	}
 _exit:
	free(w_prompt);
	refresh();
    if (valid != NULL ) {
	    free(w_valid);
        w_valid= NULL ;
        return (ch);		/* to avoid compiler warning */
    } else {
        return '\0' ;
   }
}
Exemple #8
0
Token* Scanner::NextToken() {
    while (ch == ' ' ||
            (ch >= 9 && ch <= 10) || ch == 13
          ) NextCh();
    if ((ch == L'/' && Comment0()) || (ch == L'/' && Comment1()) || (ch == L'/' && Comment2())) return NextToken();
    int recKind = noSym;
    int recEnd = pos;
    t = CreateToken();
    t->pos = pos;
    t->col = col;
    t->line = line;
    t->charPos = charPos;
    int state = start.state(ch);
    tlen = 0;
    AddCh();

    switch (state) {
    case -1: {
        t->kind = eofSym;    // NextCh already done
        break;
    }
    case 0: {
case_0:
        if (recKind != noSym) {
            tlen = recEnd - t->pos;
            SetScannerBehindT();
        }
        t->kind = recKind;
        break;
    } // NextCh already done
    case 1:
case_1:
        recEnd = pos;
        recKind = 1;
        if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {
            AddCh();
            goto case_1;
        }
        else {
            t->kind = 1;
            wchar_t *literal = coco_string_create(tval, 0, tlen);
            t->kind = keywords.get(literal, t->kind);
            coco_string_delete(literal);
            break;
        }
    case 2:
case_2:
        recEnd = pos;
        recKind = 2;
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_2;
        }
        else if (ch == L'F' || ch == L'L' || ch == L'f' || ch == L'l') {
            AddCh();
            goto case_13;
        }
        else if (ch == L'E' || ch == L'e') {
            AddCh();
            goto case_3;
        }
        else {
            t->kind = 2;
            break;
        }
    case 3:
case_3:
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_5;
        }
        else if (ch == L'+' || ch == L'-') {
            AddCh();
            goto case_4;
        }
        else {
            goto case_0;
        }
    case 4:
case_4:
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_5;
        }
        else {
            goto case_0;
        }
    case 5:
case_5:
        recEnd = pos;
        recKind = 2;
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_5;
        }
        else if (ch == L'F' || ch == L'L' || ch == L'f' || ch == L'l') {
            AddCh();
            goto case_13;
        }
        else {
            t->kind = 2;
            break;
        }
    case 6:
case_6:
        recEnd = pos;
        recKind = 2;
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_6;
        }
        else if (ch == L'F' || ch == L'L' || ch == L'f' || ch == L'l') {
            AddCh();
            goto case_13;
        }
        else if (ch == L'E' || ch == L'e') {
            AddCh();
            goto case_7;
        }
        else {
            t->kind = 2;
            break;
        }
    case 7:
case_7:
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_9;
        }
        else if (ch == L'+' || ch == L'-') {
            AddCh();
            goto case_8;
        }
        else {
            goto case_0;
        }
    case 8:
case_8:
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_9;
        }
        else {
            goto case_0;
        }
    case 9:
case_9:
        recEnd = pos;
        recKind = 2;
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_9;
        }
        else if (ch == L'F' || ch == L'L' || ch == L'f' || ch == L'l') {
            AddCh();
            goto case_13;
        }
        else {
            t->kind = 2;
            break;
        }
    case 10:
case_10:
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_12;
        }
        else if (ch == L'+' || ch == L'-') {
            AddCh();
            goto case_11;
        }
        else {
            goto case_0;
        }
    case 11:
case_11:
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_12;
        }
        else {
            goto case_0;
        }
    case 12:
case_12:
        recEnd = pos;
        recKind = 2;
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_12;
        }
        else if (ch == L'F' || ch == L'L' || ch == L'f' || ch == L'l') {
            AddCh();
            goto case_13;
        }
        else {
            t->kind = 2;
            break;
        }
    case 13:
case_13:
        {
            t->kind = 2;
            break;
        }
    case 14:
case_14:
        recEnd = pos;
        recKind = 3;
        if (ch == L'L' || ch == L'U' || ch == L'l' || ch == L'u') {
            AddCh();
            goto case_14;
        }
        else {
            t->kind = 3;
            break;
        }
    case 15:
case_15:
        if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'F') || (ch >= L'a' && ch <= L'f')) {
            AddCh();
            goto case_16;
        }
        else {
            goto case_0;
        }
    case 16:
case_16:
        recEnd = pos;
        recKind = 3;
        if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'F') || (ch >= L'a' && ch <= L'f')) {
            AddCh();
            goto case_16;
        }
        else if (ch == L'L' || ch == L'U' || ch == L'l' || ch == L'u') {
            AddCh();
            goto case_14;
        }
        else {
            t->kind = 3;
            break;
        }
    case 17:
        if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'&') || (ch >= L'(' && ch <= 65535)) {
            AddCh();
            goto case_18;
        }
        else {
            goto case_0;
        }
    case 18:
case_18:
        if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'&') || (ch >= L'(' && ch <= 65535)) {
            AddCh();
            goto case_18;
        }
        else if (ch == 39) {
            AddCh();
            goto case_19;
        }
        else {
            goto case_0;
        }
    case 19:
case_19:
        {
            t->kind = 4;
            break;
        }
    case 20:
case_20:
        if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'!') || (ch >= L'#' && ch <= 65535)) {
            AddCh();
            goto case_20;
        }
        else if (ch == L'"') {
            AddCh();
            goto case_21;
        }
        else {
            goto case_0;
        }
    case 21:
case_21:
        {
            t->kind = 5;
            break;
        }
    case 22:
    {
        t->kind = 25;
        break;
    }
    case 23:
    {
        t->kind = 26;
        break;
    }
    case 24:
    {
        t->kind = 27;
        break;
    }
    case 25:
    {
        t->kind = 28;
        break;
    }
    case 26:
    {
        t->kind = 29;
        break;
    }
    case 27:
    {
        t->kind = 30;
        break;
    }
    case 28:
    {
        t->kind = 31;
        break;
    }
    case 29:
    {
        t->kind = 32;
        break;
    }
    case 30:
    {
        t->kind = 33;
        break;
    }
    case 31:
    {
        t->kind = 34;
        break;
    }
    case 32:
case_32:
        if (ch == L'.') {
            AddCh();
            goto case_33;
        }
        else {
            goto case_0;
        }
    case 33:
case_33:
        {
            t->kind = 35;
            break;
        }
    case 34:
case_34:
        if (ch == L'e') {
            AddCh();
            goto case_35;
        }
        else {
            goto case_0;
        }
    case 35:
case_35:
        if (ch == L'f') {
            AddCh();
            goto case_36;
        }
        else {
            goto case_0;
        }
    case 36:
case_36:
        if (ch == L'i') {
            AddCh();
            goto case_37;
        }
        else {
            goto case_0;
        }
    case 37:
case_37:
        if (ch == L'n') {
            AddCh();
            goto case_38;
        }
        else {
            goto case_0;
        }
    case 38:
case_38:
        if (ch == L'e') {
            AddCh();
            goto case_39;
        }
        else {
            goto case_0;
        }
    case 39:
case_39:
        if (ch == 10 || ch == 13) {
            AddCh();
            goto case_40;
        }
        else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= 65535)) {
            AddCh();
            goto case_39;
        }
        else {
            goto case_0;
        }
    case 40:
case_40:
        {
            t->kind = 110;
            break;
        }
    case 41:
case_41:
        if (ch == L'n') {
            AddCh();
            goto case_42;
        }
        else {
            goto case_0;
        }
    case 42:
case_42:
        if (ch == L'd') {
            AddCh();
            goto case_43;
        }
        else {
            goto case_0;
        }
    case 43:
case_43:
        if (ch == L'e') {
            AddCh();
            goto case_44;
        }
        else {
            goto case_0;
        }
    case 44:
case_44:
        if (ch == L'f') {
            AddCh();
            goto case_45;
        }
        else {
            goto case_0;
        }
    case 45:
case_45:
        if (ch == 10 || ch == 13) {
            AddCh();
            goto case_46;
        }
        else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= 65535)) {
            AddCh();
            goto case_45;
        }
        else {
            goto case_0;
        }
    case 46:
case_46:
        {
            t->kind = 111;
            break;
        }
    case 47:
case_47:
        if (ch == 10 || ch == 13) {
            AddCh();
            goto case_48;
        }
        else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= 65535)) {
            AddCh();
            goto case_47;
        }
        else {
            goto case_0;
        }
    case 48:
case_48:
        {
            t->kind = 112;
            break;
        }
    case 49:
case_49:
        if (ch == L'f') {
            AddCh();
            goto case_50;
        }
        else {
            goto case_0;
        }
    case 50:
case_50:
        if (ch == 10 || ch == 13) {
            AddCh();
            goto case_51;
        }
        else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= 65535)) {
            AddCh();
            goto case_50;
        }
        else {
            goto case_0;
        }
    case 51:
case_51:
        {
            t->kind = 113;
            break;
        }
    case 52:
case_52:
        if (ch == L'e') {
            AddCh();
            goto case_53;
        }
        else {
            goto case_0;
        }
    case 53:
case_53:
        if (ch == 10 || ch == 13) {
            AddCh();
            goto case_54;
        }
        else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= 65535)) {
            AddCh();
            goto case_53;
        }
        else {
            goto case_0;
        }
    case 54:
case_54:
        {
            t->kind = 114;
            break;
        }
    case 55:
case_55:
        if (ch == L'd') {
            AddCh();
            goto case_56;
        }
        else {
            goto case_0;
        }
    case 56:
case_56:
        if (ch == L'i') {
            AddCh();
            goto case_57;
        }
        else {
            goto case_0;
        }
    case 57:
case_57:
        if (ch == L'f') {
            AddCh();
            goto case_58;
        }
        else {
            goto case_0;
        }
    case 58:
case_58:
        if (ch == 10 || ch == 13) {
            AddCh();
            goto case_59;
        }
        else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= 65535)) {
            AddCh();
            goto case_58;
        }
        else {
            goto case_0;
        }
    case 59:
case_59:
        {
            t->kind = 115;
            break;
        }
    case 60:
case_60:
        if (ch == L'c') {
            AddCh();
            goto case_61;
        }
        else {
            goto case_0;
        }
    case 61:
case_61:
        if (ch == L'l') {
            AddCh();
            goto case_62;
        }
        else {
            goto case_0;
        }
    case 62:
case_62:
        if (ch == L'u') {
            AddCh();
            goto case_63;
        }
        else {
            goto case_0;
        }
    case 63:
case_63:
        if (ch == L'd') {
            AddCh();
            goto case_64;
        }
        else {
            goto case_0;
        }
    case 64:
case_64:
        if (ch == L'e') {
            AddCh();
            goto case_65;
        }
        else {
            goto case_0;
        }
    case 65:
case_65:
        if (ch == 10 || ch == 13) {
            AddCh();
            goto case_66;
        }
        else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= 65535)) {
            AddCh();
            goto case_65;
        }
        else {
            goto case_0;
        }
    case 66:
case_66:
        {
            t->kind = 116;
            break;
        }
    case 67:
        recEnd = pos;
        recKind = 3;
        if ((ch >= L'8' && ch <= L'9')) {
            AddCh();
            goto case_71;
        }
        else if ((ch >= L'0' && ch <= L'7')) {
            AddCh();
            goto case_72;
        }
        else if (ch == L'.') {
            AddCh();
            goto case_6;
        }
        else if (ch == L'E' || ch == L'e') {
            AddCh();
            goto case_10;
        }
        else if (ch == L'L' || ch == L'U' || ch == L'l' || ch == L'u') {
            AddCh();
            goto case_14;
        }
        else if (ch == L'X' || ch == L'x') {
            AddCh();
            goto case_15;
        }
        else {
            t->kind = 3;
            break;
        }
    case 68:
case_68:
        recEnd = pos;
        recKind = 3;
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_68;
        }
        else if (ch == L'.') {
            AddCh();
            goto case_6;
        }
        else if (ch == L'E' || ch == L'e') {
            AddCh();
            goto case_10;
        }
        else if (ch == L'L' || ch == L'U' || ch == L'l' || ch == L'u') {
            AddCh();
            goto case_14;
        }
        else {
            t->kind = 3;
            break;
        }
    case 69:
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_2;
        }
        else if (ch == L'.') {
            AddCh();
            goto case_32;
        }
        else {
            goto case_0;
        }
    case 70:
case_70:
        if (ch == 9 || (ch >= 11 && ch <= 12) || ch == L' ') {
            AddCh();
            goto case_70;
        }
        else if (ch == L'd') {
            AddCh();
            goto case_34;
        }
        else if (ch == L'u') {
            AddCh();
            goto case_41;
        }
        else if (ch == L'i') {
            AddCh();
            goto case_73;
        }
        else if (ch == L'e') {
            AddCh();
            goto case_74;
        }
        else {
            goto case_0;
        }
    case 71:
case_71:
        if ((ch >= L'0' && ch <= L'9')) {
            AddCh();
            goto case_71;
        }
        else if (ch == L'.') {
            AddCh();
            goto case_6;
        }
        else if (ch == L'E' || ch == L'e') {
            AddCh();
            goto case_10;
        }
        else {
            goto case_0;
        }
    case 72:
case_72:
        recEnd = pos;
        recKind = 3;
        if ((ch >= L'8' && ch <= L'9')) {
            AddCh();
            goto case_71;
        }
        else if ((ch >= L'0' && ch <= L'7')) {
            AddCh();
            goto case_72;
        }
        else if (ch == L'.') {
            AddCh();
            goto case_6;
        }
        else if (ch == L'E' || ch == L'e') {
            AddCh();
            goto case_10;
        }
        else if (ch == L'L' || ch == L'U' || ch == L'l' || ch == L'u') {
            AddCh();
            goto case_14;
        }
        else {
            t->kind = 3;
            break;
        }
    case 73:
case_73:
        if (ch == L'f') {
            AddCh();
            goto case_47;
        }
        else if (ch == L'n') {
            AddCh();
            goto case_60;
        }
        else {
            goto case_0;
        }
    case 74:
case_74:
        if (ch == L'l') {
            AddCh();
            goto case_75;
        }
        else if (ch == L'n') {
            AddCh();
            goto case_55;
        }
        else {
            goto case_0;
        }
    case 75:
case_75:
        if (ch == L'i') {
            AddCh();
            goto case_49;
        }
        else if (ch == L's') {
            AddCh();
            goto case_52;
        }
        else {
            goto case_0;
        }
    case 76:
case_76:
        {
            t->kind = 93;
            break;
        }
    case 77:
    {
        t->kind = 96;
        break;
    }
    case 78:
    {
        t->kind = 99;
        break;
    }
    case 79:
    {
        t->kind = 100;
        break;
    }
    case 80:
        recEnd = pos;
        recKind = 1;
        if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'F') || (ch >= L'H' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {
            AddCh();
            goto case_1;
        }
        else if (ch == L'G') {
            AddCh();
            goto case_81;
        }
        else {
            t->kind = 1;
            wchar_t *literal = coco_string_create(tval, 0, tlen);
            t->kind = keywords.get(literal, t->kind);
            coco_string_delete(literal);
            break;
        }
    case 81:
case_81:
        recEnd = pos;
        recKind = 1;
        if ((ch >= L'0' && ch <= L'9') || ch == L'A' || (ch >= L'C' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {
            AddCh();
            goto case_1;
        }
        else if (ch == L'B') {
            AddCh();
            goto case_82;
        }
        else {
            t->kind = 1;
            wchar_t *literal = coco_string_create(tval, 0, tlen);
            t->kind = keywords.get(literal, t->kind);
            coco_string_delete(literal);
            break;
        }
    case 82:
case_82:
        recEnd = pos;
        recKind = 1;
        if ((ch >= L'0' && ch <= L'9') || (ch >= L'B' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {
            AddCh();
            goto case_1;
        }
        else if (ch == L'A') {
            AddCh();
            goto case_83;
        }
        else {
            t->kind = 1;
            wchar_t *literal = coco_string_create(tval, 0, tlen);
            t->kind = keywords.get(literal, t->kind);
            coco_string_delete(literal);
            break;
        }
    case 83:
case_83:
        recEnd = pos;
        recKind = 1;
        if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {
            AddCh();
            goto case_1;
        }
        else if (ch == L'(') {
            AddCh();
            goto case_76;
        }
        else {
            t->kind = 1;
            wchar_t *literal = coco_string_create(tval, 0, tlen);
            t->kind = keywords.get(literal, t->kind);
            coco_string_delete(literal);
            break;
        }

    }
    AppendVal(t);
    return t;
}
Exemple #9
0
Token* Scanner::NextToken() {
	while (ch == ' ' ||
			(ch >= 9 && ch <= 10) || ch == 13
	) NextCh();
	if ((ch == L'/' && Comment0()) || (ch == L'/' && Comment1())) return NextToken();
	int recKind = noSym;
	int recEnd = pos;
	t = CreateToken();
	t->pos = pos; t->col = col; t->line = line; t->charPos = charPos;
	int state = start.state(ch);
	tlen = 0; AddCh();

	switch (state) {
		case -1: { t->kind = eofSym; break; } // NextCh already done
		case 0: {
			case_0:
			if (recKind != noSym) {
				tlen = recEnd - t->pos;
				SetScannerBehindT();
			}
			t->kind = recKind; break;
		} // NextCh already done
		case 1:
			case_1:
			recEnd = pos; recKind = 1;
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_1;}
			else {t->kind = 1; wchar_t *literal = coco_string_create(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 2:
			case_2:
			recEnd = pos; recKind = 2;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_2;}
			else {t->kind = 2; break;}
		case 3:
			case_3:
			{t->kind = 3; break;}
		case 4:
			case_4:
			{t->kind = 4; break;}
		case 5:
			if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'&') || (ch >= L'(' && ch <= L'[') || (ch >= L']' && ch <= 65535)) {AddCh(); goto case_6;}
			else if (ch == 92) {AddCh(); goto case_7;}
			else {goto case_0;}
		case 6:
			case_6:
			if (ch == 39) {AddCh(); goto case_9;}
			else {goto case_0;}
		case 7:
			case_7:
			if ((ch >= L' ' && ch <= L'~')) {AddCh(); goto case_8;}
			else {goto case_0;}
		case 8:
			case_8:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'a' && ch <= L'f')) {AddCh(); goto case_8;}
			else if (ch == 39) {AddCh(); goto case_9;}
			else {goto case_0;}
		case 9:
			case_9:
			{t->kind = 5; break;}
		case 10:
			case_10:
			recEnd = pos; recKind = 42;
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_10;}
			else {t->kind = 42; break;}
		case 11:
			case_11:
			recEnd = pos; recKind = 43;
			if ((ch >= L'-' && ch <= L'.') || (ch >= L'0' && ch <= L':') || (ch >= L'A' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_11;}
			else {t->kind = 43; break;}
		case 12:
			case_12:
			if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'!') || (ch >= L'#' && ch <= L'[') || (ch >= L']' && ch <= 65535)) {AddCh(); goto case_12;}
			else if (ch == 10 || ch == 13) {AddCh(); goto case_4;}
			else if (ch == L'"') {AddCh(); goto case_3;}
			else if (ch == 92) {AddCh(); goto case_14;}
			else {goto case_0;}
		case 13:
			recEnd = pos; recKind = 42;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_10;}
			else if ((ch >= L'A' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_15;}
			else {t->kind = 42; break;}
		case 14:
			case_14:
			if ((ch >= L' ' && ch <= L'~')) {AddCh(); goto case_12;}
			else {goto case_0;}
		case 15:
			case_15:
			recEnd = pos; recKind = 42;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_10;}
			else if ((ch >= L'A' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_15;}
			else if (ch == L'=') {AddCh(); goto case_11;}
			else {t->kind = 42; break;}
		case 16:
			{t->kind = 17; break;}
		case 17:
			{t->kind = 20; break;}
		case 18:
			{t->kind = 21; break;}
		case 19:
			case_19:
			{t->kind = 22; break;}
		case 20:
			{t->kind = 25; break;}
		case 21:
			case_21:
			{t->kind = 26; break;}
		case 22:
			case_22:
			{t->kind = 27; break;}
		case 23:
			{t->kind = 28; break;}
		case 24:
			{t->kind = 31; break;}
		case 25:
			{t->kind = 32; break;}
		case 26:
			{t->kind = 33; break;}
		case 27:
			{t->kind = 34; break;}
		case 28:
			{t->kind = 35; break;}
		case 29:
			case_29:
			{t->kind = 39; break;}
		case 30:
			case_30:
			{t->kind = 40; break;}
		case 31:
			recEnd = pos; recKind = 18;
			if (ch == L'.') {AddCh(); goto case_19;}
			else if (ch == L'>') {AddCh(); goto case_22;}
			else if (ch == L')') {AddCh(); goto case_30;}
			else {t->kind = 18; break;}
		case 32:
			recEnd = pos; recKind = 24;
			if (ch == L'.') {AddCh(); goto case_21;}
			else {t->kind = 24; break;}
		case 33:
			recEnd = pos; recKind = 30;
			if (ch == L'.') {AddCh(); goto case_29;}
			else {t->kind = 30; break;}

	}
	AppendVal(t);
	return t;
}
Exemple #10
0
Token* Scanner::NextToken() {
	while (ch == ' ' ||
			ch == 13
	) NextCh();
	if ((ch == L'/' && Comment0())) return NextToken();
	int recKind = noSym;
	int recEnd = pos;
	t = CreateToken();
	t->pos = pos; t->col = col; t->line = line; t->charPos = charPos;
	int state = start.state(ch);
	tlen = 0; AddCh();

	switch (state) {
		case -1: { t->kind = eofSym; break; } // NextCh already done
		case 0: {
			case_0:
			if (recKind != noSym) {
				tlen = recEnd - t->pos;
				SetScannerBehindT();
			}
			t->kind = recKind; break;
		} // NextCh already done
		case 1:
			case_1:
			recEnd = pos; recKind = 1;
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_1;}
			else {t->kind = 1; wchar_t *literal = coco_string_create(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 2:
			case_2:
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_3;}
			else {goto case_0;}
		case 3:
			case_3:
			recEnd = pos; recKind = 3;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_3;}
			else {t->kind = 3; break;}
		case 4:
			case_4:
			if (ch == L' ' || (ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_4;}
			else if (ch == L'"') {AddCh(); goto case_5;}
			else {goto case_0;}
		case 5:
			case_5:
			{t->kind = 4; break;}
		case 6:
			if ((ch >= L'A' && ch <= L'Z') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_7;}
			else {goto case_0;}
		case 7:
			case_7:
			if (ch == 39) {AddCh(); goto case_8;}
			else {goto case_0;}
		case 8:
			case_8:
			{t->kind = 5; break;}
		case 9:
			{t->kind = 6; break;}
		case 10:
			case_10:
			if (ch == L'e') {AddCh(); goto case_11;}
			else {goto case_0;}
		case 11:
			case_11:
			if (ch == L'l') {AddCh(); goto case_12;}
			else {goto case_0;}
		case 12:
			case_12:
			if (ch == L'o') {AddCh(); goto case_13;}
			else {goto case_0;}
		case 13:
			case_13:
			if (ch == L'c') {AddCh(); goto case_14;}
			else {goto case_0;}
		case 14:
			case_14:
			if (ch == L'i') {AddCh(); goto case_15;}
			else {goto case_0;}
		case 15:
			case_15:
			if (ch == L'd') {AddCh(); goto case_16;}
			else {goto case_0;}
		case 16:
			case_16:
			if (ch == L'a') {AddCh(); goto case_17;}
			else {goto case_0;}
		case 17:
			case_17:
			if (ch == L'd') {AddCh(); goto case_26;}
			else {goto case_0;}
		case 18:
			case_18:
			if (ch == L'i') {AddCh(); goto case_19;}
			else {goto case_0;}
		case 19:
			case_19:
			if (ch == L'r') {AddCh(); goto case_20;}
			else {goto case_0;}
		case 20:
			case_20:
			if (ch == L'e') {AddCh(); goto case_21;}
			else {goto case_0;}
		case 21:
			case_21:
			if (ch == L'c') {AddCh(); goto case_22;}
			else {goto case_0;}
		case 22:
			case_22:
			if (ch == L'c') {AddCh(); goto case_23;}
			else {goto case_0;}
		case 23:
			case_23:
			if (ch == L'i') {AddCh(); goto case_24;}
			else {goto case_0;}
		case 24:
			case_24:
			if (ch == L'o') {AddCh(); goto case_25;}
			else {goto case_0;}
		case 25:
			case_25:
			if (ch == L'n') {AddCh(); goto case_26;}
			else {goto case_0;}
		case 26:
			case_26:
			{t->kind = 7; break;}
		case 27:
			case_27:
			if (ch == L'e') {AddCh(); goto case_28;}
			else {goto case_0;}
		case 28:
			case_28:
			if (ch == L'c') {AddCh(); goto case_29;}
			else {goto case_0;}
		case 29:
			case_29:
			if (ch == L't') {AddCh(); goto case_30;}
			else {goto case_0;}
		case 30:
			case_30:
			if (ch == L'u') {AddCh(); goto case_31;}
			else {goto case_0;}
		case 31:
			case_31:
			if (ch == L'r') {AddCh(); goto case_32;}
			else {goto case_0;}
		case 32:
			case_32:
			if (ch == L'a') {AddCh(); goto case_33;}
			else {goto case_0;}
		case 33:
			case_33:
			{t->kind = 8; break;}
		case 34:
			case_34:
			if (ch == L'c') {AddCh(); goto case_35;}
			else {goto case_0;}
		case 35:
			case_35:
			if (ch == L'e') {AddCh(); goto case_36;}
			else {goto case_0;}
		case 36:
			case_36:
			if (ch == L'n') {AddCh(); goto case_37;}
			else {goto case_0;}
		case 37:
			case_37:
			if (ch == L'd') {AddCh(); goto case_38;}
			else {goto case_0;}
		case 38:
			case_38:
			if (ch == L'i') {AddCh(); goto case_39;}
			else {goto case_0;}
		case 39:
			case_39:
			if (ch == L'd') {AddCh(); goto case_40;}
			else {goto case_0;}
		case 40:
			case_40:
			if (ch == L'o') {AddCh(); goto case_41;}
			else {goto case_0;}
		case 41:
			case_41:
			{t->kind = 9; break;}
		case 42:
			case_42:
			if (ch == L'm') {AddCh(); goto case_43;}
			else {goto case_0;}
		case 43:
			case_43:
			if (ch == L'p') {AddCh(); goto case_44;}
			else {goto case_0;}
		case 44:
			case_44:
			if (ch == L'r') {AddCh(); goto case_45;}
			else {goto case_0;}
		case 45:
			case_45:
			if (ch == L'i') {AddCh(); goto case_46;}
			else {goto case_0;}
		case 46:
			case_46:
			if (ch == L'm') {AddCh(); goto case_47;}
			else {goto case_0;}
		case 47:
			case_47:
			if (ch == L'e') {AddCh(); goto case_48;}
			else {goto case_0;}
		case 48:
			case_48:
			{t->kind = 10; break;}
		case 49:
			case_49:
			if (ch == L'n') {AddCh(); goto case_50;}
			else {goto case_0;}
		case 50:
			case_50:
			if (ch == L'g') {AddCh(); goto case_51;}
			else {goto case_0;}
		case 51:
			case_51:
			if (ch == L'u') {AddCh(); goto case_52;}
			else {goto case_0;}
		case 52:
			case_52:
			if (ch == L'l') {AddCh(); goto case_53;}
			else {goto case_0;}
		case 53:
			case_53:
			if (ch == L'o') {AddCh(); goto case_54;}
			else {goto case_0;}
		case 54:
			case_54:
			{t->kind = 11; break;}
		case 55:
			case_55:
			if (ch == L't') {AddCh(); goto case_56;}
			else {goto case_0;}
		case 56:
			case_56:
			if (ch == L'a') {AddCh(); goto case_57;}
			else {goto case_0;}
		case 57:
			case_57:
			if (ch == L'd') {AddCh(); goto case_58;}
			else {goto case_0;}
		case 58:
			case_58:
			if (ch == L'o') {AddCh(); goto case_59;}
			else {goto case_0;}
		case 59:
			case_59:
			{t->kind = 12; break;}
		case 60:
			case_60:
			recEnd = pos; recKind = 13;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_60;}
			else {t->kind = 13; break;}
		case 61:
			case_61:
			recEnd = pos; recKind = 2;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_61;}
			else if (ch == L'.') {AddCh(); goto case_2;}
			else {t->kind = 2; break;}
		case 62:
			if (ch == L'v') {AddCh(); goto case_10;}
			else if (ch == L'd') {AddCh(); goto case_18;}
			else if (ch == L'l') {AddCh(); goto case_27;}
			else if (ch == L'e') {AddCh(); goto case_63;}
			else if (ch == L'i') {AddCh(); goto case_42;}
			else if (ch == L'a') {AddCh(); goto case_49;}
			else {goto case_0;}
		case 63:
			case_63:
			if (ch == L'n') {AddCh(); goto case_34;}
			else if (ch == L's') {AddCh(); goto case_55;}
			else {goto case_0;}
		case 64:
			if (ch == L'O') {AddCh(); goto case_65;}
			else {goto case_0;}
		case 65:
			case_65:
			if (ch == L'N') {AddCh(); goto case_66;}
			else {goto case_0;}
		case 66:
			case_66:
			if (ch == L'F') {AddCh(); goto case_67;}
			else {goto case_0;}
		case 67:
			case_67:
			if (ch == L'I') {AddCh(); goto case_68;}
			else {goto case_0;}
		case 68:
			case_68:
			if (ch == L'G') {AddCh(); goto case_69;}
			else {goto case_0;}
		case 69:
			case_69:
			{t->kind = 14; break;}
		case 70:
			{t->kind = 15; break;}
		case 71:
			{t->kind = 16; break;}
		case 72:
			case_72:
			{t->kind = 17; break;}
		case 73:
			if (ch == L'U') {AddCh(); goto case_74;}
			else {goto case_0;}
		case 74:
			case_74:
			if (ch == L'N') {AddCh(); goto case_75;}
			else {goto case_0;}
		case 75:
			case_75:
			if (ch == L'C') {AddCh(); goto case_76;}
			else {goto case_0;}
		case 76:
			case_76:
			if (ch == L'I') {AddCh(); goto case_77;}
			else {goto case_0;}
		case 77:
			case_77:
			if (ch == L'O') {AddCh(); goto case_78;}
			else {goto case_0;}
		case 78:
			case_78:
			if (ch == L'N') {AddCh(); goto case_79;}
			else {goto case_0;}
		case 79:
			case_79:
			if (ch == L'E') {AddCh(); goto case_80;}
			else {goto case_0;}
		case 80:
			case_80:
			if (ch == L'S') {AddCh(); goto case_81;}
			else {goto case_0;}
		case 81:
			case_81:
			{t->kind = 18; break;}
		case 82:
			if (ch == L'R') {AddCh(); goto case_83;}
			else {goto case_0;}
		case 83:
			case_83:
			if (ch == L'O') {AddCh(); goto case_84;}
			else {goto case_0;}
		case 84:
			case_84:
			if (ch == L'G') {AddCh(); goto case_85;}
			else {goto case_0;}
		case 85:
			case_85:
			if (ch == L'R') {AddCh(); goto case_86;}
			else {goto case_0;}
		case 86:
			case_86:
			if (ch == L'A') {AddCh(); goto case_87;}
			else {goto case_0;}
		case 87:
			case_87:
			if (ch == L'M') {AddCh(); goto case_88;}
			else {goto case_0;}
		case 88:
			case_88:
			if (ch == L'A') {AddCh(); goto case_89;}
			else {goto case_0;}
		case 89:
			case_89:
			{t->kind = 19; break;}
		case 90:
			{t->kind = 26; break;}
		case 91:
			{t->kind = 34; break;}
		case 92:
			{t->kind = 35; break;}
		case 93:
			case_93:
			{t->kind = 36; break;}
		case 94:
			{t->kind = 37; break;}
		case 95:
			case_95:
			{t->kind = 49; break;}
		case 96:
			case_96:
			{t->kind = 52; break;}
		case 97:
			case_97:
			{t->kind = 53; break;}
		case 98:
			if (ch == L'=') {AddCh(); goto case_99;}
			else {goto case_0;}
		case 99:
			case_99:
			{t->kind = 54; break;}
		case 100:
			{t->kind = 55; break;}
		case 101:
			{t->kind = 56; break;}
		case 102:
			{t->kind = 57; break;}
		case 103:
			{t->kind = 58; break;}
		case 104:
			{t->kind = 59; break;}
		case 105:
			{t->kind = 60; break;}
		case 106:
			if (ch == L'A') {AddCh(); goto case_109;}
			else {goto case_0;}
		case 107:
			recEnd = pos; recKind = 51;
			if (ch == L'-') {AddCh(); goto case_95;}
			else if (ch == L'=') {AddCh(); goto case_96;}
			else {t->kind = 51; break;}
		case 108:
			recEnd = pos; recKind = 50;
			if (ch == L'=') {AddCh(); goto case_97;}
			else {t->kind = 50; break;}
		case 109:
			case_109:
			if (ch == L'R') {AddCh(); goto case_110;}
			else {goto case_0;}
		case 110:
			case_110:
			if (ch == L'G') {AddCh(); goto case_72;}
			else if (ch == L'F') {AddCh(); goto case_93;}
			else {goto case_0;}

	}
	AppendVal(t);
	return t;
}
TokenRef Scanner::NextToken() {
  while (ch == ' ' ||
			(ch >= 9 && ch <= 10) || ch == 13 || ch == ' '
  ) NextCh();
	if ((ch == '/' && Comment0()) || (ch == '/' && Comment1())) return NextToken();
  int recKind = noSym;
  size_t recEnd = pos;

  t = CreateToken();
  t->pos = pos; t->col = col; t->line = line; t->charPos = charPos;
  int state = start.state(ch);
  tlen = 0; AddCh();

  switch (state) {
  case -1: { t->kind = eofSym; break; } // NextCh already done
  case 0: {
    case_0:
    if (recKind != noSym) {
      tlen = recEnd - t->pos;
      SetScannerBehindT();
    }

    t->kind = recKind; break;
  } // NextCh already done
		case 1:
			case_1:
			recEnd = pos; recKind = 1;
			if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || ch == '_' || (ch >= 'a' && ch <= 'z')) {AddCh(); goto case_1;}
			else {t->kind = 1; char *literal = coco_string_create(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 2:
			case_2:
			if ((ch >= '0' && ch <= '9')) {AddCh(); goto case_3;}
			else {goto case_0;}
		case 3:
			case_3:
			recEnd = pos; recKind = 3;
			if ((ch >= '0' && ch <= '9')) {AddCh(); goto case_3;}
			else {t->kind = 3; break;}
		case 4:
			case_4:
			if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f')) {AddCh(); goto case_5;}
			else {goto case_0;}
		case 5:
			case_5:
			if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f')) {AddCh(); goto case_6;}
			else {goto case_0;}
		case 6:
			case_6:
			if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f')) {AddCh(); goto case_7;}
			else {goto case_0;}
		case 7:
			case_7:
			if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f')) {AddCh(); goto case_8;}
			else {goto case_0;}
		case 8:
			case_8:
			if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f')) {AddCh(); goto case_9;}
			else {goto case_0;}
		case 9:
			case_9:
			recEnd = pos; recKind = 4;
			if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f')) {AddCh(); goto case_10;}
			else {t->kind = 4; break;}
		case 10:
			case_10:
			if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f')) {AddCh(); goto case_11;}
			else {goto case_0;}
		case 11:
			case_11:
			{t->kind = 4; break;}
		case 12:
			if ((ch >= 'A' && ch <= 'Z') || ch == '_' || (ch >= 'a' && ch <= 'z')) {AddCh(); goto case_13;}
			else {goto case_0;}
		case 13:
			case_13:
			recEnd = pos; recKind = 5;
			if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || ch == '_' || (ch >= 'a' && ch <= 'z')) {AddCh(); goto case_13;}
			else {t->kind = 5; break;}
		case 14:
			case_14:
			if (ch <= '!' || (ch >= '#' && ch <= '[') || (ch >= ']' && ch <= 65535)) {AddCh(); goto case_14;}
			else if (ch == '"') {AddCh(); goto case_15;}
			else if (ch == 92) {AddCh(); goto case_17;}
			else {goto case_0;}
		case 15:
			case_15:
			{t->kind = 6; break;}
		case 16:
			case_16:
			recEnd = pos; recKind = 2;
			if ((ch >= '0' && ch <= '9')) {AddCh(); goto case_16;}
			else if (ch == '.') {AddCh(); goto case_2;}
			else {t->kind = 2; break;}
		case 17:
			case_17:
			if (ch <= '!' || (ch >= '#' && ch <= '[') || (ch >= ']' && ch <= 65535)) {AddCh(); goto case_14;}
			else if (ch == 92) {AddCh(); goto case_17;}
			else if (ch == '"') {AddCh(); goto case_18;}
			else {goto case_0;}
		case 18:
			case_18:
			recEnd = pos; recKind = 6;
			if (ch <= '!' || (ch >= '#' && ch <= '[') || (ch >= ']' && ch <= 65535)) {AddCh(); goto case_14;}
			else if (ch == '"') {AddCh(); goto case_15;}
			else if (ch == 92) {AddCh(); goto case_17;}
			else {t->kind = 6; break;}
		case 19:
			{t->kind = 11; break;}
		case 20:
			{t->kind = 12; break;}
		case 21:
			{t->kind = 15; break;}
		case 22:
			{t->kind = 16; break;}
		case 23:
			{t->kind = 20; break;}
		case 24:
			{t->kind = 31; break;}
		case 25:
			{t->kind = 32; break;}
		case 26:
			{t->kind = 36; break;}
		case 27:
			{t->kind = 43; break;}
		case 28:
			{t->kind = 45; break;}
		case 29:
			{t->kind = 47; break;}
		case 30:
			{t->kind = 90; break;}
		case 31:
			{t->kind = 91; break;}
		case 32:
			{t->kind = 93; break;}
		case 33:
			recEnd = pos; recKind = 49;
			if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f')) {AddCh(); goto case_4;}
			else {t->kind = 49; break;}

  }
  AppendVal(t);

  return t;
}
Exemple #12
0
static CJcToken* NextToken(CJcScanner* scanner){
	jc_int state;
	while (scanner->ch == ' ' ||
			scanner->ch >= 9 && scanner->ch <= 10 || scanner->ch == 13
	) NextCh(scanner);

	scanner->t = CreateToken(scanner);
	scanner->t->fcol = GetCol(scanner->buffer);
	scanner->t->fline = GetLine(scanner->buffer);
	scanner->t->fname = GetFileName(scanner->buffer);
	scanner->t->pos = scanner->pos;
	scanner->t->col = scanner->col;
	scanner->t->line = scanner->line;
	state = GetStartState(&scanner->start, scanner->ch);
	scanner->tlen = 0;
	AddCh(scanner);

	switch (state){
	case -1:
		scanner->t->kind = scanner->eofSym;
		break;
	case 0:
		scanner->t->kind = scanner->noSym;
		break;
		case 1:
			case_1:
			if (scanner->ch >= '0' && scanner->ch <= '9' || scanner->ch >= 'A' && scanner->ch <= 'Z' || scanner->ch == '_' || scanner->ch >= 'a' && scanner->ch <= 'z') {AddCh(scanner); goto case_1;}
			else {scanner->t->kind = 1; {char *literal = jcc_string_create(scanner->tval, 0, scanner->tlen); scanner->t->kind = GetKeyword(&scanner->keywords, literal, scanner->t->kind); free(literal); break;}}
		case 2:
			if (scanner->ch <= 9 || scanner->ch >= 11 && scanner->ch <= 12 || scanner->ch >= 14 && scanner->ch <= '&' || scanner->ch >= '(' && scanner->ch <= '[' || scanner->ch >= ']' && scanner->ch <= 65535) {AddCh(scanner); goto case_4;}
			else if (scanner->ch == 92) {AddCh(scanner); goto case_3;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 3:
			case_3:
			if (scanner->ch == '"' || scanner->ch == 39 || scanner->ch == '?' || scanner->ch == 92 || scanner->ch >= 'a' && scanner->ch <= 'b' || scanner->ch == 'f' || scanner->ch == 'n' || scanner->ch == 'r' || scanner->ch == 't' || scanner->ch == 'v') {AddCh(scanner); goto case_4;}
			else if (scanner->ch >= '0' && scanner->ch <= '7') {AddCh(scanner); goto case_5;}
			else if (scanner->ch == 'X' || scanner->ch == 'x') {AddCh(scanner); goto case_6;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 4:
			case_4:
			if (scanner->ch == 39) {AddCh(scanner); goto case_8;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 5:
			case_5:
			if (scanner->ch >= '0' && scanner->ch <= '7') {AddCh(scanner); goto case_87;}
			else if (scanner->ch == 39) {AddCh(scanner); goto case_8;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 6:
			case_6:
			if (scanner->ch >= '0' && scanner->ch <= '9' || scanner->ch >= 'A' && scanner->ch <= 'F' || scanner->ch >= 'a' && scanner->ch <= 'f') {AddCh(scanner); goto case_7;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 7:
			case_7:
			if (scanner->ch >= '0' && scanner->ch <= '9' || scanner->ch >= 'A' && scanner->ch <= 'F' || scanner->ch >= 'a' && scanner->ch <= 'f') {AddCh(scanner); goto case_4;}
			else if (scanner->ch == 39) {AddCh(scanner); goto case_8;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 8:
			case_8:
			{scanner->t->kind = 2; break;}
		case 9:
			case_9:
			if (scanner->ch <= 9 || scanner->ch >= 11 && scanner->ch <= 12 || scanner->ch >= 14 && scanner->ch <= '!' || scanner->ch >= '#' && scanner->ch <= '[' || scanner->ch >= ']' && scanner->ch <= 65535) {AddCh(scanner); goto case_9;}
			else if (scanner->ch == '"') {AddCh(scanner); goto case_14;}
			else if (scanner->ch == 92) {AddCh(scanner); goto case_10;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 10:
			case_10:
			if (scanner->ch == '"' || scanner->ch == 39 || scanner->ch == '?' || scanner->ch == 92 || scanner->ch >= 'a' && scanner->ch <= 'b' || scanner->ch == 'f' || scanner->ch == 'n' || scanner->ch == 'r' || scanner->ch == 't' || scanner->ch == 'v') {AddCh(scanner); goto case_9;}
			else if (scanner->ch >= '0' && scanner->ch <= '7') {AddCh(scanner); goto case_11;}
			else if (scanner->ch == 'X' || scanner->ch == 'x') {AddCh(scanner); goto case_12;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 11:
			case_11:
			if (scanner->ch <= 9 || scanner->ch >= 11 && scanner->ch <= 12 || scanner->ch >= 14 && scanner->ch <= '!' || scanner->ch >= '#' && scanner->ch <= '/' || scanner->ch >= '8' && scanner->ch <= '[' || scanner->ch >= ']' && scanner->ch <= 65535) {AddCh(scanner); goto case_9;}
			else if (scanner->ch >= '0' && scanner->ch <= '7') {AddCh(scanner); goto case_88;}
			else if (scanner->ch == '"') {AddCh(scanner); goto case_14;}
			else if (scanner->ch == 92) {AddCh(scanner); goto case_10;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 12:
			case_12:
			if (scanner->ch >= '0' && scanner->ch <= '9' || scanner->ch >= 'A' && scanner->ch <= 'F' || scanner->ch >= 'a' && scanner->ch <= 'f') {AddCh(scanner); goto case_13;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 13:
			case_13:
			if (scanner->ch <= 9 || scanner->ch >= 11 && scanner->ch <= 12 || scanner->ch >= 14 && scanner->ch <= '!' || scanner->ch >= '#' && scanner->ch <= '[' || scanner->ch >= ']' && scanner->ch <= 65535) {AddCh(scanner); goto case_9;}
			else if (scanner->ch == '"') {AddCh(scanner); goto case_14;}
			else if (scanner->ch == 92) {AddCh(scanner); goto case_10;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 14:
			case_14:
			{scanner->t->kind = 3; break;}
		case 15:
			case_15:
			if (scanner->ch == '8' || scanner->ch == 'L' || scanner->ch == 'l') {AddCh(scanner); goto case_25;}
			else if (scanner->ch == '1') {AddCh(scanner); goto case_16;}
			else if (scanner->ch == '3') {AddCh(scanner); goto case_17;}
			else if (scanner->ch == '6') {AddCh(scanner); goto case_18;}
			else {scanner->t->kind = 4; break;}
		case 16:
			case_16:
			if (scanner->ch == '6') {AddCh(scanner); goto case_25;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 17:
			case_17:
			if (scanner->ch == '2') {AddCh(scanner); goto case_25;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 18:
			case_18:
			if (scanner->ch == '4') {AddCh(scanner); goto case_25;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 19:
			case_19:
			if (scanner->ch == '8') {AddCh(scanner); goto case_25;}
			else if (scanner->ch == '1') {AddCh(scanner); goto case_20;}
			else if (scanner->ch == '3') {AddCh(scanner); goto case_21;}
			else if (scanner->ch == '6') {AddCh(scanner); goto case_22;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 20:
			case_20:
			if (scanner->ch == '6') {AddCh(scanner); goto case_25;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 21:
			case_21:
			if (scanner->ch == '2') {AddCh(scanner); goto case_25;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 22:
			case_22:
			if (scanner->ch == '4') {AddCh(scanner); goto case_25;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 23:
			case_23:
			if (scanner->ch >= '0' && scanner->ch <= '9' || scanner->ch >= 'A' && scanner->ch <= 'F' || scanner->ch >= 'a' && scanner->ch <= 'f') {AddCh(scanner); goto case_24;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 24:
			case_24:
			if (scanner->ch >= '0' && scanner->ch <= '9' || scanner->ch >= 'A' && scanner->ch <= 'F' || scanner->ch >= 'a' && scanner->ch <= 'f') {AddCh(scanner); goto case_24;}
			else if (scanner->ch == 'U' || scanner->ch == 'u') {AddCh(scanner); goto case_15;}
			else if (scanner->ch == 'I' || scanner->ch == 'i') {AddCh(scanner); goto case_19;}
			else {scanner->t->kind = 4; break;}
		case 25:
			case_25:
			{scanner->t->kind = 4; break;}
		case 26:
			case_26:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_26;}
			else if (scanner->ch == 'F' || scanner->ch == 'f') {AddCh(scanner); goto case_39;}
			else if (scanner->ch == 'E' || scanner->ch == 'e') {AddCh(scanner); goto case_27;}
			else {scanner->t->kind = 5; break;}
		case 27:
			case_27:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_29;}
			else if (scanner->ch == '+' || scanner->ch == '-') {AddCh(scanner); goto case_28;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 28:
			case_28:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_29;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 29:
			case_29:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_29;}
			else if (scanner->ch == 'F' || scanner->ch == 'f') {AddCh(scanner); goto case_39;}
			else {scanner->t->kind = 5; break;}
		case 30:
			case_30:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_30;}
			else if (scanner->ch == '.') {AddCh(scanner); goto case_31;}
			else if (scanner->ch == 'E' || scanner->ch == 'e') {AddCh(scanner); goto case_36;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 31:
			case_31:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_35;}
			else if (scanner->ch == 'F' || scanner->ch == 'f') {AddCh(scanner); goto case_39;}
			else if (scanner->ch == 'E' || scanner->ch == 'e') {AddCh(scanner); goto case_32;}
			else {scanner->t->kind = 5; break;}
		case 32:
			case_32:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_34;}
			else if (scanner->ch == '+' || scanner->ch == '-') {AddCh(scanner); goto case_33;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 33:
			case_33:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_34;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 34:
			case_34:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_34;}
			else if (scanner->ch == 'F' || scanner->ch == 'f') {AddCh(scanner); goto case_39;}
			else {scanner->t->kind = 5; break;}
		case 35:
			case_35:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_35;}
			else if (scanner->ch == 'F' || scanner->ch == 'f') {AddCh(scanner); goto case_39;}
			else if (scanner->ch == 'E' || scanner->ch == 'e') {AddCh(scanner); goto case_32;}
			else {scanner->t->kind = 5; break;}
		case 36:
			case_36:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_38;}
			else if (scanner->ch == '+' || scanner->ch == '-') {AddCh(scanner); goto case_37;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 37:
			case_37:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_38;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 38:
			case_38:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_38;}
			else if (scanner->ch == 'F' || scanner->ch == 'f') {AddCh(scanner); goto case_39;}
			else {scanner->t->kind = 5; break;}
		case 39:
			case_39:
			{scanner->t->kind = 5; break;}
		case 40:
			case_40:
			if (scanner->ch == '.') {AddCh(scanner); goto case_41;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 41:
			case_41:
			{scanner->t->kind = 40; break;}
		case 42:
			case_42:
			{scanner->t->kind = 41; break;}
		case 43:
			case_43:
			{scanner->t->kind = 42; break;}
		case 44:
			case_44:
			{scanner->t->kind = 43; break;}
		case 45:
			case_45:
			{scanner->t->kind = 44; break;}
		case 46:
			case_46:
			{scanner->t->kind = 45; break;}
		case 47:
			case_47:
			{scanner->t->kind = 46; break;}
		case 48:
			case_48:
			{scanner->t->kind = 47; break;}
		case 49:
			case_49:
			{scanner->t->kind = 48; break;}
		case 50:
			case_50:
			{scanner->t->kind = 49; break;}
		case 51:
			case_51:
			{scanner->t->kind = 50; break;}
		case 52:
			case_52:
			{scanner->t->kind = 51; break;}
		case 53:
			case_53:
			{scanner->t->kind = 52; break;}
		case 54:
			case_54:
			{scanner->t->kind = 53; break;}
		case 55:
			case_55:
			{scanner->t->kind = 54; break;}
		case 56:
			case_56:
			{scanner->t->kind = 57; break;}
		case 57:
			case_57:
			{scanner->t->kind = 58; break;}
		case 58:
			case_58:
			{scanner->t->kind = 59; break;}
		case 59:
			case_59:
			{scanner->t->kind = 60; break;}
		case 60:
			case_60:
			{scanner->t->kind = 61; break;}
		case 61:
			{scanner->t->kind = 62; break;}
		case 62:
			{scanner->t->kind = 68; break;}
		case 63:
			{scanner->t->kind = 69; break;}
		case 64:
			case_64:
			{scanner->t->kind = 73; break;}
		case 65:
			case_65:
			{scanner->t->kind = 74; break;}
		case 66:
			case_66:
			{scanner->t->kind = 75; break;}
		case 67:
			case_67:
			{scanner->t->kind = 76; break;}
		case 68:
			{scanner->t->kind = 79; break;}
		case 69:
			{scanner->t->kind = 82; break;}
		case 70:
			{scanner->t->kind = 84; break;}
		case 71:
			case_71:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_71;}
			else if (scanner->ch == 'U' || scanner->ch == 'u') {AddCh(scanner); goto case_15;}
			else if (scanner->ch == 'I' || scanner->ch == 'i') {AddCh(scanner); goto case_19;}
			else if (scanner->ch == '.') {AddCh(scanner); goto case_31;}
			else if (scanner->ch == 'E' || scanner->ch == 'e') {AddCh(scanner); goto case_36;}
			else {scanner->t->kind = 4; break;}
		case 72:
			case_72:
			if (scanner->ch >= '0' && scanner->ch <= '7') {AddCh(scanner); goto case_72;}
			else if (scanner->ch >= '8' && scanner->ch <= '9') {AddCh(scanner); goto case_30;}
			else if (scanner->ch == 'X' || scanner->ch == 'x') {AddCh(scanner); goto case_23;}
			else if (scanner->ch == 'U' || scanner->ch == 'u') {AddCh(scanner); goto case_15;}
			else if (scanner->ch == 'I' || scanner->ch == 'i') {AddCh(scanner); goto case_19;}
			else if (scanner->ch == '.') {AddCh(scanner); goto case_31;}
			else if (scanner->ch == 'E' || scanner->ch == 'e') {AddCh(scanner); goto case_36;}
			else {scanner->t->kind = 4; break;}
		case 73:
			if (scanner->ch >= '0' && scanner->ch <= '9') {AddCh(scanner); goto case_26;}
			else if (scanner->ch == '.') {AddCh(scanner); goto case_40;}
			else {scanner->t->kind = 83; break;}
		case 74:
			if (scanner->ch == '>') {AddCh(scanner); goto case_89;}
			else if (scanner->ch == '=') {AddCh(scanner); goto case_53;}
			else {scanner->t->kind = 81; break;}
		case 75:
			if (scanner->ch == '<') {AddCh(scanner); goto case_90;}
			else if (scanner->ch == '=') {AddCh(scanner); goto case_54;}
			else if (scanner->ch == '%') {AddCh(scanner); goto case_64;}
			else if (scanner->ch == ':') {AddCh(scanner); goto case_66;}
			else {scanner->t->kind = 80; break;}
		case 76:
			if (scanner->ch == '=') {AddCh(scanner); goto case_44;}
			else {scanner->t->kind = 63; break;}
		case 77:
			if (scanner->ch == '=') {AddCh(scanner); goto case_45;}
			else if (scanner->ch == '>') {AddCh(scanner); goto case_65;}
			else {scanner->t->kind = 64; break;}
		case 78:
			if (scanner->ch == '=') {AddCh(scanner); goto case_46;}
			else {scanner->t->kind = 65; break;}
		case 79:
			if (scanner->ch == '=') {AddCh(scanner); goto case_47;}
			else if (scanner->ch == '&') {AddCh(scanner); goto case_56;}
			else {scanner->t->kind = 66; break;}
		case 80:
			if (scanner->ch == '=') {AddCh(scanner); goto case_48;}
			else {scanner->t->kind = 67; break;}
		case 81:
			if (scanner->ch == '=') {AddCh(scanner); goto case_49;}
			else if (scanner->ch == '>') {AddCh(scanner); goto case_58;}
			else if (scanner->ch == '-') {AddCh(scanner); goto case_60;}
			else {scanner->t->kind = 70; break;}
		case 82:
			if (scanner->ch == '=') {AddCh(scanner); goto case_50;}
			else if (scanner->ch == '+') {AddCh(scanner); goto case_59;}
			else {scanner->t->kind = 71; break;}
		case 83:
			if (scanner->ch == '=') {AddCh(scanner); goto case_51;}
			else if (scanner->ch == '|') {AddCh(scanner); goto case_57;}
			else {scanner->t->kind = 77; break;}
		case 84:
			if (scanner->ch == '=') {AddCh(scanner); goto case_52;}
			else {scanner->t->kind = 85; break;}
		case 85:
			if (scanner->ch == '=') {AddCh(scanner); goto case_55;}
			else {scanner->t->kind = 72; break;}
		case 86:
			if (scanner->ch == '>') {AddCh(scanner); goto case_67;}
			else {scanner->t->kind = 78; break;}
		case 87:
			case_87:
			if (scanner->ch >= '0' && scanner->ch <= '7') {AddCh(scanner); goto case_4;}
			else if (scanner->ch == 39) {AddCh(scanner); goto case_8;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 88:
			case_88:
			if (scanner->ch <= 9 || scanner->ch >= 11 && scanner->ch <= 12 || scanner->ch >= 14 && scanner->ch <= '!' || scanner->ch >= '#' && scanner->ch <= '[' || scanner->ch >= ']' && scanner->ch <= 65535) {AddCh(scanner); goto case_9;}
			else if (scanner->ch == '"') {AddCh(scanner); goto case_14;}
			else if (scanner->ch == 92) {AddCh(scanner); goto case_10;}
			else {scanner->t->kind = scanner->noSym; break;}
		case 89:
			case_89:
			if (scanner->ch == '=') {AddCh(scanner); goto case_42;}
			else {scanner->t->kind = 56; break;}
		case 90:
			case_90:
			if (scanner->ch == '=') {AddCh(scanner); goto case_43;}
			else {scanner->t->kind = 55; break;}

	}
	AppendVal(scanner, scanner->t);
	return scanner->t;
}
Exemple #13
0
Token* Scanner::NextToken() {
	while (ch == ' ' ||
			ch == 10 || ch == 13
	) NextCh();

	int recKind = noSym;
	int recEnd = pos;
	t = CreateToken();
	t->pos = pos; t->col = col; t->line = line;
	int state = start.state(ch);
	tlen = 0; AddCh();

	switch (state) {
		case -1: { t->kind = eofSym; break; } // NextCh already done
		case 0: {
			case_0:
			if (recKind != noSym) {
				tlen = recEnd - t->pos;
				SetScannerBehindT();
			}
			t->kind = recKind; break;
		} // NextCh already done
		case 1:
			case_1:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_1;}
			else {t->kind = 1; wchar_t *literal = coco_string_create(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 2:
			case_2:
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_2;}
			else {t->kind = 2; break;}
		case 3:
			case_3:
			if (ch == L'e') {AddCh(); goto case_4;}
			else {t->kind = noSym; break;}
		case 4:
			case_4:
			if (ch == L'x') {AddCh(); goto case_5;}
			else {t->kind = noSym; break;}
		case 5:
			case_5:
			if (ch == L';') {AddCh(); goto case_6;}
			else {t->kind = noSym; break;}
		case 6:
			case_6:
			{t->kind = 4; break;}
		case 7:
			case_7:
			if (ch == L'c') {AddCh(); goto case_8;}
			else {t->kind = noSym; break;}
		case 8:
			case_8:
			if (ch == L't') {AddCh(); goto case_9;}
			else {t->kind = noSym; break;}
		case 9:
			case_9:
			if (ch == L';') {AddCh(); goto case_10;}
			else {t->kind = noSym; break;}
		case 10:
			case_10:
			{t->kind = 5; break;}
		case 11:
			{t->kind = 6; break;}
		case 12:
			case_12:
			{t->kind = 7; break;}
		case 13:
			{t->kind = 9; break;}
		case 14:
			{t->kind = 10; break;}
		case 15:
			{t->kind = 11; break;}
		case 16:
			{t->kind = 13; break;}
		case 17:
			{t->kind = 14; break;}
		case 18:
			{t->kind = 15; break;}
		case 19:
			if (ch == L'h') {AddCh(); goto case_3;}
			else if (ch == L'o') {AddCh(); goto case_7;}
			else if (ch == L'=') {AddCh(); goto case_12;}
			else {t->kind = noSym; break;}

	}
	AppendVal(t);
	return t;
}
Exemple #14
0
Token* Scanner::NextToken() {
	while (ch == ' ' ||
			false
	) NextCh();

	int recKind = noSym;
	int recEnd = pos;
	t = CreateToken();
	t->pos = pos; t->col = col; t->line = line; t->charPos = charPos;
	int state = start.state(ch);
	tlen = 0; AddCh();

	switch (state) {
		case -1: { t->kind = eofSym; break; } // NextCh already done
		case 0: {
			case_0:
			if (recKind != noSym) {
				tlen = recEnd - t->pos;
				SetScannerBehindT();
			}
			t->kind = recKind; break;
		} // NextCh already done
		case 1:
			if (ch == L'1') {AddCh(); goto case_2;}
			else {goto case_0;}
		case 2:
			case_2:
			if (ch == L'2') {AddCh(); goto case_3;}
			else {goto case_0;}
		case 3:
			case_3:
			if (ch == L'3') {AddCh(); goto case_4;}
			else {goto case_0;}
		case 4:
			case_4:
			if (ch == L'4') {AddCh(); goto case_5;}
			else {goto case_0;}
		case 5:
			case_5:
			if (ch == L'5') {AddCh(); goto case_6;}
			else {goto case_0;}
		case 6:
			case_6:
			if (ch == L'6') {AddCh(); goto case_7;}
			else {goto case_0;}
		case 7:
			case_7:
			if (ch == L'7') {AddCh(); goto case_8;}
			else {goto case_0;}
		case 8:
			case_8:
			if (ch == L'8') {AddCh(); goto case_9;}
			else {goto case_0;}
		case 9:
			case_9:
			if (ch == L'9') {AddCh(); goto case_10;}
			else {goto case_0;}
		case 10:
			case_10:
			{t->kind = 1; break;}
		case 11:
			case_11:
			{t->kind = 2; break;}
		case 12:
			{t->kind = 3; break;}
		case 13:
			{t->kind = 4; break;}
		case 14:
			case_14:
			if (ch == L'u') {AddCh(); goto case_15;}
			else {goto case_0;}
		case 15:
			case_15:
			if (ch == L'e') {AddCh(); goto case_19;}
			else {goto case_0;}
		case 16:
			case_16:
			if (ch == L'l') {AddCh(); goto case_17;}
			else {goto case_0;}
		case 17:
			case_17:
			if (ch == L's') {AddCh(); goto case_18;}
			else {goto case_0;}
		case 18:
			case_18:
			if (ch == L'e') {AddCh(); goto case_19;}
			else {goto case_0;}
		case 19:
			case_19:
			{t->kind = 5; break;}
		case 20:
			recEnd = pos; recKind = 2;
			if (ch == L'=') {AddCh(); goto case_11;}
			else {t->kind = 2; break;}
		case 21:
			recEnd = pos; recKind = 2;
			if (ch == L'=') {AddCh(); goto case_11;}
			else {t->kind = 2; break;}
		case 22:
			case_22:
			if (ch == L'd') {AddCh(); goto case_23;}
			else {goto case_0;}
		case 23:
			case_23:
			if (ch == L'u') {AddCh(); goto case_24;}
			else {goto case_0;}
		case 24:
			case_24:
			if (ch == L'l') {AddCh(); goto case_25;}
			else {goto case_0;}
		case 25:
			case_25:
			if (ch == L'e') {AddCh(); goto case_26;}
			else {goto case_0;}
		case 26:
			case_26:
			{t->kind = 6; break;}
		case 27:
			case_27:
			{t->kind = 7; break;}
		case 28:
			if (ch == L'a') {AddCh(); goto case_29;}
			else {goto case_0;}
		case 29:
			case_29:
			if (ch == L'r') {AddCh(); goto case_30;}
			else {goto case_0;}
		case 30:
			case_30:
			{t->kind = 8; break;}
		case 31:
			case_31:
			if (ch == L'g') {AddCh(); goto case_32;}
			else {goto case_0;}
		case 32:
			case_32:
			if (ch == L'i') {AddCh(); goto case_33;}
			else {goto case_0;}
		case 33:
			case_33:
			if (ch == L'n') {AddCh(); goto case_34;}
			else {goto case_0;}
		case 34:
			case_34:
			{t->kind = 9; break;}
		case 35:
			case_35:
			if (ch == L'd') {AddCh(); goto case_36;}
			else {goto case_0;}
		case 36:
			case_36:
			{t->kind = 10; break;}
		case 37:
			case_37:
			if (ch == L'p') {AddCh(); goto case_38;}
			else {goto case_0;}
		case 38:
			case_38:
			if (ch == L'o') {AddCh(); goto case_39;}
			else {goto case_0;}
		case 39:
			case_39:
			if (ch == L'r') {AddCh(); goto case_40;}
			else {goto case_0;}
		case 40:
			case_40:
			if (ch == L't') {AddCh(); goto case_41;}
			else {goto case_0;}
		case 41:
			case_41:
			{t->kind = 12; break;}
		case 42:
			{t->kind = 13; break;}
		case 43:
			case_43:
			if (ch == L's') {AddCh(); goto case_44;}
			else {goto case_0;}
		case 44:
			case_44:
			if (ch == L't') {AddCh(); goto case_45;}
			else {goto case_0;}
		case 45:
			case_45:
			if (ch == L'd') {AddCh(); goto case_46;}
			else {goto case_0;}
		case 46:
			case_46:
			if (ch == L'l') {AddCh(); goto case_47;}
			else {goto case_0;}
		case 47:
			case_47:
			if (ch == L'o') {AddCh(); goto case_48;}
			else {goto case_0;}
		case 48:
			case_48:
			if (ch == L'g') {AddCh(); goto case_49;}
			else {goto case_0;}
		case 49:
			case_49:
			{t->kind = 14; break;}
		case 50:
			if (ch == L'm') {AddCh(); goto case_51;}
			else {goto case_0;}
		case 51:
			case_51:
			if (ch == L'a') {AddCh(); goto case_52;}
			else {goto case_0;}
		case 52:
			case_52:
			if (ch == L't') {AddCh(); goto case_53;}
			else {goto case_0;}
		case 53:
			case_53:
			if (ch == L'h') {AddCh(); goto case_54;}
			else {goto case_0;}
		case 54:
			case_54:
			{t->kind = 15; break;}
		case 55:
			if (ch == L'r') {AddCh(); goto case_56;}
			else {goto case_0;}
		case 56:
			case_56:
			if (ch == L'r') {AddCh(); goto case_57;}
			else {goto case_0;}
		case 57:
			case_57:
			if (ch == L'a') {AddCh(); goto case_58;}
			else {goto case_0;}
		case 58:
			case_58:
			if (ch == L'y') {AddCh(); goto case_59;}
			else {goto case_0;}
		case 59:
			case_59:
			{t->kind = 17; break;}
		case 60:
			case_60:
			{t->kind = 18; break;}
		case 61:
			case_61:
			if (ch == L'g') {AddCh(); goto case_62;}
			else {goto case_0;}
		case 62:
			case_62:
			if (ch == L'e') {AddCh(); goto case_63;}
			else {goto case_0;}
		case 63:
			case_63:
			if (ch == L'r') {AddCh(); goto case_64;}
			else {goto case_0;}
		case 64:
			case_64:
			{t->kind = 19; break;}
		case 65:
			case_65:
			if (ch == L'l') {AddCh(); goto case_66;}
			else {goto case_0;}
		case 66:
			case_66:
			{t->kind = 20; break;}
		case 67:
			case_67:
			if (ch == L'a') {AddCh(); goto case_68;}
			else {goto case_0;}
		case 68:
			case_68:
			if (ch == L'n') {AddCh(); goto case_69;}
			else {goto case_0;}
		case 69:
			case_69:
			{t->kind = 21; break;}
		case 70:
			case_70:
			{t->kind = 22; break;}
		case 71:
			case_71:
			if (ch == L'e') {AddCh(); goto case_72;}
			else {goto case_0;}
		case 72:
			case_72:
			if (ch == L'n') {AddCh(); goto case_73;}
			else {goto case_0;}
		case 73:
			case_73:
			{t->kind = 23; break;}
		case 74:
			{t->kind = 24; break;}
		case 75:
			case_75:
			if (ch == L'l') {AddCh(); goto case_76;}
			else {goto case_0;}
		case 76:
			case_76:
			if (ch == L'o') {AddCh(); goto case_77;}
			else {goto case_0;}
		case 77:
			case_77:
			if (ch == L'g') {AddCh(); goto case_78;}
			else {goto case_0;}
		case 78:
			case_78:
			if (ch == L'.') {AddCh(); goto case_79;}
			else {goto case_0;}
		case 79:
			case_79:
			{t->kind = 26; break;}
		case 80:
			if (ch == L'n') {AddCh(); goto case_81;}
			else {goto case_0;}
		case 81:
			case_81:
			{t->kind = 27; break;}
		case 82:
			case_82:
			if (ch == L'i') {AddCh(); goto case_83;}
			else {goto case_0;}
		case 83:
			case_83:
			if (ch == L'n') {AddCh(); goto case_84;}
			else {goto case_0;}
		case 84:
			case_84:
			if (ch == L'g') {AddCh(); goto case_85;}
			else {goto case_0;}
		case 85:
			case_85:
			{t->kind = 30; break;}
		case 86:
			case_86:
			{t->kind = 31; break;}
		case 87:
			{t->kind = 32; break;}
		case 88:
			{t->kind = 33; break;}
		case 89:
			if (ch == L'h') {AddCh(); goto case_90;}
			else {goto case_0;}
		case 90:
			case_90:
			if (ch == L'i') {AddCh(); goto case_91;}
			else {goto case_0;}
		case 91:
			case_91:
			if (ch == L'l') {AddCh(); goto case_92;}
			else {goto case_0;}
		case 92:
			case_92:
			if (ch == L'e') {AddCh(); goto case_93;}
			else {goto case_0;}
		case 93:
			case_93:
			if (ch == L'(') {AddCh(); goto case_94;}
			else {goto case_0;}
		case 94:
			case_94:
			{t->kind = 34; break;}
		case 95:
			case_95:
			if (ch == L'o') {AddCh(); goto case_96;}
			else {goto case_0;}
		case 96:
			case_96:
			{t->kind = 35; break;}
		case 97:
			case_97:
			if (ch == L'e') {AddCh(); goto case_98;}
			else {goto case_0;}
		case 98:
			case_98:
			if (ch == L'a') {AddCh(); goto case_99;}
			else {goto case_0;}
		case 99:
			case_99:
			if (ch == L't') {AddCh(); goto case_100;}
			else {goto case_0;}
		case 100:
			case_100:
			{t->kind = 36; break;}
		case 101:
			if (ch == L'n') {AddCh(); goto case_102;}
			else {goto case_0;}
		case 102:
			case_102:
			if (ch == L't') {AddCh(); goto case_103;}
			else {goto case_0;}
		case 103:
			case_103:
			if (ch == L'i') {AddCh(); goto case_104;}
			else {goto case_0;}
		case 104:
			case_104:
			if (ch == L'l') {AddCh(); goto case_105;}
			else {goto case_0;}
		case 105:
			case_105:
			if (ch == L'(') {AddCh(); goto case_106;}
			else {goto case_0;}
		case 106:
			case_106:
			{t->kind = 37; break;}
		case 107:
			case_107:
			if (ch == L'r') {AddCh(); goto case_108;}
			else {goto case_0;}
		case 108:
			case_108:
			{t->kind = 38; break;}
		case 109:
			case_109:
			{t->kind = 39; break;}
		case 110:
			if (ch == L'o') {AddCh(); goto case_111;}
			else {goto case_0;}
		case 111:
			case_111:
			{t->kind = 40; break;}
		case 112:
			case_112:
			{t->kind = 41; break;}
		case 113:
			case_113:
			if (ch == L'e') {AddCh(); goto case_114;}
			else {goto case_0;}
		case 114:
			case_114:
			if (ch == L'n') {AddCh(); goto case_115;}
			else {goto case_0;}
		case 115:
			case_115:
			{t->kind = 42; break;}
		case 116:
			case_116:
			if (ch == L's') {AddCh(); goto case_117;}
			else {goto case_0;}
		case 117:
			case_117:
			if (ch == L'e') {AddCh(); goto case_118;}
			else {goto case_0;}
		case 118:
			case_118:
			{t->kind = 43; break;}
		case 119:
			if (ch == L'r') {AddCh(); goto case_14;}
			else if (ch == L'o') {AddCh(); goto case_109;}
			else if (ch == L'h') {AddCh(); goto case_113;}
			else {goto case_0;}
		case 120:
			if (ch == L'a') {AddCh(); goto case_16;}
			else if (ch == L'o') {AddCh(); goto case_107;}
			else {goto case_0;}
		case 121:
			if (ch == L'o') {AddCh(); goto case_22;}
			else if (ch == L'a') {AddCh(); goto case_130;}
			else {goto case_0;}
		case 122:
			if (ch == L'e') {AddCh(); goto case_31;}
			else if (ch == L'o') {AddCh(); goto case_131;}
			else {goto case_0;}
		case 123:
			if (ch == L'n') {AddCh(); goto case_35;}
			else if (ch == L'l') {AddCh(); goto case_116;}
			else {goto case_0;}
		case 124:
			if (ch == L'm') {AddCh(); goto case_37;}
			else if (ch == L'n') {AddCh(); goto case_132;}
			else if (ch == L'f') {AddCh(); goto case_112;}
			else {goto case_0;}
		case 125:
			recEnd = pos; recKind = 16;
			if (ch == L'=') {AddCh(); goto case_86;}
			else {t->kind = 16; break;}
		case 126:
			if (ch == L'f') {AddCh(); goto case_60;}
			else if (ch == L'p') {AddCh(); goto case_71;}
			else {goto case_0;}
		case 127:
			if (ch == L'e') {AddCh(); goto case_133;}
			else {goto case_0;}
		case 128:
			recEnd = pos; recKind = 25;
			if (ch == L'd') {AddCh(); goto case_95;}
			else {t->kind = 25; break;}
		case 129:
			if (ch == L't') {AddCh(); goto case_134;}
			else {goto case_0;}
		case 130:
			case_130:
			if (ch == L'i') {AddCh(); goto case_135;}
			else {goto case_0;}
		case 131:
			case_131:
			if (ch == L'o') {AddCh(); goto case_136;}
			else {goto case_0;}
		case 132:
			case_132:
			if (ch == L',') {AddCh(); goto case_43;}
			else if (ch == L't') {AddCh(); goto case_137;}
			else if (ch == L'.') {AddCh(); goto case_70;}
			else {goto case_0;}
		case 133:
			case_133:
			if (ch == L'a') {AddCh(); goto case_65;}
			else if (ch == L'p') {AddCh(); goto case_97;}
			else {goto case_0;}
		case 134:
			case_134:
			if (ch == L'd') {AddCh(); goto case_75;}
			else if (ch == L'r') {AddCh(); goto case_82;}
			else {goto case_0;}
		case 135:
			case_135:
			if (ch == L'n') {AddCh(); goto case_138;}
			else {goto case_0;}
		case 136:
			case_136:
			if (ch == L'l') {AddCh(); goto case_139;}
			else {goto case_0;}
		case 137:
			case_137:
			recEnd = pos; recKind = 28;
			if (ch == L'e') {AddCh(); goto case_61;}
			else {t->kind = 28; break;}
		case 138:
			case_138:
			recEnd = pos; recKind = 11;
			if (ch == L';') {AddCh(); goto case_27;}
			else {t->kind = 11; break;}
		case 139:
			case_139:
			recEnd = pos; recKind = 29;
			if (ch == L'e') {AddCh(); goto case_67;}
			else {t->kind = 29; break;}

	}
	AppendVal(t);
	return t;
}
Token* Scanner::NextToken() {
	while (ch == ' ' ||
			(ch >= 9 && ch <= 10) || ch == 13
	) NextCh();
	if ((ch == L'(' && Comment0())) return NextToken();
	int recKind = noSym;
	int recEnd = pos;
	t = CreateToken();
	t->pos = pos; t->col = col; t->line = line; t->charPos = charPos;
	int state = start.state(ch);
	tlen = 0; AddCh();

	switch (state) {
		case -1: { t->kind = eofSym; break; } // NextCh already done
		case 0: {
			case_0:
			if (recKind != noSym) {
				tlen = recEnd - t->pos;
				SetScannerBehindT();
			}
			t->kind = recKind; break;
		} // NextCh already done
		case 1:
			case_1:
			recEnd = pos; recKind = 1;
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_1;}
			else {t->kind = 1; wchar_t *literal = coco_string_create(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 2:
			case_2:
			{t->kind = 2; break;}
		case 3:
			case_3:
			{t->kind = 3; break;}
		case 4:
			case_4:
			{t->kind = 4; break;}
		case 5:
			case_5:
			recEnd = pos; recKind = 5;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_5;}
			else if ((ch >= L'D' && ch <= L'E')) {AddCh(); goto case_6;}
			else {t->kind = 5; break;}
		case 6:
			case_6:
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_8;}
			else if (ch == L'+' || ch == L'-') {AddCh(); goto case_7;}
			else {goto case_0;}
		case 7:
			case_7:
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_8;}
			else {goto case_0;}
		case 8:
			case_8:
			recEnd = pos; recKind = 5;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_8;}
			else {t->kind = 5; break;}
		case 9:
			case_9:
			{t->kind = 6; break;}
		case 10:
			case_10:
			recEnd = pos; recKind = 4;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_10;}
			else if ((ch >= L'A' && ch <= L'F')) {AddCh(); goto case_13;}
			else if (ch == L'H') {AddCh(); goto case_4;}
			else if (ch == L'.') {AddCh(); goto case_5;}
			else if (ch == L'X') {AddCh(); goto case_9;}
			else {t->kind = 4; break;}
		case 11:
			case_11:
			if (ch == 10 || ch == 13) {AddCh(); goto case_2;}
			else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'!') || (ch >= L'#' && ch <= L'[') || (ch >= L']' && ch <= 65535)) {AddCh(); goto case_11;}
			else if (ch == 92) {AddCh(); goto case_14;}
			else if (ch == L'"') {AddCh(); goto case_3;}
			else {goto case_0;}
		case 12:
			case_12:
			if (ch == 10 || ch == 13) {AddCh(); goto case_2;}
			else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'&') || (ch >= L'(' && ch <= L'[') || (ch >= L']' && ch <= 65535)) {AddCh(); goto case_12;}
			else if (ch == 92) {AddCh(); goto case_15;}
			else if (ch == 39) {AddCh(); goto case_3;}
			else {goto case_0;}
		case 13:
			case_13:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'F')) {AddCh(); goto case_13;}
			else if (ch == L'H') {AddCh(); goto case_4;}
			else if (ch == L'X') {AddCh(); goto case_9;}
			else {goto case_0;}
		case 14:
			case_14:
			if ((ch >= 1 && ch <= 9) || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'!') || (ch >= L'#' && ch <= L'[') || (ch >= L']' && ch <= L't') || (ch >= L'v' && ch <= L'~')) {AddCh(); goto case_11;}
			else if (ch == L'u') {AddCh(); goto case_16;}
			else {goto case_0;}
		case 15:
			case_15:
			if ((ch >= 1 && ch <= 9) || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'!') || (ch >= L'#' && ch <= L'[') || (ch >= L']' && ch <= L't') || (ch >= L'v' && ch <= L'~')) {AddCh(); goto case_12;}
			else if (ch == L'u') {AddCh(); goto case_17;}
			else {goto case_0;}
		case 16:
			case_16:
			if (ch == 10 || ch == 13) {AddCh(); goto case_2;}
			else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'!') || (ch >= L'#' && ch <= L'/') || (ch >= L':' && ch <= L'@') || (ch >= L'G' && ch <= L'[') || (ch >= L']' && ch <= 65535)) {AddCh(); goto case_11;}
			else if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'F')) {AddCh(); goto case_18;}
			else if (ch == 92) {AddCh(); goto case_14;}
			else if (ch == L'"') {AddCh(); goto case_3;}
			else {goto case_0;}
		case 17:
			case_17:
			if (ch == 10 || ch == 13) {AddCh(); goto case_2;}
			else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'&') || (ch >= L'(' && ch <= L'/') || (ch >= L':' && ch <= L'@') || (ch >= L'G' && ch <= L'[') || (ch >= L']' && ch <= 65535)) {AddCh(); goto case_12;}
			else if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'F')) {AddCh(); goto case_19;}
			else if (ch == 92) {AddCh(); goto case_15;}
			else if (ch == 39) {AddCh(); goto case_3;}
			else {goto case_0;}
		case 18:
			case_18:
			if (ch == 10 || ch == 13) {AddCh(); goto case_2;}
			else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'!') || (ch >= L'#' && ch <= L'/') || (ch >= L':' && ch <= L'@') || (ch >= L'G' && ch <= L'[') || (ch >= L']' && ch <= 65535)) {AddCh(); goto case_11;}
			else if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'F')) {AddCh(); goto case_20;}
			else if (ch == 92) {AddCh(); goto case_14;}
			else if (ch == L'"') {AddCh(); goto case_3;}
			else {goto case_0;}
		case 19:
			case_19:
			if (ch == 10 || ch == 13) {AddCh(); goto case_2;}
			else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'&') || (ch >= L'(' && ch <= L'/') || (ch >= L':' && ch <= L'@') || (ch >= L'G' && ch <= L'[') || (ch >= L']' && ch <= 65535)) {AddCh(); goto case_12;}
			else if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'F')) {AddCh(); goto case_21;}
			else if (ch == 92) {AddCh(); goto case_15;}
			else if (ch == 39) {AddCh(); goto case_3;}
			else {goto case_0;}
		case 20:
			case_20:
			if (ch == 10 || ch == 13) {AddCh(); goto case_2;}
			else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'!') || (ch >= L'#' && ch <= L'/') || (ch >= L':' && ch <= L'@') || (ch >= L'G' && ch <= L'[') || (ch >= L']' && ch <= 65535)) {AddCh(); goto case_11;}
			else if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'F')) {AddCh(); goto case_22;}
			else if (ch == 92) {AddCh(); goto case_14;}
			else if (ch == L'"') {AddCh(); goto case_3;}
			else {goto case_0;}
		case 21:
			case_21:
			if (ch == 10 || ch == 13) {AddCh(); goto case_2;}
			else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'&') || (ch >= L'(' && ch <= L'/') || (ch >= L':' && ch <= L'@') || (ch >= L'G' && ch <= L'[') || (ch >= L']' && ch <= 65535)) {AddCh(); goto case_12;}
			else if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'F')) {AddCh(); goto case_23;}
			else if (ch == 92) {AddCh(); goto case_15;}
			else if (ch == 39) {AddCh(); goto case_3;}
			else {goto case_0;}
		case 22:
			case_22:
			if (ch == 10 || ch == 13) {AddCh(); goto case_2;}
			else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'!') || (ch >= L'#' && ch <= L'[') || (ch >= L']' && ch <= 65535)) {AddCh(); goto case_11;}
			else if (ch == 92) {AddCh(); goto case_14;}
			else if (ch == L'"') {AddCh(); goto case_3;}
			else {goto case_0;}
		case 23:
			case_23:
			if (ch == 10 || ch == 13) {AddCh(); goto case_2;}
			else if (ch <= 9 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'&') || (ch >= L'(' && ch <= L'[') || (ch >= L']' && ch <= 65535)) {AddCh(); goto case_12;}
			else if (ch == 92) {AddCh(); goto case_15;}
			else if (ch == 39) {AddCh(); goto case_3;}
			else {goto case_0;}
		case 24:
			{t->kind = 7; break;}
		case 25:
			{t->kind = 8; break;}
		case 26:
			case_26:
			{t->kind = 10; break;}
		case 27:
			case_27:
			{t->kind = 12; break;}
		case 28:
			{t->kind = 15; break;}
		case 29:
			{t->kind = 16; break;}
		case 30:
			{t->kind = 18; break;}
		case 31:
			{t->kind = 19; break;}
		case 32:
			{t->kind = 22; break;}
		case 33:
			case_33:
			{t->kind = 23; break;}
		case 34:
			{t->kind = 24; break;}
		case 35:
			{t->kind = 26; break;}
		case 36:
			{t->kind = 34; break;}
		case 37:
			{t->kind = 35; break;}
		case 38:
			{t->kind = 36; break;}
		case 39:
			case_39:
			{t->kind = 42; break;}
		case 40:
			{t->kind = 44; break;}
		case 41:
			{t->kind = 46; break;}
		case 42:
			{t->kind = 47; break;}
		case 43:
			{t->kind = 48; break;}
		case 44:
			{t->kind = 49; break;}
		case 45:
			{t->kind = 52; break;}
		case 46:
			recEnd = pos; recKind = 9;
			if (ch == L'=') {AddCh(); goto case_26;}
			else {t->kind = 9; break;}
		case 47:
			recEnd = pos; recKind = 11;
			if (ch == L'=') {AddCh(); goto case_27;}
			else {t->kind = 11; break;}
		case 48:
			recEnd = pos; recKind = 31;
			if (ch == L'=') {AddCh(); goto case_33;}
			else {t->kind = 31; break;}
		case 49:
			recEnd = pos; recKind = 45;
			if (ch == L'.') {AddCh(); goto case_39;}
			else {t->kind = 45; break;}

	}
	AppendVal(t);
	return t;
}
Exemple #16
0
static void
test_adds(int level)
{
    static bool first = TRUE;

    int ch;
    int limit;
    int row = 1;
    int col;
    int row2, col2;
    int length;
    char buffer[BUFSIZ];
    WINDOW *look = 0;
    WINDOW *work = 0;
    WINDOW *show = 0;
    int margin = (2 * MY_TABSIZE) - 1;
    Options option = (Options) ((unsigned) (m_opt
                                            ? oMove
                                            : oDefault)
                                | (unsigned) ((w_opt || (level > 0))
                                        ? oWindow
                                        : oDefault));

    if (first) {
        static char cmd[80];
        setlocale(LC_ALL, "");

        putenv(strcpy(cmd, "TABSIZE=8"));

        initscr();
        (void) cbreak();	/* take input chars one at a time, no wait for \n */
        (void) noecho();	/* don't echo input */
        keypad(stdscr, TRUE);
    }

    limit = LINES - 5;
    if (level > 0) {
        look = newwin(limit, COLS - (2 * (level - 1)), 0, level - 1);
        work = newwin(limit - 2, COLS - (2 * level), 1, level);
        show = newwin(4, COLS, limit + 1, 0);
        box(look, 0, 0);
        wnoutrefresh(look);
        limit -= 2;
    } else {
        work = stdscr;
        show = derwin(stdscr, 4, COLS, limit + 1, 0);
    }
    keypad(work, TRUE);

    for (col = margin + 1; col < COLS; col += MY_TABSIZE)
        MvWVLine(work, row, col, '.', limit - 2);

    MvWVLine(work, row, margin, ACS_VLINE, limit - 2);
    MvWVLine(work, row, margin + 1, ACS_VLINE, limit - 2);
    limit /= 2;

    MvWAddChStr(work, 1, 2, ChStr("String"));
    MvWAddChStr(work, limit + 1, 2, ChStr("Chars"));
    wnoutrefresh(work);

    buffer[length = 0] = '\0';
    legend(show, level, option, buffer, length);
    wnoutrefresh(show);

    doupdate();

    /*
     * Show the characters added in color, to distinguish from those that
     * are shifted.
     */
    if (has_colors()) {
        start_color();
        init_pair(1, COLOR_WHITE, COLOR_BLUE);
        show_attr = (attr_t) COLOR_PAIR(1);
        wbkgdset(work, show_attr | ' ');
    } else {
        show_attr = A_STANDOUT;
    }

    while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) {
        wmove(work, row, margin + 1);
        switch (ch) {
        case key_RECUR:
            test_adds(level + 1);

            touchwin(look);
            touchwin(work);
            touchwin(show);

            wnoutrefresh(look);
            wnoutrefresh(work);
            wnoutrefresh(show);

            doupdate();
            break;
        case key_NEWLINE:
            if (row < limit) {
                ++row;
                /* put the whole string in, all at once */
                col2 = margin + 1;
                switch (option) {
                case oDefault:
                    if (n_opt > 1) {
                        for (col = 0; col < length; col += n_opt) {
                            col2 = ColOf(buffer, col, margin);
                            if (move(row, col2) != ERR) {
                                AddNStr(ChStr2(buffer + col), LEN(col));
                            }
                        }
                    } else {
                        if (move(row, col2) != ERR) {
                            AddStr(ChStr2(buffer));
                        }
                    }
                    break;
                case oMove:
                    if (n_opt > 1) {
                        for (col = 0; col < length; col += n_opt) {
                            col2 = ColOf(buffer, col, margin);
                            MvAddNStr(row, col2, ChStr2(buffer + col), LEN(col));
                        }
                    } else {
                        MvAddStr(row, col2, ChStr2(buffer));
                    }
                    break;
                case oWindow:
                    if (n_opt > 1) {
                        for (col = 0; col < length; col += n_opt) {
                            col2 = ColOf(buffer, col, margin);
                            if (wmove(work, row, col2) != ERR) {
                                WAddNStr(work, ChStr2(buffer + col), LEN(col));
                            }
                        }
                    } else {
                        if (wmove(work, row, col2) != ERR) {
                            WAddStr(work, ChStr2(buffer));
                        }
                    }
                    break;
                case oMoveWindow:
                    if (n_opt > 1) {
                        for (col = 0; col < length; col += n_opt) {
                            col2 = ColOf(buffer, col, margin);
                            MvWAddNStr(work, row, col2, ChStr2(buffer + col),
                                       LEN(col));
                        }
                    } else {
                        MvWAddStr(work, row, col2, ChStr2(buffer));
                    }
                    break;
                }

                /* do the corresponding single-character add */
                row2 = limit + row;
                for (col = 0; col < length; ++col) {
                    col2 = ColOf(buffer, col, margin);
                    switch (option) {
                    case oDefault:
                        if (move(row2, col2) != ERR) {
                            AddCh(UChar(buffer[col]));
                        }
                        break;
                    case oMove:
                        MvAddCh(row2, col2, UChar(buffer[col]));
                        break;
                    case oWindow:
                        if (wmove(work, row2, col2) != ERR) {
                            WAddCh(work, UChar(buffer[col]));
                        }
                        break;
                    case oMoveWindow:
                        MvWAddCh(work, row2, col2, UChar(buffer[col]));
                        break;
                    }
                }
            } else {
                beep();
            }
            break;
        case KEY_BACKSPACE:
            ch = '\b';
        /* FALLTHRU */
        default:
            if (ch <= 0 || ch > 255) {
                beep();
                break;
            }
            buffer[length++] = (char) ch;
            buffer[length] = '\0';

            /* put the string in, one character at a time */
            col = ColOf(buffer, length - 1, margin);
            switch (option) {
            case oDefault:
                if (move(row, col) != ERR) {
                    AddStr(ChStr2(buffer + length - 1));
                }
                break;
            case oMove:
                MvAddStr(row, col, ChStr2(buffer + length - 1));
                break;
            case oWindow:
                if (wmove(work, row, col) != ERR) {
                    WAddStr(work, ChStr2(buffer + length - 1));
                }
                break;
            case oMoveWindow:
                MvWAddStr(work, row, col, ChStr2(buffer + length - 1));
                break;
            }

            /* do the corresponding single-character add */
            switch (option) {
            case oDefault:
                if (move(limit + row, col) != ERR) {
                    AddCh(UChar(ch));
                }
                break;
            case oMove:
                MvAddCh(limit + row, col, UChar(ch));
                break;
            case oWindow:
                if (wmove(work, limit + row, col) != ERR) {
                    WAddCh(work, UChar(ch));
                }
                break;
            case oMoveWindow:
                MvWAddCh(work, limit + row, col, UChar(ch));
                break;
            }

            wnoutrefresh(work);

            legend(show, level, option, buffer, length);
            wnoutrefresh(show);

            doupdate();
            break;
        }
    }
    if (level > 0) {
        delwin(show);
        delwin(work);
        delwin(look);
    }
}
Exemple #17
0
Token* Scanner::NextToken() {
	while (ch == ' ' ||
			false
	) NextCh();

	t = CreateToken();
	t->pos = pos; t->col = col; t->line = line;
	int state = start.state(ch);
	tlen = 0; AddCh();

	switch (state) {
		case -1: { t->kind = eofSym; break; } // NextCh already done
		case 0: { t->kind = noSym; break; }   // NextCh already done
		case 1:
			case_1:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_1;}
			else {t->kind = 1; wchar_t *literal = coco_string_create_lower(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 2:
			if (ch <= L'&' || (ch >= L'(' && ch <= 65535)) {AddCh(); goto case_3;}
			else {t->kind = noSym; break;}
		case 3:
			case_3:
			if (ch <= L'&' || (ch >= L'(' && ch <= 65535)) {AddCh(); goto case_3;}
			else if (ch == 39) {AddCh(); goto case_4;}
			else {t->kind = noSym; break;}
		case 4:
			case_4:
			{t->kind = 2; break;}
		case 5:
			case_5:
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_5;}
			else {t->kind = 3; break;}
		case 6:
			if (ch == L'=') {AddCh(); goto case_7;}
			else {t->kind = noSym; break;}
		case 7:
			case_7:
			{t->kind = 4; break;}
		case 8:
			if (ch == L'=') {AddCh(); goto case_7;}
			else {t->kind = 4; break;}
		case 9:
			if (ch == L'=') {AddCh(); goto case_7;}
			else {t->kind = 4; break;}
		case 10:
			{t->kind = 5; break;}
		case 11:
			{t->kind = 8; break;}
		case 12:
			{t->kind = 9; break;}
		case 13:
			{t->kind = 10; break;}
		case 14:
			case_14:
			{t->kind = 20; break;}
		case 15:
			case_15:
			{t->kind = 21; break;}
		case 16:
			{t->kind = 26; break;}
		case 17:
			if (ch == L'=') {AddCh(); goto case_7;}
			else {t->kind = 31; break;}
		case 18:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'a' && ch <= L'g') || (ch >= L'i' && ch <= L'z')) {AddCh(); goto case_1;}
			else if (ch == L'h') {AddCh(); goto case_20;}
			else {t->kind = 1; wchar_t *literal = coco_string_create_lower(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 19:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'b' && ch <= L'z')) {AddCh(); goto case_1;}
			else if (ch == L'a') {AddCh(); goto case_21;}
			else {t->kind = 1; wchar_t *literal = coco_string_create_lower(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 20:
			case_20:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'b' && ch <= L'z')) {AddCh(); goto case_1;}
			else if (ch == L'a') {AddCh(); goto case_22;}
			else {t->kind = 1; wchar_t *literal = coco_string_create_lower(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 21:
			case_21:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'a' && ch <= L'q') || (ch >= L's' && ch <= L'z')) {AddCh(); goto case_1;}
			else if (ch == L'r') {AddCh(); goto case_23;}
			else {t->kind = 1; wchar_t *literal = coco_string_create_lower(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 22:
			case_22:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'a' && ch <= L'q') || (ch >= L's' && ch <= L'z')) {AddCh(); goto case_1;}
			else if (ch == L'r') {AddCh(); goto case_24;}
			else {t->kind = 1; wchar_t *literal = coco_string_create_lower(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 23:
			case_23:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'a' && ch <= L'b') || (ch >= L'd' && ch <= L'z')) {AddCh(); goto case_1;}
			else if (ch == L'c') {AddCh(); goto case_25;}
			else {t->kind = 1; wchar_t *literal = coco_string_create_lower(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 24:
			case_24:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_1;}
			else if (ch == L'(') {AddCh(); goto case_14;}
			else {t->kind = 1; wchar_t *literal = coco_string_create_lower(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 25:
			case_25:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'a' && ch <= L'g') || (ch >= L'i' && ch <= L'z')) {AddCh(); goto case_1;}
			else if (ch == L'h') {AddCh(); goto case_26;}
			else {t->kind = 1; wchar_t *literal = coco_string_create_lower(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 26:
			case_26:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'b' && ch <= L'z')) {AddCh(); goto case_1;}
			else if (ch == L'a') {AddCh(); goto case_27;}
			else {t->kind = 1; wchar_t *literal = coco_string_create_lower(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 27:
			case_27:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'a' && ch <= L'q') || (ch >= L's' && ch <= L'z')) {AddCh(); goto case_1;}
			else if (ch == L'r') {AddCh(); goto case_28;}
			else {t->kind = 1; wchar_t *literal = coco_string_create_lower(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 28:
			case_28:
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_1;}
			else if (ch == L'(') {AddCh(); goto case_15;}
			else {t->kind = 1; wchar_t *literal = coco_string_create_lower(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}

	}
	AppendVal(t);
	return t;
}
Exemple #18
0
Token* Scanner::NextToken() {
	while (ch == ' ' ||
			(ch >= 9 && ch <= 10) || ch == 13
	) NextCh();

	int recKind = noSym;
	int recEnd = pos;
	t = CreateToken();
	t->pos = pos; t->col = col; t->line = line; t->charPos = charPos;
	int state = start.state(ch);
	tlen = 0; AddCh();

	switch (state) {
		case -1: { t->kind = eofSym; break; } // NextCh already done
		case 0: {
			case_0:
			if (recKind != noSym) {
				tlen = recEnd - t->pos;
				SetScannerBehindT();
			}
			t->kind = recKind; break;
		} // NextCh already done
		case 1:
			case_1:
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_2;}
			else {goto case_0;}
		case 2:
			case_2:
			recEnd = pos; recKind = 2;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_2;}
			else {t->kind = 2; break;}
		case 3:
			if ((ch >= L'A' && ch <= L'Z') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_4;}
			else {goto case_0;}
		case 4:
			case_4:
			if ((ch >= L'A' && ch <= L'Z') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_4;}
			else if (ch == L'"') {AddCh(); goto case_5;}
			else {goto case_0;}
		case 5:
			case_5:
			{t->kind = 3; break;}
		case 6:
			case_6:
			recEnd = pos; recKind = 4;
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_6;}
			else {t->kind = 4; wchar_t *literal = coco_string_create(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;}
		case 7:
			case_7:
			recEnd = pos; recKind = 1;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_7;}
			else if (ch == L'.') {AddCh(); goto case_1;}
			else {t->kind = 1; break;}
		case 8:
			{t->kind = 6; break;}
		case 9:
			{t->kind = 7; break;}
		case 10:
			{t->kind = 9; break;}
		case 11:
			{t->kind = 10; break;}
		case 12:
			{t->kind = 11; break;}
		case 13:
			if (ch == L'.') {AddCh(); goto case_14;}
			else {goto case_0;}
		case 14:
			case_14:
			{t->kind = 12; break;}
		case 15:
			{t->kind = 13; break;}
		case 16:
			{t->kind = 17; break;}
		case 17:
			{t->kind = 18; break;}
		case 18:
			{t->kind = 22; break;}
		case 19:
			{t->kind = 23; break;}
		case 20:
			{t->kind = 31; break;}
		case 21:
			{t->kind = 33; break;}
		case 22:
			case_22:
			{t->kind = 53; break;}
		case 23:
			case_23:
			{t->kind = 54; break;}
		case 24:
			case_24:
			{t->kind = 55; break;}
		case 25:
			case_25:
			{t->kind = 56; break;}
		case 26:
			{t->kind = 61; break;}
		case 27:
			{t->kind = 62; break;}
		case 28:
			{t->kind = 63; break;}
		case 29:
			recEnd = pos; recKind = 26;
			if (ch == L'=') {AddCh(); goto case_22;}
			else {t->kind = 26; break;}
		case 30:
			recEnd = pos; recKind = 57;
			if (ch == L'>') {AddCh(); goto case_23;}
			else if (ch == L'=') {AddCh(); goto case_24;}
			else {t->kind = 57; break;}
		case 31:
			recEnd = pos; recKind = 58;
			if (ch == L'=') {AddCh(); goto case_25;}
			else {t->kind = 58; break;}

	}
	AppendVal(t);
	return t;
}
Exemple #19
0
static void
play_game(void)
{
    int dead = 0, i, j;
    char c;
    int selection[4], card;

    while (dead < 4) {
	dead = 0;
	for (i = 0; i < 4; i++) {
	    card = grid[freeptr[i] - 1];

	    if (((card % SUIT_LENGTH) == KING)
		||
		(card == NOCARD))
		selection[i] = NOCARD;
	    else
		selection[i] = find(card + 1);

	    if (selection[i] == NOCARD)
		dead++;
	};

	if (dead < 4) {
	    char live[NSUITS + 1], *lp = live;

	    for (i = 0; i < 4; i++) {
		if (selection[i] != NOCARD) {
		    move(BASEROW + (selection[i] / GRID_WIDTH) * 2 + 3,
			 (selection[i] % GRID_WIDTH) * 5);
		    (void) printw("   %c ", (*lp++ = (char) ('a' + i)));
		}
	    };
	    *lp = '\0';

	    if (strlen(live) == 1) {
		move(PROMPTROW, 0);
		(void) printw(
				 "Making forced moves...                                 ");
		refresh();
		(void) sleep(1);
		c = live[0];
	    } else {
		char buf[BUFSIZ];

		_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
			    "Type [%s] to move, r to redraw, q or INTR to quit: ",
			    live);

		do {
		    move(PROMPTROW, 0);
		    (void) addstr(buf);
		    move(PROMPTROW, (int) strlen(buf));
		    clrtoeol();
		    AddCh(' ');
		} while
		    (((c = (char) getch()) < 'a' || c > 'd')
		     && (c != 'r')
		     && (c != 'q'));
	    }

	    for (j = 0; j < 4; j++)
		if (selection[j] != NOCARD) {
		    move(BASEROW + (selection[j] / GRID_WIDTH) * 2 + 3,
			 (selection[j] % GRID_WIDTH) * 5);
		    (void) printw("     ");
		}

	    if (c == 'r')
		display_cards(deal_number);
	    else if (c == 'q')
		die(SIGINT);
	    else {
		i = c - 'a';
		if (selection[i] == NOCARD)
		    beep();
		else {
		    movecard(selection[i], freeptr[i]);
		    freeptr[i] = selection[i];
		}
	    }
	}
    }

    move(PROMPTROW, 0);
    (void) standout();
    (void) printw("Finished deal %d - type any character to continue...", deal_number);
    (void) standend();
    (void) getch();
}
Exemple #20
0
Token* Scanner::NextToken() {
	while (ch == ' ' ||
			(ch >= 9 && ch <= 10) || ch == 13
	) NextCh();

	int recKind = noSym;
	int recEnd = pos;
	t = CreateToken();
	t->pos = pos; t->col = col; t->line = line; t->charPos = charPos;
	int state = start.state(ch);
	tlen = 0; AddCh();

	switch (state) {
		case -1: { t->kind = eofSym; break; } // NextCh already done
		case 0: {
			case_0:
			if (recKind != noSym) {
				tlen = recEnd - t->pos;
				SetScannerBehindT();
			}
			t->kind = recKind; break;
		} // NextCh already done
		case 1:
			if ((ch >= L'A' && ch <= L'Z') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_2;}
			else {goto case_0;}
		case 2:
			case_2:
			recEnd = pos; recKind = 1;
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_2;}
			else {t->kind = 1; break;}
		case 3:
			if ((ch >= L'A' && ch <= L'Z') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_4;}
			else {goto case_0;}
		case 4:
			case_4:
			recEnd = pos; recKind = 2;
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_4;}
			else {t->kind = 2; break;}
		case 5:
			case_5:
			recEnd = pos; recKind = 3;
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_5;}
			else {t->kind = 3; break;}
		case 6:
			if ((ch >= L'A' && ch <= L'Z')) {AddCh(); goto case_7;}
			else {goto case_0;}
		case 7:
			case_7:
			recEnd = pos; recKind = 4;
			if ((ch >= L'0' && ch <= L'9') || (ch >= L'A' && ch <= L'Z') || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_7;}
			else {t->kind = 4; break;}
		case 8:
			case_8:
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_9;}
			else {goto case_0;}
		case 9:
			case_9:
			recEnd = pos; recKind = 6;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_9;}
			else {t->kind = 6; break;}
		case 10:
			if (ch <= 8 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'!') || (ch >= L'#' && ch <= 65535)) {AddCh(); goto case_11;}
			else {goto case_0;}
		case 11:
			case_11:
			if (ch <= 8 || (ch >= 11 && ch <= 12) || (ch >= 14 && ch <= L'!') || (ch >= L'#' && ch <= 65535)) {AddCh(); goto case_11;}
			else if (ch == L'"') {AddCh(); goto case_12;}
			else {goto case_0;}
		case 12:
			case_12:
			{t->kind = 7; break;}
		case 13:
			if (ch == L'r') {AddCh(); goto case_14;}
			else {goto case_0;}
		case 14:
			case_14:
			if (ch == L'u') {AddCh(); goto case_15;}
			else {goto case_0;}
		case 15:
			case_15:
			if (ch == L'e') {AddCh(); goto case_20;}
			else {goto case_0;}
		case 16:
			if (ch == L'a') {AddCh(); goto case_17;}
			else {goto case_0;}
		case 17:
			case_17:
			if (ch == L'l') {AddCh(); goto case_18;}
			else {goto case_0;}
		case 18:
			case_18:
			if (ch == L's') {AddCh(); goto case_19;}
			else {goto case_0;}
		case 19:
			case_19:
			if (ch == L'e') {AddCh(); goto case_20;}
			else {goto case_0;}
		case 20:
			case_20:
			{t->kind = 8; break;}
		case 21:
			if (ch == L'l') {AddCh(); goto case_22;}
			else {goto case_0;}
		case 22:
			case_22:
			if (ch == L'a') {AddCh(); goto case_23;}
			else {goto case_0;}
		case 23:
			case_23:
			if (ch == L's') {AddCh(); goto case_24;}
			else {goto case_0;}
		case 24:
			case_24:
			if (ch == L's') {AddCh(); goto case_25;}
			else {goto case_0;}
		case 25:
			case_25:
			{t->kind = 9; break;}
		case 26:
			case_26:
			if (ch == L'b') {AddCh(); goto case_27;}
			else {goto case_0;}
		case 27:
			case_27:
			if (ch == L'l') {AddCh(); goto case_28;}
			else {goto case_0;}
		case 28:
			case_28:
			if (ch == L'i') {AddCh(); goto case_29;}
			else {goto case_0;}
		case 29:
			case_29:
			if (ch == L'c') {AddCh(); goto case_30;}
			else {goto case_0;}
		case 30:
			case_30:
			{t->kind = 10; break;}
		case 31:
			case_31:
			if (ch == L'v') {AddCh(); goto case_32;}
			else {goto case_0;}
		case 32:
			case_32:
			if (ch == L'a') {AddCh(); goto case_33;}
			else {goto case_0;}
		case 33:
			case_33:
			if (ch == L't') {AddCh(); goto case_34;}
			else {goto case_0;}
		case 34:
			case_34:
			if (ch == L'e') {AddCh(); goto case_35;}
			else {goto case_0;}
		case 35:
			case_35:
			{t->kind = 11; break;}
		case 36:
			case_36:
			if (ch == L't') {AddCh(); goto case_37;}
			else {goto case_0;}
		case 37:
			case_37:
			if (ch == L'e') {AddCh(); goto case_38;}
			else {goto case_0;}
		case 38:
			case_38:
			if (ch == L'c') {AddCh(); goto case_39;}
			else {goto case_0;}
		case 39:
			case_39:
			if (ch == L't') {AddCh(); goto case_40;}
			else {goto case_0;}
		case 40:
			case_40:
			{t->kind = 12; break;}
		case 41:
			if (ch == L'e') {AddCh(); goto case_42;}
			else {goto case_0;}
		case 42:
			case_42:
			if (ch == L't') {AddCh(); goto case_43;}
			else {goto case_0;}
		case 43:
			case_43:
			if (ch == L'u') {AddCh(); goto case_44;}
			else {goto case_0;}
		case 44:
			case_44:
			if (ch == L'r') {AddCh(); goto case_45;}
			else {goto case_0;}
		case 45:
			case_45:
			if (ch == L'n') {AddCh(); goto case_46;}
			else {goto case_0;}
		case 46:
			case_46:
			{t->kind = 13; break;}
		case 47:
			if (ch == L't') {AddCh(); goto case_48;}
			else {goto case_0;}
		case 48:
			case_48:
			if (ch == L'r') {AddCh(); goto case_49;}
			else {goto case_0;}
		case 49:
			case_49:
			if (ch == L'i') {AddCh(); goto case_50;}
			else {goto case_0;}
		case 50:
			case_50:
			if (ch == L'n') {AddCh(); goto case_51;}
			else {goto case_0;}
		case 51:
			case_51:
			if (ch == L'g') {AddCh(); goto case_52;}
			else {goto case_0;}
		case 52:
			case_52:
			{t->kind = 14; break;}
		case 53:
			case_53:
			if (ch == L't') {AddCh(); goto case_54;}
			else {goto case_0;}
		case 54:
			case_54:
			{t->kind = 15; break;}
		case 55:
			if (ch == L'o') {AddCh(); goto case_56;}
			else {goto case_0;}
		case 56:
			case_56:
			if (ch == L'u') {AddCh(); goto case_57;}
			else {goto case_0;}
		case 57:
			case_57:
			if (ch == L'b') {AddCh(); goto case_58;}
			else {goto case_0;}
		case 58:
			case_58:
			if (ch == L'l') {AddCh(); goto case_59;}
			else {goto case_0;}
		case 59:
			case_59:
			if (ch == L'e') {AddCh(); goto case_60;}
			else {goto case_0;}
		case 60:
			case_60:
			{t->kind = 16; break;}
		case 61:
			if (ch == L'o') {AddCh(); goto case_62;}
			else {goto case_0;}
		case 62:
			case_62:
			if (ch == L'o') {AddCh(); goto case_63;}
			else {goto case_0;}
		case 63:
			case_63:
			if (ch == L'l') {AddCh(); goto case_64;}
			else {goto case_0;}
		case 64:
			case_64:
			{t->kind = 17; break;}
		case 65:
			if (ch == L'e') {AddCh(); goto case_66;}
			else {goto case_0;}
		case 66:
			case_66:
			if (ch == L'w') {AddCh(); goto case_67;}
			else {goto case_0;}
		case 67:
			case_67:
			{t->kind = 18; break;}
		case 68:
			if (ch == L'o') {AddCh(); goto case_69;}
			else {goto case_0;}
		case 69:
			case_69:
			if (ch == L'i') {AddCh(); goto case_70;}
			else {goto case_0;}
		case 70:
			case_70:
			if (ch == L'd') {AddCh(); goto case_71;}
			else {goto case_0;}
		case 71:
			case_71:
			{t->kind = 19; break;}
		case 72:
			case_72:
			{t->kind = 20; break;}
		case 73:
			case_73:
			if (ch == L'f') {AddCh(); goto case_74;}
			else {goto case_0;}
		case 74:
			case_74:
			{t->kind = 22; break;}
		case 75:
			if (ch == L'h') {AddCh(); goto case_76;}
			else {goto case_0;}
		case 76:
			case_76:
			if (ch == L'i') {AddCh(); goto case_77;}
			else {goto case_0;}
		case 77:
			case_77:
			if (ch == L'l') {AddCh(); goto case_78;}
			else {goto case_0;}
		case 78:
			case_78:
			if (ch == L'e') {AddCh(); goto case_79;}
			else {goto case_0;}
		case 79:
			case_79:
			{t->kind = 23; break;}
		case 80:
			case_80:
			{t->kind = 24; break;}
		case 81:
			if (ch == L'a') {AddCh(); goto case_82;}
			else {goto case_0;}
		case 82:
			case_82:
			if (ch == L'i') {AddCh(); goto case_83;}
			else {goto case_0;}
		case 83:
			case_83:
			if (ch == L'n') {AddCh(); goto case_84;}
			else {goto case_0;}
		case 84:
			case_84:
			{t->kind = 25; break;}
		case 85:
			case_85:
			{t->kind = 26; break;}
		case 86:
			case_86:
			{t->kind = 27; break;}
		case 87:
			case_87:
			{t->kind = 28; break;}
		case 88:
			case_88:
			{t->kind = 29; break;}
		case 89:
			case_89:
			{t->kind = 30; break;}
		case 90:
			case_90:
			{t->kind = 31; break;}
		case 91:
			case_91:
			{t->kind = 32; break;}
		case 92:
			case_92:
			{t->kind = 33; break;}
		case 93:
			case_93:
			if (ch <= L')' || (ch >= L'+' && ch <= 65535)) {AddCh(); goto case_93;}
			else if (ch == L'*') {AddCh(); goto case_100;}
			else {goto case_0;}
		case 94:
			case_94:
			{t->kind = 56; break;}
		case 95:
			case_95:
			recEnd = pos; recKind = 5;
			if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_95;}
			else if (ch == L'.') {AddCh(); goto case_8;}
			else {t->kind = 5; break;}
		case 96:
			if (ch == L'u') {AddCh(); goto case_26;}
			else if (ch == L'r') {AddCh(); goto case_101;}
			else {goto case_0;}
		case 97:
			if (ch == L'n') {AddCh(); goto case_53;}
			else if (ch == L'f') {AddCh(); goto case_72;}
			else {goto case_0;}
		case 98:
			if (ch == L'l') {AddCh(); goto case_102;}
			else {goto case_0;}
		case 99:
			recEnd = pos; recKind = 21;
			if (ch == L'?') {AddCh(); goto case_74;}
			else {t->kind = 21; break;}
		case 100:
			case_100:
			if (ch <= L')' || (ch >= L'+' && ch <= L'.') || (ch >= L'0' && ch <= 65535)) {AddCh(); goto case_93;}
			else if (ch == L'/') {AddCh(); goto case_94;}
			else if (ch == L'*') {AddCh(); goto case_100;}
			else {goto case_0;}
		case 101:
			case_101:
			if (ch == L'i') {AddCh(); goto case_31;}
			else if (ch == L'o') {AddCh(); goto case_36;}
			else {goto case_0;}
		case 102:
			case_102:
			if (ch == L's') {AddCh(); goto case_103;}
			else {goto case_0;}
		case 103:
			case_103:
			if (ch == L'e') {AddCh(); goto case_104;}
			else {goto case_0;}
		case 104:
			case_104:
			recEnd = pos; recKind = 21;
			if (ch == L'i') {AddCh(); goto case_73;}
			else {t->kind = 21; break;}
		case 105:
			{t->kind = 34; break;}
		case 106:
			{t->kind = 35; break;}
		case 107:
			{t->kind = 37; break;}
		case 108:
			{t->kind = 38; break;}
		case 109:
			{t->kind = 39; break;}
		case 110:
			{t->kind = 40; break;}
		case 111:
			{t->kind = 41; break;}
		case 112:
			{t->kind = 42; break;}
		case 113:
			{t->kind = 43; break;}
		case 114:
			{t->kind = 46; break;}
		case 115:
			{t->kind = 47; break;}
		case 116:
			{t->kind = 50; break;}
		case 117:
			{t->kind = 51; break;}
		case 118:
			{t->kind = 52; break;}
		case 119:
			{t->kind = 54; break;}
		case 120:
			recEnd = pos; recKind = 45;
			if (ch == L'>') {AddCh(); goto case_80;}
			else if (ch == L'-') {AddCh(); goto case_88;}
			else {t->kind = 45; break;}
		case 121:
			recEnd = pos; recKind = 49;
			if (ch == L'>') {AddCh(); goto case_85;}
			else if (ch == L'=') {AddCh(); goto case_89;}
			else {t->kind = 49; break;}
		case 122:
			recEnd = pos; recKind = 48;
			if (ch == L'<') {AddCh(); goto case_86;}
			else if (ch == L'=') {AddCh(); goto case_90;}
			else if (ch == L'>') {AddCh(); goto case_91;}
			else {t->kind = 48; break;}
		case 123:
			recEnd = pos; recKind = 44;
			if (ch == L'+') {AddCh(); goto case_87;}
			else {t->kind = 44; break;}
		case 124:
			recEnd = pos; recKind = 36;
			if (ch == L'=') {AddCh(); goto case_92;}
			else {t->kind = 36; break;}
		case 125:
			recEnd = pos; recKind = 53;
			if (ch == L'*') {AddCh(); goto case_93;}
			else {t->kind = 53; break;}

	}
	AppendVal(t);
	return t;
}