Exemplo n.º 1
0
        public void process(AssignmentStatment assignmentStatment)
        {
            VaribleStatment varibleStatment = (VaribleStatment)assignmentStatment.getTokensList()[0];

            if (varibleStatment.getTokensList().Count == 1) // для переменной
            {
                _isArrayElementLeft = false;
                _leftOp             = (Token)varibleStatment.getTokensList()[0];
                Program.varibleName = _leftOp.value;
                SemanticAnalizer.initVarible(_leftOp.value);

                _rightOp = getRightOp(assignmentStatment.getTokensList()[1]);
            }
            else //элемент массива
            {
                _isArrayElementLeft = true;
                _leftOp             = (Token)varibleStatment.getTokensList()[0];
                Program.varibleName = _leftOp.value;
                _elementIndex       = (Token)varibleStatment.getTokensList()[2];
                List <Token> rightOp = getRightOp(assignmentStatment.getTokensList()[1]);
                SemanticAnalizer.checkArrayOnOutOfRange(rightOp);
            }
            //SemanticAnalizer.checkDivByZero(_rightOp);
            //SemanticAnalizer.checkArrayOnOutOfRange(_rightOp);
            generate();
        }
Exemplo n.º 2
0
 static public string visit(AssignmentStatment assignmentStatment)
 {
     return(Constants.ASSIGNMENT_STATMENT);
 }