Package antlr

Class SimpleTokenManager

    • Field Detail

      • maxToken

        protected int maxToken
      • vocabulary

        protected Vector vocabulary
      • antlrTool

        protected Tool antlrTool
      • name

        protected java.lang.String name
      • readOnly

        protected boolean readOnly
    • Constructor Detail

      • SimpleTokenManager

        SimpleTokenManager​(java.lang.String name_,
                           Tool tool_)
    • Method Detail

      • clone

        public java.lang.Object clone()
        Specified by:
        clone in interface TokenManager
        Overrides:
        clone in class java.lang.Object
      • getName

        public java.lang.String getName()
        Simple token manager doesn't have a name -- must be set externally
        Specified by:
        getName in interface TokenManager
      • getTokenStringAt

        public java.lang.String getTokenStringAt​(int idx)
        Get a token symbol by index
        Specified by:
        getTokenStringAt in interface TokenManager
      • getTokenSymbolElements

        public java.util.Enumeration getTokenSymbolElements()
        Get an enumerator over the symbol table
        Specified by:
        getTokenSymbolElements in interface TokenManager
      • getVocabulary

        public Vector getVocabulary()
        Get the token vocabulary (read-only).
        Specified by:
        getVocabulary in interface TokenManager
        Returns:
        A Vector of TokenSymbol
      • isReadOnly

        public boolean isReadOnly()
        Simple token manager is not read-only
        Specified by:
        isReadOnly in interface TokenManager
      • mapToTokenSymbol

        public void mapToTokenSymbol​(java.lang.String name,
                                     TokenSymbol sym)
        Map a label or string to an existing token symbol
        Specified by:
        mapToTokenSymbol in interface TokenManager
      • maxTokenType

        public int maxTokenType()
        Get the highest token type in use
        Specified by:
        maxTokenType in interface TokenManager
      • nextTokenType

        public int nextTokenType()
        Get the next unused token type
        Specified by:
        nextTokenType in interface TokenManager
      • setName

        public void setName​(java.lang.String name_)
        Set the name of the token manager
        Specified by:
        setName in interface TokenManager
      • tokenDefined

        public boolean tokenDefined​(java.lang.String symbol)
        Is a token symbol defined?
        Specified by:
        tokenDefined in interface TokenManager