Exemple #1
0
 private static UnifiedExpression CreateNext(XElement node)
 {
     Contract.Requires(node != null);
     Contract.Requires(node.Name() == "next");
     return
         (UnifiedContinue.Create(
              CreateSmartExpresion(node.FirstElementOrDefault())));
 }
Exemple #2
0
        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();
            }
        }
Exemple #3
0
 public override bool Visit(UnifiedContinue element, VisitorArgument arg)
 {
     Writer.Write("continue ");
     return(true);
 }
Exemple #4
0
 public override bool Visit(UnifiedContinue element, VisitorArgument arg)
 {
     Writer.Write("continue ");
     element.Value.TryAccept(this, arg);
     return(true);
 }
 public override bool Visit(UnifiedContinue element, VisitorArgument arg)
 {
     Writer.Write("continue ");
     return true;
 }
Exemple #6
0
 public UnifiedElement VisitContinueStatement(
     ContinueStatement stmt, object data)
 {
     return(UnifiedContinue.Create());
 }
 public override bool Visit(UnifiedContinue element, VisitorArgument arg)
 {
     Writer.Write("continue ");
     element.Value.TryAccept(this, arg);
     return true;
 }