wchar_t* coco_string_create_lower(const wchar_t* data) { if (!data) { return NULL; } int dataLen = wcslen(data); return coco_string_create_lower(data, 0, dataLen); }
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; }