work in progess
This commit is contained in:
@@ -19,10 +19,10 @@
|
||||
#define RES_OK 0
|
||||
#define RES_ERR -1
|
||||
|
||||
#define POS1TYPE TOKEN_WORD
|
||||
#define POS2TYPE TOKEN_OPER
|
||||
#define POS3TYPE TOKEN_WORD
|
||||
#define POS4TYPE TOKEN_COMM
|
||||
//#define POS1TYPE TLEX_TOKEN_WORD
|
||||
//#define POS2TYPE TLEX_TOKEN_OPER
|
||||
//#define POS3TYPE TLEX_TOKEN_WORD
|
||||
//#define POS4TYPE TLEX_TOKEN_COMM
|
||||
|
||||
static char* strcopy(char* src) {
|
||||
size_t srcsize = strlen(src) + 1;
|
||||
@@ -62,25 +62,25 @@ int tccomp_parse(tccomp_t * comp) {
|
||||
|
||||
while (true) {
|
||||
toktype = tclexer_get_token(lexer, token, MAX_TOK_SIZE);
|
||||
if (toktype == TOKEN_SPACE) {
|
||||
if (toktype == TLEX_TOKEN_SPACE) {
|
||||
continue;
|
||||
}
|
||||
if (toktype == TOKEN_COMM) {
|
||||
if (toktype == TLEX_TOKEN_COMM) {
|
||||
continue;
|
||||
}
|
||||
//printf("tok=%d pos=%d line=%d [%s]\n", toktype, comp->pos, comp->lnum, token);
|
||||
|
||||
if (toktype == TOKEN_NEWLN) {
|
||||
if (toktype == TLEX_TOKEN_NEWLN) {
|
||||
comp->lnum++;
|
||||
}
|
||||
|
||||
switch (comp->pos) {
|
||||
case 0:{
|
||||
if (toktype == TOKEN_NEWLN) {
|
||||
if (toktype == TLEX_TOKEN_NEWLN) {
|
||||
comp->pos = 0;
|
||||
break;
|
||||
}
|
||||
if (toktype != TOKEN_WORD) {
|
||||
if (toktype != TLEX_TOKEN_WORD) {
|
||||
return -1;
|
||||
}
|
||||
comp->pos++;
|
||||
@@ -88,14 +88,14 @@ int tccomp_parse(tccomp_t * comp) {
|
||||
break;
|
||||
}
|
||||
case 1:{
|
||||
if (toktype != TOKEN_OPER) {
|
||||
if (toktype != TLEX_TOKEN_OPER) {
|
||||
return -1;
|
||||
}
|
||||
comp->pos++;
|
||||
break;
|
||||
}
|
||||
case 2:{
|
||||
if (toktype != TOKEN_WORD) {
|
||||
if (toktype != TLEX_TOKEN_WORD) {
|
||||
return -1;
|
||||
}
|
||||
comp->pos++;
|
||||
@@ -103,7 +103,7 @@ int tccomp_parse(tccomp_t * comp) {
|
||||
break;
|
||||
}
|
||||
case 3:{
|
||||
if (toktype != TOKEN_NEWLN && toktype != TOKEN_ENDFL) {
|
||||
if (toktype != TLEX_TOKEN_NEWLN && toktype != TLEX_TOKEN_ENDFL) {
|
||||
return -1;
|
||||
}
|
||||
comp->pos = 0;
|
||||
@@ -114,7 +114,7 @@ int tccomp_parse(tccomp_t * comp) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (toktype == TOKEN_ENDFL)
|
||||
if (toktype == TLEX_TOKEN_ENDFL)
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user