java_cup.runtime.ScannerBuffer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-cup-11b Show documentation
Show all versions of java-cup-11b Show documentation
LALR parser generator for Java.
The newest version!
package java_cup.runtime;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
public class ScannerBuffer implements Scanner {
private Scanner inner;
private List buffer = new LinkedList();
/**
* Wraps around a custom scanner and stores all so far produced tokens in a buffer
* @param inner the scanner to buffer
*/
public ScannerBuffer(Scanner inner){
this.inner=inner;
}
/**
* Read-Only access to the buffered Symbols
* @return an unmodifiable Version of the buffer
*/
public List getBuffered() {
return Collections.unmodifiableList(buffer);
}
@Override
public Symbol next_token() throws Exception {
Symbol buffered = inner.next_token();
buffer.add(buffered);
return buffered;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy