Ejemplo n.º 1
0
        public static ZilFunction FromList([NotNull] Context ctx, [NotNull] ZilListBase list)
        {
            var functionSubr = ctx.GetSubrDelegate("FUNCTION");

            Debug.Assert(functionSubr != null);
            return((ZilFunction)functionSubr.Invoke("FUNCTION", ctx, list.ToArray()));
        }
Ejemplo n.º 2
0
        public static ZilSegment FromList([NotNull] Context ctx, [NotNull] ZilListBase list)
        {
            if (!(list is ZilForm form))
            {
                form = new ZilForm(list)
                {
                    SourceLine = SourceLines.Chtyped
                };
            }

            return(new ZilSegment(form));
        }
Ejemplo n.º 3
0
        public static ZilEvalMacro FromList([NotNull] Context ctx, [NotNull] ZilListBase list)
        {
            if (list.First == null || list.Rest == null || list.Rest.First != null)
            {
                throw new InterpreterError(
                          InterpreterMessages._0_Must_Have_1_Element1s,
                          "list coerced to MACRO",
                          1);
            }

            if (!list.First.IsApplicable(ctx))
            {
                throw new InterpreterError(
                          InterpreterMessages.Element_0_Of_1_Must_Be_2,
                          1,
                          "list coerced to MACRO",
                          "applicable");
            }

            return(new ZilEvalMacro(list.First));
        }
Ejemplo n.º 4
0
 public static ZilList FromList([NotNull] Context ctx, [NotNull] ZilListBase list)
 {
     return(new ZilList(list.First, list.Rest));
 }
Ejemplo n.º 5
0
 public ZilFalse([NotNull] ZilListBase value)
     : base(value)
 {
 }
Ejemplo n.º 6
0
 public ZilSplice([NotNull] ZilListBase other)
     : base(other.First, other.Rest)
 {
 }
Ejemplo n.º 7
0
 public static ZilAsoc FromList([NotNull] Context ctx, [NotNull] ZilListBase list)
 {
     throw new InterpreterError(InterpreterMessages.CHTYPE_To_0_Not_Supported, "ASOC");
 }
Ejemplo n.º 8
0
 public static ZilDecl FromList(Context ctx, [NotNull] ZilListBase list)
 {
     return(new ZilDecl(list));
 }