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

Rename generated Lexer local variables to no shadow instance fields

parent afead31d
No related branches found
No related tags found
No related merge requests found
...@@ -68,8 +68,8 @@ public class Lexer ...@@ -68,8 +68,8 @@ public class Lexer
int acceptLine = -1; int acceptLine = -1;
boolean acceptCr = false; boolean acceptCr = false;
int[][][] gotoTable = Lexer.gotoTable[this.state.ordinal()]; int[][][] gotoTableSub = Lexer.gotoTable[this.state.ordinal()];
int[] accept = Lexer.accept[this.state.ordinal()]; int[] acceptSub = Lexer.accept[this.state.ordinal()];
this.text.setLength(0); this.text.setLength(0);
while(true) while(true)
...@@ -126,7 +126,7 @@ public class Lexer ...@@ -126,7 +126,7 @@ public class Lexer
dfaState = -1; dfaState = -1;
int[][] tmp1 = gotoTable[oldState]; int[][] tmp1 = gotoTableSub[oldState];
int low = 0; int low = 0;
int high = tmp1.length - 1; int high = tmp1.length - 1;
...@@ -160,10 +160,10 @@ public class Lexer ...@@ -160,10 +160,10 @@ public class Lexer
if(dfaState >= 0) if(dfaState >= 0)
{ {
if(accept[dfaState] != -1) if(acceptSub[dfaState] != -1)
{ {
acceptState = dfaState; acceptState = dfaState;
acceptToken = accept[dfaState]; acceptToken = acceptSub[dfaState];
acceptLength = this.text.length(); acceptLength = this.text.length();
acceptPos = this.pos; acceptPos = this.pos;
acceptLine = this.line; acceptLine = this.line;
...@@ -178,7 +178,7 @@ public class Lexer ...@@ -178,7 +178,7 @@ public class Lexer
{ {
case 0: case 0:
{ {
Token token = new TPkgId(getText(acceptLength), startLine + 1, startPos + 1); Token tok = new TPkgId(getText(acceptLength), startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
...@@ -187,11 +187,11 @@ public class Lexer ...@@ -187,11 +187,11 @@ public class Lexer
{ {
case 1: state = State.PACKAGE; break; case 1: state = State.PACKAGE; break;
} }
return token; return tok;
} }
case 1: case 1:
{ {
Token token = new TPackage(startLine + 1, startPos + 1); Token tok = new TPackage(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
...@@ -200,137 +200,137 @@ public class Lexer ...@@ -200,137 +200,137 @@ public class Lexer
{ {
case 0: state = State.PACKAGE; break; case 0: state = State.PACKAGE; break;
} }
return token; return tok;
} }
case 2: case 2:
{ {
Token token = new TStates(startLine + 1, startPos + 1); Token tok = new TStates(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 3: case 3:
{ {
Token token = new THelpers(startLine + 1, startPos + 1); Token tok = new THelpers(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 4: case 4:
{ {
Token token = new TTokens(startLine + 1, startPos + 1); Token tok = new TTokens(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 5: case 5:
{ {
Token token = new TIgnored(startLine + 1, startPos + 1); Token tok = new TIgnored(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 6: case 6:
{ {
Token token = new TProductions(startLine + 1, startPos + 1); Token tok = new TProductions(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 7: case 7:
{ {
Token token = new TAbstract(startLine + 1, startPos + 1); Token tok = new TAbstract(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 8: case 8:
{ {
Token token = new TSyntax(startLine + 1, startPos + 1); Token tok = new TSyntax(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 9: case 9:
{ {
Token token = new TTree(startLine + 1, startPos + 1); Token tok = new TTree(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 10: case 10:
{ {
Token token = new TNew(startLine + 1, startPos + 1); Token tok = new TNew(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 11: case 11:
{ {
Token token = new TNull(startLine + 1, startPos + 1); Token tok = new TNull(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 12: case 12:
{ {
Token token = new TTokenSpecifier(startLine + 1, startPos + 1); Token tok = new TTokenSpecifier(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 13: case 13:
{ {
Token token = new TProductionSpecifier(startLine + 1, startPos + 1); Token tok = new TProductionSpecifier(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 14: case 14:
{ {
Token token = new TDot(startLine + 1, startPos + 1); Token tok = new TDot(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 15: case 15:
{ {
Token token = new TDDot(startLine + 1, startPos + 1); Token tok = new TDDot(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 16: case 16:
{ {
Token token = new TSemicolon(startLine + 1, startPos + 1); Token tok = new TSemicolon(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
...@@ -340,214 +340,214 @@ public class Lexer ...@@ -340,214 +340,214 @@ public class Lexer
case 0: state = State.NORMAL; break; case 0: state = State.NORMAL; break;
case 1: state = State.NORMAL; break; case 1: state = State.NORMAL; break;
} }
return token; return tok;
} }
case 17: case 17:
{ {
Token token = new TEqual(startLine + 1, startPos + 1); Token tok = new TEqual(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 18: case 18:
{ {
Token token = new TLBkt(startLine + 1, startPos + 1); Token tok = new TLBkt(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 19: case 19:
{ {
Token token = new TRBkt(startLine + 1, startPos + 1); Token tok = new TRBkt(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 20: case 20:
{ {
Token token = new TLPar(startLine + 1, startPos + 1); Token tok = new TLPar(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 21: case 21:
{ {
Token token = new TRPar(startLine + 1, startPos + 1); Token tok = new TRPar(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 22: case 22:
{ {
Token token = new TLBrace(startLine + 1, startPos + 1); Token tok = new TLBrace(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 23: case 23:
{ {
Token token = new TRBrace(startLine + 1, startPos + 1); Token tok = new TRBrace(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 24: case 24:
{ {
Token token = new TPlus(startLine + 1, startPos + 1); Token tok = new TPlus(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 25: case 25:
{ {
Token token = new TMinus(startLine + 1, startPos + 1); Token tok = new TMinus(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 26: case 26:
{ {
Token token = new TQMark(startLine + 1, startPos + 1); Token tok = new TQMark(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 27: case 27:
{ {
Token token = new TStar(startLine + 1, startPos + 1); Token tok = new TStar(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 28: case 28:
{ {
Token token = new TBar(startLine + 1, startPos + 1); Token tok = new TBar(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 29: case 29:
{ {
Token token = new TComma(startLine + 1, startPos + 1); Token tok = new TComma(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 30: case 30:
{ {
Token token = new TSlash(startLine + 1, startPos + 1); Token tok = new TSlash(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 31: case 31:
{ {
Token token = new TArrow(startLine + 1, startPos + 1); Token tok = new TArrow(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 32: case 32:
{ {
Token token = new TColon(startLine + 1, startPos + 1); Token tok = new TColon(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 33: case 33:
{ {
Token token = new TId(getText(acceptLength), startLine + 1, startPos + 1); Token tok = new TId(getText(acceptLength), startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 34: case 34:
{ {
Token token = new TChar(getText(acceptLength), startLine + 1, startPos + 1); Token tok = new TChar(getText(acceptLength), startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 35: case 35:
{ {
Token token = new TDecChar(getText(acceptLength), startLine + 1, startPos + 1); Token tok = new TDecChar(getText(acceptLength), startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 36: case 36:
{ {
Token token = new THexChar(getText(acceptLength), startLine + 1, startPos + 1); Token tok = new THexChar(getText(acceptLength), startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 37: case 37:
{ {
Token token = new TString(getText(acceptLength), startLine + 1, startPos + 1); Token tok = new TString(getText(acceptLength), startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 38: case 38:
{ {
Token token = new TBlank(getText(acceptLength), startLine + 1, startPos + 1); Token tok = new TBlank(getText(acceptLength), startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
case 39: case 39:
{ {
Token token = new TComment(getText(acceptLength), startLine + 1, startPos + 1); Token tok = new TComment(getText(acceptLength), startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
this.cr = acceptCr; this.cr = acceptCr;
return token; return tok;
} }
} }
} }
...@@ -596,13 +596,13 @@ public class Lexer ...@@ -596,13 +596,13 @@ public class Lexer
* @deprecated This method doesn't restore line/column info correctly in some cases * @deprecated This method doesn't restore line/column info correctly in some cases
* (if a token begins in the middle of a CRLF newline pair). * (if a token begins in the middle of a CRLF newline pair).
* There is no planned replacement. * There is no planned replacement.
* @param token the token to push back onto the input * @param tok the token to push back onto the input
* @throws IOException when thrown by {@link PushbackReader#unread(int)} * @throws IOException when thrown by {@link PushbackReader#unread(int)}
*/ */
@Deprecated @Deprecated
protected void unread(Token token) throws IOException protected void unread(Token tok) throws IOException
{ {
String text = token.getText(); String text = tok.getText();
int length = text.length(); int length = text.length();
for(int i = length - 1; i >= 0; i--) for(int i = length - 1; i >= 0; i--)
...@@ -612,8 +612,8 @@ public class Lexer ...@@ -612,8 +612,8 @@ public class Lexer
this.in.unread(text.charAt(i)); this.in.unread(text.charAt(i));
} }
this.pos = token.getPos() - 1; this.pos = tok.getPos() - 1;
this.line = token.getLine() - 1; this.line = tok.getLine() - 1;
} }
private String getText(int acceptLength) private String getText(int acceptLength)
......
...@@ -92,8 +92,8 @@ public class Lexer ...@@ -92,8 +92,8 @@ public class Lexer
int acceptLine = -1; int acceptLine = -1;
boolean acceptCr = false; boolean acceptCr = false;
int[][][] gotoTable = Lexer.gotoTable[this.state.ordinal()]; int[][][] gotoTableSub = Lexer.gotoTable[this.state.ordinal()];
int[] accept = Lexer.accept[this.state.ordinal()]; int[] acceptSub = Lexer.accept[this.state.ordinal()];
this.text.setLength(0); this.text.setLength(0);
while(true) while(true)
...@@ -150,7 +150,7 @@ public class Lexer ...@@ -150,7 +150,7 @@ public class Lexer
dfaState = -1; dfaState = -1;
int[][] tmp1 = gotoTable[oldState]; int[][] tmp1 = gotoTableSub[oldState];
int low = 0; int low = 0;
int high = tmp1.length - 1; int high = tmp1.length - 1;
...@@ -184,10 +184,10 @@ public class Lexer ...@@ -184,10 +184,10 @@ public class Lexer
if(dfaState >= 0) if(dfaState >= 0)
{ {
if(accept[dfaState] != -1) if(acceptSub[dfaState] != -1)
{ {
acceptState = dfaState; acceptState = dfaState;
acceptToken = accept[dfaState]; acceptToken = acceptSub[dfaState];
acceptLength = this.text.length(); acceptLength = this.text.length();
acceptPos = this.pos; acceptPos = this.pos;
acceptLine = this.line; acceptLine = this.line;
...@@ -206,7 +206,7 @@ $ ...@@ -206,7 +206,7 @@ $
Macro:LexerVariableToken Macro:LexerVariableToken
case $0$: case $0$:
{ {
Token token = new $1$(getText(acceptLength), startLine + 1, startPos + 1); Token tok = new $1$(getText(acceptLength), startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
...@@ -217,7 +217,7 @@ $ ...@@ -217,7 +217,7 @@ $
Macro:LexerFixedToken Macro:LexerFixedToken
case $0$: case $0$:
{ {
Token token = new $1$(startLine + 1, startPos + 1); Token tok = new $1$(startLine + 1, startPos + 1);
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
this.line = acceptLine; this.line = acceptLine;
...@@ -242,7 +242,7 @@ Macro:TokenSwitchTail ...@@ -242,7 +242,7 @@ Macro:TokenSwitchTail
$ $
Macro:LexerTokenTail Macro:LexerTokenTail
return token; return tok;
} }
$ $
...@@ -295,13 +295,13 @@ Macro:LexerBody ...@@ -295,13 +295,13 @@ Macro:LexerBody
* @deprecated This method doesn't restore line/column info correctly in some cases * @deprecated This method doesn't restore line/column info correctly in some cases
* (if a token begins in the middle of a CRLF newline pair). * (if a token begins in the middle of a CRLF newline pair).
* There is no planned replacement. * There is no planned replacement.
* @param token the token to push back onto the input * @param tok the token to push back onto the input
* @throws IOException when thrown by {@link PushbackReader#unread(int)} * @throws IOException when thrown by {@link PushbackReader#unread(int)}
*/ */
@Deprecated @Deprecated
protected void unread(Token token) throws IOException protected void unread(Token tok) throws IOException
{ {
String text = token.getText(); String text = tok.getText();
int length = text.length(); int length = text.length();
for(int i = length - 1; i >= 0; i--) for(int i = length - 1; i >= 0; i--)
...@@ -311,8 +311,8 @@ Macro:LexerBody ...@@ -311,8 +311,8 @@ Macro:LexerBody
this.in.unread(text.charAt(i)); this.in.unread(text.charAt(i));
} }
this.pos = token.getPos() - 1; this.pos = tok.getPos() - 1;
this.line = token.getLine() - 1; this.line = tok.getLine() - 1;
} }
private String getText(int acceptLength) private String getText(int acceptLength)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment