-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConstNode.java
53 lines (39 loc) · 1.07 KB
/
ConstNode.java
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
package nodes;
import Visitor.*;
import org.w3c.dom.Element;
import support.SymbolTable;
import support.ValueType;
public class ConstNode implements ISyntaxVisitable, ISemanticVisitable, ICVisitable {
public String name = null;
public Object value1 = null;
public ConstNode(String name, Object value1){
this.name=name;
this.value1 = value1;
}
//Semantic part
public ValueType type = null;
public void setType(String type) {
try {
this.type = SymbolTable.StringToType(type);
} catch (Exception e) {
System.exit(0);
e.printStackTrace();
}
}
public void setType(ValueType t) {
try {
this.type = t;
} catch (Exception e) {
System.exit(0);
e.printStackTrace();
}
}
@Override
public Element accept(ISyntaxVisitor v) {
return v.visit(this);
}
@Override
public void accept(ISemanticVisitor v) { v.visit(this); }
@Override
public void accept(ICVisitor v) { v.visit(this); }
}