Fix bug
This commit is contained in:
@@ -22,7 +22,6 @@ ResultType(SolsParser, charptr) createSolsParser(SolsTokens* input) {
|
|||||||
if (parser.errors.at == NULL) {
|
if (parser.errors.at == NULL) {
|
||||||
return Error(SolsParser, charptr, "Couldn't allocate memory to store errors (in createSolsParser() function)");
|
return Error(SolsParser, charptr, "Couldn't allocate memory to store errors (in createSolsParser() function)");
|
||||||
}
|
}
|
||||||
parser.currentParent = &parser.output;
|
|
||||||
return Success(SolsParser, charptr, parser);
|
return Success(SolsParser, charptr, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +106,7 @@ static inline ResultType(Nothing, charptr) parseIdentifier(SolsParser* parser) {
|
|||||||
APPEND_ESTR(err, " (in parseLiteral() function)");
|
APPEND_ESTR(err, " (in parseLiteral() function)");
|
||||||
return Error(Nothing, charptr, err.str);
|
return Error(Nothing, charptr, err.str);
|
||||||
}
|
}
|
||||||
// addChildToSolsNode(parser->currentParent, node.as.success);
|
addChildToSolsNode(parser->currentParent, node.as.success);
|
||||||
return Success(Nothing, charptr, {});
|
return Success(Nothing, charptr, {});
|
||||||
}
|
}
|
||||||
static inline ResultType(Nothing, charptr) parseLiteral(SolsParser* parser) {
|
static inline ResultType(Nothing, charptr) parseLiteral(SolsParser* parser) {
|
||||||
@@ -121,7 +120,7 @@ static inline ResultType(Nothing, charptr) parseLiteral(SolsParser* parser) {
|
|||||||
APPEND_ESTR(err, " (in parseLiteral() function)");
|
APPEND_ESTR(err, " (in parseLiteral() function)");
|
||||||
return Error(Nothing, charptr, err.str);
|
return Error(Nothing, charptr, err.str);
|
||||||
}
|
}
|
||||||
// addChildToSolsNode(parser->currentParent, node.as.success);
|
addChildToSolsNode(parser->currentParent, node.as.success);
|
||||||
return Success(Nothing, charptr, {});
|
return Success(Nothing, charptr, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +130,7 @@ static inline ResultType(Nothing, charptr) parsePuts(SolsParser* parser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResultType(Nothing, charptr) parse(SolsParser* parser) {
|
ResultType(Nothing, charptr) parse(SolsParser* parser) {
|
||||||
|
parser->currentParent = &parser->output;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ResultType(SolsToken, Nothing) token = parserConsume(parser);
|
ResultType(SolsToken, Nothing) token = parserConsume(parser);
|
||||||
if (token.error) {
|
if (token.error) {
|
||||||
@@ -177,7 +177,7 @@ ResultType(SolsToken, Nothing) parserConsume(SolsParser* parser) {
|
|||||||
if (parser->input == NULL) {
|
if (parser->input == NULL) {
|
||||||
return Error(SolsToken, Nothing, {});
|
return Error(SolsToken, Nothing, {});
|
||||||
}
|
}
|
||||||
if (parser->current + 1 >= parser->input->count) {
|
if (parser->current >= parser->input->count) {
|
||||||
return Error(SolsToken, Nothing, {});
|
return Error(SolsToken, Nothing, {});
|
||||||
}
|
}
|
||||||
return Success(SolsToken, Nothing, parser->input->at[parser->current ++]);
|
return Success(SolsToken, Nothing, parser->input->at[parser->current ++]);
|
||||||
|
|||||||
Reference in New Issue
Block a user