コード例 #1
0
 public void process(WriteStatment writeStatment)
 {
     try
     {
         VaribleStatment varibleStatment = (VaribleStatment)writeStatment.getTokensList()[0];
         _isArray    = false;
         _identifier = (Token)varibleStatment.getTokensList()[0];
     }
     catch//для массива
     {
         List <Token> tokens = AssignmentProcessor.getMathExpression((MathStatment)writeStatment.getTokensList()[0]);
         _identifier = tokens[0];
         if (tokens.Count == 1)
         {
             if (tokens[0].kind == Constants.CONST_INT)
             {
                 SemanticAnalizer.readAndWriteToConts();
             }
             else
             {
                 SemanticAnalizer.checkVarible(tokens[0].value);
             }
             _isArray = false;
         }
         else if (tokens.Count == 4 && (tokens[1].kind == Constants.BRACKET_L) && (tokens[3].kind == Constants.BRACKET_R))
         {
             _isArray = true;
             if (tokens[2].kind == Constants.IDENTIFIER)
             {
                 SemanticAnalizer.checkVarible(tokens[2].value);
             }
             _elementIndex = tokens[2];
         }
         else
         {
             SemanticAnalizer.InvalidIdentifier();
         }
     }
     generate();
 }