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

📄 simpletoken.java

📁 是有关解释器的.用JAVA编写.可以解释一般的JAVA程序.
💻 JAVA
字号:
/**
 * Contains a simple char from the following set. : '.', ',', ';', '=', '~' (the
 * last representing the end of the file).
 */
public class SimpleToken extends Token {
    private char symbol;

    SimpleToken(int l, int p, char c) {
        super(l, p);
        symbol = c;
    }

    /**
     * @see #isMessageSend()
     * @see #isSequence()
     * @see #isStatementEnd()
     * @see #isAssign()
     * @see #isEOF()
     */
    char content() {
        return symbol;
    }

    boolean isSimple() {
        return true;
    }

    /**
     * Is it a dot ('.'), which represents a method call/message sent?
     * 
     * @see #content()
     */
    boolean isMessageSend() {
        return symbol == '.';
    }

    /**
     * Is it a comma (','), representing the divider in sequences?
     * 
     * @see #content()
     */
    boolean isSequence() {
        return symbol == ',';
    }

    /**
     * Is it a semicolon (';'), representing the end of a statement?
     * 
     * @see #content()
     */
    boolean isStatementEnd() {
        return symbol == ';';
    }

    /**
     * Is it a equal sign ('='), representing an assignment?
     * 
     * @see #content()
     */
    boolean isAssign() {
        return symbol == '=';
    }

    /**
     * Is it a tilde ('~'), representing the end of the input file?
     * 
     * @see #content()
     */
    boolean isEOF() {
        return symbol == '~';
    }

    public String toString() {
        return "SimpleToken<" + symbol + ">";
    }
}

⌨️ 快捷键说明

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