private Location Location() { int index = lexer.SymbolIndex; VariableLocation location = new VariableLocation(index); Match(Token.Variable); if (lookahead == Token.LeftParen) { List<Expression> exprs = new List<Expression>(); Match(Token.LeftParen); exprs.Add(Expression()); while (lookahead == Token.Comma) { Match(Token.Comma); exprs.Add(Expression()); } Match(Token.RightParen); return new ArrayElement(location, exprs.ToArray()); } else return location; }
public ArrayElement(VariableLocation loc, params Expression[] exprs) { this.location = loc; this.exprs = exprs; }