expression.java

来自「用java写的语句级语法分析器。用于一些软件对输入的语句进行语法分析」· Java 代码 · 共 99 行

JAVA
99
字号
package Expression;

public class Expression {
	private	Expression LeftExp;//左边表达式
	private Expression RightExp;//右过表达式
	private Expression Parent;//上一级表达式
	private int PRI;//运算符关键字优先级,如果是值,此为-1
	private String Parameter;//变量常量与值。
	private int type;//运算符关键字类型,变量常量此值为-1;而且只有在叶子点上才会为-1,运算符关键字为0,,2表示根结点只有一个
	private int Position;
	
	public Expression(){
		this.LeftExp = null;
		this.RightExp = null;
		this.Parent = null;
		this.PRI =-1;
		this.Parameter = null;
		this.type = -1;
		this.Position = -1;
	}
	
	public Expression(int type){
		this.LeftExp = null;
		this.RightExp = null;
		this.Parent = null;
		this.PRI =-1;
		this.Parameter = null;
		this.type = type;
		this.Position = -1;
	}	
	
	public Expression(int type,int PRI,int position, String parameter){
		this.LeftExp = null;
		this.RightExp = null;
		this.Parent = null;
		this.PRI = PRI;
		this.type = type;
		this.Position = position;
		this.Parameter = parameter;
	}

	public Expression getLeftExp() {
		return LeftExp;
	}

	public void setLeftExp(Expression leftExp) {
		LeftExp = leftExp;
	}

	public String getParameter() {
		return Parameter;
	}

	public void setParameter(String parameter) {
		Parameter = parameter;
	}

	public Expression getParent() {
		return Parent;
	}

	public void setParent(Expression parent) {
		Parent = parent;
	}

	public int getPRI() {
		return PRI;
	}

	public void setPRI(int pri) {
		PRI = pri;
	}

	public Expression getRightExp() {
		return RightExp;
	}

	public void setRightExp(Expression rightExp) {
		RightExp = rightExp;
	}

	public int getPosition() {
		return Position;
	}

	public void setPosition(int position) {
		Position = position;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}
		
}

⌨️ 快捷键说明

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