📄 antlrtreeprinter.java
字号:
catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } _retTree = _t; } public final void optionValue(AST _t) throws RecognitionException { GrammarAST optionValue_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; GrammarAST id = null; GrammarAST s = null; GrammarAST c = null; GrammarAST i = null; try { // for error handling if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case ID: { id = (GrammarAST)_t; match(_t,ID); _t = _t.getNextSibling(); out(id.getText()); break; } case STRING_LITERAL: { s = (GrammarAST)_t; match(_t,STRING_LITERAL); _t = _t.getNextSibling(); out(s.getText()); break; } case CHAR_LITERAL: { c = (GrammarAST)_t; match(_t,CHAR_LITERAL); _t = _t.getNextSibling(); out(c.getText()); break; } case INT: { i = (GrammarAST)_t; match(_t,INT); _t = _t.getNextSibling(); out(i.getText()); break; } default: { throw new NoViableAltException(_t); } } } catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } _retTree = _t; } public final void tokenSpec(AST _t) throws RecognitionException { GrammarAST tokenSpec_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; try { // for error handling if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case TOKEN_REF: { GrammarAST tmp32_AST_in = (GrammarAST)_t; match(_t,TOKEN_REF); _t = _t.getNextSibling(); break; } case ASSIGN: { AST __t36 = _t; GrammarAST tmp33_AST_in = (GrammarAST)_t; match(_t,ASSIGN); _t = _t.getFirstChild(); GrammarAST tmp34_AST_in = (GrammarAST)_t; match(_t,TOKEN_REF); _t = _t.getNextSibling(); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case STRING_LITERAL: { GrammarAST tmp35_AST_in = (GrammarAST)_t; match(_t,STRING_LITERAL); _t = _t.getNextSibling(); break; } case CHAR_LITERAL: { GrammarAST tmp36_AST_in = (GrammarAST)_t; match(_t,CHAR_LITERAL); _t = _t.getNextSibling(); break; } default: { throw new NoViableAltException(_t); } } } _t = __t36; _t = _t.getNextSibling(); break; } default: { throw new NoViableAltException(_t); } } } catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } _retTree = _t; } public final void modifier(AST _t) throws RecognitionException { GrammarAST modifier_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; out(modifier_AST_in.getText()); out(" "); try { // for error handling if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case LITERAL_protected: { GrammarAST tmp37_AST_in = (GrammarAST)_t; match(_t,LITERAL_protected); _t = _t.getNextSibling(); break; } case LITERAL_public: { GrammarAST tmp38_AST_in = (GrammarAST)_t; match(_t,LITERAL_public); _t = _t.getNextSibling(); break; } case LITERAL_private: { GrammarAST tmp39_AST_in = (GrammarAST)_t; match(_t,LITERAL_private); _t = _t.getNextSibling(); break; } case FRAGMENT: { GrammarAST tmp40_AST_in = (GrammarAST)_t; match(_t,FRAGMENT); _t = _t.getNextSibling(); break; } default: { throw new NoViableAltException(_t); } } } catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } _retTree = _t; } public final void ruleScopeSpec(AST _t) throws RecognitionException { GrammarAST ruleScopeSpec_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; try { // for error handling AST __t57 = _t; GrammarAST tmp41_AST_in = (GrammarAST)_t; match(_t,SCOPE); _t = _t.getFirstChild(); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case ACTION: { GrammarAST tmp42_AST_in = (GrammarAST)_t; match(_t,ACTION); _t = _t.getNextSibling(); break; } case 3: case ID: { break; } default: { throw new NoViableAltException(_t); } } } { _loop60: do { if (_t==null) _t=ASTNULL; if ((_t.getType()==ID)) { GrammarAST tmp43_AST_in = (GrammarAST)_t; match(_t,ID); _t = _t.getNextSibling(); } else { break _loop60; } } while (true); } _t = __t57; _t = _t.getNextSibling(); } catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } _retTree = _t; } public final void ruleAction(AST _t) throws RecognitionException { GrammarAST ruleAction_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; GrammarAST id = null; GrammarAST a = null; try { // for error handling AST __t54 = _t; GrammarAST tmp44_AST_in = (GrammarAST)_t; match(_t,AMPERSAND); _t = _t.getFirstChild(); id = (GrammarAST)_t; match(_t,ID); _t = _t.getNextSibling(); a = (GrammarAST)_t; match(_t,ACTION); _t = _t.getNextSibling(); _t = __t54; _t = _t.getNextSibling(); if ( showActions ) out("@"+id.getText()+"{"+a.getText()+"}"); } catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } _retTree = _t; } public final void block(AST _t, boolean forceParens ) throws RecognitionException { GrammarAST block_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; int numAlts = countAltsForBlock(block_AST_in); try { // for error handling AST __t62 = _t; GrammarAST tmp45_AST_in = (GrammarAST)_t; match(_t,BLOCK); _t = _t.getFirstChild(); if ( forceParens||numAlts>1 ) out(" ("); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case OPTIONS: { optionsSpec(_t); _t = _retTree; out(" : "); break; } case ALT: { break; } default: { throw new NoViableAltException(_t); } } } alternative(_t); _t = _retTree; rewrite(_t); _t = _retTree; { _loop65: do { if (_t==null) _t=ASTNULL; if ((_t.getType()==ALT)) { out(" | "); alternative(_t); _t = _retTree; rewrite(_t); _t = _retTree; } else { break _loop65; } } while (true); } GrammarAST tmp46_AST_in = (GrammarAST)_t; match(_t,EOB); _t = _t.getNextSibling(); if ( forceParens||numAlts>1 ) out(")"); _t = __t62; _t = _t.getNextSibling(); } catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } _retTree = _t; } public final void exceptionGroup(AST _t) throws RecognitionException { GrammarAST exceptionGroup_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; try { // for error handling if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case LITERAL_catch: { { int _cnt79=0; _loop79: do { if (_t==null) _t=ASTNULL; if ((_t.getType()==LITERAL_catch)) { exceptionHandler(_t); _t = _retTree; } else { if ( _cnt79>=1 ) { break _loop79; } else {throw new NoViableAltException(_t);} } _cnt79++; } while (true); } { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case LITERAL_finally: { finallyClause(_t); _t = _retTree; break; } case EOR: { break; } default: { throw new NoViableAltException(_t); } } } break; } case LITERAL_finally: { finallyClause(_t); _t = _retTree; break; } default: { throw new NoViableAltException(_t); } } } catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } _retTree = _t; } public final void rewrite(AST _t) throws RecognitionException { GrammarAST rewrite_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; try { // for error handling { _loop99: do { if (_t==null) _t=ASTNULL; if ((_t.getType()==REWRITE)) { single_rewrite(_t); _t = _retTree; } else { break _loop99; } } while (true); } } catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } _retTree = _t; } public final int countAltsForBlock(AST _t) throws RecognitionException { int n=0; GrammarAST countAltsForBlock_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; try { // for error handling AST __t67 = _t; GrammarAST tmp47_AST_in = (GrammarAST)_t; match(_t,BLOCK); _t = _t.getFirstChild(); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case OPTIONS: { GrammarAST tmp48_AST_in = (GrammarAST)_t; match(_t,OPTIONS); _t = _t.getNextSibling(); break; } case ALT: { break; } default: { throw new NoViableAltException(_t); } } } { int _cnt72=0; _loop72: do { if (_t==null) _t=ASTNULL; if ((_t.getType()==ALT)) { GrammarAST tmp49_AST_in = (GrammarAST)_t; match(_t,ALT); _t = _t.getNextSibling(); { _loop71: do { if (_t==null) _t=ASTNULL; if ((_t.getType()==REWRITE)) { GrammarAST tmp50_AST_in = (GrammarAST)_t; match(_t,REWRITE); _t = _t.getNextSibling(); } else { break _loop71; } } while (true); } n++; } else { if ( _cnt72>=1 ) { break _loop72; } else {throw new NoViableAltException(_t);} } _cnt72++; } while (true); } GrammarAST tmp51_AST_in = (GrammarAST)_t; match(_t,EOB); _t = _t.getNextSibling(); _t = __t67; _t = _t.getNextSibling(); } catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } _retTree = _t; return n; } public final void exceptionHandler(AST _t) throws RecognitionException { GrammarAST exceptionHandler_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; try { // for error handling AST __t82 = _t; GrammarAST tmp52_AST_in = (GrammarAST)_t; match(_t,LITERAL_catch); _t = _t.getFirstChild(); GrammarAST tmp53_AST_in = (GrammarAST)_t; match(_t,ARG_ACTION); _t = _t.getNextSibling(); GrammarAST tmp54_AST_in = (GrammarAST)_t; match(_t,ACTION); _t = _t.getNextSibling(); _t = __t82; _t = _t.getNextSibling(); } catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } _retTree = _t; } public final void finallyClause(AST _t) throws RecognitionException { GrammarAST finallyClause_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; try { // for error handling AST __t84 = _t; GrammarAST tmp55_AST_in = (GrammarAST)_t; match(_t,LITERAL_finally); _t = _t.getFirstChild(); GrammarAST tmp56_AST_in = (GrammarAST)_t; match(_t,ACTION); _t = _t.getNextSibling(); _t = __t84; _t = _t.getNextSibling(); } catch (RecognitionException ex) { reportError(ex); if (_t!=null) {_t = _t.getNextSibling();} } _retTree = _t; } public final void rewrite_template(AST _t) throws RecognitionException { GrammarAST rewrite_template_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; GrammarAST id = null; GrammarAST ind = null; GrammarAST arg = null; GrammarAST a = null; try { // for error handling AST __t90 = _t; GrammarAST tmp57_AST_in = (GrammarAST)_t; match(_t,TEMPLATE); _t = _t.getFirstChild(); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case ID: { id = (GrammarAST)_t; match(_t,ID); _t = _t.getNextSibling(); out(" "+id.getText()); break; } case ACTION: { ind = (GrammarAST)_t; match(_t,ACTION); _t = _t.getNextSibling(); out(" ({"+ind.getText()+"})");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -