Пример #1
0
        internal void buildSecondTernaryOperator()
        {
            int    type;
            string name = pop(out type);

            StatementData statement = getCurStatement();
            FunctionData  newFunc   = new FunctionData();
            CallData      call      = new CallData();
            ValueData     nname     = new ValueData();

            call.Name    = nname;
            newFunc.Call = call;
            statement.Functions.Add(newFunc);

            FunctionData func = getLastFunction();

            if (!func.IsValid())
            {
                func.Call.SetParamClass((int)CallData.ParamClassEnum.PARAM_CLASS_TERNARY_OPERATOR);
                func.SetExtentClass((int)FunctionData.ExtentClassEnum.EXTENT_CLASS_STATEMENT);

                func.Call.Name.SetId(name);
                func.Call.Name.SetType(type);
                func.Call.Name.SetLine(getLastLineNumber());
            }
        }
Пример #2
0
        internal void buildOperator()
        {
            int    type;
            string name = pop(out type);

            StatementData arg = popStatement();

            StatementData _statement = newStatement();
            FunctionData  first      = _statement.First;

            first.Call.Name.SetLine(getLastLineNumber());
            mStatementSemanticStack.Push(_statement);

            StatementData statement = getCurStatement();
            FunctionData  func      = getLastFunction();

            if (!func.IsValid())
            {
                func.Call.SetParamClass((int)CallData.ParamClassEnum.PARAM_CLASS_OPERATOR);

                func.Call.Name.SetId(name);
                func.Call.Name.SetType(type);

                if (arg.IsValid())
                {
                    func.Call.AddParams(arg);
                }
            }
        }
Пример #3
0
        internal void buildFirstTernaryOperator()
        {
            int    type;
            string name = pop(out type);

            StatementData arg = popStatement();

            StatementData _statement = newStatement();
            FunctionData  first      = _statement.First;

            first.Call.Name.SetLine(getLastLineNumber());

            _statement.CopyFirstComments(arg);
            arg.FirstComments.Clear();

            mStatementSemanticStack.Push(_statement);

            StatementData statement = getCurStatement();
            FunctionData  func      = getLastFunction();

            if (!func.IsValid())
            {
                func.Call.SetParamClass((int)CallData.ParamClassEnum.PARAM_CLASS_TERNARY_OPERATOR);
                func.SetExtentClass((int)FunctionData.ExtentClassEnum.EXTENT_CLASS_STATEMENT);

                func.Call.Name.SetId(name);
                func.Call.Name.SetType(type);

                if (arg.IsValid())
                {
                    func.Call.AddParams(arg);
                }
            }
        }
Пример #4
0
        internal void setFunctionId()
        {
            int          type;
            string       name = pop(out type);
            FunctionData func = getLastFunction();

            if (!func.IsValid())
            {
                func.Call.Name.SetId(name);
                func.Call.Name.SetType(type);
            }
        }
Пример #5
0
        private void setMemberId()
        {
            int          type;
            string       name = pop(out type);
            FunctionData func = getLastFunction();

            if (!func.IsValid())
            {
                func.Name.SetId(name);
                func.Name.SetType(type);
                func.Name.SetLine(getLastLineNumber());
            }
        }
Пример #6
0
        internal void beginFunction()
        {
            StatementData statement = getCurStatement();
            FunctionData  func      = getLastFunction();

            if (func.IsValid())
            {
                //语句的多元函数的其它元函数名
                FunctionData newFunc = new FunctionData();
                CallData     call    = new CallData();
                ValueData    name    = new ValueData();
                call.Name    = name;
                newFunc.Call = call;
                statement.Functions.Add(newFunc);
            }
        }
Пример #7
0
        internal void setMemberId()
        {
            int    type;
            string name = pop(out type);

            if (type == CallData.ID_TOKEN)
            {
                type = CallData.STRING_TOKEN;
            }
            FunctionData func = getLastFunction();

            if (!func.IsValid())
            {
                func.Call.Name.SetId(name);
                func.Call.Name.SetType(type);
            }
        }
Пример #8
0
        private void buildOperator()
        {
            int    type;
            string name = pop(out type);

            StatementData    arg     = popStatement();
            ISyntaxComponent argComp = simplifyStatement(arg);

            StatementData _statement = newStatementWithOneFunction();
            FunctionData  first      = _statement.First;

            first.Name.SetLine(getLastLineNumber());

            _statement.CopyFirstComments(argComp);
            argComp.FirstComments.Clear();

            mStatementSemanticStack.Push(_statement);

            StatementData statement = getCurStatement();
            FunctionData  func      = getLastFunction();

            if (!func.IsValid())
            {
                if (name.Length > 0 && name[0] == '`')
                {
                    func.SetParamClass((int)(FunctionData.ParamClassEnum.PARAM_CLASS_WRAP_INFIX_CALL_MASK | FunctionData.ParamClassEnum.PARAM_CLASS_OPERATOR));

                    func.Name.SetId(name.Substring(1));
                    func.Name.SetType(type);
                }
                else
                {
                    func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_OPERATOR);

                    func.Name.SetId(name);
                    func.Name.SetType(type);
                }
                if (argComp.IsValid())
                {
                    func.AddParam(argComp);
                }
            }
        }
Пример #9
0
        private void buildSecondTernaryOperator()
        {
            int    type;
            string name = pop(out type);

            StatementData statement = getCurStatement();
            FunctionData  newFunc   = new FunctionData();
            ValueData     nname     = new ValueData();

            newFunc.Name = nname;
            statement.Functions.Add(newFunc);

            FunctionData func = getLastFunction();

            if (!func.IsValid())
            {
                func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_TERNARY_OPERATOR);
                func.Name.SetId(name);
                func.Name.SetType(type);
                func.Name.SetLine(getLastLineNumber());
            }
        }
Пример #10
0
        private void buildFirstTernaryOperator()
        {
            int    type;
            string name = pop(out type);

            StatementData    arg     = popStatement();
            ISyntaxComponent argComp = simplifyStatement(arg);

            StatementData _statement = newStatementWithOneFunction();
            FunctionData  first      = _statement.First;

            //三元运算符表示成op1(cond)(true_val)op2(false_val)
            first.LowerOrderFunction      = new FunctionData();
            first.LowerOrderFunction.Name = new ValueData();
            first.LowerOrderFunction.Name.SetLine(getLastLineNumber());

            _statement.CopyFirstComments(argComp);
            argComp.FirstComments.Clear();

            mStatementSemanticStack.Push(_statement);

            StatementData statement = getCurStatement();
            FunctionData  func      = getLastFunction();

            if (!func.IsValid())
            {
                func.LowerOrderFunction.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_PARENTHESIS);
                func.LowerOrderFunction.Name.SetId(name);
                func.LowerOrderFunction.Name.SetType(type);
                if (argComp.IsValid())
                {
                    func.LowerOrderFunction.AddParam(argComp);
                }

                func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_TERNARY_OPERATOR);
            }
        }