public void while_statement(Block container) { IToken token = null; try { WhileStatement statement2; Block block; token = this.LT(1); this.match(0x2f); Expression expression = this.paren_expression(); if (base.inputState.guessing == 0) { WhileStatement statement; WhileStatement statement1 = statement = new WhileStatement(ToLexicalInfo(token)); statement.set_Condition(expression); statement2 = statement; block = statement2.get_Block(); container.Add(statement2); this.EnterLoop(statement2); } this.compound_or_single_stmt(block); if (base.inputState.guessing == 0) { this.LeaveLoop(statement2); } } catch (RecognitionException exception) { if (base.inputState.guessing != 0) { throw; } this.reportError(exception); this.recover(exception, tokenSet_15_); } }
public void do_while_statement(Block container) { IToken token = null; IToken token2 = null; try { WhileStatement statement2; Block block; token = this.LT(1); this.match(10); if (base.inputState.guessing == 0) { WhileStatement statement; WhileStatement statement1 = statement = new WhileStatement(ToLexicalInfo(token)); statement.set_Condition(new BoolLiteralExpression(true)); statement2 = statement; block = statement2.get_Block(); container.Add(statement2); this.EnterLoop(statement2); } this.block(block); token2 = this.LT(1); this.match(0x2f); Expression expression = this.paren_expression(); this.eos(); if (base.inputState.guessing == 0) { BreakStatement statement3; BreakStatement statement4 = statement3 = new BreakStatement(ToLexicalInfo(token2)); statement3.set_Modifier(new StatementModifier(2, expression)); block.Add(statement3); this.LeaveLoop(statement2); } } catch (RecognitionException exception) { if (base.inputState.guessing != 0) { throw; } this.reportError(exception); this.recover(exception, tokenSet_15_); } }
public Statement for_c(Block container) { Statement statement = null; try { Expression expression; Expression expression2; WhileStatement statement3; Block block; string str; switch (this.LA(1)) { case 0x2d: this.declaration_statement(container); if (base.inputState.guessing == 0) { statement = container.get_Statements().get_Item(-1) as DeclarationStatement; if (statement != null) { statement.Annotate("PrivateScope"); } } break; case 12: case 15: case 0x13: case 0x1b: case 0x1d: case 0x27: case 40: case 0x2a: case 0x2c: case 0x3b: case 60: case 0x3d: case 0x3f: case 0x44: case 0x4f: case 80: case 0x52: case 0x58: case 0x67: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: this.expression_statement(container); break; case 0x4d: break; default: throw new NoViableAltException(this.LT(1), this.getFilename()); } this.match(0x4d); switch (this.LA(1)) { case 12: case 15: case 0x13: case 0x1b: case 0x1d: case 0x27: case 40: case 0x2a: case 0x2c: case 0x3b: case 60: case 0x3d: case 0x3f: case 0x44: case 0x4f: case 80: case 0x52: case 0x58: case 0x67: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: expression = this.expression(); break; case 0x4d: break; default: throw new NoViableAltException(this.LT(1), this.getFilename()); } this.match(0x4d); switch (this.LA(1)) { case 12: case 15: case 0x13: case 0x1b: case 0x1d: case 0x27: case 40: case 0x2a: case 0x2c: case 0x3b: case 60: case 0x3d: case 0x3f: case 0x44: case 0x4f: case 80: case 0x52: case 0x58: case 0x67: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: expression2 = this.assignment_expression(); break; case 0x40: break; default: throw new NoViableAltException(this.LT(1), this.getFilename()); } if (base.inputState.guessing == 0) { WhileStatement statement2; WhileStatement statement1 = statement2 = new WhileStatement(); statement2.set_Condition(expression); statement3 = statement2; if (expression == null) { BoolLiteralExpression expression3; BoolLiteralExpression expression1 = expression3 = new BoolLiteralExpression(); expression3.set_Value(true); statement3.set_Condition(expression3); } block = statement3.get_Block(); statement = statement3; str = this.SetUpLoopLabel(statement3); container.Add(statement); this.EnterLoop(statement3); } this.match(0x40); this.compound_or_single_stmt(block); if (base.inputState.guessing != 0) { return statement; } this.LeaveLoop(statement3); if (this.IsLabelInUse(statement3)) { LabelStatement statement4; LabelStatement statement5 = statement4 = new LabelStatement(); statement4.set_Name(str); block.Add(statement4); } if (expression2 != null) { block.Add(expression2); } } catch (RecognitionException exception) { if (base.inputState.guessing != 0) { throw; } this.reportError(exception); this.recover(exception, tokenSet_15_); return statement; } return statement; }
public void TransformIteration(ForStatement node) { string[] textArray1 = new string[] { "iterator" }; InternalLocal iteratorVariable = this.get_CodeBuilder().DeclareLocal(this.get_CurrentMethod(), base._context.GetUniqueName(textArray1), this.get_TypeSystemServices().IEnumeratorType); iteratorVariable.set_IsUsed(true); Block block = new Block(node.get_LexicalInfo()); block.Add(this.get_CodeBuilder().CreateAssignment(node.get_LexicalInfo(), this.get_CodeBuilder().CreateReference(iteratorVariable), node.get_Iterator())); WhileStatement statement = new WhileStatement(node.get_LexicalInfo()); statement.set_Condition(this.get_CodeBuilder().CreateMethodInvocation(this.get_CodeBuilder().CreateReference(iteratorVariable), this.IEnumerator_MoveNext)); MethodInvocationExpression expression = this.get_CodeBuilder().CreateMethodInvocation(this.get_CodeBuilder().CreateReference(iteratorVariable), this.IEnumerator_get_Current); InternalLocal entity = TypeSystemServices.GetEntity(node.get_Declarations().get_Item(0)); statement.get_Block().Add(this.get_CodeBuilder().CreateAssignment(node.get_LexicalInfo(), this.get_CodeBuilder().CreateReference(entity), expression)); statement.get_Block().Add(node.get_Block()); new LoopVariableUpdater(this, base._context, iteratorVariable, entity).Visit(node); block.Add(statement); node.get_ParentNode().Replace(node, block); }