Beispiel #1
0
        public SkryptEngine(Options options)
        {
            GlobalEnvironment = new LexicalEnvironment();

            ErrorHandler          = new DefaultErrorHandler(this);
            ExpressionInterpreter = new ExpressionInterpreter(this);
            TemplateMaker         = new TemplateMaker(this);
            FileHandler           = new DefaultFileHandler(this);
            Visitor = new SkryptVisitor(this);

            Enumerable         = FastAdd(new EnumerableTrait(this));
            Iterator           = FastAdd(new IteratorTrait(this));
            AddableTrait       = FastAdd(new AddableTrait(this));
            SubtractableTrait  = FastAdd(new SubtractableTrait(this));
            DividableTrait     = FastAdd(new DividableTrait(this));
            MultiplicableTrait = FastAdd(new MultiplicableTrait(this));

            Number    = FastAdd(new NumberType(this));
            String    = FastAdd(new StringType(this));
            Boolean   = FastAdd(new BooleanType(this));
            Vector    = FastAdd(new VectorType(this));
            Vector2   = FastAdd(new Vector2Type(this));
            Vector3   = FastAdd(new Vector3Type(this));
            Vector4   = FastAdd(new Vector4Type(this));
            Array     = FastAdd(new ArrayType(this));
            Exception = FastAdd(new ExceptionType(this));

            Math   = FastAdd(new MathModule(this));
            IO     = FastAdd(new IOModule(this));
            Memory = FastAdd(new MemoryModule(this));
            Debug  = FastAdd(new DebugModule(this));

            if (options != null)
            {
                _discardGlobal     = options.DiscardGlobal;
                _maxRecursionDepth = options.MaxRecursionDepth;
                MemoryLimit        = options.MaxMemory;
                HaltMemory         = options.MemoryHalt;
            }
        }