예제 #1
0
        public void Init()
        {
            RegisterFunctions();
            RegisterEnums();
            RegisterActions();

            InitStandalone();
            CompiledClass.Init();
        }
예제 #2
0
 public static void CleanUpVariables()
 {
     s_variables.Clear();
     s_locals.Clear();
     s_localScope.Clear();
     s_namespaces.Clear();
     s_namespace = s_namespacePrefix = "";
     CompiledClass.Init();
 }
예제 #3
0
        public void Init()
        {
            if (m_bHasBeenInitialized)
            {
                return;
            }
            m_bHasBeenInitialized = true; // making sure the init gets call only once

            RegisterFunctions();
            RegisterEnums();
            RegisterActions();

            InitStandalone();
            CompiledClass.Init();
        }
예제 #4
0
        public void Init()
        {
            if (m_bHasBeenInitialized)
            {
                return;
            }
            m_bHasBeenInitialized = true; // making sure the init gets call only once

            RegisterFunctions();
            RegisterEnums();
            RegisterActions();

            ParserFunction.AddGlobal(Constants.THIS,
                                     new GetVarFunction(new Variable(Variable.VarType.ARRAY)));

            InitStandalone();
            CompiledClass.Init();
        }
예제 #5
0
파일: Interpreter.cs 프로젝트: shincar/cscs
        public void Init()
        {
            ParserFunction.RegisterFunction(Constants.IF, new IfStatement());
            ParserFunction.RegisterFunction(Constants.WHILE, new WhileStatement());
            ParserFunction.RegisterFunction(Constants.FOR, new ForStatement());
            ParserFunction.RegisterFunction(Constants.BREAK, new BreakStatement());
            ParserFunction.RegisterFunction(Constants.CONTINUE, new ContinueStatement());
            ParserFunction.RegisterFunction(Constants.CLASS, new ClassCreator());
            ParserFunction.RegisterFunction(Constants.ENUM, new EnumFunction());
            ParserFunction.RegisterFunction(Constants.NEW, new NewObjectFunction());
            ParserFunction.RegisterFunction(Constants.RETURN, new ReturnStatement());
            ParserFunction.RegisterFunction(Constants.FUNCTION, new FunctionCreator());
            ParserFunction.RegisterFunction(Constants.GET_PROPERTIES, new GetPropertiesFunction());
            ParserFunction.RegisterFunction(Constants.GET_PROPERTY, new GetPropertyFunction());
            ParserFunction.RegisterFunction(Constants.INCLUDE, new IncludeFile());
            ParserFunction.RegisterFunction(Constants.SET_PROPERTY, new SetPropertyFunction());
            ParserFunction.RegisterFunction(Constants.TRY, new TryBlock());
            ParserFunction.RegisterFunction(Constants.THROW, new ThrowFunction());
            ParserFunction.RegisterFunction(Constants.TYPE, new TypeFunction());
            ParserFunction.RegisterFunction(Constants.TRUE, new BoolFunction(true));
            ParserFunction.RegisterFunction(Constants.FALSE, new BoolFunction(false));

            ParserFunction.RegisterFunction(Constants.ABS, new AbsFunction());
            ParserFunction.RegisterFunction(Constants.ACOS, new AcosFunction());
            ParserFunction.RegisterFunction(Constants.ADD, new AddFunction());
            ParserFunction.RegisterFunction(Constants.ADD_TO_HASH, new AddVariableToHashFunction());
            ParserFunction.RegisterFunction(Constants.ADD_ALL_TO_HASH, new AddVariablesToHashFunction());
            ParserFunction.RegisterFunction(Constants.ASIN, new AsinFunction());
            ParserFunction.RegisterFunction(Constants.CANCEL, new CancelFunction());
            ParserFunction.RegisterFunction(Constants.CANCEL_RUN, new ScheduleRunFunction(false));
            ParserFunction.RegisterFunction(Constants.CEIL, new CeilFunction());
            ParserFunction.RegisterFunction(Constants.CHECK_LOADER_MAIN, new CheckLoaderMainFunction());
            ParserFunction.RegisterFunction(Constants.CONTAINS, new ContainsFunction());
            ParserFunction.RegisterFunction(Constants.COS, new CosFunction());
            ParserFunction.RegisterFunction(Constants.DEEP_COPY, new DeepCopyFunction());
            ParserFunction.RegisterFunction(Constants.DEFINE_LOCAL, new DefineLocalFunction());
            ParserFunction.RegisterFunction(Constants.ENV, new GetEnvFunction());
            ParserFunction.RegisterFunction(Constants.EXP, new ExpFunction());
            ParserFunction.RegisterFunction(Constants.FIND_INDEX, new FindIndexFunction());
            ParserFunction.RegisterFunction(Constants.FLOOR, new FloorFunction());
            ParserFunction.RegisterFunction(Constants.GET_COLUMN, new GetColumnFunction());
            ParserFunction.RegisterFunction(Constants.GET_FILE_FROM_DEBUGGER, new GetFileFromDebugger());
            ParserFunction.RegisterFunction(Constants.GET_KEYS, new GetAllKeysFunction());
            ParserFunction.RegisterFunction(Constants.LOCK, new LockFunction());
            ParserFunction.RegisterFunction(Constants.LOG, new LogFunction());
            ParserFunction.RegisterFunction(Constants.NAMESPACE, new NamespaceFunction());
            ParserFunction.RegisterFunction(Constants.NAME_EXISTS, new NameExistsFunction());
            ParserFunction.RegisterFunction(Constants.NOW, new DateTimeFunction());
            ParserFunction.RegisterFunction(Constants.PI, new PiFunction());
            ParserFunction.RegisterFunction(Constants.POW, new PowFunction());
            ParserFunction.RegisterFunction(Constants.PRINT, new PrintFunction());
            ParserFunction.RegisterFunction(Constants.PSTIME, new ProcessorTimeFunction());
            ParserFunction.RegisterFunction(Constants.RANDOM, new GetRandomFunction());
            ParserFunction.RegisterFunction(Constants.REMOVE, new RemoveFunction());
            ParserFunction.RegisterFunction(Constants.REMOVE_AT, new RemoveAtFunction());
            ParserFunction.RegisterFunction(Constants.ROUND, new RoundFunction());
            ParserFunction.RegisterFunction(Constants.SCHEDULE_RUN, new ScheduleRunFunction(true));
            ParserFunction.RegisterFunction(Constants.SHOW, new ShowFunction());
            ParserFunction.RegisterFunction(Constants.SETENV, new SetEnvFunction());
            ParserFunction.RegisterFunction(Constants.SIGNAL,new SignalWaitFunction(true));
            ParserFunction.RegisterFunction(Constants.SIN,new SinFunction());
            ParserFunction.RegisterFunction(Constants.SINGLETON,new SingletonFunction());
            ParserFunction.RegisterFunction(Constants.SIZE,new SizeFunction());
            ParserFunction.RegisterFunction(Constants.SLEEP,new SleepFunction());
            ParserFunction.RegisterFunction(Constants.SQRT,new SqrtFunction());
            ParserFunction.RegisterFunction(Constants.START_DEBUGGER,new DebuggerFunction(true));
            ParserFunction.RegisterFunction(Constants.STOP_DEBUGGER,new DebuggerFunction(false));
            ParserFunction.RegisterFunction(Constants.STR_BETWEEN,new StringManipulationFunction(StringManipulationFunction.Mode.BEETWEEN));
            ParserFunction.RegisterFunction(Constants.STR_BETWEEN_ANY,new StringManipulationFunction(StringManipulationFunction.Mode.BEETWEEN_ANY));
            ParserFunction.RegisterFunction(Constants.STR_CONTAINS,new StringManipulationFunction(StringManipulationFunction.Mode.CONTAINS));
            ParserFunction.RegisterFunction(Constants.STR_LOWER,new StringManipulationFunction(StringManipulationFunction.Mode.LOWER));
            ParserFunction.RegisterFunction(Constants.STR_ENDS_WITH,new StringManipulationFunction(StringManipulationFunction.Mode.ENDS_WITH));
            ParserFunction.RegisterFunction(Constants.STR_EQUALS,new StringManipulationFunction(StringManipulationFunction.Mode.EQUALS));
            ParserFunction.RegisterFunction(Constants.STR_INDEX_OF,new StringManipulationFunction(StringManipulationFunction.Mode.INDEX_OF));
            ParserFunction.RegisterFunction(Constants.STR_REPLACE,new StringManipulationFunction(StringManipulationFunction.Mode.REPLACE));
            ParserFunction.RegisterFunction(Constants.STR_STARTS_WITH,new StringManipulationFunction(StringManipulationFunction.Mode.STARTS_WITH));
            ParserFunction.RegisterFunction(Constants.STR_SUBSTR,new StringManipulationFunction(StringManipulationFunction.Mode.SUBSTRING));
            ParserFunction.RegisterFunction(Constants.STR_TRIM,new StringManipulationFunction(StringManipulationFunction.Mode.TRIM));
            ParserFunction.RegisterFunction(Constants.STR_UPPER,new StringManipulationFunction(StringManipulationFunction.Mode.UPPER));
            ParserFunction.RegisterFunction(Constants.THREAD,new ThreadFunction());
            ParserFunction.RegisterFunction(Constants.THREAD_ID,new ThreadIDFunction());
            ParserFunction.RegisterFunction(Constants.TOKENIZE,new TokenizeFunction());
            ParserFunction.RegisterFunction(Constants.TOKENIZE_LINES,new TokenizeLinesFunction());
            ParserFunction.RegisterFunction(Constants.TOKEN_COUNTER,new TokenCounterFunction());
            ParserFunction.RegisterFunction(Constants.TO_BOOL,new ToBoolFunction());
            ParserFunction.RegisterFunction(Constants.TO_DECIMAL,new ToDecimalFunction());
            ParserFunction.RegisterFunction(Constants.TO_DOUBLE,new ToDoubleFunction());
            ParserFunction.RegisterFunction(Constants.TO_INT,new ToIntFunction());
            ParserFunction.RegisterFunction(Constants.TO_STRING,new ToStringFunction());
            ParserFunction.RegisterFunction(Constants.WAIT,new SignalWaitFunction(false));
            ParserFunction.RegisterFunction(Constants.WEB_REQUEST,new WebRequestFunction());

            ParserFunction.RegisterEnum(Constants.VARIABLE_TYPE,"SplitAndMerge.Variable.VarType");

            ParserFunction.AddAction(Constants.ASSIGNMENT,new AssignFunction());
            ParserFunction.AddAction(Constants.INCREMENT,new IncrementDecrementFunction());
            ParserFunction.AddAction(Constants.DECREMENT,new IncrementDecrementFunction());

            for (int i = 0; i < Constants.OPER_ACTIONS.Length; i++)
            {
                ParserFunction.AddAction(Constants.OPER_ACTIONS[i],new OperatorAssignFunction());
            }

            Constants.ELSE_LIST.Add(Constants.ELSE);
            Constants.ELSE_IF_LIST.Add(Constants.ELSE_IF);
            Constants.CATCH_LIST.Add(Constants.CATCH);

            InitStandalone();
            CompiledClass.Init();
        }