Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SableCC STUPS
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
SableCC STUPS
Commits
1796fb94
Commit
1796fb94
authored
Jul 20, 2023
by
dgelessus
Browse files
Options
Downloads
Patches
Plain Diff
Deprecate Lexer.nextList and related code
parent
3090ef1f
No related branches found
No related tags found
No related merge requests found
Pipeline
#117663
passed
Jul 20, 2023
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/org/sablecc/sablecc/lexer/Lexer.java
+12
-0
12 additions, 0 deletions
src/main/java/org/sablecc/sablecc/lexer/Lexer.java
src/main/resources/org/sablecc/sablecc/lexer.txt
+12
-0
12 additions, 0 deletions
src/main/resources/org/sablecc/sablecc/lexer.txt
with
24 additions
and
0 deletions
src/main/java/org/sablecc/sablecc/lexer/Lexer.java
+
12
−
0
View file @
1796fb94
...
@@ -27,8 +27,14 @@ public class Lexer
...
@@ -27,8 +27,14 @@ 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
>();
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
()
{
public
Queue
<
IToken
>
getNextList
()
{
return
nextList
;
return
nextList
;
}
}
...
@@ -38,6 +44,10 @@ public class Lexer
...
@@ -38,6 +44,10 @@ public class Lexer
// Do nothing
// Do nothing
}
}
/**
* @deprecated Override {@link #filter()} instead.
*/
@Deprecated
protected
void
filterWrap
()
throws
LexerException
,
IOException
protected
void
filterWrap
()
throws
LexerException
,
IOException
{
{
filter
();
filter
();
...
@@ -52,6 +62,7 @@ public class Lexer
...
@@ -52,6 +62,7 @@ public class Lexer
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
)
...
@@ -63,6 +74,7 @@ public class Lexer
...
@@ -63,6 +74,7 @@ public class Lexer
return
(
Token
)
nextList
.
peek
();
return
(
Token
)
nextList
.
peek
();
}
}
@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
)
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/org/sablecc/sablecc/lexer.txt
+
12
−
0
View file @
1796fb94
...
@@ -51,8 +51,14 @@ public class Lexer
...
@@ -51,8 +51,14 @@ 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>();
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() {
public Queue<IToken> getNextList() {
return nextList;
return nextList;
}
}
...
@@ -62,6 +68,10 @@ public class Lexer
...
@@ -62,6 +68,10 @@ public class Lexer
// Do nothing
// Do nothing
}
}
/**
* @deprecated Override {@link #filter()} instead.
*/
@Deprecated
protected void filterWrap() throws LexerException, IOException
protected void filterWrap() throws LexerException, IOException
{
{
filter();
filter();
...
@@ -76,6 +86,7 @@ public class Lexer
...
@@ -76,6 +86,7 @@ public class Lexer
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)
...
@@ -87,6 +98,7 @@ public class Lexer
...
@@ -87,6 +98,7 @@ public class Lexer
return (Token) nextList.peek();
return (Token) nextList.peek();
}
}
@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)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment