private static UnifiedExpression CreateBreak(XElement node) { Contract.Requires(node != null); Contract.Requires(node.Name() == "break"); return(UnifiedBreak.Create( CreateSmartExpresion(node.FirstElementOrDefault()))); }
public static UnifiedExpression CreateJumpStatement(XElement node) { Contract.Requires(node != null); Contract.Requires(node.Name() == "jump_statement"); /* jump_statement * : 'goto' IDENTIFIER ';' * | 'continue' ';' * | 'break' ';' * | 'return' ';' * | 'return' expression ';' */ var firstElement = node.FirstElement(); switch (firstElement.Value) { case "goto": return (UnifiedGoto.Create( UnifiedLabelIdentifier.Create( node.NthElement(1).Value))); case "continue": return(UnifiedContinue.Create()); case "break": return(UnifiedBreak.Create()); case "return": var expression = node.Element("expression"); if (expression != null) { return (UnifiedReturn.Create( CreateExpression(expression).First())); } return(UnifiedReturn.Create()); default: throw new InvalidOperationException(); } }
public override bool Visit(UnifiedBreak element, VisitorArgument arg) { Writer.Write("break "); return(true); }
public override bool Visit(UnifiedBreak element, VisitorArgument arg) { Writer.Write("break "); element.Value.TryAccept(this, arg); return(true); }
public override bool Visit(UnifiedBreak element, VisitorArgument arg) { Writer.Write("break "); element.Value.TryAccept(this, arg); return true; }
public override bool Visit(UnifiedBreak element, VisitorArgument arg) { Writer.Write("break "); return true; }
public UnifiedElement VisitBreakStatement( BreakStatement stmt, object data) { return(UnifiedBreak.Create()); }