No more polish notation
This commit is contained in:
@@ -149,7 +149,10 @@ static inline ResultType(Nothing, charptr) parseIdentifier(SolsParser* parser) {
|
||||
}
|
||||
|
||||
static inline ResultType(Nothing, charptr) parseSet(SolsParser* parser) {
|
||||
if (parser->output.children.at[parser->output.children.count - 1].type != SNT_IDENTIFIER) {
|
||||
if (parser->currentParent->children.count < 1) {
|
||||
return Error(Nothing, charptr, "Expecting identifier before '='");
|
||||
}
|
||||
if (parser->currentParent->children.at[parser->output.children.count - 1].type != SNT_IDENTIFIER) {
|
||||
return Error(Nothing, charptr, "Expecting identifier before '='");
|
||||
}
|
||||
|
||||
@@ -159,6 +162,9 @@ static inline ResultType(Nothing, charptr) parseSet(SolsParser* parser) {
|
||||
return Error(Nothing, charptr, tokens.as.error);
|
||||
}
|
||||
|
||||
// Get the identifier (previous node)
|
||||
SolsNode idNode = parser->currentParent->children.at[parser->currentParent->children.count - 1];
|
||||
|
||||
ResultType(SolsToken, Nothing) peek = parserPeek(parser, 0);
|
||||
if (peek.error) return Error(Nothing, charptr, "ruh roh");
|
||||
|
||||
@@ -193,11 +199,16 @@ static inline ResultType(Nothing, charptr) parseSet(SolsParser* parser) {
|
||||
return Error(Nothing, charptr, "Expecting token after '='");
|
||||
}
|
||||
|
||||
// Copy nodes into the sols node
|
||||
// Copy idnode into set node
|
||||
addChildToSolsNode(&node.as.success, idNode);
|
||||
|
||||
// Copy nodes into the set node
|
||||
for (size_t i = 0; i < putsParser.as.success.output.children.count; i++) {
|
||||
addChildToSolsNode(&node.as.success, putsParser.as.success.output.children.at[i]);
|
||||
}
|
||||
|
||||
// Put the set node where the idNode was
|
||||
parser->currentParent->children.count--;
|
||||
addChildToSolsNode(parser->currentParent, node.as.success);
|
||||
|
||||
return Success(Nothing, charptr, {});
|
||||
|
||||
Reference in New Issue
Block a user