Esempio n. 1
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);
                }
            }
        }
Esempio n. 2
0
        internal void markStatement()
        {
            FunctionData func = getLastFunction();

            bool           commentOnNewLine;
            IList <string> cmts = GetComments(out commentOnNewLine);

            if (cmts.Count > 0)
            {
                if (func.IsHighOrder)
                {
                    func.LowerOrderFunction.Comments.AddRange(cmts);
                }
                else
                {
                    func.Comments.AddRange(cmts);
                }
            }

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_STATEMENT);
        }
Esempio n. 3
0
        private void markExternScript()
        {
            FunctionData func = getLastFunction();

            bool           commentOnNewLine;
            IList <string> cmts = GetComments(out commentOnNewLine);

            if (cmts.Count > 0)
            {
                if (func.IsHighOrder)
                {
                    func.LowerOrderFunction.Comments.AddRange(cmts);
                }
                else
                {
                    func.Comments.AddRange(cmts);
                }
            }

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_EXTERN_SCRIPT);
        }
Esempio n. 4
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());
            }
        }
Esempio n. 5
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);
            }
        }
Esempio n. 6
0
        private void markAngleBracketPercentParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_ANGLE_BRACKET_PERCENT);
        }
Esempio n. 7
0
        private void markBracePercentParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_BRACE_PERCENT);
        }
Esempio n. 8
0
        private void markParenthesisPercentParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_PARENTHESIS_PERCENT);
        }
Esempio n. 9
0
        internal void markQuestionPeriodParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_QUESTION_PERIOD);
        }
Esempio n. 10
0
        private void markAngleBracketColonParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_ANGLE_BRACKET_COLON);
        }
Esempio n. 11
0
        private void markPeriodBraceParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACE);
        }
Esempio n. 12
0
        private void markQuestionBraceParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_QUESTION_BRACE);
        }
Esempio n. 13
0
        private void markQuestionPeriodStarParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_QUESTION_PERIOD_STAR);
        }
Esempio n. 14
0
        internal void markPeriodBracketParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_PERIOD_BRACKET);
        }
Esempio n. 15
0
        private void markColonColonParenthesisParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_COLON_COLON_PARENTHESIS);
        }
Esempio n. 16
0
        internal void markQuestionParenthesisParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_QUESTION_PARENTHESIS);
        }
Esempio n. 17
0
        internal void markPeriodStarParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_PERIOD_STAR);
        }
Esempio n. 18
0
        internal void markPointerParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_POINTER);
        }
Esempio n. 19
0
        internal void markQuestionBracketParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_QUESTION_BRACKET);
        }
Esempio n. 20
0
        private void markColonColonBraceParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_COLON_COLON_BRACE);
        }
Esempio n. 21
0
        private void markBracketParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_BRACKET);
        }
Esempio n. 22
0
        private void markPointerStarParam()
        {
            FunctionData func = getLastFunction();

            func.SetParamClass((int)FunctionData.ParamClassEnum.PARAM_CLASS_POINTER_STAR);
        }
Esempio n. 23
0
        internal void markPeriodParenthesisParam()
        {
            FunctionData func = getLastFunction();

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