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