platypus
Class Parser

java.lang.Object
  extended by platypus.Parser

public class Parser
extends java.lang.Object

Handles all the various parsing tasks. All public classes are static.


Constructor Summary
Parser()
           
 
Method Summary
static ParsedUnit getUnitValue(java.lang.String inputStr)
          Parses a substring containing that *starts* with the definition of a quantity.
static PlatyConst.unit parseUnitType(java.lang.String inputStr)
          Gets the unit type.
static PlatyConst.unit unitAbbrevToUnitType(java.lang.String unitStr)
          Convert the abbreviation used for the unit into a unit-type (an enum in PlatyConst)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser()
Method Detail

getUnitValue

public static ParsedUnit getUnitValue(java.lang.String inputStr)
Parses a substring containing that *starts* with the definition of a quantity. So if the command is [paraindent:36pt], this routine would be passed 36pt] and would return a structure containing the value 36 the unit-type (enum) POINT, and the length of characters gobbled; 3. This method correctly handles macros in the string.

Parameters:
inputStr - string containing quantity and unit abbreviation
Returns:
a ParsedUnit instance containing value and type, or error type & error message

parseUnitType

public static PlatyConst.unit parseUnitType(java.lang.String inputStr)
Gets the unit type. First it looks up any macro string, then converts the abbreviation for unit to a unit type

Parameters:
inputStr - the string that starts with the unit type
Returns:
a ParsedUnit containing only type information.

unitAbbrevToUnitType

public static PlatyConst.unit unitAbbrevToUnitType(java.lang.String unitStr)
Convert the abbreviation used for the unit into a unit-type (an enum in PlatyConst)

Parameters:
unitStr - the string that begins with the unit abbreviation
Returns:
the PlatyConst.unit enum that corresponds to the type or to an error


Copyright © 2006-7 Pacific Data Works LLC