Commit 3c0866a6 authored by Kristof Szabados's avatar Kristof Szabados

could be final.

Signed-off-by: Kristof Szabados's avatarKristof Szabados <Kristof.Szabados@ericsson.com>
parent 88af8715
......@@ -67,7 +67,7 @@ public class BlockLevelTokenStreamTracker extends CommonTokenStream {
// discard this Token
assert(true); // TODO: remove it if it proves OK (in Lexer done it)
} else if (t.getType() == Asn1Lexer.BEGINCHAR) {
boolean exit = getBlock(first);
final boolean exit = getBlock(first);
if (exit) {
return ++i;
}
......@@ -91,17 +91,17 @@ public class BlockLevelTokenStreamTracker extends CommonTokenStream {
return null;
}
BlockLevelTokenStreamTracker tracker = new BlockLevelTokenStreamTracker(aBlock, startIndex);
final BlockLevelTokenStreamTracker tracker = new BlockLevelTokenStreamTracker(aBlock, startIndex);
tracker.discard(Asn1Lexer.WS);
tracker.discard(Asn1Lexer.MULTILINECOMMENT);
tracker.discard(Asn1Lexer.SINGLELINECOMMENT);
Asn1Parser parser = new Asn1Parser(tracker);
final Asn1Parser parser = new Asn1Parser(tracker);
tracker.setActualFile((IFile) aBlock.getLocation().getFile());
parser.setActualFile((IFile) aBlock.getLocation().getFile());
parser.setBuildParseTree(false);
ASN1Listener parserListener = new ASN1Listener(parser);
final ASN1Listener parserListener = new ASN1Listener(parser);
parser.removeErrorListeners(); // remove ConsoleErrorListener
parser.addErrorListener(parserListener);
return parser;
......@@ -115,7 +115,7 @@ public class BlockLevelTokenStreamTracker extends CommonTokenStream {
TokenWithIndexAndSubTokens result;
Token t = oldList.get(index++);
List<Token> tokenList = new ArrayList<Token>();
final List<Token> tokenList = new ArrayList<Token>();
int nofUnclosedParanthesis = 1;
while(t != null && t.getType() != Token.EOF && index < oldList.size()) {
if(t.getType() == Asn1Lexer.BEGINCHAR) {
......@@ -146,10 +146,11 @@ public class BlockLevelTokenStreamTracker extends CommonTokenStream {
}
private String makeString(final List<Token> list) {
StringBuilder text = new StringBuilder();
for (Token t : list) {
final StringBuilder text = new StringBuilder();
for (final Token t : list) {
text.append(t.getText());
}
}
return text.toString();
}
}
......@@ -88,7 +88,7 @@ public class ModuleLevelTokenStreamTracker extends CommonTokenStream {
((WritableToken)t).setTokenIndex(tokens.size());
}
List<Token> tokenList = new ArrayList<Token>();
final List<Token> tokenList = new ArrayList<Token>();
int nofUnclosedParanthesis = 1;
while(t != null && t.getType() != Token.EOF) {
......@@ -119,10 +119,11 @@ public class ModuleLevelTokenStreamTracker extends CommonTokenStream {
}
private String makeString(final List<Token> list) {
StringBuilder text = new StringBuilder();
for (Token t : list) {
final StringBuilder text = new StringBuilder();
for (final Token t : list) {
text.append(t.getText());
}
return text.toString();
}
}
......@@ -57,7 +57,7 @@ public class SyntaxLevelTokenStreamTracker extends CommonTokenStream {
}
do {
Token t = oldList.get(index++);
final Token t = oldList.get(index++);
//t = tokens.get(index++);
first = t;
if (t == null) {
......@@ -65,7 +65,7 @@ public class SyntaxLevelTokenStreamTracker extends CommonTokenStream {
} else if (discardMask.contains(Integer.valueOf(t.getType()))) {
// discard this Token
} else if (t.getType() == Asn1Lexer.SQUAREOPEN) {
boolean exit = getBlock(first);
final boolean exit = getBlock(first);
if (exit) {
return ++i;
}
......@@ -89,18 +89,19 @@ public class SyntaxLevelTokenStreamTracker extends CommonTokenStream {
return null;
}
SyntaxLevelTokenStreamTracker tracker = new SyntaxLevelTokenStreamTracker(aBlock, startIndex);
final SyntaxLevelTokenStreamTracker tracker = new SyntaxLevelTokenStreamTracker(aBlock, startIndex);
tracker.discard(Asn1Lexer.WS);
tracker.discard(Asn1Lexer.MULTILINECOMMENT);
tracker.discard(Asn1Lexer.SINGLELINECOMMENT);
Asn1Parser parser = new Asn1Parser(tracker);
final Asn1Parser parser = new Asn1Parser(tracker);
tracker.setActualFile((IFile) aBlock.getLocation().getFile());
parser.setActualFile((IFile) aBlock.getLocation().getFile());
parser.setBuildParseTree(false);
ASN1Listener parserListener = new ASN1Listener(parser);
final ASN1Listener parserListener = new ASN1Listener(parser);
parser.removeErrorListeners(); // remove ConsoleErrorListener
parser.addErrorListener(parserListener);
parser.addErrorListener(parserListener);
return parser;
}
......@@ -112,7 +113,7 @@ public class SyntaxLevelTokenStreamTracker extends CommonTokenStream {
TokenWithIndexAndSubTokens result;
Token t = oldList.get(index++);
List<Token> tokenList = new ArrayList<Token>();
final List<Token> tokenList = new ArrayList<Token>();
int nofUnclosedParanthesis = 1;
while(t != null && t.getType() != Token.EOF && index < oldList.size()) {
if(t.getType() == Asn1Lexer.SQUAREOPEN) {
......@@ -142,10 +143,11 @@ public class SyntaxLevelTokenStreamTracker extends CommonTokenStream {
}
private String makeString(final List<Token> list) {
StringBuilder text = new StringBuilder();
for (Token t : list) {
final StringBuilder text = new StringBuilder();
for (final Token t : list) {
text.append(t.getText());
}
}
return text.toString();
}
}
......@@ -73,10 +73,11 @@ public class TokenWithIndexAndSubTokens extends CommonToken {
}
public TokenWithIndexAndSubTokens copy() {
TokenWithIndexAndSubTokens token = new TokenWithIndexAndSubTokens(source, type, channel, start, stop, tokenList, sourceFile);
final TokenWithIndexAndSubTokens token = new TokenWithIndexAndSubTokens(source, type, channel, start, stop, tokenList, sourceFile);
token.line = line;
token.charPositionInLine = charPositionInLine;
token.setText(getText());
token.setText(getText());
return token;
}
......
......@@ -30,7 +30,7 @@ public class TokenWithIndexAndSubTokensFactory implements TokenFactory<TokenWith
final int channel, final int start, final int stop,
final int line, final int charPositionInLine)
{
TokenWithIndexAndSubTokens t = new TokenWithIndexAndSubTokens(source, type, channel, start, stop);
final TokenWithIndexAndSubTokens t = new TokenWithIndexAndSubTokens(source, type, channel, start, stop);
t.setLine(line);
t.setCharPositionInLine(charPositionInLine);
if ( text!=null ) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment