예제 #1
0
 public void visit(ArrayGetElement statement)
 {
     foreach (Expression index in statement.indexes)
     {
         index.accept(this);
     }
 }
예제 #2
0
 private Statement assignment()
 {
     //Token curr = get(0);
     //Token curr1 = get(1);
     Console.WriteLine();
     if (lookMatch(0, TokenType.WORD) && lookMatch(1, TokenType.EQUALS))
     {
         //consume(TokenType.WORD);
         string var = consume(TokenType.WORD).Text;
         consume(TokenType.EQUALS);
         return(new Assignment(var, expression()));
     }
     if (lookMatch(0, TokenType.WORD) && lookMatch(1, TokenType.S_QBRACKET))
     {
         //string var = consume(TokenType.WORD).Text;
         ArrayGetElement array = element();
         consume(TokenType.EQUALS);
         return(new ArrayAssignementStatement(array, expression()));
     }
     throw new Exception("Unknown operator");
 }
예제 #3
0
 public ArrayAssignementStatement(ArrayGetElement array, Expression val)
 {
     this.array = array;
     this.val   = val;
 }