📄 treetonfaconverter.java
字号:
_t = _t.getNextSibling(); } else { break _loop110; } } while (true); } AST __t111 = _t; GrammarAST tmp71_AST_in = (GrammarAST)_t; match(_t,BLOCK); _t = _t.getFirstChild(); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case OPTIONS: { GrammarAST tmp72_AST_in = (GrammarAST)_t; match(_t,OPTIONS); _t = _t.getNextSibling(); break; } case ALT: { break; } default: { throw new NoViableAltException(_t); } } } { int _cnt115=0; _loop115: do { if (_t==null) _t=ASTNULL; if ((_t.getType()==ALT)) { AST __t114 = _t; GrammarAST tmp73_AST_in = (GrammarAST)_t; match(_t,ALT); _t = _t.getFirstChild(); setElement(_t,elements); _t = _retTree; GrammarAST tmp74_AST_in = (GrammarAST)_t; match(_t,EOA); _t = _t.getNextSibling(); _t = __t114; _t = _t.getNextSibling(); } else { if ( _cnt115>=1 ) { break _loop115; } else {throw new NoViableAltException(_t);} } _cnt115++; } while (true); } GrammarAST tmp75_AST_in = (GrammarAST)_t; match(_t,EOB); _t = _t.getNextSibling(); _t = __t111; _t = _t.getNextSibling(); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case LITERAL_catch: case LITERAL_finally: { exceptionGroup(_t); _t = _retTree; break; } case EOR: { break; } default: { throw new NoViableAltException(_t); } } } GrammarAST tmp76_AST_in = (GrammarAST)_t; match(_t,EOR); _t = _t.getNextSibling(); _t = __t105; _t = _t.getNextSibling(); } catch (RecognitionException re) { throw re; } _retTree = _t; return elements; } /** Check to see if this block can be a set. Can't have actions * etc... Also can't be in a rule with a rewrite as we need * to track what's inside set for use in rewrite. */ public final void testBlockAsSet(AST _t) throws RecognitionException { GrammarAST testBlockAsSet_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; int nAlts=0; Rule r = grammar.getRule(currentRuleName); try { // for error handling AST __t121 = _t; GrammarAST tmp77_AST_in = (GrammarAST)_t; match(_t,BLOCK); _t = _t.getFirstChild(); { int _cnt125=0; _loop125: do { if (_t==null) _t=ASTNULL; if ((_t.getType()==ALT)) { AST __t123 = _t; GrammarAST tmp78_AST_in = (GrammarAST)_t; match(_t,ALT); _t = _t.getFirstChild(); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case BACKTRACK_SEMPRED: { GrammarAST tmp79_AST_in = (GrammarAST)_t; match(_t,BACKTRACK_SEMPRED); _t = _t.getNextSibling(); break; } case BLOCK: case CHAR_RANGE: case STRING_LITERAL: case CHAR_LITERAL: case TOKEN_REF: case NOT: { break; } default: { throw new NoViableAltException(_t); } } } testSetElement(_t); _t = _retTree; nAlts++; GrammarAST tmp80_AST_in = (GrammarAST)_t; match(_t,EOA); _t = _t.getNextSibling(); _t = __t123; _t = _t.getNextSibling(); if (!(!r.hasRewrite(outerAltNum))) throw new SemanticException("!r.hasRewrite(outerAltNum)"); } else { if ( _cnt125>=1 ) { break _loop125; } else {throw new NoViableAltException(_t);} } _cnt125++; } while (true); } GrammarAST tmp81_AST_in = (GrammarAST)_t; match(_t,EOB); _t = _t.getNextSibling(); _t = __t121; _t = _t.getNextSibling(); if (!(nAlts>1)) throw new SemanticException("nAlts>1"); } catch (RecognitionException re) { throw re; } _retTree = _t; } /** Match just an element; no ast suffix etc.. */ public final void testSetElement(AST _t) throws RecognitionException { GrammarAST testSetElement_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; GrammarAST c = null; GrammarAST t = null; GrammarAST s = null; GrammarAST c1 = null; GrammarAST c2 = null; AST r = _t; try { // for error handling if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case CHAR_LITERAL: { c = (GrammarAST)_t; match(_t,CHAR_LITERAL); _t = _t.getNextSibling(); break; } case TOKEN_REF: { t = (GrammarAST)_t; match(_t,TOKEN_REF); _t = _t.getNextSibling(); if ( grammar.type==Grammar.LEXER ) { Rule rule = grammar.getRule(t.getText()); if ( rule==null ) { throw new RecognitionException("invalid rule"); } // recursively will invoke this rule to match elements in target rule ref testSetRule(rule.tree); } break; } case CHAR_RANGE: { AST __t140 = _t; GrammarAST tmp82_AST_in = (GrammarAST)_t; match(_t,CHAR_RANGE); _t = _t.getFirstChild(); c1 = (GrammarAST)_t; match(_t,CHAR_LITERAL); _t = _t.getNextSibling(); c2 = (GrammarAST)_t; match(_t,CHAR_LITERAL); _t = _t.getNextSibling(); _t = __t140; _t = _t.getNextSibling(); break; } case BLOCK: { testBlockAsSet(_t); _t = _retTree; break; } case NOT: { AST __t141 = _t; GrammarAST tmp83_AST_in = (GrammarAST)_t; match(_t,NOT); _t = _t.getFirstChild(); testSetElement(_t); _t = _retTree; _t = __t141; _t = _t.getNextSibling(); break; } default: if (_t==null) _t=ASTNULL; if (((_t.getType()==STRING_LITERAL))&&(grammar.type!=Grammar.LEXER)) { s = (GrammarAST)_t; match(_t,STRING_LITERAL); _t = _t.getNextSibling(); } else { throw new NoViableAltException(_t); } } } catch (RecognitionException re) { throw re; } _retTree = _t; } public final void testSetRule(AST _t) throws RecognitionException { GrammarAST testSetRule_AST_in = (_t == ASTNULL) ? null : (GrammarAST)_t; GrammarAST id = null; try { // for error handling AST __t127 = _t; GrammarAST tmp84_AST_in = (GrammarAST)_t; match(_t,RULE); _t = _t.getFirstChild(); id = (GrammarAST)_t; match(_t,ID); _t = _t.getNextSibling(); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case FRAGMENT: case LITERAL_protected: case LITERAL_public: case LITERAL_private: { modifier(_t); _t = _retTree; break; } case ARG: { break; } default: { throw new NoViableAltException(_t); } } } GrammarAST tmp85_AST_in = (GrammarAST)_t; match(_t,ARG); _t = _t.getNextSibling(); GrammarAST tmp86_AST_in = (GrammarAST)_t; match(_t,RET); _t = _t.getNextSibling(); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case OPTIONS: { GrammarAST tmp87_AST_in = (GrammarAST)_t; match(_t,OPTIONS); _t = _t.getNextSibling(); break; } case BLOCK: case SCOPE: case AMPERSAND: { break; } default: { throw new NoViableAltException(_t); } } } { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case SCOPE: { ruleScopeSpec(_t); _t = _retTree; break; } case BLOCK: case AMPERSAND: { break; } default: { throw new NoViableAltException(_t); } } } { _loop132: do { if (_t==null) _t=ASTNULL; if ((_t.getType()==AMPERSAND)) { GrammarAST tmp88_AST_in = (GrammarAST)_t; match(_t,AMPERSAND); _t = _t.getNextSibling(); } else { break _loop132; } } while (true); } AST __t133 = _t; GrammarAST tmp89_AST_in = (GrammarAST)_t; match(_t,BLOCK); _t = _t.getFirstChild(); { int _cnt137=0; _loop137: do { if (_t==null) _t=ASTNULL; if ((_t.getType()==ALT)) { AST __t135 = _t; GrammarAST tmp90_AST_in = (GrammarAST)_t; match(_t,ALT); _t = _t.getFirstChild(); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case BACKTRACK_SEMPRED: { GrammarAST tmp91_AST_in = (GrammarAST)_t; match(_t,BACKTRACK_SEMPRED); _t = _t.getNextSibling(); break; } case BLOCK: case CHAR_RANGE: case STRING_LITERAL: case CHAR_LITERAL: case TOKEN_REF: case NOT: { break; } default: { throw new NoViableAltException(_t); } } } testSetElement(_t); _t = _retTree; GrammarAST tmp92_AST_in = (GrammarAST)_t; match(_t,EOA); _t = _t.getNextSibling(); _t = __t135; _t = _t.getNextSibling(); } else { if ( _cnt137>=1 ) { break _loop137; } else {throw new NoViableAltException(_t);} } _cnt137++; } while (true); } GrammarAST tmp93_AST_in = (GrammarAST)_t; match(_t,EOB); _t = _t.getNextSibling(); _t = __t133; _t = _t.getNextSibling(); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case LITERAL_catch: case LITERAL_finally: { exceptionGroup(_t); _t = _retTree; break; } case EOR: { break; } default: { throw new NoViableAltException(_t); } } } GrammarAST tmp94_AST_in = (GrammarAST)_t; match(_t,EOR); _t = _t.getNextSibling(); _t = __t127; _t = _t.getNextSibling(); } catch (RecognitionException re) { throw re; } _retTree = _t; } public static final String[] _tokenNames = { "<0>", "EOF", "<2>", "NULL_TREE_LOOKAHEAD", "\"options\"", "\"tokens\"", "\"parser\"", "LEXER", "RULE", "BLOCK", "OPTIONAL", "CLOSURE", "POSITIVE_CLOSURE", "SYNPRED", "RANGE", "CHAR_RANGE", "EPSILON", "ALT", "EOR", "EOB", "EOA", "ID", "ARG", "ARGLIST", "RET", "LEXER_GRAMMAR", "PARSER_GRAMMAR", "TREE_GRAMMAR", "COMBINED_GRAMMAR", "INITACTION", "LABEL", "TEMPLATE", "\"scope\"", "GATED_SEMPRED", "SYN_SEMPRED", "BACKTRACK_SEMPRED", "\"fragment\"", "ACTION", "DOC_COMMENT", "SEMI", "\"lexer\"", "\"tree\"", "\"grammar\"", "AMPERSAND", "COLON", "RCURLY", "ASSIGN", "STRING_LITERAL", "CHAR_LITERAL", "INT", "STAR", "TOKEN_REF", "\"protected\"", "\"public\"", "\"private\"", "BANG", "ARG_ACTION", "\"returns\"", "\"throws\"", "COMMA", "LPAREN", "OR", "RPAREN", "\"catch\"", "\"finally\"", "PLUS_ASSIGN", "SEMPRED", "IMPLIES", "ROOT", "RULE_REF", "NOT", "TREE_BEGIN", "QUESTION", "PLUS", "WILDCARD", "REWRITE", "DOLLAR", "DOUBLE_QUOTE_STRING_LITERAL", "DOUBLE_ANGLE_STRING_LITERAL", "WS", "COMMENT", "SL_COMMENT", "ML_COMMENT", "OPEN_ELEMENT_OPTION", "CLOSE_ELEMENT_OPTION", "ESC", "DIGIT", "XDIGIT", "NESTED_ARG_ACTION", "NESTED_ACTION", "ACTION_CHAR_LITERAL", "ACTION_STRING_LITERAL", "ACTION_ESC", "WS_LOOP", "INTERNAL_RULE_REF", "WS_OPT", "SRC" }; private static final long[] mk_tokenSet_0() { long[] data = { 38773375610519040L, 1270L, 0L, 0L}; return data; } public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -