public void visit(ArrayGetElement statement) { foreach (Expression index in statement.indexes) { index.accept(this); } }
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"); }
public ArrayAssignementStatement(ArrayGetElement array, Expression val) { this.array = array; this.val = val; }