Ejemplo n.º 1
0
 List <Token> getRightOp(object statment)
 {
     try //для инициализации массива
     {
         ArrayAssignment arrayAssignment = (ArrayAssignment)statment;
         _isMathRight = false;
         return(getArrayInitializtionList(arrayAssignment));
     }
     catch //для математического выражения
     {
         MathStatment mathStatment = (MathStatment)statment;
         _isMathRight = true;
         return(getMathExpression(mathStatment));
     }
 }
Ejemplo n.º 2
0
        public static List <Token> getMathExpression(MathStatment mathStatment)
        {
            List <Token>   tokens         = new List <Token>();
            MathExpression mathExpression = (MathExpression)mathStatment.getTokensList()[0];

            foreach (object item in mathExpression.getTokensList())
            {
                tokens.AddRange(getFactor(item));
            }
            if (tokens.Count > 1)
            {
                SortExpression.getSortedExpression(tokens);
            }

            return(tokens);
        }
Ejemplo n.º 3
0
        public static List <Token> getMathExpression(MathStatment mathStatment)
        {
            List <Token>   tokens         = new List <Token>();
            MathExpression mathExpression = (MathExpression)mathStatment.getTokensList()[0];

            foreach (object item in mathExpression.getTokensList())
            {
                tokens.AddRange(getFactor(item));
            }


            if (!Program.isArrayElementLeft)
            {
                SemanticAnalizer.checkCompareTypes(Program.varibleName, Constants.INT);
            }

            return(tokens);
        }
Ejemplo n.º 4
0
 static public string visit(MathStatment mathStatment)
 {
     return(Constants.MATH_STATMENT);
 }