Esempio n. 1
0
        internal static DynamicExprExpression LoadDynamicExpr(Script script, SourceCode source)
        {
            AntlrErrorListener listener = new AntlrErrorListener(source);

            try
            {
                LuaParser parser = CreateParser(script, new AntlrInputStream(source.Code), source.SourceID, p => p.dynamicexp(), listener);

                ScriptLoadingContext lcontext = CreateLoadingContext(script, source);
                lcontext.IsDynamicExpression = true;
                lcontext.Anonymous           = true;

                DynamicExprExpression stat;

                using (script.PerformanceStats.StartStopwatch(Diagnostics.PerformanceCounter.AstCreation))
                    stat = new DynamicExprExpression(parser.dynamicexp(), lcontext);

                return(stat);
            }
            catch (ParseCanceledException ex)
            {
                HandleParserError(ex, listener);
                throw;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new dynamic expression.
        /// </summary>
        /// <param name="code">The code of the expression.</param>
        /// <returns></returns>
        public DynamicExpression CreateDynamicExpression(string code)
        {
            DynamicExprExpression dee = Loader_Fast.LoadDynamicExpr(this, new SourceCode("__dynamic", code, -1, this));

            return(new DynamicExpression(this, code, dee));
        }
Esempio n. 3
0
 internal DynamicExpression(Script S, string strExpr, DynamicExprExpression expr)
 {
     ExpressionCode = strExpr;
     OwnerScript    = S;
     m_Exp          = expr;
 }
 internal DynamicExpression(Script s, string strExpr, DynamicExprExpression expr)
 {
     ExpressionCode   = strExpr;
     this.OwnerScript = s;
     _exp             = expr;
 }