Esempio n. 1
0
 public ScriptEvent(ActionNodeRoot rootNode, Int32 customEventId)
 {
     m_CustomEventId = customEventId;
     RootNode = rootNode;
     m_JumpStack = new Stack<IActionNode>(8);
     Restart();
 }
Esempio n. 2
0
        /// <summary>
        ///     For testing expression parsing only
        /// </summary>
        public Expression CompileExpression(string input, bool normalize = true)
        {
            var tokens = Lexer.Tokenize(input).ToList();
            var commandNodeRoot = new ActionNodeRoot();

            // Build string tables
            foreach (Token token in tokens)
            {
                if (token.Type == TokenType.StringLiteral)
                {
                    string data = token.Value.Substring(1, token.Value.Count() - 2);
                    commandNodeRoot.StringTable.RegisterString(data);
                }
            }

            var compilationContext = new CompilationContext(m_HostCallTable,
                                                            commandNodeRoot.StringTable,
                                                            m_Engine.HostBridge.EnumDefineTable,
                                                            m_Engine.HostBridge.TypeBindingTable,
                                                            m_Engine.HostBridge.EventBindingTable);

            Expression expression = ExpressionParser.Parse(tokens, compilationContext, normalize);
            return expression;
        }
Esempio n. 3
0
        private ActionNodeRoot CompileEvent(List<Token> tokens, Type selfTarget, StringTable stringTable,
                                            Type eventType = null)
        {
            var commandNodeRoot = new ActionNodeRoot();

            var compilationContext = new CompilationContext(m_HostCallTable,
                                                            stringTable,
                                                            m_Engine.HostBridge.EnumDefineTable,
                                                            m_Engine.HostBridge.TypeBindingTable,
                                                            m_Engine.HostBridge.EventBindingTable);
            compilationContext.ScriptOwnerType = selfTarget;
            compilationContext.EventType = eventType;
            commandNodeRoot.Next = Compile(tokens, compilationContext);

            return commandNodeRoot;
        }