tcra.math
Class MathTypeParser

java.lang.Object
  extended by tcra.math.MathTypeParser
Direct Known Subclasses:
MathIntegerParser, MathStringParser

public abstract class MathTypeParser
extends java.lang.Object

MathTypeParser is the base MathType parser that must be extended to parser a specific MathType.


Constructor Summary
MathTypeParser()
           
 
Method Summary
protected  void eatWhitespace(java.lang.StringBuilder input)
          Removes all leading whitespaces.
protected  int nextToken(java.lang.String input)
          Returns the index of the next non-whitespace character.
abstract  MathType parse(java.lang.StringBuilder input)
          Does nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MathTypeParser

public MathTypeParser()
Method Detail

parse

public abstract MathType parse(java.lang.StringBuilder input)
                        throws MathFormatException
Does nothing. Must be overridden by subclasses. All parse functions in subclasses must be destructive to the StringBuilder provided.

Parameters:
input - StringBuilder to be parsed for whatever MathType the parser is built for.
Returns:
MathType the parser is built for.
Throws:
MathFormatException - If the StringBuilder provided does not match the pattern required by the parser.

eatWhitespace

protected void eatWhitespace(java.lang.StringBuilder input)
Removes all leading whitespaces.

Parameters:
input - StringBuilder to be trimmed.

nextToken

protected int nextToken(java.lang.String input)
Returns the index of the next non-whitespace character.

Parameters:
input - String to search