📄 antlrparser.java
字号:
case ACTION:
{
a = LT(1);
match(ACTION);
if ( inputState.guessing==0 ) {
behavior.refInitAction(a);
}
break;
}
case COLON:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
match(COLON);
block();
match(SEMI);
{
switch ( LA(1)) {
case LITERAL_exception:
{
exceptionGroup();
break;
}
case EOF:
case ACTION:
case DOC_COMMENT:
case LITERAL_lexclass:
case LITERAL_class:
case TOKEN_REF:
case RULE_REF:
case LITERAL_protected:
case LITERAL_public:
case LITERAL_private:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
if ( inputState.guessing==0 ) {
behavior.endRule(idTok.getText());
}
}
public final void throwsSpec() throws RecognitionException, TokenStreamException {
String t=null;
Token a,b;
match(LITERAL_throws);
a=id();
if ( inputState.guessing==0 ) {
t=a.getText();
}
{
_loop84:
do {
if ((LA(1)==COMMA)) {
match(COMMA);
b=id();
if ( inputState.guessing==0 ) {
t+=","+b.getText();
}
}
else {
break _loop84;
}
} while (true);
}
if ( inputState.guessing==0 ) {
behavior.setUserExceptions(t);
}
}
public final void ruleOptionsSpec() throws RecognitionException, TokenStreamException {
Token idTok; Token value;
match(OPTIONS);
{
_loop81:
do {
if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF)) {
idTok=id();
match(ASSIGN);
value=optionValue();
if ( inputState.guessing==0 ) {
behavior.setRuleOption(idTok, value);
}
match(SEMI);
}
else {
break _loop81;
}
} while (true);
}
match(RCURLY);
}
public final void block() throws RecognitionException, TokenStreamException {
if ( inputState.guessing==0 ) {
blockNesting++;
}
alternative();
{
_loop87:
do {
if ((LA(1)==OR)) {
match(OR);
alternative();
}
else {
break _loop87;
}
} while (true);
}
if ( inputState.guessing==0 ) {
blockNesting--;
}
}
public final void exceptionGroup() throws RecognitionException, TokenStreamException {
if ( inputState.guessing==0 ) {
behavior.beginExceptionGroup();
}
{
int _cnt95=0;
_loop95:
do {
if ((LA(1)==LITERAL_exception)) {
exceptionSpec();
}
else {
if ( _cnt95>=1 ) { break _loop95; } else {throw new NoViableAltException(LT(1), getFilename());}
}
_cnt95++;
} while (true);
}
if ( inputState.guessing==0 ) {
behavior.endExceptionGroup();
}
}
public final void alternative() throws RecognitionException, TokenStreamException {
boolean altAutoGen = true;
{
switch ( LA(1)) {
case BANG:
{
match(BANG);
if ( inputState.guessing==0 ) {
altAutoGen=false;
}
break;
}
case STRING_LITERAL:
case ACTION:
case SEMI:
case CHAR_LITERAL:
case OR:
case TOKEN_REF:
case LPAREN:
case RULE_REF:
case RPAREN:
case LITERAL_exception:
case NOT_OP:
case SEMPRED:
case TREE_BEGIN:
case WILDCARD:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
if ( inputState.guessing==0 ) {
behavior.beginAlt(altAutoGen);
}
{
_loop91:
do {
if ((_tokenSet_2.member(LA(1)))) {
element();
}
else {
break _loop91;
}
} while (true);
}
{
switch ( LA(1)) {
case LITERAL_exception:
{
exceptionSpecNoLabel();
break;
}
case SEMI:
case OR:
case RPAREN:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
if ( inputState.guessing==0 ) {
behavior.endAlt();
}
}
public final void element() throws RecognitionException, TokenStreamException {
elementNoOptionSpec();
{
switch ( LA(1)) {
case OPEN_ELEMENT_OPTION:
{
elementOptionSpec();
break;
}
case STRING_LITERAL:
case ACTION:
case SEMI:
case CHAR_LITERAL:
case OR:
case TOKEN_REF:
case LPAREN:
case RULE_REF:
case RPAREN:
case LITERAL_exception:
case NOT_OP:
case SEMPRED:
case TREE_BEGIN:
case WILDCARD:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
}
public final void exceptionSpecNoLabel() throws RecognitionException, TokenStreamException {
match(LITERAL_exception);
if ( inputState.guessing==0 ) {
behavior.beginExceptionSpec(null);
}
{
_loop102:
do {
if ((LA(1)==LITERAL_catch)) {
exceptionHandler();
}
else {
break _loop102;
}
} while (true);
}
if ( inputState.guessing==0 ) {
behavior.endExceptionSpec();
}
}
public final void exceptionSpec() throws RecognitionException, TokenStreamException {
Token aa = null;
Token labelAction = null;
match(LITERAL_exception);
{
switch ( LA(1)) {
case ARG_ACTION:
{
aa = LT(1);
match(ARG_ACTION);
if ( inputState.guessing==0 ) {
labelAction = aa;
}
break;
}
case EOF:
case ACTION:
case DOC_COMMENT:
case LITERAL_lexclass:
case LITERAL_class:
case TOKEN_REF:
case RULE_REF:
case LITERAL_protected:
case LITERAL_public:
case LITERAL_private:
case LITERAL_exception:
case LITERAL_catch:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
if ( inputState.guessing==0 ) {
behavior.beginExceptionSpec(labelAction);
}
{
_loop99:
do {
if ((LA(1)==LITERAL_catch)) {
exceptionHandler();
}
else {
break _loop99;
}
} while (true);
}
if ( inputState.guessing==0 ) {
behavior.endExceptionSpec();
}
}
public final void exceptionHandler() throws RecognitionException, TokenStreamException {
Token a1 = null;
Token a2 = null;
Token exType; Token exName;
match(LITERAL_catch);
a1 = LT(1);
match(ARG_ACTION);
a2 = LT(1);
match(ACTION);
if ( inputState.guessing==0 ) {
behavior.refExceptionHandler(a1, a2);
}
}
public final void elementNoOptionSpec() throws RecognitionException, TokenStreamException {
Token rr = null;
Token aa = null;
Token tr = null;
Token aa2 = null;
Token r2 = null;
Token aa3 = null;
Token a = null;
Token p = null;
Token label = null;
Token assignId = null;
Token args = null;
int autoGen = GrammarElement.AUTO_GEN_NONE;
switch ( LA(1)) {
case ACTION:
{
a = LT(1);
match(ACTION);
if ( inputState.guessing==0 ) {
behavior.refAction(a);
}
break;
}
case SEMPRED:
{
p = LT(1);
match(SEMPRED);
if ( inputState.guessing==0 ) {
behavior.refSemPred(p);
}
break;
}
case TREE_BEGIN:
{
tree();
break;
}
default:
if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF) && (LA(2)==ASSIGN)) {
assignId=id();
match(ASSIGN);
{
if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF) && (LA(2)==COLON)) {
label=id();
match(COLON);
if ( inputState.guessing==0 ) {
checkForMissingEndRule(label);
}
}
else if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF) && (_tokenSet_3.member(LA(2)))) {
}
else {
throw new NoViableAltException(LT(1), getFilename());
}
}
{
switch ( LA(1)) {
case RULE_REF:
{
rr = LT(1);
match(RULE_REF);
{
switch ( LA(1)) {
case ARG_ACTION:
{
aa = LT(1);
match(ARG_ACTION);
if ( inputState.guessing==0 ) {
args=aa;
}
break;
}
case STRING_LITERAL:
case ACTION:
case SEMI:
case CHAR_LITERAL:
case OR:
case TOKEN_REF:
case OPEN_ELEMENT_OPTION:
case LPAREN:
case RULE_REF:
case RPAREN:
case BANG:
case LITERAL_exception:
case NOT_OP:
case SEMPRED:
case TREE_BEGIN:
case WILDCARD:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
{
switch ( LA(1)) {
case BANG:
{
match(BANG);
if ( inputState.guessing==0 ) {
autoGen = GrammarElement.AUTO_GEN_BANG;
}
break;
}
case STRING_LITERAL:
case ACTION:
case SEMI:
case CHAR_LITERAL:
case OR:
case TOKEN_REF:
case OPEN_ELEMENT_OPTION:
case LPAREN:
case RULE_REF:
case RPAREN:
case LITERAL_exception:
case NOT_OP:
case SEMPRED:
case TREE_BEGIN:
case WILDCARD:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
if ( inputState.guessing==0 ) {
behavior.refRule(assignId, rr, label, args, autoGen);
}
break;
}
case TOKEN_REF:
{
tr = LT(1);
match(TOKEN_REF);
{
switch ( LA(1)) {
case ARG_ACTION:
{
aa2 = LT(1);
match(ARG_ACTION);
if ( inputState.guessing==0 ) {
args=aa2;
}
break;
}
case STRING_LITERAL:
case ACTION:
case SEMI:
case CHAR_LITERAL:
case OR:
case TOKEN_REF:
case OPEN_ELEMENT_OPTION:
case LPAREN:
case RULE_REF:
case RPAREN:
case LITERAL_exception:
case NOT_OP:
case SEMPRED:
case TREE_BEGIN:
case WILDCARD:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
if ( inputState.guessing==0 ) {
behavior.refToken(assignId, tr, label, args, false, autoGen, lastInRule());
}
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
}
else if ((_tokenSet_4.member(LA(1))) && (_tokenSet_5.member(LA(2)))) {
{
if ((LA(1)==TOKEN_REF||LA(1)==RULE_REF) && (LA(2)==COLON)) {
label=id();
match(COLON);
if ( inputState.guessing==0 ) {
checkForMissingEndRule(label);
}
}
else if ((_tokenSet_4.member(LA(1))) && (_tokenSet_6.member(LA(2)))) {
}
else {
throw new NoViableAltException(LT(1), getFilename());
}
}
{
switch ( LA(1)) {
case RULE_REF:
{
r2 = LT(1);
match(RULE_REF);
{
switch ( LA(1)) {
case ARG_ACTION:
{
aa3 = LT(1);
match(ARG_ACTION);
if ( inputState.guessing==0 ) {
args=aa3;
}
break;
}
case STRING_LITERAL:
case ACTION:
case SEMI:
case CHAR_LITERAL:
case OR:
case TOKEN_REF:
case OPEN_ELEMENT_OPTION:
case LPAREN:
case RULE_REF:
case RPAREN:
case BANG:
case LITERAL_exception:
case NOT_OP:
case SEMPRED:
case TREE_BEGIN:
case WILDCARD:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
{
switch ( LA(1)) {
case BANG:
{
match(BANG);
if ( inputState.guessing==0 ) {
autoGen = GrammarElement.AUTO_GEN_BANG;
}
break;
}
case STRING_LITERAL:
case ACTION:
case SEMI:
case CHAR_LITERAL:
case OR:
case TOKEN_REF:
case OPEN_ELEMENT_OPTION:
case LPAREN:
case RULE_REF:
case RPAREN:
case LITERAL_exception:
case NOT_OP:
case SEMPRED:
case TREE_BEGIN:
case WILDCARD:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
if ( inputState.guessing==0 ) {
behavior.refRule(assignId, r2, label, args, autoGen);
}
break;
}
case NOT_OP:
{
match(NOT_OP);
{
switch ( LA(1)) {
case CHAR_LITERAL:
case TOKEN_REF:
{
notTerminal(label);
break;
}
case LPAREN:
{
ebnf(label,true);
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
break;
}
case LPAREN:
{
ebnf(label,false);
break;
}
default:
if ((LA(1)==STRING_LITERAL||LA(1)==CHAR_LITERAL||LA(1)==TOKEN_REF) && (LA(2)==RANGE)) {
range(label);
}
else if ((_tokenSet_7.member(LA(1))) && (_tokenSet_8.member(LA(2)))) {
terminal(label);
}
else {
throw new NoViableAltException(LT(1), getFilename());
}
}
}
}
else {
throw new NoViableAltException(LT(1), getFilename());
}
}
}
public final void elementOptionSpec() throws RecognitionException, TokenStreamException {
Token o=null, v=null;
match(OPEN_ELEMENT_OPTION);
o=id();
match(ASSIGN);
v=optionValue();
if ( inputState.guessing==0 ) {
behavior.refElementOption(o,v);
}
{
_loop108:
do {
if ((LA(1)==SEMI)) {
match(SEMI);
o=id();
match(ASSIGN);
v=optionValue();
if ( inputState.guessing==0 ) {
behavior.refElementOption(o,v);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -