diff --git a/src/lexer.c b/src/lexer.c index 3ae4d35..af26a40 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -77,7 +77,7 @@ void lexer_do_call(Lexer* lexer) { for (; *lexer->cchar && (isblank(lexer->cchar) || *lexer->cchar == '\n'); lexer_inc(lexer)); - for (callsz = 0; *lexer->cchar && isalpha(*lexer->cchar); callsz++) + for (callsz = 0; *lexer->cchar && (!isdigit(*lexer->cchar)); callsz++) lexer_inc(lexer); char* call = malloc(callsz + 1); diff --git a/src/main.c b/src/main.c index f863774..7899779 100644 --- a/src/main.c +++ b/src/main.c @@ -10,15 +10,17 @@ int main(int argc, char** argv) { Dstr* cline = dstr_init(); // The current line. printf("> "); fflush(stdout); - for (char cch; (cch = getchar() != EOF);) { - dstr_appendch(cline, fgetc(stdin)); + for (char cch; (cch = getc(stdin)) != '\n';) { + log_dbgf("cchar: %c", cch); + dstr_appendch(cline, cch); } + log_dbgf("cline: %s", cline->buf); + if (cline->ln > 0) { Lexer* lexer = lexer_init(cline->buf); lexer_lex(lexer); printf("\n=%s\n", token_to_dstr(lexer->tokens[0])->buf); } - } }