cminus/submit/SymbolInfo.java

44 lines
887 B
Java
Raw Normal View History

2023-04-10 11:17:11 -04:00
/*
* Code formatter project
* CS 4481
*/
package submit;
import submit.ast.VarType;
/**
*
* @author edwajohn
*/
public class SymbolInfo {
private final String id;
// In the case of a function, type is the return type
private final VarType type;
private final boolean function;
2023-04-23 02:24:42 -04:00
private int offset;
2023-04-10 11:17:11 -04:00
public SymbolInfo(String id, VarType type, boolean function) {
this.id = id;
this.type = type;
this.function = function;
}
2023-04-23 02:24:42 -04:00
public SymbolInfo(String id, VarType type, boolean function, int offset) {
this(id, type, function);
this.offset = offset;
}
2023-04-10 11:17:11 -04:00
@Override
public String toString() {
return "<" + id + ", " + type + '>';
}
2023-04-23 02:24:42 -04:00
public VarType getType() { return type; }
public boolean isFunction() { return function; }
public int getOffset() { return offset; }
public void setOffset(int offset) { this.offset = offset; }
2023-04-10 11:17:11 -04:00
}