edu.cornell.cs.sam.io
Enum Tokenizer.TokenType

java.lang.Object
  extended by java.lang.Enum<Tokenizer.TokenType>
      extended by edu.cornell.cs.sam.io.Tokenizer.TokenType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Tokenizer.TokenType>
Enclosing interface:
Tokenizer

public static enum Tokenizer.TokenType
extends java.lang.Enum<Tokenizer.TokenType>

Represents the type of a tokenizer token


Enum Constant Summary
CHARACTER
          CHARACTER: A single character between two apostrophes.
COMMENT
          COMMENT: The text following // on a single line
EOF
          EOF: The end of file
FLOAT
          FLOAT: a sequence of digits starting with either a period, or a digit and containing only digits and one period after the first digit.
INTEGER
          INT: a sequence of digits with only digits after the first digit.
OPERATOR
          OPERATOR: Any non-alphanumeric character
STRING
          STRING: If string processing is turned on, a word is anything between two quotation signs.
WORD
          WORD: a letter followed by a sequence of alphanumeric characters or underscores (_) without any whitespace.
 
Method Summary
static Tokenizer.TokenType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Tokenizer.TokenType[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

INTEGER

public static final Tokenizer.TokenType INTEGER
INT: a sequence of digits with only digits after the first digit. An integer will always be >= 0.


FLOAT

public static final Tokenizer.TokenType FLOAT
FLOAT: a sequence of digits starting with either a period, or a digit and containing only digits and one period after the first digit. A float will always be >= 0.


WORD

public static final Tokenizer.TokenType WORD
WORD: a letter followed by a sequence of alphanumeric characters or underscores (_) without any whitespace. If a string such as 2.0.0 is detected, this should also be considered a word.


STRING

public static final Tokenizer.TokenType STRING
STRING: If string processing is turned on, a word is anything between two quotation signs. Valid escapes (\n, \r, \\, \", etc..) should also be evaluated in this case.


CHARACTER

public static final Tokenizer.TokenType CHARACTER
CHARACTER: A single character between two apostrophes. Valid escapes are allowed.


OPERATOR

public static final Tokenizer.TokenType OPERATOR
OPERATOR: Any non-alphanumeric character


COMMENT

public static final Tokenizer.TokenType COMMENT
COMMENT: The text following // on a single line


EOF

public static final Tokenizer.TokenType EOF
EOF: The end of file

Method Detail

values

public static final Tokenizer.TokenType[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(Tokenizer.TokenType c : Tokenizer.TokenType.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static Tokenizer.TokenType 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