Beispiel #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"));
        }
Beispiel #2
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();
            }
        }
Beispiel #3
0
        private void Default(string oper, bool validTag = true)
        {
            if (validTag)
            {
                var varName = this.ValidateNameExists(this._Tag);
                if (varName == null)
                {
                    this.Error(this._Tag + " 未定义");
                }
                this._Tag = varName.GetAliasName();
            }
            var varElem = new JVariableEleme();

            varElem.IsStart = true;
            varElem.Name    = this._Tag;
            if (!string.IsNullOrEmpty(oper))
            {
                if (!this.VaildatePChar(oper))
                {
                    this.Error();
                }
                varElem.Characteristic = new CharacteristicInfo(EBAType.Before, oper);
            }
            this.AddFather(this.pValueEleme, varElem);
            var variableSpan = new VariableSpan(this.PBParser, varElem);

            variableSpan.Init();
        }
Beispiel #4
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 + " 未定义");
            }
        }
Beispiel #5
0
        private void End(EPType p, BEleme e)
        {
            this.SetUpPoint();
            this.GetChar();
            switch (this._Char)
            {
            case '+':
            case '-':
            case '.':
            case '[':
            case '(':
                if (this._Char == '+' || this._Char == '-')
                {
                    var c     = this._Char;
                    var point = new CPoint(this.UpPoint);
                    this.GetChar(false, null);
                    if (this._Char != c)
                    {
                        this.PBParser.Point.X = point.X;
                        this.PBParser.Point.Y = point.Y;
                        break;
                    }

                    if (p == EPType.Method)
                    {
                        this.Error();
                    }

                    IVariableAttr att    = null;
                    BEleme        father = this.NEleme.Father;
                    while (father is IVariableValue)
                    {
                        father = father.Father;
                        if (father is JVariableEleme)
                        {
                            if ((father as JVariableEleme).IsStart)
                            {
                                att = father as JVariableEleme;
                                break;
                            }
                            father = father.Father;
                        }
                    }
                    SetCharacteristic(c, att);
                    break;
                }

                this.ResetUpPoint();
                var varElem = new JVariableEleme();
                this.AddFather(e, varElem);
                var variableSpan = new VariableSpan(this.PBParser, varElem);
                variableSpan.Init();
                break;

            case ';':
                break;

            default:
                this.ResetUpPoint();
                break;
            }
        }