semicolon

This commit is contained in:
Timerix 2024-11-21 09:48:54 +05:00
parent 1729070b80
commit ad232f187a

View File

@ -187,7 +187,7 @@ static void readArguments(Compiler* cmp){
while(cmp->pos < cmp->code_len){ while(cmp->pos < cmp->code_len){
c = cmp->code[cmp->pos]; c = cmp->code[cmp->pos];
// end of line // end of line
if(c == '\r' || c == '\n'){ if(c == '\r' || c == '\n' || c == ';'){
tok.length = cmp->pos - tok.begin; tok.length = cmp->pos - tok.begin;
if(tok.length > 0) if(tok.length > 0)
List_Token_push(&cmp->tokens, tok); List_Token_push(&cmp->tokens, tok);
@ -222,7 +222,7 @@ static void readInstruction(Compiler* cmp){
while(cmp->pos < cmp->code_len){ while(cmp->pos < cmp->code_len){
char c = cmp->code[cmp->pos]; char c = cmp->code[cmp->pos];
// end of line // end of line
if(c == '\r' || c == '\n'){ if(c == '\r' || c == '\n' || c == ';'){
tok.length = cmp->pos - tok.begin; tok.length = cmp->pos - tok.begin;
List_Token_push(&cmp->tokens, tok); List_Token_push(&cmp->tokens, tok);
// cmp->line will be increased in lex() // cmp->line will be increased in lex()
@ -358,9 +358,8 @@ bool Compiler_compileTasm(Compiler* cmp, cstr source_file_name, cstr out_file_na
char* tokstr = malloc(4096); char* tokstr = malloc(4096);
strncpy(tokstr, cmp->code + t.begin, t.length); strncpy(tokstr, cmp->code + t.begin, t.length);
tokstr[t.length] = 0; tokstr[t.length] = 0;
printf("[l:%u, c:%u](pos:%u, size:%u) %s '%s'\n", printf("[l:%2u, c:%2u] %s '%s'\n",
pos.line, pos.column, pos.line, pos.column,
t.begin, t.length,
TokenType_toString(t.type), tokstr); TokenType_toString(t.type), tokstr);
free(tokstr); free(tokstr);
} }