001/* 002 * Copyright (c) 2012-2017 Institut National des Sciences Appliquées de Lyon (INSA-Lyon) 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 */ 009 010package org.eclipse.golo.compiler.parser; 011 012import java.util.List; 013import java.util.LinkedList; 014 015public class ASTForEachLoop extends GoloASTNode { 016 017 private String elementIdentifier; 018 private List<String> names = new LinkedList<>(); 019 private boolean isVarargs = false; 020 021 public ASTForEachLoop(int id) { 022 super(id); 023 } 024 025 public ASTForEachLoop(GoloParser p, int id) { 026 super(p, id); 027 } 028 029 public String getElementIdentifier() { 030 return elementIdentifier; 031 } 032 033 public void setElementIdentifier(String elementIdentifier) { 034 this.elementIdentifier = elementIdentifier; 035 } 036 037 public List<String> getNames() { 038 return this.names; 039 } 040 041 public void setNames(List<String> names) { 042 this.names.clear(); 043 this.names.addAll(names); 044 } 045 046 public void setVarargs(boolean b) { 047 this.isVarargs = b; 048 } 049 050 public boolean isVarargs() { 051 return this.isVarargs; 052 } 053 054 @Override 055 public String toString() { 056 return String.format("ASTForEachLoop{elementIdentifier='%s'}", elementIdentifier); 057 } 058 059 @Override 060 public Object jjtAccept(GoloParserVisitor visitor, Object data) { 061 return visitor.visit(this, data); 062 } 063}