pobs.utility
Class POBS

java.lang.Object
  extended bypobs.utility.POBS

public class POBS
extends java.lang.Object

Contains a number of convenient factories for commonly used parsers.

Author:
Martijn W. van der Lee, Franz-Josef Elmer

Field Summary
static PParser ANY
          Matches any single character.
static PParser SIGNED_FLOAT
          Matches a signed floating decimal of any length.
static PParser SIGNED_INT
          Matches a signed decimal integer of any length.
static PParser UNSIGNED_FLOAT
          Matches an unsigned floating decimal of any length.
static PParser UNSIGNED_INT
          Matches an unsigned decimal integer of any length.
 
Method Summary
static PParser alpha()
          Matches all ASCII alphabetical characters, both lower- and uppercase.
static PParser alphaAlphaNums()
          Creates a parser who parses a sequence starting with a letter followed by zero or more alpha-numerical characters.
static PParser alphaNum()
          Matches all ASCII alphabetical characters and digits, both lower- and uppercase.
static PParser alphaNums()
          Creates a parser who parses one or more alpha-numerical characters with skipping disabled.
static PParser binaryDigit()
          Matches all valid ASCII characters for the binary system, both lower- and uppercase.
static PParser digit()
          Matches a single ASCII digits 0 to 9.
static PParser digits()
          Matches a series ASCII digits 0 to 9.
static PParser floatNumber()
          Creates a new instance of a parser for floating point numbers with optional exponent.
static PParser hexDigit()
          Matches all valid ASCII characters for the hexadecimal system, both lower- and uppercase.
static PParser lowerCase()
          Matches all ASCII lowercase alphabetical characthers.
static PParser octalDigit()
          Matches all valid ASCII characters for the octal system, both lower- and uppercase.
static PParser sign()
          Matches all the ASCII characters for the positive and negative signs.
static PParser signedInt()
          Creates a new instance of a parser for optionally signed integer numbers.
static PParser unsignedInt()
          Creates a new instance of a parser for an unsigned integer.
static PParser upperCase()
          Matches all ASCII uppercase alphabetical characters.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY

public static final PParser ANY
Matches any single character.


UNSIGNED_INT

public static final PParser UNSIGNED_INT
Matches an unsigned decimal integer of any length.


SIGNED_INT

public static final PParser SIGNED_INT
Matches a signed decimal integer of any length.


UNSIGNED_FLOAT

public static final PParser UNSIGNED_FLOAT
Matches an unsigned floating decimal of any length.


SIGNED_FLOAT

public static final PParser SIGNED_FLOAT
Matches a signed floating decimal of any length.

Method Detail

alphaNum

public static PParser alphaNum()
Matches all ASCII alphabetical characters and digits, both lower- and uppercase.


alphaNums

public static PParser alphaNums()
Creates a parser who parses one or more alpha-numerical characters with skipping disabled. Short-cut of
new PMultiple(POBS.alphaNum()).addControl(new PDisableSkip()


alpha

public static PParser alpha()
Matches all ASCII alphabetical characters, both lower- and uppercase.


alphaAlphaNums

public static PParser alphaAlphaNums()
Creates a parser who parses a sequence starting with a letter followed by zero or more alpha-numerical characters. Skipping disabled. Short-cut of
new PSequence(POBS.alpha(), new PKleene(POBS.alphaNum())).addControl(new PDisableSkip())

Returns:
PParser

lowerCase

public static PParser lowerCase()
Matches all ASCII lowercase alphabetical characthers.


upperCase

public static PParser upperCase()
Matches all ASCII uppercase alphabetical characters.


digit

public static PParser digit()
Matches a single ASCII digits 0 to 9.


digits

public static PParser digits()
Matches a series ASCII digits 0 to 9.


binaryDigit

public static PParser binaryDigit()
Matches all valid ASCII characters for the binary system, both lower- and uppercase.


octalDigit

public static PParser octalDigit()
Matches all valid ASCII characters for the octal system, both lower- and uppercase.


hexDigit

public static PParser hexDigit()
Matches all valid ASCII characters for the hexadecimal system, both lower- and uppercase.


sign

public static PParser sign()
Matches all the ASCII characters for the positive and negative signs.


unsignedInt

public static PParser unsignedInt()
Creates a new instance of a parser for an unsigned integer.


signedInt

public static PParser signedInt()
Creates a new instance of a parser for optionally signed integer numbers. Any successfully parsed string can be converted into a BigInteger without throwing a NumberFormatException.


floatNumber

public static PParser floatNumber()
Creates a new instance of a parser for floating point numbers with optional exponent. Any string successfully parsed by this parser can be converted into a double without throwing a NumberFormatException.