xtc.parser
Class CharClass.Parser

java.lang.Object
  extended by xtc.parser.CharClass.Parser
Enclosing class:
CharClass

public static class CharClass.Parser
extends java.lang.Object

Parser for a character class specification.


Field Summary
protected  int idx
          The index into the string.
protected  java.lang.String s
          The string.
 
Constructor Summary
CharClass.Parser(java.lang.String s)
          Create a new character class parser for the specified string.
 
Method Summary
 boolean hasNext()
          Determine whether there are more characters.
 boolean hasRange()
          Determine whether the next character is a range delimiter '-'.
 char next()
          Return the next character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s

protected java.lang.String s
The string.


idx

protected int idx
The index into the string.

Constructor Detail

CharClass.Parser

public CharClass.Parser(java.lang.String s)
Create a new character class parser for the specified string. Note that the string must not include the leading '[' and trailing ']' characters.

Parameters:
s - The string to parse.
Method Detail

hasNext

public boolean hasNext()
Determine whether there are more characters.

Returns:
true if there are more characters.

hasRange

public boolean hasRange()
Determine whether the next character is a range delimiter '-'. Note that this test is destructive: if the next character is a range delimiter, it is consumed.

Returns:
true if the next character is a range delimiter.

next

public char next()
Return the next character. If the character is represented by an escape sequence (including Java Unicode and regex-like escapes), it is unescaped.

Returns:
The next character.


Copyright © 2012. All Rights Reserved.