From: Matthias Kruk Date: Sat, 30 May 2020 14:28:27 +0000 (+0900) Subject: tokenize: Fix mistaken use of putchar() where putnext() should have been X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=d7a1c389860e6777822b5523c5aca7ed2351d027;p=ccc tokenize: Fix mistaken use of putchar() where putnext() should have been --- diff --git a/src/tokenize.c b/src/tokenize.c index dcfcfe6..a7adf39 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -457,7 +457,7 @@ struct token *nexttoken(void) return(token_new2(_line, _col, "-=")); default: - putchar(c); + putnext(c); return(token_new2(_line, _col, "-")); } @@ -490,7 +490,6 @@ struct token *nexttoken(void) case STATE_NUM: /* FIXME: e, E may be in the middle, (u|U)(l|L|ll|LL) or vice versa may be at the end */ - if(c >= '0' && c <= '9' || c == '.') { str_appendc(tok->value, c); } else { @@ -513,43 +512,8 @@ int main(int argc, char *argv[]) ret_val = 0; while((tok = nexttoken())) { - printf("Token at %d:%d: %s\n", tok->line, tok->column, str_value(tok->value)); - } -#if 0 - while(_state != STATE_DONE) { - printf("_state = %d\n", _state); - - switch(_state) { - case STATE_NONE: - _state = none(); - break; - - case STATE_COMMENT: - _state = comment(); - break; - - case STATE_OP: - _state = op(); - break; - - default: - _state = STATE_DONE; - break; - } - } - - if(!tokens) { - printf("No tokens\n"); - } - - for(litem = tokens; litem; litem = litem->next) { - struct token *t; - - t = (struct token*)litem->data; - - printf("%s token at line %d:%d\n", token_typestr(t->type), t->line, t->column); + printf("Token at %4d:%3d: \"%s\"\n", tok->line, tok->column, str_value(tok->value)); } -#endif return(ret_val); }