Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
JFlex.CharClasses
public class CharClasses
extends java.lang.Object
Field Summary | |
static char |
|
Constructor Summary | |
|
Method Summary | |
void |
|
void |
|
int |
|
int[] |
|
CharClassInterval[] |
|
char |
|
int[] |
|
int |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
String |
|
String |
|
public static final char maxChar
the largest character that can be used in char classes
- Field Value:
- '\uffff'
public CharClasses(int maxCharCode)
Constructs a new CharClass object that provides space for classes of characters from 0 to maxCharCode. Initially all characters are in class 0.
- Parameters:
maxCharCode
- the last character code to be considered. (127 for 7bit Lexers, 255 for 8bit Lexers and 0xFFFF for Unicode Lexers).
public void check()
Check consistency of the stored classes [debug]. all classes must be disjoint, checks if all characters have a class assigned.
public void dump()
Dump charclasses to the dump output stream
public int getClassCode(char letter)
Returns the code of the character class the specified character belongs to.
public int[] getClassCodes(Vector intervallVec)
Returns an array that contains the character class codes of all characters in the specified set of input characters.
- Parameters:
intervallVec
- a Vector of Intervals, the set of characters to get the class codes for
- Returns:
- an array with the class codes for intervallVec
public CharClassInterval[] getIntervals()
Returns an array of all CharClassIntervalls in this char class collection. The array is ordered by char code, i.e.result[i+1].start = result[i].end+1
Each CharClassInterval contains the number of the char class it belongs to.
public char getMaxCharCode()
Returns the greatest Unicode value of the current input character set.
public int[] getNotClassCodes(Vector intervallVec)
Returns an array that contains the character class codes of all characters that are not in the specified set of input characters.
- Parameters:
intervallVec
- a Vector of Intervals, the complement of the set of characters to get the class codes for
- Returns:
- an array with the class codes for the complement of intervallVec
public int getNumClasses()
Returns the current number of character classes.
public void makeClass(IntCharSet set, boolean caseless)
Updates the current partition, so that the specified set of characters gets a new character class. Characters that are elements ofset
are not in the same equivalence class with characters that are not elements ofset
.
- Parameters:
set
- the set of characters to distinguish from the restcaseless
- if true upper/lower/title case are considered equivalent
public void makeClass(String str, boolean caseless)
Creates a new character class for each character of the specified String.
- Parameters:
caseless
- if true upper/lower/title case are considered equivalent
public void makeClass(Vector v, boolean caseless)
Updates the current partition, so that the specified set of characters gets a new character class. Characters that are elements of the setv
are not in the same equivalence class with characters that are not elements of the setv
.
- Parameters:
v
- a Vector of Interval objects. This Vector represents a set of characters. The set of characters is the union of all intervals in the Vector.caseless
- if true upper/lower/title case are considered equivalent
public void makeClass(char singleChar, boolean caseless)
Creates a new character class for the single charactersingleChar
.
- Parameters:
caseless
- if true upper/lower/title case are considered equivalent
public void makeClassNot(Vector v, boolean caseless)
Updates the current partition, so that the set of all characters not contained in the specified set of characters gets a new character class. Characters that are elements of the setv
are not in the same equivalence class with characters that are not elements of the setv
. This method is equivalent tomakeClass(v)
- Parameters:
v
- a Vector of Interval objects. This Vector represents a set of characters. The set of characters is the union of all intervals in the Vector.caseless
- if true upper/lower/title case are considered equivalent
public void setMaxCharCode(int charCode)
Sets the largest Unicode value of the current input character set.
- Parameters:
charCode
- the largest character code, used for the scanner (i.e. %7bit, %8bit, %16bit etc.)
public String toString()
Return a string representation of the char classes stored in this class. Enumerates the classes by index.
public String toString(int theClass)
Return a string representation of one char class
- Parameters:
theClass
- the index of the class to