Enum Lexer.Token.Type

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.util.regex.Pattern pattern
      A pattern matching this type.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Type​(java.lang.String regexp)
      Constructs a token type with a regular expression for the pattern.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isMatchedBy​(Lexer.Token token)
      Checks if the specified element matches this type.
      java.lang.String toString()
      Returns the string representation of this type.
      static Lexer.Token.Type valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static Lexer.Token.Type[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • pattern

        final java.util.regex.Pattern pattern
        A pattern matching this type.
    • Constructor Detail

      • Type

        private Type​(java.lang.String regexp)
        Constructs a token type with a regular expression for the pattern.
        Parameters:
        regexp - the regular expression for the pattern
        See Also:
        pattern
    • Method Detail

      • values

        public static Lexer.Token.Type[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Lexer.Token.Type c : Lexer.Token.Type.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Lexer.Token.Type valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • toString

        public java.lang.String toString()
        Returns the string representation of this type.
        Overrides:
        toString in class java.lang.Enum<Lexer.Token.Type>
        Returns:
        the string representation of this type
      • isMatchedBy

        public boolean isMatchedBy​(Lexer.Token token)
        Checks if the specified element matches this type.
        Specified by:
        isMatchedBy in interface Stream.ElementType<Lexer.Token>
        Parameters:
        token - the element to be tested
        Returns:
        true if the element matches this type or false otherwise