[09 - LL(I) AST] Re-init project as project with modules

This commit is contained in:
2020-05-25 11:55:53 +02:00
parent ffd623e674
commit 0598ac09a7
22 changed files with 3755 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
/* **********************************************
* Duale Hochschule Baden-Württemberg Karlsruhe
* Prof. Dr. Jörn Eisenbiegler
*
* Vorlesung Übersetzerbau
* Praxis LL(1)-Parser für X
* - Token-Puffer
*
* **********************************************
*/
package de.dhbw.compiler.xparser;
import java.io.IOException;
public class TokenBuffer {
private JFlexXScanner scanner;
private int count = 0;
private Token token = null;
public TokenBuffer(JFlexXScanner scanner) throws IOException {
this.scanner = scanner;
token = scanner.nextToken();
count++;
}
public Token nextToken() throws IOException {
Token help = token;
if (help.getType()!=Token.EOF) {
token = scanner.nextToken();
count++;
}
return help;
}
public Token lookaheadToken() {
return token;
}
public int getTokenCount() {
return count;
}
}