This repository was archived by the owner on Jun 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSymbolTableNode.java
More file actions
61 lines (55 loc) · 2 KB
/
SymbolTableNode.java
File metadata and controls
61 lines (55 loc) · 2 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
public class SymbolTableNode {
public int scopeID;
public String value;
public int parentScopeID;
public String type;
public boolean isUsed;
public int nodeID;
public boolean isDeclaration;
public boolean isArray;
public int varLinkNodeID; // which node id (of the declared vars) the var being used will access
SymbolTableNode(int nID, int sID, String v, int psID, String t) {
nodeID = nID;
scopeID = sID;
value = v;
parentScopeID = psID;
type = t;
isUsed = false;
varLinkNodeID = -1;
}
SymbolTableNode(int nID, int sID, String v, int psID, String t, boolean d, boolean a) {
nodeID = nID;
scopeID = sID;
value = v;
parentScopeID = psID;
type = t;
isUsed = false;
isDeclaration = d;
isArray = a;
varLinkNodeID = -1;
}
SymbolTableNode(int nID, int sID, String v, int psID, String t, boolean d, boolean a, int vL) {
nodeID = nID;
scopeID = sID;
value = v;
parentScopeID = psID;
type = t;
isUsed = false;
isDeclaration = d;
isArray = a;
varLinkNodeID = vL;
}
public String procRow() {
return "nodeID:\t" + nodeID + "\tscopeID:\t" + scopeID + "\tvalue:\t" + value + "\tparentScopeID:\t"
+ parentScopeID + "\ttype:\t" + type;
}
public String varRow() {
if (!isDeclaration) {
return "nodeID:\t" + nodeID + "\tscopeID:\t" + scopeID + "\tvalue:\t" + value + "\tparentScopeID:\t"
+ parentScopeID + "\ttype:\t" + type + "\tisDeclaration:\t" + isDeclaration + "\tisArray:\t"
+ isArray + "\tLinkedToNodeID:\t" + varLinkNodeID;
}
return "nodeID:\t" + nodeID + "\tscopeID:\t" + scopeID + "\tvalue:\t" + value + "\tparentScopeID:\t"
+ parentScopeID + "\ttype:\t" + type + "\tisDeclaration:\t" + isDeclaration + "\tisArray:\t" + isArray + "\tisUsed:\t" + isUsed;
}
}