@amplitude/ampli
Version:
Amplitude CLI
920 lines (919 loc) • 956 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IdentifierContext = exports.SimpleIdentifierContext = exports.UnescapedAnnotationContext = exports.AnnotationUseSiteTargetContext = exports.MultiAnnotationContext = exports.SingleAnnotationContext = exports.AnnotationContext = exports.PlatformModifierContext = exports.ReificationModifierContext = exports.ParameterModifierContext = exports.InheritanceModifierContext = exports.PropertyModifierContext = exports.FunctionModifierContext = exports.TypeParameterModifierContext = exports.TypeParameterModifiersContext = exports.VarianceModifierContext = exports.VisibilityModifierContext = exports.MemberModifierContext = exports.ClassModifierContext = exports.TypeModifierContext = exports.TypeModifiersContext = exports.ModifierContext = exports.ParameterModifiersContext = exports.ModifiersContext = exports.SafeNavContext = exports.MemberAccessOperatorContext = exports.ExclContext = exports.PostfixUnaryOperatorContext = exports.PrefixUnaryOperatorContext = exports.AsOperatorContext = exports.MultiplicativeOperatorContext = exports.AdditiveOperatorContext = exports.IsOperatorContext = exports.InOperatorContext = exports.ComparisonOperatorContext = exports.EqualityOperatorContext = exports.AssignmentAndOperatorContext = exports.CallableReferenceContext = exports.JumpExpressionContext = exports.FinallyBlockContext = exports.CatchBlockContext = exports.TryExpressionContext = exports.TypeTestContext = exports.RangeTestContext = exports.WhenConditionContext = exports.WhenEntryContext = exports.WhenExpressionContext = exports.WhenSubjectContext = exports.IfExpressionContext = exports.SuperExpressionContext = exports.ThisExpressionContext = exports.ObjectLiteralContext = exports.FunctionLiteralContext = exports.AnonymousFunctionContext = exports.LambdaParameterContext = exports.LambdaParametersContext = exports.LambdaLiteralContext = exports.MultiLineStringExpressionContext = exports.MultiLineStringContentContext = exports.LineStringExpressionContext = exports.LineStringContentContext = exports.MultiLineStringLiteralContext = exports.LineStringLiteralContext = exports.StringLiteralContext = exports.LiteralConstantContext = exports.CollectionLiteralContext = exports.ParenthesizedExpressionContext = exports.PrimaryExpressionContext = exports.ValueArgumentContext = exports.ValueArgumentsContext = exports.TypeArgumentsContext = exports.AnnotatedLambdaContext = exports.CallSuffixContext = exports.NavigationSuffixContext = exports.IndexingSuffixContext = exports.AssignableSuffixContext = exports.ParenthesizedAssignableExpressionContext = exports.AssignableExpressionContext = exports.ParenthesizedDirectlyAssignableExpressionContext = exports.DirectlyAssignableExpressionContext = exports.PostfixUnarySuffixContext = exports.PostfixUnaryExpressionContext = exports.UnaryPrefixContext = exports.PrefixUnaryExpressionContext = exports.AsExpressionContext = exports.MultiplicativeExpressionContext = exports.AdditiveExpressionContext = exports.RangeExpressionContext = exports.InfixFunctionCallContext = exports.ElvisContext = exports.ElvisExpressionContext = exports.InfixOperationContext = exports.ComparisonContext = exports.EqualityContext = exports.ConjunctionContext = exports.DisjunctionContext = exports.ExpressionContext = exports.SemisContext = exports.SemiContext = exports.AssignmentContext = exports.DoWhileStatementContext = exports.WhileStatementContext = exports.ForStatementContext = exports.LoopStatementContext = exports.BlockContext = exports.ControlStructureBodyContext = exports.LabelContext = exports.StatementContext = exports.StatementsContext = exports.ParenthesizedUserTypeContext = exports.ReceiverTypeContext = exports.ParenthesizedTypeContext = exports.FunctionTypeParametersContext = exports.FunctionTypeContext = exports.TypeProjectionModifierContext = exports.TypeProjectionModifiersContext = exports.TypeProjectionContext = exports.SimpleUserTypeContext = exports.UserTypeContext = exports.QuestContext = exports.NullableTypeContext = exports.TypeReferenceContext = exports.TypeContext = exports.EnumEntryContext = exports.EnumEntriesContext = exports.EnumClassBodyContext = exports.ConstructorDelegationCallContext = exports.SecondaryConstructorContext = exports.ObjectDeclarationContext = exports.ParameterContext = exports.ParameterWithOptionalTypeContext = exports.ParametersWithOptionalTypeContext = exports.SetterContext = exports.GetterContext = exports.PropertyDelegateContext = exports.PropertyDeclarationContext = exports.MultiVariableDeclarationContext = exports.VariableDeclarationContext = exports.FunctionBodyContext = exports.FunctionDeclarationContext = exports.FunctionValueParameterContext = exports.FunctionValueParametersContext = exports.CompanionObjectContext = exports.AnonymousInitializerContext = exports.ClassMemberDeclarationContext = exports.ClassMemberDeclarationsContext = exports.TypeConstraintContext = exports.TypeConstraintsContext = exports.TypeParameterContext = exports.TypeParametersContext = exports.ExplicitDelegationContext = exports.AnnotatedDelegationSpecifierContext = exports.ConstructorInvocationContext = exports.DelegationSpecifierContext = exports.DelegationSpecifiersContext = exports.ClassParameterContext = exports.ClassParametersContext = exports.ClassBodyContext = exports.PrimaryConstructorContext = exports.ClassDeclarationContext = exports.DeclarationContext = exports.TypeAliasContext = exports.TopLevelObjectContext = exports.ImportAliasContext = exports.ImportHeaderContext = exports.ImportListContext = exports.PackageHeaderContext = exports.FileAnnotationContext = exports.ShebangLineContext = exports.ScriptContext = exports.KotlinFileContext = exports.KotlinParser = void 0;
const ATN_1 = require("antlr4ts/atn/ATN");
const ATNDeserializer_1 = require("antlr4ts/atn/ATNDeserializer");
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 = require("antlr4ts/misc/Utils");
class KotlinParser extends Parser_1.Parser {
constructor(input) {
super(input);
this._interp = new ParserATNSimulator_1.ParserATNSimulator(KotlinParser._ATN, this);
}
get vocabulary() {
return KotlinParser.VOCABULARY;
}
get grammarFileName() { return "KotlinParser.g4"; }
get ruleNames() { return KotlinParser.ruleNames; }
get serializedATN() { return KotlinParser._serializedATN; }
kotlinFile() {
let _localctx = new KotlinFileContext(this._ctx, this.state);
this.enterRule(_localctx, 0, KotlinParser.RULE_kotlinFile);
let _la;
try {
let _alt;
this.enterOuterAlt(_localctx, 1);
{
this.state = 343;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === KotlinParser.ShebangLine) {
{
this.state = 342;
this.shebangLine();
}
}
this.state = 348;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 1, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 345;
this.match(KotlinParser.NL);
}
}
}
this.state = 350;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 1, this._ctx);
}
this.state = 354;
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 = 351;
this.fileAnnotation();
}
}
}
this.state = 356;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 2, this._ctx);
}
this.state = 357;
this.packageHeader();
this.state = 358;
this.importList();
this.state = 362;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === KotlinParser.AT_NO_WS || _la === KotlinParser.AT_PRE_WS || ((((_la - 72)) & ~0x1F) === 0 && ((1 << (_la - 72)) & ((1 << (KotlinParser.CLASS - 72)) | (1 << (KotlinParser.INTERFACE - 72)) | (1 << (KotlinParser.FUN - 72)) | (1 << (KotlinParser.OBJECT - 72)) | (1 << (KotlinParser.VAL - 72)) | (1 << (KotlinParser.VAR - 72)) | (1 << (KotlinParser.TYPE_ALIAS - 72)))) !== 0) || ((((_la - 107)) & ~0x1F) === 0 && ((1 << (_la - 107)) & ((1 << (KotlinParser.PUBLIC - 107)) | (1 << (KotlinParser.PRIVATE - 107)) | (1 << (KotlinParser.PROTECTED - 107)) | (1 << (KotlinParser.INTERNAL - 107)) | (1 << (KotlinParser.ENUM - 107)) | (1 << (KotlinParser.SEALED - 107)) | (1 << (KotlinParser.ANNOTATION - 107)) | (1 << (KotlinParser.DATA - 107)) | (1 << (KotlinParser.INNER - 107)) | (1 << (KotlinParser.TAILREC - 107)) | (1 << (KotlinParser.OPERATOR - 107)) | (1 << (KotlinParser.INLINE - 107)) | (1 << (KotlinParser.INFIX - 107)) | (1 << (KotlinParser.EXTERNAL - 107)) | (1 << (KotlinParser.SUSPEND - 107)) | (1 << (KotlinParser.OVERRIDE - 107)) | (1 << (KotlinParser.ABSTRACT - 107)) | (1 << (KotlinParser.FINAL - 107)) | (1 << (KotlinParser.OPEN - 107)) | (1 << (KotlinParser.CONST - 107)) | (1 << (KotlinParser.LATEINIT - 107)) | (1 << (KotlinParser.VARARG - 107)) | (1 << (KotlinParser.NOINLINE - 107)) | (1 << (KotlinParser.CROSSINLINE - 107)) | (1 << (KotlinParser.EXPECT - 107)) | (1 << (KotlinParser.ACTUAL - 107)))) !== 0)) {
{
{
this.state = 359;
this.topLevelObject();
}
}
this.state = 364;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 365;
this.match(KotlinParser.EOF);
}
}
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;
}
script() {
let _localctx = new ScriptContext(this._ctx, this.state);
this.enterRule(_localctx, 2, KotlinParser.RULE_script);
let _la;
try {
let _alt;
this.enterOuterAlt(_localctx, 1);
{
this.state = 368;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === KotlinParser.ShebangLine) {
{
this.state = 367;
this.shebangLine();
}
}
this.state = 373;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 5, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 370;
this.match(KotlinParser.NL);
}
}
}
this.state = 375;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 5, this._ctx);
}
this.state = 379;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 6, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 376;
this.fileAnnotation();
}
}
}
this.state = 381;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 6, this._ctx);
}
this.state = 382;
this.packageHeader();
this.state = 383;
this.importList();
this.state = 389;
this._errHandler.sync(this);
_la = this._input.LA(1);
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << KotlinParser.NL) | (1 << KotlinParser.LPAREN) | (1 << KotlinParser.LSQUARE) | (1 << KotlinParser.LCURL) | (1 << KotlinParser.ADD) | (1 << KotlinParser.SUB) | (1 << KotlinParser.INCR) | (1 << KotlinParser.DECR) | (1 << KotlinParser.EXCL_WS) | (1 << KotlinParser.EXCL_NO_WS))) !== 0) || ((((_la - 37)) & ~0x1F) === 0 && ((1 << (_la - 37)) & ((1 << (KotlinParser.COLONCOLON - 37)) | (1 << (KotlinParser.AT_NO_WS - 37)) | (1 << (KotlinParser.AT_PRE_WS - 37)) | (1 << (KotlinParser.RETURN_AT - 37)) | (1 << (KotlinParser.CONTINUE_AT - 37)) | (1 << (KotlinParser.BREAK_AT - 37)) | (1 << (KotlinParser.THIS_AT - 37)) | (1 << (KotlinParser.SUPER_AT - 37)) | (1 << (KotlinParser.FILE - 37)) | (1 << (KotlinParser.FIELD - 37)) | (1 << (KotlinParser.PROPERTY - 37)) | (1 << (KotlinParser.GET - 37)) | (1 << (KotlinParser.SET - 37)) | (1 << (KotlinParser.RECEIVER - 37)) | (1 << (KotlinParser.PARAM - 37)) | (1 << (KotlinParser.SETPARAM - 37)))) !== 0) || ((((_la - 69)) & ~0x1F) === 0 && ((1 << (_la - 69)) & ((1 << (KotlinParser.DELEGATE - 69)) | (1 << (KotlinParser.IMPORT - 69)) | (1 << (KotlinParser.CLASS - 69)) | (1 << (KotlinParser.INTERFACE - 69)) | (1 << (KotlinParser.FUN - 69)) | (1 << (KotlinParser.OBJECT - 69)) | (1 << (KotlinParser.VAL - 69)) | (1 << (KotlinParser.VAR - 69)) | (1 << (KotlinParser.TYPE_ALIAS - 69)) | (1 << (KotlinParser.CONSTRUCTOR - 69)) | (1 << (KotlinParser.BY - 69)) | (1 << (KotlinParser.COMPANION - 69)) | (1 << (KotlinParser.INIT - 69)) | (1 << (KotlinParser.THIS - 69)) | (1 << (KotlinParser.SUPER - 69)) | (1 << (KotlinParser.WHERE - 69)) | (1 << (KotlinParser.IF - 69)) | (1 << (KotlinParser.WHEN - 69)) | (1 << (KotlinParser.TRY - 69)) | (1 << (KotlinParser.CATCH - 69)) | (1 << (KotlinParser.FINALLY - 69)) | (1 << (KotlinParser.FOR - 69)) | (1 << (KotlinParser.DO - 69)) | (1 << (KotlinParser.WHILE - 69)) | (1 << (KotlinParser.THROW - 69)) | (1 << (KotlinParser.RETURN - 69)) | (1 << (KotlinParser.CONTINUE - 69)) | (1 << (KotlinParser.BREAK - 69)))) !== 0) || ((((_la - 105)) & ~0x1F) === 0 && ((1 << (_la - 105)) & ((1 << (KotlinParser.OUT - 105)) | (1 << (KotlinParser.DYNAMIC - 105)) | (1 << (KotlinParser.PUBLIC - 105)) | (1 << (KotlinParser.PRIVATE - 105)) | (1 << (KotlinParser.PROTECTED - 105)) | (1 << (KotlinParser.INTERNAL - 105)) | (1 << (KotlinParser.ENUM - 105)) | (1 << (KotlinParser.SEALED - 105)) | (1 << (KotlinParser.ANNOTATION - 105)) | (1 << (KotlinParser.DATA - 105)) | (1 << (KotlinParser.INNER - 105)) | (1 << (KotlinParser.TAILREC - 105)) | (1 << (KotlinParser.OPERATOR - 105)) | (1 << (KotlinParser.INLINE - 105)) | (1 << (KotlinParser.INFIX - 105)) | (1 << (KotlinParser.EXTERNAL - 105)) | (1 << (KotlinParser.SUSPEND - 105)) | (1 << (KotlinParser.OVERRIDE - 105)) | (1 << (KotlinParser.ABSTRACT - 105)) | (1 << (KotlinParser.FINAL - 105)) | (1 << (KotlinParser.OPEN - 105)) | (1 << (KotlinParser.CONST - 105)) | (1 << (KotlinParser.LATEINIT - 105)) | (1 << (KotlinParser.VARARG - 105)) | (1 << (KotlinParser.NOINLINE - 105)) | (1 << (KotlinParser.CROSSINLINE - 105)) | (1 << (KotlinParser.REIFIED - 105)) | (1 << (KotlinParser.EXPECT - 105)) | (1 << (KotlinParser.ACTUAL - 105)) | (1 << (KotlinParser.RealLiteral - 105)))) !== 0) || ((((_la - 137)) & ~0x1F) === 0 && ((1 << (_la - 137)) & ((1 << (KotlinParser.IntegerLiteral - 137)) | (1 << (KotlinParser.HexLiteral - 137)) | (1 << (KotlinParser.BinLiteral - 137)) | (1 << (KotlinParser.UnsignedLiteral - 137)) | (1 << (KotlinParser.LongLiteral - 137)) | (1 << (KotlinParser.BooleanLiteral - 137)) | (1 << (KotlinParser.NullLiteral - 137)) | (1 << (KotlinParser.CharacterLiteral - 137)) | (1 << (KotlinParser.Identifier - 137)) | (1 << (KotlinParser.QUOTE_OPEN - 137)) | (1 << (KotlinParser.TRIPLE_QUOTE_OPEN - 137)))) !== 0)) {
{
{
this.state = 384;
this.statement();
this.state = 385;
this.semi();
}
}
this.state = 391;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 392;
this.match(KotlinParser.EOF);
}
}
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;
}
shebangLine() {
let _localctx = new ShebangLineContext(this._ctx, this.state);
this.enterRule(_localctx, 4, KotlinParser.RULE_shebangLine);
try {
let _alt;
this.enterOuterAlt(_localctx, 1);
{
this.state = 394;
this.match(KotlinParser.ShebangLine);
this.state = 396;
this._errHandler.sync(this);
_alt = 1;
do {
switch (_alt) {
case 1:
{
{
this.state = 395;
this.match(KotlinParser.NL);
}
}
break;
default:
throw new NoViableAltException_1.NoViableAltException(this);
}
this.state = 398;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 8, this._ctx);
} while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER);
}
}
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;
}
fileAnnotation() {
let _localctx = new FileAnnotationContext(this._ctx, this.state);
this.enterRule(_localctx, 6, KotlinParser.RULE_fileAnnotation);
let _la;
try {
let _alt;
this.enterOuterAlt(_localctx, 1);
{
this.state = 400;
_la = this._input.LA(1);
if (!(_la === KotlinParser.AT_NO_WS || _la === KotlinParser.AT_PRE_WS)) {
this._errHandler.recoverInline(this);
}
else {
if (this._input.LA(1) === Token_1.Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
this.state = 401;
this.match(KotlinParser.FILE);
this.state = 405;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === KotlinParser.NL) {
{
{
this.state = 402;
this.match(KotlinParser.NL);
}
}
this.state = 407;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 408;
this.match(KotlinParser.COLON);
this.state = 412;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === KotlinParser.NL) {
{
{
this.state = 409;
this.match(KotlinParser.NL);
}
}
this.state = 414;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 424;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case KotlinParser.LSQUARE:
{
this.state = 415;
this.match(KotlinParser.LSQUARE);
this.state = 417;
this._errHandler.sync(this);
_la = this._input.LA(1);
do {
{
{
this.state = 416;
this.unescapedAnnotation();
}
}
this.state = 419;
this._errHandler.sync(this);
_la = this._input.LA(1);
} while (((((_la - 61)) & ~0x1F) === 0 && ((1 << (_la - 61)) & ((1 << (KotlinParser.FILE - 61)) | (1 << (KotlinParser.FIELD - 61)) | (1 << (KotlinParser.PROPERTY - 61)) | (1 << (KotlinParser.GET - 61)) | (1 << (KotlinParser.SET - 61)) | (1 << (KotlinParser.RECEIVER - 61)) | (1 << (KotlinParser.PARAM - 61)) | (1 << (KotlinParser.SETPARAM - 61)) | (1 << (KotlinParser.DELEGATE - 61)) | (1 << (KotlinParser.IMPORT - 61)) | (1 << (KotlinParser.CONSTRUCTOR - 61)) | (1 << (KotlinParser.BY - 61)) | (1 << (KotlinParser.COMPANION - 61)) | (1 << (KotlinParser.INIT - 61)) | (1 << (KotlinParser.WHERE - 61)) | (1 << (KotlinParser.CATCH - 61)) | (1 << (KotlinParser.FINALLY - 61)))) !== 0) || ((((_la - 105)) & ~0x1F) === 0 && ((1 << (_la - 105)) & ((1 << (KotlinParser.OUT - 105)) | (1 << (KotlinParser.DYNAMIC - 105)) | (1 << (KotlinParser.PUBLIC - 105)) | (1 << (KotlinParser.PRIVATE - 105)) | (1 << (KotlinParser.PROTECTED - 105)) | (1 << (KotlinParser.INTERNAL - 105)) | (1 << (KotlinParser.ENUM - 105)) | (1 << (KotlinParser.SEALED - 105)) | (1 << (KotlinParser.ANNOTATION - 105)) | (1 << (KotlinParser.DATA - 105)) | (1 << (KotlinParser.INNER - 105)) | (1 << (KotlinParser.TAILREC - 105)) | (1 << (KotlinParser.OPERATOR - 105)) | (1 << (KotlinParser.INLINE - 105)) | (1 << (KotlinParser.INFIX - 105)) | (1 << (KotlinParser.EXTERNAL - 105)) | (1 << (KotlinParser.SUSPEND - 105)) | (1 << (KotlinParser.OVERRIDE - 105)) | (1 << (KotlinParser.ABSTRACT - 105)) | (1 << (KotlinParser.FINAL - 105)) | (1 << (KotlinParser.OPEN - 105)) | (1 << (KotlinParser.CONST - 105)) | (1 << (KotlinParser.LATEINIT - 105)) | (1 << (KotlinParser.VARARG - 105)) | (1 << (KotlinParser.NOINLINE - 105)) | (1 << (KotlinParser.CROSSINLINE - 105)) | (1 << (KotlinParser.REIFIED - 105)) | (1 << (KotlinParser.EXPECT - 105)) | (1 << (KotlinParser.ACTUAL - 105)))) !== 0) || _la === KotlinParser.Identifier);
this.state = 421;
this.match(KotlinParser.RSQUARE);
}
break;
case KotlinParser.FILE:
case KotlinParser.FIELD:
case KotlinParser.PROPERTY:
case KotlinParser.GET:
case KotlinParser.SET:
case KotlinParser.RECEIVER:
case KotlinParser.PARAM:
case KotlinParser.SETPARAM:
case KotlinParser.DELEGATE:
case KotlinParser.IMPORT:
case KotlinParser.CONSTRUCTOR:
case KotlinParser.BY:
case KotlinParser.COMPANION:
case KotlinParser.INIT:
case KotlinParser.WHERE:
case KotlinParser.CATCH:
case KotlinParser.FINALLY:
case KotlinParser.OUT:
case KotlinParser.DYNAMIC:
case KotlinParser.PUBLIC:
case KotlinParser.PRIVATE:
case KotlinParser.PROTECTED:
case KotlinParser.INTERNAL:
case KotlinParser.ENUM:
case KotlinParser.SEALED:
case KotlinParser.ANNOTATION:
case KotlinParser.DATA:
case KotlinParser.INNER:
case KotlinParser.TAILREC:
case KotlinParser.OPERATOR:
case KotlinParser.INLINE:
case KotlinParser.INFIX:
case KotlinParser.EXTERNAL:
case KotlinParser.SUSPEND:
case KotlinParser.OVERRIDE:
case KotlinParser.ABSTRACT:
case KotlinParser.FINAL:
case KotlinParser.OPEN:
case KotlinParser.CONST:
case KotlinParser.LATEINIT:
case KotlinParser.VARARG:
case KotlinParser.NOINLINE:
case KotlinParser.CROSSINLINE:
case KotlinParser.REIFIED:
case KotlinParser.EXPECT:
case KotlinParser.ACTUAL:
case KotlinParser.Identifier:
{
this.state = 423;
this.unescapedAnnotation();
}
break;
default:
throw new NoViableAltException_1.NoViableAltException(this);
}
this.state = 429;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 13, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 426;
this.match(KotlinParser.NL);
}
}
}
this.state = 431;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 13, 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;
}
packageHeader() {
let _localctx = new PackageHeaderContext(this._ctx, this.state);
this.enterRule(_localctx, 8, KotlinParser.RULE_packageHeader);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 437;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === KotlinParser.PACKAGE) {
{
this.state = 432;
this.match(KotlinParser.PACKAGE);
this.state = 433;
this.identifier();
this.state = 435;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 14, this._ctx)) {
case 1:
{
this.state = 434;
this.semi();
}
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;
}
importList() {
let _localctx = new ImportListContext(this._ctx, this.state);
this.enterRule(_localctx, 10, KotlinParser.RULE_importList);
try {
let _alt;
this.enterOuterAlt(_localctx, 1);
{
this.state = 442;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 16, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 439;
this.importHeader();
}
}
}
this.state = 444;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 16, 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;
}
importHeader() {
let _localctx = new ImportHeaderContext(this._ctx, this.state);
this.enterRule(_localctx, 12, KotlinParser.RULE_importHeader);
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 445;
this.match(KotlinParser.IMPORT);
this.state = 446;
this.identifier();
this.state = 450;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case KotlinParser.DOT:
{
this.state = 447;
this.match(KotlinParser.DOT);
this.state = 448;
this.match(KotlinParser.MULT);
}
break;
case KotlinParser.AS:
{
this.state = 449;
this.importAlias();
}
break;
case KotlinParser.EOF:
case KotlinParser.NL:
case KotlinParser.LPAREN:
case KotlinParser.LSQUARE:
case KotlinParser.LCURL:
case KotlinParser.ADD:
case KotlinParser.SUB:
case KotlinParser.INCR:
case KotlinParser.DECR:
case KotlinParser.EXCL_WS:
case KotlinParser.EXCL_NO_WS:
case KotlinParser.SEMICOLON:
case KotlinParser.COLONCOLON:
case KotlinParser.AT_NO_WS:
case KotlinParser.AT_PRE_WS:
case KotlinParser.RETURN_AT:
case KotlinParser.CONTINUE_AT:
case KotlinParser.BREAK_AT:
case KotlinParser.THIS_AT:
case KotlinParser.SUPER_AT:
case KotlinParser.FILE:
case KotlinParser.FIELD:
case KotlinParser.PROPERTY:
case KotlinParser.GET:
case KotlinParser.SET:
case KotlinParser.RECEIVER:
case KotlinParser.PARAM:
case KotlinParser.SETPARAM:
case KotlinParser.DELEGATE:
case KotlinParser.IMPORT:
case KotlinParser.CLASS:
case KotlinParser.INTERFACE:
case KotlinParser.FUN:
case KotlinParser.OBJECT:
case KotlinParser.VAL:
case KotlinParser.VAR:
case KotlinParser.TYPE_ALIAS:
case KotlinParser.CONSTRUCTOR:
case KotlinParser.BY:
case KotlinParser.COMPANION:
case KotlinParser.INIT:
case KotlinParser.THIS:
case KotlinParser.SUPER:
case KotlinParser.WHERE:
case KotlinParser.IF:
case KotlinParser.WHEN:
case KotlinParser.TRY:
case KotlinParser.CATCH:
case KotlinParser.FINALLY:
case KotlinParser.FOR:
case KotlinParser.DO:
case KotlinParser.WHILE:
case KotlinParser.THROW:
case KotlinParser.RETURN:
case KotlinParser.CONTINUE:
case KotlinParser.BREAK:
case KotlinParser.OUT:
case KotlinParser.DYNAMIC:
case KotlinParser.PUBLIC:
case KotlinParser.PRIVATE:
case KotlinParser.PROTECTED:
case KotlinParser.INTERNAL:
case KotlinParser.ENUM:
case KotlinParser.SEALED:
case KotlinParser.ANNOTATION:
case KotlinParser.DATA:
case KotlinParser.INNER:
case KotlinParser.TAILREC:
case KotlinParser.OPERATOR:
case KotlinParser.INLINE:
case KotlinParser.INFIX:
case KotlinParser.EXTERNAL:
case KotlinParser.SUSPEND:
case KotlinParser.OVERRIDE:
case KotlinParser.ABSTRACT:
case KotlinParser.FINAL:
case KotlinParser.OPEN:
case KotlinParser.CONST:
case KotlinParser.LATEINIT:
case KotlinParser.VARARG:
case KotlinParser.NOINLINE:
case KotlinParser.CROSSINLINE:
case KotlinParser.REIFIED:
case KotlinParser.EXPECT:
case KotlinParser.ACTUAL:
case KotlinParser.RealLiteral:
case KotlinParser.IntegerLiteral:
case KotlinParser.HexLiteral:
case KotlinParser.BinLiteral:
case KotlinParser.UnsignedLiteral:
case KotlinParser.LongLiteral:
case KotlinParser.BooleanLiteral:
case KotlinParser.NullLiteral:
case KotlinParser.CharacterLiteral:
case KotlinParser.Identifier:
case KotlinParser.QUOTE_OPEN:
case KotlinParser.TRIPLE_QUOTE_OPEN:
break;
default:
break;
}
this.state = 453;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 18, this._ctx)) {
case 1:
{
this.state = 452;
this.semi();
}
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;
}
importAlias() {
let _localctx = new ImportAliasContext(this._ctx, this.state);
this.enterRule(_localctx, 14, KotlinParser.RULE_importAlias);
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 455;
this.match(KotlinParser.AS);
this.state = 456;
this.simpleIdentifier();
}
}
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;
}
topLevelObject() {
let _localctx = new TopLevelObjectContext(this._ctx, this.state);
this.enterRule(_localctx, 16, KotlinParser.RULE_topLevelObject);
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 458;
this.declaration();
this.state = 460;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 19, this._ctx)) {
case 1:
{
this.state = 459;
this.semis();
}
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;
}
typeAlias() {
let _localctx = new TypeAliasContext(this._ctx, this.state);
this.enterRule(_localctx, 18, KotlinParser.RULE_typeAlias);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 463;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === KotlinParser.AT_NO_WS || _la === KotlinParser.AT_PRE_WS || ((((_la - 107)) & ~0x1F) === 0 && ((1 << (_la - 107)) & ((1 << (KotlinParser.PUBLIC - 107)) | (1 << (KotlinParser.PRIVATE - 107)) | (1 << (KotlinParser.PROTECTED - 107)) | (1 << (KotlinParser.INTERNAL - 107)) | (1 << (KotlinParser.ENUM - 107)) | (1 << (KotlinParser.SEALED - 107)) | (1 << (KotlinParser.ANNOTATION - 107)) | (1 << (KotlinParser.DATA - 107)) | (1 << (KotlinParser.INNER - 107)) | (1 << (KotlinParser.TAILREC - 107)) | (1 << (KotlinParser.OPERATOR - 107)) | (1 << (KotlinParser.INLINE - 107)) | (1 << (KotlinParser.INFIX - 107)) | (1 << (KotlinParser.EXTERNAL - 107)) | (1 << (KotlinParser.SUSPEND - 107)) | (1 << (KotlinParser.OVERRIDE - 107)) | (1 << (KotlinParser.ABSTRACT - 107)) | (1 << (KotlinParser.FINAL - 107)) | (1 << (KotlinParser.OPEN - 107)) | (1 << (KotlinParser.CONST - 107)) | (1 << (KotlinParser.LATEINIT - 107)) | (1 << (KotlinParser.VARARG - 107)) | (1 << (KotlinParser.NOINLINE - 107)) | (1 << (KotlinParser.CROSSINLINE - 107)) | (1 << (KotlinParser.EXPECT - 107)) | (1 << (KotlinParser.ACTUAL - 107)))) !== 0)) {
{
this.state = 462;
this.modifiers();
}
}
this.state = 465;
this.match(KotlinParser.TYPE_ALIAS);
this.state = 469;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === KotlinParser.NL) {
{
{
this.state = 466;
this.match(KotlinParser.NL);
}
}
this.state = 471;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 472;
this.simpleIdentifier();
this.state = 480;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 23, this._ctx)) {
case 1:
{
this.state = 476;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === KotlinParser.NL) {
{
{
this.state = 473;
this.match(KotlinParser.NL);
}
}
this.state = 478;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 479;
this.typeParameters();
}
break;
}
this.state = 485;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === KotlinParser.NL) {
{
{
this.state = 482;
this.match(KotlinParser.NL);
}
}
this.state = 487;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 488;
this.match(KotlinParser.ASSIGNMENT);
this.state = 492;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === KotlinParser.NL) {
{
{
this.state = 489;
this.match(KotlinParser.NL);
}
}
this.state = 494;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 495;
this.type();
}
}
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;
}
declaration() {
let _localctx = new DeclarationContext(this._ctx, this.state);
this.enterRule(_localctx, 20, KotlinParser.RULE_declaration);
try {
this.state = 502;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 26, this._ctx)) {
case 1:
this.enterOuterAlt(_localctx, 1);
{
this.state = 497;
this.classDeclaration();
}
break;
case 2:
this.enterOuterAlt(_localctx, 2);
{
this.state = 498;
this.objectDeclaration();
}
break;
case 3:
this.enterOuterAlt(_localctx, 3);
{
this.state = 499;
this.functionDeclaration();
}
break;
case 4:
this.enterOuterAlt(_localctx, 4);
{
this.state = 500;
this.propertyDeclaration();
}
break;
case 5:
this.enterOuterAlt(_localctx, 5);
{
this.state = 501;
this.typeAlias();
}
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;
}
classDeclaration() {
let _localctx = new ClassDeclarationContext(this._ctx, this.state);
this.enterRule(_localctx, 22, KotlinParser.RULE_classDeclaration);
let _la;
try {
let _alt;
this.enterOuterAlt(_localctx, 1);
{
this.state = 505;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === KotlinParser.AT_NO_WS || _la === KotlinParser.AT_PRE_WS || ((((_la - 107)) & ~0x1F) === 0 && ((1 << (_la - 107)) & ((1 << (KotlinParser.PUBLIC - 107)) | (1 << (KotlinParser.PRIVATE - 107)) | (1 << (KotlinParser.PROTECTED - 107)) | (1 << (KotlinParser.INTERNAL - 107)) | (1 << (KotlinParser.ENUM - 107)) | (1 << (KotlinParser.SEALED - 107)) | (1 << (KotlinParser.ANNOTATION - 107)) | (1 << (KotlinParser.DATA - 107)) | (1 << (KotlinParser.INNER - 107)) | (1 << (KotlinParser.TAILREC - 107)) | (1 << (KotlinParser.OPERATOR - 107)) | (1 << (KotlinParser.INLINE - 107)) | (1 << (KotlinParser.INFIX - 107)) | (1 << (KotlinParser.EXTERNAL - 107)) | (1 << (KotlinParser.SUSPEND - 107)) | (1 << (KotlinParser.OVERRIDE - 107)) | (1 << (KotlinParser.ABSTRACT - 107)) | (1 << (KotlinParser.FINAL - 107)) | (1 << (KotlinParser.OPEN - 107)) | (1 << (KotlinParser.CONST - 107)) | (1 << (KotlinParser.LATEINIT - 107)) | (1 << (KotlinParser.VARARG - 107)) | (1 << (KotlinParser.NOINLINE - 107)) | (1 << (KotlinParser.CROSSINLINE - 107)) | (1 << (KotlinParser.EXPECT - 107)) | (1 << (KotlinParser.ACTUAL - 107)))) !== 0)) {
{
this.state = 504;
this.modifiers();
}
}
this.state = 507;
_la = this._input.LA(1);
if (!(_la === KotlinParser.CLASS || _la === KotlinParser.INTERFACE)) {
this._errHandler.recoverInline(this);
}
else {
if (this._input.LA(1) === Token_1.Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
this.state = 511;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === KotlinParser.NL) {
{
{
this.state = 508;
this.match(KotlinParser.NL);
}
}
this.state = 513;
this._errHandler.sync(this);
_la = this._input.LA(1);