Remove redundant casts

This commit is contained in:
Sam Harwell 2012-12-14 09:41:11 -06:00
parent 9d0ba56cbd
commit ed40c1aad1
4 changed files with 5 additions and 5 deletions

View File

@ -52,7 +52,7 @@ public class Action extends RuleElement {
super(factory,ast);
RuleFunction rf = factory.getCurrentRuleFunction();
if (ast != null) {
chunks = ActionTranslator.translateAction(factory, rf, ast.token, (ActionAST)ast);
chunks = ActionTranslator.translateAction(factory, rf, ast.token, ast);
}
else {
chunks = new ArrayList<ActionChunk>();

View File

@ -54,7 +54,7 @@ public class ToolANTLRParser extends ANTLRParser {
{
String msg = getParserErrorMessage(this, e);
if ( !paraphrases.isEmpty() ) {
String paraphrase = (String)paraphrases.peek();
String paraphrase = paraphrases.peek();
msg = msg+" while "+paraphrase;
}
// List stack = getRuleInvocationStack(e, this.getClass().getName());

View File

@ -280,7 +280,7 @@ public class GrammarTransformPipeline {
GrammarRootAST combinedAST = combinedGrammar.ast;
//tool.log("grammar", "before="+combinedAST.toStringTree());
GrammarASTAdaptor adaptor = new GrammarASTAdaptor(combinedAST.token.getInputStream());
GrammarAST[] elements = (GrammarAST[])combinedAST.getChildren().toArray(new GrammarAST[0]);
GrammarAST[] elements = combinedAST.getChildren().toArray(new GrammarAST[0]);
// MAKE A GRAMMAR ROOT and ID
String lexerName = combinedAST.getChild(0).getText()+"Lexer";
@ -296,7 +296,7 @@ public class GrammarTransformPipeline {
if ( optionsRoot!=null ) {
GrammarAST lexerOptionsRoot = (GrammarAST)adaptor.dupNode(optionsRoot);
lexerAST.addChild(lexerOptionsRoot);
GrammarAST[] options = (GrammarAST[])optionsRoot.getChildren().toArray(new GrammarAST[0]);
GrammarAST[] options = optionsRoot.getChildren().toArray(new GrammarAST[0]);
for (GrammarAST o : options) {
String optionName = o.getChild(0).getText();
if ( Grammar.lexerOptions.contains(optionName) &&

View File

@ -893,7 +893,7 @@ public class TestATNConstruction extends BaseTest {
System.err.println("no such mode "+modeName);
return;
}
ParserATNFactory f = new LexerATNFactory((LexerGrammar)g);
ParserATNFactory f = new LexerATNFactory(g);
ATN nfa = f.createATN();
ATNState startState = nfa.modeNameToStartState.get(modeName);
ATNPrinter serializer = new ATNPrinter(g, startState);