Methods Summary |
---|
public final int | LA(int i)Get a lookahead token value
fill(i);
return queue.elementAt(markerOffset + i - 1).type;
|
public final persistence.antlr.Token | LT(int i)Get a lookahead token
fill(i);
return queue.elementAt(markerOffset + i - 1);
|
public final void | consume()Mark another token for deferred consumption
numToConsume++;
|
private final void | fill(int amount)Ensure that the token buffer is sufficiently full
syncConsume();
// Fill the buffer sufficiently to hold needed tokens
while (queue.nbrEntries < amount + markerOffset) {
// Append the next token
queue.append(input.nextToken());
}
|
public persistence.antlr.TokenStream | getInput()return the Tokenizer (needed by ParseView)
return input;
|
public final int | mark()Return an integer marker that can be used to rewind the buffer to
its current state.
syncConsume();
//System.out.println("Marking at " + markerOffset);
//try { for (int i = 1; i <= 2; i++) { System.out.println("LA("+i+")=="+LT(i).getText()); } } catch (ScannerException e) {}
nMarkers++;
return markerOffset;
|
public final void | reset()Reset the input buffer to empty state
nMarkers = 0;
markerOffset = 0;
numToConsume = 0;
queue.reset();
|
public final void | rewind(int mark)Rewind the token buffer to a marker.
syncConsume();
markerOffset = mark;
nMarkers--;
//System.out.println("Rewinding to " + mark);
//try { for (int i = 1; i <= 2; i++) { System.out.println("LA("+i+")=="+LT(i).getText()); } } catch (ScannerException e) {}
|
private final void | syncConsume()Sync up deferred consumption
while (numToConsume > 0) {
if (nMarkers > 0) {
// guess mode -- leave leading tokens and bump offset.
markerOffset++;
}
else {
// normal mode -- remove first token
queue.removeFirst();
}
numToConsume--;
}
|