Skip to content
Snippets Groups Projects
Commit cd07a89b authored by dgelessus's avatar dgelessus
Browse files

Remove deprecated Lexer.nextList and related code

parent b4ed3438
Branches
Tags
No related merge requests found
Pipeline #118792 passed
...@@ -7,10 +7,6 @@ import java.io.DataInputStream; ...@@ -7,10 +7,6 @@ import java.io.DataInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PushbackReader; import java.io.PushbackReader;
import java.util.LinkedList;
import java.util.Queue;
import de.hhu.stups.sablecc.patch.IToken;
import org.sablecc.sablecc.node.*; import org.sablecc.sablecc.node.*;
...@@ -27,61 +23,34 @@ public class Lexer ...@@ -27,61 +23,34 @@ public class Lexer
private boolean eof; private boolean eof;
private final StringBuilder text = new StringBuilder(); private final StringBuilder text = new StringBuilder();
@Deprecated
private final Queue<IToken> nextList = new LinkedList<IToken>();
/**
* @deprecated Use {@link #token} to get, modify, replace, and/or delete the current token.
* Injecting new tokens into the token stream will not be supported in the future.
*/
@Deprecated
public Queue<IToken> getNextList() {
return nextList;
}
protected void filter() throws LexerException, IOException protected void filter() throws LexerException, IOException
{} {}
/**
* @deprecated Override {@link #filter()} instead.
*/
@Deprecated
protected void filterWrap() throws LexerException, IOException
{
filter();
if (token != null) {
nextList.add(token);
}
}
public Lexer(PushbackReader in) public Lexer(PushbackReader in)
{ {
this.in = in; this.in = in;
} }
@SuppressWarnings("deprecation") // because of filterWrap and nextList
public Token peek() throws LexerException, IOException public Token peek() throws LexerException, IOException
{ {
while(this.token == null) while(this.token == null)
{ {
token = getToken(); token = getToken();
filterWrap(); filter();
} }
return (Token) nextList.peek(); return token;
} }
@SuppressWarnings("deprecation") // because of filterWrap and nextList
public Token next() throws LexerException, IOException public Token next() throws LexerException, IOException
{ {
while(this.token == null) while(this.token == null)
{ {
token = getToken(); token = getToken();
filterWrap(); filter();
} }
Token result = (Token) nextList.poll(); Token result = token;
token = null; token = null;
return result; return result;
} }
......
...@@ -31,10 +31,6 @@ import java.io.DataInputStream; ...@@ -31,10 +31,6 @@ import java.io.DataInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PushbackReader; import java.io.PushbackReader;
import java.util.LinkedList;
import java.util.Queue;
import de.hhu.stups.sablecc.patch.IToken;
import $0$node.*; import $0$node.*;
...@@ -51,61 +47,34 @@ public class Lexer ...@@ -51,61 +47,34 @@ public class Lexer
private boolean eof; private boolean eof;
private final StringBuilder text = new StringBuilder(); private final StringBuilder text = new StringBuilder();
@Deprecated
private final Queue<IToken> nextList = new LinkedList<IToken>();
/**
* @deprecated Use {@link #token} to get, modify, replace, and/or delete the current token.
* Injecting new tokens into the token stream will not be supported in the future.
*/
@Deprecated
public Queue<IToken> getNextList() {
return nextList;
}
protected void filter() throws LexerException, IOException protected void filter() throws LexerException, IOException
{} {}
/**
* @deprecated Override {@link #filter()} instead.
*/
@Deprecated
protected void filterWrap() throws LexerException, IOException
{
filter();
if (token != null) {
nextList.add(token);
}
}
public Lexer(PushbackReader in) public Lexer(PushbackReader in)
{ {
this.in = in; this.in = in;
} }
@SuppressWarnings("deprecation") // because of filterWrap and nextList
public Token peek() throws LexerException, IOException public Token peek() throws LexerException, IOException
{ {
while(this.token == null) while(this.token == null)
{ {
token = getToken(); token = getToken();
filterWrap(); filter();
} }
return (Token) nextList.peek(); return token;
} }
@SuppressWarnings("deprecation") // because of filterWrap and nextList
public Token next() throws LexerException, IOException public Token next() throws LexerException, IOException
{ {
while(this.token == null) while(this.token == null)
{ {
token = getToken(); token = getToken();
filterWrap(); filter();
} }
Token result = (Token) nextList.poll(); Token result = token;
token = null; token = null;
return result; return result;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment