Ejemplo n.º 1
0
        private void This()
        {
            this.SetUpPoint();
            this.ValidChar('.');
            var funElem = this.NEleme.GetFather <JFunEleme>();

            if (funElem == null)
            {
                this.Error();
            }

            //this.ResetUpPoint();

            //this.SetUpPoint();
            this.GetTagNotNull();
            this.GetChar();
            if (this._Char == '=')
            {
                var funPro = new JDefinitionEleme();
                funPro.Name = this._Tag;
                this.AnalysisAnnotation(funPro);
                funElem.AddPropertyValue(this._Tag, funPro);
            }
            this.ResetUpPoint();
            var varElem = new JVariableEleme();

            varElem.Name = funElem.GetThisName;
            this.AddFather(varElem);
            var variableSpan = new VariableSpan(this.PBParser, varElem);

            variableSpan.IsSet = true;
            variableSpan.Init();
            this.AddFather(new MarkElem(";\r\n"));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool Foreach()
        {
            this.SetUpPoint();
            string varName = string.Empty;

            this.GetTag();
            if (this._Tag == "var")
            {
                this.GetTagNotNull();
                varName = this._Tag;
            }
            else
            {
                varName = this._Tag;
            }

            this.GetTag();
            if (this._Tag != "in")
            {
                this.ResetUpPoint();
                return(false);
            }

            pFEleme            = new JForeachEleme();
            pFEleme.Father     = this.NEleme;
            pForeachEleme      = pFEleme as JForeachEleme;
            pForeachEleme.Name = varName + "_" + this.PBParser.VarIndexCount++ + "_";

            var def = new JDefinitionEleme();

            def.SetPoint(this.PBParser.Point);
            def.Name = varName;
            var exists = this.ValidateNameExists(varName);

            if (exists != null)
            {
                def.Name          = exists.GetAliasName();
                def.PVariableType = Entity.EVariableType.SetValue;
            }
            this.AddFather(def, new JConstEleme(pForeachEleme.Name, Entity.EValueType.Const));
            this.AddFather(pForeachEleme, def);

            var vE = new ValueEleme();

            vE.Father = this.NEleme;
            var vS = new ValueSpan(this.PBParser, vE);

            vS.Init();
            pForeachEleme.Where = vE;
            return(true);
        }
Ejemplo n.º 3
0
        private void Catch()
        {
            var catchE = new JCatchEleme();

            catchE.Father             = this.pTryEleme;
            this.pTryEleme.CatchValue = catchE;

            this.GetChar();
            if (this._Char == '(')
            {
                this.GetTagNotNull();
                catchE.Name = this._Tag + "_" + this.PBParser.VarIndexCount++ + "_";
                var def = new JDefinitionEleme();
                def.Name = this._Tag;
                var exists = this.ValidateNameExists(this._Tag);
                if (exists != null)
                {
                    def.Name          = exists.GetAliasName();
                    def.PVariableType = Entity.EVariableType.SetValue;
                }
                this.AddFather(def, new JConstEleme(catchE.Name + ".Message", Entity.EValueType.SimString));
                this.AddFather(catchE, def);
                this.ValidChar(')');
                this.GetChar();
            }
            if (this._Char != '{')
            {
                this.Error();
            }
            new JavaSciptSpan(this.PBParser, catchE).Init();
            this.ValidChar('}');
            this.SetUpPoint();
            this.GetTag();
            if (this._Tag == "finally")
            {
                this.Finally();
            }
            else
            {
                this.ResetUpPoint();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 设置参数
        /// </summary>
        private void SetArgs()
        {
            if (this.pFunEleme.Arguments.IsNull())
            {
                return;
            }
            int index = 0;

            foreach (var a in this.pFunEleme.Arguments)
            {
                var jdef = new JDefinitionEleme();
                jdef.SetPoint(this.PBParser.Point);
                jdef.Name     = a;
                jdef.IsFunArg = true;
                jdef.Childs   = new List <BEleme>();
                jdef.Childs.Add(new JConstEleme(string.Format("__paramers{0}__.__Get__({1})", this.pFunEleme.Sign, index), EValueType.Const));
                this.AddFather(this.pFunEleme, jdef);
                index++;
            }
        }
Ejemplo n.º 5
0
        public override void Init()
        {
            if (string.IsNullOrEmpty(VarName))
            {
                this.GetTag();
                if (string.IsNullOrEmpty(this._Tag))
                {
                    this.Error("无法找到定义的变量名称");
                }
            }
            else
            {
                this._Tag = this.VarName;
            }

            this.ValidVar();
            var definition = new JDefinitionEleme();

            definition.SetPoint(this.PBParser.Point);
            definition.Name          = this._Tag;
            definition.OperationChar = this.OperationChar;
            this.AnalysisAnnotation(definition);
            BEleme vdef = null;

            if (string.IsNullOrEmpty(this.VarName))
            {
                vdef = this.ValidateNameExists(this._Tag, false);
            }
            else if (this.IsDef)
            {
                definition.PVariableType = Entity.EVariableType.SetValue;
            }

            if (vdef != null)
            {
                definition.PVariableType = Entity.EVariableType.SetValue;
                definition.Name          = definition.GetAliasName();
            }
            this.SetUpPoint();
            this.GetChar();
            if (this._Char == '=')
            {
                this.ResetUpPoint();
                this.ValidChar('=');
                this.AddFather(definition);
                var valueSpan = new ValueSpan(this.PBParser, definition);
                valueSpan.Init();
            }
            else if (this._Char == ',')
            {
                this.AddFather(definition, new JConstEleme("", Entity.EValueType.Undefined));
                this.AddFather(definition);
                this.ResetUpPoint();
            }
            else
            {
                if (this._Char != ';')
                {
                    this.ResetUpPoint();
                    this.GetChar(false);
                    if (this._Char != Tools.LineEndChar)
                    {
                        this.Error();
                    }
                }
                if (!(string.IsNullOrEmpty(VarName) || this.IsFollowUp))
                {
                    this.Error();
                }

                this.AddFather(definition, new JConstEleme("", Entity.EValueType.Undefined));
                this.AddFather(definition);
            }
            this.SetUpPoint();
            this.GetChar();
            if (this._Char == ',')
            {
                FollowUp();
            }
            else
            {
                this.ResetUpPoint();
            }
        }