blob: 761a49cb363abe71bf59865a08f2b3a5b494d56b (
plain)
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
|
package ast.nodes;
import java.util.ArrayList;
import semanticanalysis.SemanticError;
import semanticanalysis.SymbolTable;
import ast.types.*;
import org.antlr.v4.runtime.tree.TerminalNode;
/**
* Node for the `comp_op` statement of the grammar.
*/
public class CompOpNode implements Node {
private final TerminalNode op;
public CompOpNode(TerminalNode op) {
this.op = op;
}
public String getOp() {
return op.toString();
}
@Override
public ArrayList<SemanticError> checkSemantics(SymbolTable ST, int _nesting, FunctionType ft) {
return new ArrayList<>();
}
@Override
public Type typeCheck() {
return new VoidType();
}
/**
* The code generation for this operation is in `ExprNode`.
*/
@Override
public String codeGeneration() {
return "";
}
@Override
public String printAST(String prefix) {
return prefix + "CompOpNode(" + op + ")\n";
}
@Override
public String toPrint(String prefix) {
return prefix + op;
}
}
|