public class Tokenizer extends Object
FiniteStateAutomaton| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args)
main method that can be used for interactive testing of the
tokenizer.
|
static FiniteStateAutomaton |
makeFSA()
Creates a specific instance of FiniteStateAutomaton with the
states and transitions needed to parse the language implemented
by this arithmetic expression evaluator.
|
ArrayList<Token> |
tokenize()
Convert the input for this tokenizer into a sequence of tokens
|
static Token[] |
tokenizeToArray(String input)
Convenience method for use in testing that takes input as a string,
and returns a plain old java array of Token objects
|
public Tokenizer(String input)
public static FiniteStateAutomaton makeFSA()
FiniteStateAutomaton that can be used to tokenize a stringpublic ArrayList<Token> tokenize()
public static Token[] tokenizeToArray(String input)
input - stringpublic static void main(String[] args)
"2+2" unless
a command line argument is passed, in which case it parses that.args - Command line arguments, where arg[0] is the string to parse, if present