public object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) { bool frontCondition = doLoopStatement.ConditionPosition != ConditionPosition.End; bool negateCondition = doLoopStatement.ConditionType == ConditionType.Until; if (frontCondition && negateCondition) { // VB: Do Unless * : ** : Loop B.UnlessStatement u = new B.UnlessStatement(GetLexicalInfo(doLoopStatement)); u.Condition = ConvertExpression(doLoopStatement.Condition); u.Block = ConvertBlock(doLoopStatement.EmbeddedStatement); return(u); } // While and Do loop B.WhileStatement w = new B.WhileStatement(GetLexicalInfo(doLoopStatement)); if (frontCondition) { w.Condition = ConvertExpression(doLoopStatement.Condition); } else { w.Condition = new B.BoolLiteralExpression(true); } w.Block = ConvertBlock(doLoopStatement.EmbeddedStatement); if (!frontCondition) { B.BreakStatement breakStatement = new B.BreakStatement(); breakStatement.Modifier = new B.StatementModifier(negateCondition ? B.StatementModifierType.If : B.StatementModifierType.Unless, ConvertExpression(doLoopStatement.Condition)); w.Block.Add(breakStatement); } return(w); }
public override void OnBreakStatement(BreakStatement node) { if (this._level <= 0) { this.ReplaceCurrentNode(SwitchMacroModule.NewGoto(this._label)); } }
/// <summary> /// Make a loop: /// $initializers /// goto converterGeneratedName# /// while true: /// $iterators /// :converterGeneratedName# /// break $conditionType $condition /// $body /// </summary> ArrayList MakeManualLoop(INode node, List <Statement> initializers, B.StatementModifierType conditionType, Expression condition, List <Statement> iterators, Statement body) { // we use this "while true" form because "continue" must not skip the iterator. ArrayList list = ConvertStatements(initializers); B.LabelStatement labelStatement = MakeLabel(GenerateName()); B.GotoStatement gotoStatement = new B.GotoStatement(); gotoStatement.Label = new B.ReferenceExpression(labelStatement.Name); list.Add(gotoStatement); B.WhileStatement w = new B.WhileStatement(GetLexicalInfo(node)); w.Condition = new B.BoolLiteralExpression(true); list.Add(w); w.Block = ConvertBlock(iterators); B.BreakStatement breakStatement = new B.BreakStatement(); breakStatement.Modifier = new B.StatementModifier(conditionType, ConvertExpression(condition)); w.Block.Add(labelStatement); w.Block.Add(breakStatement); foreach (B.Statement st in ConvertBlock(body).Statements) { w.Block.Add(st); } return(list); }
protected BreakStatement break_stmt() //throws RecognitionException, TokenStreamException { BreakStatement s; IToken b = null; s = null; try { // for error handling b = LT(1); match(BREAK); if (0==inputState.guessing) { s = new BreakStatement(ToLexicalInfo(b)); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex, "break_stmt"); recover(ex,tokenSet_21_); } else { throw ex; } } return s; }
public override void OnBreakStatement(BreakStatement node) { EmitGoTo(_currentLoopInfo.BreakLabel, node); }
//throws RecognitionException, TokenStreamException protected BreakStatement break_stmt() { BreakStatement s; IToken b = null; s = null; try { // for error handling b = LT(1); match(BREAK); if (0==inputState.guessing) { s = new BreakStatement(SourceLocationFactory.ToLexicalInfo(b)); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_22_); } else { throw ex; } } return s; }
public override void OnBreakStatement(BreakStatement node) { CheckInLoop(node); }
override public object Clone() { BreakStatement clone = new BreakStatement(); clone._lexicalInfo = _lexicalInfo; clone._endSourceLocation = _endSourceLocation; clone._documentation = _documentation; clone._isSynthetic = _isSynthetic; clone._entity = _entity; if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone(); if (null != _modifier) { clone._modifier = _modifier.Clone() as StatementModifier; clone._modifier.InitializeParent(clone); } return clone; }
public override void OnBreakStatement(BreakStatement node) { GotoStatement gotoStatement = new GotoStatement(node.LexicalInfo); gotoStatement.Label = new ReferenceExpression(node.LexicalInfo, label); node.ReplaceBy(gotoStatement); }
override public bool EnterBreakStatement(BreakStatement node) { RemoveUnreachableCode(node); return false; }
public override void LeaveBreakStatement(BreakStatement node) { LeaveStatement(node); }
public override void OnBreakStatement(BreakStatement node) { EmitDebugInfo(node); if (InTryInLoop()) { _il.Emit(OpCodes.Leave, _currentLoopInfo.BreakLabel); } else { _il.Emit(OpCodes.Br, _currentLoopInfo.BreakLabel); } }
public override void OnBreakStatement(BreakStatement node) { WriteIndented(); WriteKeyword("break "); Visit(node.Modifier); WriteLine(); }
public object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) { bool frontCondition = doLoopStatement.ConditionPosition != ConditionPosition.End; bool negateCondition = doLoopStatement.ConditionType == ConditionType.Until; if (frontCondition && negateCondition) { // VB: Do Unless * : ** : Loop B.UnlessStatement u = new B.UnlessStatement(GetLexicalInfo(doLoopStatement)); u.Condition = ConvertExpression(doLoopStatement.Condition); u.Block = ConvertBlock(doLoopStatement.EmbeddedStatement); return u; } // While and Do loop B.WhileStatement w = new B.WhileStatement(GetLexicalInfo(doLoopStatement)); if (frontCondition) w.Condition = ConvertExpression(doLoopStatement.Condition); else w.Condition = new B.BoolLiteralExpression(true); w.Block = ConvertBlock(doLoopStatement.EmbeddedStatement); if (!frontCondition) { B.BreakStatement breakStatement = new B.BreakStatement(); breakStatement.Modifier = new B.StatementModifier(negateCondition ? B.StatementModifierType.If : B.StatementModifierType.Unless, ConvertExpression(doLoopStatement.Condition)); w.Block.Add(breakStatement); } return w; }
/// <summary> /// Make a loop: /// $initializers /// goto converterGeneratedName# /// while true: /// $iterators /// :converterGeneratedName# /// break $conditionType $condition /// $body /// </summary> ArrayList MakeManualLoop(INode node, List<Statement> initializers, B.StatementModifierType conditionType, Expression condition, List<Statement> iterators, Statement body) { // we use this "while true" form because "continue" must not skip the iterator. ArrayList list = ConvertStatements(initializers); B.LabelStatement labelStatement = MakeLabel(GenerateName()); B.GotoStatement gotoStatement = new B.GotoStatement(); gotoStatement.Label = new B.ReferenceExpression(labelStatement.Name); list.Add(gotoStatement); B.WhileStatement w = new B.WhileStatement(GetLexicalInfo(node)); w.Condition = new B.BoolLiteralExpression(true); list.Add(w); w.Block = ConvertBlock(iterators); B.BreakStatement breakStatement = new B.BreakStatement(); breakStatement.Modifier = new B.StatementModifier(conditionType, ConvertExpression(condition)); w.Block.Add(labelStatement); w.Block.Add(breakStatement); foreach (B.Statement st in ConvertBlock(body).Statements) { w.Block.Add(st); } return list; }
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_); } }