Class Token


  • public class Token
    extends java.lang.Object
    This class implements the JavaScript scanner. It is based on the C source files jsscan.c and jsscan.h in the jsref package.
    See Also:
    Parser
    • Constructor Detail

      • Token

        public Token()
    • Method Detail

      • name

        public static java.lang.String name​(int token)
        Returns a name for the token. If Rhino is compiled with certain hardcoded debugging flags in this file, it calls #typeToName; otherwise it returns a string whose value is the token number.
      • typeToName

        public static java.lang.String typeToName​(int token)
        Always returns a human-readable string for the token name. For instance, FINALLY has the name "FINALLY".
        Parameters:
        token - the token code
        Returns:
        the actual name for the token code
      • keywordToName

        public static java.lang.String keywordToName​(int token)
        Convert a keyword token to a name string for use with the Context.FEATURE_RESERVED_KEYWORD_AS_IDENTIFIER feature.
        Parameters:
        token - A token
        Returns:
        the corresponding name string
      • isValidToken

        public static boolean isValidToken​(int code)
        Return true if the passed code is a valid Token constant.
        Parameters:
        code - a potential token code
        Returns:
        true if it's a known token