forked from jasder/antlr
Remove redundant casts
This commit is contained in:
parent
9d0ba56cbd
commit
ed40c1aad1
|
@ -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>();
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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) &&
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue