public static IADNode WhileLoop() { MainFSM.GetNextToken(); if (MainFSM.GetNextToken().Type != TokenType.leftRBType) { ParserFunctions.SyntaxError("Byl ocekavan znak \'(\'"); } var result = new ADWhileLoop(); result.Condition = PrecedenceSyntaxAnalysis.Precedence(TokenType.rightRBType); if (MainFSM.GetNextToken().Type != TokenType.rightRBType) { ParserFunctions.SyntaxError("Byl ocekavan znak \')\'"); } if (MainFSM.GetNextToken().Type != TokenType.leftCBType) { ParserFunctions.SyntaxError("Byl ocekavan znak \'{\'"); } ParserFunctions.STablesStack.Push(new STable()); result.Body = ParserFunctions.statement_list(); if (MainFSM.GetNextToken().Type != TokenType.rightCBType) { ParserFunctions.SyntaxError("Byl ocekavan znak \'}\'"); } ParserFunctions.STablesStack.Pop(); return(result); }
public static IADNode InnerStatements() { MainFSM.GetNextToken(); ParserFunctions.STablesStack.Push(new STable()); var result = ParserFunctions.statement_list(); if (MainFSM.GetNextToken().Type != TokenType.rightCBType) { ParserFunctions.SyntaxError("Byl ocekavan znak \'}\'"); } ParserFunctions.STablesStack.Pop(); if (MainFSM.PeekNextToken().Type == TokenType.semiType) { MainFSM.GetNextToken(); } return(new ADInnerStatements() { Statements = result }); }