Expr_CompilerToken() public method

public Expr_CompilerToken ( IList listToken ) : ICLS_Expression
listToken IList
return ICLS_Expression
Beispiel #1
0
    public object Eval(string script)
    {
        if (env == null)
        {
            Init();
        }

        var token = env.ParserToken(script);             //词法分析
        var expr  = env.Expr_CompilerToken(token, true); //语法分析,简单表达式,一句话
        var value = env.Expr_Execute(expr, content);     //执行表达式

        if (value == null)
        {
            return(null);
        }
        return(value.value);
    }
    public static void CSLightDoString(string code)
    {
        var c    = new CSLE.CLS_Content(env, false);
        int hash = code.GetHashCode();

        if (expcache.ContainsKey(hash))
        {
            env.Expr_Execute(expcache[hash], c);
            return;
        }
        var t = env.ParserToken(code);
        var e = env.Expr_CompilerToken(t);

        expcache[hash] = e;
        env.Expr_Execute(e, c);
    }