Fix a bug that produced a lot of NONEs in the syntaxtree

This commit is contained in:
bʰedoh₂ swé 2024-06-09 22:24:58 +05:00
parent 96acb9df26
commit 6e1de39a2e

View File

@ -37,7 +37,6 @@ tSyntaxElement* parse(FILE* file) {
continue; continue;
} }
if (instring) { if (instring) {
syntaxtree = se_next(syntaxtree);
if (symbol == '"') { if (symbol == '"') {
if (extstring == NULL) { if (extstring == NULL) {
extstring = malloc(sizeof(tExtstring)); extstring = malloc(sizeof(tExtstring));
@ -61,7 +60,6 @@ tSyntaxElement* parse(FILE* file) {
continue; continue;
} }
if (intoken) { if (intoken) {
syntaxtree = se_next(syntaxtree);
if (isspace(symbol) || symbol == '(' || symbol == ')') { if (isspace(symbol) || symbol == '(' || symbol == ')') {
intoken = false; intoken = false;
syntaxtree->type = TOKEN; syntaxtree->type = TOKEN;
@ -93,9 +91,11 @@ tSyntaxElement* parse(FILE* file) {
incomment = true; incomment = true;
continue; continue;
case '"': case '"':
syntaxtree = se_next(syntaxtree);
instring = true; instring = true;
continue; continue;
default: default:
syntaxtree = se_next(syntaxtree);
exttoken = malloc(sizeof(tExtstring)); exttoken = malloc(sizeof(tExtstring));
exttoken->symbol = symbol; exttoken->symbol = symbol;
exttoken->next = NULL; exttoken->next = NULL;