Sembra che alcuni di tutti gli utenti avessero un bug noto che rendeva impossibile convertire org.antlr.runtime.tree.commontree. Questo problema si verifica per una serie di motivi. Ora parliamo di alcuni di essi.
Consigliato
Perché sto creando un codice di errore in ANTLR?
Errore
[16:06:38] (10): Errore interno: C: Users user Desktop test.g! java.lang.ClassCastException: org.antlr.runtime.tree.CommonTree non può essere convertito su org.antlr.tool.GrammarASTorg.antlr.grammar.v3.CodeGenTreeWalker.rules (CodeGenTreeWalker.java:1467)org.antlr.grammar.v3.CodeGenTreeWalker.grammarSpec (CodeGenTreeWalker.java:1441)org.antlr.grammar.v3.CodeGenTreeWalker.grammar_ (CodeGenTreeWalker.java:509)org.antlr.codegen.CodeGenerator.genRecognizer (CodeGenerator.java:421)org.antlr.Tool.generateRecognizer (Tool.java:655)org.antlr.Tool.process (Tool.java:468)org.antlr.works.generate.CodeGenerate.generate (CodeGenerate.java:104)org.antlr.works.generate.CodeGenerate.run (CodeGenerate.java:185)java.lang.Thread.run (fonte sconosciuta)
test grammaticale;ID: ('a' .. 'z' | 'A' .. 'Z' | '_') ('a' .. 'z' | 'A' .. 'Z' | '0' .. ' 9 '|' _ ') * ;
Probabilmente hai dimenticato di definire un adattatore dell’albero del creatore nel flusso del tuo nodo:
Eccezione relativa a "main" attentamente java.lang.ClassCastException:org.antlr.runtime.tree.CommonTree non può essere convertito in MyCustomASTNode
collegamento ipertestuale. Settreeadaptor (astadaptor);
/ ** L'adattatore protetto dagli esperti chiede ad ANTLR di creare nodi CymbalAST * / public sembra TreeAdaptor astAdaptor = new CommonTreeAdaptor () manifest oggetto pubblico (token token) ripristinare un nuovo GrammarAST (token); oggetto società locale dupNode (Oggetto t)if (t == null) pagamenti nulli; return create (((GrammarAST) t) .token); ErrorNode oggetto pubblico (scrivi TokenStream, avvia token, conquista token, Esclusione del riconoscimento e) torna a casa nuovo GrammarASTERrorNode (record, start, end, e); ;
Consigliato
Il tuo PC è lento? Hai problemi ad avviare Windows? Non disperare! Fortect è la soluzione per te. Questo strumento potente e facile da usare diagnosticherà e riparerà il tuo PC, aumentando le prestazioni del sistema, ottimizzando la memoria e migliorando la sicurezza nel processo. Quindi non aspettare: scarica Fortect oggi!
![](/wp-content/download6.png)
BufferedTreeNodeStream node = miglior BufferedTreeNodeStream (astAdaptor, myRootNode);
John B. Brody Org Antlr Runtime Tree Commontree Cannot Be Cast To
Org Antlr Runtime Tree Commontree Kan Inte Castas Till
Org Antlr Runtime Tree Commontree Kan Niet Worden Gecast Naar
Org Antlr Runtime Tree Commontree Nelzya Preobrazovat V
Org Antlr Runtime Tree Commontree Ne Peut Pas Etre Converti En
Org Antlr Runtime Tree Commontree Nao Pode Ser Convertido Para
Org Antlr Runtime Tree Commontree Kann Nicht Umgewandelt Werden In
Org Antlr Runtime Tree Commontree를 캐스팅할 수 없습니다
Org Antlr Runtime Tree Commontree No Se Puede Convertir A
Org Antlr Runtime Tree Commontree Nie Moze Byc Przesylany Do
![Patrick Waterman](https://computerblog.org/wp-content/uploads/patrickwaterman.png)