summaryrefslogtreecommitdiff
path: root/submit/SymbolInfo.java
blob: c640718f2597f91b1e44ba0dffdd86684791ac05 (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
/*
 * 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;
  private int offset;

  public SymbolInfo(String id, VarType type, boolean function) {
    this.id = id;
    this.type = type;
    this.function = function;
  }

  public SymbolInfo(String id, VarType type, boolean function, int offset) {
    this(id, type, function);
    this.offset = offset;
  }

  @Override
  public String toString() {
    return "<" + id + ", " + type + '>';
  }

  public VarType getType() { return type; }

  public boolean isFunction() { return function; }

  public int getOffset() { return offset; }
  public void setOffset(int offset) { this.offset = offset; }
}