token.java

来自「用编译原理方法计算表达式的值,例如(2+3)*84+3这样的复杂表达式 深入体」· Java 代码 · 共 33 行

JAVA
33
字号
/**
 * 
 * Course - CS601 OO Programming
 * Instructor - Terence Parr
 * Assignment - 4
 *
 * Ideas represented in this class have been recycled from Terence Parr's
 * http://www.antlr.org/book/byhand.pdf. Thanks Terence
 */

public class Token {
	public static int MULTIPLICATION = -10;
	public static int ADDITION = -9;
	public static int INTEGER = -8;
	public static int UNDEFINED = -7;
	public static int WHITESPACE = -6;
	public static int EOT = -5;
	public static int R_PARENTHESIS=-4;
	public static int L_PARENTHESIS=-3;
	public static int LESS=-2;
	
	private final int 	_type;
	private final String _text;
	
	public Token(int type, String text) {
		_type = type;
		_text = text;
	}
	
	public String getText() { return _text; }
	public int getType() { return _type; }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?