From 4d5fd363908d9d1dc3508113bcae78e4db78989f Mon Sep 17 00:00:00 2001 From: Curle Date: Sun, 23 Apr 2023 18:56:35 +0100 Subject: [PATCH] Fix not consuming semicolon on most operations --- src/Parser.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Parser.c b/src/Parser.c index 96af774..bece0b9 100644 --- a/src/Parser.c +++ b/src/Parser.c @@ -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); } }