-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathKeywordFormal.java
More file actions
166 lines (133 loc) · 4.52 KB
/
KeywordFormal.java
File metadata and controls
166 lines (133 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*******************************************************************************
* 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 io.usethesource.vallang.IConstructor;
import io.usethesource.vallang.ISourceLocation;
@SuppressWarnings(value = {"unused"})
public abstract class KeywordFormal extends AbstractAST {
public KeywordFormal(ISourceLocation src, IConstructor node) {
super(src /* we forget node on purpose */);
}
public boolean hasExpression() {
return false;
}
public org.rascalmpl.ast.Expression getExpression() {
throw new UnsupportedOperationException();
}
public boolean hasName() {
return false;
}
public org.rascalmpl.ast.Name getName() {
throw new UnsupportedOperationException();
}
public boolean hasType() {
return false;
}
public org.rascalmpl.ast.Type getType() {
throw new UnsupportedOperationException();
}
public boolean isDefault() {
return false;
}
static public class Default extends KeywordFormal {
// Production: sig("Default",[arg("org.rascalmpl.ast.Type","type"),arg("org.rascalmpl.ast.Name","name"),arg("org.rascalmpl.ast.Expression","expression")],breakable=false)
private final org.rascalmpl.ast.Type type;
private final org.rascalmpl.ast.Name name;
private final org.rascalmpl.ast.Expression expression;
public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.Type type, org.rascalmpl.ast.Name name, org.rascalmpl.ast.Expression expression) {
super(src, node);
this.type = type;
this.name = name;
this.expression = expression;
}
@Override
public boolean isDefault() {
return true;
}
@Override
public <T> T accept(IASTVisitor<T> visitor) {
return visitor.visitKeywordFormalDefault(this);
}
@Override
protected void addForLineNumber(int $line, java.util.List<AbstractAST> $result) {
if (getLocation().getBeginLine() == $line) {
$result.add(this);
}
ISourceLocation $l;
$l = type.getLocation();
if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) {
type.addForLineNumber($line, $result);
}
if ($l.getBeginLine() > $line) {
return;
}
$l = name.getLocation();
if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) {
name.addForLineNumber($line, $result);
}
if ($l.getBeginLine() > $line) {
return;
}
$l = expression.getLocation();
if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) {
expression.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.type.equals(this.type) && tmp.name.equals(this.name) && tmp.expression.equals(this.expression) ;
}
@Override
public int hashCode() {
return 941 + 941 * type.hashCode() + 2 * name.hashCode() + 421 * expression.hashCode() ;
}
@Override
public org.rascalmpl.ast.Type getType() {
return this.type;
}
@Override
public boolean hasType() {
return true;
}
@Override
public org.rascalmpl.ast.Name getName() {
return this.name;
}
@Override
public boolean hasName() {
return true;
}
@Override
public org.rascalmpl.ast.Expression getExpression() {
return this.expression;
}
@Override
public boolean hasExpression() {
return true;
}
@Override
public Object clone() {
return newInstance(getClass(), src, (IConstructor) null , clone(type), clone(name), clone(expression));
}
}
}