/******************************************************************************* * Copyright (c) 2009-2015 CWI * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl * * Paul Klint - Paul.Klint@cwi.nl - CWI * * Mark Hills - Mark.Hills@cwi.nl (CWI) * * Arnold Lankamp - Arnold.Lankamp@cwi.nl * * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI *******************************************************************************/ package org.rascalmpl.ast; import org.rascalmpl.value.IConstructor; import org.rascalmpl.value.ISourceLocation; public abstract class KeywordArguments_Expression extends AbstractAST { public KeywordArguments_Expression(ISourceLocation src, IConstructor node) { super(src /* we forget node on purpose */); } public boolean hasKeywordArgumentList() { return false; } public java.util.List<org.rascalmpl.ast.KeywordArgument_Expression> getKeywordArgumentList() { throw new UnsupportedOperationException(); } public boolean hasOptionalComma() { return false; } public org.rascalmpl.ast.OptionalComma getOptionalComma() { throw new UnsupportedOperationException(); } public boolean isDefault() { return false; } static public class Default extends KeywordArguments_Expression { // Production: sig("Default",[arg("org.rascalmpl.ast.OptionalComma","optionalComma"),arg("java.util.List\<org.rascalmpl.ast.KeywordArgument_Expression\>","keywordArgumentList")],breakable=false) private final org.rascalmpl.ast.OptionalComma optionalComma; private final java.util.List<org.rascalmpl.ast.KeywordArgument_Expression> keywordArgumentList; public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.OptionalComma optionalComma, java.util.List<org.rascalmpl.ast.KeywordArgument_Expression> keywordArgumentList) { super(src, node); this.optionalComma = optionalComma; this.keywordArgumentList = keywordArgumentList; } @Override public boolean isDefault() { return true; } @Override public <T> T accept(IASTVisitor<T> visitor) { return visitor.visitKeywordArguments_ExpressionDefault(this); } @Override protected void addForLineNumber(int $line, java.util.List<AbstractAST> $result) { if (getLocation().getBeginLine() == $line) { $result.add(this); } ISourceLocation $l; $l = optionalComma.getLocation(); if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { optionalComma.addForLineNumber($line, $result); } if ($l.getBeginLine() > $line) { return; } for (AbstractAST $elem : keywordArgumentList) { $l = $elem.getLocation(); if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) { $elem.addForLineNumber($line, $result); } if ($l.getBeginLine() > $line) { return; } } } @Override public boolean equals(Object o) { if (!(o instanceof Default)) { return false; } Default tmp = (Default) o; return true && tmp.optionalComma.equals(this.optionalComma) && tmp.keywordArgumentList.equals(this.keywordArgumentList) ; } @Override public int hashCode() { return 823 + 43 * optionalComma.hashCode() + 733 * keywordArgumentList.hashCode() ; } @Override public org.rascalmpl.ast.OptionalComma getOptionalComma() { return this.optionalComma; } @Override public boolean hasOptionalComma() { return true; } @Override public java.util.List<org.rascalmpl.ast.KeywordArgument_Expression> getKeywordArgumentList() { return this.keywordArgumentList; } @Override public boolean hasKeywordArgumentList() { return true; } @Override public Object clone() { return newInstance(getClass(), src, (IConstructor) null , clone(optionalComma), clone(keywordArgumentList)); } } public boolean isNone() { return false; } static public class None extends KeywordArguments_Expression { // Production: sig("None",[],breakable=false) public None(ISourceLocation src, IConstructor node ) { super(src, node); } @Override public boolean isNone() { return true; } @Override public <T> T accept(IASTVisitor<T> visitor) { return visitor.visitKeywordArguments_ExpressionNone(this); } @Override protected void addForLineNumber(int $line, java.util.List<AbstractAST> $result) { if (getLocation().getBeginLine() == $line) { $result.add(this); } ISourceLocation $l; } @Override public boolean equals(Object o) { if (!(o instanceof None)) { return false; } None tmp = (None) o; return true ; } @Override public int hashCode() { return 239 ; } @Override public Object clone() { return newInstance(getClass(), src, (IConstructor) null ); } } }