示例#1
0
        public static Control Create(
			Declaration Declaration,
			ControlBlockType BlockType,
			Func<List<Ast.Node>, Ast.Node, Ast.Node> TransformationFunction)
        {
            return new Control
            {
                DeclarationTerms = Declaration.Terms,
                TransformationFunction = TransformationFunction,
                BlockType = BlockType
            };
        }
示例#2
0
        public static string GetKeyWord(this ControlBlockType type)
        {
            switch (type)
            {
            case ControlBlockType.If: return("if");

            case ControlBlockType.ElseIf: return("else if");

            case ControlBlockType.Else: return("else");

            case ControlBlockType.While: return("while");

            case ControlBlockType.For: return("for");

            default: return("");
            }
        }
示例#3
0
 public ControlBlock(ControlBlockType type, Expression expr, IEnumerable <ILineObject> body)
     : base(new MultipartWritable(new StringWritable(type.GetKeyWord() + " ("),
                                  expr, new StringWritable(")")), body)
 {
 }
示例#4
0
 public ControlBlock(ControlBlockType type, string expr, IEnumerable <ILineObject> body)
     : base(new StringWritable(type.GetKeyWord() + (expr == null ? "" : " (" + expr + ")")), body)
 {
 }
示例#5
0
 public ControlBlock(ControlBlockType type, IEnumerable <ILineObject> body)
     : base(new StringWritable(type.GetKeyWord()), body)
 {
 }