pobs.parser
Class PRange

java.lang.Object
  extended bypobs.PParser
      extended bypobs.parser.PSet
          extended bypobs.parser.PRange
All Implemented Interfaces:
PObject

public class PRange
extends PSet

Terminal parser which creates a set of characters to match from an encoded input "rangestring". Matches any single character specified in the rangestring. Uses case sensitive directive. This is a terminal parser for which no BNF equivalent exists. The rangestring is encoded as a simple sequences of characters and markers. A marker is a specific, predefined character placed between individual characters in the rangestring to specify that each character in between those two characters must also be matched by this parser. e.g.: "a-d" will match 'a', 'b', 'c' and 'd' Placing the marker character at the beginning or end of the rangestring will include the marker itself in the set. e.g.: "a-c-" will match 'a', 'b', 'c' and '-' Individual characters can be included by simply omitting the range marker. e.g.: "ae-h" will match 'a', 'e', 'f', 'g', 'h' and 'z' The default marker is the hyphen ('-') but you can specify an alternative marker in the constructor, this may be useful if you want the hyphen to be included in the set but do not want to specify it as either the first or last character in the rangestring. Characters in the range need not be in any specific order, the current implementation can handle both incremental and decremental order or ranges. Please note that this may change prior to a v1.0 release of POBS due to performance reasons.

Author:
Martijn W. van der Lee

Constructor Summary
PRange(java.lang.String range)
          Stub constructor which assumes the hyphen (-) character as the marker.
PRange(java.lang.String range, char marker)
          Constructor.
 
Method Summary
static java.lang.String decode(java.lang.String range, char marker)
          Decodes a rangestring containing both individual characters as ranges into a string which contains all individual characters implied in the rangestring.
 
Methods inherited from class pobs.parser.PSet
parse
 
Methods inherited from class pobs.PParser
addControl, getErrorInfo, process, setErrorInfo, setMatchAction, setMismatchAction
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PRange

public PRange(java.lang.String range,
              char marker)
Constructor.

Parameters:
range - string containing individual characters and ranges
marker - character used to mark ranges

PRange

public PRange(java.lang.String range)
Stub constructor which assumes the hyphen (-) character as the marker.

Parameters:
range - string containing individual characters and ranges
Method Detail

decode

public static java.lang.String decode(java.lang.String range,
                                      char marker)
Decodes a rangestring containing both individual characters as ranges into a string which contains all individual characters implied in the rangestring.

Parameters:
range - string containing individual characters and ranges
marker - character used to mark ranges
Returns:
set of all characters decoded from the rangestring