예제 #1
0
        private void FollowUp()
        {
            this.GetTag();
            if (this._Tag == "var")
            {
                this.Error("意外的标记 var");
            }

            var exists  = this.ValidateNameExists(this._Tag);
            var varSpan = new VarSpan(this);

            varSpan.IsFollowUp = true;
            if (exists != null)
            {
                varSpan.IsDef   = true;
                varSpan.VarName = exists.GetAliasName();
            }
            else
            {
                varSpan.VarName = this._Tag;
            }
            varSpan.Init();
        }
예제 #2
0
        private void SetValue()
        {
            var e = this.ValidateNameExists(this._Tag);

            this.SetUpPoint();
            this.GetChar();
            switch (this._Char)
            {
            case '=':
                this.ResetUpPoint();
                var vSpan = new VarSpan(this);
                if (e != null)
                {
                    vSpan.VarName = e.GetAliasName();
                    vSpan.IsDef   = true;
                }
                else
                {
                    vSpan.VarName = this._Tag;
                }
                vSpan.Init();
                return;

            case '+':
            case '-':
            case '*':
            case '/':
            case '%':
                char fChar = this._Char;
                var  point = new CPoint(this.PBParser.Point);
                this.GetChar();
                if (this._Char != '=')
                {
                    if (this.IsAddOrReduce)
                    {
                        this.ResetUpPoint();
                        break;
                    }
                    this.Error();
                }
                if (e == null)
                {
                    this.Error(this._Tag + " 未定义");
                }
                this.PBParser.Point.X = point.X;
                this.PBParser.Point.Y = point.Y;
                vSpan               = new VarSpan(this);
                vSpan.VarName       = e.GetAliasName();
                vSpan.IsDef         = true;
                vSpan.OperationChar = fChar.ToString();
                vSpan.Init();
                return;
            }
            if (e != null)
            {
                this.ResetUpPoint();
                var varElem = new JVariableEleme();
                varElem.Name = e.GetAliasName();
                this.AddFather(varElem);
                var variableSpan = new VariableSpan(this.PBParser, varElem);
                variableSpan.IsSet = true;
                variableSpan.Init();
                this.AddFather(new MarkElem(";\r\n"));
            }
            else
            {
                this.Error(this._Tag + " 未定义");
            }
        }
예제 #3
0
        public void For()
        {
            pFEleme   = new JForEleme();
            pForEleme = pFEleme as JForEleme;

            #region 定义参数
            this.SetUpPoint();
            this.GetChar();
            if (this._Char != ';')
            {
                this.ResetUpPoint();
                this.GetTag();
                var valueS = new VarSpan(this);
                if (this._Tag != "var")
                {
                    var exists = this.ValidateNameExists(this._Tag);
                    if (exists != null)
                    {
                        valueS.IsDef   = true;
                        valueS.VarName = exists.GetAliasName();
                    }
                    else
                    {
                        valueS.VarName = this._Tag;
                    }
                }
                valueS.Init();
            }

            #endregion

            #region Statement2
            this.SetUpPoint();
            this.GetChar();
            if (this._Char != ';')
            {
                this.ResetUpPoint();
                pForEleme.Statement2        = new ValueEleme();
                pForEleme.Statement2.Father = this.NEleme;
                var valueE = new ValueEleme();
                this.AddFather(pForEleme.Statement2, valueE);
                var valueS = new ValueSpan(this.PBParser, valueE);
                valueS.Init();
            }
            #endregion

            #region where
            this.SetUpPoint();
            this.GetChar();
            if (this._Char != ';')
            {
                this.ResetUpPoint();
                pForEleme.Where        = new ValueEleme();
                pForEleme.Where.Father = this.NEleme;
                var valueE = new ValueEleme();
                this.AddFather(pForEleme.Where, valueE);
                var valueS = new ValueSpan(this.PBParser, valueE);
                valueS.Init();
            }
            #endregion
        }