Fixed lexing error inside token string not being on heap
This commit is contained in:
parent
76a89fe03f
commit
727f461fb6
|
|
@ -761,14 +761,15 @@ static LexerResult parse_token_string(LexerInfo *lexer_info, char c, size_t star
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current->type == SLS_ERROR) {
|
if (current->type == SLS_ERROR) {
|
||||||
LexerResult e = (LexerResult){SLS_RESULT, .result = &(LexerTokenResult){
|
LexerTokenResult *e = (LexerTokenResult *)malloc(sizeof(LexerTokenResult));
|
||||||
|
*e = (LexerTokenResult){
|
||||||
.type = SLS_ERROR,
|
.type = SLS_ERROR,
|
||||||
.error = (SlsError){sls_str_cpy(current->error.message), 1},
|
.error = (SlsError){sls_str_cpy(current->error.message), 1},
|
||||||
.file_info = current->file_info,
|
.file_info = current->file_info,
|
||||||
.next = NULL
|
.next = NULL
|
||||||
}};
|
};
|
||||||
clean_token_result(head);
|
clean_token_result(head);
|
||||||
return e;
|
return (LexerResult){SLS_RESULT, .result = e};
|
||||||
}
|
}
|
||||||
if (current->result.type == TOKEN_EOF) break;
|
if (current->result.type == TOKEN_EOF) break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue