示例#1
0
 public Functions(Functions other)
 {
     _functions = new Dictionary<string, List<KeyValuePair<object, MethodInfo>>>(other._functions);
 }
示例#2
0
 public Scope(Scope other)
 {
     Functions = new Functions(other.Functions);
     _locals = new ObjectTable(other._locals);
 }
示例#3
0
        public ScriptEngine()
        {
            _internalBuilders = new Dictionary<int, List<Builder>>();
            _customBuilders = new Dictionary<int, List<Builder>>();

            _builderQueue = new Stack<Builder>();

            Globals = new ObjectTable();
            Functions = new Functions();
            Plugins = new List<Plugin>();

            SecurityPolicy = new SecurityPolicy();

            // /* */, //, ++, --, +=, -= (etc), Numbers, ()
            RegisterInternalBuilder(new CommentBuilder(), 0);
            RegisterInternalBuilder(new PlusPlusMinusMinusBuilder(), 0);
            RegisterInternalBuilder(new ComparisonOperatorBuilder(), 0);
            RegisterInternalBuilder(new NumberBuilder(), 0);
            RegisterInternalBuilder(new BracketBuilder(), 0);
            RegisterInternalBuilder(new RoundBracketBuilder(), 0);
            RegisterInternalBuilder(new NotBuilder(), 0);

            // Math, booleans, strings, chars
            RegisterInternalBuilder(new MathBuilder(), 5);
            RegisterInternalBuilder(new BooleanBuilder(), 5);
            RegisterInternalBuilder(new StringBuilder(), 5);
            //RegisterInternalBuilder(new Builders.CharBuilder(), 5);

            // $, @ & .
            RegisterInternalBuilder(new TypeFunctionBuilder(), 10);
            RegisterInternalBuilder(new VariableBuilder(), 10);

            // []
            RegisterInternalBuilder(new ArrayBuilder(), 10);
            RegisterInternalBuilder(new ArrayAccessBuilder(), 15);

            // Keywords
            RegisterInternalBuilder(new NullBuilder(), 20);
            RegisterInternalBuilder(new TypeOfBuilder(), 20);
            RegisterInternalBuilder(new ReturnBuilder(), 20);
            RegisterInternalBuilder(new IfBlockBuilder(), 20);
            RegisterInternalBuilder(new InBuilder(), 20);
            RegisterInternalBuilder(new IsBuilder(), 20);
            RegisterInternalBuilder(new NewTypeBuilder(), 20);
            RegisterInternalBuilder(new ForBlockBuilder(), 20);
            RegisterInternalBuilder(new DoWhileBlockBuilder(), 20);
            RegisterInternalBuilder(new WhileBlockBuilder(), 20);
            RegisterInternalBuilder(new UsingBlockBuilder(), 20);
            RegisterInternalBuilder(new ConstBuilder(), 20);
            RegisterInternalBuilder(new FixedBuilder(), 20);

            // Functions/Classes
            RegisterInternalBuilder(new FunctionBuilder(), 30);
            RegisterInternalBuilder(new ClassBuilder(), 30);

            RegisterInternalBuilder(new EqualsBuilder(), int.MaxValue);
            RegisterInternalBuilder(new TypeBuilder(), int.MaxValue);

            // Fetch Global Plugins
            for (int i = 0; i < PluginManager.Plugins.Count; i++)
            {
                RegisterPlugin(PluginManager.Plugins[i]);
            }
        }
示例#4
0
 public Scope()
 {
     Functions = new Functions();
     _locals = new ObjectTable();
 }