⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 token.java

📁 用编译原理方法计算表达式的值,例如(2+3)*84+3这样的复杂表达式 深入体现了面向对象的方法,代码可以很容易进行overwrite
💻 JAVA
字号:
/**
 * 
 * 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -