symbol.java

来自「To help you in writing an LL grammar, we」· Java 代码 · 共 50 行

JAVA
50
字号
// LLAnalyze -- Nathaniel Nystrom, February 2000// For use in Cornell University Computer Science 412/413// Abstract class for symbol expressions in the grammar// (terminals and nonterminals).package Iota.util.grammar;import java.util.*;public class Symbol extends Expr{    String sym;    int index;    public Symbol(String sym, int index)    {	this.sym = sym;	this.index = index;    }    public int getIndex()    {	return index;    }    public String getString()    {	return sym;    }    public String toString()    {	return sym;    }    public boolean equals(Object o)    {	return o instanceof Symbol &&	       sym != null &&	       sym.equals(((Symbol) o).sym) &&	       index == ((Symbol) o).index;    }    public int hashCode()    {        return sym.hashCode() + index;    }}

⌨️ 快捷键说明

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