private void ProcessElseStatement() { Debug.Assert(CurrentInputElement is KeywordToken); Debug.Assert(CurrentInputElement.Data == Keywords.Else); MoveToNextToken(); if (CurrentInputElement.Data == Keywords.If) { MoveToNextToken(); var conditionalElse = new IfElseStatement(); Debug.Assert(CurrentInputElement is SeperatorToken); Debug.Assert(CurrentInputElement.Data == "("); MoveToNextToken(); conditionalElse.Condition = GetInnerExpression(")"); Debug.Assert(CurrentInputElement is SeperatorToken); Debug.Assert(CurrentInputElement.Data == ")"); MoveToNextToken(); conditionalElse.Body = GetWork(); _ifElseStatement.ConditionalElses.Add(conditionalElse); } else { _ifElseStatement.ElseBody = new List<IAstNode>(); _ifElseStatement.ElseBody = GetWork(); } }
public IfElseStatementCompiler(ICompiler compiler, IfElseStatement ifElseStatement) { _compiler = compiler; _ifElseStatement = ifElseStatement; }