java-ast
Version:
Java Parser for JavaScript/TypeScript, based on antlr4ts
1,129 lines • 622 kB
JavaScript
"use strict";
// Generated from src/parser/JavaParser.g4 by ANTLR 4.9.0-SNAPSHOT
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LastFormalParameterContext = exports.FormalParameterContext = exports.FormalParameterListContext = exports.ReceiverParameterContext = exports.FormalParametersContext = exports.QualifiedNameListContext = exports.TypeArgumentContext = exports.ClassOrInterfaceTypeContext = exports.ArrayInitializerContext = exports.VariableInitializerContext = exports.VariableDeclaratorIdContext = exports.VariableDeclaratorContext = exports.VariableDeclaratorsContext = exports.InterfaceCommonBodyDeclarationContext = exports.GenericInterfaceMethodDeclarationContext = exports.InterfaceMethodModifierContext = exports.InterfaceMethodDeclarationContext = exports.ConstantDeclaratorContext = exports.ConstDeclarationContext = exports.InterfaceMemberDeclarationContext = exports.InterfaceBodyDeclarationContext = exports.FieldDeclarationContext = exports.CompactConstructorDeclarationContext = exports.ConstructorDeclarationContext = exports.GenericConstructorDeclarationContext = exports.GenericMethodDeclarationContext = exports.TypeTypeOrVoidContext = exports.MethodBodyContext = exports.MethodDeclarationContext = exports.MemberDeclarationContext = exports.ClassBodyDeclarationContext = exports.InterfaceBodyContext = exports.ClassBodyContext = exports.InterfaceDeclarationContext = exports.EnumBodyDeclarationsContext = exports.EnumConstantContext = exports.EnumConstantsContext = exports.EnumDeclarationContext = exports.TypeBoundContext = exports.TypeParameterContext = exports.TypeParametersContext = exports.ClassDeclarationContext = exports.VariableModifierContext = exports.ClassOrInterfaceModifierContext = exports.ModifierContext = exports.TypeDeclarationContext = exports.ImportDeclarationContext = exports.PackageDeclarationContext = exports.CompilationUnitContext = exports.JavaParser = void 0;
exports.MethodCallContext = exports.ExpressionListContext = exports.ParExpressionContext = exports.EnhancedForControlContext = exports.ForInitContext = exports.ForControlContext = exports.SwitchLabelContext = exports.SwitchBlockStatementGroupContext = exports.ResourceContext = exports.ResourcesContext = exports.ResourceSpecificationContext = exports.FinallyBlockContext = exports.CatchTypeContext = exports.CatchClauseContext = exports.StatementContext = exports.LocalTypeDeclarationContext = exports.TypeIdentifierContext = exports.IdentifierContext = exports.LocalVariableDeclarationContext = exports.BlockStatementContext = exports.BlockContext = exports.RecordBodyContext = exports.RecordComponentContext = exports.RecordComponentListContext = exports.RecordHeaderContext = exports.RecordDeclarationContext = exports.RequiresModifierContext = exports.ModuleDirectiveContext = exports.ModuleBodyContext = exports.ModuleDeclarationContext = exports.DefaultValueContext = exports.AnnotationConstantRestContext = exports.AnnotationMethodRestContext = exports.AnnotationMethodOrConstantRestContext = exports.AnnotationTypeElementRestContext = exports.AnnotationTypeElementDeclarationContext = exports.AnnotationTypeBodyContext = exports.AnnotationTypeDeclarationContext = exports.ElementValueArrayInitializerContext = exports.ElementValueContext = exports.ElementValuePairContext = exports.ElementValuePairsContext = exports.AnnotationContext = exports.AltAnnotationQualifiedNameContext = exports.FloatLiteralContext = exports.IntegerLiteralContext = exports.LiteralContext = exports.QualifiedNameContext = exports.LambdaLVTIParameterContext = exports.LambdaLVTIListContext = void 0;
exports.ArgumentsContext = exports.ExplicitGenericInvocationSuffixContext = exports.SuperSuffixContext = exports.TypeArgumentsContext = exports.PrimitiveTypeContext = exports.TypeTypeContext = exports.TypeListContext = exports.NonWildcardTypeArgumentsContext = exports.NonWildcardTypeArgumentsOrDiamondContext = exports.TypeArgumentsOrDiamondContext = exports.ExplicitGenericInvocationContext = exports.ClassCreatorRestContext = exports.ArrayCreatorRestContext = exports.InnerCreatorContext = exports.CreatedNameContext = exports.CreatorContext = exports.ClassTypeContext = exports.SwitchRuleOutcomeContext = exports.GuardedPatternContext = exports.SwitchLabeledRuleContext = exports.SwitchExpressionContext = exports.PrimaryContext = exports.LambdaBodyContext = exports.LambdaParametersContext = exports.LambdaExpressionContext = exports.PatternContext = exports.ExpressionContext = void 0;
const ATN_1 = require("antlr4ts/atn/ATN");
const ATNDeserializer_1 = require("antlr4ts/atn/ATNDeserializer");
const FailedPredicateException_1 = require("antlr4ts/FailedPredicateException");
const NoViableAltException_1 = require("antlr4ts/NoViableAltException");
const Parser_1 = require("antlr4ts/Parser");
const ParserRuleContext_1 = require("antlr4ts/ParserRuleContext");
const ParserATNSimulator_1 = require("antlr4ts/atn/ParserATNSimulator");
const RecognitionException_1 = require("antlr4ts/RecognitionException");
const Token_1 = require("antlr4ts/Token");
const VocabularyImpl_1 = require("antlr4ts/VocabularyImpl");
const Utils = __importStar(require("antlr4ts/misc/Utils"));
class JavaParser extends Parser_1.Parser {
// @Override
// @NotNull
get vocabulary() {
return JavaParser.VOCABULARY;
}
// tslint:enable:no-trailing-whitespace
// @Override
get grammarFileName() { return "JavaParser.g4"; }
// @Override
get ruleNames() { return JavaParser.ruleNames; }
// @Override
get serializedATN() { return JavaParser._serializedATN; }
createFailedPredicateException(predicate, message) {
return new FailedPredicateException_1.FailedPredicateException(this, predicate, message);
}
constructor(input) {
super(input);
this._interp = new ParserATNSimulator_1.ParserATNSimulator(JavaParser._ATN, this);
}
// @RuleVersion(0)
compilationUnit() {
let _localctx = new CompilationUnitContext(this._ctx, this.state);
this.enterRule(_localctx, 0, JavaParser.RULE_compilationUnit);
let _la;
try {
let _alt;
this.state = 272;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 5, this._ctx)) {
case 1:
this.enterOuterAlt(_localctx, 1);
{
this.state = 253;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 0, this._ctx)) {
case 1:
{
this.state = 252;
this.packageDeclaration();
}
break;
}
this.state = 259;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 2, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
this.state = 257;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case JavaParser.IMPORT:
{
this.state = 255;
this.importDeclaration();
}
break;
case JavaParser.SEMI:
{
this.state = 256;
this.match(JavaParser.SEMI);
}
break;
default:
throw new NoViableAltException_1.NoViableAltException(this);
}
}
}
this.state = 261;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 2, this._ctx);
}
this.state = 266;
this._errHandler.sync(this);
_la = this._input.LA(1);
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << JavaParser.ABSTRACT) | (1 << JavaParser.CLASS) | (1 << JavaParser.ENUM) | (1 << JavaParser.FINAL) | (1 << JavaParser.INTERFACE))) !== 0) || ((((_la - 33)) & ~0x1F) === 0 && ((1 << (_la - 33)) & ((1 << (JavaParser.PRIVATE - 33)) | (1 << (JavaParser.PROTECTED - 33)) | (1 << (JavaParser.PUBLIC - 33)) | (1 << (JavaParser.STATIC - 33)) | (1 << (JavaParser.STRICTFP - 33)) | (1 << (JavaParser.MODULE - 33)) | (1 << (JavaParser.OPEN - 33)) | (1 << (JavaParser.REQUIRES - 33)) | (1 << (JavaParser.EXPORTS - 33)) | (1 << (JavaParser.OPENS - 33)) | (1 << (JavaParser.TO - 33)) | (1 << (JavaParser.USES - 33)) | (1 << (JavaParser.PROVIDES - 33)) | (1 << (JavaParser.WITH - 33)) | (1 << (JavaParser.TRANSITIVE - 33)) | (1 << (JavaParser.VAR - 33)) | (1 << (JavaParser.YIELD - 33)) | (1 << (JavaParser.RECORD - 33)) | (1 << (JavaParser.SEALED - 33)))) !== 0) || ((((_la - 65)) & ~0x1F) === 0 && ((1 << (_la - 65)) & ((1 << (JavaParser.PERMITS - 65)) | (1 << (JavaParser.NON_SEALED - 65)) | (1 << (JavaParser.SEMI - 65)))) !== 0) || _la === JavaParser.AT || _la === JavaParser.IDENTIFIER) {
{
this.state = 264;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case JavaParser.ABSTRACT:
case JavaParser.CLASS:
case JavaParser.ENUM:
case JavaParser.FINAL:
case JavaParser.INTERFACE:
case JavaParser.PRIVATE:
case JavaParser.PROTECTED:
case JavaParser.PUBLIC:
case JavaParser.STATIC:
case JavaParser.STRICTFP:
case JavaParser.MODULE:
case JavaParser.OPEN:
case JavaParser.REQUIRES:
case JavaParser.EXPORTS:
case JavaParser.OPENS:
case JavaParser.TO:
case JavaParser.USES:
case JavaParser.PROVIDES:
case JavaParser.WITH:
case JavaParser.TRANSITIVE:
case JavaParser.VAR:
case JavaParser.YIELD:
case JavaParser.RECORD:
case JavaParser.SEALED:
case JavaParser.PERMITS:
case JavaParser.NON_SEALED:
case JavaParser.AT:
case JavaParser.IDENTIFIER:
{
this.state = 262;
this.typeDeclaration();
}
break;
case JavaParser.SEMI:
{
this.state = 263;
this.match(JavaParser.SEMI);
}
break;
default:
throw new NoViableAltException_1.NoViableAltException(this);
}
}
this.state = 268;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
}
break;
case 2:
this.enterOuterAlt(_localctx, 2);
{
this.state = 269;
this.moduleDeclaration();
this.state = 270;
this.match(JavaParser.EOF);
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
packageDeclaration() {
let _localctx = new PackageDeclarationContext(this._ctx, this.state);
this.enterRule(_localctx, 2, JavaParser.RULE_packageDeclaration);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 277;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (((((_la - 51)) & ~0x1F) === 0 && ((1 << (_la - 51)) & ((1 << (JavaParser.MODULE - 51)) | (1 << (JavaParser.OPEN - 51)) | (1 << (JavaParser.REQUIRES - 51)) | (1 << (JavaParser.EXPORTS - 51)) | (1 << (JavaParser.OPENS - 51)) | (1 << (JavaParser.TO - 51)) | (1 << (JavaParser.USES - 51)) | (1 << (JavaParser.PROVIDES - 51)) | (1 << (JavaParser.WITH - 51)) | (1 << (JavaParser.TRANSITIVE - 51)) | (1 << (JavaParser.VAR - 51)) | (1 << (JavaParser.YIELD - 51)) | (1 << (JavaParser.RECORD - 51)) | (1 << (JavaParser.SEALED - 51)) | (1 << (JavaParser.PERMITS - 51)))) !== 0) || _la === JavaParser.AT || _la === JavaParser.IDENTIFIER) {
{
{
this.state = 274;
this.annotation();
}
}
this.state = 279;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 280;
this.match(JavaParser.PACKAGE);
this.state = 281;
this.qualifiedName();
this.state = 282;
this.match(JavaParser.SEMI);
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
importDeclaration() {
let _localctx = new ImportDeclarationContext(this._ctx, this.state);
this.enterRule(_localctx, 4, JavaParser.RULE_importDeclaration);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 284;
this.match(JavaParser.IMPORT);
this.state = 286;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.STATIC) {
{
this.state = 285;
this.match(JavaParser.STATIC);
}
}
this.state = 288;
this.qualifiedName();
this.state = 291;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.DOT) {
{
this.state = 289;
this.match(JavaParser.DOT);
this.state = 290;
this.match(JavaParser.MUL);
}
}
this.state = 293;
this.match(JavaParser.SEMI);
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
typeDeclaration() {
let _localctx = new TypeDeclarationContext(this._ctx, this.state);
this.enterRule(_localctx, 6, JavaParser.RULE_typeDeclaration);
try {
let _alt;
this.enterOuterAlt(_localctx, 1);
{
this.state = 298;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 9, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 295;
this.classOrInterfaceModifier();
}
}
}
this.state = 300;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 9, this._ctx);
}
this.state = 306;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case JavaParser.CLASS:
{
this.state = 301;
this.classDeclaration();
}
break;
case JavaParser.ENUM:
{
this.state = 302;
this.enumDeclaration();
}
break;
case JavaParser.INTERFACE:
{
this.state = 303;
this.interfaceDeclaration();
}
break;
case JavaParser.AT:
{
this.state = 304;
this.annotationTypeDeclaration();
}
break;
case JavaParser.RECORD:
{
this.state = 305;
this.recordDeclaration();
}
break;
default:
throw new NoViableAltException_1.NoViableAltException(this);
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
modifier() {
let _localctx = new ModifierContext(this._ctx, this.state);
this.enterRule(_localctx, 8, JavaParser.RULE_modifier);
try {
this.state = 313;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case JavaParser.ABSTRACT:
case JavaParser.FINAL:
case JavaParser.PRIVATE:
case JavaParser.PROTECTED:
case JavaParser.PUBLIC:
case JavaParser.STATIC:
case JavaParser.STRICTFP:
case JavaParser.MODULE:
case JavaParser.OPEN:
case JavaParser.REQUIRES:
case JavaParser.EXPORTS:
case JavaParser.OPENS:
case JavaParser.TO:
case JavaParser.USES:
case JavaParser.PROVIDES:
case JavaParser.WITH:
case JavaParser.TRANSITIVE:
case JavaParser.VAR:
case JavaParser.YIELD:
case JavaParser.RECORD:
case JavaParser.SEALED:
case JavaParser.PERMITS:
case JavaParser.NON_SEALED:
case JavaParser.AT:
case JavaParser.IDENTIFIER:
this.enterOuterAlt(_localctx, 1);
{
this.state = 308;
this.classOrInterfaceModifier();
}
break;
case JavaParser.NATIVE:
this.enterOuterAlt(_localctx, 2);
{
this.state = 309;
this.match(JavaParser.NATIVE);
}
break;
case JavaParser.SYNCHRONIZED:
this.enterOuterAlt(_localctx, 3);
{
this.state = 310;
this.match(JavaParser.SYNCHRONIZED);
}
break;
case JavaParser.TRANSIENT:
this.enterOuterAlt(_localctx, 4);
{
this.state = 311;
this.match(JavaParser.TRANSIENT);
}
break;
case JavaParser.VOLATILE:
this.enterOuterAlt(_localctx, 5);
{
this.state = 312;
this.match(JavaParser.VOLATILE);
}
break;
default:
throw new NoViableAltException_1.NoViableAltException(this);
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
classOrInterfaceModifier() {
let _localctx = new ClassOrInterfaceModifierContext(this._ctx, this.state);
this.enterRule(_localctx, 10, JavaParser.RULE_classOrInterfaceModifier);
try {
this.state = 325;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 12, this._ctx)) {
case 1:
this.enterOuterAlt(_localctx, 1);
{
this.state = 315;
this.annotation();
}
break;
case 2:
this.enterOuterAlt(_localctx, 2);
{
this.state = 316;
this.match(JavaParser.PUBLIC);
}
break;
case 3:
this.enterOuterAlt(_localctx, 3);
{
this.state = 317;
this.match(JavaParser.PROTECTED);
}
break;
case 4:
this.enterOuterAlt(_localctx, 4);
{
this.state = 318;
this.match(JavaParser.PRIVATE);
}
break;
case 5:
this.enterOuterAlt(_localctx, 5);
{
this.state = 319;
this.match(JavaParser.STATIC);
}
break;
case 6:
this.enterOuterAlt(_localctx, 6);
{
this.state = 320;
this.match(JavaParser.ABSTRACT);
}
break;
case 7:
this.enterOuterAlt(_localctx, 7);
{
this.state = 321;
this.match(JavaParser.FINAL);
}
break;
case 8:
this.enterOuterAlt(_localctx, 8);
{
this.state = 322;
this.match(JavaParser.STRICTFP);
}
break;
case 9:
this.enterOuterAlt(_localctx, 9);
{
this.state = 323;
this.match(JavaParser.SEALED);
}
break;
case 10:
this.enterOuterAlt(_localctx, 10);
{
this.state = 324;
this.match(JavaParser.NON_SEALED);
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
variableModifier() {
let _localctx = new VariableModifierContext(this._ctx, this.state);
this.enterRule(_localctx, 12, JavaParser.RULE_variableModifier);
try {
this.state = 329;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case JavaParser.FINAL:
this.enterOuterAlt(_localctx, 1);
{
this.state = 327;
this.match(JavaParser.FINAL);
}
break;
case JavaParser.MODULE:
case JavaParser.OPEN:
case JavaParser.REQUIRES:
case JavaParser.EXPORTS:
case JavaParser.OPENS:
case JavaParser.TO:
case JavaParser.USES:
case JavaParser.PROVIDES:
case JavaParser.WITH:
case JavaParser.TRANSITIVE:
case JavaParser.VAR:
case JavaParser.YIELD:
case JavaParser.RECORD:
case JavaParser.SEALED:
case JavaParser.PERMITS:
case JavaParser.AT:
case JavaParser.IDENTIFIER:
this.enterOuterAlt(_localctx, 2);
{
this.state = 328;
this.annotation();
}
break;
default:
throw new NoViableAltException_1.NoViableAltException(this);
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
classDeclaration() {
let _localctx = new ClassDeclarationContext(this._ctx, this.state);
this.enterRule(_localctx, 14, JavaParser.RULE_classDeclaration);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 331;
this.match(JavaParser.CLASS);
this.state = 332;
this.identifier();
this.state = 334;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.LT) {
{
this.state = 333;
this.typeParameters();
}
}
this.state = 338;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.EXTENDS) {
{
this.state = 336;
this.match(JavaParser.EXTENDS);
this.state = 337;
this.typeType();
}
}
this.state = 342;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.IMPLEMENTS) {
{
this.state = 340;
this.match(JavaParser.IMPLEMENTS);
this.state = 341;
this.typeList();
}
}
this.state = 346;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.PERMITS) {
{
this.state = 344;
this.match(JavaParser.PERMITS);
this.state = 345;
this.typeList();
}
}
this.state = 348;
this.classBody();
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
typeParameters() {
let _localctx = new TypeParametersContext(this._ctx, this.state);
this.enterRule(_localctx, 16, JavaParser.RULE_typeParameters);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 350;
this.match(JavaParser.LT);
this.state = 351;
this.typeParameter();
this.state = 356;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === JavaParser.COMMA) {
{
{
this.state = 352;
this.match(JavaParser.COMMA);
this.state = 353;
this.typeParameter();
}
}
this.state = 358;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 359;
this.match(JavaParser.GT);
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
typeParameter() {
let _localctx = new TypeParameterContext(this._ctx, this.state);
this.enterRule(_localctx, 18, JavaParser.RULE_typeParameter);
let _la;
try {
let _alt;
this.enterOuterAlt(_localctx, 1);
{
this.state = 364;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 19, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 361;
this.annotation();
}
}
}
this.state = 366;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 19, this._ctx);
}
this.state = 367;
this.identifier();
this.state = 376;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.EXTENDS) {
{
this.state = 368;
this.match(JavaParser.EXTENDS);
this.state = 372;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 20, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 369;
this.annotation();
}
}
}
this.state = 374;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 20, this._ctx);
}
this.state = 375;
this.typeBound();
}
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
typeBound() {
let _localctx = new TypeBoundContext(this._ctx, this.state);
this.enterRule(_localctx, 20, JavaParser.RULE_typeBound);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 378;
this.typeType();
this.state = 383;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === JavaParser.BITAND) {
{
{
this.state = 379;
this.match(JavaParser.BITAND);
this.state = 380;
this.typeType();
}
}
this.state = 385;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
enumDeclaration() {
let _localctx = new EnumDeclarationContext(this._ctx, this.state);
this.enterRule(_localctx, 22, JavaParser.RULE_enumDeclaration);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 386;
this.match(JavaParser.ENUM);
this.state = 387;
this.identifier();
this.state = 390;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.IMPLEMENTS) {
{
this.state = 388;
this.match(JavaParser.IMPLEMENTS);
this.state = 389;
this.typeList();
}
}
this.state = 392;
this.match(JavaParser.LBRACE);
this.state = 394;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (((((_la - 51)) & ~0x1F) === 0 && ((1 << (_la - 51)) & ((1 << (JavaParser.MODULE - 51)) | (1 << (JavaParser.OPEN - 51)) | (1 << (JavaParser.REQUIRES - 51)) | (1 << (JavaParser.EXPORTS - 51)) | (1 << (JavaParser.OPENS - 51)) | (1 << (JavaParser.TO - 51)) | (1 << (JavaParser.USES - 51)) | (1 << (JavaParser.PROVIDES - 51)) | (1 << (JavaParser.WITH - 51)) | (1 << (JavaParser.TRANSITIVE - 51)) | (1 << (JavaParser.VAR - 51)) | (1 << (JavaParser.YIELD - 51)) | (1 << (JavaParser.RECORD - 51)) | (1 << (JavaParser.SEALED - 51)) | (1 << (JavaParser.PERMITS - 51)))) !== 0) || _la === JavaParser.AT || _la === JavaParser.IDENTIFIER) {
{
this.state = 393;
this.enumConstants();
}
}
this.state = 397;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.COMMA) {
{
this.state = 396;
this.match(JavaParser.COMMA);
}
}
this.state = 400;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.SEMI) {
{
this.state = 399;
this.enumBodyDeclarations();
}
}
this.state = 402;
this.match(JavaParser.RBRACE);
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
enumConstants() {
let _localctx = new EnumConstantsContext(this._ctx, this.state);
this.enterRule(_localctx, 24, JavaParser.RULE_enumConstants);
try {
let _alt;
this.enterOuterAlt(_localctx, 1);
{
this.state = 404;
this.enumConstant();
this.state = 409;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 27, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 405;
this.match(JavaParser.COMMA);
this.state = 406;
this.enumConstant();
}
}
}
this.state = 411;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 27, this._ctx);
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
enumConstant() {
let _localctx = new EnumConstantContext(this._ctx, this.state);
this.enterRule(_localctx, 26, JavaParser.RULE_enumConstant);
let _la;
try {
let _alt;
this.enterOuterAlt(_localctx, 1);
{
this.state = 415;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 28, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 412;
this.annotation();
}
}
}
this.state = 417;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 28, this._ctx);
}
this.state = 418;
this.identifier();
this.state = 420;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.LPAREN) {
{
this.state = 419;
this.arguments();
}
}
this.state = 423;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.LBRACE) {
{
this.state = 422;
this.classBody();
}
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
enumBodyDeclarations() {
let _localctx = new EnumBodyDeclarationsContext(this._ctx, this.state);
this.enterRule(_localctx, 28, JavaParser.RULE_enumBodyDeclarations);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 425;
this.match(JavaParser.SEMI);
this.state = 429;
this._errHandler.sync(this);
_la = this._input.LA(1);
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << JavaParser.ABSTRACT) | (1 << JavaParser.BOOLEAN) | (1 << JavaParser.BYTE) | (1 << JavaParser.CHAR) | (1 << JavaParser.CLASS) | (1 << JavaParser.DOUBLE) | (1 << JavaParser.ENUM) | (1 << JavaParser.FINAL) | (1 << JavaParser.FLOAT) | (1 << JavaParser.INT) | (1 << JavaParser.INTERFACE) | (1 << JavaParser.LONG) | (1 << JavaParser.NATIVE))) !== 0) || ((((_la - 33)) & ~0x1F) === 0 && ((1 << (_la - 33)) & ((1 << (JavaParser.PRIVATE - 33)) | (1 << (JavaParser.PROTECTED - 33)) | (1 << (JavaParser.PUBLIC - 33)) | (1 << (JavaParser.SHORT - 33)) | (1 << (JavaParser.STATIC - 33)) | (1 << (JavaParser.STRICTFP - 33)) | (1 << (JavaParser.SYNCHRONIZED - 33)) | (1 << (JavaParser.TRANSIENT - 33)) | (1 << (JavaParser.VOID - 33)) | (1 << (JavaParser.VOLATILE - 33)) | (1 << (JavaParser.MODULE - 33)) | (1 << (JavaParser.OPEN - 33)) | (1 << (JavaParser.REQUIRES - 33)) | (1 << (JavaParser.EXPORTS - 33)) | (1 << (JavaParser.OPENS - 33)) | (1 << (JavaParser.TO - 33)) | (1 << (JavaParser.USES - 33)) | (1 << (JavaParser.PROVIDES - 33)) | (1 << (JavaParser.WITH - 33)) | (1 << (JavaParser.TRANSITIVE - 33)) | (1 << (JavaParser.VAR - 33)) | (1 << (JavaParser.YIELD - 33)) | (1 << (JavaParser.RECORD - 33)) | (1 << (JavaParser.SEALED - 33)))) !== 0) || ((((_la - 65)) & ~0x1F) === 0 && ((1 << (_la - 65)) & ((1 << (JavaParser.PERMITS - 65)) | (1 << (JavaParser.NON_SEALED - 65)) | (1 << (JavaParser.LBRACE - 65)) | (1 << (JavaParser.SEMI - 65)) | (1 << (JavaParser.LT - 65)))) !== 0) || _la === JavaParser.AT || _la === JavaParser.IDENTIFIER) {
{
{
this.state = 426;
this.classBodyDeclaration();
}
}
this.state = 431;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
interfaceDeclaration() {
let _localctx = new InterfaceDeclarationContext(this._ctx, this.state);
this.enterRule(_localctx, 30, JavaParser.RULE_interfaceDeclaration);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 432;
this.match(JavaParser.INTERFACE);
this.state = 433;
this.identifier();
this.state = 435;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.LT) {
{
this.state = 434;
this.typeParameters();
}
}
this.state = 439;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.EXTENDS) {
{
this.state = 437;
this.match(JavaParser.EXTENDS);
this.state = 438;
this.typeList();
}
}
this.state = 443;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === JavaParser.PERMITS) {
{
this.state = 441;
this.match(JavaParser.PERMITS);
this.state = 442;
this.typeList();
}
}
this.state = 445;
this.interfaceBody();
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
classBody() {
let _localctx = new ClassBodyContext(this._ctx, this.state);
this.enterRule(_localctx, 32, JavaParser.RULE_classBody);
let _la;
try {
this.ente