public IfStatement(ArithmExprEvaluator e1, RelationEvalutator relOp, ArithmExprEvaluator e2, Queue <Statement> stat, Queue <Statement> elseStat) { expr1 = e1; relationOp = relOp; expr2 = e2; statements = stat; elseStatements = elseStat; }
private Statement HandleIfStatement() { if (Accept(TokenType.If)) { Expect(TokenType.ParenthesisLeft); var expr1 = GetArithmExpr(); var relationToken = currentToken; ExpectRelationOp(); var relationOp = new RelationEvalutator(relationToken.code); var expr2 = GetArithmExpr(); Expect(TokenType.ParenthesisRight); var blockStatements = GetStatementBlock(); var elseBlockStatements = new Queue <Statement>(); if (Accept(TokenType.Else)) { elseBlockStatements = GetStatementBlock(); } return(new IfStatement(expr1, relationOp, expr2, blockStatements, elseBlockStatements)); } return(null); }