All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Alachisoft.NCache.Parser.Token Maven / Gradle / Ivy

There is a newer version: 5.3.3
Show newest version
package Alachisoft.NCache.Parser;

// C# Translation of GoldParser, by Marcus Klimstra .
// Based on GOLDParser by Devin Cook .

/**
 * While the Symbol represents a class of terminals and nonterminals,
 * the Token represents an individual piece of information.
 */
public class Token extends Symbol {
    private int m_state;
    private Object m_data;

    /* constructors */

    /**
     *
     */
    public Token() {
        m_state = -1;
        m_data = "";
    }

    /**
     *
     */
    public Token(Symbol p_symbol) {
        this();
        SetParent(p_symbol);
    }

    /* properties */

    /**
     * Gets the state
     */
    public final int getState() {
        return m_state;
    }

    public final void setState(int value) {
        m_state = value;
    }

    /**
     * Gets or sets the information stored in the token.
     */
    public final Object getData() {
        return m_data;
    }

    public final void setData(Object value) {
        m_data = value;
    }

    /* public methods */

    /**
     *
     */
    public final void SetParent(Symbol p_symbol) {
        CopyData(p_symbol);
    }

    /**
     * Returns the text representation of the token's parent symbol.
     * In the case of nonterminals, the name is delimited by angle brackets,
     * special terminals are delimited by parenthesis and terminals are delimited
     * by single quotes (if special characters are present).
     */
    @Override
    public String toString() {
        return super.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy