Fix not consuming semicolon on most operations

This commit is contained in:
Curle 2023-04-23 18:56:35 +01:00
parent 216d6c6b5e
commit 4d5fd36390

View File

@ -286,6 +286,8 @@ struct ASTNode* ParsePrecedenceASTNode(int PreviousTokenPrecedence) {
// int LeftType, RightType;
int NodeType, OpType;
printf("Left node branch\r\n");
fflush(stdout);
LeftNode = PrefixStatement();
NodeType = CurrentFile->CurrentSymbol.type;
@ -295,6 +297,7 @@ struct ASTNode* ParsePrecedenceASTNode(int PreviousTokenPrecedence) {
return LeftNode;
}
printf("Operator expected\r\n");
while ((OperatorPrecedence(NodeType) > PreviousTokenPrecedence) ||
(IsRightExpr(OpType) && OperatorPrecedence(OpType) == PreviousTokenPrecedence)) {
Tokenise();
@ -327,7 +330,7 @@ struct ASTNode* ParsePrecedenceASTNode(int PreviousTokenPrecedence) {
LeftNode = RightNode;
RightNode = LeftTemp;
// Clear temps as ensurance
// Clear temps as insurance
RightTemp = NULL;
LeftTemp = NULL;
} else {
@ -513,7 +516,7 @@ struct ASTNode* ParseStatement(void) {
return ContinueStatement();
default:
ParsePrecedenceASTNode(0);
return ParsePrecedenceASTNode(0);
}
}