// $ANTLR start "rhtype" // AnnotationParser.g:129:1: rhtype : (param= STRING -> ^( RHTYPE $param) | param= STRING_LITERAL // -> ^( RHTYPE $param) | json ); public final AnnotationParser.rhtype_return rhtype() throws RecognitionException { AnnotationParser.rhtype_return retval = new AnnotationParser.rhtype_return(); retval.start = input.LT(1); AnnotationCommonTree root_0 = null; CommonToken param = null; AnnotationParser.json_return json27 = null; AnnotationCommonTree param_tree = null; RewriteRuleTokenStream stream_STRING_LITERAL = new RewriteRuleTokenStream(adaptor, "token STRING_LITERAL"); RewriteRuleTokenStream stream_STRING = new RewriteRuleTokenStream(adaptor, "token STRING"); try { // AnnotationParser.g:130:3: (param= STRING -> ^( RHTYPE $param) | param= STRING_LITERAL -> ^( // RHTYPE $param) | json ) int alt8 = 3; switch (input.LA(1)) { case STRING: { alt8 = 1; } break; case STRING_LITERAL: { alt8 = 2; } break; case JSON_START: { alt8 = 3; } break; default: NoViableAltException nvae = new NoViableAltException("", 8, 0, input); throw nvae; } switch (alt8) { case 1: // AnnotationParser.g:130:5: param= STRING { param = (CommonToken) match(input, STRING, FOLLOW_STRING_in_rhtype411); stream_STRING.add(param); // AST REWRITE // elements: param // token labels: param // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.tree = root_0; RewriteRuleTokenStream stream_param = new RewriteRuleTokenStream(adaptor, "token param", param); RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.tree : null); root_0 = (AnnotationCommonTree) adaptor.nil(); // 131:5: -> ^( RHTYPE $param) { // AnnotationParser.g:131:8: ^( RHTYPE $param) { AnnotationCommonTree root_1 = (AnnotationCommonTree) adaptor.nil(); root_1 = (AnnotationCommonTree) adaptor.becomeRoot( (AnnotationCommonTree) adaptor.create(RHTYPE, "RHTYPE"), root_1); adaptor.addChild(root_1, stream_param.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0; } break; case 2: // AnnotationParser.g:132:5: param= STRING_LITERAL { param = (CommonToken) match(input, STRING_LITERAL, FOLLOW_STRING_LITERAL_in_rhtype432); stream_STRING_LITERAL.add(param); // AST REWRITE // elements: param // token labels: param // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.tree = root_0; RewriteRuleTokenStream stream_param = new RewriteRuleTokenStream(adaptor, "token param", param); RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.tree : null); root_0 = (AnnotationCommonTree) adaptor.nil(); // 133:5: -> ^( RHTYPE $param) { // AnnotationParser.g:133:8: ^( RHTYPE $param) { AnnotationCommonTree root_1 = (AnnotationCommonTree) adaptor.nil(); root_1 = (AnnotationCommonTree) adaptor.becomeRoot( (AnnotationCommonTree) adaptor.create(RHTYPE, "RHTYPE"), root_1); adaptor.addChild(root_1, stream_param.nextNode()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0; } break; case 3: // AnnotationParser.g:134:5: json { root_0 = (AnnotationCommonTree) adaptor.nil(); pushFollow(FOLLOW_json_in_rhtype451); json27 = json(); state._fsp--; adaptor.addChild(root_0, json27.getTree()); } break; } retval.stop = input.LT(-1); retval.tree = (AnnotationCommonTree) adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } catch (RecognitionException re) { reportError(re); recover(input, re); retval.tree = (AnnotationCommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; }
// $ANTLR start "argument" // AnnotationParser.g:102:1: argument : ( literal_argument | named_argument | json ); public final AnnotationParser.argument_return argument() throws RecognitionException { AnnotationParser.argument_return retval = new AnnotationParser.argument_return(); retval.start = input.LT(1); AnnotationCommonTree root_0 = null; AnnotationParser.literal_argument_return literal_argument13 = null; AnnotationParser.named_argument_return named_argument14 = null; AnnotationParser.json_return json15 = null; try { // AnnotationParser.g:103:1: ( literal_argument | named_argument | json ) int alt5 = 3; switch (input.LA(1)) { case STRING_LITERAL: { alt5 = 1; } break; case STRING: { alt5 = 2; } break; case JSON_START: { alt5 = 3; } break; default: NoViableAltException nvae = new NoViableAltException("", 5, 0, input); throw nvae; } switch (alt5) { case 1: // AnnotationParser.g:103:3: literal_argument { root_0 = (AnnotationCommonTree) adaptor.nil(); pushFollow(FOLLOW_literal_argument_in_argument260); literal_argument13 = literal_argument(); state._fsp--; adaptor.addChild(root_0, literal_argument13.getTree()); } break; case 2: // AnnotationParser.g:103:22: named_argument { root_0 = (AnnotationCommonTree) adaptor.nil(); pushFollow(FOLLOW_named_argument_in_argument264); named_argument14 = named_argument(); state._fsp--; adaptor.addChild(root_0, named_argument14.getTree()); } break; case 3: // AnnotationParser.g:103:39: json { root_0 = (AnnotationCommonTree) adaptor.nil(); pushFollow(FOLLOW_json_in_argument268); json15 = json(); state._fsp--; adaptor.addChild(root_0, json15.getTree()); } break; } retval.stop = input.LT(-1); retval.tree = (AnnotationCommonTree) adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } catch (RecognitionException re) { reportError(re); recover(input, re); retval.tree = (AnnotationCommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; }
// $ANTLR start "json" // AnnotationParser.g:117:1: json : JSON_START ( json_arguments )? JSON_END ; public final AnnotationParser.json_return json() throws RecognitionException { AnnotationParser.json_return retval = new AnnotationParser.json_return(); retval.start = input.LT(1); AnnotationCommonTree root_0 = null; CommonToken JSON_START18 = null; CommonToken JSON_END20 = null; AnnotationParser.json_arguments_return json_arguments19 = null; AnnotationCommonTree JSON_START18_tree = null; AnnotationCommonTree JSON_END20_tree = null; try { // AnnotationParser.g:118:3: ( JSON_START ( json_arguments )? JSON_END ) // AnnotationParser.g:118:5: JSON_START ( json_arguments )? JSON_END { root_0 = (AnnotationCommonTree) adaptor.nil(); JSON_START18 = (CommonToken) match(input, JSON_START, FOLLOW_JSON_START_in_json342); JSON_START18_tree = (AnnotationCommonTree) adaptor.create(JSON_START18); adaptor.addChild(root_0, JSON_START18_tree); // AnnotationParser.g:118:16: ( json_arguments )? int alt6 = 2; int LA6_0 = input.LA(1); if ((LA6_0 == STRING_LITERAL)) { alt6 = 1; } switch (alt6) { case 1: // AnnotationParser.g:118:16: json_arguments { pushFollow(FOLLOW_json_arguments_in_json344); json_arguments19 = json_arguments(); state._fsp--; adaptor.addChild(root_0, json_arguments19.getTree()); } break; } JSON_END20 = (CommonToken) match(input, JSON_END, FOLLOW_JSON_END_in_json347); JSON_END20_tree = (AnnotationCommonTree) adaptor.create(JSON_END20); adaptor.addChild(root_0, JSON_END20_tree); } retval.stop = input.LT(-1); retval.tree = (AnnotationCommonTree) adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } catch (RecognitionException re) { reportError(re); recover(input, re); retval.tree = (AnnotationCommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; }