예제 #1
0
        /// <summary>
        ///
        /// </summary>
        public void AutoFun()
        {
            this.GetTag();
            if (this._Tag != "function")
            {
                this.Error();
            }
            var fSpan = new FunctionSpan(this);

            fSpan.IsValidName = false;
            fSpan.Init();
            this.ValidChar(')');

            this.SetUpPoint();
            this.GetChar();
            this.ResetUpPoint();
            if (this._Char == '(')
            {
                var varElem = new JVariableEleme();
                this.AddFather(varElem);

                var varSpan = new VariableSpan(this.PBParser, varElem);
                varSpan.Init();
            }
        }
예제 #2
0
        /// <summary>
        /// 变量
        /// </summary>
        /// <param name="oper"></param>
        private void Var(string oper)
        {
            if (!Tools.HasVarHead(this._Char))
            {
                this.Error();
            }
            this.GetTagForBack(false);
            switch (this._Tag)
            {
            case "true":
            case "false":
                this.AddFather(pValueEleme, new JConstEleme(this._Tag, EValueType.Bool));
                break;

            case "undefined":
                this.AddFather(pValueEleme, new JConstEleme(this._Tag, EValueType.Undefined));
                break;

            case "null":
                this.AddFather(pValueEleme, new JConstEleme(this._Tag, EValueType.Null));
                break;

            //case "window":
            //    this.AddFather(pValueEleme, new JConstEleme(this._Tag, EValueType.Const));
            //break;
            case "new":
                new NewSpan(this).Init();
                break;

            case "typeof":
                new TypeofInstanceofSpan(this.PBParser, pValueEleme).Init();
                break;

            case "function":
                var fSpan = new FunctionSpan(this.PBParser, this.pValueEleme);
                fSpan.IsValidName = false;
                fSpan.Init();
                break;

            case "arguments":
                Arguments(oper);
                break;

            case "this":
                this.This(oper);
                break;

            default:
                Default(oper);
                break;
            }
        }