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)); } }
List <Token> getArrayInitializtionList(ArrayAssignment arrayAssignmnent) { List <Token> tokens = new List <Token>(); foreach (Token token in arrayAssignmnent.getTokensList()) { tokens.Add(token); } SemanticAnalizer.checkVarible(_leftOp.value); SemanticAnalizer.checkInitEmptyArray(_leftOp.value, tokens.Count); SemanticAnalizer.checkIsLengthArrayEqual(_leftOp.value, tokens.Count); if (_isArrayElementLeft) { SemanticAnalizer.incompatibleTypes(); } else { SemanticAnalizer.checkCompareTypes(_leftOp.value, Constants.INTARRAY); } return(tokens); }
static public string visit(ArrayAssignment arrayAssignment) { return(Constants.ARRAY_ASSIGNMENT); }