Skip to content
Permalink
Browse files

每个具体单词应有的属性

  • Loading branch information
VincentBel committed Jan 10, 2015
1 parent 61970b5 commit df3ecc86b4f2ed6311369febf32e77eb41869da7
Showing with 46 additions and 0 deletions.
  1. +46 −0 src/com/vincentbel/compiler/Symbol.java
@@ -74,4 +74,50 @@
public static final int UNTIL_SYMBOL = 32;
public static final int READ_SYMBOL = 33;
public static final int WRITE_SYMBOL = 34;



private int symbolType; // 符号的类型,即前面35种中的一种

private int number = 0; // 如果符号是无符号整数,则记录其值

private String name = ""; // 如果符号是保留字,则记录其名字

public Symbol(int symbolType) {
this.symbolType = symbolType;
}


/*------------------------------
* Getter
* -----------------------------
*/

public String getName() {
return name;
}

public int getSymbolType() {
return symbolType;
}

public int getNumber() {
return number;
}



/*------------------------------
* Setter
* -----------------------------
*/

public void setNumber(int number) {
this.number = number;
}

public void setName(String name) {
this.name = name;
}

}

0 comments on commit df3ecc8

Please sign in to comment.
You can’t perform that action at this time.