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