|
Send bugs or comments to Bernd Kühl (bernd@informatik.uni-osnabrueck.de) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--lolo.Scanner
A Scanner collects Scan objects to maintain a lexical scanner. The characters are read from an Input object.
A Scanner can be serialized to be reused.
Mux,
Scan,
Input,
scan(Input), Serialized Form| Inner Class Summary | |
static class |
Scanner.IllegalCharacterException
An IllegalCharacterException is thrown, when no Scan instance matches the current character. |
| Field Summary | |
boolean |
debug
debug mode? |
protected int |
max
Indexes in scans. |
protected int |
next
Indexes in scans. |
protected boolean |
packed
Marks if this Scanner is packed. |
protected Scan[] |
scans
Array of all Scan objects. |
Scan[] |
table
Array holding for every character-index a Scan or Mux object. |
protected boolean |
unicode
Unicode (or ASCII) mode? |
| Constructor Summary | |
Scanner()
Constructs an empty Scanner. |
|
Scanner(Scan scan)
Constructs a Scanner managing one Scan instance. |
|
Scanner(Scan[] scans)
Constructs a Scanner managing many Scan instances. |
|
| Method Summary | |
boolean |
add(Scan scan)
Adds a Scan instance to this Scanner. |
boolean |
add(Scan[] scans)
Adds all elements of a Scan array to this Scanner. |
boolean |
contains(Scan scan)
Returns if this Scanner contains the Scan instance. |
protected void |
enter(int index,
Scan scan)
Enters scan at index index into the table. |
boolean |
getUnicode()
Returns if the current mode is Unicode. |
void |
pack()
Packs the table with Scan or Mux objects. |
boolean |
packed()
Returns if this Scanner is packed. |
boolean |
remove(Scan scan)
Removes a Scan instance to this Scanner. |
Scan |
scan(Input input)
Finds and returns the next winning Scan object or null at EOF. |
void |
setUnicode(boolean unicode)
Set Unicode (or ASCII) mode mode. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
protected Scan[] scans
Scanprotected int next
protected int max
protected boolean packed
pack()public transient Scan[] table
Mux,
Scanpublic boolean debug
protected boolean unicode
| Constructor Detail |
public Scanner()
public Scanner(Scan scan)
Scanpublic Scanner(Scan[] scans)
Scan| Method Detail |
public boolean add(Scan scan)
throws java.lang.IllegalArgumentException
scan - the added recognizer.java.lang.IllegalArgumentException - if the argument is null.Scan
public boolean add(Scan[] scans)
throws java.lang.IllegalArgumentException
scans - the added recognizers.java.lang.IllegalArgumentException - if the argument or the elements of the argument are null.Scanpublic boolean remove(Scan scan)
Scanpublic boolean contains(Scan scan)
Scanpublic boolean packed()
public void pack()
Mux,
Scan
protected void enter(int index,
Scan scan)
index - index into the table for scan.scan - the new Scan object for table index index.Mux,
Scan
public Scan scan(Input input)
throws Scanner.IllegalCharacterException,
java.io.IOException
the - character input source.Scanner.IllegalCharacterException - if no symbol was found.java.io.IOException - if an I/O error occured.public void setUnicode(boolean unicode)
the - new mode.public boolean getUnicode()
|
Send bugs or comments to Bernd Kühl (bernd@informatik.uni-osnabrueck.de) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||