UNPKG

net.akehurst.language-agl-processor

Version:
46,273 lines 1.89 MB
import {
  initMetadataForObject1cxne3s9w65el as initMetadataForObject,
  getKClass1s3j9wy1cofik as getKClass,
  Unit_instance104q5opgivhr8 as Unit_instance,
  ensureNotNull1e947j3ixpazm as ensureNotNull,
  VOID7hggqo3abtya as VOID,
  IllegalStateExceptionkoljg5n0nrlr as IllegalStateException,
  toString1pkumu07cwy4m as toString,
  hashCodeq5arwsb9dgti as hashCode,
  getStringHashCode26igk1bx568vk as getStringHashCode,
  THROW_CCE2g6jy02ryeudk as THROW_CCE,
  equals2au1ep9vhcato as equals,
  initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
  FunctionAdapter3lcrrz3moet5b as FunctionAdapter,
  isInterface3d6p8outrmvmk as isInterface,
  Comparator2b3maoeh98xtg as Comparator,
  compareValues1n2ayl87ihzfk as compareValues,
  LinkedHashMap1zhqxkxv3xnkl as LinkedHashMap,
  ArrayList3it5z8td81qkl as ArrayList,
  first58ocm7j58k3q as first,
  sortedWith2csnbbb21k0lg as sortedWith,
  collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
  checkIndexOverflow3frtmheghr0th as checkIndexOverflow,
  toSet2orjxp16sotqu as toSet,
  toList3jhuyej2anx2q as toList,
  plus310ted5e4i90h as plus,
  addAll1k27qatfgp3k5 as addAll,
  emptyList1g2z5xcrvp2zy as emptyList,
  getKClassFromExpression3vpejubogshaw as getKClassFromExpression,
  listOfvhqybd2zx248 as listOf,
  plus20p0vtfmu0596 as plus_0,
  Collection1k04j3hzsbod0 as Collection,
  checkCountOverflow1ro2fe1r4xvgf as checkCountOverflow,
  isBlank1dvkhjjvox3p0 as isBlank,
  _Char___init__impl__6a9atx281r2pd9o601g as _Char___init__impl__6a9atx,
  printStackTrace18lnx7a39cni as printStackTrace,
  joinToString1cxrrlmo0chqs as joinToString,
  initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
  setOf1u3mizs95ngxo as setOf,
  lazy2hsh8ze7j6ikd as lazy,
  KProperty1ca4yb4wlo496 as KProperty1,
  getPropertyCallableRef1ajb9in178r5r as getPropertyCallableRef,
  defineProp3hxgpk2knu2px as defineProp,
  ObservableProperty3aw08lidjfpjm as ObservableProperty,
  Delegates_instanceib38j9qg9yhk as Delegates_instance,
  protoOf180f3jzyo7rfj as protoOf,
  KMutableProperty11e8g1gb0ecb9j as KMutableProperty1,
  Paire9pteg33gng7 as Pair,
  mapCapacity1h45rc3eh9p2l as mapCapacity,
  coerceAtLeast2bkz8m9ik7hep as coerceAtLeast,
  emptyMapr06gerzljqtm as emptyMap,
  toString30pk9tzaqopn as toString_0,
  flatten2dh4kibw1u0qq as flatten,
  startsWith26w8qjqapeeq6 as startsWith,
  plus18eogev54fmsa as plus_1,
  initMetadataForInterface1egvbzx539z91 as initMetadataForInterface,
  noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
  toMutableMapr5f3w62lv8sk as toMutableMap,
  emptySetcxexqki71qfa as emptySet,
  plus1ogy4liedzq5j as plus_2,
  compareTo3ankvs086tmwq as compareTo,
  NoSuchElementException679xzhnp5bpj as NoSuchElementException,
  getOrNull1go7ef9ldk0df as getOrNull,
  firstOrNull1982767dljvdy as firstOrNull,
  dropLast1vpiyky649o34 as dropLast,
  last1vo29oleiqj36 as last,
  toLongw1zpgk99d84b as toLong,
  listOf1jh22dvmctj1r as listOf_0,
  NotImplementedErrorfzlkpv14xxr8 as NotImplementedError,
  filterNotNull3qfgcwmxhwfxe as filterNotNull,
  to2cs3ny02qtbcb as to,
  mapOf2zpbbmyqk8xpf as mapOf,
  KtList3hktaavzmj137 as KtList,
  throwUninitializedPropertyAccessExceptionyynx7gkm73wd as throwUninitializedPropertyAccessException,
  charSequenceLength3278n89t01tmv as charSequenceLength,
  charSequenceGet1vxk1y5n17t1z as charSequenceGet,
  toString35i91qxh73cps as toString_1,
  titlecase36e9fbud5gg4t as titlecase,
  substringAfterLastuw9v7gfiiihe as substringAfterLast,
  KtMap140uvy3s5zad8 as KtMap,
  reversed22y3au42jl32b as reversed,
  createThis2j2avj17cvnv2 as createThis,
  firstOrNullf6vlo6vdgu1e as firstOrNull_0,
  KtMutableMap1kqeifoi36kpz as KtMutableMap,
  replace3le3ie7l9k8aq as replace,
  trimIndent1qytc1wvt8suh as trimIndent,
  StringBuildermazzzhj6kkai as StringBuilder,
  first28gmhyvs4kf06 as first_0,
  THROW_IAE23kobfj9wdoxr as THROW_IAE,
  Enum3alwj03lh1n41 as Enum,
  split2bvyvnrlcifjv as split,
  Exceptiondt2hlxn7j7vw as Exception,
  captureStack1fzi4aczwc4hg as captureStack,
  setOf45ia9pnfhe90 as setOf_0,
  substringBeforeLast14532pi2uwutw as substringBeforeLast,
  KtMutableList1beimitadwkna as KtMutableList,
  MutableCollection3jqcg879qsnhr as MutableCollection,
  numberRangeToNumber25vse2rgp6rs8 as numberRangeToNumber,
  asList2ho2pewtsfvv as asList,
  toMutableList20rdgwi7d3cwi as toMutableList,
  contains3ue2qo8xhmpf1 as contains,
  Regexxgw0gjiagf4z as Regex,
  get_indices3txodfl5wuu5j as get_indices,
  getBooleanHashCode1bbj3u6b3v0a7 as getBooleanHashCode,
  toList383f556t1dixk as toList_0,
  Iterable1y3qizuf89iou as Iterable,
  isArray1hxjqtqy632bc as isArray,
  addAll21mdhg523wnoa as addAll_0,
  UnsupportedOperationException2tkumpmhredt3 as UnsupportedOperationException,
  Long2qws0ah9gnpki as Long,
  zipfdxxupzuj2p9 as zip,
  toBoolean2azvnq2ukl7b3 as toBoolean,
  toLongkk4waq8msp1k as toLong_0,
  toDouble1kn912gjoizjp as toDouble,
  charArrayOf27f4r3dozbrk1 as charArrayOf,
  trim6jpmwojjgb3l as trim,
  toInt2q8uldh7sc951 as toInt,
  drop3na99dw9feawf as drop,
  mapOf1xd03cq9cnmy8 as mapOf_0,
  toBooleanStrictOrNull2j0md398tkvbj as toBooleanStrictOrNull,
  toLongOrNullutqivezb0wx1 as toLongOrNull,
  toDoubleOrNullkxwozihadygj as toDoubleOrNull,
  removeSurroundingtenczfhnh0cp as removeSurrounding,
  copyToArray2j022khrow2yi as copyToArray,
  mutableMapOfk2y3zt1azl40 as mutableMapOf,
  drop336950s126lmj as drop_0,
  substringAfter35b3qhto7hchb as substringAfter,
  trimStart1mkod6gyztuyy as trimStart,
  isCharSequence1ju9jr1w86plq as isCharSequence,
  trimStart5ewg8zf6cs5u as trimStart_0,
  substringBeforekje8w2lxhyb6 as substringBefore,
  splitToSequence1zhgbvnxlhat1 as splitToSequence,
  drop1psm9p6la89df as drop_1,
  addAll3rgorw6ix9mgp as addAll_1,
  contentHashCode2i020q5tbeh2s as contentHashCode,
  Companion_getInstance3kme2txpd8mob as Companion_getInstance,
  lastOrNull1aq5oz189qoe1 as lastOrNull,
  LinkedHashSet2tkztfx86kyx2 as LinkedHashSet,
  mutableListOf6oorvk2mtdmp as mutableListOf,
  mutableSetOf3lxrr4fe5z3v8 as mutableSetOf,
  intersect7qttw6wlmz1n as intersect,
  RuntimeException1r3t0zl97011n as RuntimeException,
  removePrefix279df90bhrqqg as removePrefix,
  Triple1vhi3d0dgpnjb as Triple,
  plus2m1vv33moko5t as plus_3,
  HashMap1a0ld5kgwhmhv as HashMap,
} from './kotlin-kotlin-stdlib.mjs';
import {
  KotlinxReflect_getInstance2hq0ypnv4vmi6 as KotlinxReflect_getInstance,
  reflect24kqvyv71l70g as reflect,
  reflect2lo0xbf04497l as reflect_0,
} from './net.akehurst.kotlinx-kotlinx-reflect.mjs';
import {
  ParseOptionsDefault34j6tsmvtsecq as ParseOptionsDefault,
  RuntimeRulekprsqj399oq0 as RuntimeRule,
  RulePositionRuntime19wtz7t2hizg4 as RulePositionRuntime,
  RuntimeRuleRhsGoal1ph4kee007aef as RuntimeRuleRhsGoal,
  cached318xiqa8svyjm as cached,
  LanguageProcessorPhase_ALL_getInstance1qtcgi468ulny as LanguageProcessorPhase_ALL_getInstance,
  IssueHolder39atakzjd4kvn as IssueHolder,
  LeftCornerParsertj6xpf8f0s4d as LeftCornerParser,
  SPPTParserDefault18kntl3vonjtf as SPPTParserDefault,
  SentenceDefault4rp4zw27zpbp as SentenceDefault,
  plusg9sbs2lzk8v8 as plus_4,
  ScannerKind_OnDemand_getInstance3pb2n0aoxhsac as ScannerKind_OnDemand_getInstance,
  ScannerClassic2uadtaovtpl2a as ScannerClassic,
  ScannerOnDemand1qe6dkocbwuld as ScannerOnDemand,
  ScanOptionsDefault25ekig3kk7ndj as ScanOptionsDefault,
  LanguageIssueKind_ERROR_getInstance1j4sgxdh6o289 as LanguageIssueKind_ERROR_getInstance,
  LanguageProcessorPhase_SYNTAX_ANALYSIS_getInstancem666rfl21d3f as LanguageProcessorPhase_SYNTAX_ANALYSIS_getInstance,
  LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance2eh75w5g3hebi as LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance,
  matchedTextNoSkipbu44x75g3dj8 as matchedTextNoSkip,
  OptionNum3o6wvcwbdp8bn as OptionNum,
  RuntimeRuleRhsEmbedded3kpb9lqtr3yqu as RuntimeRuleRhsEmbedded,
  SpptWalkern8pvvurx4wdl as SpptWalker,
  _OptionNum___get_asIndex__impl__fdwc2btti5eh0massp as _OptionNum___get_asIndex__impl__fdwc2b,
  _OptionNum___get_value__impl__ebz44c3fg6b1g7yombx as _OptionNum___get_value__impl__ebz44c,
  locationForNodejw3iwfncg5l7 as locationForNode,
  SPPTFromTreeData3b4f3pp8qykr8 as SPPTFromTreeData,
  Companion_getInstance2w2rvaxv9f5k8 as Companion_getInstance_0,
  RuntimeRuleRhsListSeparated3nkq2abf529fd as RuntimeRuleRhsListSeparated,
  ParseAction_WIDTH_getInstance6zdc28ku5l3 as ParseAction_WIDTH_getInstance,
  ParseAction_HEIGHT_getInstance3dyv4qmrpoq38 as ParseAction_HEIGHT_getInstance,
  ParseAction_GRAFT_getInstance1ccx1o4hps8jy as ParseAction_GRAFT_getInstance,
  ParseAction_GOAL_getInstance1bjef2k2zzqri as ParseAction_GOAL_getInstance,
  OptionNum__toString_impl_vefk5s14jnqkgcfkqv7 as OptionNum__toString_impl_vefk5s,
  LanguageProcessorPhase_FORMAT_getInstance2wey2el01ved8 as LanguageProcessorPhase_FORMAT_getInstance,
  ParserStateSet1u5hn5w646r2p as ParserStateSet,
  AutomatonKind_LOOKAHEAD_1_getInstance15lrwzq3j1h2d as AutomatonKind_LOOKAHEAD_1_getInstance,
  Companion_instance30bbvlmjitp9w as Companion_instance,
  RuntimeRuleRhsLiteral3sbwo9jvqui8v as RuntimeRuleRhsLiteral,
  RuntimeRuleRhsPattern3jp5r4no3945l as RuntimeRuleRhsPattern,
  RuntimeRuleKind_TERMINAL_getInstance3sy6gdllbe0hk as RuntimeRuleKind_TERMINAL_getInstance,
  _OptionNum___init__impl__jxeviwqmqa5luktts2 as _OptionNum___init__impl__jxeviw,
  Assoc_LEFT_getInstance3ls7io6a83tar as Assoc_LEFT_getInstance,
  Assoc_RIGHT_getInstanceii3umyuuy8c7 as Assoc_RIGHT_getInstance,
  RuntimePreferenceOptionl8946ir2vbd as RuntimePreferenceOption,
  RuntimePreferenceRule2mpjpum5dlrmb as RuntimePreferenceRule,
  Companion_getInstance29fmg0mgi0gn7 as Companion_getInstance_1,
  RuntimeRuleRhsConcatenation1kfkpq1vatnqj as RuntimeRuleRhsConcatenation,
  RuntimeRuleChoiceKind_AMBIGUOUS_getInstancej6n329tyns2t as RuntimeRuleChoiceKind_AMBIGUOUS_getInstance,
  RuntimeRuleChoiceKind_PRIORITY_LONGEST_getInstance3pj4etk0yn3kn as RuntimeRuleChoiceKind_PRIORITY_LONGEST_getInstance,
  RuntimeRuleChoiceKind_LONGEST_PRIORITY_getInstance4lgvkacezagj as RuntimeRuleChoiceKind_LONGEST_PRIORITY_getInstance,
  RuntimeRuleRhsChoice9mtudo7pk6hx as RuntimeRuleRhsChoice,
  RuntimeRuleRhsOptionaluuf4vhyg0czu as RuntimeRuleRhsOptional,
  RuntimeRuleRhsListSimple1lfx632r9rbd2 as RuntimeRuleRhsListSimple,
  RuntimeRuleSet2buzu7gfhi4ce as RuntimeRuleSet,
  LanguageIssueKind_WARNING_getInstance56rkvbbi2u1l as LanguageIssueKind_WARNING_getInstance,
  ParsePath2l5dv3crq1by6 as ParsePath,
  LanguageProcessorPhase_INTERPRET_getInstance36iiwc7cf449y as LanguageProcessorPhase_INTERPRET_getInstance,
} from './net.akehurst.language-agl-parser.mjs';
import {
  RegexValueProvider1jsd46klwvaq9 as RegexValueProvider,
  RegexEngineKind_PLATFORM_getInstancee9x0uwmxnmy0 as RegexEngineKind_PLATFORM_getInstance,
  RegexEnginePlatform_getInstance3aim5ebqg16so as RegexEnginePlatform_getInstance,
  RegexEngineAgl_getInstance1v73djgixeep as RegexEngineAgl_getInstance,
} from './net.akehurst.language-agl-regex.mjs';
import {
  transitiveClosure19nldfhu84wkp as transitiveClosure,
  get_capitalise1fytkcnart99b as get_capitalise,
  mutableStackOf3qxc0gq2zdq09 as mutableStackOf,
  lazyMap2hjp9tqb7iyt1 as lazyMap,
  ListSeparatedArrayListek9n2zsx3dqy as ListSeparatedArrayList,
  ListSeparated97fiswuae3y9 as ListSeparated,
  orderedSetOfzbshky8898rn as orderedSetOf,
  toOrderedSetm9zaa385h1v7 as toOrderedSet,
  plus1ibpxh05maamr as plus_5,
  toMutableOrderedSet3pwu9brs2kfi0 as toMutableOrderedSet,
} from './net.akehurst.language-collections.mjs';
//region block: imports
var imul = Math.imul;
//endregion
//region block: pre-declaration
class BuildConfig_0 {
  constructor() {
    this.version = '4.2.1.21';
    this.buildStamp = '2025-06-13T13:57:23.643022Z[UTC]';
    this.buildDate = '2025-Jun-13';
    this.buildTime = '13:57:23 UTC';
  }
  ml() {
    return this.version;
  }
  nl() {
    return this.buildStamp;
  }
  ol() {
    return this.buildDate;
  }
  pl() {
    return this.buildTime;
  }
}
class KotlinxReflectForModule_0 {
  registerUsedClasses() {
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.BuildConfig', getKClass(BuildConfig_0), null, BuildConfig_instance);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.FormatterAbstract', getKClass(FormatterAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.LanguageDefinitionAbstract', getKClass(LanguageDefinitionAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.AglLanguages', getKClass(AglLanguages), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.LanguageRegistryDefault', getKClass(LanguageRegistryDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.LanguageProcessorConfigurationDslMarker', getKClass(LanguageProcessorConfigurationDslMarker), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.LanguageProcessorConfigurationBuilder', getKClass(LanguageProcessorConfigurationBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.ProcessOptionsDefault', getKClass(ProcessOptionsDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.SyntaxAnalysisOptionsDefault', getKClass(SyntaxAnalysisOptionsDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.SemanticAnalysisOptionsDefault', getKClass(SemanticAnalysisOptionsDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.CompletionProviderOptionsDefault', getKClass(CompletionProviderOptionsDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.ProcessOptionsDslMarker', getKClass(ProcessOptionsDslMarker), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.ScanOptionsBuilder', getKClass(ScanOptionsBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.ParseOptionsBuilder', getKClass(ParseOptionsBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.ProcessOptionsBuilder', getKClass(ProcessOptionsBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.SyntaxAnalysisOptionsBuilder', getKClass(SyntaxAnalysisOptionsBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.SemanticAnalysisOptionsBuilder', getKClass(SemanticAnalysisOptionsBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.CompletionProviderOptionsBuilder', getKClass(CompletionProviderOptionsBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.LanguageProcessorResult', getKClass(LanguageProcessorResult), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.SyntaxAnalysisResultDefault', getKClass(SyntaxAnalysisResultDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.SemanticAnalysisResultDefault', getKClass(SemanticAnalysisResultDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.ProcessResultDefault', getKClass(ProcessResultDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.FormatResultDefault', getKClass(FormatResultDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.processor.ExpectedAtResultDefault', getKClass(ExpectedAtResultDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.semanticAnalyser.ContextFromTypeModelReference', getKClass(ContextFromTypeModelReference), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.semanticAnalyser.ContextFromTypeModel', getKClass(ContextFromTypeModel), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.simple.CreateScopedItemDefault', getKClass(CreateScopedItemDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.simple.ResolveScopedItemDefault', getKClass(ResolveScopedItemDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.simple.NULL_SENTENCE_IDENTIFIER', getKClass(NULL_SENTENCE_IDENTIFIER_0), null, NULL_SENTENCE_IDENTIFIER_instance);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.simple.ContextWithScope', getKClass(ContextWithScope), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.agl.syntaxAnalyser.LocationMapDefault', getKClass(LocationMapDefault), null, null);
    var tmp = KotlinxReflect_getInstance();
    var tmp_0 = getKClass(CompletionItemKind);
    tmp.np('net.akehurst.language.api.processor.CompletionItemKind', tmp_0, CompletionItemKind$values$ref(), null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.CompletionItem', getKClass(CompletionItem), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.SpineNode', getKClass(SpineNode), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.Spine', getKClass(Spine), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.CompletionProvider', getKClass(CompletionProvider), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.Formatter', getKClass(Formatter), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.GrammarRegistry', getKClass(GrammarRegistry), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.LanguageIdentity', getKClass(LanguageIdentity), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.GrammarString', getKClass(GrammarString), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.TypesString', getKClass(TypesString), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.TransformString', getKClass(TransformString), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.CrossReferenceString', getKClass(CrossReferenceString), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.StyleString', getKClass(StyleString), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.FormatString', getKClass(FormatString), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.LanguageRegistry', getKClass(LanguageRegistry), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.LanguageDefinition', getKClass(LanguageDefinition), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.LanguageProcessor', getKClass(LanguageProcessor), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.LanguageProcessorConfiguration', getKClass(LanguageProcessorConfiguration), null, null);
    var tmp_1 = KotlinxReflect_getInstance();
    var tmp_2 = getKClass(ParserKind);
    tmp_1.np('net.akehurst.language.api.processor.ParserKind', tmp_2, ParserKind$values$ref(), null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.LanguageObject', getKClass(LanguageObject), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.LanguageObjectAbstract.Companion', getKClass(Companion_5), null, Companion_getInstance_8());
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.LanguageObjectAbstract', getKClass(LanguageObjectAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.SyntaxAnalysisOptions', getKClass(SyntaxAnalysisOptions), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.SemanticAnalysisOptions', getKClass(SemanticAnalysisOptions), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.CompletionProviderOptions', getKClass(CompletionProviderOptions), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.ProcessOptions', getKClass(ProcessOptions), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.SyntaxAnalysisResult', getKClass(SyntaxAnalysisResult), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.ResolvedReference', getKClass(ResolvedReference), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.SemanticAnalysisResult', getKClass(SemanticAnalysisResult), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.ProcessResult', getKClass(ProcessResult), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.FormatResult', getKClass(FormatResult), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.processor.ExpectedAtResult', getKClass(ExpectedAtResult), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.api.semanticAnalyser.SentenceContext', getKClass(SentenceContext), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.AsmPath', getKClass(AsmPath), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.Asm', getKClass(Asm), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.AsmValue', getKClass(AsmValue), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.AsmNothing', getKClass(AsmNothing), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.AsmAny', getKClass(AsmAny), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.AsmPrimitive', getKClass(AsmPrimitive), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.AsmReference', getKClass(AsmReference), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.PropertyValueName', getKClass(PropertyValueName), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.AsmStructure', getKClass(AsmStructure), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.AsmStructureProperty', getKClass(AsmStructureProperty), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.AsmList', getKClass(AsmList), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.AsmListSeparated', getKClass(AsmListSeparated), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.AsmLambda', getKClass(AsmLambda), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.api.AsmTreeWalker', getKClass(AsmTreeWalker), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AglAsm', getKClass(AglAsm_0), null, AglAsm_getInstance());
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmPathSimple.Companion', getKClass(Companion_6), null, Companion_getInstance_9());
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmPathSimple', getKClass(AsmPathSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmSimple', getKClass(AsmSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmValueAbstract', getKClass(AsmValueAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmNothingSimple', getKClass(AsmNothingSimple_0), null, AsmNothingSimple_getInstance());
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmAnySimple.Companion', getKClass(Companion_7), null, Companion_instance_8);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmAnySimple', getKClass(AsmAnySimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmPrimitiveSimple.Companion', getKClass(Companion_8), null, Companion_instance_9);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmPrimitiveSimple', getKClass(AsmPrimitiveSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmReferenceSimple', getKClass(AsmReferenceSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmStructureSimple', getKClass(AsmStructureSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmStructurePropertySimple.Companion', getKClass(Companion_9), null, Companion_instance_10);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmStructurePropertySimple', getKClass(AsmStructurePropertySimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmListSimple', getKClass(AsmListSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmListSeparatedSimple', getKClass(AsmListSeparatedSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.simple.AsmLambdaSimple', getKClass(AsmLambdaSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.builder.AsmSimpleBuilderMarker', getKClass(AsmSimpleBuilderMarker), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.builder.AsmSimpleBuilder', getKClass(AsmSimpleBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.builder.AsmElementSimpleBuilder', getKClass(AsmElementSimpleBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.asm.builder.ListAsmElementSimpleBuilder', getKClass(ListAsmElementSimpleBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.asm.OptionHolderDefault', getKClass(OptionHolderDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.asm.ModelAbstract', getKClass(ModelAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.asm.NamespaceAbstract', getKClass(NamespaceAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.asm.DefinitionAbstract', getKClass(DefinitionAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.asm.ModelDefault', getKClass(ModelDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.asm.NamespaceDefault', getKClass(NamespaceDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.asm.DefinitionDefault', getKClass(DefinitionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.PossiblyQualifiedName.Companion', getKClass(Companion_10), null, Companion_instance_11);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.PossiblyQualifiedName', getKClass(PossiblyQualifiedName_0), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.QualifiedName', getKClass(QualifiedName), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.SimpleName.Companion', getKClass(Companion_11), null, Companion_instance_12);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.SimpleName', getKClass(SimpleName), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.PublicValueType', getKClass(PublicValueType), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.Import', getKClass(Import), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.Indent', getKClass(Indent), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.Formatable', getKClass(Formatable), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.OptionHolder', getKClass(OptionHolder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.Model', getKClass(Model), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.Namespace', getKClass(Namespace), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.DefinitionReference', getKClass(DefinitionReference), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.api.Definition', getKClass(Definition), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.processor.AglBase', getKClass(AglBase_0), null, AglBase_getInstance());
    KotlinxReflect_getInstance().np('net.akehurst.language.base.processor.BaseSemanticAnalyser', getKClass(BaseSemanticAnalyser), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.processor.BaseSyntaxAnalyser', getKClass(BaseSyntaxAnalyser), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.base.processor.BaseCompletionProvider', getKClass(BaseCompletionProvider), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.Expression', getKClass(Expression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.RootExpression', getKClass(RootExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.LiteralExpression', getKClass(LiteralExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.CreateObjectExpression', getKClass(CreateObjectExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.CreateTupleExpression', getKClass(CreateTupleExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.OnExpression', getKClass(OnExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.NavigationExpression', getKClass(NavigationExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.NavigationPart', getKClass(NavigationPart), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.PropertyCall', getKClass(PropertyCall), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.MethodCall', getKClass(MethodCall), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.LambdaExpression', getKClass(LambdaExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.IndexOperation', getKClass(IndexOperation), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.AssignmentStatement', getKClass(AssignmentStatement), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.WithExpression', getKClass(WithExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.WhenExpression', getKClass(WhenExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.WhenOption', getKClass(WhenOption), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.WhenOptionElse', getKClass(WhenOptionElse), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.InfixExpression', getKClass(InfixExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.CastExpression', getKClass(CastExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.TypeTestExpression', getKClass(TypeTestExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.TypeReference', getKClass(TypeReference), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.api.GroupExpression', getKClass(GroupExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.ExpressionAbstract', getKClass(ExpressionAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.CreateTupleExpressionDefault', getKClass(CreateTupleExpressionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.CreateObjectExpressionDefault', getKClass(CreateObjectExpressionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.WithExpressionDefault', getKClass(WithExpressionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.WhenExpressionDefault', getKClass(WhenExpressionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.WhenOptionDefault', getKClass(WhenOptionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.WhenOptionElseDefault', getKClass(WhenOptionElseDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.OnExpressionDefault', getKClass(OnExpressionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.RootExpressionDefault.Companion', getKClass(Companion_12), null, Companion_getInstance_15());
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.RootExpressionDefault', getKClass(RootExpressionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.LiteralExpressionDefault', getKClass(LiteralExpressionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.NavigationExpressionDefault', getKClass(NavigationExpressionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.PropertyCallDefault', getKClass(PropertyCallDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.MethodCallDefault', getKClass(MethodCallDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.LambdaExpressionDefault', getKClass(LambdaExpressionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.IndexOperationDefault', getKClass(IndexOperationDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.AssignmentStatementDefault', getKClass(AssignmentStatementDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.InfixExpressionDefault', getKClass(InfixExpressionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.CastExpressionDefault', getKClass(CastExpressionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.TypeTestExpressionDefault', getKClass(TypeTestExpressionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.TypeReferenceDefault', getKClass(TypeReferenceDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.asm.GroupExpressionDefault', getKClass(GroupExpressionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.AglExpressions', getKClass(AglExpressions_0), null, AglExpressions_getInstance());
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.ExpressionTypeResolver', getKClass(ExpressionTypeResolver), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.ExpressionsCompletionProvider', getKClass(ExpressionsCompletionProvider), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.EvaluationContext.Companion', getKClass(Companion_13), null, Companion_instance_14);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.EvaluationContext', getKClass(EvaluationContext), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.TypedObject', getKClass(TypedObject), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.ObjectGraph', getKClass(ObjectGraph), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.ExpressionsInterpreterOverTypedObject', getKClass(ExpressionsInterpreterOverTypedObject), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.ExpressionsSemanticAnalyser', getKClass(ExpressionsSemanticAnalyser), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.ExpressionsSyntaxAnalyser.PropertyValue', getKClass(PropertyValue), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.ExpressionsSyntaxAnalyser', getKClass(ExpressionsSyntaxAnalyser), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.StdLibPrimitiveExecutions', getKClass(StdLibPrimitiveExecutions_0), null, StdLibPrimitiveExecutions_getInstance());
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.TypedObjectAsmValue', getKClass(TypedObjectAsmValue), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.expressions.processor.ObjectGraphAsmSimple', getKClass(ObjectGraphAsmSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.GrammarModelDefault', getKClass(GrammarModelDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.GrammarNamespaceDefault', getKClass(GrammarNamespaceDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.GrammarDefault.Companion', getKClass(Companion_16), null, Companion_instance_17);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.GrammarDefault', getKClass(GrammarDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.GrammarReferenceDefault', getKClass(GrammarReferenceDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.GrammarAbstract', getKClass(GrammarAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.GrammarItemAbstract', getKClass(GrammarItemAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.GrammarRuleAbstract.Companion.CompressedLeafRule', getKClass(CompressedLeafRule), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.GrammarRuleAbstract.Companion', getKClass(Companion_18), null, Companion_instance_19);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.GrammarRuleAbstract', getKClass(GrammarRuleAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.NormalRuleDefault', getKClass(NormalRuleDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.OverrideRuleDefault', getKClass(OverrideRuleDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.PreferenceRuleDefault', getKClass(PreferenceRuleDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.PreferenceOptionDefault', getKClass(PreferenceOptionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.SpineDefault', getKClass(SpineDefault_0), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.RuleItemAbstract', getKClass(RuleItemAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.ConcatenationDefault', getKClass(ConcatenationDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.ChoiceAbstract', getKClass(ChoiceAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.ChoiceLongestDefault', getKClass(ChoiceLongestDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.ChoicePriorityDefault', getKClass(ChoicePriorityDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.ChoiceAmbiguousDefault', getKClass(ChoiceAmbiguousDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.ConcatenationItemAbstract', getKClass(ConcatenationItemAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.OptionalItemDefault', getKClass(OptionalItemDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.SimpleItemAbstract', getKClass(SimpleItemAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.GroupDefault', getKClass(GroupDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.TangibleItemAbstract', getKClass(TangibleItemAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.EmptyRuleDefault', getKClass(EmptyRuleDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.TerminalDefault', getKClass(TerminalDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.NonTerminalDefault', getKClass(NonTerminalDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.EmbeddedDefault', getKClass(EmbeddedDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.ListOfItemsAbstract', getKClass(ListOfItemsAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.SimpleListDefault', getKClass(SimpleListDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.asm.SeparatedListDefault', getKClass(SeparatedListDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.GrammarModel', getKClass(GrammarModel), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.GrammarNamespace', getKClass(GrammarNamespace), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.GrammarItem', getKClass(GrammarItem), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.GrammarReference', getKClass(GrammarReference), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.Grammar', getKClass(Grammar), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.GrammarRuleName', getKClass(GrammarRuleName), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.PreferenceRule', getKClass(PreferenceRule), null, null);
    var tmp_3 = KotlinxReflect_getInstance();
    var tmp_4 = getKClass(Associativity);
    tmp_3.np('net.akehurst.language.grammar.api.Associativity', tmp_4, Associativity$values$ref(), null);
    var tmp_5 = KotlinxReflect_getInstance();
    var tmp_6 = getKClass(ChoiceIndicator);
    tmp_5.np('net.akehurst.language.grammar.api.ChoiceIndicator', tmp_6, ChoiceIndicator$values$ref(), null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.PreferenceOption', getKClass(PreferenceOption), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.Spine', getKClass(Spine_0), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.GrammarRule', getKClass(GrammarRule), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.NormalRule', getKClass(NormalRule), null, null);
    var tmp_7 = KotlinxReflect_getInstance();
    var tmp_8 = getKClass(OverrideKind);
    tmp_7.np('net.akehurst.language.grammar.api.OverrideKind', tmp_8, OverrideKind$values$ref(), null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.OverrideRule', getKClass(OverrideRule), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.RuleItem', getKClass(RuleItem), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.Choice', getKClass(Choice), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.Concatenation', getKClass(Concatenation), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.ConcatenationItem', getKClass(ConcatenationItem), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.ChoiceLongest', getKClass(ChoiceLongest), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.ChoicePriority', getKClass(ChoicePriority), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.ChoiceAmbiguous', getKClass(ChoiceAmbiguous), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.OptionalItem', getKClass(OptionalItem), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.SimpleItem', getKClass(SimpleItem), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.ListOfItems', getKClass(ListOfItems), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.SimpleList', getKClass(SimpleList), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.SeparatedList', getKClass(SeparatedList), null, null);
    var tmp_9 = KotlinxReflect_getInstance();
    var tmp_10 = getKClass(SeparatedListKind);
    tmp_9.np('net.akehurst.language.grammar.api.SeparatedListKind', tmp_10, SeparatedListKind$values$ref(), null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.Group', getKClass(Group), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.TangibleItem', getKClass(TangibleItem), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.EmptyRule', getKClass(EmptyRule), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.Terminal', getKClass(Terminal), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.NonTerminal', getKClass(NonTerminal), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.api.Embedded', getKClass(Embedded), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.builder.GrammarBuilderMarker', getKClass(GrammarBuilderMarker), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.builder.GrammarModelBuilder', getKClass(GrammarModelBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.builder.GrammarNamespaceBuilder', getKClass(GrammarNamespaceBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.builder.GrammarBuilder', getKClass(GrammarBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.builder.SimpleItemsBuilder', getKClass(SimpleItemsBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.builder.ChoiceItemBuilder', getKClass(ChoiceItemBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.builder.ConcatenationItemBuilder', getKClass(ConcatenationItemBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.builder.GroupChoiceBuilder', getKClass(GroupChoiceBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.builder.PreferenceRuleBuilder', getKClass(PreferenceRuleBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.processor.AglGrammar', getKClass(AglGrammar_0), null, AglGrammar_getInstance());
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.processor.AglGrammarCompletionProvider', getKClass(AglGrammarCompletionProvider), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.processor.AglGrammarSemanticAnalyser.Companion', getKClass(Companion_19), null, Companion_instance_20);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammar.processor.AglGrammarSemanticAnalyser', getKClass(AglGrammarSemanticAnalyser), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammarTypemodel.asm.GrammarTypeNamespaceSimple.Companion', getKClass(Companion_20), null, Companion_instance_21);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammarTypemodel.asm.GrammarTypeNamespaceSimple', getKClass(GrammarTypeNamespaceSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammarTypemodel.asm.GrammarTypeNamespaceAbstract', getKClass(GrammarTypeNamespaceAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammarTypemodel.builder.GrammarTypeNamespaceBuilder', getKClass(GrammarTypeNamespaceBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.grammarTypemodel.api.GrammarTypeNamespace', getKClass(GrammarTypeNamespace), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.processor.AglCrossReference', getKClass(AglCrossReference_0), null, AglCrossReference_getInstance());
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.processor.ReferencesCompletionProvider', getKClass(ReferencesCompletionProvider), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.processor.ReferencesSemanticAnalyser', getKClass(ReferencesSemanticAnalyser), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.processor.ReferencesSyntaxAnalyser.PropertyValue', getKClass(PropertyValue_0), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.processor.ReferencesSyntaxAnalyser', getKClass(ReferencesSyntaxAnalyser), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.api.CrossReferenceModel', getKClass(CrossReferenceModel), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.api.CrossReferenceNamespace', getKClass(CrossReferenceNamespace), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.api.DeclarationsForNamespace', getKClass(DeclarationsForNamespace), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.api.ReferenceDefinition', getKClass(ReferenceDefinition), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.api.ScopeDefinition', getKClass(ScopeDefinition), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.api.Identifiable', getKClass(Identifiable), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.api.ReferenceExpression', getKClass(ReferenceExpression), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.api.ReferenceExpressionProperty', getKClass(ReferenceExpressionProperty), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.api.ReferenceExpressionCollection', getKClass(ReferenceExpressionCollection), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.asm.CrossReferenceModelDefault.Companion', getKClass(Companion_21), null, Companion_getInstance_24());
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.asm.CrossReferenceModelDefault', getKClass(CrossReferenceModelDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.asm.CrossReferenceNamespaceDefault', getKClass(CrossReferenceNamespaceDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.asm.DeclarationsForNamespaceDefault', getKClass(DeclarationsForNamespaceDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.asm.ScopeDefinitionDefault', getKClass(ScopeDefinitionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.asm.IdentifiableDefault', getKClass(IdentifiableDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.asm.ReferenceDefinitionDefault', getKClass(ReferenceDefinitionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.asm.ReferenceExpressionAbstract', getKClass(ReferenceExpressionAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.asm.ReferenceExpressionPropertyDefault', getKClass(ReferenceExpressionPropertyDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.asm.ReferenceExpressionCollectionDefault', getKClass(ReferenceExpressionCollectionDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.builder.CrossReferenceModelBuilderMarker', getKClass(CrossReferenceModelBuilderMarker), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.builder.CrossReferenceModelBuilder', getKClass(CrossReferenceModelBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.builder.DeclarationsForNamespaceBuilder', getKClass(DeclarationsForNamespaceBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.builder.ScopeDefinitionBuilder', getKClass(ScopeDefinitionBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.reference.builder.ReferenceDefinitionBuilder', getKClass(ReferenceDefinitionBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.scope.processor.AglScope', getKClass(AglScope_0), null, AglScope_getInstance());
    KotlinxReflect_getInstance().np('net.akehurst.language.scope.api.ItemInScope', getKClass(ItemInScope), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.scope.api.Scope', getKClass(Scope), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.scope.asm.ScopeSimple.Companion', getKClass(Companion_22), null, Companion_instance_23);
    KotlinxReflect_getInstance().np('net.akehurst.language.scope.asm.ScopeSimple', getKClass(ScopeSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.processor.AglStyle', getKClass(AglStyle_0), null, AglStyle_getInstance());
    KotlinxReflect_getInstance().np('net.akehurst.language.style.processor.AglStyleCompletionProvider.Companion', getKClass(Companion_23), null, Companion_getInstance_26());
    KotlinxReflect_getInstance().np('net.akehurst.language.style.processor.AglStyleCompletionProvider', getKClass(AglStyleCompletionProvider), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.processor.AglStyleSemanticAnalyser.Companion', getKClass(Companion_24), null, Companion_getInstance_27());
    KotlinxReflect_getInstance().np('net.akehurst.language.style.processor.AglStyleSemanticAnalyser', getKClass(AglStyleSemanticAnalyser), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.asm.AglStyleModelDefault.Companion', getKClass(Companion_25), null, Companion_getInstance_28());
    KotlinxReflect_getInstance().np('net.akehurst.language.style.asm.AglStyleModelDefault', getKClass(AglStyleModelDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.asm.StyleNamespaceDefault', getKClass(StyleNamespaceDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.asm.StyleSetReferenceDefault', getKClass(StyleSetReferenceDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.asm.AglStyleSetDefault', getKClass(AglStyleSetDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.asm.AglStyleMetaRuleDefault', getKClass(AglStyleMetaRuleDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.asm.AglStyleTagRuleDefault', getKClass(AglStyleTagRuleDefault), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.api.AglStyleModel', getKClass(AglStyleModel), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.api.StyleNamespace', getKClass(StyleNamespace), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.api.StyleSetReference', getKClass(StyleSetReference), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.api.StyleSet', getKClass(StyleSet), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.api.AglStyleRule', getKClass(AglStyleRule), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.api.AglStyleMetaRule', getKClass(AglStyleMetaRule), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.api.AglStyleTagRule', getKClass(AglStyleTagRule), null, null);
    var tmp_11 = KotlinxReflect_getInstance();
    var tmp_12 = getKClass(AglStyleSelectorKind);
    tmp_11.np('net.akehurst.language.style.api.AglStyleSelectorKind', tmp_12, AglStyleSelectorKind$values$ref(), null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.api.AglStyleSelector', getKClass(AglStyleSelector), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.api.AglStyleDeclaration', getKClass(AglStyleDeclaration), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.builder.StyleModelDslMarker', getKClass(StyleModelDslMarker), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.builder.StyleModelBuilder', getKClass(StyleModelBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.builder.StyleNamespaceBuilder', getKClass(StyleNamespaceBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.builder.StylesBuilder', getKClass(StylesBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.builder.StyleMetaRuleBuilder', getKClass(StyleMetaRuleBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.style.builder.StyleTagRuleBuilder', getKClass(StyleTagRuleBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.StdLibDefault', getKClass(StdLibDefault_0), null, StdLibDefault_getInstance());
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeModelSimple.Companion', getKClass(Companion_29), null, Companion_instance_30);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeModelSimple', getKClass(TypeModelSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeModelSimpleAbstract', getKClass(TypeModelSimpleAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeInstanceAbstract', getKClass(TypeInstanceAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeParameterReference', getKClass(TypeParameterReference), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeArgumentSimple', getKClass(TypeArgumentSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeInstanceSimple.Companion', getKClass(Companion_30), null, Companion_instance_31);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeInstanceSimple', getKClass(TypeInstanceSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TupleTypeInstanceSimple', getKClass(TupleTypeInstanceSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeNamespaceSimple', getKClass(TypeNamespaceSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeNamespaceAbstract', getKClass(TypeNamespaceAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeParameterSimple', getKClass(TypeParameterSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeParameterMultiple', getKClass(TypeParameterMultiple_0), null, TypeParameterMultiple_getInstance());
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeDefinitionSimpleAbstract.Companion', getKClass(Companion_31), null, Companion_instance_32);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeDefinitionSimpleAbstract', getKClass(TypeDefinitionSimpleAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.SpecialTypeSimple', getKClass(SpecialTypeSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.SingletonTypeSimple', getKClass(SingletonTypeSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.PrimitiveTypeSimple', getKClass(PrimitiveTypeSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.EnumTypeSimple', getKClass(EnumTypeSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.UnionTypeSimple', getKClass(UnionTypeSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.StructuredTypeSimpleAbstract', getKClass(StructuredTypeSimpleAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TypeArgumentNamedSimple', getKClass(TypeArgumentNamedSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.TupleTypeSimple', getKClass(TupleTypeSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.ValueTypeSimple', getKClass(ValueTypeSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.InterfaceTypeSimple', getKClass(InterfaceTypeSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.DataTypeSimple', getKClass(DataTypeSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.CollectionTypeSimple', getKClass(CollectionTypeSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.ConstructorDeclarationSimple', getKClass(ConstructorDeclarationSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.PropertyDeclarationAbstract', getKClass(PropertyDeclarationAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.PropertyDeclarationStored', getKClass(PropertyDeclarationStored), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.PropertyDeclarationPrimitive', getKClass(PropertyDeclarationPrimitive), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.PropertyDeclarationDerived', getKClass(PropertyDeclarationDerived), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.PropertyDeclarationResolvedSimple', getKClass(PropertyDeclarationResolvedSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.MethodDeclarationAbstract', getKClass(MethodDeclarationAbstract), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.MethodDeclarationDerivedSimple', getKClass(MethodDeclarationDerivedSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.MethodDeclarationResolvedSimple', getKClass(MethodDeclarationResolvedSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.asm.ParameterDefinitionSimple', getKClass(ParameterDefinitionSimple), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.processor.AglTypes', getKClass(AglTypes_0), null, AglTypes_getInstance());
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.processor.TypemodelSemanticAnalyser.Companion', getKClass(Companion_32), null, Companion_instance_33);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.TypeModel', getKClass(TypeModel), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.TypeNamespace', getKClass(TypeNamespace), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.TypeParameter', getKClass(TypeParameter), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.TypeArgument', getKClass(TypeArgument), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.TypeInstance', getKClass(TypeInstance), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.TypeArgumentNamed', getKClass(TypeArgumentNamed), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.TupleTypeInstance', getKClass(TupleTypeInstance), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.TypeDefinition', getKClass(TypeDefinition), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.SpecialType', getKClass(SpecialType), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.SingletonType', getKClass(SingletonType), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.PrimitiveType', getKClass(PrimitiveType), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.EnumType', getKClass(EnumType), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.StructuredType', getKClass(StructuredType), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.TupleType', getKClass(TupleType), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.ValueType', getKClass(ValueType), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.InterfaceType', getKClass(InterfaceType), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.DataType', getKClass(DataType), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.UnionType', getKClass(UnionType), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.CollectionType', getKClass(CollectionType), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.PropertyName', getKClass(PropertyName), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.PropertyDeclaration', getKClass(PropertyDeclaration), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.PropertyDeclarationResolved', getKClass(PropertyDeclarationResolved), null, null);
    var tmp_13 = KotlinxReflect_getInstance();
    var tmp_14 = getKClass(PropertyCharacteristic);
    tmp_13.np('net.akehurst.language.typemodel.api.PropertyCharacteristic', tmp_14, PropertyCharacteristic$values$ref(), null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.MethodName', getKClass(MethodName), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.MethodDeclaration', getKClass(MethodDeclaration), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.MethodDeclarationPrimitive', getKClass(MethodDeclarationPrimitive), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.MethodDeclarationDerived', getKClass(MethodDeclarationDerived), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.MethodDeclarationResolved', getKClass(MethodDeclarationResolved), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.ConstructorDeclaration', getKClass(ConstructorDeclaration), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.ParameterName', getKClass(ParameterName), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.api.ParameterDeclaration', getKClass(ParameterDeclaration), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.builder.TypeModelDslMarker', getKClass(TypeModelDslMarker), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.builder.TypeModelBuilder', getKClass(TypeModelBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.builder.TypeNamespaceBuilder', getKClass(TypeNamespaceBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.builder.StructuredTypeBuilder', getKClass(StructuredTypeBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.builder.ValueTypeBuilder', getKClass(ValueTypeBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.builder.InterfaceTypeBuilder', getKClass(InterfaceTypeBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.builder.DataTypeBuilder', getKClass(DataTypeBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.builder.ConstructorBuilder', getKClass(ConstructorBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.builder.TypeInstanceArgBuilder', getKClass(TypeInstanceArgBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.builder.TypeInstanceArgNamedBuilder', getKClass(TypeInstanceArgNamedBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.builder.TypeArgumentBuilder', getKClass(TypeArgumentBuilder), null, null);
    KotlinxReflect_getInstance().np('net.akehurst.language.typemodel.builder.SubtypeListBuilder', getKClass(SubtypeListBuilder), null, null);
  }
  w1r(qualifiedName) {
    this.registerUsedClasses();
    return KotlinxReflect_getInstance().op(qualifiedName);
  }
}
class Agl_0 {
  constructor() {
    Agl_instance = this;
    this.version = '4.2.1.21';
    this.buildStamp = '2025-06-13T13:57:23.643022Z[UTC]';
    this.registry = new LanguageRegistryDefault();
  }
  ml() {
    return this.version;
  }
  nl() {
    return this.buildStamp;
  }
  x1r() {
    return this.registry;
  }
  configurationEmpty() {
    return new LanguageProcessorConfigurationEmpty();
  }
  configurationBase() {
    return new LanguageProcessorConfigurationBase();
  }
  configurationFromLanguageObject(languageObject) {
    var tmp = languageObject.defaultTargetGrammar.name;
    var tmp_0 = _GrammarRuleName___init__impl__yqiut(languageObject.defaultTargetGoalRule);
    var tmp_1 = _GrammarString___init__impl__7iaxk1(languageObject.grammarString);
    var tmp_2 = _TypesString___init__impl__keabg1(languageObject.typesString);
    var tmp_3 = _TransformString___init__impl__9dqy3g(languageObject.asmTransformString);
    var tmp_4 = _CrossReferenceString___init__impl__2ehjbv(languageObject.crossReferenceString);
    var tmp_5 = _StyleString___init__impl__vpzm3t(languageObject.styleString);
    var tmp_6 = _FormatString___init__impl__5jzgt5(languageObject.formatString);
    var tmp_7 = Agl$configurationFromLanguageObject$lambda(languageObject);
    var tmp_8 = Agl$configurationFromLanguageObject$lambda_0(languageObject);
    var tmp_9 = Agl$configurationFromLanguageObject$lambda_1(languageObject);
    var tmp_10 = Agl$configurationFromLanguageObject$lambda_2(languageObject);
    var tmp_11 = Agl$configurationFromLanguageObject$lambda_3(languageObject);
    var tmp_12 = Agl$configurationFromLanguageObject$lambda_4(languageObject);
    var tmp_13 = Agl$configurationFromLanguageObject$lambda_5(languageObject);
    return new LanguageProcessorConfigurationBase(tmp, tmp_0, tmp_1, tmp_2, tmp_3, tmp_4, tmp_5, tmp_6, VOID, VOID, VOID, VOID, tmp_7, tmp_8, tmp_9, tmp_10, tmp_11, tmp_12, tmp_13, Agl$configurationFromLanguageObject$lambda_6(languageObject));
  }
  configurationSimple() {
    return new LanguageProcessorConfigurationSimple();
  }
  y1r(base, init) {
    var b = new LanguageProcessorConfigurationBuilder(base);
    init(b);
    return b.build();
  }
  configuration(base, init, $super) {
    base = base === VOID ? Agl_getInstance().configurationBase() : base;
    return $super === VOID ? this.y1r(base, init) : $super.y1r.call(this, base, init);
  }
  z1r(base, init) {
    var b = new ParseOptionsBuilder(base);
    init(b);
    return b.build();
  }
  parseOptions(base, init, $super) {
    base = base === VOID ? new ParseOptionsDefault() : base;
    return $super === VOID ? this.z1r(base, init) : $super.z1r.call(this, base, init);
  }
  a1s(base, init) {
    var b = new ProcessOptionsBuilder(base);
    init(b);
    return b.build();
  }
  options(base, init, $super) {
    base = base === VOID ? new ProcessOptionsDefault() : base;
    return $super === VOID ? this.a1s(base, init) : $super.a1s.call(this, base, init);
  }
  b1s(grammarModel, configuration) {
    var config = configuration == null ? this.configurationBase() : configuration;
    return new LanguageProcessorDefault(grammarModel, config);
  }
  processorFromGrammar(grammarModel, configuration, $super) {
    configuration = configuration === VOID ? null : configuration;
    return $super === VOID ? this.b1s(grammarModel, configuration) : $super.b1s.call(this, grammarModel, configuration);
  }
  c1s(grammarDefinitionStr, typeStr, transformStr, referenceStr, styleStr, formatterModelStr, configurationBase, grammarAglOptions) {
    var tmp = Agl_getInstance();
    var config = tmp.configuration(configurationBase, Agl$processorFromStringSimple$lambda_0(typeStr, transformStr, referenceStr, styleStr, formatterModelStr));
    var proc = this.processorFromString(_GrammarString___get_value__impl__5bomff(grammarDefinitionStr), config, grammarAglOptions);
    return proc;
  }
  processorFromStringSimple(grammarDefinitionStr, typeStr, transformStr, referenceStr, styleStr, formatterModelStr, configurationBase, grammarAglOptions, $super) {
    typeStr = typeStr === VOID ? null : typeStr;
    transformStr = transformStr === VOID ? null : transformStr;
    referenceStr = referenceStr === VOID ? null : referenceStr;
    styleStr = styleStr === VOID ? null : styleStr;
    formatterModelStr = formatterModelStr === VOID ? null : formatterModelStr;
    configurationBase = configurationBase === VOID ? this.configurationSimple() : configurationBase;
    var tmp;
    if (grammarAglOptions === VOID) {
      tmp = this.options(VOID, Agl$processorFromStringSimple$lambda);
    } else {
      tmp = grammarAglOptions;
    }
    grammarAglOptions = tmp;
    var tmp_0;
    if ($super === VOID) {
      tmp_0 = this.c1s(grammarDefinitionStr, typeStr, transformStr, referenceStr, styleStr, formatterModelStr, configurationBase, grammarAglOptions);
    } else {
      var tmp_1 = $super.c1s;
      var tmp_2 = typeStr;
      var tmp_3 = tmp_2 == null ? null : new TypesString(tmp_2);
      var tmp_4 = transformStr;
      var tmp_5 = tmp_4 == null ? null : new TransformString(tmp_4);
      var tmp_6 = referenceStr;
      var tmp_7 = tmp_6 == null ? null : new CrossReferenceString(tmp_6);
      var tmp_8 = styleStr;
      var tmp_9 = tmp_8 == null ? null : new StyleString(tmp_8);
      var tmp_10 = formatterModelStr;
      tmp_0 = tmp_1.call(this, new GrammarString(grammarDefinitionStr), tmp_3, tmp_5, tmp_7, tmp_9, tmp_10 == null ? null : new FormatString(tmp_10), configurationBase, grammarAglOptions);
    }
    return tmp_0;
  }
  d1s(grammarDefinitionStr, typeModelStr, transformStr, crossReferenceModelStr, styleModelStr, formatterModelStr, configurationBase, grammarAglOptions) {
    var tmp = _GrammarString___init__impl__7iaxk1(grammarDefinitionStr);
    var tmp_0;
    if (typeModelStr == null) {
      tmp_0 = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp_0 = _TypesString___init__impl__keabg1(typeModelStr);
    }
    var tmp_1 = tmp_0;
    var tmp_2;
    if (transformStr == null) {
      tmp_2 = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp_2 = _TransformString___init__impl__9dqy3g(transformStr);
    }
    var tmp_3 = tmp_2;
    var tmp_4;
    if (crossReferenceModelStr == null) {
      tmp_4 = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp_4 = _CrossReferenceString___init__impl__2ehjbv(crossReferenceModelStr);
    }
    var tmp_5 = tmp_4;
    var tmp_6;
    if (styleModelStr == null) {
      tmp_6 = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp_6 = _StyleString___init__impl__vpzm3t(styleModelStr);
    }
    var tmp_7 = tmp_6;
    var tmp_8;
    if (formatterModelStr == null) {
      tmp_8 = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp_8 = _FormatString___init__impl__5jzgt5(formatterModelStr);
    }
    return this.processorFromStringSimple(tmp, tmp_1, tmp_3, tmp_5, tmp_7, tmp_8, configurationBase, grammarAglOptions);
  }
  processorFromStringSimpleJava(grammarDefinitionStr, typeModelStr, transformStr, crossReferenceModelStr, styleModelStr, formatterModelStr, configurationBase, grammarAglOptions, $super) {
    typeModelStr = typeModelStr === VOID ? null : typeModelStr;
    transformStr = transformStr === VOID ? null : transformStr;
    crossReferenceModelStr = crossReferenceModelStr === VOID ? null : crossReferenceModelStr;
    styleModelStr = styleModelStr === VOID ? null : styleModelStr;
    formatterModelStr = formatterModelStr === VOID ? null : formatterModelStr;
    configurationBase = configurationBase === VOID ? this.configurationSimple() : configurationBase;
    var tmp;
    if (grammarAglOptions === VOID) {
      tmp = this.options(VOID, Agl$processorFromStringSimpleJava$lambda);
    } else {
      tmp = grammarAglOptions;
    }
    grammarAglOptions = tmp;
    return $super === VOID ? this.d1s(grammarDefinitionStr, typeModelStr, transformStr, crossReferenceModelStr, styleModelStr, formatterModelStr, configurationBase, grammarAglOptions) : $super.d1s.call(this, grammarDefinitionStr, typeModelStr, transformStr, crossReferenceModelStr, styleModelStr, formatterModelStr, configurationBase, grammarAglOptions);
  }
  j1s(grammarDefinitionStr, configuration, aglOptions) {
    var tmp;
    try {
      var tmp_0 = Agl_getInstance();
      var res = tmp_0.grammarFromString(grammarDefinitionStr, aglOptions == null ? ensureNotNull(Agl_getInstance().registry.agl.grammar.processor).optionsDefault() : aglOptions);
      var tmp_1;
      if (null == res.asm || ensureNotNull(res.asm).isEmpty) {
        tmp_1 = new LanguageProcessorResult(null, res.allIssues);
      } else {
        var tmp1_elvis_lhs = res.asm;
        var tmp_2;
        if (tmp1_elvis_lhs == null) {
          var message = 'Unable to create processor for ' + grammarDefinitionStr;
          throw IllegalStateException.v4(toString(message));
        } else {
          tmp_2 = tmp1_elvis_lhs;
        }
        var grammarModel = tmp_2;
        var proc = this.processorFromGrammar(grammarModel, configuration);
        tmp_1 = new LanguageProcessorResult(proc, res.allIssues);
      }
      tmp = tmp_1;
    } catch ($p) {
      var tmp_3;
      if ($p instanceof Error) {
        var e = $p;
        throw LanguageProcessorException.m1s('Unable to create processor for grammarDefinitionStr: ' + e.message, e);
      } else {
        throw $p;
      }
    }
    return tmp;
  }
  processorFromString(grammarDefinitionStr, configuration, aglOptions, $super) {
    configuration = configuration === VOID ? this.configurationBase() : configuration;
    var tmp;
    if (aglOptions === VOID) {
      var tmp_0 = Agl_getInstance();
      tmp = tmp_0.options(VOID, Agl$processorFromString$lambda);
    } else {
      tmp = aglOptions;
    }
    aglOptions = tmp;
    return $super === VOID ? this.j1s(grammarDefinitionStr, configuration, aglOptions) : $super.j1s.call(this, grammarDefinitionStr, configuration, aglOptions);
  }
  processorFromGeneratedCode(generated) {
    return new LanguageProcessorFromLanguageObject(generated);
  }
  fromString(proc, aglOptions, sentence) {
    return proc.process(sentence, aglOptions);
  }
  n1s(sentence, aglOptions) {
    var tmp;
    if (null == sentence) {
      tmp = new ProcessResultDefault(null);
    } else {
      var res = ensureNotNull(Agl_getInstance().registry.agl.grammar.processor).process(sentence, aglOptions);
      var tmp0_elvis_lhs = res.asm;
      tmp = new ProcessResultDefault(tmp0_elvis_lhs == null ? new GrammarModelDefault(_SimpleName___init__impl__6s45d0('fromString-error')) : tmp0_elvis_lhs, res.parse, res.syntaxAnalysis, res.semanticAnalysis);
    }
    return tmp;
  }
  grammarFromString(sentence, aglOptions, $super) {
    var tmp;
    if (aglOptions === VOID) {
      var tmp_0 = Agl_getInstance();
      tmp = tmp_0.options(VOID, Agl$grammarFromString$lambda);
    } else {
      tmp = aglOptions;
    }
    aglOptions = tmp;
    return $super === VOID ? this.n1s(sentence, aglOptions) : $super.n1s.call(this, sentence, aglOptions);
  }
  o1s(identity, grammarDefinitionStr, typeStr, transformStr, referenceStr, styleStr, formatterModelStr, configurationBase, grammarAglOptions) {
    var tmp = Agl_getInstance();
    var config = tmp.configuration(configurationBase, Agl$languageDefinitionFromString$lambda_0(grammarDefinitionStr, typeStr, transformStr, referenceStr, styleStr, formatterModelStr));
    return new LanguageDefinitionDefault(identity, grammarAglOptions, false, config);
  }
  languageDefinitionFromString(identity, grammarDefinitionStr, typeStr, transformStr, referenceStr, styleStr, formatterModelStr, configurationBase, grammarAglOptions, $super) {
    grammarDefinitionStr = grammarDefinitionStr === VOID ? null : grammarDefinitionStr;
    typeStr = typeStr === VOID ? null : typeStr;
    transformStr = transformStr === VOID ? null : transformStr;
    referenceStr = referenceStr === VOID ? null : referenceStr;
    styleStr = styleStr === VOID ? null : styleStr;
    formatterModelStr = formatterModelStr === VOID ? null : formatterModelStr;
    configurationBase = configurationBase === VOID ? this.configurationBase() : configurationBase;
    var tmp;
    if (grammarAglOptions === VOID) {
      tmp = this.options(VOID, Agl$languageDefinitionFromString$lambda);
    } else {
      tmp = grammarAglOptions;
    }
    grammarAglOptions = tmp;
    var tmp_0;
    if ($super === VOID) {
      tmp_0 = this.o1s(identity, grammarDefinitionStr, typeStr, transformStr, referenceStr, styleStr, formatterModelStr, configurationBase, grammarAglOptions);
    } else {
      var tmp_1 = $super.o1s;
      var tmp_2 = grammarDefinitionStr;
      var tmp_3 = tmp_2 == null ? null : new GrammarString(tmp_2);
      var tmp_4 = typeStr;
      var tmp_5 = tmp_4 == null ? null : new TypesString(tmp_4);
      var tmp_6 = transformStr;
      var tmp_7 = tmp_6 == null ? null : new TransformString(tmp_6);
      var tmp_8 = referenceStr;
      var tmp_9 = tmp_8 == null ? null : new CrossReferenceString(tmp_8);
      var tmp_10 = styleStr;
      var tmp_11 = tmp_10 == null ? null : new StyleString(tmp_10);
      var tmp_12 = formatterModelStr;
      tmp_0 = tmp_1.call(this, new LanguageIdentity(identity), tmp_3, tmp_5, tmp_7, tmp_9, tmp_11, tmp_12 == null ? null : new FormatString(tmp_12), configurationBase, grammarAglOptions);
    }
    return tmp_0;
  }
  p1s(identity, grammarDefinitionStr, typeStr, transformStr, referenceStr, styleStr, formatterModelStr, configurationBase, grammarAglOptions) {
    var tmp = Agl_getInstance();
    var config = tmp.configuration(configurationBase, Agl$languageDefinitionFromStringSimple$lambda_0(grammarDefinitionStr, typeStr, transformStr, referenceStr, styleStr, formatterModelStr));
    return new LanguageDefinitionDefault(identity, grammarAglOptions, false, config);
  }
  languageDefinitionFromStringSimple(identity, grammarDefinitionStr, typeStr, transformStr, referenceStr, styleStr, formatterModelStr, configurationBase, grammarAglOptions, $super) {
    grammarDefinitionStr = grammarDefinitionStr === VOID ? null : grammarDefinitionStr;
    typeStr = typeStr === VOID ? null : typeStr;
    transformStr = transformStr === VOID ? null : transformStr;
    referenceStr = referenceStr === VOID ? null : referenceStr;
    styleStr = styleStr === VOID ? null : styleStr;
    formatterModelStr = formatterModelStr === VOID ? null : formatterModelStr;
    configurationBase = configurationBase === VOID ? this.configurationSimple() : configurationBase;
    var tmp;
    if (grammarAglOptions === VOID) {
      tmp = this.options(VOID, Agl$languageDefinitionFromStringSimple$lambda);
    } else {
      tmp = grammarAglOptions;
    }
    grammarAglOptions = tmp;
    var tmp_0;
    if ($super === VOID) {
      tmp_0 = this.p1s(identity, grammarDefinitionStr, typeStr, transformStr, referenceStr, styleStr, formatterModelStr, configurationBase, grammarAglOptions);
    } else {
      var tmp_1 = $super.p1s;
      var tmp_2 = grammarDefinitionStr;
      var tmp_3 = tmp_2 == null ? null : new GrammarString(tmp_2);
      var tmp_4 = typeStr;
      var tmp_5 = tmp_4 == null ? null : new TypesString(tmp_4);
      var tmp_6 = transformStr;
      var tmp_7 = tmp_6 == null ? null : new TransformString(tmp_6);
      var tmp_8 = referenceStr;
      var tmp_9 = tmp_8 == null ? null : new CrossReferenceString(tmp_8);
      var tmp_10 = styleStr;
      var tmp_11 = tmp_10 == null ? null : new StyleString(tmp_10);
      var tmp_12 = formatterModelStr;
      tmp_0 = tmp_1.call(this, new LanguageIdentity(identity), tmp_3, tmp_5, tmp_7, tmp_9, tmp_11, tmp_12 == null ? null : new FormatString(tmp_12), configurationBase, grammarAglOptions);
    }
    return tmp_0;
  }
}
class Expansion {
  constructor(ruleItem, name, list) {
    this.ruleItem = ruleItem;
    this.name = name;
    this.list = list;
  }
  q1s() {
    return this.ruleItem;
  }
  e3() {
    return this.name;
  }
  r1s() {
    return this.list;
  }
  bh() {
    return this.ruleItem;
  }
  ch() {
    return this.name;
  }
  ds() {
    return this.list;
  }
  s1s(ruleItem, name, list) {
    return new Expansion(ruleItem, name, list);
  }
  copy(ruleItem, name, list, $super) {
    ruleItem = ruleItem === VOID ? this.ruleItem : ruleItem;
    name = name === VOID ? this.name : name;
    list = list === VOID ? this.list : list;
    return $super === VOID ? this.s1s(ruleItem, name, list) : $super.s1s.call(this, ruleItem, name, list);
  }
  toString() {
    return 'Expansion(ruleItem=' + toString(this.ruleItem) + ', name=' + this.name + ', list=' + this.list + ')';
  }
  hashCode() {
    var result = hashCode(this.ruleItem);
    result = imul(result, 31) + (this.name == null ? 0 : getStringHashCode(this.name)) | 0;
    result = imul(result, 31) + getStringHashCode(this.list) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof Expansion))
      return false;
    var tmp0_other_with_cast = other instanceof Expansion ? other : THROW_CCE();
    if (!equals(this.ruleItem, tmp0_other_with_cast.ruleItem))
      return false;
    if (!(this.name == tmp0_other_with_cast.name))
      return false;
    if (!(this.list === tmp0_other_with_cast.list))
      return false;
    return true;
  }
}
class sam$kotlin_Comparator$0 {
  constructor(function_0) {
    this.t1s_1 = function_0;
  }
  wh(a, b) {
    return this.t1s_1(a, b);
  }
  compare(a, b) {
    return this.wh(a, b);
  }
  w3() {
    return this.t1s_1;
  }
  equals(other) {
    var tmp;
    if (!(other == null) ? isInterface(other, Comparator) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.w3(), other.w3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.w3());
  }
}
class Companion {
  defaultSortAndFilter(items) {
    // Inline function 'kotlin.collections.groupBy' call
    // Inline function 'kotlin.collections.groupByTo' call
    var destination = LinkedHashMap.l4();
    var _iterator__ex2g4s = items.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var key = element.text;
      // Inline function 'kotlin.collections.getOrPut' call
      var value = destination.z2(key);
      var tmp;
      if (value == null) {
        var answer = ArrayList.y();
        destination.r2(key, answer);
        tmp = answer;
      } else {
        tmp = value;
      }
      var list = tmp;
      list.r(element);
    }
    var grouped = destination;
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination_0 = ArrayList.w(grouped.v());
    // Inline function 'kotlin.collections.iterator' call
    var _iterator__ex2g4s_0 = grouped.w2().s();
    while (_iterator__ex2g4s_0.t()) {
      var item = _iterator__ex2g4s_0.u();
      var list_0 = item.b3();
      var tmp_0;
      switch (list_0.v()) {
        case 0:
          var message = 'should not happen';
          throw IllegalStateException.v4(toString(message));
        case 1:
          tmp_0 = first(list_0);
          break;
        default:
          var tmp$ret$7;
          $l$block: {
            // Inline function 'kotlin.collections.firstOrNull' call
            var _iterator__ex2g4s_1 = list_0.s();
            while (_iterator__ex2g4s_1.t()) {
              var element_0 = _iterator__ex2g4s_1.u();
              if (element_0.kind.equals(CompletionItemKind_REFERRED_getInstance())) {
                tmp$ret$7 = element_0;
                break $l$block;
              }
            }
            tmp$ret$7 = null;
          }

          var tmp1_elvis_lhs = tmp$ret$7;
          var tmp_1;
          if (tmp1_elvis_lhs == null) {
            var tmp$ret$9;
            $l$block_0: {
              // Inline function 'kotlin.collections.firstOrNull' call
              var _iterator__ex2g4s_2 = list_0.s();
              while (_iterator__ex2g4s_2.t()) {
                var element_1 = _iterator__ex2g4s_2.u();
                if (element_1.kind.equals(CompletionItemKind_LITERAL_getInstance())) {
                  tmp$ret$9 = element_1;
                  break $l$block_0;
                }
              }
              tmp$ret$9 = null;
            }
            tmp_1 = tmp$ret$9;
          } else {
            tmp_1 = tmp1_elvis_lhs;
          }

          var tmp2_elvis_lhs = tmp_1;
          var tmp_2;
          if (tmp2_elvis_lhs == null) {
            var tmp$ret$11;
            $l$block_1: {
              // Inline function 'kotlin.collections.firstOrNull' call
              var _iterator__ex2g4s_3 = list_0.s();
              while (_iterator__ex2g4s_3.t()) {
                var element_2 = _iterator__ex2g4s_3.u();
                if (element_2.kind.equals(CompletionItemKind_PATTERN_getInstance())) {
                  tmp$ret$11 = element_2;
                  break $l$block_1;
                }
              }
              tmp$ret$11 = null;
            }
            tmp_2 = tmp$ret$11;
          } else {
            tmp_2 = tmp2_elvis_lhs;
          }

          var tmp3_elvis_lhs = tmp_2;
          tmp_0 = tmp3_elvis_lhs == null ? first(list_0) : tmp3_elvis_lhs;
          break;
      }
      var tmp$ret$12 = tmp_0;
      destination_0.r(tmp$ret$12);
    }
    var filtered = destination_0;
    // Inline function 'kotlin.comparisons.compareByDescending' call
    var tmp_3 = CompletionProviderAbstract$Companion$defaultSortAndFilter$lambda;
    // Inline function 'kotlin.comparisons.thenBy' call
    var this_0 = new sam$kotlin_Comparator$0(tmp_3);
    var tmp_4 = CompletionProviderAbstract$Companion$defaultSortAndFilter$lambda_0(this_0);
    // Inline function 'kotlin.comparisons.thenByDescending' call
    var this_1 = new sam$kotlin_Comparator$0(tmp_4);
    var tmp_5 = CompletionProviderAbstract$Companion$defaultSortAndFilter$lambda_1(this_1);
    // Inline function 'kotlin.comparisons.thenByDescending' call
    var this_2 = new sam$kotlin_Comparator$0(tmp_5);
    var tmp_6 = CompletionProviderAbstract$Companion$defaultSortAndFilter$lambda_2(this_2);
    var tmp$ret$18 = new sam$kotlin_Comparator$0(tmp_6);
    var sorted = sortedWith(filtered, tmp$ret$18);
    return sorted;
  }
  expansionToCompletionItem(expansions) {
    // Inline function 'kotlin.collections.mapIndexed' call
    // Inline function 'kotlin.collections.mapIndexedTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(expansions, 10));
    var index = 0;
    var _iterator__ex2g4s = expansions.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var _unary__edvuaz = index;
      index = _unary__edvuaz + 1 | 0;
      var idx = checkIndexOverflow(_unary__edvuaz);
      var tmp0_elvis_lhs = item.name;
      var label = tmp0_elvis_lhs == null ? '???' : tmp0_elvis_lhs;
      var text = item.list;
      // Inline function 'kotlin.also' call
      var this_0 = new CompletionItem(CompletionItemKind_SEGMENT_getInstance(), label, text);
      this_0.id = idx;
      destination.r(this_0);
    }
    return toList(toSet(destination));
  }
  provideDefaultForSpine(spine, options) {
    var exps = this.provideForRuleItems(spine.expectedNextRuleItems, options);
    var cis = plus(this.expansionToCompletionItem(exps), this.provideForTangibles(spine.expectedNextLeafNonTerminalOrTerminal, options));
    return cis;
  }
  provideExpansionsForSpine(spine, options) {
    return this.provideForRuleItems(spine.expectedNextRuleItems, options);
  }
  provideForConcatenations(concatenations, options) {
    var tmp;
    if (options.depth === 0) {
      tmp = emptyList();
    } else {
      // Inline function 'kotlin.collections.flatMap' call
      // Inline function 'kotlin.collections.flatMapTo' call
      var destination = ArrayList.y();
      var _iterator__ex2g4s = concatenations.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        var list = Companion_instance_0.expand(options.depth, element, options);
        addAll(destination, list);
      }
      tmp = destination;
    }
    return tmp;
  }
  provideForRuleItems(ruleItems, options) {
    return this.provideExpansionsForRuleItem(options.depth, ruleItems, options);
  }
  provideExpansionsForRuleItem(curDepth, ruleItems, options) {
    // Inline function 'kotlin.collections.flatMap' call
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = ruleItems.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = Companion_instance_0.expand(curDepth, element, options);
      addAll(destination, list);
    }
    return destination;
  }
  expand(curDepth, ri, options) {
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.expandItem(curDepth, ri, options);
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp;
      if (null == item.name) {
        tmp = new Expansion(item.ruleItem, _GrammarRuleName___get_value__impl__470s0v(ri.owningRule.name), item.list);
      } else {
        tmp = item;
      }
      var tmp$ret$0 = tmp;
      destination.r(tmp$ret$0);
    }
    return destination;
  }
  expandItem(curDepth, item, options) {
    var tmp;
    if (isInterface(item, Choice)) {
      // Inline function 'kotlin.collections.flatMap' call
      var tmp0 = item.alternative;
      // Inline function 'kotlin.collections.flatMapTo' call
      var destination = ArrayList.y();
      var _iterator__ex2g4s = tmp0.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        var list = Companion_instance_0.expandItem(curDepth, element, options);
        addAll(destination, list);
      }
      tmp = destination;
    } else {
      if (isInterface(item, Concatenation)) {
        var results = listOf(new Expansion(item, null, ''));
        var tmp_0;
        var tmp2 = item.items;
        var tmp$ret$3;
        $l$block: {
          // Inline function 'kotlin.collections.count' call
          var tmp_1;
          if (isInterface(tmp2, Collection)) {
            tmp_1 = tmp2.a1();
          } else {
            tmp_1 = false;
          }
          if (tmp_1) {
            tmp$ret$3 = 0;
            break $l$block;
          }
          var count = 0;
          var _iterator__ex2g4s_0 = tmp2.s();
          while (_iterator__ex2g4s_0.t()) {
            var element_0 = _iterator__ex2g4s_0.u();
            var tmp_2;
            if (isInterface(element_0, Terminal)) {
              tmp_2 = element_0.isLiteral;
            } else {
              tmp_2 = false;
            }
            if (!tmp_2) {
              count = count + 1 | 0;
              checkCountOverflow(count);
            }
          }
          tmp$ret$3 = count;
        }
        if (tmp$ret$3 > 1) {
          tmp_0 = CompletionProviderAbstract$Companion$expandItem$lambda;
        } else {
          tmp_0 = CompletionProviderAbstract$Companion$expandItem$lambda_0;
        }
        var nameFunc = tmp_0;
        var _iterator__ex2g4s_1 = item.items.s();
        while (_iterator__ex2g4s_1.t()) {
          var concItem = _iterator__ex2g4s_1.u();
          var expand = this.expandItem(curDepth, concItem, options);
          // Inline function 'kotlin.collections.flatMap' call
          // Inline function 'kotlin.collections.flatMapTo' call
          var destination_0 = ArrayList.y();
          var _iterator__ex2g4s_2 = expand.s();
          while (_iterator__ex2g4s_2.t()) {
            var element_1 = _iterator__ex2g4s_2.u();
            var expName = nameFunc(element_1);
            var expRl = element_1.ruleItem;
            // Inline function 'kotlin.collections.map' call
            var this_0 = results;
            // Inline function 'kotlin.collections.mapTo' call
            var destination_1 = ArrayList.w(collectionSizeOrDefault(this_0, 10));
            var _iterator__ex2g4s_3 = this_0.s();
            while (_iterator__ex2g4s_3.t()) {
              var item_0 = _iterator__ex2g4s_3.u();
              var tmp_3;
              if (isBlank(element_1.list)) {
                tmp_3 = item_0;
              } else if (isBlank(item_0.list)) {
                var tmp0_elvis_lhs = item_0.name;
                tmp_3 = new Expansion(expRl, tmp0_elvis_lhs == null ? expName : tmp0_elvis_lhs, element_1.list);
              } else {
                var tmp1_elvis_lhs = item_0.name;
                tmp_3 = new Expansion(item_0.ruleItem, tmp1_elvis_lhs == null ? expName : tmp1_elvis_lhs, item_0.list + ' ' + element_1.list);
              }
              var tmp$ret$5 = tmp_3;
              destination_1.r(tmp$ret$5);
            }
            var list_0 = destination_1;
            addAll(destination_0, list_0);
          }
          var newResults = destination_0;
          results = newResults;
        }
        tmp = results;
      } else {
        if (isInterface(item, ConcatenationItem)) {
          var tmp_4;
          if (isInterface(item, OptionalItem)) {
            tmp_4 = plus_0(this.expandItem(curDepth, item.item, options), new Expansion(item, null, ''));
          } else {
            if (isInterface(item, ListOfItems)) {
              tmp_4 = this.expandItem(curDepth, item.item, options);
            } else {
              if (isInterface(item, SimpleItem)) {
                var tmp_5;
                if (isInterface(item, Group)) {
                  tmp_5 = this.expandItem(curDepth, item.groupedContent, options);
                } else {
                  if (isInterface(item, TangibleItem)) {
                    var tmp_6;
                    if (isInterface(item, EmptyRule)) {
                      tmp_6 = listOf(this.textFor(item, options));
                    } else {
                      if (isInterface(item, Terminal)) {
                        tmp_6 = listOf(this.textFor(item, options));
                      } else {
                        if (isInterface(item, Embedded)) {
                          tmp_6 = listOf(this.textFor(item, options));
                        } else {
                          if (isInterface(item, NonTerminal)) {
                            var tmp_7;
                            if (curDepth === 0) {
                              tmp_7 = listOf(this.textFor(item, options));
                            } else {
                              var refRule = item.referencedRule(item.owningRule.grammar);
                              var tmp_8;
                              if (refRule.isLeaf) {
                                tmp_8 = listOf(this.textFor(item, options));
                              } else {
                                // Inline function 'kotlin.collections.map' call
                                var this_1 = this.expandItem(curDepth - 1 | 0, refRule.rhs, options);
                                // Inline function 'kotlin.collections.mapTo' call
                                var destination_2 = ArrayList.w(collectionSizeOrDefault(this_1, 10));
                                var _iterator__ex2g4s_4 = this_1.s();
                                while (_iterator__ex2g4s_4.t()) {
                                  var item_1 = _iterator__ex2g4s_4.u();
                                  var tmp0_elvis_lhs_0 = item_1.name;
                                  var tmp$ret$11 = new Expansion(item_1.ruleItem, tmp0_elvis_lhs_0 == null ? _GrammarRuleName___get_value__impl__470s0v(item.ruleReference) : tmp0_elvis_lhs_0, item_1.list);
                                  destination_2.r(tmp$ret$11);
                                }
                                tmp_8 = destination_2;
                              }
                              tmp_7 = tmp_8;
                            }
                            tmp_6 = tmp_7;
                          } else {
                            var message = 'Unsupported subtype of TangibleItem: ' + getKClassFromExpression(item).zc();
                            throw IllegalStateException.v4(toString(message));
                          }
                        }
                      }
                    }
                    tmp_5 = tmp_6;
                  } else {
                    var message_0 = 'Unsupported subtype of SimpleItem: ' + getKClassFromExpression(item).zc();
                    throw IllegalStateException.v4(toString(message_0));
                  }
                }
                tmp_4 = tmp_5;
              } else {
                var message_1 = 'Unsupported subtype of ConcatenationItem: ' + getKClassFromExpression(item).zc();
                throw IllegalStateException.v4(toString(message_1));
              }
            }
          }
          tmp = tmp_4;
        } else {
          var message_2 = 'Unsupported subtype of RuleItem: ' + getKClassFromExpression(item).zc();
          throw IllegalStateException.v4(toString(message_2));
        }
      }
    }
    return tmp;
  }
  textFor(item, options) {
    var tmp;
    if (isInterface(item, Choice)) {
      var tmp_0 = item.alternative;
      tmp = new Expansion(item, null, '<' + joinToString(tmp_0, '|', VOID, VOID, VOID, VOID, CompletionProviderAbstract$Companion$textFor$lambda(options)) + '>');
    } else {
      if (isInterface(item, Concatenation)) {
        var tmp_1 = item.items;
        tmp = new Expansion(item, null, joinToString(tmp_1, ' ', VOID, VOID, VOID, VOID, CompletionProviderAbstract$Companion$textFor$lambda_0(options)));
      } else {
        if (isInterface(item, ConcatenationItem)) {
          var tmp_2;
          if (isInterface(item, OptionalItem)) {
            tmp_2 = new Expansion(item, null, this.textFor(item.item, options).list + '?');
          } else {
            if (isInterface(item, ListOfItems)) {
              tmp_2 = this.textFor(item.item, options);
            } else {
              if (isInterface(item, SimpleItem)) {
                var tmp_3;
                if (isInterface(item, Group)) {
                  tmp_3 = this.textFor(item.groupedContent, options);
                } else {
                  if (isInterface(item, TangibleItem)) {
                    var tmp_4;
                    if (isInterface(item, EmptyRule)) {
                      tmp_4 = new Expansion(item, null, '');
                    } else {
                      if (isInterface(item, Terminal)) {
                        var tmp_5;
                        if (item.owningRule.isLeaf) {
                          tmp_5 = new Expansion(item, null, '<' + GrammarRuleName__toString_impl_przz03(item.owningRule.name) + '>');
                        } else if (item.isPattern) {
                          var tmp_6;
                          if (options.provideValuesForPatternTerminals) {
                            var tmp_7;
                            try {
                              var p = new RegexValueProvider(item.value, _Char___init__impl__6a9atx(88));
                              var txt = p.provide();
                              tmp_7 = new Expansion(item, null, txt);
                            } catch ($p) {
                              var tmp_8;
                              if ($p instanceof Error) {
                                var t = $p;
                                printStackTrace(t);
                                tmp_8 = new Expansion(item, null, '<' + item.value + '>');
                              } else {
                                throw $p;
                              }
                              tmp_7 = tmp_8;
                            }
                            tmp_6 = tmp_7;
                          } else {
                            tmp_6 = new Expansion(item, null, '<' + item.value + '>');
                          }
                          tmp_5 = tmp_6;
                        } else {
                          tmp_5 = new Expansion(item, null, item.value);
                        }
                        tmp_4 = tmp_5;
                      } else {
                        if (isInterface(item, NonTerminal)) {
                          tmp_4 = new Expansion(item, _GrammarRuleName___get_value__impl__470s0v(item.ruleReference), '<' + _GrammarRuleName___get_value__impl__470s0v(item.ruleReference) + '>');
                        } else {
                          if (isInterface(item, Embedded)) {
                            tmp_4 = new Expansion(item, null, '<' + _SimpleName___get_value__impl__rl2r3c(item.embeddedGrammarReference.nameOrQName.simpleName) + '::' + _GrammarRuleName___get_value__impl__470s0v(item.embeddedGoalName) + '>');
                          } else {
                            var message = 'Unsupported subtype of TangibleItem: ' + getKClassFromExpression(item).zc();
                            throw IllegalStateException.v4(toString(message));
                          }
                        }
                      }
                    }
                    tmp_3 = tmp_4;
                  } else {
                    var message_0 = 'Unsupported subtype of SimpleItem: ' + getKClassFromExpression(item).zc();
                    throw IllegalStateException.v4(toString(message_0));
                  }
                }
                tmp_2 = tmp_3;
              } else {
                var message_1 = 'Unsupported subtype of ConcatenationItem: ' + getKClassFromExpression(item).zc();
                throw IllegalStateException.v4(toString(message_1));
              }
            }
          }
          tmp = tmp_2;
        } else {
          var message_2 = 'Unsupported subtype of RuleItem: ' + getKClassFromExpression(item).zc();
          throw IllegalStateException.v4(toString(message_2));
        }
      }
    }
    return tmp;
  }
  provideForTangibles(tangibles, options) {
    // Inline function 'kotlin.collections.flatMap' call
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tangibles.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.owningRule.isSkip ? emptyList() : Companion_instance_0.provideForTangible(element, options);
      addAll(destination, list);
    }
    return destination;
  }
  provideForTangible(tangibleItem, options) {
    var tmp;
    if (isInterface(tangibleItem, NonTerminal)) {
      var name = _GrammarRuleName___get_value__impl__470s0v(tangibleItem.ruleReference);
      var refRule = tangibleItem.referencedRule(tangibleItem.owningRule.grammar);
      var text = refRule.compressedLeaf.value;
      tmp = listOf(new CompletionItem(CompletionItemKind_PATTERN_getInstance(), text, '<' + name + '>'));
    } else {
      if (isInterface(tangibleItem, Terminal)) {
        var name_0 = tangibleItem.owningRule.isLeaf ? _GrammarRuleName___get_value__impl__470s0v(tangibleItem.owningRule.name) : tangibleItem.value;
        var tmp_0;
        if (tangibleItem.isPattern) {
          var tmp_1;
          if (options.provideValuesForPatternTerminals) {
            var tmp_2;
            try {
              var p = new RegexValueProvider(tangibleItem.value, _Char___init__impl__6a9atx(88));
              var txt = p.provide();
              tmp_2 = listOf(new CompletionItem(CompletionItemKind_PATTERN_getInstance(), tangibleItem.value, txt));
            } catch ($p) {
              var tmp_3;
              if ($p instanceof Error) {
                var t = $p;
                printStackTrace(t);
                tmp_3 = listOf(new CompletionItem(CompletionItemKind_PATTERN_getInstance(), tangibleItem.value, '<' + name_0 + '>'));
              } else {
                throw $p;
              }
              tmp_2 = tmp_3;
            }
            tmp_1 = tmp_2;
          } else {
            tmp_1 = listOf(new CompletionItem(CompletionItemKind_PATTERN_getInstance(), tangibleItem.value, '<' + name_0 + '>'));
          }
          tmp_0 = tmp_1;
        } else {
          tmp_0 = listOf(new CompletionItem(CompletionItemKind_LITERAL_getInstance(), "'" + name_0 + "'", tangibleItem.value));
        }
        tmp = tmp_0;
      } else {
        var message = 'Not supported subtype of TangibleItem: ' + getKClassFromExpression(tangibleItem).zc();
        throw IllegalStateException.v4(toString(message));
      }
    }
    return tmp;
  }
}
class CompletionProvider {}
class CompletionProviderAbstract {
  provide(nextExpected, options) {
    // Inline function 'kotlin.collections.flatMap' call
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = nextExpected.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = Companion_instance_0.provideDefaultForSpine(element, options);
      addAll(destination, list);
    }
    var items = destination;
    return Companion_instance_0.defaultSortAndFilter(items);
  }
}
class SpineNode {}
class SpineNodeAbstract {
  constructor(ruleItem, nextChildNumber) {
    this.u1s_1 = ruleItem;
    this.v1s_1 = nextChildNumber;
  }
  r1d() {
    return this.v1s_1;
  }
  xs() {
    return this.u1s_1.owningRule;
  }
  w1s() {
    return this.u1s_1.itemsForChild(this.nextChildNumber);
  }
  x1s() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.nextExpectedItems;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.firstTangibleRecursive;
      addAll(destination, list);
    }
    return toSet(destination);
  }
  y1s() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.nextExpectedItems;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.firstConcatenationRecursive;
      addAll(destination, list);
    }
    return toSet(destination);
  }
  toString() {
    return '(' + toString(this.u1s_1) + ')[' + this.nextChildNumber + ']';
  }
  get nextChildNumber() {
    return this.r1d();
  }
  get rule() {
    return this.xs();
  }
  get nextExpectedItems() {
    return this.w1s();
  }
  get expectedNextLeafNonTerminalOrTerminal() {
    return this.x1s();
  }
  get nextExpectedConcatenation() {
    return this.y1s();
  }
}
class SpineNodeRoot {
  constructor(_rootRuleItem) {
    this.z1s_1 = _rootRuleItem;
  }
  r1d() {
    return 0;
  }
  xs() {
    return this.z1s_1.owningRule;
  }
  w1s() {
    return setOf(this.z1s_1);
  }
  x1s() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.nextExpectedItems;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.firstTangibleRecursive;
      addAll(destination, list);
    }
    return toSet(destination);
  }
  y1s() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.nextExpectedItems;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.firstConcatenationRecursive;
      addAll(destination, list);
    }
    return toSet(destination);
  }
  toString() {
    return 'GOAL';
  }
  get nextChildNumber() {
    return this.r1d();
  }
  get rule() {
    return this.xs();
  }
  get nextExpectedItems() {
    return this.w1s();
  }
  get expectedNextLeafNonTerminalOrTerminal() {
    return this.x1s();
  }
  get nextExpectedConcatenation() {
    return this.y1s();
  }
}
class SpineNodeDefault extends SpineNodeAbstract {
  get nextChildNumber() {
    return this.r1d();
  }
  get rule() {
    return this.xs();
  }
  get nextExpectedItems() {
    return this.w1s();
  }
  get expectedNextLeafNonTerminalOrTerminal() {
    return this.x1s();
  }
  get nextExpectedConcatenation() {
    return this.y1s();
  }
}
class Spine {}
class SpineDefault {
  constructor(runtimeSpine, mapToGrammar) {
    this.c1t_1 = runtimeSpine;
    this.d1t_1 = mapToGrammar;
    var tmp = this;
    tmp.e1t_1 = lazy(SpineDefault$expectedNextLeafNonTerminalOrTerminal$delegate$lambda(this));
    var tmp_0 = this;
    tmp_0.f1t_1 = lazy(SpineDefault$expectedNextRuleItems$delegate$lambda(this));
    var tmp_1 = this;
    tmp_1.g1t_1 = lazy(SpineDefault$elements$delegate$lambda(this));
  }
  x1s() {
    var tmp0 = this.e1t_1;
    // Inline function 'kotlin.getValue' call
    expectedNextLeafNonTerminalOrTerminal$factory();
    return tmp0.b3();
  }
  h1t() {
    var tmp0 = this.f1t_1;
    // Inline function 'kotlin.getValue' call
    expectedNextRuleItems$factory();
    return tmp0.b3();
  }
  ek() {
    var tmp0 = this.g1t_1;
    // Inline function 'kotlin.getValue' call
    elements$factory();
    return tmp0.b3();
  }
  r1d() {
    return this.c1t_1.nextChildNumber;
  }
  toString() {
    var tmp = this.elements;
    return 'Spine ' + joinToString(tmp, '->', VOID, VOID, VOID, VOID, SpineDefault$toString$lambda);
  }
  get expectedNextLeafNonTerminalOrTerminal() {
    return this.x1s();
  }
  get expectedNextRuleItems() {
    return this.h1t();
  }
  get elements() {
    return this.ek();
  }
  get nextChildNumber() {
    return this.r1d();
  }
}
class AutomatonToKotlin {}
class Formatter {}
class FormatterAbstract {
  get formatModel() {
    return this.i1t();
  }
}
class LanguageDefinitionAbstract$grammarModel$$inlined$observable$1 extends ObservableProperty {
  constructor($initialValue, this$0, $box) {
    if ($box === VOID)
      $box = {};
    $box.k1t_1 = this$0;
    super($initialValue, $box);
  }
  l1t(property, oldValue, newValue) {
    if (!(oldValue === newValue)) {
      this.k1t_1._processor_cache.reset();
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s = this.k1t_1.grammarObservers.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        element(oldValue, newValue);
      }
    }
    return Unit_instance;
  }
  zh(property, oldValue, newValue) {
    var tmp = (oldValue == null ? true : !(oldValue == null)) ? oldValue : THROW_CCE();
    return this.l1t(property, tmp, (newValue == null ? true : !(newValue == null)) ? newValue : THROW_CCE());
  }
}
class LanguageDefinitionAbstract$targetGrammarName$$inlined$observable$1 extends ObservableProperty {
  constructor($initialValue, this$0, $box) {
    if ($box === VOID)
      $box = {};
    $box.z1t_1 = this$0;
    super($initialValue, $box);
  }
  l1t(property, oldValue, newValue) {
    var tmp = oldValue;
    var tmp_0 = newValue;
    var tmp_1 = tmp == null ? null : tmp.a1u_1;
    var tmp_2 = tmp_1 == null ? null : new SimpleName(tmp_1);
    var tmp_3 = tmp_0 == null ? null : tmp_0.a1u_1;
    if (!equals(tmp_2, tmp_3 == null ? null : new SimpleName(tmp_3))) {
      this.z1t_1._processor_cache.reset();
    }
    return Unit_instance;
  }
  zh(property, oldValue, newValue) {
    var tmp = (oldValue == null ? true : !(oldValue == null)) ? oldValue : THROW_CCE();
    return this.l1t(property, tmp, (newValue == null ? true : !(newValue == null)) ? newValue : THROW_CCE());
  }
}
class LanguageDefinitionAbstract$defaultGoalRule$$inlined$observable$1 extends ObservableProperty {
  constructor($initialValue, this$0, $box) {
    if ($box === VOID)
      $box = {};
    $box.c1u_1 = this$0;
    super($initialValue, $box);
  }
  l1t(property, oldValue, newValue) {
    var tmp = oldValue;
    var tmp_0 = newValue;
    var tmp_1 = tmp == null ? null : tmp.d1u_1;
    var tmp_2 = tmp_1 == null ? null : new GrammarRuleName(tmp_1);
    var tmp_3 = tmp_0 == null ? null : tmp_0.d1u_1;
    if (!equals(tmp_2, tmp_3 == null ? null : new GrammarRuleName(tmp_3))) {
      this.c1u_1._processor_cache.reset();
    }
    return Unit_instance;
  }
  zh(property, oldValue, newValue) {
    var tmp = (oldValue == null ? true : !(oldValue == null)) ? oldValue : THROW_CCE();
    return this.l1t(property, tmp, (newValue == null ? true : !(newValue == null)) ? newValue : THROW_CCE());
  }
}
class LanguageDefinitionAbstract$_styleResolver$$inlined$observable$1 extends ObservableProperty {
  constructor($initialValue, this$0, $box) {
    if ($box === VOID)
      $box = {};
    $box.f1u_1 = this$0;
    super($initialValue, $box);
  }
  l1t(property, oldValue, newValue) {
    if (!equals(oldValue, newValue)) {
      this.f1u_1._processor_cache.reset();
    }
    return Unit_instance;
  }
  zh(property, oldValue, newValue) {
    var tmp = (oldValue == null ? true : !(oldValue == null)) ? oldValue : THROW_CCE();
    return this.l1t(property, tmp, (newValue == null ? true : !(newValue == null)) ? newValue : THROW_CCE());
  }
}
class LanguageDefinition {}
function update(grammarString, typesString, transformString, crossReferenceString, styleString, formatString, $super) {
  grammarString = grammarString === VOID ? null : grammarString;
  typesString = typesString === VOID ? null : typesString;
  transformString = transformString === VOID ? null : transformString;
  crossReferenceString = crossReferenceString === VOID ? null : crossReferenceString;
  styleString = styleString === VOID ? null : styleString;
  formatString = formatString === VOID ? null : formatString;
  var tmp;
  if ($super === VOID) {
    this.t1v(grammarString, typesString, transformString, crossReferenceString, styleString, formatString);
    tmp = Unit_instance;
  } else {
    var tmp_0 = $super.t1v;
    var tmp_1 = grammarString;
    var tmp_2 = tmp_1 == null ? null : new GrammarString(tmp_1);
    var tmp_3 = typesString;
    var tmp_4 = tmp_3 == null ? null : new TypesString(tmp_3);
    var tmp_5 = transformString;
    var tmp_6 = tmp_5 == null ? null : new TransformString(tmp_5);
    var tmp_7 = crossReferenceString;
    var tmp_8 = tmp_7 == null ? null : new CrossReferenceString(tmp_7);
    var tmp_9 = styleString;
    var tmp_10 = tmp_9 == null ? null : new StyleString(tmp_9);
    var tmp_11 = formatString;
    tmp = tmp_0.call(this, tmp_2, tmp_4, tmp_6, tmp_8, tmp_10, tmp_11 == null ? null : new FormatString(tmp_11));
  }
  return tmp;
}
class LanguageDefinitionAbstract {
  constructor(argGrammarModel, argBuildForDefaultGoal) {
    var tmp = this;
    // Inline function 'kotlin.properties.Delegates.observable' call
    tmp.m1t_1 = new LanguageDefinitionAbstract$grammarModel$$inlined$observable$1(argGrammarModel, this);
    var tmp_0 = this;
    // Inline function 'kotlin.properties.Delegates.observable' call
    tmp_0.n1t_1 = new LanguageDefinitionAbstract$targetGrammarName$$inlined$observable$1(null, this);
    var tmp_1 = this;
    // Inline function 'kotlin.properties.Delegates.observable' call
    tmp_1.o1t_1 = new LanguageDefinitionAbstract$defaultGoalRule$$inlined$observable$1(null, this);
    var tmp_2 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_2.p1t_1 = ArrayList.y();
    var tmp_3 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_3.q1t_1 = ArrayList.y();
    var tmp_4 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_4.r1t_1 = ArrayList.y();
    var tmp_5 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_5.s1t_1 = ArrayList.y();
    var tmp_6 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_6.t1t_1 = ArrayList.y();
    var tmp_7 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_7.u1t_1 = ArrayList.y();
    var tmp_8 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_8.v1t_1 = ArrayList.y();
    var tmp_9 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_9.w1t_1 = ArrayList.y();
    var tmp_10 = this;
    // Inline function 'kotlin.apply' call
    var this_0 = cached(LanguageDefinitionAbstract$_processor_cache$lambda(this, argBuildForDefaultGoal));
    var tmp_11 = this_0;
    tmp_11.resetAction = LanguageDefinitionAbstract$_processor_cache$lambda_0(this);
    tmp_10._processor_cache = this_0;
    var tmp_12 = this;
    tmp_12._style_cache = cached(LanguageDefinitionAbstract$_style_cache$lambda(this));
    this._issues = new IssueHolder(LanguageProcessorPhase_ALL_getInstance());
    var tmp_13 = this;
    // Inline function 'kotlin.properties.Delegates.observable' call
    tmp_13.x1t_1 = new LanguageDefinitionAbstract$_styleResolver$$inlined$observable$1(null, this);
  }
  h1u(_set____db54di) {
    return this.m1t_1.di(this, grammarModel$factory(), _set____db54di);
  }
  i1u() {
    return this.m1t_1.bi(this, grammarModel$factory_0());
  }
  j1u() {
    var tmp0_safe_receiver = this.grammarModel;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.allDefinitions;
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      var tmp$ret$1;
      $l$block: {
        // Inline function 'kotlin.collections.lastOrNull' call
        var iterator = tmp1_safe_receiver.j1(tmp1_safe_receiver.v());
        while (iterator.i6()) {
          var element = iterator.k6();
          var tmp_0 = element.name;
          var tmp_1 = this.targetGrammarName;
          if (equals(new SimpleName(tmp_0), tmp_1 == null ? null : new SimpleName(tmp_1))) {
            tmp$ret$1 = element;
            break $l$block;
          }
        }
        tmp$ret$1 = null;
      }
      tmp = tmp$ret$1;
    }
    var tmp2_elvis_lhs = tmp;
    var tmp_2;
    if (tmp2_elvis_lhs == null) {
      var tmp3_safe_receiver = this.grammarModel;
      tmp_2 = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.primary;
    } else {
      tmp_2 = tmp2_elvis_lhs;
    }
    return tmp_2;
  }
  l1u(_set____db54di) {
    var tmp = targetGrammarName$factory();
    var tmp_0 = _set____db54di;
    return this.n1t_1.di(this, tmp, tmp_0 == null ? null : new SimpleName(tmp_0));
  }
  m1u() {
    var tmp = this.n1t_1.bi(this, targetGrammarName$factory_0());
    return tmp == null ? null : tmp.a1u_1;
  }
  n1u(_set____db54di) {
    var tmp = defaultGoalRule$factory();
    var tmp_0 = _set____db54di;
    return this.o1t_1.di(this, tmp, tmp_0 == null ? null : new GrammarRuleName(tmp_0));
  }
  o1u() {
    var tmp = this.o1t_1.bi(this, defaultGoalRule$factory_0());
    return tmp == null ? null : tmp.d1u_1;
  }
  p1u() {
    var tmp0_safe_receiver = this.processor;
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.typesModel;
  }
  q1u() {
    var tmp0_safe_receiver = this.processor;
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.transformModel;
  }
  r1u() {
    var tmp0_safe_receiver = this.processor;
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.crossReferenceModel;
  }
  s1u() {
    var tmp0_safe_receiver = this.processor;
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.syntaxAnalyser;
  }
  t1u() {
    var tmp0_safe_receiver = this.processor;
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.semanticAnalyser;
  }
  u1u() {
    var tmp0_safe_receiver = this.processor;
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.formatter;
  }
  n16() {
    return this._issues;
  }
  v1u() {
    return this._processor_cache.value;
  }
  w1u() {
    return this._style_cache.value;
  }
  x1u() {
    return this.p1t_1;
  }
  y1u() {
    return this.q1t_1;
  }
  z1u() {
    return this.r1t_1;
  }
  a1v() {
    return this.s1t_1;
  }
  b1v() {
    return this.t1t_1;
  }
  c1v() {
    return this.u1t_1;
  }
  d1v() {
    return this.v1t_1;
  }
  e1v() {
    return this.w1t_1;
  }
  toString() {
    return _LanguageIdentity___get_value__impl__kqfjz3(this.identity);
  }
  f1v() {
    return this._processor_cache;
  }
  g1v() {
    return this._style_cache;
  }
  h1v(_set____db54di) {
    this._issues = _set____db54di;
  }
  i1v() {
    return this._issues;
  }
  j1v(_set____db54di) {
    return this.x1t_1.di(this, _styleResolver$factory(), _set____db54di);
  }
  k1v() {
    return this.x1t_1.bi(this, _styleResolver$factory_0());
  }
  get identity() {
    return this.g1u();
  }
  get grammarModel() {
    return this.i1u();
  }
  set grammarModel(value) {
    this.h1u(value);
  }
  get targetGrammar() {
    return this.j1u();
  }
  get isModifiable() {
    return this.k1u();
  }
  get targetGrammarName() {
    return this.m1u();
  }
  set targetGrammarName(value) {
    this.l1u(value);
  }
  get defaultGoalRule() {
    return this.o1u();
  }
  set defaultGoalRule(value) {
    this.n1u(value);
  }
  get typesModel() {
    return this.p1u();
  }
  get transformModel() {
    return this.q1u();
  }
  get crossReferenceModel() {
    return this.r1u();
  }
  get syntaxAnalyser() {
    return this.s1u();
  }
  get semanticAnalyser() {
    return this.t1u();
  }
  get formatter() {
    return this.u1u();
  }
  get issues() {
    return this.n16();
  }
  get processor() {
    return this.v1u();
  }
  get styleModel() {
    return this.w1u();
  }
  get processorObservers() {
    return this.x1u();
  }
  get grammarStrObservers() {
    return this.y1u();
  }
  get grammarObservers() {
    return this.z1u();
  }
  get typeModelStrObservers() {
    return this.a1v();
  }
  get asmTransformStrObservers() {
    return this.b1v();
  }
  get crossReferenceStrObservers() {
    return this.c1v();
  }
  get formatterStrObservers() {
    return this.d1v();
  }
  get styleStrObservers() {
    return this.e1v();
  }
  get _styleResolver() {
    return this.k1v();
  }
  set _styleResolver(value) {
    this.j1v(value);
  }
  get grammarString() {
    return this.l1v();
  }
  get typesString() {
    return this.m1v();
  }
  get transformString() {
    return this.n1v();
  }
  get crossReferenceString() {
    return this.o1v();
  }
  get configuration() {
    return this.q1v();
  }
  set configuration(value) {
    this.p1v(value);
  }
  get formatString() {
    return this.r1v();
  }
  get styleString() {
    return this.s1v();
  }
}
class LanguageDefinitionDefault extends LanguageDefinitionAbstract {
  constructor(identity, aglOptions, buildForDefaultGoal, initialConfiguration) {
    super(new GrammarModelDefault(_SimpleName___init__impl__6s45d0(_LanguageIdentity___get_last__impl__k9n7m0(identity))), buildForDefaultGoal);
    this.h1w_1 = identity;
    this.i1w_1 = aglOptions;
    this.j1w_1 = true;
    this.k1w_1 = true;
    this.l1w_1 = initialConfiguration;
    this.m1w_1 = null;
    this.n1w_1 = null;
    this.o1w_1 = null;
    this.p1w_1 = null;
    this.q1w_1 = null;
    this.r1w_1 = null;
    this.s1w(initialConfiguration);
  }
  g1u() {
    return this.h1w_1;
  }
  k1u() {
    return this.k1w_1;
  }
  p1v(value) {
    this.s1w(value);
  }
  q1v() {
    return this.l1w_1;
  }
  l1v() {
    return this.m1w_1;
  }
  m1v() {
    return this.n1w_1;
  }
  n1v() {
    return this.o1w_1;
  }
  o1v() {
    return this.p1w_1;
  }
  s1v() {
    return this.q1w_1;
  }
  r1v() {
    return this.r1w_1;
  }
  t1v(grammarString, typesString, transformString, crossReferenceString, styleString, formatString) {
    var oldGrammarStr = this.m1w_1;
    var oldTypeModelStr = this.n1w_1;
    var oldTransformStr = this.o1w_1;
    var oldCrossReferenceStr = this.p1w_1;
    var oldStyleStr = this.q1w_1;
    var oldFormatStr = this.r1w_1;
    var tmp = Agl_getInstance();
    var tmp_0 = this.configuration;
    var newConfig = tmp.configuration(tmp_0, LanguageDefinitionDefault$update$lambda(grammarString, typesString, transformString, crossReferenceString, styleString, formatString));
    this.s1w(newConfig);
    notifyGrammarStringObservers(this, oldGrammarStr, this.m1w_1);
    notifyTypesStringObservers(this, oldTypeModelStr, this.n1w_1);
    notifyTransformStringObservers(this, oldTransformStr, this.o1w_1);
    notifyCrossReferenceStringObservers(this, oldCrossReferenceStr, this.p1w_1);
    notifyStyleStringObservers(this, oldStyleStr, this.q1w_1);
    notifyFormatStringObservers(this, oldFormatStr, this.r1w_1);
  }
  s1w(configuration) {
    this.j1w_1 = false;
    this._issues.clear();
    this.l1w_1 = configuration;
    var oldGrammarStr = this.m1w_1;
    this.targetGrammarName = configuration.targetGrammarName;
    this.defaultGoalRule = configuration.defaultGoalRuleName;
    this.m1w_1 = configuration.grammarString;
    this.n1w_1 = configuration.typesString;
    this.o1w_1 = configuration.transformString;
    this.p1w_1 = configuration.crossReferenceString;
    this.q1w_1 = configuration.styleString;
    this.r1w_1 = configuration.formatString;
    this._styleResolver = configuration.styleResolver;
    this.t1w(oldGrammarStr, configuration.grammarString);
    this.j1w_1 = true;
    this._processor_cache.reset();
    this._style_cache.reset();
  }
  t1w(oldValue, newValue) {
    var tmp = oldValue;
    var tmp_0 = tmp == null ? null : new GrammarString(tmp);
    var tmp_1 = newValue;
    if (!equals(tmp_0, tmp_1 == null ? null : new GrammarString(tmp_1))) {
      var tmp_2 = Agl_getInstance();
      var tmp_3;
      var tmp_4 = newValue;
      if ((tmp_4 == null ? null : new GrammarString(tmp_4)) == null) {
        tmp_3 = null;
      } else {
        tmp_3 = _GrammarString___get_value__impl__5bomff(newValue);
      }
      var res = tmp_2.grammarFromString(tmp_3, this.i1w_1);
      this._issues.addAllFrom(res.allIssues);
      var tmp_5;
      // Inline function 'kotlin.collections.isNotEmpty' call
      if (!res.allIssues.errors.a1()) {
        tmp_5 = new GrammarModelDefault(_SimpleName___init__impl__6s45d0('Error'));
      } else {
        var tmp1_elvis_lhs = res.asm;
        tmp_5 = tmp1_elvis_lhs == null ? new GrammarModelDefault(_SimpleName___init__impl__6s45d0(_LanguageIdentity___get_last__impl__k9n7m0(this.h1w_1))) : tmp1_elvis_lhs;
      }
      this.grammarModel = tmp_5;
    }
  }
}
class LanguageDefinitionFromAsm extends LanguageDefinitionAbstract {
  constructor(identity, grammarModel, buildForDefaultGoal, initialConfiguration) {
    super(grammarModel, buildForDefaultGoal);
    this.g1x_1 = identity;
    this.h1x_1 = initialConfiguration;
    this.i1x_1 = false;
    this._issues.clear();
    this.targetGrammarName = this.configuration.targetGrammarName;
    this.defaultGoalRule = this.configuration.defaultGoalRuleName;
    this._styleResolver = this.configuration.styleResolver;
    this._processor_cache.reset();
    this._style_cache.reset();
  }
  g1u() {
    return this.g1x_1;
  }
  p1v(value) {
    // Inline function 'kotlin.error' call
    var message = 'Cannot set the configuration of a LanguageDefinitionFromAsm';
    throw IllegalStateException.v4(toString(message));
  }
  q1v() {
    return this.h1x_1;
  }
  l1v() {
    var tmp0_safe_receiver = this.grammarModel;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.asString();
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp = _GrammarString___init__impl__7iaxk1(tmp1_safe_receiver);
    }
    return tmp;
  }
  k1u() {
    return this.i1x_1;
  }
  m1v() {
    var tmp0_safe_receiver = this.typesModel;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.asString();
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp = _TypesString___init__impl__keabg1(tmp1_safe_receiver);
    }
    return tmp;
  }
  n1v() {
    var tmp0_safe_receiver = this.transformModel;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.asString();
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp = _TransformString___init__impl__9dqy3g(tmp1_safe_receiver);
    }
    return tmp;
  }
  o1v() {
    var tmp0_safe_receiver = this.crossReferenceModel;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.asString();
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp = _CrossReferenceString___init__impl__2ehjbv(tmp1_safe_receiver);
    }
    return tmp;
  }
  s1v() {
    var tmp0_safe_receiver = this.styleModel;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.asString();
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp = _StyleString___init__impl__vpzm3t(tmp1_safe_receiver);
    }
    return tmp;
  }
  r1v() {
    var tmp0_safe_receiver = this.formatter;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.formatModel;
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.asString();
    return _FormatString___init__impl__5jzgt5(tmp2_elvis_lhs == null ? '' : tmp2_elvis_lhs);
  }
  t1v(grammarStr, typeModelStr, asmTransformStr, crossReferenceStr, styleStr, formatStr) {
    // Inline function 'kotlin.error' call
    var message = 'Cannot update a LanguageDefinitionFromAsm';
    throw IllegalStateException.v4(toString(message));
  }
}
class LanguageProcessor {}
function buildFor(options, $super) {
  options = options === VOID ? null : options;
  return $super === VOID ? this.v1y(options) : $super.v1y.call(this, options);
}
function scan(sentence, options, $super) {
  options = options === VOID ? null : options;
  return $super === VOID ? this.w1y(sentence, options) : $super.w1y.call(this, sentence, options);
}
function parse(sentence, options, $super) {
  options = options === VOID ? null : options;
  return $super === VOID ? this.x1y(sentence, options) : $super.x1y.call(this, sentence, options);
}
function syntaxAnalysis(sppt, options, $super) {
  options = options === VOID ? null : options;
  return $super === VOID ? this.y1y(sppt, options) : $super.y1y.call(this, sppt, options);
}
function semanticAnalysis(asm, options, $super) {
  options = options === VOID ? null : options;
  return $super === VOID ? this.a1z(asm, options) : $super.a1z.call(this, asm, options);
}
function process(sentence, options, $super) {
  options = options === VOID ? null : options;
  return $super === VOID ? this.b1z(sentence, options) : $super.b1z.call(this, sentence, options);
}
function format(sentence, options, $super) {
  options = options === VOID ? null : options;
  return $super === VOID ? this.c1z(sentence, options) : $super.c1z.call(this, sentence, options);
}
function formatAsm(asm, options, $super) {
  options = options === VOID ? null : options;
  return $super === VOID ? this.d1z(asm, options) : $super.d1z.call(this, asm, options);
}
function expectedTerminalsAt(sentence, position, options, $super) {
  options = options === VOID ? null : options;
  return $super === VOID ? this.e1z(sentence, position, options) : $super.e1z.call(this, sentence, position, options);
}
function expectedItemsAt(sentence, position, options, $super) {
  options = options === VOID ? null : options;
  return $super === VOID ? this.f1z(sentence, position, options) : $super.f1z.call(this, sentence, position, options);
}
class LanguageProcessorAbstract {
  constructor() {
    this.t1x_1 = new IssueHolder(LanguageProcessorPhase_ALL_getInstance());
    var tmp = this;
    tmp.u1x_1 = lazy(LanguageProcessorAbstract$scanner$delegate$lambda(this));
    var tmp_0 = this;
    tmp_0.v1x_1 = lazy(LanguageProcessorAbstract$parser$delegate$lambda(this));
    var tmp_1 = this;
    tmp_1.w1x_1 = lazy(LanguageProcessorAbstract$spptParser$delegate$lambda(this));
    var tmp_2 = this;
    tmp_2.x1x_1 = lazy(LanguageProcessorAbstract$defaultGoalRuleName$delegate$lambda(this));
    var tmp_3 = this;
    tmp_3.y1x_1 = lazy(LanguageProcessorAbstract$targetGrammar$delegate$lambda(this));
    var tmp_4 = this;
    tmp_4.z1x_1 = lazy(LanguageProcessorAbstract$baseTypeModel$delegate$lambda(this));
    var tmp_5 = this;
    tmp_5.a1y_1 = lazy(LanguageProcessorAbstract$transformModel$delegate$lambda(this));
    var tmp_6 = this;
    tmp_6.b1y_1 = lazy(LanguageProcessorAbstract$targetTransformRuleSet$delegate$lambda(this));
    var tmp_7 = this;
    tmp_7.c1y_1 = lazy(LanguageProcessorAbstract$crossReferenceModel$delegate$lambda(this));
    var tmp_8 = this;
    tmp_8.d1y_1 = lazy(LanguageProcessorAbstract$syntaxAnalyser$delegate$lambda(this));
    var tmp_9 = this;
    tmp_9.e1y_1 = lazy(LanguageProcessorAbstract$semanticAnalyser$delegate$lambda(this));
    var tmp_10 = this;
    tmp_10.f1y_1 = lazy(LanguageProcessorAbstract$formatModel$delegate$lambda(this));
    var tmp_11 = this;
    tmp_11.g1y_1 = lazy(LanguageProcessorAbstract$formatter$delegate$lambda(this));
    var tmp_12 = this;
    tmp_12.h1y_1 = lazy(LanguageProcessorAbstract$completionProvider$delegate$lambda(this));
  }
  n16() {
    return this.t1x_1;
  }
  nv() {
    var tmp0 = this.u1x_1;
    // Inline function 'kotlin.getValue' call
    scanner$factory();
    return tmp0.b3();
  }
  k1y() {
    var tmp0 = this.v1x_1;
    // Inline function 'kotlin.getValue' call
    parser$factory();
    return tmp0.b3();
  }
  l1y() {
    var tmp0 = this.w1x_1;
    // Inline function 'kotlin.getValue' call
    spptParser$factory();
    return tmp0.b3();
  }
  m1y() {
    var tmp0 = this.x1x_1;
    // Inline function 'kotlin.getValue' call
    defaultGoalRuleName$factory();
    var tmp = tmp0.b3();
    return tmp == null ? null : tmp.d1u_1;
  }
  j1u() {
    var tmp0 = this.y1x_1;
    // Inline function 'kotlin.getValue' call
    targetGrammar$factory();
    return tmp0.b3();
  }
  n1y() {
    var tmp0 = this.z1x_1;
    // Inline function 'kotlin.getValue' call
    baseTypeModel$factory();
    return tmp0.b3();
  }
  p1u() {
    var tmp0_elvis_lhs = this.transformModel.typeModel;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = 'Should not happen';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  q1u() {
    var tmp0 = this.a1y_1;
    // Inline function 'kotlin.getValue' call
    transformModel$factory();
    return tmp0.b3();
  }
  o1y() {
    var tmp0 = this.b1y_1;
    // Inline function 'kotlin.getValue' call
    targetTransformRuleSet$factory();
    return tmp0.b3();
  }
  r1u() {
    var tmp0 = this.c1y_1;
    // Inline function 'kotlin.getValue' call
    crossReferenceModel$factory();
    return tmp0.b3();
  }
  s1u() {
    var tmp0 = this.d1y_1;
    // Inline function 'kotlin.getValue' call
    syntaxAnalyser$factory();
    return tmp0.b3();
  }
  t1u() {
    var tmp0 = this.e1y_1;
    // Inline function 'kotlin.getValue' call
    semanticAnalyser$factory();
    return tmp0.b3();
  }
  i1t() {
    var tmp0 = this.f1y_1;
    // Inline function 'kotlin.getValue' call
    formatModel$factory();
    return tmp0.b3();
  }
  u1u() {
    var tmp0 = this.g1y_1;
    // Inline function 'kotlin.getValue' call
    formatter$factory();
    return tmp0.b3();
  }
  p1y() {
    var tmp0 = this.h1y_1;
    // Inline function 'kotlin.getValue' call
    completionProvider$factory();
    return tmp0.b3();
  }
  usedAutomatonFor(goalRuleName) {
    return ensureNotNull(this.parser).ruleSet.usedAutomatonFor(goalRuleName);
  }
  interrupt(message) {
    var tmp0_safe_receiver = this.parser;
    if (tmp0_safe_receiver == null)
      null;
    else {
      tmp0_safe_receiver.interrupt(message);
    }
  }
  parseOptionsDefault() {
    var tmp0_safe_receiver = this.m1y();
    var tmp;
    var tmp_0 = tmp0_safe_receiver;
    if ((tmp_0 == null ? null : new GrammarRuleName(tmp_0)) == null) {
      tmp = null;
    } else {
      tmp = _GrammarRuleName___get_value__impl__470s0v(tmp0_safe_receiver);
    }
    return new ParseOptionsDefault(VOID, tmp);
  }
  optionsDefault() {
    // Inline function 'kotlin.also' call
    var this_0 = new ProcessOptionsDefault();
    var tmp0_safe_receiver = this.m1y();
    var tmp;
    var tmp_0 = tmp0_safe_receiver;
    if ((tmp_0 == null ? null : new GrammarRuleName(tmp_0)) == null) {
      tmp = null;
    } else {
      tmp = _GrammarRuleName___get_value__impl__470s0v(tmp0_safe_receiver);
    }
    this_0.r1y_1.goalRuleName = tmp;
    return this_0;
  }
  v1y(options) {
    var opts = options == null ? this.parseOptionsDefault() : options;
    if (null == opts.goalRuleName) {
      var tmp1_safe_receiver = this.m1y();
      var tmp;
      var tmp_0 = tmp1_safe_receiver;
      if ((tmp_0 == null ? null : new GrammarRuleName(tmp_0)) == null) {
        tmp = null;
      } else {
        tmp = _GrammarRuleName___get_value__impl__470s0v(tmp1_safe_receiver);
      }
      opts.goalRuleName = tmp;
    }
    var tmp2_safe_receiver = this.parser;
    if (tmp2_safe_receiver == null)
      null;
    else {
      tmp2_safe_receiver.buildFor(ensureNotNull(opts.goalRuleName));
    }
    return this;
  }
  w1y(sentence, options) {
    var tmp0_safe_receiver = this.scanner;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.scan(new SentenceDefault(sentence, null), options);
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.also' call
      var tmp0_safe_receiver_0 = this.scanner;
      if (tmp0_safe_receiver_0 == null)
        null;
      else {
        tmp0_safe_receiver_0.reset();
      }
      tmp = tmp1_safe_receiver;
    }
    var tmp2_elvis_lhs = tmp;
    var tmp_0;
    if (tmp2_elvis_lhs == null) {
      var tmp3_safe_receiver = this.targetGrammar;
      var tmp_1 = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.qualifiedName;
      var message = "The processor for grammar '" + toString_0(tmp_1 == null ? null : new QualifiedName(tmp_1)) + "' was not configured with a Scanner";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_0 = tmp2_elvis_lhs;
    }
    return tmp_0;
  }
  x1y(sentence, options) {
    var opts = options == null ? this.parseOptionsDefault() : options;
    if (null == opts.goalRuleName) {
      var tmp1_safe_receiver = this.m1y();
      var tmp;
      var tmp_0 = tmp1_safe_receiver;
      if ((tmp_0 == null ? null : new GrammarRuleName(tmp_0)) == null) {
        tmp = null;
      } else {
        tmp = _GrammarRuleName___get_value__impl__470s0v(tmp1_safe_receiver);
      }
      opts.goalRuleName = tmp;
    }
    var tmp2_safe_receiver = this.parser;
    var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.parse(sentence, opts);
    var tmp_1;
    if (tmp3_safe_receiver == null) {
      tmp_1 = null;
    } else {
      // Inline function 'kotlin.also' call
      var tmp0_safe_receiver = this.scanner;
      if (tmp0_safe_receiver == null)
        null;
      else {
        tmp0_safe_receiver.reset();
      }
      var tmp1_safe_receiver_0 = this.parser;
      if (tmp1_safe_receiver_0 == null)
        null;
      else {
        tmp1_safe_receiver_0.reset();
      }
      tmp_1 = tmp3_safe_receiver;
    }
    var tmp4_elvis_lhs = tmp_1;
    var tmp_2;
    if (tmp4_elvis_lhs == null) {
      var tmp5_safe_receiver = this.targetGrammar;
      var tmp_3 = tmp5_safe_receiver == null ? null : tmp5_safe_receiver.qualifiedName;
      var message = "The processor for grammar '" + toString_0(tmp_3 == null ? null : new QualifiedName(tmp_3)) + "' was not configured with a Parser";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_2 = tmp4_elvis_lhs;
    }
    return tmp_2;
  }
  y1y(sppt, options) {
    var opts = this.z1y(options);
    var tmp0_elvis_lhs = this.syntaxAnalyser;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp1_safe_receiver = this.targetGrammar;
      var tmp_0 = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.qualifiedName;
      var message = "The processor for grammar '" + toString_0(tmp_0 == null ? null : new QualifiedName(tmp_0)) + "' was not configured with a SyntaxAnalyser";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var sa = tmp;
    sa.clear();
    var tmp_1 = sa.transform(sppt, this.j1y());
    return isInterface(tmp_1, SyntaxAnalysisResult) ? tmp_1 : THROW_CCE();
  }
  a1z(asm, options) {
    var opts = this.z1y(options);
    var tmp0_elvis_lhs = this.semanticAnalyser;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp1_safe_receiver = this.targetGrammar;
      var tmp_0 = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.qualifiedName;
      var message = "the processor for grammar '" + toString_0(tmp_0 == null ? null : new QualifiedName(tmp_0)) + "' was not configured with a SemanticAnalyser";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var semAnalyser = tmp;
    semAnalyser.clear();
    var tmp2_safe_receiver = opts.parse.sentenceIdentity;
    var sentenceId = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.invoke();
    var lm = opts.semanticAnalysis.locationMap;
    return semAnalyser.analyse(sentenceId, asm, lm, opts.semanticAnalysis);
  }
  b1z(sentence, options) {
    var opts = this.z1y(options);
    var parseResult = this.parse(sentence, opts.parse);
    var sppt = parseResult.sppt;
    var tmp;
    if (null == sppt || !opts.syntaxAnalysis.enabled) {
      tmp = new ProcessResultDefault(null, parseResult);
    } else {
      var synxResult = this.syntaxAnalysis(sppt, opts);
      var asm = synxResult.asm;
      var tmp_0;
      if (null == asm || !opts.semanticAnalysis.enabled || null == this.semanticAnalyser) {
        var issues = new IssueHolder();
        if (null == this.semanticAnalyser) {
          issues.info(null, 'There is no SemanticAnalyser configured');
        }
        if (null == synxResult.asm) {
          issues.info(null, 'There was no ASM returned by the SyntaxAnalyser');
        }
        if (!opts.semanticAnalysis.enabled) {
          issues.info(null, 'Semantic Analysis is inactive (switched off) in the options');
        }
        tmp_0 = new ProcessResultDefault(synxResult.asm, parseResult, synxResult, VOID, issues);
      } else {
        opts.semanticAnalysis.locationMap = synxResult.locationMap;
        var result = this.semanticAnalysis(asm, opts);
        tmp_0 = new ProcessResultDefault(synxResult.asm, parseResult, synxResult, result);
      }
      tmp = tmp_0;
    }
    return tmp;
  }
  c1z(sentence, options) {
    var opts = this.z1y(options);
    var parseResult = this.parse(sentence, opts.parse);
    var tmp;
    if (null == parseResult.sppt) {
      tmp = new FormatResultDefault(null, parseResult.issues);
    } else {
      var synxResult = this.syntaxAnalysis(ensureNotNull(parseResult.sppt));
      var tmp_0;
      if (null == synxResult.asm) {
        tmp_0 = new FormatResultDefault(null, plus_4(parseResult.issues, synxResult.issues));
      } else {
        var frmtResult = this.formatAsm(ensureNotNull(synxResult.asm));
        tmp_0 = new FormatResultDefault(frmtResult.sentence, plus_4(plus_4(parseResult.issues, synxResult.issues), frmtResult.issues));
      }
      tmp = tmp_0;
    }
    return tmp;
  }
  d1z(asm, options) {
    var opts = this.z1y(options);
    var formatSetName = ensureNotNull(this.targetGrammar).qualifiedName;
    var tmp0_elvis_lhs = this.formatter;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp1_safe_receiver = this.targetGrammar;
      var tmp_0 = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.qualifiedName;
      var message = "the processor for grammar '" + toString_0(tmp_0 == null ? null : new QualifiedName(tmp_0)) + "' was not configured with a Formatter";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var frmtr = tmp;
    return frmtr.format(new QualifiedName(formatSetName), asm);
  }
  e1z(sentence, position, options) {
    var opts = this.z1y(options);
    var tmp0_safe_receiver = this.parser;
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.expectedTerminalsAt(sentence, position, opts.parse);
    var tmp;
    if (tmp1_elvis_lhs == null) {
      var tmp2_safe_receiver = this.targetGrammar;
      var tmp_0 = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.qualifiedName;
      var message = "The processor for grammar '" + toString_0(tmp_0 == null ? null : new QualifiedName(tmp_0)) + "' was not configured with a Parser";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp1_elvis_lhs;
    }
    var parserExpected = tmp;
    // Inline function 'kotlin.collections.mapNotNull' call
    // Inline function 'kotlin.collections.mapNotNullTo' call
    var destination = ArrayList.y();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = parserExpected.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp_1;
      if (element.isEndOfText) {
        tmp_1 = null;
      } else if (element.isEmptyTerminal) {
        tmp_1 = null;
      } else if (element.isEmptyListTerminal) {
        tmp_1 = null;
      } else {
        var rr = element instanceof RuntimeRule ? element : THROW_CCE();
        var tmp_2 = this.j1y()(rr.runtimeRuleSetNumber, rr.ruleNumber);
        var terminalRuleItem = (tmp_2 == null ? true : isInterface(tmp_2, Terminal)) ? tmp_2 : THROW_CCE();
        var tmp_3;
        if (terminalRuleItem == null) {
          tmp_3 = null;
        } else {
          // Inline function 'kotlin.let' call
          tmp_3 = Companion_instance_0.provideForTangible(terminalRuleItem, opts.completionProvider);
        }
        tmp_1 = tmp_3;
      }
      var tmp0_safe_receiver_0 = tmp_1;
      if (tmp0_safe_receiver_0 == null)
        null;
      else {
        // Inline function 'kotlin.let' call
        destination.r(tmp0_safe_receiver_0);
      }
    }
    var terminalItems = flatten(destination);
    return new ExpectedAtResultDefault(0, terminalItems, new IssueHolder(LanguageProcessorPhase_ALL_getInstance()));
  }
  f1z(sentence, position, options) {
    var tmp;
    if (!(null == this.completionProvider)) {
      var opts = this.z1y(options);
      var tmp0_safe_receiver = this.parser;
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.expectedAt(sentence, position, opts.parse);
      var tmp_0;
      if (tmp1_elvis_lhs == null) {
        var tmp2_safe_receiver = this.targetGrammar;
        var tmp_1 = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.qualifiedName;
        var message = "The processor for grammar '" + toString_0(tmp_1 == null ? null : new QualifiedName(tmp_1)) + "' was not configured with a Parser";
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp_0 = tmp1_elvis_lhs;
      }
      var parserExpected = tmp_0;
      // Inline function 'kotlin.collections.map' call
      var this_0 = parserExpected.spines;
      // Inline function 'kotlin.collections.mapTo' call
      var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
      var _iterator__ex2g4s = this_0.s();
      while (_iterator__ex2g4s.t()) {
        var item = _iterator__ex2g4s.u();
        var tmp$ret$0 = new SpineDefault(item, this.j1y());
        destination.r(tmp$ret$0);
      }
      var spines = toSet(destination);
      var items = ensureNotNull(this.completionProvider).provide(spines, opts.completionProvider);
      var tmp_2;
      if (parserExpected.usedPosition === position) {
        tmp_2 = new ExpectedAtResultDefault(0, items, new IssueHolder(LanguageProcessorPhase_ALL_getInstance()));
      } else {
        // Inline function 'kotlin.text.substring' call
        var startIndex = parserExpected.usedPosition;
        // Inline function 'kotlin.js.asDynamic' call
        var prefix = sentence.substring(startIndex, position);
        // Inline function 'kotlin.collections.filter' call
        // Inline function 'kotlin.collections.filterTo' call
        var destination_0 = ArrayList.y();
        var _iterator__ex2g4s_0 = items.s();
        while (_iterator__ex2g4s_0.t()) {
          var element = _iterator__ex2g4s_0.u();
          if (startsWith(element.text, prefix)) {
            destination_0.r(element);
          }
        }
        var filtered = destination_0;
        tmp_2 = new ExpectedAtResultDefault(position - parserExpected.usedPosition | 0, filtered, new IssueHolder(LanguageProcessorPhase_ALL_getInstance()));
      }
      tmp = tmp_2;
    } else {
      tmp = this.expectedTerminalsAt(sentence, position, options);
    }
    return tmp;
  }
  z1y(options) {
    var opts = options == null ? this.optionsDefault() : options;
    if (null == opts.parse.goalRuleName) {
      var tmp = opts.parse;
      var tmp1_safe_receiver = this.m1y();
      var tmp_0;
      var tmp_1 = tmp1_safe_receiver;
      if ((tmp_1 == null ? null : new GrammarRuleName(tmp_1)) == null) {
        tmp_0 = null;
      } else {
        tmp_0 = _GrammarRuleName___get_value__impl__470s0v(tmp1_safe_receiver);
      }
      tmp.goalRuleName = tmp_0;
    }
    return opts;
  }
  get issues() {
    return this.n16();
  }
  get targetRuleSet() {
    return this.i1y();
  }
  get grammarModel() {
    return this.i1u();
  }
  get scanner() {
    return this.nv();
  }
  get parser() {
    return this.k1y();
  }
  get spptParser() {
    return this.l1y();
  }
  get targetGrammar() {
    return this.j1u();
  }
  get baseTypeModel() {
    return this.n1y();
  }
  get typesModel() {
    return this.p1u();
  }
  get transformModel() {
    return this.q1u();
  }
  get targetTransformRuleSet() {
    return this.o1y();
  }
  get crossReferenceModel() {
    return this.r1u();
  }
  get syntaxAnalyser() {
    return this.s1u();
  }
  get semanticAnalyser() {
    return this.t1u();
  }
  get formatModel() {
    return this.i1t();
  }
  get formatter() {
    return this.u1u();
  }
  get completionProvider() {
    return this.p1y();
  }
  get configuration() {
    return this.q1v();
  }
}
class LanguageProcessorDefault extends LanguageProcessorAbstract {
  constructor(grammarModel, configuration) {
    super();
    this.v1z_1 = grammarModel;
    this.w1z_1 = configuration;
    var tmp = this;
    tmp.x1z_1 = LanguageProcessorDefault$mapToGrammar$lambda(this);
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_0.y1z_1 = LinkedHashMap.l4();
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_1.z1z_1 = LinkedHashMap.l4();
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.v1z_1.allDefinitions;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = plus_1(element.allResolvedEmbeddedGrammars, element);
      addAll(destination, list);
    }
    var allGrammars = toSet(destination);
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination_0 = ArrayList.w(collectionSizeOrDefault(allGrammars, 10));
    var _iterator__ex2g4s_0 = allGrammars.s();
    while (_iterator__ex2g4s_0.t()) {
      var item = _iterator__ex2g4s_0.u();
      var tmp$ret$5 = new ConverterToRuntimeRules(item);
      destination_0.r(tmp$ret$5);
    }
    var converters = destination_0;
    // Inline function 'kotlin.collections.associateBy' call
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(converters, 10)), 16);
    // Inline function 'kotlin.collections.associateByTo' call
    var destination_1 = LinkedHashMap.kb(capacity);
    var _iterator__ex2g4s_1 = converters.s();
    while (_iterator__ex2g4s_1.t()) {
      var element_0 = _iterator__ex2g4s_1.u();
      var tmp_2 = element_0.j1x_1;
      var tmp$ret$9 = element_0.jr();
      destination_1.r2(tmp_2, tmp$ret$9);
    }
    var grmToRrs = destination_1;
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_2 = converters.s();
    while (_iterator__ex2g4s_2.t()) {
      var element_1 = _iterator__ex2g4s_2.u();
      element_1.a20(grmToRrs);
      var rrs = element_1.jr();
      var orm = element_1.b20();
      this.y1z_1.t2(orm);
      var tmp0_0 = this.z1z_1;
      // Inline function 'kotlin.collections.set' call
      var key = rrs.qualifiedName;
      tmp0_0.r2(key, rrs);
    }
  }
  i1u() {
    return this.v1z_1;
  }
  q1v() {
    return this.w1z_1;
  }
  i1y() {
    var tmp0_safe_receiver = this.targetGrammar;
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp = this.z1z_1.z2(_QualifiedName___get_value__impl__nkc4gq(tmp0_safe_receiver.qualifiedName));
    }
    return tmp;
  }
  j1y() {
    return this.x1z_1;
  }
  get grammarModel() {
    return this.i1u();
  }
  get configuration() {
    return this.q1v();
  }
  get targetRuleSet() {
    return this.i1y();
  }
  get issues() {
    return this.n16();
  }
  get scanner() {
    return this.nv();
  }
  get parser() {
    return this.k1y();
  }
  get spptParser() {
    return this.l1y();
  }
  get targetGrammar() {
    return this.j1u();
  }
  get baseTypeModel() {
    return this.n1y();
  }
  get typesModel() {
    return this.p1u();
  }
  get transformModel() {
    return this.q1u();
  }
  get targetTransformRuleSet() {
    return this.o1y();
  }
  get crossReferenceModel() {
    return this.r1u();
  }
  get syntaxAnalyser() {
    return this.s1u();
  }
  get semanticAnalyser() {
    return this.t1u();
  }
  get formatModel() {
    return this.i1t();
  }
  get formatter() {
    return this.u1u();
  }
  get completionProvider() {
    return this.p1y();
  }
}
class LanguageProcessorFromLanguageObject extends LanguageProcessorAbstract {
  constructor(languageObject) {
    super();
    this.r20_1 = Agl_getInstance().configurationFromLanguageObject(languageObject);
    this.s20_1 = languageObject.ruleSet;
    this.t20_1 = languageObject.grammarModel;
    this.u20_1 = languageObject.mapToGrammar;
    this.v20_1 = languageObject.crossReferenceModel;
    this.w20_1 = languageObject.syntaxAnalyser;
    var tmp = this;
    var tmp_0 = new FormatterOverAsmSimple(languageObject.formatModel, languageObject.typesModel, this.issues);
    tmp.x20_1 = isInterface(tmp_0, Formatter) ? tmp_0 : THROW_CCE();
    this.y20_1 = languageObject.semanticAnalyser;
    // Inline function 'kotlin.collections.forEach' call
    // Inline function 'kotlin.collections.iterator' call
    var _iterator__ex2g4s = languageObject.automata.w2().s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      // Inline function 'kotlin.collections.component1' call
      var userGoalRuleName = element.a3();
      // Inline function 'kotlin.collections.component2' call
      var automaton = element.b3();
      this.s20_1.addPreBuiltFor(userGoalRuleName, automaton);
    }
  }
  q1v() {
    return this.r20_1;
  }
  i1y() {
    return this.s20_1;
  }
  i1u() {
    return this.t20_1;
  }
  j1y() {
    return this.u20_1;
  }
  r1u() {
    return this.v20_1;
  }
  s1u() {
    return this.w20_1;
  }
  u1u() {
    return this.x20_1;
  }
  t1u() {
    return this.y20_1;
  }
  get configuration() {
    return this.q1v();
  }
  get targetRuleSet() {
    return this.i1y();
  }
  get grammarModel() {
    return this.i1u();
  }
  get crossReferenceModel() {
    return this.r1u();
  }
  get syntaxAnalyser() {
    return this.s1u();
  }
  get formatter() {
    return this.u1u();
  }
  get semanticAnalyser() {
    return this.t1u();
  }
  get issues() {
    return this.n16();
  }
  get scanner() {
    return this.nv();
  }
  get parser() {
    return this.k1y();
  }
  get spptParser() {
    return this.l1y();
  }
  get targetGrammar() {
    return this.j1u();
  }
  get baseTypeModel() {
    return this.n1y();
  }
  get typesModel() {
    return this.p1u();
  }
  get transformModel() {
    return this.q1u();
  }
  get targetTransformRuleSet() {
    return this.o1y();
  }
  get formatModel() {
    return this.i1t();
  }
  get completionProvider() {
    return this.p1y();
  }
}
class AglLanguages {}
class LanguageRegistryDefault$agl$1 {
  constructor(this$0) {
    var tmp = this;
    tmp.q21_1 = lazy(LanguageRegistryDefault$agl$o$base$delegate$lambda(this$0));
    var tmp_0 = this;
    tmp_0.r21_1 = lazy(LanguageRegistryDefault$agl$o$expressions$delegate$lambda(this, this$0));
    var tmp_1 = this;
    tmp_1.s21_1 = lazy(LanguageRegistryDefault$agl$o$grammar$delegate$lambda(this, this$0));
    var tmp_2 = this;
    tmp_2.t21_1 = lazy(LanguageRegistryDefault$agl$o$types$delegate$lambda(this, this$0));
    var tmp_3 = this;
    tmp_3.u21_1 = lazy(LanguageRegistryDefault$agl$o$transform$delegate$lambda(this, this$0));
    var tmp_4 = this;
    tmp_4.v21_1 = lazy(LanguageRegistryDefault$agl$o$crossReference$delegate$lambda(this, this$0));
    var tmp_5 = this;
    tmp_5.w21_1 = lazy(LanguageRegistryDefault$agl$o$format$delegate$lambda(this, this$0));
    var tmp_6 = this;
    tmp_6.x21_1 = lazy(LanguageRegistryDefault$agl$o$style$delegate$lambda(this, this$0));
  }
  z20() {
    return AglBase_getInstance().f22_1;
  }
  a21() {
    return AglExpressions_getInstance().b23_1;
  }
  b21() {
    return AglGrammar_getInstance().x23_1;
  }
  c21() {
    return AglTypes_getInstance().t24_1;
  }
  d21() {
    return AglCrossReference_getInstance().identity;
  }
  e21() {
    return AsmTransform_getInstance().identity;
  }
  f21() {
    return AglStyle_getInstance().p25_1;
  }
  g21() {
    return AglFormat_getInstance().l26_1;
  }
  h21() {
    var tmp0 = this.q21_1;
    // Inline function 'kotlin.getValue' call
    base$factory();
    return tmp0.b3();
  }
  i21() {
    var tmp0 = this.r21_1;
    // Inline function 'kotlin.getValue' call
    expressions$factory();
    return tmp0.b3();
  }
  j21() {
    var tmp0 = this.s21_1;
    // Inline function 'kotlin.getValue' call
    grammar$factory();
    return tmp0.b3();
  }
  k21() {
    var tmp0 = this.t21_1;
    // Inline function 'kotlin.getValue' call
    types$factory();
    return tmp0.b3();
  }
  m21() {
    var tmp0 = this.u21_1;
    // Inline function 'kotlin.getValue' call
    transform$factory();
    return tmp0.b3();
  }
  l21() {
    var tmp0 = this.v21_1;
    // Inline function 'kotlin.getValue' call
    crossReference$factory();
    return tmp0.b3();
  }
  o21() {
    var tmp0 = this.w21_1;
    // Inline function 'kotlin.getValue' call
    format$factory();
    return tmp0.b3();
  }
  n21() {
    var tmp0 = this.x21_1;
    // Inline function 'kotlin.getValue' call
    style$factory();
    return tmp0.b3();
  }
  get baseLanguageIdentity() {
    return this.z20();
  }
  get expressionsLanguageIdentity() {
    return this.a21();
  }
  get grammarLanguageIdentity() {
    return this.b21();
  }
  get typesLanguageIdentity() {
    return this.c21();
  }
  get crossReferenceLanguageIdentity() {
    return this.d21();
  }
  get transformLanguageIdentity() {
    return this.e21();
  }
  get styleLanguageIdentity() {
    return this.f21();
  }
  get formatLanguageIdentity() {
    return this.g21();
  }
  get base() {
    return this.h21();
  }
  get expressions() {
    return this.i21();
  }
  get grammar() {
    return this.j21();
  }
  get types() {
    return this.k21();
  }
  get transform() {
    return this.m21();
  }
  get crossReference() {
    return this.l21();
  }
  get format() {
    return this.o21();
  }
  get style() {
    return this.n21();
  }
}
class GrammarRegistry {}
class LanguageRegistry {}
function findOrPlaceholder(identity, aglOptions, configuration, $super) {
  aglOptions = aglOptions === VOID ? null : aglOptions;
  configuration = configuration === VOID ? null : configuration;
  return $super === VOID ? this.e27(identity, aglOptions, configuration) : $super.e27.call(this, new LanguageIdentity(identity), aglOptions, configuration);
}
class LanguageRegistryDefault {
  constructor() {
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.y26_1 = LinkedHashMap.l4();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_0.z26_1 = LinkedHashMap.l4();
    var tmp_1 = this;
    tmp_1.a27_1 = new LanguageRegistryDefault$agl$1(this);
  }
  b27() {
    return this.z26_1;
  }
  c27() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.languages;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    // Inline function 'kotlin.collections.iterator' call
    var _iterator__ex2g4s = tmp0.w2().s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = toList(ensureNotNull(element.b3().grammarModel).allDefinitions);
      addAll(destination, list);
    }
    return destination;
  }
  d27() {
    return this.a27_1;
  }
  registerFromDefinition(definition) {
    var tmp;
    if (this.z26_1.x2(new LanguageIdentity(definition.identity))) {
      // Inline function 'kotlin.error' call
      var message = "LanguageDefinition '" + LanguageIdentity__toString_impl_sekfl7(definition.identity) + "' is already registered, please unregister the old one first";
      throw IllegalStateException.v4(toString(message));
    } else {
      var tmp1 = this.z26_1;
      // Inline function 'kotlin.collections.set' call
      var key = new LanguageIdentity(definition.identity);
      tmp1.r2(key, definition);
      var tmp0_safe_receiver = definition.grammarModel;
      var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.allDefinitions;
      if (tmp1_safe_receiver == null)
        null;
      else {
        // Inline function 'kotlin.collections.forEach' call
        var _iterator__ex2g4s = tmp1_safe_receiver.s();
        while (_iterator__ex2g4s.t()) {
          var element = _iterator__ex2g4s.u();
          this.registerGrammar(element);
        }
      }
      tmp = definition;
    }
    return tmp;
  }
  register(identity, aglOptions, buildForDefaultGoal, configuration) {
    return this.registerFromDefinition(new LanguageDefinitionDefault(identity, aglOptions, buildForDefaultGoal, configuration));
  }
  registerFromLanguageObject(languageObject) {
    var tmp;
    if (this.z26_1.x2(new LanguageIdentity(languageObject.identity))) {
      // Inline function 'kotlin.error' call
      var message = "LanguageDefinition '" + LanguageIdentity__toString_impl_sekfl7(languageObject.identity) + "' is already registered, please unregister the old one first";
      throw IllegalStateException.v4(toString(message));
    } else {
      var definition = new LanguageDefinitionFromAsm(languageObject.identity, languageObject.grammarModel, false, Agl_getInstance().configurationFromLanguageObject(languageObject));
      var tmp_0 = this.registerFromDefinition(definition);
      tmp = isInterface(tmp_0, LanguageDefinition) ? tmp_0 : THROW_CCE();
    }
    return tmp;
  }
  unregister(identity) {
    var definition = this.z26_1.s2(new LanguageIdentity(identity));
    var tmp1_safe_receiver = definition == null ? null : definition.grammarModel;
    var tmp2_safe_receiver = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.allDefinitions;
    if (tmp2_safe_receiver == null)
      null;
    else {
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s = tmp2_safe_receiver.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        this.unregisterGrammar(element.qualifiedName);
      }
    }
  }
  findOrNull(identity) {
    var tmp = identity === this.a27_1.baseLanguageIdentity ? this.a27_1.base : identity === this.a27_1.expressionsLanguageIdentity ? this.a27_1.expressions : identity === this.a27_1.grammarLanguageIdentity ? this.a27_1.grammar : identity === this.a27_1.transformLanguageIdentity ? this.a27_1.transform : identity === this.a27_1.styleLanguageIdentity ? this.a27_1.style : identity === this.a27_1.formatLanguageIdentity ? this.a27_1.format : identity === this.a27_1.crossReferenceLanguageIdentity ? this.a27_1.crossReference : this.z26_1.z2(new LanguageIdentity(identity));
    return (tmp == null ? true : isInterface(tmp, LanguageDefinition)) ? tmp : THROW_CCE();
  }
  findWithNamespaceOrNull(localNamespace, nameOrQName) {
    var tmp0_elvis_lhs = this.findOrNull(_LanguageIdentity___init__impl__3hnnkb(localNamespace + '.' + nameOrQName));
    return tmp0_elvis_lhs == null ? this.findOrNull(_LanguageIdentity___init__impl__3hnnkb(nameOrQName)) : tmp0_elvis_lhs;
  }
  createLanguageDefinition(identity, aglOptions, configuration) {
    return new LanguageDefinitionDefault(identity, aglOptions, false, configuration == null ? Agl_getInstance().configurationEmpty() : configuration);
  }
  e27(identity, aglOptions, configuration) {
    var existing = this.findOrNull(identity);
    var tmp;
    if (null == existing) {
      var placeholder = this.createLanguageDefinition(identity, aglOptions, configuration);
      tmp = this.registerFromDefinition(placeholder);
    } else {
      tmp = existing;
    }
    return tmp;
  }
  findGrammarOrNullByQualifiedName(qualifiedName) {
    return this.y26_1.z2(new QualifiedName(qualifiedName));
  }
  findGrammarOrNull(localNamespace, nameOrQName) {
    var tmp;
    if (nameOrQName instanceof QualifiedName) {
      tmp = this.findGrammarOrNullByQualifiedName(nameOrQName.f27_1);
    } else {
      if (nameOrQName instanceof SimpleName) {
        tmp = this.findGrammarOrNullByQualifiedName(SimpleName__asQualifiedName_impl_w29pat(nameOrQName.a1u_1, localNamespace.qualifiedName));
      } else {
        noWhenBranchMatchedException();
      }
    }
    return tmp;
  }
  registerGrammar(grammar) {
    var tmp0 = this.y26_1;
    // Inline function 'kotlin.collections.set' call
    var key = new QualifiedName(grammar.qualifiedName);
    tmp0.r2(key, grammar);
  }
  unregisterGrammar(qualifiedName) {
    this.y26_1.s2(new QualifiedName(qualifiedName));
  }
  get languages() {
    return this.b27();
  }
  get grammars() {
    return this.c27();
  }
  get agl() {
    return this.d27();
  }
}
class LanguageProcessorConfiguration {}
class LanguageProcessorConfigurationEmpty {
  constructor(targetGrammarName, defaultGoalRuleName, grammarString, typesString, transformString, crossReferenceString, styleString, formatString, regexEngineKind, scannerKind, scannerResolver, parserResolver, transformResolver, typesResolver, crossReferenceResolver, syntaxAnalyserResolver, semanticAnalyserResolver, formatResolver, styleResolver, completionProviderResolver) {
    targetGrammarName = targetGrammarName === VOID ? null : targetGrammarName;
    defaultGoalRuleName = defaultGoalRuleName === VOID ? null : defaultGoalRuleName;
    grammarString = grammarString === VOID ? null : grammarString;
    typesString = typesString === VOID ? null : typesString;
    transformString = transformString === VOID ? null : transformString;
    crossReferenceString = crossReferenceString === VOID ? null : crossReferenceString;
    styleString = styleString === VOID ? null : styleString;
    formatString = formatString === VOID ? null : formatString;
    regexEngineKind = regexEngineKind === VOID ? RegexEngineKind_PLATFORM_getInstance() : regexEngineKind;
    scannerKind = scannerKind === VOID ? ScannerKind_OnDemand_getInstance() : scannerKind;
    scannerResolver = scannerResolver === VOID ? null : scannerResolver;
    parserResolver = parserResolver === VOID ? null : parserResolver;
    transformResolver = transformResolver === VOID ? null : transformResolver;
    typesResolver = typesResolver === VOID ? null : typesResolver;
    crossReferenceResolver = crossReferenceResolver === VOID ? null : crossReferenceResolver;
    syntaxAnalyserResolver = syntaxAnalyserResolver === VOID ? null : syntaxAnalyserResolver;
    semanticAnalyserResolver = semanticAnalyserResolver === VOID ? null : semanticAnalyserResolver;
    formatResolver = formatResolver === VOID ? null : formatResolver;
    styleResolver = styleResolver === VOID ? null : styleResolver;
    completionProviderResolver = completionProviderResolver === VOID ? null : completionProviderResolver;
    this.g27_1 = targetGrammarName;
    this.h27_1 = defaultGoalRuleName;
    this.i27_1 = grammarString;
    this.j27_1 = typesString;
    this.k27_1 = transformString;
    this.l27_1 = crossReferenceString;
    this.m27_1 = styleString;
    this.n27_1 = formatString;
    this.o27_1 = regexEngineKind;
    this.p27_1 = scannerKind;
    this.q27_1 = scannerResolver;
    this.r27_1 = parserResolver;
    this.s27_1 = transformResolver;
    this.t27_1 = typesResolver;
    this.u27_1 = crossReferenceResolver;
    this.v27_1 = syntaxAnalyserResolver;
    this.w27_1 = semanticAnalyserResolver;
    this.x27_1 = formatResolver;
    this.y27_1 = styleResolver;
    this.z27_1 = completionProviderResolver;
  }
  m1u() {
    return this.g27_1;
  }
  m1y() {
    return this.h27_1;
  }
  l1v() {
    return this.i27_1;
  }
  m1v() {
    return this.j27_1;
  }
  n1v() {
    return this.k27_1;
  }
  o1v() {
    return this.l27_1;
  }
  s1v() {
    return this.m27_1;
  }
  r1v() {
    return this.n27_1;
  }
  a28() {
    return this.o27_1;
  }
  b28() {
    return this.p27_1;
  }
  c28() {
    return this.q27_1;
  }
  d28() {
    return this.r27_1;
  }
  e28() {
    return this.s27_1;
  }
  f28() {
    return this.t27_1;
  }
  g28() {
    return this.u27_1;
  }
  h28() {
    return this.v27_1;
  }
  i28() {
    return this.w27_1;
  }
  j28() {
    return this.x27_1;
  }
  k28() {
    return this.y27_1;
  }
  l28() {
    return this.z27_1;
  }
  get targetGrammarName() {
    return this.m1u();
  }
  get defaultGoalRuleName() {
    return this.m1y();
  }
  get grammarString() {
    return this.l1v();
  }
  get typesString() {
    return this.m1v();
  }
  get transformString() {
    return this.n1v();
  }
  get crossReferenceString() {
    return this.o1v();
  }
  get styleString() {
    return this.s1v();
  }
  get formatString() {
    return this.r1v();
  }
  get regexEngineKind() {
    return this.a28();
  }
  get scannerKind() {
    return this.b28();
  }
  get scannerResolver() {
    return this.c28();
  }
  get parserResolver() {
    return this.d28();
  }
  get transformResolver() {
    return this.e28();
  }
  get typesResolver() {
    return this.f28();
  }
  get crossReferenceResolver() {
    return this.g28();
  }
  get syntaxAnalyserResolver() {
    return this.h28();
  }
  get semanticAnalyserResolver() {
    return this.i28();
  }
  get formatResolver() {
    return this.j28();
  }
  get styleResolver() {
    return this.k28();
  }
  get completionProviderResolver() {
    return this.l28();
  }
}
class LanguageProcessorConfigurationBase {
  constructor(targetGrammarName, defaultGoalRuleName, grammarString, typesString, transformString, crossReferenceString, styleString, formatString, regexEngineKind, scannerKind, scannerResolver, parserResolver, typesResolver, transformResolver, crossReferenceResolver, syntaxAnalyserResolver, semanticAnalyserResolver, formatResolver, styleResolver, completionProviderResolver) {
    targetGrammarName = targetGrammarName === VOID ? null : targetGrammarName;
    defaultGoalRuleName = defaultGoalRuleName === VOID ? null : defaultGoalRuleName;
    grammarString = grammarString === VOID ? null : grammarString;
    typesString = typesString === VOID ? null : typesString;
    transformString = transformString === VOID ? null : transformString;
    crossReferenceString = crossReferenceString === VOID ? null : crossReferenceString;
    styleString = styleString === VOID ? null : styleString;
    formatString = formatString === VOID ? null : formatString;
    regexEngineKind = regexEngineKind === VOID ? RegexEngineKind_PLATFORM_getInstance() : regexEngineKind;
    scannerKind = scannerKind === VOID ? ScannerKind_OnDemand_getInstance() : scannerKind;
    var tmp;
    if (scannerResolver === VOID) {
      tmp = LanguageProcessorConfigurationBase$_init_$lambda_d8he5e(regexEngineKind, scannerKind);
    } else {
      tmp = scannerResolver;
    }
    scannerResolver = tmp;
    var tmp_0;
    if (parserResolver === VOID) {
      tmp_0 = LanguageProcessorConfigurationBase$_init_$lambda_d8he5e_0;
    } else {
      tmp_0 = parserResolver;
    }
    parserResolver = tmp_0;
    var tmp_1;
    if (typesResolver === VOID) {
      tmp_1 = LanguageProcessorConfigurationBase$_init_$lambda_d8he5e_1;
    } else {
      tmp_1 = typesResolver;
    }
    typesResolver = tmp_1;
    var tmp_2;
    if (transformResolver === VOID) {
      tmp_2 = LanguageProcessorConfigurationBase$_init_$lambda_d8he5e_2;
    } else {
      tmp_2 = transformResolver;
    }
    transformResolver = tmp_2;
    var tmp_3;
    if (crossReferenceResolver === VOID) {
      tmp_3 = LanguageProcessorConfigurationBase$_init_$lambda_d8he5e_3;
    } else {
      tmp_3 = crossReferenceResolver;
    }
    crossReferenceResolver = tmp_3;
    syntaxAnalyserResolver = syntaxAnalyserResolver === VOID ? null : syntaxAnalyserResolver;
    semanticAnalyserResolver = semanticAnalyserResolver === VOID ? null : semanticAnalyserResolver;
    var tmp_4;
    if (formatResolver === VOID) {
      tmp_4 = LanguageProcessorConfigurationBase$_init_$lambda_d8he5e_4;
    } else {
      tmp_4 = formatResolver;
    }
    formatResolver = tmp_4;
    var tmp_5;
    if (styleResolver === VOID) {
      tmp_5 = LanguageProcessorConfigurationBase$_init_$lambda_d8he5e_5;
    } else {
      tmp_5 = styleResolver;
    }
    styleResolver = tmp_5;
    completionProviderResolver = completionProviderResolver === VOID ? null : completionProviderResolver;
    this.m28_1 = targetGrammarName;
    this.n28_1 = defaultGoalRuleName;
    this.o28_1 = grammarString;
    this.p28_1 = typesString;
    this.q28_1 = transformString;
    this.r28_1 = crossReferenceString;
    this.s28_1 = styleString;
    this.t28_1 = formatString;
    this.u28_1 = regexEngineKind;
    this.v28_1 = scannerKind;
    this.w28_1 = scannerResolver;
    this.x28_1 = parserResolver;
    this.y28_1 = typesResolver;
    this.z28_1 = transformResolver;
    this.a29_1 = crossReferenceResolver;
    this.b29_1 = syntaxAnalyserResolver;
    this.c29_1 = semanticAnalyserResolver;
    this.d29_1 = formatResolver;
    this.e29_1 = styleResolver;
    this.f29_1 = completionProviderResolver;
  }
  m1u() {
    return this.m28_1;
  }
  m1y() {
    return this.n28_1;
  }
  l1v() {
    return this.o28_1;
  }
  m1v() {
    return this.p28_1;
  }
  n1v() {
    return this.q28_1;
  }
  o1v() {
    return this.r28_1;
  }
  s1v() {
    return this.s28_1;
  }
  r1v() {
    return this.t28_1;
  }
  a28() {
    return this.u28_1;
  }
  b28() {
    return this.v28_1;
  }
  c28() {
    return this.w28_1;
  }
  d28() {
    return this.x28_1;
  }
  f28() {
    return this.y28_1;
  }
  e28() {
    return this.z28_1;
  }
  g28() {
    return this.a29_1;
  }
  h28() {
    return this.b29_1;
  }
  i28() {
    return this.c29_1;
  }
  j28() {
    return this.d29_1;
  }
  k28() {
    return this.e29_1;
  }
  l28() {
    return this.f29_1;
  }
  get targetGrammarName() {
    return this.m1u();
  }
  get defaultGoalRuleName() {
    return this.m1y();
  }
  get grammarString() {
    return this.l1v();
  }
  get typesString() {
    return this.m1v();
  }
  get transformString() {
    return this.n1v();
  }
  get crossReferenceString() {
    return this.o1v();
  }
  get styleString() {
    return this.s1v();
  }
  get formatString() {
    return this.r1v();
  }
  get regexEngineKind() {
    return this.a28();
  }
  get scannerKind() {
    return this.b28();
  }
  get scannerResolver() {
    return this.c28();
  }
  get parserResolver() {
    return this.d28();
  }
  get typesResolver() {
    return this.f28();
  }
  get transformResolver() {
    return this.e28();
  }
  get crossReferenceResolver() {
    return this.g28();
  }
  get syntaxAnalyserResolver() {
    return this.h28();
  }
  get semanticAnalyserResolver() {
    return this.i28();
  }
  get formatResolver() {
    return this.j28();
  }
  get styleResolver() {
    return this.k28();
  }
  get completionProviderResolver() {
    return this.l28();
  }
}
class LanguageProcessorConfigurationSimple {
  constructor(targetGrammarName, defaultGoalRuleName, grammarString, typesString, transformString, crossReferenceString, styleString, formatString, regexEngineKind, scannerKind, scannerResolver, parserResolver, typesResolver, transformResolver, crossReferenceResolver, syntaxAnalyserResolver, semanticAnalyserResolver, formatResolver, styleResolver, completionProviderResolver) {
    targetGrammarName = targetGrammarName === VOID ? null : targetGrammarName;
    defaultGoalRuleName = defaultGoalRuleName === VOID ? null : defaultGoalRuleName;
    grammarString = grammarString === VOID ? null : grammarString;
    typesString = typesString === VOID ? null : typesString;
    transformString = transformString === VOID ? null : transformString;
    crossReferenceString = crossReferenceString === VOID ? null : crossReferenceString;
    styleString = styleString === VOID ? null : styleString;
    formatString = formatString === VOID ? null : formatString;
    regexEngineKind = regexEngineKind === VOID ? RegexEngineKind_PLATFORM_getInstance() : regexEngineKind;
    scannerKind = scannerKind === VOID ? ScannerKind_OnDemand_getInstance() : scannerKind;
    var tmp;
    if (scannerResolver === VOID) {
      tmp = LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx(regexEngineKind, scannerKind);
    } else {
      tmp = scannerResolver;
    }
    scannerResolver = tmp;
    var tmp_0;
    if (parserResolver === VOID) {
      tmp_0 = LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_0;
    } else {
      tmp_0 = parserResolver;
    }
    parserResolver = tmp_0;
    var tmp_1;
    if (typesResolver === VOID) {
      tmp_1 = LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_1;
    } else {
      tmp_1 = typesResolver;
    }
    typesResolver = tmp_1;
    var tmp_2;
    if (transformResolver === VOID) {
      tmp_2 = LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_2;
    } else {
      tmp_2 = transformResolver;
    }
    transformResolver = tmp_2;
    var tmp_3;
    if (crossReferenceResolver === VOID) {
      tmp_3 = LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_3;
    } else {
      tmp_3 = crossReferenceResolver;
    }
    crossReferenceResolver = tmp_3;
    var tmp_4;
    if (syntaxAnalyserResolver === VOID) {
      tmp_4 = LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_4;
    } else {
      tmp_4 = syntaxAnalyserResolver;
    }
    syntaxAnalyserResolver = tmp_4;
    var tmp_5;
    if (semanticAnalyserResolver === VOID) {
      tmp_5 = LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_5;
    } else {
      tmp_5 = semanticAnalyserResolver;
    }
    semanticAnalyserResolver = tmp_5;
    var tmp_6;
    if (formatResolver === VOID) {
      tmp_6 = LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_6;
    } else {
      tmp_6 = formatResolver;
    }
    formatResolver = tmp_6;
    var tmp_7;
    if (styleResolver === VOID) {
      tmp_7 = LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_7;
    } else {
      tmp_7 = styleResolver;
    }
    styleResolver = tmp_7;
    var tmp_8;
    if (completionProviderResolver === VOID) {
      tmp_8 = LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_8;
    } else {
      tmp_8 = completionProviderResolver;
    }
    completionProviderResolver = tmp_8;
    this.g29_1 = targetGrammarName;
    this.h29_1 = defaultGoalRuleName;
    this.i29_1 = grammarString;
    this.j29_1 = typesString;
    this.k29_1 = transformString;
    this.l29_1 = crossReferenceString;
    this.m29_1 = styleString;
    this.n29_1 = formatString;
    this.o29_1 = regexEngineKind;
    this.p29_1 = scannerKind;
    this.q29_1 = scannerResolver;
    this.r29_1 = parserResolver;
    this.s29_1 = typesResolver;
    this.t29_1 = transformResolver;
    this.u29_1 = crossReferenceResolver;
    this.v29_1 = syntaxAnalyserResolver;
    this.w29_1 = semanticAnalyserResolver;
    this.x29_1 = formatResolver;
    this.y29_1 = styleResolver;
    this.z29_1 = completionProviderResolver;
  }
  m1u() {
    return this.g29_1;
  }
  m1y() {
    return this.h29_1;
  }
  l1v() {
    return this.i29_1;
  }
  m1v() {
    return this.j29_1;
  }
  n1v() {
    return this.k29_1;
  }
  o1v() {
    return this.l29_1;
  }
  s1v() {
    return this.m29_1;
  }
  r1v() {
    return this.n29_1;
  }
  a28() {
    return this.o29_1;
  }
  b28() {
    return this.p29_1;
  }
  c28() {
    return this.q29_1;
  }
  d28() {
    return this.r29_1;
  }
  f28() {
    return this.s29_1;
  }
  e28() {
    return this.t29_1;
  }
  g28() {
    return this.u29_1;
  }
  h28() {
    return this.v29_1;
  }
  i28() {
    return this.w29_1;
  }
  j28() {
    return this.x29_1;
  }
  k28() {
    return this.y29_1;
  }
  l28() {
    return this.z29_1;
  }
  get targetGrammarName() {
    return this.m1u();
  }
  get defaultGoalRuleName() {
    return this.m1y();
  }
  get grammarString() {
    return this.l1v();
  }
  get typesString() {
    return this.m1v();
  }
  get transformString() {
    return this.n1v();
  }
  get crossReferenceString() {
    return this.o1v();
  }
  get styleString() {
    return this.s1v();
  }
  get formatString() {
    return this.r1v();
  }
  get regexEngineKind() {
    return this.a28();
  }
  get scannerKind() {
    return this.b28();
  }
  get scannerResolver() {
    return this.c28();
  }
  get parserResolver() {
    return this.d28();
  }
  get typesResolver() {
    return this.f28();
  }
  get transformResolver() {
    return this.e28();
  }
  get crossReferenceResolver() {
    return this.g28();
  }
  get syntaxAnalyserResolver() {
    return this.h28();
  }
  get semanticAnalyserResolver() {
    return this.i28();
  }
  get formatResolver() {
    return this.j28();
  }
  get styleResolver() {
    return this.k28();
  }
  get completionProviderResolver() {
    return this.l28();
  }
}
class LanguageProcessorConfigurationBuilder {
  constructor(base) {
    this.base = base;
    this.a2a_1 = this.base.grammarString;
    this.b2a_1 = this.base.typesString;
    this.c2a_1 = this.base.transformString;
    this.d2a_1 = this.base.crossReferenceString;
    this.e2a_1 = this.base.styleString;
    this.f2a_1 = this.base.formatString;
    this.g2a_1 = this.base.regexEngineKind;
    this.h2a_1 = this.base.scannerKind;
    this.i2a_1 = this.base.targetGrammarName;
    this.j2a_1 = this.base.defaultGoalRuleName;
    this.k2a_1 = this.base.scannerResolver;
    this.l2a_1 = this.base.parserResolver;
    this.m2a_1 = this.base.transformResolver;
    this.n2a_1 = this.base.typesResolver;
    this.o2a_1 = this.base.crossReferenceResolver;
    this.p2a_1 = this.base.syntaxAnalyserResolver;
    this.q2a_1 = this.base.semanticAnalyserResolver;
    this.r2a_1 = this.base.formatResolver;
    this.s2a_1 = this.base.styleResolver;
    this.t2a_1 = this.base.completionProviderResolver;
  }
  h21() {
    return this.base;
  }
  targetGrammarName(value) {
    var tmp = this;
    var tmp_0;
    if (value == null) {
      tmp_0 = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp_0 = _SimpleName___init__impl__6s45d0(value);
    }
    tmp.i2a_1 = tmp_0;
  }
  defaultGoalRuleName(value) {
    var tmp = this;
    var tmp_0;
    if (value == null) {
      tmp_0 = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp_0 = _GrammarRuleName___init__impl__yqiut(value);
    }
    tmp.j2a_1 = tmp_0;
  }
  grammarString(value) {
    this.a2a_1 = value;
  }
  typesString(value) {
    this.b2a_1 = value;
  }
  transformString(value) {
    this.c2a_1 = value;
  }
  crossReferenceString(value) {
    this.d2a_1 = value;
  }
  styleString(value) {
    this.e2a_1 = value;
  }
  formatString(value) {
    this.f2a_1 = value;
  }
  scanner(scannerKind, regexEngineKind) {
    var tmp = this;
    tmp.k2a_1 = LanguageProcessorConfigurationBuilder$scanner$lambda(regexEngineKind, scannerKind);
  }
  scannerResolver(func) {
    this.k2a_1 = func;
  }
  parserResolver(func) {
    this.l2a_1 = func;
  }
  transformResolver(func) {
    this.m2a_1 = func;
  }
  typesResolver(func) {
    this.n2a_1 = func;
  }
  crossReferenceResolver(func) {
    this.o2a_1 = func;
  }
  syntaxAnalyserResolver(func) {
    this.p2a_1 = func;
  }
  syntaxAnalyserResolverResult(func) {
    var tmp = this;
    tmp.p2a_1 = LanguageProcessorConfigurationBuilder$syntaxAnalyserResolverResult$lambda(func);
  }
  semanticAnalyserResolver(value) {
    this.q2a_1 = value;
  }
  semanticAnalyserResolverResult(func) {
    var tmp = this;
    tmp.q2a_1 = LanguageProcessorConfigurationBuilder$semanticAnalyserResolverResult$lambda(func);
  }
  formatResolver(func) {
    this.r2a_1 = func;
  }
  styleResolver(func) {
    this.s2a_1 = func;
  }
  completionProvider(value) {
    this.t2a_1 = value;
  }
  build() {
    var tmp0_targetGrammarName = this.i2a_1;
    var tmp1_defaultGoalRuleName = this.j2a_1;
    var tmp2_grammarString = this.a2a_1;
    var tmp3_typesString = this.b2a_1;
    var tmp4_transformString = this.c2a_1;
    var tmp5_crossReferenceString = this.d2a_1;
    var tmp6_styleString = this.e2a_1;
    var tmp7_formatString = this.f2a_1;
    var tmp8_regexEngineKind = this.g2a_1;
    var tmp9_scannerKind = this.h2a_1;
    var tmp10_scannerResolver = this.k2a_1;
    var tmp11_parserResolver = this.l2a_1;
    var tmp12_typesResolver = this.n2a_1;
    var tmp13_transformResolver = this.m2a_1;
    var tmp14_crossReferenceResolver = this.o2a_1;
    var tmp15_syntaxAnalyserResolver = this.p2a_1;
    var tmp16_semanticAnalyserResolver = this.q2a_1;
    var tmp17_formatResolver = this.r2a_1;
    var tmp18_styleResolver = this.s2a_1;
    var tmp19_completionProviderResolver = this.t2a_1;
    return new LanguageProcessorConfigurationEmpty(tmp0_targetGrammarName, tmp1_defaultGoalRuleName, tmp2_grammarString, tmp3_typesString, tmp4_transformString, tmp5_crossReferenceString, tmp6_styleString, tmp7_formatString, tmp8_regexEngineKind, tmp9_scannerKind, tmp10_scannerResolver, tmp11_parserResolver, tmp13_transformResolver, tmp12_typesResolver, tmp14_crossReferenceResolver, tmp15_syntaxAnalyserResolver, tmp16_semanticAnalyserResolver, tmp17_formatResolver, tmp18_styleResolver, tmp19_completionProviderResolver);
  }
}
class LanguageProcessorConfigurationDslMarker {
  equals(other) {
    if (!(other instanceof LanguageProcessorConfigurationDslMarker))
      return false;
    other instanceof LanguageProcessorConfigurationDslMarker || THROW_CCE();
    return true;
  }
  hashCode() {
    return 0;
  }
  toString() {
    return '@net.akehurst.language.agl.processor.LanguageProcessorConfigurationDslMarker(' + ')';
  }
}
class ProcessOptions {}
class ProcessOptionsDefault {
  constructor(scan, parse, syntaxAnalysis, semanticAnalysis, completionProvider) {
    scan = scan === VOID ? new ScanOptionsDefault() : scan;
    parse = parse === VOID ? new ParseOptionsDefault() : parse;
    syntaxAnalysis = syntaxAnalysis === VOID ? new SyntaxAnalysisOptionsDefault() : syntaxAnalysis;
    semanticAnalysis = semanticAnalysis === VOID ? new SemanticAnalysisOptionsDefault() : semanticAnalysis;
    completionProvider = completionProvider === VOID ? new CompletionProviderOptionsDefault() : completionProvider;
    this.q1y_1 = scan;
    this.r1y_1 = parse;
    this.s1y_1 = syntaxAnalysis;
    this.t1y_1 = semanticAnalysis;
    this.u1y_1 = completionProvider;
  }
  u2a() {
    return this.q1y_1;
  }
  v2a() {
    return this.r1y_1;
  }
  w2a() {
    return this.s1y_1;
  }
  x2a() {
    return this.t1y_1;
  }
  p1y() {
    return this.u1y_1;
  }
  clone() {
    return new ProcessOptionsDefault(this.q1y_1.clone(), this.r1y_1.clone(), this.s1y_1.clone(), this.t1y_1.clone(), this.u1y_1.clone());
  }
  get scan() {
    return this.u2a();
  }
  get parse() {
    return this.v2a();
  }
  get syntaxAnalysis() {
    return this.w2a();
  }
  get semanticAnalysis() {
    return this.x2a();
  }
  get completionProvider() {
    return this.p1y();
  }
}
class SyntaxAnalysisOptions {}
class SyntaxAnalysisOptionsDefault {
  constructor(enabled) {
    enabled = enabled === VOID ? true : enabled;
    this.y2a_1 = enabled;
  }
  y15(_set____db54di) {
    this.y2a_1 = _set____db54di;
  }
  z15() {
    return this.y2a_1;
  }
  clone() {
    return new SyntaxAnalysisOptionsDefault(this.y2a_1);
  }
  get enabled() {
    return this.z15();
  }
  set enabled(value) {
    this.y15(value);
  }
}
class SemanticAnalysisOptions {}
class SemanticAnalysisOptionsDefault {
  constructor(enabled, locationMap, context, buildScope, replaceIfItemAlreadyExistsInScope, ifItemAlreadyExistsInScopeIssueKind, checkReferences, resolveReferences, other) {
    enabled = enabled === VOID ? true : enabled;
    locationMap = locationMap === VOID ? new LocationMapDefault() : locationMap;
    context = context === VOID ? null : context;
    buildScope = buildScope === VOID ? true : buildScope;
    replaceIfItemAlreadyExistsInScope = replaceIfItemAlreadyExistsInScope === VOID ? false : replaceIfItemAlreadyExistsInScope;
    ifItemAlreadyExistsInScopeIssueKind = ifItemAlreadyExistsInScopeIssueKind === VOID ? LanguageIssueKind_ERROR_getInstance() : ifItemAlreadyExistsInScopeIssueKind;
    checkReferences = checkReferences === VOID ? true : checkReferences;
    resolveReferences = resolveReferences === VOID ? true : resolveReferences;
    var tmp;
    if (other === VOID) {
      // Inline function 'kotlin.collections.mutableMapOf' call
      tmp = LinkedHashMap.l4();
    } else {
      tmp = other;
    }
    other = tmp;
    this.z2a_1 = enabled;
    this.a2b_1 = locationMap;
    this.b2b_1 = context;
    this.c2b_1 = buildScope;
    this.d2b_1 = replaceIfItemAlreadyExistsInScope;
    this.e2b_1 = ifItemAlreadyExistsInScopeIssueKind;
    this.f2b_1 = checkReferences;
    this.g2b_1 = resolveReferences;
    this.h2b_1 = other;
  }
  y15(_set____db54di) {
    this.z2a_1 = _set____db54di;
  }
  z15() {
    return this.z2a_1;
  }
  i2b(_set____db54di) {
    this.a2b_1 = _set____db54di;
  }
  j2b() {
    return this.a2b_1;
  }
  k2b(_set____db54di) {
    this.b2b_1 = _set____db54di;
  }
  cs() {
    return this.b2b_1;
  }
  l2b(_set____db54di) {
    this.c2b_1 = _set____db54di;
  }
  m2b() {
    return this.c2b_1;
  }
  n2b(_set____db54di) {
    this.d2b_1 = _set____db54di;
  }
  o2b() {
    return this.d2b_1;
  }
  p2b(_set____db54di) {
    this.e2b_1 = _set____db54di;
  }
  q2b() {
    return this.e2b_1;
  }
  r2b(_set____db54di) {
    this.f2b_1 = _set____db54di;
  }
  s2b() {
    return this.f2b_1;
  }
  t2b(_set____db54di) {
    this.g2b_1 = _set____db54di;
  }
  u2b() {
    return this.g2b_1;
  }
  v2b() {
    return this.h2b_1;
  }
  clone() {
    return new SemanticAnalysisOptionsDefault(this.z2a_1, this.a2b_1, this.b2b_1, this.c2b_1, this.d2b_1, this.e2b_1, this.f2b_1, this.g2b_1, this.h2b_1);
  }
  get enabled() {
    return this.z15();
  }
  set enabled(value) {
    this.y15(value);
  }
  get locationMap() {
    return this.j2b();
  }
  set locationMap(value) {
    this.i2b(value);
  }
  get context() {
    return this.cs();
  }
  set context(value) {
    this.k2b(value);
  }
  get buildScope() {
    return this.m2b();
  }
  set buildScope(value) {
    this.l2b(value);
  }
  get replaceIfItemAlreadyExistsInScope() {
    return this.o2b();
  }
  set replaceIfItemAlreadyExistsInScope(value) {
    this.n2b(value);
  }
  get ifItemAlreadyExistsInScopeIssueKind() {
    return this.q2b();
  }
  set ifItemAlreadyExistsInScopeIssueKind(value) {
    this.p2b(value);
  }
  get checkReferences() {
    return this.s2b();
  }
  set checkReferences(value) {
    this.r2b(value);
  }
  get resolveReferences() {
    return this.u2b();
  }
  set resolveReferences(value) {
    this.t2b(value);
  }
  get other() {
    return this.v2b();
  }
}
class CompletionProviderOptions {}
class CompletionProviderOptionsDefault {
  constructor(context, depth, path, showOptionalItems, provideValuesForPatternTerminals, other) {
    context = context === VOID ? null : context;
    depth = depth === VOID ? 0 : depth;
    path = path === VOID ? emptyList() : path;
    showOptionalItems = showOptionalItems === VOID ? true : showOptionalItems;
    provideValuesForPatternTerminals = provideValuesForPatternTerminals === VOID ? false : provideValuesForPatternTerminals;
    var tmp;
    if (other === VOID) {
      // Inline function 'kotlin.collections.mutableMapOf' call
      tmp = LinkedHashMap.l4();
    } else {
      tmp = other;
    }
    other = tmp;
    this.w2b_1 = context;
    this.x2b_1 = depth;
    this.y2b_1 = path;
    this.z2b_1 = showOptionalItems;
    this.a2c_1 = provideValuesForPatternTerminals;
    this.b2c_1 = other;
  }
  k2b(_set____db54di) {
    this.w2b_1 = _set____db54di;
  }
  cs() {
    return this.w2b_1;
  }
  c2c(_set____db54di) {
    this.x2b_1 = _set____db54di;
  }
  d2c() {
    return this.x2b_1;
  }
  e2c(_set____db54di) {
    this.y2b_1 = _set____db54di;
  }
  n1m() {
    return this.y2b_1;
  }
  f2c(_set____db54di) {
    this.z2b_1 = _set____db54di;
  }
  g2c() {
    return this.z2b_1;
  }
  h2c(_set____db54di) {
    this.a2c_1 = _set____db54di;
  }
  i2c() {
    return this.a2c_1;
  }
  v2b() {
    return this.b2c_1;
  }
  clone() {
    return new CompletionProviderOptionsDefault(this.w2b_1, this.x2b_1, this.y2b_1, this.z2b_1, this.a2c_1, this.b2c_1);
  }
  get context() {
    return this.cs();
  }
  set context(value) {
    this.k2b(value);
  }
  get depth() {
    return this.d2c();
  }
  set depth(value) {
    this.c2c(value);
  }
  get path() {
    return this.n1m();
  }
  set path(value) {
    this.e2c(value);
  }
  get showOptionalItems() {
    return this.g2c();
  }
  set showOptionalItems(value) {
    this.f2c(value);
  }
  get provideValuesForPatternTerminals() {
    return this.i2c();
  }
  set provideValuesForPatternTerminals(value) {
    this.h2c(value);
  }
  get other() {
    return this.v2b();
  }
}
class ScanOptionsBuilder {
  constructor(base) {
    this.j2c_1 = true;
    this.k2c_1 = false;
  }
  enabled(value) {
    this.j2c_1 = value;
  }
  resultsByLine(value) {
    this.k2c_1 = value;
  }
  build() {
    return new ScanOptionsDefault(this.j2c_1, this.k2c_1);
  }
}
class ParseOptionsBuilder {
  constructor(base) {
    this.l2c_1 = true;
    this.m2c_1 = base.goalRuleName;
    this.n2c_1 = base.sentenceIdentity;
    this.o2c_1 = base.reportErrors;
    this.p2c_1 = base.reportGrammarAmbiguities;
    this.q2c_1 = base.cacheSkip;
  }
  enabled(value) {
    this.l2c_1 = value;
  }
  goalRuleName(value) {
    this.m2c_1 = value;
  }
  sentenceIdentity(func) {
    this.n2c_1 = func;
  }
  reportErrors(value) {
    this.o2c_1 = value;
  }
  reportGrammarAmbiguities(value) {
    this.p2c_1 = value;
  }
  cacheSkip(value) {
    this.q2c_1 = value;
  }
  build() {
    return new ParseOptionsDefault(this.l2c_1, this.m2c_1, this.n2c_1, this.o2c_1, this.p2c_1, this.q2c_1);
  }
}
class ProcessOptionsBuilder {
  constructor(base) {
    this.r2c_1 = base.scan.clone();
    this.s2c_1 = base.parse.clone();
    this.t2c_1 = base.syntaxAnalysis.clone();
    this.u2c_1 = base.semanticAnalysis.clone();
    this.v2c_1 = base.completionProvider.clone();
  }
  scan(init) {
    var b = new ScanOptionsBuilder(this.r2c_1);
    init(b);
    this.r2c_1 = b.build();
  }
  parse(init) {
    var b = new ParseOptionsBuilder(this.s2c_1);
    init(b);
    this.s2c_1 = b.build();
  }
  syntaxAnalysis(init) {
    var b = new SyntaxAnalysisOptionsBuilder(this.t2c_1);
    init(b);
    this.t2c_1 = b.build();
  }
  semanticAnalysis(init) {
    var b = new SemanticAnalysisOptionsBuilder(this.u2c_1);
    init(b);
    this.u2c_1 = b.build();
  }
  completionProvider(init) {
    var b = new CompletionProviderOptionsBuilder(this.v2c_1);
    init(b);
    this.v2c_1 = b.build();
  }
  build() {
    return new ProcessOptionsDefault(this.r2c_1, this.s2c_1, this.t2c_1, this.u2c_1, this.v2c_1);
  }
}
class SyntaxAnalysisOptionsBuilder {
  constructor(base) {
    this.w2c_1 = base.enabled;
  }
  enabled(value) {
    this.w2c_1 = value;
  }
  build() {
    return new SyntaxAnalysisOptionsDefault(this.w2c_1);
  }
}
class SemanticAnalysisOptionsBuilder {
  constructor(base) {
    this.x2c_1 = base.enabled;
    this.y2c_1 = base.locationMap;
    this.z2c_1 = base.context;
    this.a2d_1 = base.buildScope;
    this.b2d_1 = base.replaceIfItemAlreadyExistsInScope;
    this.c2d_1 = base.ifItemAlreadyExistsInScopeIssueKind;
    this.d2d_1 = base.checkReferences;
    this.e2d_1 = base.resolveReferences;
    this.f2d_1 = toMutableMap(base.other);
  }
  enabled(value) {
    this.x2c_1 = value;
  }
  locationMap(value) {
    this.y2c_1 = value;
  }
  context(value) {
    this.z2c_1 = value;
  }
  buildScope(value) {
    this.a2d_1 = value;
  }
  replaceIfItemAlreadyExistsInScope(value) {
    this.b2d_1 = value;
  }
  ifItemAlreadyExistsInScopeIssueKind(value) {
    this.c2d_1 = value;
  }
  checkReferences(value) {
    this.d2d_1 = value;
  }
  resolveReferences(value) {
    this.e2d_1 = value;
  }
  option(key, value) {
    // Inline function 'kotlin.collections.set' call
    this.f2d_1.r2(key, value);
  }
  build() {
    return new SemanticAnalysisOptionsDefault(this.x2c_1, this.y2c_1, this.z2c_1, this.a2d_1, this.b2d_1, this.c2d_1, this.d2d_1, this.e2d_1, this.f2d_1);
  }
}
class CompletionProviderOptionsBuilder {
  constructor(base) {
    this.g2d_1 = base.context;
    this.h2d_1 = base.depth;
    this.i2d_1 = base.path;
    this.j2d_1 = base.showOptionalItems;
    this.k2d_1 = base.provideValuesForPatternTerminals;
    this.l2d_1 = toMutableMap(base.other);
  }
  context(value) {
    this.g2d_1 = value;
  }
  depth(value) {
    this.h2d_1 = value;
  }
  path(value) {
    this.i2d_1 = value;
  }
  showOptionalItems(value) {
    this.j2d_1 = value;
  }
  provideValuesForPatternTerminals(value) {
    this.k2d_1 = value;
  }
  option(key, value) {
    // Inline function 'kotlin.collections.set' call
    this.l2d_1.r2(key, value);
  }
  build() {
    return new CompletionProviderOptionsDefault(this.g2d_1, this.h2d_1, this.i2d_1, this.j2d_1, this.k2d_1, this.l2d_1);
  }
}
class ProcessOptionsDslMarker {
  equals(other) {
    if (!(other instanceof ProcessOptionsDslMarker))
      return false;
    other instanceof ProcessOptionsDslMarker || THROW_CCE();
    return true;
  }
  hashCode() {
    return 0;
  }
  toString() {
    return '@net.akehurst.language.agl.processor.ProcessOptionsDslMarker(' + ')';
  }
}
class LanguageProcessorResult {
  constructor(processor, issues) {
    this.processor = processor;
    this.issues = issues;
  }
  v1u() {
    return this.processor;
  }
  n16() {
    return this.issues;
  }
}
class SyntaxAnalysisResult {}
class SyntaxAnalysisResultDefault {
  constructor(asm, issues, locationMap) {
    this.m2d_1 = asm;
    this.n2d_1 = issues;
    this.o2d_1 = locationMap;
  }
  p2d() {
    return this.m2d_1;
  }
  n16() {
    return this.n2d_1;
  }
  j2b() {
    return this.o2d_1;
  }
  bh() {
    return this.m2d_1;
  }
  ch() {
    return this.n2d_1;
  }
  ds() {
    return this.o2d_1;
  }
  q2d(asm, issues, locationMap) {
    return new SyntaxAnalysisResultDefault(asm, issues, locationMap);
  }
  copy(asm, issues, locationMap, $super) {
    asm = asm === VOID ? this.m2d_1 : asm;
    issues = issues === VOID ? this.n2d_1 : issues;
    locationMap = locationMap === VOID ? this.o2d_1 : locationMap;
    return $super === VOID ? this.q2d(asm, issues, locationMap) : $super.q2d.call(this, asm, issues, locationMap);
  }
  toString() {
    return 'SyntaxAnalysisResultDefault(asm=' + toString_0(this.m2d_1) + ', issues=' + toString(this.n2d_1) + ', locationMap=' + toString(this.o2d_1) + ')';
  }
  hashCode() {
    var result = this.m2d_1 == null ? 0 : hashCode(this.m2d_1);
    result = imul(result, 31) + hashCode(this.n2d_1) | 0;
    result = imul(result, 31) + hashCode(this.o2d_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof SyntaxAnalysisResultDefault))
      return false;
    var tmp0_other_with_cast = other instanceof SyntaxAnalysisResultDefault ? other : THROW_CCE();
    if (!equals(this.m2d_1, tmp0_other_with_cast.m2d_1))
      return false;
    if (!equals(this.n2d_1, tmp0_other_with_cast.n2d_1))
      return false;
    if (!equals(this.o2d_1, tmp0_other_with_cast.o2d_1))
      return false;
    return true;
  }
  get asm() {
    return this.p2d();
  }
  get issues() {
    return this.n16();
  }
  get locationMap() {
    return this.j2b();
  }
}
class SemanticAnalysisResult {}
class SemanticAnalysisResultDefault {
  constructor(resolvedReferences, issues) {
    this.r2d_1 = resolvedReferences;
    this.s2d_1 = issues;
  }
  t2d() {
    return this.r2d_1;
  }
  n16() {
    return this.s2d_1;
  }
  bh() {
    return this.r2d_1;
  }
  ch() {
    return this.s2d_1;
  }
  u2d(resolvedReferences, issues) {
    return new SemanticAnalysisResultDefault(resolvedReferences, issues);
  }
  copy(resolvedReferences, issues, $super) {
    resolvedReferences = resolvedReferences === VOID ? this.r2d_1 : resolvedReferences;
    issues = issues === VOID ? this.s2d_1 : issues;
    return $super === VOID ? this.u2d(resolvedReferences, issues) : $super.u2d.call(this, resolvedReferences, issues);
  }
  toString() {
    return 'SemanticAnalysisResultDefault(resolvedReferences=' + toString(this.r2d_1) + ', issues=' + toString(this.s2d_1) + ')';
  }
  hashCode() {
    var result = hashCode(this.r2d_1);
    result = imul(result, 31) + hashCode(this.s2d_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof SemanticAnalysisResultDefault))
      return false;
    var tmp0_other_with_cast = other instanceof SemanticAnalysisResultDefault ? other : THROW_CCE();
    if (!equals(this.r2d_1, tmp0_other_with_cast.r2d_1))
      return false;
    if (!equals(this.s2d_1, tmp0_other_with_cast.s2d_1))
      return false;
    return true;
  }
  get resolvedReferences() {
    return this.t2d();
  }
  get issues() {
    return this.n16();
  }
}
class ProcessResult {}
class ProcessResultDefault {
  constructor(asm, parse, syntaxAnalysis, semanticAnalysis, processIssues) {
    parse = parse === VOID ? null : parse;
    syntaxAnalysis = syntaxAnalysis === VOID ? null : syntaxAnalysis;
    semanticAnalysis = semanticAnalysis === VOID ? null : semanticAnalysis;
    processIssues = processIssues === VOID ? new IssueHolder() : processIssues;
    this.v2d_1 = asm;
    this.w2d_1 = parse;
    this.x2d_1 = syntaxAnalysis;
    this.y2d_1 = semanticAnalysis;
    this.z2d_1 = processIssues;
  }
  p2d() {
    return this.v2d_1;
  }
  v2a() {
    return this.w2d_1;
  }
  w2a() {
    return this.x2d_1;
  }
  x2a() {
    return this.y2d_1;
  }
  a2e() {
    return this.z2d_1;
  }
  b2e() {
    var tmp0_safe_receiver = this.w2d_1;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.issues;
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.all;
    var parseIssues = tmp2_elvis_lhs == null ? emptySet() : tmp2_elvis_lhs;
    var tmp3_safe_receiver = this.x2d_1;
    var tmp4_safe_receiver = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.issues;
    var tmp5_elvis_lhs = tmp4_safe_receiver == null ? null : tmp4_safe_receiver.all;
    var synIssues = tmp5_elvis_lhs == null ? emptySet() : tmp5_elvis_lhs;
    var tmp6_safe_receiver = this.y2d_1;
    var tmp7_safe_receiver = tmp6_safe_receiver == null ? null : tmp6_safe_receiver.issues;
    var tmp8_elvis_lhs = tmp7_safe_receiver == null ? null : tmp7_safe_receiver.all;
    var semIssues = tmp8_elvis_lhs == null ? emptySet() : tmp8_elvis_lhs;
    return new IssueHolder(VOID, plus_2(plus_2(plus_2(parseIssues, synIssues), semIssues), this.z2d_1.all));
  }
  bh() {
    return this.v2d_1;
  }
  ch() {
    return this.w2d_1;
  }
  ds() {
    return this.x2d_1;
  }
  es() {
    return this.y2d_1;
  }
  fs() {
    return this.z2d_1;
  }
  c2e(asm, parse, syntaxAnalysis, semanticAnalysis, processIssues) {
    return new ProcessResultDefault(asm, parse, syntaxAnalysis, semanticAnalysis, processIssues);
  }
  copy(asm, parse, syntaxAnalysis, semanticAnalysis, processIssues, $super) {
    asm = asm === VOID ? this.v2d_1 : asm;
    parse = parse === VOID ? this.w2d_1 : parse;
    syntaxAnalysis = syntaxAnalysis === VOID ? this.x2d_1 : syntaxAnalysis;
    semanticAnalysis = semanticAnalysis === VOID ? this.y2d_1 : semanticAnalysis;
    processIssues = processIssues === VOID ? this.z2d_1 : processIssues;
    return $super === VOID ? this.c2e(asm, parse, syntaxAnalysis, semanticAnalysis, processIssues) : $super.c2e.call(this, asm, parse, syntaxAnalysis, semanticAnalysis, processIssues);
  }
  toString() {
    return 'ProcessResultDefault(asm=' + toString_0(this.v2d_1) + ', parse=' + toString_0(this.w2d_1) + ', syntaxAnalysis=' + toString_0(this.x2d_1) + ', semanticAnalysis=' + toString_0(this.y2d_1) + ', processIssues=' + toString(this.z2d_1) + ')';
  }
  hashCode() {
    var result = this.v2d_1 == null ? 0 : hashCode(this.v2d_1);
    result = imul(result, 31) + (this.w2d_1 == null ? 0 : hashCode(this.w2d_1)) | 0;
    result = imul(result, 31) + (this.x2d_1 == null ? 0 : hashCode(this.x2d_1)) | 0;
    result = imul(result, 31) + (this.y2d_1 == null ? 0 : hashCode(this.y2d_1)) | 0;
    result = imul(result, 31) + hashCode(this.z2d_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof ProcessResultDefault))
      return false;
    var tmp0_other_with_cast = other instanceof ProcessResultDefault ? other : THROW_CCE();
    if (!equals(this.v2d_1, tmp0_other_with_cast.v2d_1))
      return false;
    if (!equals(this.w2d_1, tmp0_other_with_cast.w2d_1))
      return false;
    if (!equals(this.x2d_1, tmp0_other_with_cast.x2d_1))
      return false;
    if (!equals(this.y2d_1, tmp0_other_with_cast.y2d_1))
      return false;
    if (!equals(this.z2d_1, tmp0_other_with_cast.z2d_1))
      return false;
    return true;
  }
  get asm() {
    return this.p2d();
  }
  get parse() {
    return this.v2a();
  }
  get syntaxAnalysis() {
    return this.w2a();
  }
  get semanticAnalysis() {
    return this.x2a();
  }
  get processIssues() {
    return this.a2e();
  }
  get allIssues() {
    return this.b2e();
  }
}
class FormatResult {}
class FormatResultDefault {
  constructor(sentence, issues) {
    this.d2e_1 = sentence;
    this.e2e_1 = issues;
  }
  mv() {
    return this.d2e_1;
  }
  n16() {
    return this.e2e_1;
  }
  bh() {
    return this.d2e_1;
  }
  ch() {
    return this.e2e_1;
  }
  f2e(sentence, issues) {
    return new FormatResultDefault(sentence, issues);
  }
  copy(sentence, issues, $super) {
    sentence = sentence === VOID ? this.d2e_1 : sentence;
    issues = issues === VOID ? this.e2e_1 : issues;
    return $super === VOID ? this.f2e(sentence, issues) : $super.f2e.call(this, sentence, issues);
  }
  toString() {
    return 'FormatResultDefault(sentence=' + this.d2e_1 + ', issues=' + toString(this.e2e_1) + ')';
  }
  hashCode() {
    var result = this.d2e_1 == null ? 0 : getStringHashCode(this.d2e_1);
    result = imul(result, 31) + hashCode(this.e2e_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof FormatResultDefault))
      return false;
    var tmp0_other_with_cast = other instanceof FormatResultDefault ? other : THROW_CCE();
    if (!(this.d2e_1 == tmp0_other_with_cast.d2e_1))
      return false;
    if (!equals(this.e2e_1, tmp0_other_with_cast.e2e_1))
      return false;
    return true;
  }
  get sentence() {
    return this.mv();
  }
  get issues() {
    return this.n16();
  }
}
class ExpectedAtResult {}
class ExpectedAtResultDefault {
  constructor(offset, items, issues) {
    this.g2e_1 = offset;
    this.h2e_1 = items;
    this.i2e_1 = issues;
  }
  j2e() {
    return this.g2e_1;
  }
  ck() {
    return this.h2e_1;
  }
  n16() {
    return this.i2e_1;
  }
  bh() {
    return this.g2e_1;
  }
  ch() {
    return this.h2e_1;
  }
  ds() {
    return this.i2e_1;
  }
  k2e(offset, items, issues) {
    return new ExpectedAtResultDefault(offset, items, issues);
  }
  copy(offset, items, issues, $super) {
    offset = offset === VOID ? this.g2e_1 : offset;
    items = items === VOID ? this.h2e_1 : items;
    issues = issues === VOID ? this.i2e_1 : issues;
    return $super === VOID ? this.k2e(offset, items, issues) : $super.k2e.call(this, offset, items, issues);
  }
  toString() {
    return 'ExpectedAtResultDefault(offset=' + this.g2e_1 + ', items=' + toString(this.h2e_1) + ', issues=' + toString(this.i2e_1) + ')';
  }
  hashCode() {
    var result = this.g2e_1;
    result = imul(result, 31) + hashCode(this.h2e_1) | 0;
    result = imul(result, 31) + hashCode(this.i2e_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof ExpectedAtResultDefault))
      return false;
    var tmp0_other_with_cast = other instanceof ExpectedAtResultDefault ? other : THROW_CCE();
    if (!(this.g2e_1 === tmp0_other_with_cast.g2e_1))
      return false;
    if (!equals(this.h2e_1, tmp0_other_with_cast.h2e_1))
      return false;
    if (!equals(this.i2e_1, tmp0_other_with_cast.i2e_1))
      return false;
    return true;
  }
  get offset() {
    return this.j2e();
  }
  get items() {
    return this.ck();
  }
  get issues() {
    return this.n16();
  }
}
class SentenceContext {}
class ContextFromTypeModelReference {
  constructor(languageDefinitionId) {
    this.languageDefinitionId = languageDefinitionId;
  }
  l2e() {
    return this.languageDefinitionId;
  }
}
class ContextFromTypeModel {
  constructor(typeModel) {
    this.typeModel = typeModel;
  }
  m2e() {
    return this.typeModel;
  }
  hashCode() {
    return hashCode(this.typeModel);
  }
  equals(other) {
    var tmp;
    if (!(other instanceof ContextFromTypeModel)) {
      tmp = false;
    } else {
      if (!equals(this.typeModel, other.typeModel)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    return 'ContextFromTypeModel(' + toString(this.typeModel) + ')';
  }
}
class CompletionProviderSimple extends CompletionProviderAbstract {
  constructor(targetGrammar, grammar2TypeModel, typeModel, crossReferenceModel) {
    super();
    this.targetGrammar = targetGrammar;
    this.grammar2TypeModel = grammar2TypeModel;
    this.typeModel = typeModel;
    this.crossReferenceModel = crossReferenceModel;
    var tmp = this;
    var tmp_0 = this.typeModel.findNamespaceOrNull(this.targetGrammar.qualifiedName);
    var tmp0_elvis_lhs = (tmp_0 == null ? true : tmp_0 instanceof GrammarTypeNamespaceSimple) ? tmp_0 : THROW_CCE();
    var tmp_1;
    if (tmp0_elvis_lhs == null) {
      var message = "Namespace not found for grammar '" + QualifiedName__toString_impl_z3wem2(this.targetGrammar.qualifiedName) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_1 = tmp0_elvis_lhs;
    }
    tmp.targetNamespace = tmp_1;
  }
  j1u() {
    return this.targetGrammar;
  }
  c2f() {
    return this.grammar2TypeModel;
  }
  m2e() {
    return this.typeModel;
  }
  r1u() {
    return this.crossReferenceModel;
  }
  d2f() {
    return this.targetNamespace;
  }
  provide(nextExpected, options) {
    var context = options.context;
    var tmp;
    if (options.path.a1()) {
      var tmp_0;
      if (null == context) {
        // Inline function 'kotlin.collections.flatMap' call
        // Inline function 'kotlin.collections.flatMapTo' call
        var destination = ArrayList.y();
        var _iterator__ex2g4s = nextExpected.s();
        while (_iterator__ex2g4s.t()) {
          var element = _iterator__ex2g4s.u();
          var list = Companion_instance_0.provideForRuleItems(element.expectedNextRuleItems, options);
          addAll(destination, list);
        }
        var expansions = destination;
        // Inline function 'kotlin.collections.flatMap' call
        // Inline function 'kotlin.collections.flatMapTo' call
        var destination_0 = ArrayList.y();
        var _iterator__ex2g4s_0 = nextExpected.s();
        while (_iterator__ex2g4s_0.t()) {
          var element_0 = _iterator__ex2g4s_0.u();
          var list_0 = Companion_instance_0.provideForTangibles(element_0.expectedNextLeafNonTerminalOrTerminal, options);
          addAll(destination_0, list_0);
        }
        var tangibles = destination_0;
        tmp_0 = plus(Companion_instance_0.expansionToCompletionItem(expansions), toList(toSet(tangibles)));
      } else {
        // Inline function 'kotlin.collections.flatMap' call
        // Inline function 'kotlin.collections.flatMapTo' call
        var destination_1 = ArrayList.y();
        var _iterator__ex2g4s_1 = nextExpected.s();
        while (_iterator__ex2g4s_1.t()) {
          var element_1 = _iterator__ex2g4s_1.u();
          var firstSpineNode = firstOrNull(element_1.elements);
          var tmp_1;
          if (firstSpineNode == null) {
            tmp_1 = Companion_instance_0.provideDefaultForSpine(element_1, options);
          } else {
            var type = this.typeFor(firstSpineNode.rule);
            var tmp_2;
            if (type == null) {
              // Inline function 'kotlin.collections.flatMap' call
              // Inline function 'kotlin.collections.flatMapTo' call
              var destination_2 = ArrayList.y();
              var _iterator__ex2g4s_2 = nextExpected.s();
              while (_iterator__ex2g4s_2.t()) {
                var element_2 = _iterator__ex2g4s_2.u();
                var list_1 = Companion_instance_0.provideForRuleItems(element_2.expectedNextRuleItems, options);
                addAll(destination_2, list_1);
              }
              var expansions_0 = destination_2;
              // Inline function 'kotlin.collections.flatMap' call
              // Inline function 'kotlin.collections.flatMapTo' call
              var destination_3 = ArrayList.y();
              var _iterator__ex2g4s_3 = nextExpected.s();
              while (_iterator__ex2g4s_3.t()) {
                var element_3 = _iterator__ex2g4s_3.u();
                var list_2 = Companion_instance_0.provideForTangibles(element_3.expectedNextLeafNonTerminalOrTerminal, options);
                addAll(destination_3, list_2);
              }
              var tangibles_0 = destination_3;
              tmp_2 = plus(Companion_instance_0.expansionToCompletionItem(expansions_0), toList(toSet(tangibles_0)));
            } else {
              var forTypes = provideForType(this, type, firstSpineNode, context);
              // Inline function 'kotlin.collections.flatMap' call
              // Inline function 'kotlin.collections.flatMapTo' call
              var destination_4 = ArrayList.y();
              var _iterator__ex2g4s_4 = nextExpected.s();
              while (_iterator__ex2g4s_4.t()) {
                var element_4 = _iterator__ex2g4s_4.u();
                var list_3 = Companion_instance_0.provideForRuleItems(element_4.expectedNextRuleItems, options);
                addAll(destination_4, list_3);
              }
              var expansions_1 = destination_4;
              // Inline function 'kotlin.collections.flatMap' call
              // Inline function 'kotlin.collections.flatMapTo' call
              var destination_5 = ArrayList.y();
              var _iterator__ex2g4s_5 = nextExpected.s();
              while (_iterator__ex2g4s_5.t()) {
                var element_5 = _iterator__ex2g4s_5.u();
                var list_4 = Companion_instance_0.provideForTangibles(element_5.expectedNextLeafNonTerminalOrTerminal, options);
                addAll(destination_5, list_4);
              }
              var tangibles_1 = destination_5;
              tmp_2 = plus(plus(forTypes, Companion_instance_0.expansionToCompletionItem(expansions_1)), toList(toSet(tangibles_1)));
            }
            tmp_1 = tmp_2;
          }
          var list_5 = tmp_1;
          addAll(destination_1, list_5);
        }
        var items = destination_1;
        tmp_0 = toList(toSet(items));
      }
      var result = tmp_0;
      tmp = Companion_instance_0.defaultSortAndFilter(result);
    } else {
      var path = options.path;
      var _destruct__k2r9zo = first(path);
      var pthDepth0 = _destruct__k2r9zo.bh();
      var pthExpIdx0 = _destruct__k2r9zo.ch();
      // Inline function 'kotlin.collections.flatMap' call
      // Inline function 'kotlin.collections.flatMapTo' call
      var destination_6 = ArrayList.y();
      var _iterator__ex2g4s_6 = nextExpected.s();
      while (_iterator__ex2g4s_6.t()) {
        var element_6 = _iterator__ex2g4s_6.u();
        var list_6 = Companion_instance_0.provideExpansionsForRuleItem(pthDepth0, element_6.expectedNextRuleItems, options);
        addAll(destination_6, list_6);
      }
      var initExpansions = destination_6;
      var tmp_3;
      if (path.v() === 1) {
        tmp_3 = initExpansions;
      } else {
        var lastItems = initExpansions;
        var pthItem = ensureNotNull(lastItems.z(pthExpIdx0)).ruleItem;
        var inductionVariable = 1;
        var last = path.v();
        if (inductionVariable < last)
          $l$loop: do {
            var i = inductionVariable;
            inductionVariable = inductionVariable + 1 | 0;
            var _destruct__k2r9zo_0 = path.z(i);
            var pthDepth = _destruct__k2r9zo_0.bh();
            var pthExpIdx = _destruct__k2r9zo_0.ch();
            lastItems = Companion_instance_0.expand(pthDepth, pthItem, options);
            var tmp1_safe_receiver = getOrNull(lastItems, pthExpIdx);
            var ni = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.ruleItem;
            if (ni == null)
              break $l$loop;
            pthItem = ni;
          }
           while (inductionVariable < last);
        tmp_3 = lastItems;
      }
      var expansions_2 = tmp_3;
      var cis = Companion_instance_0.expansionToCompletionItem(expansions_2);
      tmp = Companion_instance_0.defaultSortAndFilter(cis);
    }
    return tmp;
  }
  typeFor(rule) {
    return this.targetNamespace.findTypeForRule(rule.name);
  }
}
class CreateScopedItem {}
class ResolveScopedItem {}
class CreateScopedItemDefault {
  invoke(qualifiedName, item, location) {
    return !(item == null) ? item : THROW_CCE();
  }
}
class ResolveScopedItemDefault {
  invoke(itemInScope) {
    return !(itemInScope == null) ? itemInScope : THROW_CCE();
  }
}
class NULL_SENTENCE_IDENTIFIER_0 {
  toString() {
    return 'NULL_SENTENCE_IDENTIFIER';
  }
}
class ContextWithScope {
  constructor(createScopedItem, resolveScopedItem) {
    createScopedItem = createScopedItem === VOID ? new CreateScopedItemDefault() : createScopedItem;
    resolveScopedItem = resolveScopedItem === VOID ? new ResolveScopedItemDefault() : resolveScopedItem;
    this.createScopedItem = createScopedItem;
    this.resolveScopedItem = resolveScopedItem;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.scopeForSentence = LinkedHashMap.l4();
  }
  e2f() {
    return this.createScopedItem;
  }
  f2f() {
    return this.resolveScopedItem;
  }
  g2f() {
    return this.scopeForSentence;
  }
  mk() {
    var tmp0 = this.scopeForSentence;
    var tmp$ret$0;
    $l$block_0: {
      // Inline function 'kotlin.collections.all' call
      if (tmp0.a1()) {
        tmp$ret$0 = true;
        break $l$block_0;
      }
      // Inline function 'kotlin.collections.iterator' call
      var _iterator__ex2g4s = tmp0.w2().s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        // Inline function 'kotlin.collections.component1' call
        var k = element.a3();
        // Inline function 'kotlin.collections.component2' call
        var v = element.b3();
        if (!v.isEmpty) {
          tmp$ret$0 = false;
          break $l$block_0;
        }
      }
      tmp$ret$0 = true;
    }
    return tmp$ret$0;
  }
  clear() {
    this.scopeForSentence.n2();
  }
  newScopeForSentence(sentenceIdentity) {
    var newScope = new ScopeSimple(null, '', Companion_getInstance_24().ROOT_SCOPE_TYPE_NAME);
    var tmp0 = this.scopeForSentence;
    // Inline function 'kotlin.collections.set' call
    var key = sentenceIdentity == null ? NULL_SENTENCE_IDENTIFIER_instance : sentenceIdentity;
    tmp0.r2(key, newScope);
    return newScope;
  }
  getScopeForSentenceOrNull(sentenceIdentity) {
    var tmp;
    if (null == sentenceIdentity) {
      var tmp0_elvis_lhs = this.scopeForSentence.z2(NULL_SENTENCE_IDENTIFIER_instance);
      tmp = tmp0_elvis_lhs == null ? this.newScopeForSentence(NULL_SENTENCE_IDENTIFIER_instance) : tmp0_elvis_lhs;
    } else {
      tmp = this.scopeForSentence.z2(sentenceIdentity);
    }
    return tmp;
  }
  addToScope(sentenceIdentity, qualifiedName, itemTypeName, location, item) {
    var tmp0_elvis_lhs = this.getScopeForSentenceOrNull(sentenceIdentity);
    var rootScope = tmp0_elvis_lhs == null ? this.newScopeForSentence(sentenceIdentity) : tmp0_elvis_lhs;
    var scope = rootScope;
    var _iterator__ex2g4s = dropLast(qualifiedName, 1).s();
    while (_iterator__ex2g4s.t()) {
      var n = _iterator__ex2g4s.u();
      scope = scope.createOrGetChildScope(n, _QualifiedName___init__impl__8ed982('<unknown>'));
    }
    scope.addToScope(last(qualifiedName), itemTypeName, location, item, false);
  }
  findItemsConformingTo(conformsToFunc) {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.scopeForSentence;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    // Inline function 'kotlin.collections.iterator' call
    var _iterator__ex2g4s = tmp0.w2().s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.b3().findItemsConformingTo(conformsToFunc);
      addAll(destination, list);
    }
    return destination;
  }
  findItemsNamedConformingTo(name, conformsToFunc) {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.scopeForSentence;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    // Inline function 'kotlin.collections.iterator' call
    var _iterator__ex2g4s = tmp0.w2().s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.b3().findItemsNamedConformingTo(name, conformsToFunc);
      addAll(destination, list);
    }
    return destination;
  }
  findItemsByQualifiedNameConformingTo(qname, conformsToFunc) {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.scopeForSentence;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    // Inline function 'kotlin.collections.iterator' call
    var _iterator__ex2g4s = tmp0.w2().s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.b3().findItemsByQualifiedNameConformingTo(qname, conformsToFunc);
      addAll(destination, list);
    }
    return destination;
  }
  h2f(indent) {
    var scopeIndent = indent.inc;
    var tmp = this.scopeForSentence.w2();
    var scopes = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, ContextWithScope$asString$lambda(scopeIndent));
    return this.scopeForSentence.a1() ? 'context { }' : 'context {\n' + scopes + '\n}';
  }
  asString(indent, $super) {
    indent = indent === VOID ? new Indent() : indent;
    return $super === VOID ? this.h2f(indent) : $super.h2f.call(this, indent);
  }
  hashCode() {
    return 0;
  }
  equals(other) {
    var tmp;
    if (!(other instanceof ContextWithScope)) {
      tmp = false;
    } else {
      if (!equals(this.scopeForSentence, other.scopeForSentence)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    return 'ContextWithScope';
  }
  get isEmpty() {
    return this.mk();
  }
}
class ContextFromGrammarAndTypeModel {
  constructor(grammarModel, typeModel) {
    this.grammarModel = grammarModel;
    this.typeModel = typeModel;
  }
  i1u() {
    return this.grammarModel;
  }
  m2e() {
    return this.typeModel;
  }
  bh() {
    return this.grammarModel;
  }
  ch() {
    return this.typeModel;
  }
  i2f(grammarModel, typeModel) {
    return new ContextFromGrammarAndTypeModel(grammarModel, typeModel);
  }
  copy(grammarModel, typeModel, $super) {
    grammarModel = grammarModel === VOID ? this.grammarModel : grammarModel;
    typeModel = typeModel === VOID ? this.typeModel : typeModel;
    return $super === VOID ? this.i2f(grammarModel, typeModel) : $super.i2f.call(this, grammarModel, typeModel);
  }
  toString() {
    return 'ContextFromGrammarAndTypeModel(grammarModel=' + toString(this.grammarModel) + ', typeModel=' + toString(this.typeModel) + ')';
  }
  hashCode() {
    var result = hashCode(this.grammarModel);
    result = imul(result, 31) + hashCode(this.typeModel) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof ContextFromGrammarAndTypeModel))
      return false;
    var tmp0_other_with_cast = other instanceof ContextFromGrammarAndTypeModel ? other : THROW_CCE();
    if (!equals(this.grammarModel, tmp0_other_with_cast.grammarModel))
      return false;
    if (!equals(this.typeModel, tmp0_other_with_cast.typeModel))
      return false;
    return true;
  }
}
class Companion_0 {
  constructor() {
    Companion_instance_1 = this;
    this.defaultConfiguration = new TypeModelFromGrammarConfigurationDefault();
    this.UNNAMED_PRIMITIVE_PROPERTY_NAME = _PropertyName___init__impl__sz2wu9('$value');
    this.UNNAMED_LIST_PROPERTY_NAME = _PropertyName___init__impl__sz2wu9('$list');
    this.UNNAMED_TUPLE_PROPERTY_NAME = _PropertyName___init__impl__sz2wu9('$tuple');
    this.UNNAMED_GROUP_PROPERTY_NAME = _PropertyName___init__impl__sz2wu9('$group');
    this.UNNAMED_CHOICE_PROPERTY_NAME = _PropertyName___init__impl__sz2wu9('$choice');
    this.EXPRESSION_CHILDREN = new RootExpressionDefault('children');
  }
  j2f() {
    return this.defaultConfiguration;
  }
  k2f() {
    return this.UNNAMED_PRIMITIVE_PROPERTY_NAME;
  }
  l2f() {
    return this.UNNAMED_LIST_PROPERTY_NAME;
  }
  m2f() {
    return this.UNNAMED_TUPLE_PROPERTY_NAME;
  }
  n2f() {
    return this.UNNAMED_GROUP_PROPERTY_NAME;
  }
  o2f() {
    return this.UNNAMED_CHOICE_PROPERTY_NAME;
  }
  toNoActionTrRule(_this__u8e3s4) {
    // Inline function 'kotlin.let' call
    return transformationRule(_this__u8e3s4, Companion_getInstance_15().NOTHING);
  }
  toLeafAsStringTrRule(_this__u8e3s4) {
    // Inline function 'kotlin.let' call
    return transformationRule(_this__u8e3s4, Companion_getInstance_15().SELF);
  }
  toListTrRule(_this__u8e3s4) {
    // Inline function 'kotlin.let' call
    return transformationRule(_this__u8e3s4, new RootExpressionDefault('children'));
  }
  toSListItemsTrRule(_this__u8e3s4) {
    // Inline function 'kotlin.let' call
    return transformationRule(_this__u8e3s4, new NavigationExpressionDefault(new RootExpressionDefault('children'), listOf(new PropertyCallDefault('items'))));
  }
  toSubtypeTrRule(_this__u8e3s4) {
    // Inline function 'kotlin.let' call
    return transformationRule(_this__u8e3s4, Companion_getInstance_3().EXPRESSION_CHILD(0));
  }
  toUnnamedSubtypeTrRule(_this__u8e3s4) {
    // Inline function 'kotlin.let' call
    return transformationRule(_this__u8e3s4, Companion_getInstance_3().EXPRESSION_CHILD(0));
  }
  EXPRESSION_CHILD(childIndex) {
    return new NavigationExpressionDefault(new RootExpressionDefault('child'), listOf(new IndexOperationDefault(listOf(new LiteralExpressionDefault(StdLibDefault_getInstance().Integer.qualifiedTypeName, toLong(childIndex))))));
  }
  EXPRESSION_CHILD_i_prop(childIndex, pName) {
    return new NavigationExpressionDefault(new RootExpressionDefault('child'), listOf_0([new IndexOperationDefault(listOf(new LiteralExpressionDefault(StdLibDefault_getInstance().Integer.qualifiedTypeName, toLong(childIndex)))), new PropertyCallDefault(_PropertyName___get_value__impl__p219lh(pName))]));
  }
  p2f() {
    return this.EXPRESSION_CHILDREN;
  }
}
class Formatable {}
function asString(indent, $super) {
  indent = indent === VOID ? new Indent('', '  ') : indent;
  return $super === VOID ? this.h2f(indent) : $super.h2f.call(this, indent);
}
class Definition {}
class TypeDefinition {}
function signature(context, currentDepth, $super) {
  currentDepth = currentDepth === VOID ? 0 : currentDepth;
  return $super === VOID ? this.g2h(context, currentDepth) : $super.g2h.call(this, context, currentDepth);
}
function type(typeArguments, isNullable, $super) {
  typeArguments = typeArguments === VOID ? emptyList() : typeArguments;
  isNullable = isNullable === VOID ? false : isNullable;
  return $super === VOID ? this.g2i(typeArguments, isNullable) : $super.g2i.call(this, typeArguments, isNullable);
}
class TypeDefinitionSimpleAbstract {
  constructor(options) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    this.o2h_1 = options;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.p2h_1 = ArrayList.y();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_0.q2h_1 = ArrayList.y();
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_1.r2h_1 = ArrayList.y();
    var tmp_2 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_2.propertyByIndex = LinkedHashMap.l4();
    var tmp_3 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_3.s2h_1 = ArrayList.y();
    var tmp_4 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_4.t2h_1 = LinkedHashMap.l4();
  }
  x1c() {
    return this.o2h_1;
  }
  u2h() {
    return QualifiedName__append_impl_hhmte4(this.namespace.qualifiedName, this.name);
  }
  v2h() {
    return this.p2h_1;
  }
  w2h() {
    return this.q2h_1;
  }
  x2h() {
    return this.r2h_1;
  }
  y2h() {
    return this.propertyByIndex;
  }
  z2h() {
    return toList(this.propertyByIndex.v2());
  }
  a2i() {
    return this.s2h_1;
  }
  b2i() {
    var tmp = this.supertypes;
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.supertypes;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp_0 = element.resolvedDeclaration;
      var list = (isInterface(tmp_0, DataType) ? tmp_0 : THROW_CCE()).allSuperTypes;
      addAll(destination, list);
    }
    return plus(tmp, destination);
  }
  c2i() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.supertypes;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.resolvedDeclaration.allProperty.v2();
      addAll(destination, list);
    }
    // Inline function 'kotlin.collections.associateBy' call
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(destination, 10)), 16);
    // Inline function 'kotlin.collections.associateByTo' call
    var destination_0 = LinkedHashMap.kb(capacity);
    var _iterator__ex2g4s_0 = destination.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      var tmp$ret$3 = new PropertyName(element_0.name);
      destination_0.r2(tmp$ret$3, element_0);
    }
    var tmp = destination_0;
    // Inline function 'kotlin.collections.associateBy' call
    var this_0 = this.property;
    var capacity_0 = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_0, 10)), 16);
    // Inline function 'kotlin.collections.associateByTo' call
    var destination_1 = LinkedHashMap.kb(capacity_0);
    var _iterator__ex2g4s_1 = this_0.s();
    while (_iterator__ex2g4s_1.t()) {
      var element_1 = _iterator__ex2g4s_1.u();
      var tmp$ret$6 = new PropertyName(element_1.name);
      destination_1.r2(tmp$ret$6, element_1);
    }
    return plus_3(tmp, destination_1);
  }
  d2i() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.supertypes;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.resolvedDeclaration.allMethod.v2();
      addAll(destination, list);
    }
    // Inline function 'kotlin.collections.associateBy' call
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(destination, 10)), 16);
    // Inline function 'kotlin.collections.associateByTo' call
    var destination_0 = LinkedHashMap.kb(capacity);
    var _iterator__ex2g4s_0 = destination.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      var tmp$ret$3 = new MethodName(element_0.name);
      destination_0.r2(tmp$ret$3, element_0);
    }
    var tmp = destination_0;
    // Inline function 'kotlin.collections.associateBy' call
    var this_0 = this.method;
    var capacity_0 = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_0, 10)), 16);
    // Inline function 'kotlin.collections.associateByTo' call
    var destination_1 = LinkedHashMap.kb(capacity_0);
    var _iterator__ex2g4s_1 = this_0.s();
    while (_iterator__ex2g4s_1.t()) {
      var element_1 = _iterator__ex2g4s_1.u();
      var tmp$ret$6 = new MethodName(element_1.name);
      destination_1.r2(tmp$ret$6, element_1);
    }
    return plus_3(tmp, destination_1);
  }
  e2i(_set____db54di) {
    this.t2h_1 = _set____db54di;
  }
  f2i() {
    return this.t2h_1;
  }
  g2i(typeArguments, isNullable) {
    return this.namespace.createTypeInstance(this.qualifiedName, new SimpleName(this.name), typeArguments, isNullable);
  }
  conformsTo(other) {
    var tmp;
    if (other === this) {
      tmp = true;
    } else {
      if (this.equals(StdLibDefault_getInstance().NothingType.resolvedDeclaration)) {
        tmp = false;
      } else {
        if (equals(other, StdLibDefault_getInstance().NothingType.resolvedDeclaration)) {
          tmp = false;
        } else {
          if (equals(other, StdLibDefault_getInstance().AnyType.resolvedDeclaration)) {
            tmp = true;
          } else {
            if (equals(other, this)) {
              tmp = true;
            } else {
              if (isInterface(other, UnionType)) {
                var tmp0 = other.alternatives;
                var tmp$ret$0;
                $l$block_0: {
                  // Inline function 'kotlin.collections.any' call
                  var tmp_0;
                  if (isInterface(tmp0, Collection)) {
                    tmp_0 = tmp0.a1();
                  } else {
                    tmp_0 = false;
                  }
                  if (tmp_0) {
                    tmp$ret$0 = false;
                    break $l$block_0;
                  }
                  var _iterator__ex2g4s = tmp0.s();
                  while (_iterator__ex2g4s.t()) {
                    var element = _iterator__ex2g4s.u();
                    if (this.conformsTo(element.resolvedDeclaration)) {
                      tmp$ret$0 = true;
                      break $l$block_0;
                    }
                  }
                  tmp$ret$0 = false;
                }
                tmp = tmp$ret$0;
              } else {
                var tmp2 = this.supertypes;
                var tmp$ret$2;
                $l$block_2: {
                  // Inline function 'kotlin.collections.any' call
                  var tmp_1;
                  if (isInterface(tmp2, Collection)) {
                    tmp_1 = tmp2.a1();
                  } else {
                    tmp_1 = false;
                  }
                  if (tmp_1) {
                    tmp$ret$2 = false;
                    break $l$block_2;
                  }
                  var _iterator__ex2g4s_0 = tmp2.s();
                  while (_iterator__ex2g4s_0.t()) {
                    var element_0 = _iterator__ex2g4s_0.u();
                    if (element_0.resolvedDeclaration.conformsTo(other)) {
                      tmp$ret$2 = true;
                      break $l$block_2;
                    }
                  }
                  tmp$ret$2 = false;
                }
                tmp = tmp$ret$2;
              }
            }
          }
        }
      }
    }
    return tmp;
  }
  getOwnedPropertyByIndexOrNull(i) {
    return this.propertyByIndex.z2(i);
  }
  findOwnedPropertyOrNull(name) {
    var tmp0 = this.property;
    var tmp$ret$1;
    $l$block: {
      // Inline function 'kotlin.collections.firstOrNull' call
      var _iterator__ex2g4s = tmp0.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        if (element.name === name) {
          tmp$ret$1 = element;
          break $l$block;
        }
      }
      tmp$ret$1 = null;
    }
    return tmp$ret$1;
  }
  findAllPropertyOrNull(name) {
    return this.allProperty.z2(new PropertyName(name));
  }
  findOwnedMethodOrNull(name) {
    var tmp0 = this.method;
    var tmp$ret$1;
    $l$block: {
      // Inline function 'kotlin.collections.firstOrNull' call
      var _iterator__ex2g4s = tmp0.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        if (element.name === name) {
          tmp$ret$1 = element;
          break $l$block;
        }
      }
      tmp$ret$1 = null;
    }
    return tmp$ret$1;
  }
  findAllMethodOrNull(name) {
    return this.allMethod.z2(new MethodName(name));
  }
  addTypeParameter(name) {
    var tmp = this.typeParameters;
    (isInterface(tmp, KtMutableList) ? tmp : THROW_CCE()).r(name);
  }
  addSupertype_dep(qualifiedTypeName) {
    var ti = this.namespace.createTypeInstance(this.qualifiedName, qualifiedTypeName, emptyList(), false);
    this.addSupertype(ti);
  }
  addSupertype(typeInstance) {
    if (!this.supertypes.e1(typeInstance)) {
      var tmp = this.supertypes;
      (isInterface(tmp, KtMutableList) ? tmp : THROW_CCE()).r(typeInstance);
    }
  }
  appendPropertyDerived(name, typeInstance, description, expression) {
    var propIndex = this.property.v();
    var prop = new PropertyDeclarationDerived(this, name, typeInstance, description, expression, propIndex);
    this.addProperty(prop);
    return prop;
  }
  appendPropertyPrimitive(name, typeInstance, description) {
    var propIndex = this.property.v();
    var prop = new PropertyDeclarationPrimitive(this, name, typeInstance, description, propIndex);
    this.addProperty(prop);
    return prop;
  }
  appendMethodPrimitive(name, parameters, returnType, description) {
    return new MethodDeclarationPrimitiveSimple(this, name, parameters, returnType, description);
  }
  appendMethodDerived(name, parameters, typeInstance, description, body) {
    return new MethodDeclarationDerivedSimple(this, name, parameters, typeInstance, description, body);
  }
  asStringInContext(context) {
    return this.signature(context, 0);
  }
  h2f(indent) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  hashCode() {
    return QualifiedName__hashCode_impl_dcqht7(this.qualifiedName);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, TypeDefinition) : false)) {
      tmp = false;
    } else {
      tmp = this.qualifiedName === other.qualifiedName;
    }
    return tmp;
  }
  toString() {
    return _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  findInOrCloneTo(other, clone) {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.supertypes.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      clone.addSupertype(element.findInOrCloneTo(other));
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = this.typeParameters.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      clone.addTypeParameter(element_0.clone());
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_1 = this.property.s();
    while (_iterator__ex2g4s_1.t()) {
      var element_1 = _iterator__ex2g4s_1.u();
      element_1.findInOrCloneTo(other);
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_2 = this.method.s();
    while (_iterator__ex2g4s_2.t()) {
      var element_2 = _iterator__ex2g4s_2.u();
      element_2.findInOrCloneTo(other);
    }
    clone.metaInfo.t2(this.metaInfo);
  }
  addProperty(propertyDeclaration) {
    // Inline function 'kotlin.check' call
    if (!(this.findOwnedPropertyOrNull(propertyDeclaration.name) == null)) {
      var message = "TypeDefinition '" + QualifiedName__toString_impl_z3wem2(this.qualifiedName) + "' already owns a property named '" + PropertyName__toString_impl_hcnfa7(propertyDeclaration.name) + "'";
      throw IllegalStateException.v4(toString(message));
    }
    var tmp1 = this.propertyByIndex;
    // Inline function 'kotlin.collections.set' call
    var key = propertyDeclaration.index;
    tmp1.r2(key, propertyDeclaration);
  }
  addMethod(methodDeclaration) {
    this.method.r(methodDeclaration);
  }
  get options() {
    return this.x1c();
  }
  get qualifiedName() {
    return this.u2h();
  }
  get supertypes() {
    return this.v2h();
  }
  get subtypes() {
    return this.w2h();
  }
  get typeParameters() {
    return this.x2h();
  }
  get property() {
    return this.z2h();
  }
  get method() {
    return this.a2i();
  }
  get allSuperTypes() {
    return this.b2i();
  }
  get allProperty() {
    return this.c2i();
  }
  get allMethod() {
    return this.d2i();
  }
  get metaInfo() {
    return this.f2i();
  }
  set metaInfo(value) {
    this.e2i(value);
  }
  get namespace() {
    return this.e2h();
  }
  get name() {
    return this.f2h();
  }
}
class StructuredType {}
function appendPropertyStored(name, typeInstance, characteristics, index, $super) {
  index = index === VOID ? -1 : index;
  return $super === VOID ? this.n2h(name, typeInstance, characteristics, index) : $super.n2h.call(this, new PropertyName(name), typeInstance, characteristics, index);
}
class StructuredTypeSimpleAbstract extends TypeDefinitionSimpleAbstract {
  propertiesWithCharacteristic(chr) {
    // Inline function 'kotlin.collections.filter' call
    var tmp0 = this.property;
    // Inline function 'kotlin.collections.filterTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (element.characteristics.e1(chr)) {
        destination.r(element);
      }
    }
    return destination;
  }
  n2h(name, typeInstance, characteristics, index) {
    var propIndex = index >= 0 ? index : this.property.v();
    var pd = new PropertyDeclarationStored(this, name, typeInstance, plus_1(characteristics, PropertyCharacteristic_STORED_getInstance()), propIndex);
    this.addProperty(pd);
    return pd;
  }
  get namespace() {
    return this.e2h();
  }
  get name() {
    return this.f2h();
  }
}
class Grammar2TransformRuleSet$trRuleForRuleItemConcatenation$ttSub$1 extends StructuredTypeSimpleAbstract {
  constructor(this$0) {
    super();
    this.c2h_1 = this$0.t2f_1;
    var tmp = this;
    var _unary__edvuaz = this$0.d2g_1;
    this$0.d2g_1 = _unary__edvuaz + 1 | 0;
    tmp.d2h_1 = _SimpleName___init__impl__6s45d0('TupleTypeSubstitute-' + _unary__edvuaz);
  }
  e2h() {
    return this.c2h_1;
  }
  f2h() {
    return this.d2h_1;
  }
  g2h(context, currentDepth) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  findInOrCloneTo(other) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
}
class Grammar2TransformRuleSet$trRuleForGroupContentOptional$ttSub$1 extends StructuredTypeSimpleAbstract {
  constructor(this$0) {
    super();
    this.n2i_1 = this$0.t2f_1;
    var tmp = this;
    var _unary__edvuaz = this$0.d2g_1;
    this$0.d2g_1 = _unary__edvuaz + 1 | 0;
    tmp.o2i_1 = _SimpleName___init__impl__6s45d0('TupleTypeSubstitute-' + _unary__edvuaz);
  }
  e2h() {
    return this.n2i_1;
  }
  f2h() {
    return this.o2i_1;
  }
  g2h(context, currentDepth) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  findInOrCloneTo(other) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
}
class Grammar2TransformRuleSet {
  constructor(issues, typeModel, transModel, grammarTypeNamespace, transformNamespace, grammar, grm2Ns, configuration) {
    Companion_getInstance_3();
    this.q2f_1 = issues;
    this.r2f_1 = typeModel;
    this.s2f_1 = transModel;
    this.t2f_1 = grammarTypeNamespace;
    this.u2f_1 = transformNamespace;
    this.v2f_1 = grammar;
    this.w2f_1 = grm2Ns;
    this.x2f_1 = configuration;
    this.y2f_1 = null;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.z2f_1 = LinkedHashMap.l4();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_0.a2g_1 = LinkedHashMap.l4();
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_1.b2g_1 = LinkedHashMap.l4();
    var tmp_2 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_2.c2g_1 = LinkedHashMap.l4();
    this.d2g_1 = 0;
  }
  wm() {
    // Inline function 'kotlin.collections.filter' call
    var tmp0 = this.v2f_1.resolvedGrammarRule;
    // Inline function 'kotlin.collections.filterTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!element.isSkip) {
        destination.r(element);
      }
    }
    var nonSkipRules = destination;
    var _iterator__ex2g4s_0 = nonSkipRules.s();
    while (_iterator__ex2g4s_0.t()) {
      var gr = _iterator__ex2g4s_0.u();
      createOrFindTrRuleForGrammarRule(this, gr);
    }
    // Inline function 'kotlin.collections.mutableListOf' call
    var trRules = ArrayList.y();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_1 = this.a2g_1.w2().s();
    while (_iterator__ex2g4s_1.t()) {
      var element_0 = _iterator__ex2g4s_1.u();
      var key = element_0.a3().d1u_1;
      var value = element_0.b3();
      trRules.r(value);
      var tmp = this.t2f_1;
      var tmp0_0 = (tmp instanceof GrammarTypeNamespaceSimple ? tmp : THROW_CCE()).allRuleNameToType;
      var tmp1 = new GrammarRuleName(key);
      // Inline function 'kotlin.collections.set' call
      var value_0 = value.resolvedType;
      tmp0_0.r2(tmp1, value_0);
    }
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.v2f_1.extends;
    // Inline function 'kotlin.collections.mapTo' call
    var destination_0 = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s_2 = this_0.s();
    while (_iterator__ex2g4s_2.t()) {
      var item = _iterator__ex2g4s_2.u();
      var tmp0_safe_receiver = item.resolved;
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.qualifiedName;
      var tmp_0;
      var tmp_1 = tmp1_elvis_lhs;
      if ((tmp_1 == null ? null : new QualifiedName(tmp_1)) == null) {
        var message = 'Should already be resolved';
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp_0 = tmp1_elvis_lhs;
      }
      var rqn = tmp_0;
      var tmp2_safe_receiver = this.w2f_1.z2(new QualifiedName(rqn));
      var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.o2g_1;
      var tmp4_elvis_lhs = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.y2f_1;
      var tmp_2;
      if (tmp4_elvis_lhs == null) {
        var message_0 = 'Extended TransformRuleSet not built!';
        throw IllegalStateException.v4(toString(message_0));
      } else {
        tmp_2 = tmp4_elvis_lhs;
      }
      var trs = tmp_2;
      // Inline function 'kotlin.also' call
      var this_1 = new TransformRuleSetReferenceDefault(this.u2f_1, item.nameOrQName);
      this_1.resolveAs(trs);
      destination_0.r(this_1);
    }
    var extends_0 = destination_0;
    var tmp_3 = this;
    var tmp0_namespace = this.u2f_1;
    var tmp1_name = this.v2f_1.name;
    tmp_3.y2f_1 = new TransformRuleSetDefault(tmp0_namespace, tmp1_name, extends_0, VOID, trRules);
    // Inline function 'kotlin.collections.map' call
    var this_2 = this.v2f_1.extends;
    // Inline function 'kotlin.collections.mapTo' call
    var destination_1 = ArrayList.w(collectionSizeOrDefault(this_2, 10));
    var _iterator__ex2g4s_3 = this_2.s();
    while (_iterator__ex2g4s_3.t()) {
      var item_0 = _iterator__ex2g4s_3.u();
      var tmp$ret$12 = new Import(_QualifiedName___get_asImport__impl__hufagg(ensureNotNull(item_0.resolved).qualifiedName));
      destination_1.r(tmp$ret$12);
    }
    var typeImports = plus_0(destination_1, new Import(_QualifiedName___get_asImport__impl__hufagg(this.v2f_1.qualifiedName)));
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_4 = typeImports.s();
    while (_iterator__ex2g4s_4.t()) {
      var element_1 = _iterator__ex2g4s_4.u();
      var it = element_1.p2i_1;
      ensureNotNull(this.y2f_1).addImportType(it);
    }
    return ensureNotNull(this.y2f_1);
  }
  p2g(gr) {
    var tmp;
    if (gr.grammar.qualifiedName === this.t2f_1.qualifiedName) {
      tmp = this.a2g_1.z2(new GrammarRuleName(gr.name));
    } else {
      var tmp0_safe_receiver = this.w2f_1.z2(new QualifiedName(gr.grammar.qualifiedName));
      var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.o2g_1;
      var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.p2g(gr);
      var tmp_0;
      if (tmp2_elvis_lhs == null) {
        var message = "TransformationRule not found for '" + QualifiedName__toString_impl_z3wem2(gr.grammar.qualifiedName) + '.' + GrammarRuleName__toString_impl_przz03(gr.name) + "'";
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp_0 = tmp2_elvis_lhs;
      }
      tmp = tmp_0;
    }
    return tmp;
  }
}
class ConstructAndModify {
  constructor(construct, modify) {
    this.e2g_1 = construct;
    this.f2g_1 = modify;
  }
}
class GrammarModel2TransformModel {
  constructor(typeModel, grammarModel, configuration) {
    configuration = configuration === VOID ? Companion_getInstance_3().defaultConfiguration : configuration;
    this.q2i_1 = typeModel;
    this.r2i_1 = grammarModel;
    this.s2i_1 = configuration;
    this.t2i_1 = new IssueHolder(LanguageProcessorPhase_SYNTAX_ANALYSIS_getInstance());
    var tmp = this;
    // Inline function 'kotlin.also' call
    var this_0 = new TransformDomainDefault(_SimpleName___init__impl__6s45d0('FromGrammar' + _SimpleName___get_value__impl__rl2r3c(last(this.r2i_1.allDefinitions).name)), VOID, emptyList());
    this_0.z2i_1 = this.q2i_1;
    tmp.u2i_1 = this_0;
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_0.v2i_1 = LinkedHashMap.l4();
  }
  wm() {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.r2i_1.allDefinitions.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      getOrCreate(this, element);
    }
    return this.u2i_1;
  }
}
class Grammar2Namespaces {
  constructor(issues, typeModel, transModel, grammar, grm2Ns, configuration) {
    this.g2g_1 = issues;
    this.h2g_1 = typeModel;
    this.i2g_1 = transModel;
    this.j2g_1 = grammar;
    this.k2g_1 = grm2Ns;
    this.l2g_1 = configuration;
    this.m2g_1 = null;
    this.n2g_1 = null;
    this.o2g_1 = null;
  }
  fb() {
    var ns = this.j2g_1.namespace.qualifiedName;
    var gqn = this.j2g_1.qualifiedName;
    this.h2g_1.addNamespace(StdLibDefault_getInstance());
    this.m2g_1 = findOrCreateGrammarNamespace(this, gqn);
    this.n2g_1 = findOrCreateTransformNamespace(this);
    this.o2g_1 = new Grammar2TransformRuleSet(this.g2g_1, this.h2g_1, this.i2g_1, ensureNotNull(this.m2g_1), ensureNotNull(this.n2g_1), this.j2g_1, this.k2g_1, this.l2g_1);
    var rs = ensureNotNull(this.o2g_1).wm();
  }
}
class ReferenceExpressionContext {
  constructor(element, scope) {
    this.element = element;
    this.scope = scope;
  }
  a2j() {
    return this.element;
  }
  b2j() {
    return this.scope;
  }
  bh() {
    return this.element;
  }
  ch() {
    return this.scope;
  }
  c2j(element, scope) {
    return new ReferenceExpressionContext(element, scope);
  }
  copy(element, scope, $super) {
    element = element === VOID ? this.element : element;
    scope = scope === VOID ? this.scope : scope;
    return $super === VOID ? this.c2j(element, scope) : $super.c2j.call(this, element, scope);
  }
  toString() {
    return 'ReferenceExpressionContext(element=' + toString(this.element) + ', scope=' + toString(this.scope) + ')';
  }
  hashCode() {
    var result = hashCode(this.element);
    result = imul(result, 31) + hashCode(this.scope) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof ReferenceExpressionContext))
      return false;
    var tmp0_other_with_cast = other instanceof ReferenceExpressionContext ? other : THROW_CCE();
    if (!equals(this.element, tmp0_other_with_cast.element))
      return false;
    if (!equals(this.scope, tmp0_other_with_cast.scope))
      return false;
    return true;
  }
}
class AsmTreeWalker {}
class ReferenceResolverSimple {
  constructor(typeModel, crossReferenceModel, context, sentenceIdentity, identifyingValueInFor, resolveFunction, _locationMap, _issues) {
    this.typeModel = typeModel;
    this.crossReferenceModel = crossReferenceModel;
    this.context = context;
    this.sentenceIdentity = sentenceIdentity;
    this.identifyingValueInFor = identifyingValueInFor;
    this.resolveFunction = resolveFunction;
    this.d2j_1 = _locationMap;
    this.e2j_1 = _issues;
    var tmp = this;
    var tmp0_elvis_lhs = this.context.getScopeForSentenceOrNull(this.sentenceIdentity);
    tmp.f2j_1 = mutableStackOf([tmp0_elvis_lhs == null ? this.context.newScopeForSentence(this.sentenceIdentity) : tmp0_elvis_lhs]);
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_0.g2j_1 = LinkedHashMap.l4();
    this.h2j_1 = new ExpressionsInterpreterOverTypedObject(new ObjectGraphAsmSimple(this.typeModel, this.e2j_1), this.e2j_1);
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_1.resolvedReferences = ArrayList.y();
  }
  m2e() {
    return this.typeModel;
  }
  r1u() {
    return this.crossReferenceModel;
  }
  cs() {
    return this.context;
  }
  d16() {
    return this.sentenceIdentity;
  }
  p2j() {
    return this.identifyingValueInFor;
  }
  q2j() {
    return this.resolveFunction;
  }
  t2d() {
    return this.resolvedReferences;
  }
  beforeRoot(root) {
    if (isInterface(root, AsmStructure)) {
      var tmp0 = this.g2j_1;
      // Inline function 'kotlin.collections.set' call
      var value = this.f2j_1.ok();
      tmp0.r2(root, value);
    }
  }
  afterRoot(root) {
  }
  onNothing(owningProperty, value) {
  }
  onPrimitive(owningProperty, value) {
  }
  beforeStructure(owningProperty, value) {
    var parentScope = this.f2j_1.ok();
    var inTypeName = _QualifiedName___get_last__impl__838y8h(parentScope.forTypeName);
    var refInParent = this.identifyingValueInFor(new SimpleName(inTypeName), value);
    var tmp;
    if (refInParent == null) {
      tmp = parentScope;
    } else {
      if (!(refInParent == null) ? typeof refInParent === 'string' : false) {
        var tmp1_elvis_lhs = parentScope.getChildScopeOrNull(refInParent);
        tmp = tmp1_elvis_lhs == null ? parentScope : tmp1_elvis_lhs;
      } else {
        if (!(refInParent == null) ? isInterface(refInParent, KtList) : false) {
          var tmp_0;
          var tmp$ret$0;
          $l$block_0: {
            // Inline function 'kotlin.collections.all' call
            var tmp_1;
            if (isInterface(refInParent, Collection)) {
              tmp_1 = refInParent.a1();
            } else {
              tmp_1 = false;
            }
            if (tmp_1) {
              tmp$ret$0 = true;
              break $l$block_0;
            }
            var _iterator__ex2g4s = refInParent.s();
            while (_iterator__ex2g4s.t()) {
              var element = _iterator__ex2g4s.u();
              if (!(!(element == null) ? typeof element === 'string' : false)) {
                tmp$ret$0 = false;
                break $l$block_0;
              }
            }
            tmp$ret$0 = true;
          }
          if (tmp$ret$0) {
            var lastScope = parentScope;
            var _iterator__ex2g4s_0 = refInParent.s();
            while (_iterator__ex2g4s_0.t()) {
              var r = _iterator__ex2g4s_0.u();
              var tmp_2 = lastScope;
              var tmp2_elvis_lhs = tmp_2.getChildScopeOrNull((!(r == null) ? typeof r === 'string' : false) ? r : THROW_CCE());
              lastScope = tmp2_elvis_lhs == null ? parentScope : tmp2_elvis_lhs;
            }
            tmp_0 = lastScope;
          } else {
            throw NotImplementedError.uj();
          }
          tmp = tmp_0;
        } else {
          throw NotImplementedError.uj();
        }
      }
    }
    var elScope = tmp;
    this.f2j_1.nk(elScope);
    // Inline function 'kotlin.collections.set' call
    this.g2j_1.r2(value, elScope);
    var references = this.crossReferenceModel.referencesFor(new SimpleName(value.typeName));
    var _iterator__ex2g4s_1 = references.s();
    while (_iterator__ex2g4s_1.t()) {
      var refExpr = _iterator__ex2g4s_1.u();
      handleReferenceExpression(this, refExpr, new ReferenceExpressionContext(value, elScope), value);
    }
  }
  onProperty(owner, property) {
  }
  afterStructure(owningProperty, value) {
    this.f2j_1.rk();
  }
  beforeList(owningProperty, value) {
  }
  afterList(owningProperty, value) {
  }
}
class ScopeCreator {
  constructor(typeModel, crossReferenceModel, context, sentenceIdentity, replaceIfItemAlreadyExistsInScope, ifItemAlreadyExistsInScopeIssueKind, identifyingValueInFor, locationMap, issues) {
    this.typeModel = typeModel;
    this.crossReferenceModel = crossReferenceModel;
    this.context = context;
    this.sentenceIdentity = sentenceIdentity;
    this.replaceIfItemAlreadyExistsInScope = replaceIfItemAlreadyExistsInScope;
    this.ifItemAlreadyExistsInScopeIssueKind = ifItemAlreadyExistsInScopeIssueKind;
    this.identifyingValueInFor = identifyingValueInFor;
    this.locationMap = locationMap;
    this.issues = issues;
    this.currentScope = mutableStackOf([this.context.newScopeForSentence(this.sentenceIdentity)]);
  }
  m2e() {
    return this.typeModel;
  }
  r1u() {
    return this.crossReferenceModel;
  }
  cs() {
    return this.context;
  }
  d16() {
    return this.sentenceIdentity;
  }
  n2b(_set____db54di) {
    this.replaceIfItemAlreadyExistsInScope = _set____db54di;
  }
  o2b() {
    return this.replaceIfItemAlreadyExistsInScope;
  }
  p2b(_set____db54di) {
    this.ifItemAlreadyExistsInScopeIssueKind = _set____db54di;
  }
  q2b() {
    return this.ifItemAlreadyExistsInScopeIssueKind;
  }
  p2j() {
    return this.identifyingValueInFor;
  }
  j2b() {
    return this.locationMap;
  }
  n16() {
    return this.issues;
  }
  r2j() {
    return this.currentScope;
  }
  beforeRoot(root) {
  }
  afterRoot(root) {
  }
  onNothing(owningProperty, value) {
  }
  onPrimitive(owningProperty, value) {
  }
  beforeStructure(owningProperty, value) {
    var scope = this.currentScope.ok();
    addToScope(this, scope, value);
    var chScope = createScope(this, scope, value);
    this.currentScope.nk(chScope);
    var tmp0 = chScope.scopePath;
    // Inline function 'kotlin.collections.fold' call
    var accumulator = Companion_getInstance_9().ROOT;
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      accumulator = accumulator.plus(element);
    }
    value.semanticPath = accumulator;
  }
  onProperty(owner, property) {
  }
  afterStructure(owningProperty, value) {
    this.currentScope.rk();
  }
  beforeList(owningProperty, value) {
  }
  afterList(owningProperty, value) {
  }
}
class Companion_1 {
  identifyingValueInFor(interpreter, crossReferenceModel, inScopeForTypeName, self_0) {
    var tmp;
    var exp = crossReferenceModel.identifyingExpressionFor(inScopeForTypeName, new QualifiedName(self_0.qualifiedTypeName));
    var tmp_0;
    if (exp == null) {
      tmp_0 = null;
    } else {
      var tmp1_safe_receiver = interpreter.typeModel.findByQualifiedNameOrNull(self_0.qualifiedTypeName);
      var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.type();
      var elType = tmp2_elvis_lhs == null ? StdLibDefault_getInstance().AnyType : tmp2_elvis_lhs;
      var value = interpreter.evaluateExpression(Companion_instance_14.ofSelf(new TypedObjectAsmValue(elType, self_0)), exp).self;
      var tmp_1;
      var tmp_2;
      if (isInterface(value, AsmPrimitive)) {
        tmp_2 = get_isStdString(value);
      } else {
        tmp_2 = false;
      }
      if (tmp_2) {
        var tmp_3 = value.value;
        tmp_1 = typeof tmp_3 === 'string' ? tmp_3 : THROW_CCE();
      } else {
        var tmp_4;
        if (isInterface(value, AsmList)) {
          var tmp0 = value.elements;
          var tmp$ret$0;
          $l$block_0: {
            // Inline function 'kotlin.collections.all' call
            var tmp_5;
            if (isInterface(tmp0, Collection)) {
              tmp_5 = tmp0.a1();
            } else {
              tmp_5 = false;
            }
            if (tmp_5) {
              tmp$ret$0 = true;
              break $l$block_0;
            }
            var _iterator__ex2g4s = tmp0.s();
            while (_iterator__ex2g4s.t()) {
              var element = _iterator__ex2g4s.u();
              var tmp_6;
              if (isInterface(element, AsmPrimitive)) {
                tmp_6 = get_isStdString(element);
              } else {
                tmp_6 = false;
              }
              if (!tmp_6) {
                tmp$ret$0 = false;
                break $l$block_0;
              }
            }
            tmp$ret$0 = true;
          }
          tmp_4 = tmp$ret$0;
        } else {
          tmp_4 = false;
        }
        if (tmp_4) {
          // Inline function 'kotlin.collections.map' call
          var this_0 = value.elements;
          // Inline function 'kotlin.collections.mapTo' call
          var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
          var _iterator__ex2g4s_0 = this_0.s();
          while (_iterator__ex2g4s_0.t()) {
            var item = _iterator__ex2g4s_0.u();
            var tmp_7 = (isInterface(item, AsmPrimitive) ? item : THROW_CCE()).value;
            var tmp$ret$2 = typeof tmp_7 === 'string' ? tmp_7 : THROW_CCE();
            destination.r(tmp$ret$2);
          }
          tmp_1 = destination;
        } else {
          var message = 'Cannot get identifying value for ' + toString(value);
          throw IllegalStateException.v4(toString(message));
        }
      }
      tmp_0 = tmp_1;
    }
    tmp = tmp_0;
    return tmp;
  }
}
class sam$net_akehurst_language_agl_simple_ResolveScopedItem$0 {
  constructor(function_0) {
    this.w2j_1 = function_0;
  }
  invoke(itemInScope) {
    return this.w2j_1(itemInScope);
  }
  w3() {
    return this.w2j_1;
  }
  equals(other) {
    var tmp;
    if (!(other == null) ? isInterface(other, ResolveScopedItem) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.w3(), other.w3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.w3());
  }
}
class SemanticAnalyser {}
function analyse(sentenceIdentity, asm, locationMap, options, $super) {
  locationMap = locationMap === VOID ? null : locationMap;
  return $super === VOID ? this.y2j(sentenceIdentity, asm, locationMap, options) : $super.y2j.call(this, sentenceIdentity, asm, locationMap, options);
}
class SemanticAnalyserSimple {
  constructor(typeModel, crossReferenceModel) {
    this.typeModel = typeModel;
    this.crossReferenceModel = crossReferenceModel;
    this.s2j_1 = new IssueHolder(LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance());
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.t2j_1 = ArrayList.y();
    this.v2j_1 = new ExpressionsInterpreterOverTypedObject(new ObjectGraphAsmSimple(this.typeModel, this.s2j_1), this.s2j_1);
  }
  m2e() {
    return this.typeModel;
  }
  r1u() {
    return this.crossReferenceModel;
  }
  clear() {
    this.t2j_1.n2();
    this.s2j_1.clear();
  }
  x2j(sentenceIdentity, asm, locationMap, options) {
    var context = options.context;
    var tmp = this;
    tmp.u2j_1 = locationMap == null ? new LocationMapDefault() : locationMap;
    if (null == context) {
      this.s2j_1.info(null, 'No context provided, references not built, checked or resolved, switch off semanticAnalysis or provide a context.');
    } else {
      buildScope(this, options, sentenceIdentity, asm, context);
      checkAndResolveReferences(this, options, sentenceIdentity, asm, _get__locationMap__uz16lf(this), context);
    }
    return new SemanticAnalysisResultDefault(this.t2j_1, this.s2j_1);
  }
  y2j(sentenceIdentity, asm, locationMap, options) {
    return this.x2j(sentenceIdentity, isInterface(asm, Asm) ? asm : THROW_CCE(), locationMap, options);
  }
}
class SyntaxAnalyser {}
function clear(done, $super) {
  done = done === VOID ? emptySet() : done;
  var tmp;
  if ($super === VOID) {
    this.o2k(done);
    tmp = Unit_instance;
  } else {
    tmp = $super.o2k.call(this, done);
  }
  return tmp;
}
class SyntaxAnalyserFromTreeDataAbstract {
  constructor() {
    this.p2k_1 = new LocationMapDefault();
    this.issues = new IssueHolder(LanguageProcessorPhase_SYNTAX_ANALYSIS_getInstance());
    this.q2k_1 = emptyMap();
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.r2k_1 = LinkedHashMap.l4();
  }
  j2b() {
    return this.p2k_1;
  }
  n16() {
    return this.issues;
  }
  s2k() {
    return this.q2k_1;
  }
  e2k() {
    return this.r2k_1;
  }
  setLocationFor(obj, nodeInfo, sentence) {
    this.locationMap.add(nodeInfo.path, obj, locationForNode(sentence, nodeInfo.node));
  }
  setEmbeddedSyntaxAnalyser(qualifiedName, sa) {
    var tmp = this.embeddedSyntaxAnalyser;
    var tmp0 = isInterface(tmp, KtMutableMap) ? tmp : THROW_CCE();
    // Inline function 'kotlin.collections.set' call
    var key = new QualifiedName(qualifiedName);
    tmp0.r2(key, sa);
  }
  o2k(done) {
    if (!done.e1(isInterface(this, SyntaxAnalyser) ? this : THROW_CCE())) {
      this.locationMap.clear();
      this.issues.clear();
      var newDone = plus_1(done, this);
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s = this.extendsSyntaxAnalyser.v2().s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        element.clear(newDone);
      }
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s_0 = this.embeddedSyntaxAnalyser.v2().s();
      while (_iterator__ex2g4s_0.t()) {
        var element_0 = _iterator__ex2g4s_0.u();
        element_0.clear(newDone);
      }
    }
  }
  transform(sppt, mapToGrammar) {
    var sentence = (sppt instanceof SPPTFromTreeData ? sppt : THROW_CCE()).sentence;
    var treeData = (sppt instanceof SPPTFromTreeData ? sppt : THROW_CCE()).h1n_1;
    this.walkTree(sentence, treeData, false);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.embeddedSyntaxAnalyser.v2().s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      this.issues.addAllFrom((element instanceof SyntaxAnalyserFromTreeDataAbstract ? element : THROW_CCE()).issues);
    }
    return new SyntaxAnalysisResultDefault(this.asm, this.issues, this.locationMap);
  }
  locationForNode(sentence, node) {
    return locationForNode(sentence, node);
  }
  get locationMap() {
    return this.j2b();
  }
  get asm() {
    return this.p2d();
  }
  get extendsSyntaxAnalyser() {
    return this.s2k();
  }
  get embeddedSyntaxAnalyser() {
    return this.e2k();
  }
}
class SyntaxAnalyserFromAsmTransformAbstract extends SyntaxAnalyserFromTreeDataAbstract {
  constructor(_typeModel, asmTransformModel, relevantTrRuleSet, asmFactory) {
    super();
    this.asmTransformModel = asmTransformModel;
    this.relevantTrRuleSet = relevantTrRuleSet;
    this.asmFactory = asmFactory;
    this.i2k_1 = null;
    var tmp = this;
    var tmp0_safe_receiver = this.asmTransformModel.findNamespaceOrNull(_QualifiedName___get_front__impl__24j8eq(this.relevantTrRuleSet));
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.findDefinitionOrNull(_QualifiedName___get_last__impl__838y8h(this.relevantTrRuleSet));
    var tmp_0;
    if (tmp1_elvis_lhs == null) {
      var message = "Relevant TransformRuleSet not Found for '" + QualifiedName__toString_impl_z3wem2(this.relevantTrRuleSet) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    tmp.relevantRuleSet = tmp_0;
    this._trf = new AsmTransformInterpreter(this.typeModel, this.asmFactory);
    // Inline function 'kotlin.also' call
    var this_0 = new TypeModelSimple(_SimpleName___init__impl__6s45d0(_SimpleName___get_value__impl__rl2r3c(_typeModel.name) + '+ParseNodeNamespace'));
    this_0.addAllNamespaceAndResolveImports(plus_0(_typeModel.namespace, Companion_getInstance_29().parseNodeNamespace));
    this.asmFactory.typeModel = this_0;
  }
  j2k() {
    return this.asmTransformModel;
  }
  k2k() {
    return this.relevantTrRuleSet;
  }
  l2k() {
    return this.asmFactory;
  }
  m2e() {
    return this.asmFactory.typeModel;
  }
  p2d() {
    var tmp = this.i2k_1;
    return !(tmp == null) ? tmp : THROW_CCE();
  }
  m2k() {
    return this.relevantRuleSet;
  }
  n2k() {
    return this._trf;
  }
  o2k(done) {
    super.clear(done, protoOf(SyntaxAnalyserFromTreeDataAbstract));
    this._trf.clear();
    this.i2k_1 = null;
  }
  walkTree(sentence, treeData, skipDataAsTree) {
    var syntaxAnalyserStack = mutableStackOf([this]);
    var downStack = mutableStackOf([]);
    var stack = mutableStackOf([]);
    var walker = new SyntaxAnalyserFromAsmTransformAbstract$walkTree$walker$1(syntaxAnalyserStack, this, stack, sentence, downStack);
    treeData.traverseTreeDepthFirst(walker, false);
  }
  get typeModel() {
    return this.m2e();
  }
}
class SyntaxAnalyserSimple extends SyntaxAnalyserFromAsmTransformAbstract {
  constructor(typeModel, asmTransformModel, relevantTrRuleSet) {
    super(typeModel, asmTransformModel, relevantTrRuleSet, new AsmFactorySimple(typeModel, new IssueHolder(LanguageProcessorPhase_SYNTAX_ANALYSIS_getInstance())));
    var tmp = this;
    tmp.d2k_1 = lazyMap(SyntaxAnalyserSimple$embeddedSyntaxAnalyser$lambda(typeModel, asmTransformModel));
  }
  e2k() {
    return this.d2k_1;
  }
}
class ObjectGraph {}
class ObjectGraphAsmSimple {
  constructor(typeModel, issues) {
    this.t2k_1 = typeModel;
    this.u2k_1 = issues;
  }
  v2k(_set____db54di) {
    this.t2k_1 = _set____db54di;
  }
  m2e() {
    return this.t2k_1;
  }
  w2k(_this__u8e3s4) {
    return new TypedObjectAsmValue(this.typeFor(_this__u8e3s4), _this__u8e3s4);
  }
  typeFor(obj) {
    var tmp;
    if (obj == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      var tmp0_safe_receiver = this.typeModel.findByQualifiedNameOrNull(obj.qualifiedTypeName);
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.type();
      tmp = tmp1_elvis_lhs == null ? StdLibDefault_getInstance().AnyType : tmp1_elvis_lhs;
    }
    var tmp1_elvis_lhs_0 = tmp;
    return tmp1_elvis_lhs_0 == null ? StdLibDefault_getInstance().NothingType : tmp1_elvis_lhs_0;
  }
  toTypedObject(obj) {
    var tmp1_elvis_lhs = obj == null ? null : this.w2k(obj);
    return tmp1_elvis_lhs == null ? this.nothing() : tmp1_elvis_lhs;
  }
  nothing() {
    return this.w2k(AsmNothingSimple_getInstance());
  }
  any(value) {
    return this.w2k(new AsmAnySimple(value));
  }
  createPrimitiveValue(qualifiedTypeName, value) {
    var tmp;
    if (qualifiedTypeName === StdLibDefault_getInstance().Boolean.qualifiedTypeName) {
      var tmp_0 = Companion_instance_9;
      tmp = this.w2k(tmp_0.stdBoolean(typeof value === 'boolean' ? value : THROW_CCE()));
    } else if (qualifiedTypeName === StdLibDefault_getInstance().Integer.qualifiedTypeName) {
      var tmp_1 = Companion_instance_9;
      tmp = this.w2k(tmp_1.stdInteger(value instanceof Long ? value : THROW_CCE()));
    } else if (qualifiedTypeName === StdLibDefault_getInstance().Real.qualifiedTypeName) {
      var tmp_2 = Companion_instance_9;
      tmp = this.w2k(tmp_2.stdReal(typeof value === 'number' ? value : THROW_CCE()));
    } else if (qualifiedTypeName === StdLibDefault_getInstance().String.qualifiedTypeName) {
      var tmp_3 = Companion_instance_9;
      tmp = this.w2k(tmp_3.stdString(typeof value === 'string' ? value : THROW_CCE()));
    } else {
      var message = 'should not happen';
      throw IllegalStateException.v4(toString(message));
    }
    return tmp;
  }
  createTupleValue(typeArgs) {
    var tupleType = StdLibDefault_getInstance().TupleType;
    var tuple = new AsmStructureSimple(tupleType.qualifiedName);
    return new TypedObjectAsmValue(tupleType.type(typeArgs), tuple);
  }
  createStructureValue(possiblyQualifiedTypeName, constructorArgs) {
    var tmp0_elvis_lhs = this.typeModel.findFirstDefinitionByPossiblyQualifiedNameOrNull(possiblyQualifiedTypeName);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = 'Type not found ' + toString(possiblyQualifiedTypeName);
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var typeDecl = tmp;
    var obj = new AsmStructureSimple(typeDecl.qualifiedName);
    // Inline function 'kotlin.collections.forEach' call
    // Inline function 'kotlin.collections.iterator' call
    var _iterator__ex2g4s = constructorArgs.w2().s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      // Inline function 'kotlin.collections.component1' call
      var k = element.a3();
      // Inline function 'kotlin.collections.component2' call
      var v = element.b3();
      obj.setProperty(_PropertyValueName___init__impl__cmfy0i(k), v.self, obj.k2m_1.v());
    }
    return new TypedObjectAsmValue(typeDecl.type(), obj);
  }
  createCollection(qualifiedTypeName, collection) {
    var tmp;
    if (qualifiedTypeName === StdLibDefault_getInstance().List.qualifiedName) {
      var tmp1_safe_receiver = firstOrNull_0(collection);
      var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.type;
      var elType = tmp2_elvis_lhs == null ? StdLibDefault_getInstance().AnyType : tmp2_elvis_lhs;
      var tmp_0 = StdLibDefault_getInstance().List.type(listOf(elType.asTypeArgument));
      // Inline function 'kotlin.collections.map' call
      // Inline function 'kotlin.collections.mapTo' call
      var destination = ArrayList.w(collectionSizeOrDefault(collection, 10));
      var _iterator__ex2g4s = collection.s();
      while (_iterator__ex2g4s.t()) {
        var item = _iterator__ex2g4s.u();
        var tmp$ret$0 = item.self;
        destination.r(tmp$ret$0);
      }
      tmp = new TypedObjectAsmValue(tmp_0, new AsmListSimple(destination));
    } else if (qualifiedTypeName === StdLibDefault_getInstance().ListSeparated.qualifiedName) {
      var list = toList(collection);
      var tmp3_safe_receiver = getOrNull(list, 0);
      var tmp4_elvis_lhs = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.type;
      var elType_0 = tmp4_elvis_lhs == null ? StdLibDefault_getInstance().AnyType : tmp4_elvis_lhs;
      var tmp5_safe_receiver = getOrNull(list, 1);
      var tmp6_elvis_lhs = tmp5_safe_receiver == null ? null : tmp5_safe_receiver.type;
      var sepType = tmp6_elvis_lhs == null ? StdLibDefault_getInstance().AnyType : tmp6_elvis_lhs;
      var tmp_1 = StdLibDefault_getInstance().ListSeparated.type(listOf_0([elType_0.asTypeArgument, sepType.asTypeArgument]));
      // Inline function 'kotlin.collections.map' call
      // Inline function 'kotlin.collections.mapTo' call
      var destination_0 = ArrayList.w(collectionSizeOrDefault(collection, 10));
      var _iterator__ex2g4s_0 = collection.s();
      while (_iterator__ex2g4s_0.t()) {
        var item_0 = _iterator__ex2g4s_0.u();
        var tmp$ret$3 = item_0.self;
        destination_0.r(tmp$ret$3);
      }
      // Inline function 'net.akehurst.language.collections.toSeparatedList' call
      var tmp$ret$6 = ListSeparatedArrayList.gk(destination_0);
      tmp = new TypedObjectAsmValue(tmp_1, new AsmListSeparatedSimple(tmp$ret$6));
    } else {
      tmp = this.nothing();
    }
    return tmp;
  }
  createLambdaValue(lambda) {
    var lambdaType = StdLibDefault_getInstance().Lambda;
    var lmb = new AsmLambdaSimple(ObjectGraphAsmSimple$createLambdaValue$lambda(lambda, this));
    return new TypedObjectAsmValue(lambdaType, lmb);
  }
  valueOf(value) {
    return get_raw(value.self);
  }
  getIndex(tobj, index) {
    var asmValue = tobj.self;
    var tmp;
    if (isInterface(asmValue, AsmList)) {
      var el = getOrNull(asmValue.elements, index);
      var tmp_0;
      if (el == null) {
        this.u2k_1.error(null, "in getIndex argument index '" + index + "' out of range");
        tmp_0 = this.nothing();
      } else {
        tmp_0 = this.w2k(el);
      }
      tmp = tmp_0;
    } else {
      this.u2k_1.error(null, "getIndex not supported on type '" + SimpleName__toString_impl_vxsxyc(tobj.type.typeName) + "'");
      tmp = this.nothing();
    }
    return tmp;
  }
  getProperty(tobj, propertyName) {
    var asmValue = tobj.self;
    var propRes = tobj.type.allResolvedProperty.z2(new PropertyName(_PropertyName___init__impl__sz2wu9(propertyName)));
    var tmp;
    if (propRes == null) {
      var tmp_0;
      if (isInterface(asmValue, AsmStructure)) {
        var pv = asmValue.property.z2(new PropertyValueName(_PropertyValueName___init__impl__cmfy0i(propertyName)));
        var tmp_1;
        if (pv == null) {
          tmp_1 = null;
        } else {
          // Inline function 'kotlin.let' call
          tmp_1 = this.w2k(pv.value);
        }
        var tmp2_elvis_lhs = tmp_1;
        tmp_0 = tmp2_elvis_lhs == null ? this.nothing() : tmp2_elvis_lhs;
      } else {
        this.u2k_1.error(null, "getProperty property '" + propertyName + "' not found on object of type '" + SimpleName__toString_impl_vxsxyc(tobj.type.typeName) + "'");
        tmp_0 = this.nothing();
      }
      tmp = tmp_0;
    } else {
      var tmp3_subject = propRes.original;
      var tmp_2;
      if (tmp3_subject instanceof PropertyDeclarationDerived) {
        throw NotImplementedError.uj();
      } else {
        if (tmp3_subject instanceof PropertyDeclarationPrimitive) {
          var type = tobj.type.resolvedDeclaration;
          var tmp4_elvis_lhs = StdLibPrimitiveExecutions_getInstance().property.z2(type);
          var tmp_3;
          if (tmp4_elvis_lhs == null) {
            var message = "StdLibPrimitiveExecutions not found for TypeDeclaration '" + QualifiedName__toString_impl_z3wem2(type.qualifiedName) + "'";
            throw IllegalStateException.v4(toString(message));
          } else {
            tmp_3 = tmp4_elvis_lhs;
          }
          var typeProps = tmp_3;
          var tmp5_elvis_lhs = typeProps.z2(propRes.original);
          var tmp_4;
          if (tmp5_elvis_lhs == null) {
            var message_0 = "StdLibPrimitiveExecutions not found for property '" + propertyName + "' of TypeDeclaration '" + QualifiedName__toString_impl_z3wem2(type.qualifiedName) + "'";
            throw IllegalStateException.v4(toString(message_0));
          } else {
            tmp_4 = tmp5_elvis_lhs;
          }
          var propExec = tmp_4;
          tmp_2 = this.w2k(propExec(asmValue, propRes));
        } else {
          if (tmp3_subject instanceof PropertyDeclarationStored) {
            var tmp_5;
            if (isInterface(asmValue, AsmStructure)) {
              var pv_0 = asmValue.property.z2(new PropertyValueName(_PropertyValueName___init__impl__cmfy0i(propertyName)));
              var tmp_6;
              if (pv_0 == null) {
                tmp_6 = null;
              } else {
                // Inline function 'kotlin.let' call
                tmp_6 = this.w2k(pv_0.value);
              }
              var tmp8_elvis_lhs = tmp_6;
              tmp_5 = tmp8_elvis_lhs == null ? this.nothing() : tmp8_elvis_lhs;
            } else {
              var message_1 = "Cannot evaluate property '" + propertyName + "' on object of type '" + getKClassFromExpression(tobj).zc() + "'";
              throw IllegalStateException.v4(toString(message_1));
            }
            tmp_2 = tmp_5;
          } else {
            var message_2 = "Subtype of PropertyDeclaration not handled: '" + getKClassFromExpression(this).zc() + "'";
            throw IllegalStateException.v4(toString(message_2));
          }
        }
      }
      tmp = tmp_2;
    }
    return tmp;
  }
  setProperty(tobj, propertyName, value) {
    var tmp = tobj.self;
    var obj = isInterface(tmp, AsmStructure) ? tmp : THROW_CCE();
    obj.setProperty(_PropertyValueName___init__impl__cmfy0i(propertyName), value.self, obj.property.v());
  }
  executeMethod(tobj, methodName, args) {
    var methRes = ensureNotNull(tobj.type.allResolvedMethod.z2(new MethodName(_MethodName___init__impl__2ggy8b(methodName))));
    var type = tobj.type.resolvedDeclaration;
    var stdMeths = StdLibPrimitiveExecutions_getInstance().method.z2(type);
    var tmp;
    if (stdMeths == null) {
      throw NotImplementedError.uj();
    } else {
      var tmp1_elvis_lhs = stdMeths.z2(methRes.original);
      var tmp_0;
      if (tmp1_elvis_lhs == null) {
        var message = "StdLibPrimitiveExecutions not found for method '" + _MethodName___get_value__impl__37ln07(methRes.name) + "' of TypeDeclaration '" + QualifiedName__toString_impl_z3wem2(type.qualifiedName) + "'";
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp_0 = tmp1_elvis_lhs;
      }
      var methExec = tmp_0;
      var self_0 = tobj.self;
      tmp = methExec(self_0, methRes, args);
    }
    var ao = tmp;
    return new TypedObjectAsmValue(methRes.returnType, ao);
  }
  cast(tobj, newType) {
    var rtd = newType.resolvedDeclaration;
    var tmp;
    if (isInterface(rtd, TupleType)) {
      var tmp_0 = tobj.self;
      // Inline function 'kotlin.collections.map' call
      var this_0 = (isInterface(tmp_0, AsmStructure) ? tmp_0 : THROW_CCE()).property;
      // Inline function 'kotlin.collections.mapTo' call
      var destination = ArrayList.w(this_0.v());
      // Inline function 'kotlin.collections.iterator' call
      var _iterator__ex2g4s = this_0.w2().s();
      while (_iterator__ex2g4s.t()) {
        var item = _iterator__ex2g4s.u();
        var n = _PropertyName___init__impl__sz2wu9(_PropertyValueName___get_value__impl__k5tzza(item.a3().i2p_1));
        var t = StdLibDefault_getInstance().AnyType;
        var tmp$ret$1 = new TypeArgumentNamedSimple(n, t);
        destination.r(tmp$ret$1);
      }
      var targs = destination;
      var tp = rtd.typeTuple(targs);
      tmp = new TypedObjectAsmValue(tp, tobj.self);
    } else {
      tmp = this.w2k(tobj.self);
    }
    return tmp;
  }
  get typeModel() {
    return this.m2e();
  }
  set typeModel(value) {
    this.v2k(value);
  }
}
class AsmFactory {}
class AsmFactorySimple extends ObjectGraphAsmSimple {
  constructAsm() {
    return new AsmSimple();
  }
  rootList(asm) {
    return asm.root;
  }
  addRoot(asm, root) {
    return (asm instanceof AsmSimple ? asm : THROW_CCE()).addRoot(root);
  }
  removeRoot(asm, root) {
    return (asm instanceof AsmSimple ? asm : THROW_CCE()).removeRoot(root);
  }
  get typeModel() {
    return this.m2e();
  }
  set typeModel(value) {
    this.v2k(value);
  }
}
class Grammar2TypeModelMapping {}
class TypeModelFromGrammarConfigurationDefault {
  typeNameFor(rule) {
    // Inline function 'kotlin.text.replaceFirstChar' call
    var this_0 = _GrammarRuleName___get_value__impl__470s0v(rule.name);
    var tmp;
    // Inline function 'kotlin.text.isNotEmpty' call
    if (charSequenceLength(this_0) > 0) {
      var it = charSequenceGet(this_0, 0);
      var tmp$ret$1 = titlecase(it);
      var tmp_0 = toString(tmp$ret$1);
      // Inline function 'kotlin.text.substring' call
      // Inline function 'kotlin.js.asDynamic' call
      tmp = tmp_0 + this_0.substring(1);
    } else {
      tmp = this_0;
    }
    var tmp$ret$4 = tmp;
    return _SimpleName___init__impl__6s45d0(tmp$ret$4);
  }
  propertyNameFor(context, ruleItem, ruleItemType) {
    var baseName = baseNameFor(this, ruleItem, ruleItemType);
    var tmp;
    if (isInterface(ruleItemType, PrimitiveType)) {
      tmp = baseName;
    } else {
      if (isInterface(ruleItemType, UnionType)) {
        tmp = baseName;
      } else {
        if (isInterface(ruleItemType, CollectionType)) {
          var tmp_0;
          if (isInterface(ruleItem, NonTerminal)) {
            tmp_0 = lower(_GrammarRuleName___get_value__impl__470s0v(ruleItem.ruleReference));
          } else {
            if (isInterface(ruleItem, Terminal)) {
              tmp_0 = _PropertyName___get_value__impl__p219lh(Companion_getInstance_3().UNNAMED_LIST_PROPERTY_NAME);
            } else {
              if (isInterface(ruleItem, Group)) {
                tmp_0 = _PropertyName___get_value__impl__p219lh(Companion_getInstance_3().UNNAMED_LIST_PROPERTY_NAME);
              } else {
                tmp_0 = baseName + 'List';
              }
            }
          }
          tmp = tmp_0;
        } else {
          if (isInterface(ruleItemType, TupleType)) {
            tmp = baseName;
          } else {
            if (isInterface(ruleItemType, DataType)) {
              tmp = baseName;
            } else {
              tmp = baseName;
            }
          }
        }
      }
    }
    var name = tmp;
    return _PropertyName___init__impl__sz2wu9(name);
  }
}
class ContextBuilder {
  constructor(createScopedItem, resolveScopedItem) {
    this.z2k_1 = new ContextWithScope(createScopedItem, resolveScopedItem);
  }
  a2l(id, init) {
    var tmp = this.z2k_1.newScopeForSentence(id);
    var scope = tmp instanceof ScopeSimple ? tmp : THROW_CCE();
    var b = new ScopeBuilder(scope, this.z2k_1.createScopedItem, this.z2k_1.resolveScopedItem);
    init(b);
  }
  forSentence(id, init, $super) {
    var tmp;
    if (init === VOID) {
      tmp = ContextBuilder$forSentence$lambda;
    } else {
      tmp = init;
    }
    init = tmp;
    var tmp_0;
    if ($super === VOID) {
      this.a2l(id, init);
      tmp_0 = Unit_instance;
    } else {
      tmp_0 = $super.a2l.call(this, id, init);
    }
    return tmp_0;
  }
  build() {
    return this.z2k_1;
  }
}
class ScopeBuilder {
  constructor(_scope, _createScopedItem, _resolveScopedItem) {
    this.b2l_1 = _scope;
    this.c2l_1 = _createScopedItem;
    this.d2l_1 = _resolveScopedItem;
  }
  item(id, qualifiedTypeName, location, itemInScope) {
    this.b2l_1.addToScope(id, _QualifiedName___init__impl__8ed982(qualifiedTypeName), location, itemInScope, false);
  }
  e2l(forReferenceInParent, forTypeName, init) {
    var chScope = this.b2l_1.createOrGetChildScope(forReferenceInParent, _QualifiedName___init__impl__8ed982(forTypeName));
    var b = new ScopeBuilder(chScope, this.c2l_1, this.d2l_1);
    init(b);
  }
  scope(forReferenceInParent, forTypeName, init, $super) {
    var tmp;
    if (init === VOID) {
      tmp = ScopeBuilder$scope$lambda;
    } else {
      tmp = init;
    }
    init = tmp;
    var tmp_0;
    if ($super === VOID) {
      this.e2l(forReferenceInParent, forTypeName, init);
      tmp_0 = Unit_instance;
    } else {
      tmp_0 = $super.e2l.call(this, forReferenceInParent, forTypeName, init);
    }
    return tmp_0;
  }
  f2l(id, qualifiedTypeName, location, itemInScope, init) {
    this.b2l_1.addToScope(id, _QualifiedName___init__impl__8ed982(qualifiedTypeName), location, itemInScope, false);
    var forTypeName = substringAfterLast(qualifiedTypeName, '.');
    var chScope = this.b2l_1.createOrGetChildScope(id, _QualifiedName___init__impl__8ed982(forTypeName));
    var b = new ScopeBuilder(chScope, this.c2l_1, this.d2l_1);
    init(b);
  }
  scopedItem(id, qualifiedTypeName, location, itemInScope, init, $super) {
    var tmp;
    if (init === VOID) {
      tmp = ScopeBuilder$scopedItem$lambda;
    } else {
      tmp = init;
    }
    init = tmp;
    var tmp_0;
    if ($super === VOID) {
      this.f2l(id, qualifiedTypeName, location, itemInScope, init);
      tmp_0 = Unit_instance;
    } else {
      tmp_0 = $super.f2l.call(this, id, qualifiedTypeName, location, itemInScope, init);
    }
    return tmp_0;
  }
  build() {
  }
}
class sam$net_akehurst_language_agl_simple_CreateScopedItem$0 {
  constructor(function_0) {
    this.g2l_1 = function_0;
  }
  invoke(qualifiedName, item, location) {
    return this.g2l_1(qualifiedName, item, location);
  }
  w3() {
    return this.g2l_1;
  }
  equals(other) {
    var tmp;
    if (!(other == null) ? isInterface(other, CreateScopedItem) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.w3(), other.w3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.w3());
  }
}
class sam$net_akehurst_language_agl_simple_ResolveScopedItem$0_0 {
  constructor(function_0) {
    this.h2l_1 = function_0;
  }
  invoke(itemInScope) {
    return this.h2l_1(itemInScope);
  }
  w3() {
    return this.h2l_1;
  }
  equals(other) {
    var tmp;
    if (!(other == null) ? isInterface(other, ResolveScopedItem) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.w3(), other.w3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.w3());
  }
}
class SyntaxAnalyserByMethodRegistrationAbstract$Companion$EMPTY_LIST_VALUE$1 {
  toString() {
    return 'EMPTY_LIST_VALUE';
  }
}
class SyntaxAnalyserByMethodRegistrationAbstract$Companion$EMPTY_TERMINAL_VALUE$1 {
  toString() {
    return 'EMPTY_TERMINAL_VALUE';
  }
}
class Companion_2 {
  constructor() {
    Companion_instance_3 = this;
    var tmp = this;
    tmp.i2l_1 = new SyntaxAnalyserByMethodRegistrationAbstract$Companion$EMPTY_LIST_VALUE$1();
    var tmp_0 = this;
    tmp_0.j2l_1 = new SyntaxAnalyserByMethodRegistrationAbstract$Companion$EMPTY_TERMINAL_VALUE$1();
  }
}
class SyntaxAnalyserByMethodRegistrationAbstract$walkTree$walker$1 {
  constructor($stack, $syntaxAnalyserStack, $sentence, this$0) {
    this.q2l_1 = $stack;
    this.r2l_1 = $syntaxAnalyserStack;
    this.s2l_1 = $sentence;
    this.t2l_1 = this$0;
  }
  beginTree() {
  }
  endTree() {
  }
  leaf(nodeInfo) {
    if (nodeInfo.node.rule.isEmptyTerminal) {
      this.q2l_1.nk(Companion_getInstance_5().j2l_1);
    } else if (nodeInfo.node.rule.isEmptyListTerminal) {
      this.q2l_1.nk(Companion_getInstance_5().i2l_1);
    } else {
      var handlerName = nodeInfo.node.rule.tag;
      var handler = findBranchHandler(this.r2l_1.ok(), handlerName, false);
      var tmp;
      if (handler == null) {
        tmp = matchedTextNoSkip(this.s2l_1, nodeInfo.node);
      } else {
        var res = handler(nodeInfo, emptyList(), this.s2l_1);
        if (res == null)
          null;
        else {
          // Inline function 'kotlin.let' call
          this.t2l_1.setLocationFor(res, nodeInfo, this.s2l_1);
        }
        tmp = res;
      }
      var obj = tmp;
      this.q2l_1.nk(obj);
    }
  }
  beginBranch(nodeInfo) {
    var branchName = nodeInfo.node.rule.tag;
    var handler = findBranchHandler(this.r2l_1.ok(), branchName, true);
    if (null != handler) {
      var numChildren = nodeInfo.child.index;
      var siblings = this.q2l_1.qk(numChildren);
      handler(nodeInfo, siblings, this.s2l_1);
    }
  }
  endBranch(nodeInfo) {
    var opt = nodeInfo.alt.option;
    var numChildren = ensureNotNull(nodeInfo.numChildrenAlternatives.z2(new OptionNum(opt)));
    var children = this.q2l_1.sk(numChildren);
    var reverseChildren = reversed(children);
    var branchName = nodeInfo.node.rule.tag;
    var handler = findBranchHandler(this.r2l_1.ok(), branchName, false);
    if (nodeInfo.node.rule.isOptional) {
      var v = reverseChildren.z(0);
      var tmp;
      if (equals(v, Companion_getInstance_5().j2l_1)) {
        tmp = null;
      } else if (equals(v, Companion_getInstance_5().i2l_1)) {
        var message = 'should not happen';
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp = v;
      }
      var child = tmp;
      if (handler == null) {
        this.q2l_1.nk(child);
      } else {
        var obj = handler(nodeInfo, listOf(child), this.s2l_1);
        if (obj == null)
          null;
        else {
          // Inline function 'kotlin.let' call
          this.t2l_1.setLocationFor(obj, nodeInfo, this.s2l_1);
        }
        this.q2l_1.nk(obj);
      }
    } else if (nodeInfo.node.rule.isList) {
      var chldn = nodeInfo.node.rule.isListOptional && 1 === children.v() && equals(Companion_getInstance_5().i2l_1, children.z(0)) ? emptyList() : reverseChildren;
      if (handler == null) {
        this.q2l_1.nk(chldn);
      } else {
        var obj_0 = handler(nodeInfo, chldn, this.s2l_1);
        if (obj_0 == null)
          null;
        else {
          // Inline function 'kotlin.let' call
          this.t2l_1.setLocationFor(obj_0, nodeInfo, this.s2l_1);
        }
        this.q2l_1.nk(obj_0);
      }
    } else {
      if (handler == null) {
        this.q2l_1.nk(reverseChildren);
      } else {
        var obj_1 = handler(nodeInfo, reverseChildren, this.s2l_1);
        if (obj_1 != null) {
          if (!(!(obj_1 == null) ? typeof obj_1 === 'function' : false)) {
            this.t2l_1.setLocationFor(obj_1, nodeInfo, this.s2l_1);
          }
        }
        this.q2l_1.nk(obj_1);
      }
    }
  }
  beginEmbedded(nodeInfo) {
    var tmp = nodeInfo.node.rule;
    var tmp_0 = (tmp instanceof RuntimeRule ? tmp : THROW_CCE()).rhs;
    var embeddedRhs = tmp_0 instanceof RuntimeRuleRhsEmbedded ? tmp_0 : THROW_CCE();
    var embName = embeddedRhs.embeddedRuntimeRuleSet.qualifiedName;
    var tmp_1 = this.r2l_1.ok().embeddedSyntaxAnalyser.z2(new QualifiedName(_QualifiedName___init__impl__8ed982(embName)));
    var tmp0_elvis_lhs = (tmp_1 == null ? true : tmp_1 instanceof SyntaxAnalyserByMethodRegistrationAbstract) ? tmp_1 : THROW_CCE();
    var tmp_2;
    if (tmp0_elvis_lhs == null) {
      var message = "Embedded SyntaxAnalyser not found for '" + embName + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_2 = tmp0_elvis_lhs;
    }
    var embSyntaxAnalyser = tmp_2;
    this.r2l_1.nk(embSyntaxAnalyser);
  }
  endEmbedded(nodeInfo) {
    this.r2l_1.rk();
    var handlerName = nodeInfo.node.rule.tag;
    var handler = findBranchHandler(this.r2l_1.ok(), handlerName, false);
    var children = this.q2l_1.sk(1);
    var tmp;
    if (handler == null) {
      tmp = children.z(0);
    } else {
      var obj = handler(nodeInfo, children, this.s2l_1);
      if (obj == null)
        null;
      else {
        // Inline function 'kotlin.let' call
        this.t2l_1.setLocationFor(obj, nodeInfo, this.s2l_1);
      }
      tmp = obj;
    }
    var obj_0 = tmp;
    this.q2l_1.nk(obj_0);
  }
  treeError(msg, path) {
    // Inline function 'kotlin.error' call
    throw IllegalStateException.v4(toString(msg));
  }
  skip(startPosition, nextInputPosition) {
  }
}
class SyntaxAnalyserByMethodRegistrationAbstract extends SyntaxAnalyserFromTreeDataAbstract {
  constructor() {
    Companion_getInstance_5();
    super();
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.n2l_1 = LinkedHashMap.l4();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_0.o2l_1 = LinkedHashMap.l4();
    this.p2l_1 = null;
  }
  p2d() {
    var tmp0_elvis_lhs = this.p2l_1;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = 'Root of asm not set, walk must have failed';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  walkTree(sentence, treeData, skipDataAsTree) {
    var syntaxAnalyserStack = mutableStackOf([this]);
    var stack = mutableStackOf([]);
    var walker = new SyntaxAnalyserByMethodRegistrationAbstract$walkTree$walker$1(stack, syntaxAnalyserStack, sentence, this);
    treeData.traverseTreeDepthFirst(walker, skipDataAsTree);
    var root = stack.rk();
    var tmp = this;
    tmp.p2l_1 = !(root == null) ? root : THROW_CCE();
  }
  register(handler) {
    var tmp0 = this.n2l_1;
    var tmp1 = handler.callableName;
    // Inline function 'kotlin.collections.set' call
    var value = typeof handler === 'function' ? handler : THROW_CCE();
    tmp0.r2(tmp1, value);
  }
  registerFor(branchName, handler) {
    // Inline function 'kotlin.collections.set' call
    this.n2l_1.r2(branchName, handler);
  }
  registerForBeginHandler(branchName, handler) {
    var tmp0 = this.o2l_1;
    // Inline function 'kotlin.collections.set' call
    var value = typeof handler === 'function' ? handler : THROW_CCE();
    tmp0.r2(branchName, value);
  }
}
class NodeTrRules {
  constructor(forNode, forChildren) {
    return new.target.u2l(forNode, forChildren);
  }
  static u2l(forNode, forChildren) {
    var $this = createThis(this);
    $this.forNode = forNode;
    $this.forChildren = forChildren;
    return $this;
  }
  v2l() {
    return this.forNode;
  }
  w2l() {
    return this.forChildren;
  }
  static new_net_akehurst_language_agl_syntaxAnalyser_NodeTrRules(t) {
    return this.u2l(t, t);
  }
  bh() {
    return this.forNode;
  }
  ch() {
    return this.forChildren;
  }
  x2l(forNode, forChildren) {
    return NodeTrRules.u2l(forNode, forChildren);
  }
  copy(forNode, forChildren, $super) {
    forNode = forNode === VOID ? this.forNode : forNode;
    forChildren = forChildren === VOID ? this.forChildren : forChildren;
    return $super === VOID ? this.x2l(forNode, forChildren) : $super.x2l.call(this, forNode, forChildren);
  }
  toString() {
    return 'NodeTrRules(forNode=' + toString(this.forNode) + ', forChildren=' + toString(this.forChildren) + ')';
  }
  hashCode() {
    var result = hashCode(this.forNode);
    result = imul(result, 31) + hashCode(this.forChildren) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof NodeTrRules))
      return false;
    var tmp0_other_with_cast = other instanceof NodeTrRules ? other : THROW_CCE();
    if (!equals(this.forNode, tmp0_other_with_cast.forNode))
      return false;
    if (!equals(this.forChildren, tmp0_other_with_cast.forChildren))
      return false;
    return true;
  }
}
class DownData2 {
  constructor(path, trRule) {
    this.path = path;
    this.trRule = trRule;
  }
  n1m() {
    return this.path;
  }
  y2l() {
    return this.trRule;
  }
  bh() {
    return this.path;
  }
  ch() {
    return this.trRule;
  }
  z2l(path, trRule) {
    return new DownData2(path, trRule);
  }
  copy(path, trRule, $super) {
    path = path === VOID ? this.path : path;
    trRule = trRule === VOID ? this.trRule : trRule;
    return $super === VOID ? this.z2l(path, trRule) : $super.z2l.call(this, path, trRule);
  }
  toString() {
    return 'DownData2(path=' + this.path.toString() + ', trRule=' + this.trRule.toString() + ')';
  }
  hashCode() {
    var result = this.path.hashCode();
    result = imul(result, 31) + this.trRule.hashCode() | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof DownData2))
      return false;
    var tmp0_other_with_cast = other instanceof DownData2 ? other : THROW_CCE();
    if (!this.path.equals(tmp0_other_with_cast.path))
      return false;
    if (!this.trRule.equals(tmp0_other_with_cast.trRule))
      return false;
    return true;
  }
}
class ChildData {
  constructor(nodeInfo, value) {
    this.nodeInfo = nodeInfo;
    this.value = value;
  }
  a2m() {
    return this.nodeInfo;
  }
  b3() {
    return this.value;
  }
  bh() {
    return this.nodeInfo;
  }
  ch() {
    return this.value;
  }
  b2m(nodeInfo, value) {
    return new ChildData(nodeInfo, value);
  }
  copy(nodeInfo, value, $super) {
    nodeInfo = nodeInfo === VOID ? this.nodeInfo : nodeInfo;
    value = value === VOID ? this.value : value;
    return $super === VOID ? this.b2m(nodeInfo, value) : $super.b2m.call(this, nodeInfo, value);
  }
  toString() {
    return 'ChildData(nodeInfo=' + toString(this.nodeInfo) + ', value=' + toString_0(this.value) + ')';
  }
  hashCode() {
    var result = hashCode(this.nodeInfo);
    result = imul(result, 31) + (this.value == null ? 0 : hashCode(this.value)) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof ChildData))
      return false;
    var tmp0_other_with_cast = other instanceof ChildData ? other : THROW_CCE();
    if (!equals(this.nodeInfo, tmp0_other_with_cast.nodeInfo))
      return false;
    if (!equals(this.value, tmp0_other_with_cast.value))
      return false;
    return true;
  }
}
class Companion_3 {
  constructor() {
    this.c2m_1 = 'net.akehurst.language.agl.syntaxAnalyser';
    this.CONFIGURATION_KEY_AGL_SCOPE_MODEL = 'net.akehurst.language.agl.syntaxAnalyser.scope.model';
  }
  d2m() {
    return this.CONFIGURATION_KEY_AGL_SCOPE_MODEL;
  }
  e2m(_this__u8e3s4) {
    return _this__u8e3s4.owner.property.v() === 1;
  }
  f2m(_this__u8e3s4) {
    return _this__u8e3s4.rhsItems.v() === 1 && _this__u8e3s4.rhsItems.z(0).v() === 1;
  }
}
class SyntaxAnalyserFromAsmTransformAbstract$walkTree$walker$1 {
  constructor($syntaxAnalyserStack, this$0, $stack, $sentence, $downStack) {
    this.m2m_1 = $syntaxAnalyserStack;
    this.n2m_1 = this$0;
    this.o2m_1 = $stack;
    this.p2m_1 = $sentence;
    this.q2m_1 = $downStack;
    this.l2m_1 = true;
  }
  beginTree() {
    var tmp = this.m2m_1.ok();
    var tmp0_elvis_lhs = this.n2m_1.i2k_1;
    setAsm(tmp, tmp0_elvis_lhs == null ? this.n2m_1.asmFactory.constructAsm() : tmp0_elvis_lhs);
    this.l2m_1 = true;
  }
  endTree() {
    var root = this.o2m_1.rk();
    addAsmRoot(this.m2m_1.ok(), ensureNotNull(root.value).self);
  }
  leaf(nodeInfo) {
    var value = createValueFromLeaf(this.m2m_1.ok(), this.p2m_1, nodeInfo);
    this.o2m_1.nk(new ChildData(nodeInfo, value));
  }
  beginBranch(nodeInfo) {
    var parentDownData = this.q2m_1.pk();
    var p = nodeInfo.path;
    var tmp;
    if (this.l2m_1) {
      this.l2m_1 = false;
      var tmp0_elvis_lhs = findTrRuleForGrammarRuleNamedOrNull(this.m2m_1.ok(), nodeInfo.node.rule.tag);
      var tmp_0;
      if (tmp0_elvis_lhs == null) {
        var message = 'Type not found for ' + nodeInfo.node.rule.tag;
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp_0 = tmp0_elvis_lhs;
      }
      var trRule = tmp_0;
      tmp = trRule;
    } else {
      var tmp_1 = this.m2m_1.ok();
      var tmp2_safe_receiver = parentDownData == null ? null : parentDownData.trRule;
      tmp = trRuleForNode(tmp_1, tmp2_safe_receiver == null ? null : tmp2_safe_receiver.forChildren, nodeInfo);
    }
    var tr = tmp;
    var ddcomp = resolveCompressed(this.n2m_1, p, tr, nodeInfo);
    this.q2m_1.nk(ddcomp);
  }
  endBranch(nodeInfo) {
    var opt = nodeInfo.alt.option;
    var numChildren = ensureNotNull(nodeInfo.numChildrenAlternatives.z2(new OptionNum(opt)));
    var children = this.o2m_1.sk(numChildren);
    var adjChildren = reversed(children);
    var downData = this.q2m_1.rk();
    var value = equals(this.n2m_1.typeModel.NothingType, downData.trRule.forNode.resolvedType.resolvedDeclaration) ? this.n2m_1.asmFactory.nothing() : createValueFromBranch(this.m2m_1.ok(), this.p2m_1, downData, nodeInfo, adjChildren);
    if (value == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      this.n2m_1.setLocationFor(value.self, nodeInfo, this.p2m_1);
    }
    this.o2m_1.nk(new ChildData(nodeInfo, value));
  }
  beginEmbedded(nodeInfo) {
    var tmp = nodeInfo.node.rule;
    var tmp_0 = (tmp instanceof RuntimeRule ? tmp : THROW_CCE()).rhs;
    var embeddedRhs = tmp_0 instanceof RuntimeRuleRhsEmbedded ? tmp_0 : THROW_CCE();
    var embRuleName = embeddedRhs.embeddedStartRule.tag;
    var embGrmName = embeddedRhs.embeddedRuntimeRuleSet.qualifiedName;
    var tmp_1 = this.n2m_1.embeddedSyntaxAnalyser.z2(new QualifiedName(_QualifiedName___init__impl__8ed982(embGrmName)));
    var tmp0_elvis_lhs = (tmp_1 == null ? true : tmp_1 instanceof SyntaxAnalyserFromAsmTransformAbstract) ? tmp_1 : THROW_CCE();
    var tmp_2;
    if (tmp0_elvis_lhs == null) {
      var message = "Embedded SyntaxAnalyser not found for '" + embGrmName + "' in SyntaxAnalyser using TrRuleSet '" + QualifiedName__toString_impl_z3wem2(this.n2m_1.relevantTrRuleSet) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_2 = tmp0_elvis_lhs;
    }
    var embSyntaxAnalyser = tmp_2;
    this.m2m_1.nk(embSyntaxAnalyser instanceof SyntaxAnalyserFromAsmTransformAbstract ? embSyntaxAnalyser : THROW_CCE());
    var parentPath = this.l2m_1 ? Companion_getInstance_9().ROOT.plus(this.n2m_1.asmFactory.rootList(this.n2m_1.asm).v().toString()) : this.q2m_1.ok().path;
    var tmp_3;
    if (this.l2m_1) {
      var tmp1_elvis_lhs = findTrRuleForGrammarRuleNamedOrNull(this.m2m_1.ok(), nodeInfo.node.rule.tag);
      var tmp_4;
      if (tmp1_elvis_lhs == null) {
        var message_0 = 'Type not found for ' + nodeInfo.node.rule.tag;
        throw IllegalStateException.v4(toString(message_0));
      } else {
        tmp_4 = tmp1_elvis_lhs;
      }
      tmp_3 = tmp_4;
    } else {
      tmp_3 = this.q2m_1.ok().trRule.forChildren;
    }
    var parentTr = tmp_3;
    var p = nodeInfo.path;
    var tmp2_elvis_lhs = findTrRuleForGrammarRuleNamedOrNull(this.m2m_1.ok(), embRuleName);
    var tmp_5;
    if (tmp2_elvis_lhs == null) {
      var message_1 = 'Type not found for ' + embRuleName;
      throw IllegalStateException.v4(toString(message_1));
    } else {
      tmp_5 = tmp2_elvis_lhs;
    }
    var tu = tmp_5;
    var dd = resolveCompressed(this.n2m_1, p, tu, nodeInfo);
    this.q2m_1.nk(dd);
  }
  endEmbedded(nodeInfo) {
    var embSyntaxAnalyser = this.m2m_1.rk();
    var embeddedAsm = ensureNotNull(embSyntaxAnalyser.i2k_1);
    this.q2m_1.rk();
    var value = last(this.n2m_1.asmFactory.rootList(embeddedAsm));
    removeAsmRoot(this.n2m_1, value);
    if (value == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      this.n2m_1.setLocationFor(value, nodeInfo, this.p2m_1);
    }
    this.o2m_1.nk(new ChildData(nodeInfo, this.n2m_1.asmFactory.toTypedObject(value)));
  }
  skip(startPosition, nextInputPosition) {
  }
  treeError(msg, path) {
    this.n2m_1.issues.error(null, "Error 'msg' at '" + joinToString(path.invoke(), '/') + "'");
  }
}
class LocationMap {}
class LocationMapDefault {
  constructor() {
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.r2m_1 = LinkedHashMap.l4();
  }
  clear() {
    this.r2m_1.n2();
  }
  get(obj) {
    // Inline function 'kotlin.collections.get' call
    var this_0 = this.r2m_1;
    var ppm = (isInterface(this_0, KtMap) ? this_0 : THROW_CCE()).z2(obj);
    return null == ppm ? null : ppm.a1() ? null : firstOrNull_0(ppm.v2());
  }
  getByPath(obj, path) {
    // Inline function 'kotlin.collections.get' call
    var this_0 = this.r2m_1;
    var ppm = (isInterface(this_0, KtMap) ? this_0 : THROW_CCE()).z2(obj);
    return null == ppm ? null : ppm.a1() ? null : ppm.z2(path);
  }
  add(path, obj, location) {
    var ppm = this.r2m_1.z2(obj);
    if (null == ppm) {
      // Inline function 'kotlin.collections.mutableMapOf' call
      ppm = LinkedHashMap.l4();
      var tmp0 = this.r2m_1;
      // Inline function 'kotlin.collections.set' call
      var value = ppm;
      tmp0.r2(obj, value);
    }
    // Inline function 'kotlin.collections.set' call
    ppm.r2(path, location);
  }
}
class SyntaxAnalyserGeneratorKotlin {
  constructor() {
    this.s2m_1 = StringBuilder.j();
  }
  generateFor(grammar) {
    var indent = '    ';
    var lineSep = '\n';
    var tmp = grammar.grammarRule;
    var register = joinToString(tmp, lineSep, VOID, VOID, VOID, VOID, SyntaxAnalyserGeneratorKotlin$generateFor$lambda(this));
    var tmp_0 = grammar.grammarRule;
    var tmp_1 = lineSep + lineSep;
    var functions = joinToString(tmp_0, tmp_1, VOID, VOID, VOID, VOID, SyntaxAnalyserGeneratorKotlin$generateFor$lambda_0(this, indent));
    return trimIndent('\npackage ' + QualifiedName__toString_impl_z3wem2(grammar.namespace.qualifiedName) + '\n\nimport net.akehurst.language.sentence.api.Sentence\nimport net.akehurst.language.sppt.api.SpptDataNodeInfo\nimport net.akehurst.language.agl.syntaxAnalyser.SyntaxAnalyserByMethodRegistrationAbstract\n\nclass ' + SimpleName__toString_impl_vxsxyc(grammar.name) + 'SyntaxAnalyser : SyntaxAnalyserByMethodRegistrationAbstract<AsmType>() {\n\n    override fun registerHandlers() {\n' + register + '\n    }\n    \n' + functions + '\n}\n        ');
  }
}
class NodeTypes {
  constructor(forNode, forChildren) {
    return new.target.t2m(forNode, forChildren);
  }
  static t2m(forNode, forChildren) {
    var $this = createThis(this);
    $this.forNode = forNode;
    $this.forChildren = forChildren;
    return $this;
  }
  v2l() {
    return this.forNode;
  }
  w2l() {
    return this.forChildren;
  }
  static new_net_akehurst_language_agl_syntaxAnalyser_NodeTypes(t) {
    return this.t2m(t, t);
  }
  bh() {
    return this.forNode;
  }
  ch() {
    return this.forChildren;
  }
  u2m(forNode, forChildren) {
    return NodeTypes.t2m(forNode, forChildren);
  }
  copy(forNode, forChildren, $super) {
    forNode = forNode === VOID ? this.forNode : forNode;
    forChildren = forChildren === VOID ? this.forChildren : forChildren;
    return $super === VOID ? this.u2m(forNode, forChildren) : $super.u2m.call(this, forNode, forChildren);
  }
  toString() {
    return 'NodeTypes(forNode=' + toString(this.forNode) + ', forChildren=' + toString(this.forChildren) + ')';
  }
  hashCode() {
    var result = hashCode(this.forNode);
    result = imul(result, 31) + hashCode(this.forChildren) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof NodeTypes))
      return false;
    var tmp0_other_with_cast = other instanceof NodeTypes ? other : THROW_CCE();
    if (!equals(this.forNode, tmp0_other_with_cast.forNode))
      return false;
    if (!equals(this.forChildren, tmp0_other_with_cast.forChildren))
      return false;
    return true;
  }
}
class DownData {
  constructor(path, typeUse) {
    this.path = path;
    this.typeUse = typeUse;
  }
  n1m() {
    return this.path;
  }
  v2m() {
    return this.typeUse;
  }
  bh() {
    return this.path;
  }
  ch() {
    return this.typeUse;
  }
  w2m(path, typeUse) {
    return new DownData(path, typeUse);
  }
  copy(path, typeUse, $super) {
    path = path === VOID ? this.path : path;
    typeUse = typeUse === VOID ? this.typeUse : typeUse;
    return $super === VOID ? this.w2m(path, typeUse) : $super.w2m.call(this, path, typeUse);
  }
  toString() {
    return 'DownData(path=' + toString(this.path) + ', typeUse=' + this.typeUse.toString() + ')';
  }
  hashCode() {
    var result = hashCode(this.path);
    result = imul(result, 31) + this.typeUse.hashCode() | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof DownData))
      return false;
    var tmp0_other_with_cast = other instanceof DownData ? other : THROW_CCE();
    if (!equals(this.path, tmp0_other_with_cast.path))
      return false;
    if (!this.typeUse.equals(tmp0_other_with_cast.typeUse))
      return false;
    return true;
  }
}
class ChildDataAny {
  constructor(nodeInfo, value) {
    this.nodeInfo = nodeInfo;
    this.value = value;
  }
  a2m() {
    return this.nodeInfo;
  }
  b3() {
    return this.value;
  }
  bh() {
    return this.nodeInfo;
  }
  ch() {
    return this.value;
  }
  x2m(nodeInfo, value) {
    return new ChildDataAny(nodeInfo, value);
  }
  copy(nodeInfo, value, $super) {
    nodeInfo = nodeInfo === VOID ? this.nodeInfo : nodeInfo;
    value = value === VOID ? this.value : value;
    return $super === VOID ? this.x2m(nodeInfo, value) : $super.x2m.call(this, nodeInfo, value);
  }
  toString() {
    return 'ChildDataAny(nodeInfo=' + toString(this.nodeInfo) + ', value=' + toString_0(this.value) + ')';
  }
  hashCode() {
    var result = hashCode(this.nodeInfo);
    result = imul(result, 31) + (this.value == null ? 0 : hashCode(this.value)) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof ChildDataAny))
      return false;
    var tmp0_other_with_cast = other instanceof ChildDataAny ? other : THROW_CCE();
    if (!equals(this.nodeInfo, tmp0_other_with_cast.nodeInfo))
      return false;
    if (!equals(this.value, tmp0_other_with_cast.value))
      return false;
    return true;
  }
}
class Companion_4 {
  constructor() {
    this.y2m_1 = 'net.akehurst.language.agl.syntaxAnalyser';
    this.CONFIGURATION_KEY_AGL_SCOPE_MODEL = 'net.akehurst.language.agl.syntaxAnalyser.scope.model';
  }
  d2m() {
    return this.CONFIGURATION_KEY_AGL_SCOPE_MODEL;
  }
  e2m(_this__u8e3s4) {
    return _this__u8e3s4.owner.property.v() === 1;
  }
  f2m(_this__u8e3s4) {
    return _this__u8e3s4.rhsItems.v() === 1 && _this__u8e3s4.rhsItems.z(0).v() === 1;
  }
}
class SyntaxAnalyserSimpleStreamPushAbstract$walkTree$walker$1 {
  constructor($syntaxAnalyserStack, $sentence, $stack, $downStack, this$0) {
    this.c2n_1 = $syntaxAnalyserStack;
    this.d2n_1 = $sentence;
    this.e2n_1 = $stack;
    this.f2n_1 = $downStack;
    this.g2n_1 = this$0;
  }
  beginTree() {
    this.c2n_1.ok().startAsm();
  }
  endTree() {
    this.c2n_1.ok().finishAsm();
  }
  leaf(nodeInfo) {
    var tmp = StdLibDefault_getInstance().String.resolvedDeclaration;
    var type = isInterface(tmp, PrimitiveType) ? tmp : THROW_CCE();
    createPrimitiveValue(this.c2n_1.ok(), this.d2n_1, type, nodeInfo);
    this.e2n_1.nk(new ChildDataAny(nodeInfo, null));
  }
  beginBranch(nodeInfo) {
    var parentDownData = this.f2n_1.pk();
    var p = this.f2n_1.mk() ? Companion_getInstance_9().ROOT : null == parentDownData ? Companion_getInstance_9().ROOT.plus('<error>') : pathFor(this.c2n_1.ok(), parentDownData.path, parentDownData.typeUse.forChildren.resolvedDeclaration, nodeInfo);
    var tmp;
    if (this.f2n_1.mk()) {
      var tmp0_elvis_lhs = findTypeUsageForRule(this.c2n_1.ok(), nodeInfo.node.rule.tag);
      var tmp_0;
      if (tmp0_elvis_lhs == null) {
        var message = 'Type not found for ' + nodeInfo.node.rule.tag;
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp_0 = tmp0_elvis_lhs;
      }
      var typeUse = tmp_0;
      tmp = typeUse;
    } else {
      var tmp_1 = this.c2n_1.ok();
      var tmp2_safe_receiver = parentDownData == null ? null : parentDownData.typeUse;
      tmp = typeForNode(tmp_1, tmp2_safe_receiver == null ? null : tmp2_safe_receiver.forChildren, nodeInfo);
    }
    var tu = tmp;
    var tuc = resolveCompressed_0(this.g2n_1, tu, nodeInfo);
    var dd = equals(tuc.forNode.resolvedDeclaration, this.g2n_1.typeModel.NothingType) ? null : new DownData(p, tuc);
    this.f2n_1.nk(dd);
    var tmp3_subject = tuc.forNode.resolvedDeclaration;
    if (!isInterface(tmp3_subject, PrimitiveType)) {
      if (!isInterface(tmp3_subject, UnionType)) {
        if (isInterface(tmp3_subject, CollectionType)) {
          var tmp4_subject = tuc.forNode.resolvedDeclaration;
          if (equals(tmp4_subject, StdLibDefault_getInstance().List)) {
            this.g2n_1.startList();
          } else if (equals(tmp4_subject, StdLibDefault_getInstance().ListSeparated)) {
            this.g2n_1.startListSeparated();
          } else {
            // Inline function 'kotlin.error' call
            var message_0 = 'Should not happen';
            throw IllegalStateException.v4(toString(message_0));
          }
        } else {
          if (isInterface(tmp3_subject, TupleType)) {
            this.g2n_1.startTuple();
          } else {
            if (isInterface(tmp3_subject, DataType)) {
              var tmp_2 = tuc.forNode.resolvedDeclaration;
              this.g2n_1.startAsmElement(p, isInterface(tmp_2, DataType) ? tmp_2 : THROW_CCE());
            } else {
              var tmp5_subject = tuc.forNode.resolvedDeclaration;
              if (!equals(tmp5_subject, this.g2n_1.typeModel.NothingType))
                if (!equals(tmp5_subject, this.g2n_1.typeModel.AnyType)) {
                  // Inline function 'kotlin.error' call
                  var message_1 = 'Shold not happen';
                  throw IllegalStateException.v4(toString(message_1));
                }
            }
          }
        }
      }
    }
  }
  endBranch(nodeInfo) {
    var opt = nodeInfo.alt.option;
    var numChildren = ensureNotNull(nodeInfo.numChildrenAlternatives.z2(new OptionNum(opt)));
    var children = this.e2n_1.sk(numChildren);
    var adjChildren = reversed(children);
    var downData = this.f2n_1.rk();
    var tmp;
    if (null == downData) {
      tmp = null;
    } else {
      createValueFromBranch_0(this.c2n_1.ok(), this.d2n_1, downData, nodeInfo, adjChildren);
      tmp = Unit_instance;
    }
    var value = tmp;
    if (value == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      this.g2n_1.setLocationFor(Unit_instance, nodeInfo, this.d2n_1);
    }
    this.e2n_1.nk(new ChildDataAny(nodeInfo, value));
  }
  beginEmbedded(nodeInfo) {
    var tmp = nodeInfo.node.rule;
    var tmp_0 = (tmp instanceof RuntimeRule ? tmp : THROW_CCE()).rhs;
    var embeddedRhs = tmp_0 instanceof RuntimeRuleRhsEmbedded ? tmp_0 : THROW_CCE();
    var embRuleName = embeddedRhs.embeddedStartRule.tag;
    var embGrmName = embeddedRhs.embeddedRuntimeRuleSet.qualifiedName;
    var tmp_1 = this.g2n_1.embeddedSyntaxAnalyser.z2(new QualifiedName(_QualifiedName___init__impl__8ed982(embGrmName)));
    var tmp0_elvis_lhs = (tmp_1 == null ? true : tmp_1 instanceof SyntaxAnalyserSimpleStreamPushAbstract) ? tmp_1 : THROW_CCE();
    var tmp_2;
    if (tmp0_elvis_lhs == null) {
      var message = "Embedded SyntaxAnalyser not found for '" + embGrmName + "' in SyntaxAnalyser for '" + QualifiedName__toString_impl_z3wem2(this.g2n_1.grammarNamespaceQualifiedName) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_2 = tmp0_elvis_lhs;
    }
    var embSyntaxAnalyser = tmp_2;
    this.c2n_1.nk(embSyntaxAnalyser instanceof SyntaxAnalyserSimpleStreamPushAbstract ? embSyntaxAnalyser : THROW_CCE());
    var parentDownData = ensureNotNull(this.f2n_1.ok());
    var p = pathFor(this.c2n_1.ok(), parentDownData.path, parentDownData.typeUse.forChildren.resolvedDeclaration, nodeInfo);
    var tmp1_elvis_lhs = findTypeUsageForRule(this.c2n_1.ok(), embRuleName);
    var tmp_3;
    if (tmp1_elvis_lhs == null) {
      var message_0 = 'Type not found for ' + embRuleName;
      throw IllegalStateException.v4(toString(message_0));
    } else {
      tmp_3 = tmp1_elvis_lhs;
    }
    var tu = tmp_3;
    var tuc = resolveCompressed_0(this.g2n_1, tu, nodeInfo);
    var dd = equals(tuc.forNode.resolvedDeclaration, this.g2n_1.typeModel.NothingType) ? null : new DownData(p, tuc);
    this.f2n_1.nk(dd);
  }
  endEmbedded(nodeInfo) {
    var embSyntaxAnalyser = this.c2n_1.rk();
    this.e2n_1.nk(new ChildDataAny(nodeInfo, null));
  }
  skip(startPosition, nextInputPosition) {
  }
  treeError(msg, path) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
}
class SyntaxAnalyserSimpleStreamPushAbstract extends SyntaxAnalyserFromTreeDataAbstract {
  constructor(grammarNamespaceQualifiedName, typeModel, scopeModel) {
    super();
    this.grammarNamespaceQualifiedName = grammarNamespaceQualifiedName;
    this.typeModel = typeModel;
    this.scopeModel = scopeModel;
  }
  h2n() {
    return this.grammarNamespaceQualifiedName;
  }
  m2e() {
    return this.typeModel;
  }
  i2n() {
    return this.scopeModel;
  }
  walkTree(sentence, treeData, skipDataAsTree) {
    var syntaxAnalyserStack = mutableStackOf([this]);
    var downStack = mutableStackOf([]);
    var stack = mutableStackOf([]);
    var walker = new SyntaxAnalyserSimpleStreamPushAbstract$walkTree$walker$1(syntaxAnalyserStack, sentence, stack, downStack, this);
    treeData.traverseTreeDepthFirst(walker, false);
  }
}
class AsmWalker {}
class CompletionItemKind extends Enum {
  get name() {
    return this.e3();
  }
  get ordinal() {
    return this.f3();
  }
}
class CompletionItem {
  constructor(kind, label, text) {
    this.kind = kind;
    this.label = label;
    this.text = text;
    this.id = 0;
    this.description = '';
  }
  yo() {
    return this.kind;
  }
  l2n() {
    return this.label;
  }
  w1e() {
    return this.text;
  }
  m2n(_set____db54di) {
    this.id = _set____db54di;
  }
  n2n() {
    return this.id;
  }
  o2n(_set____db54di) {
    this.description = _set____db54di;
  }
  p2n() {
    return this.description;
  }
  bh() {
    return this.kind;
  }
  ch() {
    return this.label;
  }
  ds() {
    return this.text;
  }
  q2n(kind, label, text) {
    return new CompletionItem(kind, label, text);
  }
  copy(kind, label, text, $super) {
    kind = kind === VOID ? this.kind : kind;
    label = label === VOID ? this.label : label;
    text = text === VOID ? this.text : text;
    return $super === VOID ? this.q2n(kind, label, text) : $super.q2n.call(this, kind, label, text);
  }
  toString() {
    return 'CompletionItem(kind=' + this.kind.toString() + ', label=' + this.label + ', text=' + this.text + ')';
  }
  hashCode() {
    var result = this.kind.hashCode();
    result = imul(result, 31) + getStringHashCode(this.label) | 0;
    result = imul(result, 31) + getStringHashCode(this.text) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof CompletionItem))
      return false;
    var tmp0_other_with_cast = other instanceof CompletionItem ? other : THROW_CCE();
    if (!this.kind.equals(tmp0_other_with_cast.kind))
      return false;
    if (!(this.label === tmp0_other_with_cast.label))
      return false;
    if (!(this.text === tmp0_other_with_cast.text))
      return false;
    return true;
  }
}
class PublicValueType {}
class LanguageIdentity {
  constructor(value) {
    this.r2n_1 = value;
  }
  b3() {
    return _LanguageIdentity___get_value__impl__kqfjz3(this.r2n_1);
  }
  toString() {
    return LanguageIdentity__toString_impl_sekfl7(this.r2n_1);
  }
  hashCode() {
    return LanguageIdentity__hashCode_impl_6neisc(this.r2n_1);
  }
  equals(other) {
    return LanguageIdentity__equals_impl_65o6bc(this.r2n_1, other);
  }
  get value() {
    return this.b3();
  }
}
class GrammarString {
  constructor(value) {
    this.u1v_1 = value;
  }
  b3() {
    return _GrammarString___get_value__impl__5bomff(this.u1v_1);
  }
  toString() {
    return GrammarString__toString_impl_8b7lo7(this.u1v_1);
  }
  hashCode() {
    return GrammarString__hashCode_impl_u2dih2(this.u1v_1);
  }
  equals(other) {
    return GrammarString__equals_impl_ykqk2e(this.u1v_1, other);
  }
  get value() {
    return this.b3();
  }
}
class TypesString {
  constructor(value) {
    this.e1s_1 = value;
  }
  b3() {
    return _TypesString___get_value__impl__8slfz1(this.e1s_1);
  }
  toString() {
    return TypesString__toString_impl_m29nnb(this.e1s_1);
  }
  hashCode() {
    return TypesString__hashCode_impl_b3qug(this.e1s_1);
  }
  equals(other) {
    return TypesString__equals_impl_x7bh1g(this.e1s_1, other);
  }
  get value() {
    return this.b3();
  }
}
class TransformString {
  constructor(value) {
    this.f1s_1 = value;
  }
  b3() {
    return _TransformString___get_value__impl__kxu2ls(this.f1s_1);
  }
  toString() {
    return TransformString__toString_impl_aulel8(this.f1s_1);
  }
  hashCode() {
    return TransformString__hashCode_impl_wlrbe3(this.f1s_1);
  }
  equals(other) {
    return TransformString__equals_impl_ejjinl(this.f1s_1, other);
  }
  get value() {
    return this.b3();
  }
}
class CrossReferenceString {
  constructor(value) {
    this.g1s_1 = value;
  }
  b3() {
    return _CrossReferenceString___get_value__impl__vi2q2h(this.g1s_1);
  }
  toString() {
    return CrossReferenceString__toString_impl_p6g1h7(this.g1s_1);
  }
  hashCode() {
    return CrossReferenceString__hashCode_impl_o3i3p2(this.g1s_1);
  }
  equals(other) {
    return CrossReferenceString__equals_impl_x2ltda(this.g1s_1, other);
  }
  get value() {
    return this.b3();
  }
}
class StyleString {
  constructor(value) {
    this.h1s_1 = value;
  }
  b3() {
    return _StyleString___get_value__impl__2hufp(this.h1s_1);
  }
  toString() {
    return StyleString__toString_impl_hzhk8v(this.h1s_1);
  }
  hashCode() {
    return StyleString__hashCode_impl_3rock0(this.h1s_1);
  }
  equals(other) {
    return StyleString__equals_impl_v9zdu4(this.h1s_1, other);
  }
  get value() {
    return this.b3();
  }
}
class FormatString {
  constructor(value) {
    this.i1s_1 = value;
  }
  b3() {
    return _FormatString___get_value__impl__b4w1sj(this.i1s_1);
  }
  toString() {
    return FormatString__toString_impl_1nt62v(this.i1s_1);
  }
  hashCode() {
    return FormatString__hashCode_impl_nez2vq(this.i1s_1);
  }
  equals(other) {
    return FormatString__equals_impl_kwq0li(this.i1s_1, other);
  }
  get value() {
    return this.b3();
  }
}
class LanguageProcessorException extends Exception {
  static m1s(message, cause) {
    var $this = this.xb(message, cause);
    captureStack($this, $this.l1s_1);
    return $this;
  }
}
class ParserKind extends Enum {
  get name() {
    return this.e3();
  }
  get ordinal() {
    return this.f3();
  }
}
class LanguageObject {}
class Companion_5 {
  constructor() {
    Companion_instance_6 = this;
    this.GOAL_RULE = -1;
    this.OP_NONE = Companion_getInstance_0().OPTION_NONE;
    this.SR = 0;
    this.ER = -1;
    this.WIDTH = ParseAction_WIDTH_getInstance();
    this.HEIGHT = ParseAction_HEIGHT_getInstance();
    this.GRAFT = ParseAction_GRAFT_getInstance();
    this.GOAL = ParseAction_GOAL_getInstance();
  }
  e2o() {
    return this.GOAL_RULE;
  }
  f2o() {
    return this.OP_NONE;
  }
  g2o() {
    return this.SR;
  }
  h2o() {
    return this.ER;
  }
  i2o() {
    return this.WIDTH;
  }
  j2o() {
    return this.HEIGHT;
  }
  k2o() {
    return this.GRAFT;
  }
  l2o() {
    return this.GOAL;
  }
}
class LanguageObjectAbstract {
  constructor() {
    Companion_getInstance_8();
    var tmp = this;
    tmp.m2o_1 = lazy(LanguageObjectAbstract$grammarString$delegate$lambda(this));
    var tmp_0 = this;
    tmp_0.n2o_1 = lazy(LanguageObjectAbstract$typesString$delegate$lambda(this));
    var tmp_1 = this;
    tmp_1.o2o_1 = lazy(LanguageObjectAbstract$kompositeString$delegate$lambda(this));
    var tmp_2 = this;
    tmp_2.p2o_1 = lazy(LanguageObjectAbstract$asmTransformString$delegate$lambda(this));
    var tmp_3 = this;
    tmp_3.q2o_1 = lazy(LanguageObjectAbstract$crossReferenceString$delegate$lambda(this));
    var tmp_4 = this;
    tmp_4.r2o_1 = lazy(LanguageObjectAbstract$styleString$delegate$lambda(this));
    var tmp_5 = this;
    tmp_5.s2o_1 = lazy(LanguageObjectAbstract$formatString$delegate$lambda(this));
  }
  b2o() {
    return this.typesModel;
  }
  u2n() {
    var tmp0 = this.m2o_1;
    // Inline function 'kotlin.getValue' call
    grammarString$factory();
    return tmp0.b3();
  }
  v2n() {
    var tmp0 = this.n2o_1;
    // Inline function 'kotlin.getValue' call
    typesString$factory();
    return tmp0.b3();
  }
  w2n() {
    var tmp0 = this.o2o_1;
    // Inline function 'kotlin.getValue' call
    kompositeString$factory();
    return tmp0.b3();
  }
  x2n() {
    var tmp0 = this.p2o_1;
    // Inline function 'kotlin.getValue' call
    asmTransformString$factory();
    return tmp0.b3();
  }
  y2n() {
    var tmp0 = this.q2o_1;
    // Inline function 'kotlin.getValue' call
    crossReferenceString$factory();
    return tmp0.b3();
  }
  z2n() {
    var tmp0 = this.r2o_1;
    // Inline function 'kotlin.getValue' call
    styleString$factory();
    return tmp0.b3();
  }
  a2o() {
    var tmp0 = this.s2o_1;
    // Inline function 'kotlin.getValue' call
    formatString$factory();
    return tmp0.b3();
  }
  f18() {
    throw NotImplementedError.uj();
  }
  j1y() {
    throw NotImplementedError.uj();
  }
  t2o() {
    throw NotImplementedError.uj();
  }
  s1u() {
    throw NotImplementedError.uj();
  }
  t1u() {
    throw NotImplementedError.uj();
  }
  get kompositeModel() {
    return this.b2o();
  }
  get grammarString() {
    return this.u2n();
  }
  get typesString() {
    return this.v2n();
  }
  get kompositeString() {
    return this.w2n();
  }
  get asmTransformString() {
    return this.x2n();
  }
  get crossReferenceString() {
    return this.y2n();
  }
  get styleString() {
    return this.z2n();
  }
  get formatString() {
    return this.a2o();
  }
  get ruleSet() {
    return this.f18();
  }
  get mapToGrammar() {
    return this.j1y();
  }
  get automata() {
    return this.t2o();
  }
  get syntaxAnalyser() {
    return this.s1u();
  }
  get semanticAnalyser() {
    return this.t1u();
  }
  get identity() {
    return this.g1u();
  }
  get grammarModel() {
    return this.i1u();
  }
  get typesModel() {
    return this.p1u();
  }
  get asmTransformModel() {
    return this.j2k();
  }
  get crossReferenceModel() {
    return this.r1u();
  }
  get styleModel() {
    return this.w1u();
  }
  get formatModel() {
    return this.i1t();
  }
  get defaultTargetGrammar() {
    return this.c2o();
  }
  get defaultTargetGoalRule() {
    return this.d2o();
  }
  get completionProvider() {
    return this.p1y();
  }
}
class ResolvedReference {
  constructor(source, sourceLocation, target, targetLocation) {
    this.source = source;
    this.sourceLocation = sourceLocation;
    this.target = target;
    this.targetLocation = targetLocation;
  }
  xr() {
    return this.source;
  }
  u2o() {
    return this.sourceLocation;
  }
  yr() {
    return this.target;
  }
  v2o() {
    return this.targetLocation;
  }
  bh() {
    return this.source;
  }
  ch() {
    return this.sourceLocation;
  }
  ds() {
    return this.target;
  }
  es() {
    return this.targetLocation;
  }
  w2o(source, sourceLocation, target, targetLocation) {
    return new ResolvedReference(source, sourceLocation, target, targetLocation);
  }
  copy(source, sourceLocation, target, targetLocation, $super) {
    source = source === VOID ? this.source : source;
    sourceLocation = sourceLocation === VOID ? this.sourceLocation : sourceLocation;
    target = target === VOID ? this.target : target;
    targetLocation = targetLocation === VOID ? this.targetLocation : targetLocation;
    return $super === VOID ? this.w2o(source, sourceLocation, target, targetLocation) : $super.w2o.call(this, source, sourceLocation, target, targetLocation);
  }
  toString() {
    return 'ResolvedReference(source=' + toString_0(this.source) + ', sourceLocation=' + toString_0(this.sourceLocation) + ', target=' + toString_0(this.target) + ', targetLocation=' + toString_0(this.targetLocation) + ')';
  }
  hashCode() {
    var result = this.source == null ? 0 : hashCode(this.source);
    result = imul(result, 31) + (this.sourceLocation == null ? 0 : this.sourceLocation.hashCode()) | 0;
    result = imul(result, 31) + (this.target == null ? 0 : hashCode(this.target)) | 0;
    result = imul(result, 31) + (this.targetLocation == null ? 0 : this.targetLocation.hashCode()) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof ResolvedReference))
      return false;
    var tmp0_other_with_cast = other instanceof ResolvedReference ? other : THROW_CCE();
    if (!equals(this.source, tmp0_other_with_cast.source))
      return false;
    if (!equals(this.sourceLocation, tmp0_other_with_cast.sourceLocation))
      return false;
    if (!equals(this.target, tmp0_other_with_cast.target))
      return false;
    if (!equals(this.targetLocation, tmp0_other_with_cast.targetLocation))
      return false;
    return true;
  }
}
class AsmPath {}
class Asm {}
function asString_0(currentIndent, indentIncrement, $super) {
  currentIndent = currentIndent === VOID ? '' : currentIndent;
  indentIncrement = indentIncrement === VOID ? '  ' : indentIncrement;
  return $super === VOID ? this.y2o(currentIndent, indentIncrement) : $super.y2o.call(this, currentIndent, indentIncrement);
}
class AsmValue {}
function asString_1(currentIndent, indentIncrement, $super) {
  currentIndent = currentIndent === VOID ? '' : currentIndent;
  indentIncrement = indentIncrement === VOID ? '  ' : indentIncrement;
  return $super === VOID ? this.y2o(currentIndent, indentIncrement) : $super.y2o.call(this, currentIndent, indentIncrement);
}
class AsmNothing {}
class AsmAny {}
class AsmPrimitive {}
class AsmReference {}
class AsmStructure {}
class AsmStructureProperty {}
class AsmList {}
class AsmListSeparated {}
class AsmLambda {}
class PropertyValueName {
  constructor(value) {
    this.i2p_1 = value;
  }
  b3() {
    return _PropertyValueName___get_value__impl__k5tzza(this.i2p_1);
  }
  toString() {
    return PropertyValueName__toString_impl_bg83d2(this.i2p_1);
  }
  hashCode() {
    return PropertyValueName__hashCode_impl_x7e05x(this.i2p_1);
  }
  equals(other) {
    return PropertyValueName__equals_impl_h3c8qh(this.i2p_1, other);
  }
  get value() {
    return this.b3();
  }
}
class AglAsm_0 {
  constructor() {
    AglAsm_instance = this;
    this.komposite = 'namespace net.akehurst.language.asm.api\ninterface Asm {\n  cmp root\n}\ninterface AsmStructure {\n  cmp semanticPath\n  cmp property\n}\ninterface AsmStructureProperty {\n  cmp value\n}\ninterface AsmList {\n  cmp elements\n}\ninterface AsmListSeparated {\n  cmp elements\n}\n';
    var tmp = this;
    tmp.j2p_1 = lazy(AglAsm$typeModel$delegate$lambda);
  }
  k2p() {
    return this.komposite;
  }
  m2e() {
    var tmp0 = this.j2p_1;
    // Inline function 'kotlin.getValue' call
    typeModel$factory();
    return tmp0.b3();
  }
  get typeModel() {
    return this.m2e();
  }
}
class Companion_6 {
  constructor() {
    Companion_instance_7 = this;
    this.SEPARATOR = '/';
    this.ROOT = new AsmPathSimple('/');
  }
  l2p() {
    return this.SEPARATOR;
  }
  m2p() {
    return this.ROOT;
  }
}
class AsmPathSimple {
  constructor(value) {
    Companion_getInstance_9();
    this.n2p_1 = value;
  }
  b3() {
    return this.n2p_1;
  }
  l1m() {
    return split(this.n2p_1, ['/']);
  }
  ox() {
    return Companion_getInstance_9().ROOT.equals(this) ? null : new AsmPathSimple(substringBeforeLast(this.n2p_1, '/'));
  }
  plus(segment) {
    return this.equals(Companion_getInstance_9().ROOT) ? new AsmPathSimple('/' + segment) : new AsmPathSimple(this.n2p_1 + '/' + segment);
  }
  hashCode() {
    return getStringHashCode(this.n2p_1);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, AsmPath) : false)) {
      tmp = false;
    } else {
      if (!(this.n2p_1 === other.value)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    return this.n2p_1;
  }
  get value() {
    return this.b3();
  }
  get segments() {
    return this.l1m();
  }
  get parent() {
    return this.ox();
  }
}
class AsmSimple {
  constructor() {
    this.o2p_1 = 0;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.p2p_1 = ArrayList.y();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_0.q2p_1 = LinkedHashMap.l4();
  }
  w1m() {
    return this.p2p_1;
  }
  x2o() {
    return this.q2p_1;
  }
  addRoot(root) {
    var tmp = this.root;
    return (isInterface(tmp, KtMutableList) ? tmp : THROW_CCE()).r(root);
  }
  removeRoot(root) {
    var tmp = this.root;
    // Inline function 'kotlin.collections.remove' call
    var this_0 = isInterface(tmp, KtMutableList) ? tmp : THROW_CCE();
    return (isInterface(this_0, MutableCollection) ? this_0 : THROW_CCE()).k2(root);
  }
  createStructure(parsePath, typeName) {
    var el = new AsmStructureSimple(typeName);
    el.i2m_1 = parsePath;
    return el;
  }
  addToIndex(value) {
    var tmp0 = this.elementIndex;
    // Inline function 'kotlin.collections.set' call
    var key = new AsmPathSimple(toString(value.parsePath));
    tmp0.r2(key, value);
  }
  traverseDepthFirst(callback) {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.root.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      callback.beforeRoot(element);
      traverseDepthFirst$traverse(callback, null, element);
      callback.afterRoot(element);
    }
  }
  y2o(currentIndent, indentIncrement) {
    var tmp = this.root;
    return joinToString(tmp, '\n', VOID, VOID, VOID, VOID, AsmSimple$asString$lambda(indentIncrement, currentIndent));
  }
  get root() {
    return this.w1m();
  }
  get elementIndex() {
    return this.x2o();
  }
}
class AsmValueAbstract {
  a2p() {
    return _QualifiedName___get_last__impl__838y8h(this.qualifiedTypeName);
  }
  get typeName() {
    return this.a2p();
  }
  get qualifiedTypeName() {
    return this.z2o();
  }
}
class AsmNothingSimple_0 extends AsmValueAbstract {
  constructor() {
    AsmNothingSimple_instance = null;
    super();
    AsmNothingSimple_instance = this;
  }
  z2o() {
    return StdLibDefault_getInstance().NothingType.qualifiedTypeName;
  }
  y2o(currentIndent, indentIncrement) {
    return 'Nothing';
  }
  equalTo(other) {
    var tmp;
    if (!isInterface(other, AsmNothing)) {
      tmp = false;
    } else {
      tmp = true;
    }
    return tmp;
  }
  hashCode() {
    return 0;
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, AsmNothing) : false)) {
      tmp = false;
    } else {
      tmp = true;
    }
    return tmp;
  }
  toString() {
    return 'Nothing';
  }
}
class Companion_7 {
  stdAny(value) {
    return new AsmAnySimple(value);
  }
}
class AsmAnySimple extends AsmValueAbstract {
  constructor(value) {
    super();
    this.r2p_1 = value;
  }
  b3() {
    return this.r2p_1;
  }
  z2o() {
    return StdLibDefault_getInstance().AnyType.qualifiedTypeName;
  }
  y2o(currentIndent, indentIncrement) {
    return 'AsmAny(' + toString(this.r2p_1) + ')';
  }
  equalTo(other) {
    var tmp;
    if (!isInterface(other, AsmAny)) {
      tmp = false;
    } else {
      if (!equals(other.value, this.r2p_1)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  hashCode() {
    return hashCode(listOf_0([new QualifiedName(this.qualifiedTypeName), this.r2p_1]));
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, AsmAny) : false)) {
      tmp = false;
    } else {
      if (!equals(this.r2p_1, other.value)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    return QualifiedName__toString_impl_z3wem2(this.qualifiedTypeName) + '(' + toString(this.r2p_1) + ')';
  }
  get value() {
    return this.b3();
  }
}
class Companion_8 {
  stdString(value) {
    return new AsmPrimitiveSimple(StdLibDefault_getInstance().String.qualifiedTypeName, value);
  }
  stdBoolean(value) {
    return new AsmPrimitiveSimple(StdLibDefault_getInstance().Boolean.qualifiedTypeName, value);
  }
  stdInteger(value) {
    return new AsmPrimitiveSimple(StdLibDefault_getInstance().Integer.qualifiedTypeName, value);
  }
  stdReal(value) {
    return new AsmPrimitiveSimple(StdLibDefault_getInstance().Real.qualifiedTypeName, value);
  }
}
class AsmPrimitiveSimple extends AsmValueAbstract {
  constructor(qualifiedTypeName, value) {
    super();
    this.s2p_1 = qualifiedTypeName;
    this.t2p_1 = value;
  }
  z2o() {
    return this.s2p_1;
  }
  b3() {
    return this.t2p_1;
  }
  y2o(currentIndent, indentIncrement) {
    return toString(this.t2p_1);
  }
  equalTo(other) {
    var tmp;
    if (!isInterface(other, AsmPrimitive)) {
      tmp = false;
    } else {
      if (!equals(other.value, this.t2p_1)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  hashCode() {
    return hashCode(listOf_0([new QualifiedName(this.s2p_1), this.t2p_1]));
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, AsmPrimitive) : false)) {
      tmp = false;
    } else {
      if (!(this.s2p_1 === other.qualifiedTypeName)) {
        tmp = false;
      } else {
        if (!equals(this.t2p_1, other.value)) {
          tmp = false;
        } else {
          tmp = true;
        }
      }
    }
    return tmp;
  }
  toString() {
    return QualifiedName__toString_impl_z3wem2(this.s2p_1) + '(' + toString(this.t2p_1) + ')';
  }
  get value() {
    return this.b3();
  }
}
class AsmReferenceSimple extends AsmValueAbstract {
  constructor(reference, value) {
    super();
    this.u2p_1 = reference;
    this.v2p_1 = value;
  }
  b2p() {
    return this.u2p_1;
  }
  w2p(_set____db54di) {
    this.v2p_1 = _set____db54di;
  }
  b3() {
    return this.v2p_1;
  }
  z2o() {
    return this.v2p_1 == null ? StdLibDefault_getInstance().NothingType.qualifiedTypeName : ensureNotNull(this.v2p_1).qualifiedTypeName;
  }
  resolveAs(value) {
    this.v2p_1 = value;
  }
  y2o(currentIndent, indentIncrement) {
    return this.v2p_1 == null ? '<unresolved> &' + this.u2p_1 : "&{'" + toString(ensureNotNull(this.v2p_1).parsePath) + "' : " + SimpleName__toString_impl_vxsxyc(ensureNotNull(this.v2p_1).typeName) + '}';
  }
  equalTo(other) {
    var tmp;
    if (!isInterface(other, AsmReference)) {
      tmp = false;
    } else {
      if (!(other.reference === this.u2p_1)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  hashCode() {
    return getStringHashCode(this.u2p_1);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, AsmReference) : false)) {
      tmp = false;
    } else {
      if (!(other.reference === this.u2p_1)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    var tmp;
    if (this.v2p_1 == null) {
      tmp = '<unresolved> &' + this.u2p_1;
    } else {
      var tmp1_safe_receiver = ensureNotNull(this.v2p_1).semanticPath;
      var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.value;
      tmp = "&{'" + (tmp2_elvis_lhs == null ? toString(ensureNotNull(this.v2p_1).parsePath) : tmp2_elvis_lhs) + "' : " + SimpleName__toString_impl_vxsxyc(ensureNotNull(this.v2p_1).typeName) + '}';
    }
    return tmp;
  }
  get reference() {
    return this.b2p();
  }
  get value() {
    return this.b3();
  }
  set value(value) {
    this.w2p(value);
  }
}
class sam$kotlin_Comparator$0_0 {
  constructor(function_0) {
    this.x2p_1 = function_0;
  }
  wh(a, b) {
    return this.x2p_1(a, b);
  }
  compare(a, b) {
    return this.wh(a, b);
  }
  w3() {
    return this.x2p_1;
  }
  equals(other) {
    var tmp;
    if (!(other == null) ? isInterface(other, Comparator) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.w3(), other.w3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.w3());
  }
}
class AsmStructureSimple extends AsmValueAbstract {
  constructor(qualifiedTypeName) {
    super();
    this.g2m_1 = qualifiedTypeName;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.h2m_1 = LinkedHashMap.l4();
    this.i2m_1 = '??';
    this.j2m_1 = null;
    this.k2m_1 = this.h2m_1;
  }
  z2o() {
    return this.g2m_1;
  }
  y2p(_set____db54di) {
    this.i2m_1 = _set____db54di;
  }
  c2p() {
    return this.i2m_1;
  }
  d2p(_set____db54di) {
    this.j2m_1 = _set____db54di;
  }
  e2p() {
    return this.j2m_1;
  }
  z2h() {
    return this.k2m_1;
  }
  f2p() {
    var tmp = this.k2m_1.v2();
    var tmp_0 = AsmStructureSimple$_get_propertyOrdered_$lambda_a95tmc;
    return sortedWith(tmp, new sam$kotlin_Comparator$0_0(tmp_0));
  }
  s13() {
    // Inline function 'kotlin.collections.filterNot' call
    var tmp0 = this.k2m_1.v2();
    // Inline function 'kotlin.collections.filterNotTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!element.isReference) {
        destination.r(element);
      }
    }
    // Inline function 'kotlin.collections.flatMap' call
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination_0 = ArrayList.y();
    var _iterator__ex2g4s_0 = destination.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      var tmp;
      var tmp_0 = element_0.value;
      if (isInterface(tmp_0, KtList)) {
        var tmp_1 = element_0.value;
        tmp = isInterface(tmp_1, KtList) ? tmp_1 : THROW_CCE();
      } else {
        tmp = listOf(element_0.value);
      }
      var list = tmp;
      addAll(destination_0, list);
    }
    // Inline function 'kotlin.collections.filterIsInstance' call
    // Inline function 'kotlin.collections.filterIsInstanceTo' call
    var destination_1 = ArrayList.y();
    var _iterator__ex2g4s_1 = destination_0.s();
    while (_iterator__ex2g4s_1.t()) {
      var element_1 = _iterator__ex2g4s_1.u();
      if (element_1 instanceof AsmStructureSimple) {
        destination_1.r(element_1);
      }
    }
    return destination_1;
  }
  hasProperty(name) {
    return this.k2m_1.x2(new PropertyValueName(name));
  }
  getPropertyAsStringOrNull(name) {
    var tmp0_safe_receiver = this.k2m_1.z2(new PropertyValueName(name));
    var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.value;
    return (tmp == null ? true : typeof tmp === 'string') ? tmp : THROW_CCE();
  }
  getPropertyAsAsmElementOrNull(name) {
    var tmp0_safe_receiver = this.k2m_1.z2(new PropertyValueName(name));
    var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.value;
    return (tmp == null ? true : tmp instanceof AsmStructureSimple) ? tmp : THROW_CCE();
  }
  getPropertyAsReferenceOrNull(name) {
    var tmp0_safe_receiver = this.k2m_1.z2(new PropertyValueName(name));
    var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.value;
    return (tmp == null ? true : tmp instanceof AsmReferenceSimple) ? tmp : THROW_CCE();
  }
  getPropertyAsListOrNull(name) {
    var tmp0_safe_receiver = this.k2m_1.z2(new PropertyValueName(name));
    var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.value;
    return (tmp == null ? true : isInterface(tmp, KtList)) ? tmp : THROW_CCE();
  }
  getPropertyOrNothing(name) {
    var tmp0_safe_receiver = this.k2m_1.z2(new PropertyValueName(name));
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.value;
    return tmp1_elvis_lhs == null ? AsmNothingSimple_getInstance() : tmp1_elvis_lhs;
  }
  getProperty(name) {
    var tmp0_safe_receiver = this.k2m_1.z2(new PropertyValueName(name));
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.value;
    var tmp;
    if (tmp1_elvis_lhs == null) {
      var message = "Cannot find property '" + PropertyValueName__toString_impl_bg83d2(name) + "' in element type '" + SimpleName__toString_impl_vxsxyc(this.typeName) + "' with path '" + this.i2m_1 + "' ";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp1_elvis_lhs;
    }
    return tmp;
  }
  getPropertyAsString(name) {
    var tmp = this.getProperty(name);
    var tmp_0 = (isInterface(tmp, AsmPrimitive) ? tmp : THROW_CCE()).value;
    return typeof tmp_0 === 'string' ? tmp_0 : THROW_CCE();
  }
  getPropertyAsAsmElement(name) {
    var tmp = this.getProperty(name);
    return tmp instanceof AsmStructureSimple ? tmp : THROW_CCE();
  }
  getPropertyAsReference(name) {
    var tmp = this.getProperty(name);
    return tmp instanceof AsmReferenceSimple ? tmp : THROW_CCE();
  }
  getPropertyAsList(name) {
    var tmp = this.getProperty(name);
    return isInterface(tmp, KtList) ? tmp : THROW_CCE();
  }
  getPropertyAsListOfElement(name) {
    var tmp = this.getProperty(name);
    return isInterface(tmp, KtList) ? tmp : THROW_CCE();
  }
  setProperty(name, value, childIndex) {
    var tmp0 = this.h2m_1;
    var tmp1 = new PropertyValueName(name);
    // Inline function 'kotlin.collections.set' call
    var value_0 = new AsmStructurePropertySimple(name, childIndex, value);
    tmp0.r2(tmp1, value_0);
  }
  addAllProperty(value) {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = value.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0 = this.h2m_1;
      // Inline function 'kotlin.collections.set' call
      var key = new PropertyValueName(element.z2p_1);
      tmp0.r2(key, element);
    }
  }
  y2o(currentIndent, indentIncrement) {
    var newIndent = currentIndent + indentIncrement;
    var tmp = this.k2m_1.v2();
    var tmp_0 = '\n' + newIndent;
    var tmp_1 = '{\n' + newIndent;
    var tmp_2 = '\n' + currentIndent + '}';
    var propsStr = joinToString(tmp, tmp_0, tmp_1, tmp_2, VOID, VOID, AsmStructureSimple$asString$lambda(indentIncrement, newIndent));
    return ':' + SimpleName__toString_impl_vxsxyc(this.typeName) + ' ' + propsStr;
  }
  equalTo(other) {
    var tmp;
    if (!isInterface(other, AsmStructure)) {
      tmp = false;
    } else {
      if (!(this.g2m_1 === other.qualifiedTypeName)) {
        tmp = false;
      } else {
        if (!(this.i2m_1 === other.parsePath)) {
          tmp = false;
        } else {
          if (!(this.k2m_1.v() === other.property.v())) {
            tmp = false;
          } else {
            var tmp0 = this.k2m_1;
            var tmp$ret$0;
            $l$block_0: {
              // Inline function 'kotlin.collections.all' call
              if (tmp0.a1()) {
                tmp$ret$0 = true;
                break $l$block_0;
              }
              // Inline function 'kotlin.collections.iterator' call
              var _iterator__ex2g4s = tmp0.w2().s();
              while (_iterator__ex2g4s.t()) {
                var element = _iterator__ex2g4s.u();
                // Inline function 'kotlin.collections.component1' call
                var k = element.a3().i2p_1;
                // Inline function 'kotlin.collections.component2' call
                var v = element.b3();
                var o = other.property.z2(new PropertyValueName(k));
                var tmp_0;
                if (null == o) {
                  tmp_0 = false;
                } else {
                  tmp_0 = v.equalTo(o);
                }
                if (!tmp_0) {
                  tmp$ret$0 = false;
                  break $l$block_0;
                }
              }
              tmp$ret$0 = true;
            }
            tmp = tmp$ret$0;
          }
        }
      }
    }
    return tmp;
  }
  hashCode() {
    return getStringHashCode(this.i2m_1);
  }
  equals(other) {
    var tmp;
    if (other instanceof AsmStructureSimple) {
      tmp = this.i2m_1 === other.i2m_1;
    } else {
      tmp = false;
    }
    return tmp;
  }
  toString() {
    var tmp = SimpleName__toString_impl_vxsxyc(this.typeName);
    var tmp0_safe_receiver = this.j2m_1;
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.value;
    return ':' + tmp + '[' + (tmp1_elvis_lhs == null ? toString(this.i2m_1) : tmp1_elvis_lhs) + '] { ' + joinToString(this.k2m_1.v2()) + '} }';
  }
  get parsePath() {
    return this.c2p();
  }
  set parsePath(value) {
    this.y2p(value);
  }
  get semanticPath() {
    return this.e2p();
  }
  set semanticPath(value) {
    this.d2p(value);
  }
  get property() {
    return this.z2h();
  }
  get propertyOrdered() {
    return this.f2p();
  }
  get children() {
    return this.s13();
  }
}
class Companion_9 {
  constructor() {
    this.TO_STRING_MAX_LEN = 30;
  }
  c2q() {
    return this.TO_STRING_MAX_LEN;
  }
}
class AsmStructurePropertySimple {
  constructor(name, index, value) {
    this.z2p_1 = name;
    this.a2q_1 = index;
    this.b2q_1 = value;
  }
  g2p() {
    return this.z2p_1;
  }
  f1m() {
    return this.a2q_1;
  }
  b3() {
    return this.b2q_1;
  }
  h2p() {
    var tmp = this.b2q_1;
    return tmp instanceof AsmReferenceSimple;
  }
  convertToReferenceTo(referredValue) {
    var v = this.b2q_1;
    if (isInterface(v, AsmNothing)) {
      // Inline function 'kotlin.error' call
      var message = "Cannot convert property '" + this.toString() + "' a reference, it has value " + AsmNothingSimple_getInstance().toString();
      throw IllegalStateException.v4(toString(message));
    } else {
      if (isInterface(v, AsmReference)) {
        v.resolveAs(referredValue);
      } else {
        var tmp;
        if (isInterface(v, AsmPrimitive)) {
          var tmp_0 = v.value;
          tmp = typeof tmp_0 === 'string';
        } else {
          tmp = false;
        }
        if (tmp) {
          var tmp_1 = v.value;
          var ref = new AsmReferenceSimple(typeof tmp_1 === 'string' ? tmp_1 : THROW_CCE(), referredValue);
          this.b2q_1 = ref;
        } else {
          var tmp_2;
          if (isInterface(v, AsmList)) {
            var tmp1 = v.elements;
            var tmp$ret$0;
            $l$block_0: {
              // Inline function 'kotlin.collections.all' call
              var tmp_3;
              if (isInterface(tmp1, Collection)) {
                tmp_3 = tmp1.a1();
              } else {
                tmp_3 = false;
              }
              if (tmp_3) {
                tmp$ret$0 = true;
                break $l$block_0;
              }
              var _iterator__ex2g4s = tmp1.s();
              while (_iterator__ex2g4s.t()) {
                var element = _iterator__ex2g4s.u();
                var tmp_4;
                if (isInterface(element, AsmPrimitive)) {
                  tmp_4 = get_isStdString(element);
                } else {
                  tmp_4 = false;
                }
                if (!tmp_4) {
                  tmp$ret$0 = false;
                  break $l$block_0;
                }
              }
              tmp$ret$0 = true;
            }
            tmp_2 = tmp$ret$0;
          } else {
            tmp_2 = false;
          }
          if (tmp_2) {
            var tmp_5 = v.elements;
            var refValue = joinToString(tmp_5, '.', VOID, VOID, VOID, VOID, AsmStructurePropertySimple$convertToReferenceTo$lambda);
            var ref_0 = new AsmReferenceSimple(refValue, referredValue);
            this.b2q_1 = ref_0;
          } else {
            // Inline function 'kotlin.error' call
            var message_0 = "Cannot convert property '" + this.toString() + "' a reference, it has value of type '" + getKClassFromExpression(v).zc() + "'";
            throw IllegalStateException.v4(toString(message_0));
          }
        }
      }
    }
  }
  equalTo(other) {
    var tmp;
    if (!(this.z2p_1 === other.name)) {
      tmp = false;
    } else if (!(this.isReference === other.isReference)) {
      tmp = false;
    } else {
      var t = this.b2q_1;
      var o = other.value;
      var tmp_0;
      if (this.isReference) {
        var tmp_1;
        var tmp_2;
        if (t instanceof AsmReferenceSimple) {
          tmp_2 = o instanceof AsmReferenceSimple;
        } else {
          tmp_2 = false;
        }
        if (tmp_2) {
          tmp_1 = t.equalTo(o);
        } else {
          // Inline function 'kotlin.error' call
          var message = 'Cannot compare property values: ' + toString(t) + ' and ' + toString(o);
          throw IllegalStateException.v4(toString(message));
        }
        tmp_0 = tmp_1;
      } else {
        var tmp_3;
        var tmp_4;
        if (t instanceof AsmStructureSimple) {
          tmp_4 = o instanceof AsmStructureSimple;
        } else {
          tmp_4 = false;
        }
        if (tmp_4) {
          tmp_3 = t.equalTo(o);
        } else {
          tmp_3 = equals(t, o);
        }
        tmp_0 = tmp_3;
      }
      tmp = tmp_0;
    }
    return tmp;
  }
  toString() {
    var v = this.b2q_1;
    var tmp;
    if (v instanceof AsmStructureSimple) {
      tmp = PropertyValueName__toString_impl_bg83d2(this.z2p_1) + ' = :' + SimpleName__toString_impl_vxsxyc(v.typeName);
    } else {
      if (isInterface(v, AsmList)) {
        var elems = joinToString(v.elements);
        var tmp_0;
        if (elems.length > 30) {
          // Inline function 'kotlin.text.substring' call
          // Inline function 'kotlin.js.asDynamic' call
          tmp_0 = elems.substring(0, 30) + '...';
        } else {
          tmp_0 = elems;
        }
        var elemsStr = tmp_0;
        tmp = PropertyValueName__toString_impl_bg83d2(this.z2p_1) + ' = [' + elemsStr + ']';
      } else {
        if (isInterface(v, AsmPrimitive)) {
          tmp = this.isReference ? PropertyValueName__toString_impl_bg83d2(this.z2p_1) + ' = &' + toString(v) : PropertyValueName__toString_impl_bg83d2(this.z2p_1) + ' = ' + toString(v);
        } else {
          tmp = PropertyValueName__toString_impl_bg83d2(this.z2p_1) + ' = ' + toString(v);
        }
      }
    }
    return tmp;
  }
  get name() {
    return this.g2p();
  }
  get index() {
    return this.f1m();
  }
  get value() {
    return this.b3();
  }
  get isReference() {
    return this.h2p();
  }
}
class AsmListSimple extends AsmValueAbstract {
  constructor(elements) {
    super();
    this.d2q_1 = elements;
  }
  ek() {
    return this.d2q_1;
  }
  z2o() {
    return StdLibDefault_getInstance().List.qualifiedName;
  }
  mk() {
    return this.d2q_1.a1();
  }
  ik() {
    // Inline function 'kotlin.collections.isNotEmpty' call
    return !this.d2q_1.a1();
  }
  y2o(currentIndent, indentIncrement) {
    return joinToString(this.d2q_1, VOID, VOID, VOID, VOID, VOID, AsmListSimple$asString$lambda(currentIndent, indentIncrement));
  }
  equalTo(other) {
    var tmp;
    if (!isInterface(other, AsmList)) {
      tmp = false;
    } else {
      if (!(other.elements.v() === this.d2q_1.v())) {
        tmp = false;
      } else {
        var tmp0 = numberRangeToNumber(0, this.d2q_1.v());
        var tmp$ret$0;
        $l$block_0: {
          // Inline function 'kotlin.collections.all' call
          var tmp_0;
          if (isInterface(tmp0, Collection)) {
            tmp_0 = tmp0.a1();
          } else {
            tmp_0 = false;
          }
          if (tmp_0) {
            tmp$ret$0 = true;
            break $l$block_0;
          }
          var inductionVariable = tmp0.ei_1;
          var last = tmp0.fi_1;
          if (inductionVariable <= last)
            do {
              var element = inductionVariable;
              inductionVariable = inductionVariable + 1 | 0;
              var it = element;
              if (!this.d2q_1.z(it).equalTo(other.elements.z(it))) {
                tmp$ret$0 = false;
                break $l$block_0;
              }
            }
             while (!(element === last));
          tmp$ret$0 = true;
        }
        tmp = tmp$ret$0;
      }
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.d2q_1);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, AsmList) : false)) {
      tmp = false;
    } else {
      tmp = equals(this.d2q_1, other.elements);
    }
    return tmp;
  }
  toString() {
    return toString(this.d2q_1);
  }
  get elements() {
    return this.ek();
  }
  get isEmpty() {
    return this.mk();
  }
  get isNotEmpty() {
    return this.ik();
  }
}
class AsmListSeparatedSimple extends AsmValueAbstract {
  constructor(elements) {
    super();
    this.e2q_1 = elements;
  }
  ek() {
    return this.e2q_1;
  }
  z2o() {
    return StdLibDefault_getInstance().ListSeparated.qualifiedName;
  }
  mk() {
    return this.e2q_1.a1();
  }
  ik() {
    // Inline function 'kotlin.collections.isNotEmpty' call
    return !this.e2q_1.a1();
  }
  y2o(currentIndent, indentIncrement) {
    var tmp = this.e2q_1.ek();
    return joinToString(tmp, VOID, VOID, VOID, VOID, VOID, AsmListSeparatedSimple$asString$lambda(currentIndent, indentIncrement));
  }
  equalTo(other) {
    var tmp;
    if (!isInterface(other, AsmListSeparated)) {
      tmp = false;
    } else {
      if (!(other.elements.v() === this.e2q_1.v())) {
        tmp = false;
      } else {
        var tmp0 = numberRangeToNumber(0, this.e2q_1.v());
        var tmp$ret$0;
        $l$block_0: {
          // Inline function 'kotlin.collections.all' call
          var tmp_0;
          if (isInterface(tmp0, Collection)) {
            tmp_0 = tmp0.a1();
          } else {
            tmp_0 = false;
          }
          if (tmp_0) {
            tmp$ret$0 = true;
            break $l$block_0;
          }
          var inductionVariable = tmp0.ei_1;
          var last = tmp0.fi_1;
          if (inductionVariable <= last)
            do {
              var element = inductionVariable;
              inductionVariable = inductionVariable + 1 | 0;
              var it = element;
              if (!this.e2q_1.z(it).equalTo(other.elements.z(it))) {
                tmp$ret$0 = false;
                break $l$block_0;
              }
            }
             while (!(element === last));
          tmp$ret$0 = true;
        }
        tmp = tmp$ret$0;
      }
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.e2q_1);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, AsmListSeparated) : false)) {
      tmp = false;
    } else {
      tmp = equals(this.e2q_1, other.elements);
    }
    return tmp;
  }
  toString() {
    return toString(this.e2q_1);
  }
  get elements() {
    return this.ek();
  }
  get isEmpty() {
    return this.mk();
  }
  get isNotEmpty() {
    return this.ik();
  }
}
class AsmLambdaSimple extends AsmValueAbstract {
  constructor(lambda) {
    super();
    this.lambda = lambda;
    this.f2q_1 = StdLibDefault_getInstance().Lambda.qualifiedTypeName;
  }
  g2q() {
    return this.lambda;
  }
  z2o() {
    return this.f2q_1;
  }
  invoke(args) {
    var it = ensureNotNull(args.z2('it'));
    return this.lambda(it);
  }
  equalTo(other) {
    return false;
  }
  y2o(currentIndent, indentIncrement) {
    return '{ <expre> }';
  }
}
class AsmSimpleBuilder {
  constructor(_typeModel, _defaultNamespace, _crossReferenceModel, _sentenceId, _context, resolveReferences, failIfIssues, resolvedReferences) {
    this.h2q_1 = _typeModel;
    this.i2q_1 = _defaultNamespace;
    this.j2q_1 = _crossReferenceModel;
    this.k2q_1 = _sentenceId;
    this.l2q_1 = _context;
    this.m2q_1 = resolveReferences;
    this.n2q_1 = failIfIssues;
    this.o2q_1 = resolvedReferences;
    var tmp = this;
    var tmp0_safe_receiver = this.l2q_1;
    var tmp_0 = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.getScopeForSentenceOrNull(null);
    tmp.p2q_1 = (tmp_0 == null ? true : tmp_0 instanceof ScopeSimple) ? tmp_0 : THROW_CCE();
    this.q2q_1 = new IssueHolder(LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance());
    this.r2q_1 = new ExpressionsInterpreterOverTypedObject(new ObjectGraphAsmSimple(this.h2q_1, this.q2q_1), this.q2q_1);
    this.s2q_1 = new AsmSimple();
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_1.t2q_1 = LinkedHashMap.l4();
    var tmp_2 = this;
    tmp_2.u2q_1 = AsmSimpleBuilder$_identifyingValueInFor$lambda(this);
  }
  string(value) {
    this.s2q_1.addRoot(Companion_instance_9.stdString(value));
  }
  element(typeName, init) {
    var path = Companion_getInstance_9().ROOT.plus(this.s2q_1.root.v().toString());
    var b = new AsmElementSimpleBuilder(this.h2q_1, this.i2q_1, this.j2q_1, this.l2q_1, this.t2q_1, this.s2q_1, this.u2q_1, path, typeName, true, this.p2q_1);
    init(b);
    return b.build();
  }
  tuple(init) {
    return this.element(_QualifiedName___get_value__impl__nkc4gq(StdLibDefault_getInstance().TupleType.qualifiedName), init);
  }
  listOfString(items) {
    var path = Companion_getInstance_9().ROOT.plus(this.s2q_1.root.v().toString());
    // Inline function 'kotlin.collections.map' call
    var this_0 = asList(items);
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = Companion_instance_9.stdString(item);
      destination.r(tmp$ret$0);
    }
    var l = destination;
    var list = new AsmListSimple(l);
    this.s2q_1.addRoot(list);
    return list;
  }
  list(init) {
    var path = Companion_getInstance_9().ROOT.plus(this.s2q_1.root.v().toString());
    var b = new ListAsmElementSimpleBuilder(this.h2q_1, this.i2q_1, this.j2q_1, this.l2q_1, this.t2q_1, this.s2q_1, path, this.p2q_1, this.u2q_1);
    init(b);
    var list = b.build();
    this.s2q_1.addRoot(list);
    return list;
  }
  build() {
    if (this.m2q_1 && !(null == this.l2q_1) && !(null == this.p2q_1)) {
      var tmp = this.j2q_1;
      var scopeCreator = new ScopeCreator(this.h2q_1, tmp instanceof CrossReferenceModelDefault ? tmp : THROW_CCE(), this.l2q_1, this.k2q_1, false, LanguageIssueKind_ERROR_getInstance(), this.u2q_1, new LocationMapDefault(), this.q2q_1);
      this.s2q_1.traverseDepthFirst(scopeCreator);
      var resolver = new ReferenceResolverSimple(this.h2q_1, this.j2q_1, this.l2q_1, this.k2q_1, this.u2q_1, this.l2q_1.resolveScopedItem, new LocationMapDefault(), this.q2q_1);
      this.s2q_1.traverseDepthFirst(resolver);
      this.o2q_1.x(resolver.resolvedReferences);
    }
    var tmp_0;
    if (this.n2q_1) {
      // Inline function 'kotlin.collections.isNotEmpty' call
      tmp_0 = !this.q2q_1.errors.a1();
    } else {
      tmp_0 = false;
    }
    if (tmp_0) {
      var tmp_1 = this.q2q_1.all;
      // Inline function 'kotlin.error' call
      var message = 'Issues building asm:\n' + joinToString(tmp_1, '\n', VOID, VOID, VOID, VOID, AsmSimpleBuilder$build$lambda);
      throw IllegalStateException.v4(toString(message));
    } else {
      return this.s2q_1;
    }
  }
}
class AsmElementSimpleBuilder {
  constructor(_typeModel, _defaultNamespace, _crossReferenceModel, _context, _scopeMap, _asm, _identifyingValueInFor, _asmPath, _typeName, _isRoot, _parentScope) {
    this.v2q_1 = _typeModel;
    this.w2q_1 = _defaultNamespace;
    this.x2q_1 = _crossReferenceModel;
    this.y2q_1 = _context;
    this.z2q_1 = _scopeMap;
    this.a2r_1 = _asm;
    this.b2r_1 = _identifyingValueInFor;
    var tmp = this;
    // Inline function 'kotlin.let' call
    var qtn = get_asPossiblyQualifiedName(_typeName);
    var tmp_0;
    if (qtn instanceof QualifiedName) {
      var tmp1_safe_receiver = this.v2q_1.findByQualifiedNameOrNull(qtn.f27_1);
      var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.qualifiedName;
      var tmp_1;
      var tmp_2 = tmp2_elvis_lhs;
      if ((tmp_2 == null ? null : new QualifiedName(tmp_2)) == null) {
        var message = "Type not found '" + _QualifiedName___get_value__impl__nkc4gq(qtn.f27_1) + "'";
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp_1 = tmp2_elvis_lhs;
      }
      tmp_0 = tmp_1;
    } else {
      if (qtn instanceof SimpleName) {
        var tmp_3;
        if (qtn.a1u_1 === StdLibDefault_getInstance().TupleType.t2r_1) {
          tmp_3 = StdLibDefault_getInstance().TupleType.qualifiedName;
        } else {
          var tmp4_safe_receiver = this.v2q_1.findFirstDefinitionByPossiblyQualifiedNameOrNull(qtn);
          var tmp5_elvis_lhs = tmp4_safe_receiver == null ? null : tmp4_safe_receiver.qualifiedName;
          var tmp_4;
          var tmp_5 = tmp5_elvis_lhs;
          if ((tmp_5 == null ? null : new QualifiedName(tmp_5)) == null) {
            tmp_4 = QualifiedName__append_impl_hhmte4(this.w2q_1.qualifiedName, _SimpleName___init__impl__6s45d0(_typeName));
          } else {
            tmp_4 = tmp5_elvis_lhs;
          }
          tmp_3 = tmp_4;
        }
        tmp_0 = tmp_3;
      } else {
        noWhenBranchMatchedException();
      }
    }
    tmp.c2r_1 = tmp_0;
    var tmp_6 = this;
    // Inline function 'kotlin.also' call
    var this_0 = this.a2r_1.createStructure('/', this.c2r_1);
    this_0.j2m_1 = _asmPath;
    if (_isRoot) {
      this.a2r_1.addRoot(this_0);
    }
    tmp_6.d2r_1 = this_0;
    var tmp_7 = this;
    tmp_7.e2r_1 = lazy(AsmElementSimpleBuilder$_elementScope$delegate$lambda(_parentScope, this, _asmPath));
  }
  propertyUnnamedString(value) {
    return this.propertyString(_PropertyName___get_value__impl__p219lh(Companion_getInstance_3().UNNAMED_PRIMITIVE_PROPERTY_NAME), value);
  }
  propertyString(name, value) {
    var tmp;
    if (value == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp = Companion_instance_9.stdString(value);
    }
    var tmp1_elvis_lhs = tmp;
    return _property(this, name, tmp1_elvis_lhs == null ? AsmNothingSimple_getInstance() : tmp1_elvis_lhs);
  }
  propertyNothing(name) {
    return _property(this, name, AsmNothingSimple_getInstance());
  }
  propertyUnnamedElement(typeName, init) {
    return this.propertyElementExplicitType(_PropertyName___get_value__impl__p219lh(Companion_getInstance_3().UNNAMED_PRIMITIVE_PROPERTY_NAME), typeName, init);
  }
  v2r(name, tupleTypeId, init) {
    var tmp0_elvis_lhs = this.v2q_1.findNamespaceOrNull(_QualifiedName___get_front__impl__24j8eq(this.c2r_1));
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = "No namespace '" + _QualifiedName___get_value__impl__nkc4gq(_QualifiedName___get_front__impl__24j8eq(this.c2r_1)) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var ns = tmp;
    var tmp_0;
    if (tupleTypeId == null) {
      tmp_0 = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp_0 = ns.findTupleTypeWithIdOrNull(tupleTypeId);
    }
    var tmp2_elvis_lhs = tmp_0;
    var tt = tmp2_elvis_lhs == null ? ns.createTupleType() : tmp2_elvis_lhs;
    return this.propertyElementExplicitType(name, _QualifiedName___get_value__impl__nkc4gq(tt.qualifiedName), init);
  }
  propertyTuple(name, tupleTypeId, init, $super) {
    tupleTypeId = tupleTypeId === VOID ? null : tupleTypeId;
    return $super === VOID ? this.v2r(name, tupleTypeId, init) : $super.v2r.call(this, name, tupleTypeId, init);
  }
  propertyElement(name, init) {
    return this.propertyElementExplicitType(name, name, init);
  }
  propertyElementExplicitType(name, typeName, init) {
    var newPath = ensureNotNull(this.d2r_1.j2m_1).plus(name);
    var tmp0_elvis_lhs = this.v2q_1.findNamespaceOrNull(_QualifiedName___get_front__impl__24j8eq(this.c2r_1));
    var ns = tmp0_elvis_lhs == null ? this.w2q_1 : tmp0_elvis_lhs;
    var b = new AsmElementSimpleBuilder(this.v2q_1, ns, this.x2q_1, this.y2q_1, this.z2q_1, this.a2r_1, this.b2r_1, newPath, typeName, false, _get__elementScope__jy0q92(this));
    init(b);
    var el = b.build();
    this.d2r_1.setProperty(_PropertyValueName___init__impl__cmfy0i(name), el, 0);
    return el;
  }
  propertyUnnamedListOfString(list) {
    return this.propertyListOfString(_PropertyName___get_value__impl__p219lh(Companion_getInstance_3().UNNAMED_LIST_PROPERTY_NAME), list);
  }
  propertyListOfString(name, list) {
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(list, 10));
    var _iterator__ex2g4s = list.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = Companion_instance_9.stdString(item);
      destination.r(tmp$ret$0);
    }
    return _property(this, name, new AsmListSimple(destination));
  }
  propertyUnnamedListOfElement(init) {
    return this.propertyListOfElement(_PropertyName___get_value__impl__p219lh(Companion_getInstance_3().UNNAMED_LIST_PROPERTY_NAME), init);
  }
  propertyListOfElement(name, init) {
    var newPath = ensureNotNull(this.d2r_1.j2m_1).plus(name);
    var tmp0_elvis_lhs = this.v2q_1.findNamespaceOrNull(_QualifiedName___get_front__impl__24j8eq(this.c2r_1));
    var ns = tmp0_elvis_lhs == null ? this.w2q_1 : tmp0_elvis_lhs;
    var b = new ListAsmElementSimpleBuilder(this.v2q_1, ns, this.x2q_1, this.y2q_1, this.z2q_1, this.a2r_1, newPath, _get__elementScope__jy0q92(this), this.b2r_1);
    init(b);
    var list = b.build();
    this.d2r_1.setProperty(_PropertyValueName___init__impl__cmfy0i(name), list, 0);
    return list;
  }
  reference(name, elementReference) {
    var ref = new AsmReferenceSimple(elementReference, null);
    this.d2r_1.setProperty(_PropertyValueName___init__impl__cmfy0i(name), ref, 0);
  }
  build() {
    return this.d2r_1;
  }
}
class ListAsmElementSimpleBuilder {
  constructor(_typeModel, _defaultNamespace, _crossReferenceModel, _context, _scopeMap, _asm, _asmPath, _parentScope, _identifyingValueInFor) {
    this.w2r_1 = _typeModel;
    this.x2r_1 = _defaultNamespace;
    this.y2r_1 = _crossReferenceModel;
    this.z2r_1 = _context;
    this.a2s_1 = _scopeMap;
    this.b2s_1 = _asm;
    this.c2s_1 = _asmPath;
    this.d2s_1 = _parentScope;
    this.e2s_1 = _identifyingValueInFor;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.f2s_1 = ArrayList.y();
  }
  string(value) {
    this.f2s_1.r(Companion_instance_9.stdString(value));
  }
  list(init) {
    var newPath = this.c2s_1.plus(this.f2s_1.v().toString());
    var b = new ListAsmElementSimpleBuilder(this.w2r_1, this.x2r_1, this.y2r_1, this.z2r_1, this.a2s_1, this.b2s_1, newPath, this.d2s_1, this.e2s_1);
    init(b);
    var list = b.build();
    this.f2s_1.r(list);
  }
  element(typeName, init) {
    var newPath = this.c2s_1.plus(this.f2s_1.v().toString());
    var b = new AsmElementSimpleBuilder(this.w2r_1, this.x2r_1, this.y2r_1, this.z2r_1, this.a2s_1, this.b2s_1, this.e2s_1, newPath, typeName, false, this.d2s_1);
    init(b);
    var el = b.build();
    this.f2s_1.r(el);
    return el;
  }
  tuple(init) {
    var tt = StdLibDefault_getInstance().TupleType;
    return this.element(_QualifiedName___get_value__impl__nkc4gq(tt.qualifiedName), init);
  }
  build() {
    return new AsmListSimple(this.f2s_1);
  }
}
class AsmSimpleBuilderMarker {
  equals(other) {
    if (!(other instanceof AsmSimpleBuilderMarker))
      return false;
    other instanceof AsmSimpleBuilderMarker || THROW_CCE();
    return true;
  }
  hashCode() {
    return 0;
  }
  toString() {
    return '@net.akehurst.language.asm.builder.AsmSimpleBuilderMarker(' + ')';
  }
}
class OptionHolder {}
class OptionHolderDefault {
  constructor(parent, options) {
    parent = parent === VOID ? null : parent;
    options = options === VOID ? emptyMap() : options;
    this.g2s_1 = parent;
    this.options = options;
  }
  h2s(_set____db54di) {
    this.g2s_1 = _set____db54di;
  }
  ox() {
    return this.g2s_1;
  }
  x1c() {
    return this.options;
  }
  get(name) {
    var tmp0_elvis_lhs = this.options.z2(name);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp1_safe_receiver = this.g2s_1;
      tmp = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.get(name);
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  clone(parent) {
    return new OptionHolderDefault(parent, this.options);
  }
  toString() {
    var tmp = this.options.w2();
    return joinToString(tmp, VOID, VOID, VOID, VOID, VOID, OptionHolderDefault$toString$lambda);
  }
  hashCode() {
    return hashCode(this.options);
  }
  equals(other) {
    var tmp;
    if (!(other instanceof OptionHolderDefault)) {
      tmp = false;
    } else {
      if (!equals(this.g2s_1, other.g2s_1)) {
        tmp = false;
      } else {
        if (!equals(this.options, other.options)) {
          tmp = false;
        } else {
          tmp = true;
        }
      }
    }
    return tmp;
  }
  get parent() {
    return this.ox();
  }
  set parent(value) {
    this.h2s(value);
  }
}
class Model {}
class ModelAbstract {
  constructor(namespace, options) {
    this.i2s_1 = options;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    // Inline function 'kotlin.also' call
    var this_0 = LinkedHashMap.l4();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = namespace.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      // Inline function 'kotlin.collections.set' call
      var key = new QualifiedName(element.qualifiedName);
      this_0.r2(key, element);
    }
    tmp.j2s_1 = this_0;
    this.connectionNamespaceOptionHolderParentsToThis();
  }
  x1c() {
    return this.i2s_1;
  }
  k2s() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.namespace;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.definition;
      addAll(destination, list);
    }
    return destination;
  }
  mk() {
    return this.allDefinitions.a1();
  }
  e2h() {
    return toList(this.j2s_1.v2());
  }
  findNamespaceOrNull(qualifiedName) {
    return this.j2s_1.z2(new QualifiedName(qualifiedName));
  }
  findFirstDefinitionByPossiblyQualifiedNameOrNull(pqn) {
    var tmp;
    if (pqn instanceof QualifiedName) {
      tmp = this.findDefinitionByQualifiedNameOrNull(pqn.f27_1);
    } else {
      if (pqn instanceof SimpleName) {
        tmp = this.findFirstDefinitionByNameOrNull(pqn.a1u_1);
      } else {
        noWhenBranchMatchedException();
      }
    }
    return tmp;
  }
  findDefinitionByQualifiedNameOrNull(qualifiedName) {
    var tmp0_safe_receiver = this.j2s_1.z2(new QualifiedName(_QualifiedName___get_front__impl__24j8eq(qualifiedName)));
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.findOwnedDefinitionOrNull(_QualifiedName___get_last__impl__838y8h(qualifiedName));
  }
  findFirstDefinitionByNameOrNull(simpleName) {
    var _iterator__ex2g4s = this.namespace.s();
    while (_iterator__ex2g4s.t()) {
      var ns = _iterator__ex2g4s.u();
      var t = ns.findDefinitionOrNull(simpleName);
      if (!(null == t)) {
        return t;
      }
    }
    return null;
  }
  resolveReference(reference) {
    var tmp0_subject = reference.nameOrQName;
    var tmp;
    if (tmp0_subject instanceof QualifiedName) {
      var tmp_0 = reference.nameOrQName;
      tmp = this.findDefinitionByQualifiedNameOrNull(tmp_0 instanceof QualifiedName ? tmp_0.f27_1 : THROW_CCE());
    } else {
      if (tmp0_subject instanceof SimpleName) {
        tmp = this.findDefinitionByQualifiedNameOrNull(reference.nameOrQName.asQualifiedName(reference.localNamespace.qualifiedName));
      } else {
        noWhenBranchMatchedException();
      }
    }
    var res = tmp;
    var tmp_1;
    if (!(null == res)) {
      reference.resolveAs(res);
      tmp_1 = res;
    } else {
      tmp_1 = null;
    }
    return tmp_1;
  }
  connectionNamespaceOptionHolderParentsToThis() {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.namespace.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      element.options.parent = this.options;
    }
  }
  addNamespace(value) {
    if (this.j2s_1.x2(new QualifiedName(value.qualifiedName))) {
      if (this.j2s_1.z2(new QualifiedName(value.qualifiedName)) !== value) {
        // Inline function 'kotlin.error' call
        var message = "TypeModel '" + SimpleName__toString_impl_vxsxyc(this.name) + "' already contains a namespace '" + QualifiedName__toString_impl_z3wem2(value.qualifiedName) + "'";
        throw IllegalStateException.v4(toString(message));
      }
    } else {
      var tmp = this.j2s_1;
      var tmp1 = isInterface(tmp, KtMutableMap) ? tmp : THROW_CCE();
      // Inline function 'kotlin.collections.set' call
      var key = new QualifiedName(value.qualifiedName);
      tmp1.r2(key, value);
      value.options.parent = this.options;
    }
  }
  h2f(indent) {
    var sb = StringBuilder.j();
    var tmp = this.namespace;
    var ns = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, ModelAbstract$asString$lambda(indent));
    sb.cb(ns);
    return sb.toString();
  }
  hashCode() {
    return hashCode(listOf_0([new SimpleName(this.name), hashCode(this.namespace)]));
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, Model) : false)) {
      tmp = false;
    } else {
      if (!(this.name === other.name)) {
        tmp = false;
      } else {
        if (!equals(this.namespace, other.namespace)) {
          tmp = false;
        } else {
          tmp = true;
        }
      }
    }
    return tmp;
  }
  toString() {
    return "Domain '" + SimpleName__toString_impl_vxsxyc(this.name) + "'";
  }
  get options() {
    return this.x1c();
  }
  get allDefinitions() {
    return this.k2s();
  }
  get isEmpty() {
    return this.mk();
  }
  get namespace() {
    return this.e2h();
  }
  get name() {
    return this.f2h();
  }
}
class sam$kotlin_Comparator$0_1 {
  constructor(function_0) {
    this.l2s_1 = function_0;
  }
  wh(a, b) {
    return this.l2s_1(a, b);
  }
  compare(a, b) {
    return this.wh(a, b);
  }
  w3() {
    return this.l2s_1;
  }
  equals(other) {
    var tmp;
    if (!(other == null) ? isInterface(other, Comparator) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.w3(), other.w3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.w3());
  }
}
class Namespace {}
class NamespaceAbstract {
  constructor(options, argImport) {
    this.m2s_1 = options;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp._importedNamespaces = LinkedHashMap.l4();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.linkedMapOf' call
    tmp_0._definition = LinkedHashMap.l4();
    this.n2s_1 = toMutableList(argImport);
    this.connectionDefinitionOptionHolderParentsToThis();
  }
  x1c() {
    return this.m2s_1;
  }
  o2s() {
    return toList(this._definition.v2());
  }
  p2s() {
    return this._definition;
  }
  q2s() {
    return this._importedNamespaces;
  }
  r2s() {
    return this._definition;
  }
  s2s() {
    return this.n2s_1;
  }
  resolveImports(model) {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.import.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var it = element.p2i_1;
      var tmp0_elvis_lhs = model.findNamespaceOrNull(_Import___get_asQualifiedName__impl__htdpak(it));
      var tmp;
      if (tmp0_elvis_lhs == null) {
        var message = "import '" + Import__toString_impl_bbkios(it) + "' cannot be resolved in the TypeModel '" + SimpleName__toString_impl_vxsxyc(model.name) + "'";
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp = tmp0_elvis_lhs;
      }
      var ns = tmp;
      var tmp1 = this._importedNamespaces;
      // Inline function 'kotlin.collections.set' call
      var key = new QualifiedName(_Import___get_asQualifiedName__impl__htdpak(it));
      tmp1.r2(key, ns);
    }
  }
  findDefinitionOrNull(simpleName) {
    var tmp0_elvis_lhs = this.findOwnedDefinitionOrNull(simpleName);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp0 = this.import;
      var tmp$ret$1;
      $l$block: {
        // Inline function 'kotlin.collections.firstNotNullOfOrNull' call
        var _iterator__ex2g4s = tmp0.s();
        while (_iterator__ex2g4s.t()) {
          var element = _iterator__ex2g4s.u();
          var it = element.p2i_1;
          var tns = this._importedNamespaces.z2(new QualifiedName(_Import___get_asQualifiedName__impl__htdpak(it)));
          var result = tns == null ? null : tns.findOwnedDefinitionOrNull(simpleName);
          if (!(result == null)) {
            tmp$ret$1 = result;
            break $l$block;
          }
        }
        tmp$ret$1 = null;
      }
      tmp = tmp$ret$1;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  findOwnedDefinitionOrNull(simpleName) {
    return this._definition.z2(new SimpleName(simpleName));
  }
  connectionDefinitionOptionHolderParentsToThis() {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.definition.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      element.options.parent = this.options;
    }
  }
  addImport(value) {
    if (!this.import.e1(new Import(value))) {
      var tmp = this.import;
      (isInterface(tmp, KtMutableList) ? tmp : THROW_CCE()).r(new Import(value));
    }
  }
  addDefinition(value) {
    // Inline function 'kotlin.check' call
    if (!!this._definition.x2(new SimpleName(value.name))) {
      var message = "namespace '" + QualifiedName__toString_impl_z3wem2(this.qualifiedName) + "' already contains a declaration named '" + SimpleName__toString_impl_vxsxyc(value.name) + "', cannot add another";
      throw IllegalStateException.v4(toString(message));
    }
    var tmp1 = this._definition;
    // Inline function 'kotlin.collections.set' call
    var key = new SimpleName(value.name);
    tmp1.r2(key, value);
    value.options.parent = this.options;
  }
  h2f(indent) {
    var sb = StringBuilder.j();
    sb.cb('namespace ' + QualifiedName__toString_impl_z3wem2(this.qualifiedName) + '\n');
    var newIndent = indent.inc;
    // Inline function 'kotlin.collections.isNotEmpty' call
    if (!this.import.a1()) {
      var tmp = this.import;
      var importStr = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, NamespaceAbstract$asString$lambda(newIndent));
      sb.cb(importStr);
      sb.cb('\n');
    }
    // Inline function 'kotlin.collections.sortedBy' call
    var this_0 = this.definition;
    // Inline function 'kotlin.comparisons.compareBy' call
    var tmp_0 = NamespaceAbstract$asString$lambda_0;
    var tmp$ret$1 = new sam$kotlin_Comparator$0_1(tmp_0);
    var tmp_1 = sortedWith(this_0, tmp$ret$1);
    var defs = joinToString(tmp_1, '\n', VOID, VOID, VOID, VOID, NamespaceAbstract$asString$lambda_1(newIndent));
    sb.cb(defs);
    return sb.toString();
  }
  hashCode() {
    return QualifiedName__hashCode_impl_dcqht7(this.qualifiedName);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, Namespace) : false)) {
      tmp = false;
    } else {
      tmp = this.qualifiedName === other.qualifiedName;
    }
    return tmp;
  }
  toString() {
    return 'namespace ' + QualifiedName__toString_impl_z3wem2(this.qualifiedName);
  }
  addAllDefinition(value) {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = value.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      this.addDefinition(element);
    }
  }
  get options() {
    return this.x1c();
  }
  get definition() {
    return this.o2s();
  }
  get definitionByName() {
    return this.p2s();
  }
  get import() {
    return this.s2s();
  }
  get qualifiedName() {
    return this.u2h();
  }
}
class DefinitionAbstract {
  u2h() {
    return QualifiedName__append_impl_hhmte4(this.namespace.qualifiedName, this.name);
  }
  h2f(indent) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  get qualifiedName() {
    return this.u2h();
  }
  get namespace() {
    return this.e2h();
  }
  get name() {
    return this.f2h();
  }
  get options() {
    return this.x1c();
  }
}
class ModelDefault extends ModelAbstract {
  constructor(name, options, namespace) {
    namespace = namespace === VOID ? emptyList() : namespace;
    super(namespace, options);
    this.v2s_1 = name;
  }
  f2h() {
    return this.v2s_1;
  }
}
class NamespaceDefault extends NamespaceAbstract {
  constructor(qualifiedName, options, import_0) {
    super(options, import_0);
    this.y2s_1 = qualifiedName;
  }
  u2h() {
    return this.y2s_1;
  }
}
class DefinitionDefault extends DefinitionAbstract {
  constructor(namespace, name, options) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    super();
    this.z2s_1 = namespace;
    this.a2t_1 = name;
    this.b2t_1 = options;
  }
  e2h() {
    return this.z2s_1;
  }
  f2h() {
    return this.a2t_1;
  }
  x1c() {
    return this.b2t_1;
  }
}
class Companion_10 {}
class PossiblyQualifiedName_0 {}
class Companion_11 {}
class SimpleName {
  constructor(value) {
    this.a1u_1 = value;
  }
  b3() {
    return _SimpleName___get_value__impl__rl2r3c(this.a1u_1);
  }
  c2t() {
    return _SimpleName___get_simpleName__impl__j6kwzs(this.a1u_1);
  }
  asQualifiedName(namespace) {
    return SimpleName__asQualifiedName_impl_w29pat(this.a1u_1, namespace);
  }
  toString() {
    return SimpleName__toString_impl_vxsxyc(this.a1u_1);
  }
  hashCode() {
    return SimpleName__hashCode_impl_a6n15h(this.a1u_1);
  }
  equals(other) {
    return SimpleName__equals_impl_cgqmkv(this.a1u_1, other);
  }
  get value() {
    return this.b3();
  }
  get simpleName() {
    return this.c2t();
  }
}
class Indent {
  constructor(value, increment) {
    value = value === VOID ? '' : value;
    increment = increment === VOID ? '  ' : increment;
    this.value = value;
    this.increment = increment;
  }
  b3() {
    return this.value;
  }
  d2t() {
    return this.increment;
  }
  e2t() {
    return new Indent(this.value + this.increment, this.increment);
  }
  toString() {
    return this.value;
  }
  get inc() {
    return this.e2t();
  }
}
class DefinitionReference {}
class QualifiedName {
  constructor(value) {
    this.f27_1 = value;
  }
  b3() {
    return _QualifiedName___get_value__impl__nkc4gq(this.f27_1);
  }
  c2t() {
    return _QualifiedName___get_simpleName__impl__hgm016(this.f27_1);
  }
  asQualifiedName(namespace) {
    return QualifiedName__asQualifiedName_impl_3a4znl(this.f27_1, namespace);
  }
  toString() {
    return QualifiedName__toString_impl_z3wem2(this.f27_1);
  }
  hashCode() {
    return QualifiedName__hashCode_impl_dcqht7(this.f27_1);
  }
  equals(other) {
    return QualifiedName__equals_impl_yjpbk7(this.f27_1, other);
  }
  get value() {
    return this.b3();
  }
  get simpleName() {
    return this.c2t();
  }
}
class Import {
  constructor(value) {
    this.p2i_1 = value;
  }
  b3() {
    return _Import___get_value__impl__o1bac0(this.p2i_1);
  }
  toString() {
    return Import__toString_impl_bbkios(this.p2i_1);
  }
  hashCode() {
    return Import__hashCode_impl_afle43(this.p2i_1);
  }
  equals(other) {
    return Import__equals_impl_38wftj(this.p2i_1, other);
  }
  get value() {
    return this.b3();
  }
}
class AglBase_0 extends LanguageObjectAbstract {
  constructor() {
    AglBase_instance = null;
    super();
    AglBase_instance = this;
    this.NAMESPACE_NAME = 'net.akehurst.language';
    this.NAME = 'Base';
    this.f22_1 = _LanguageIdentity___init__impl__3hnnkb('net.akehurst.language.Base');
    this.g22_1 = "namespace net.akehurst.language\n  grammar Base {\n    skip leaf WHITESPACE = \"\\s+\" ;\n    skip leaf MULTI_LINE_COMMENT = \"/\\*[^*]*\\*+([^*/][^*]*\\*+)*/\" ;\n    skip leaf SINGLE_LINE_COMMENT = \"//[^\\n\\r]*\" ;\n\n    unit = option* namespace* ;\n    namespace = 'namespace' possiblyQualifiedName option* import* definition* ;\n    import = 'import' possiblyQualifiedName ;\n    definition = 'definition' IDENTIFIER ;\n    possiblyQualifiedName = [IDENTIFIER / '.']+ ;\n    option = '#' IDENTIFIER (':' IDENTIFIER)? ;\n    leaf IDENTIFIER = \"[a-zA-Z_][a-zA-Z_0-9-]*\" ;\n  }";
    this.h22_1 = 'namespace net.akehurst.language.base.api\n    interface Model {\n        cmp namespace\n        cmp options\n    }\n    interface Namespace {\n        cmp options\n    }\n    interface Definition {\n        cmp options\n    }\n    \nnamespace net.akehurst.language.base.asm\n    class NamespaceAbstract {\n        cmp _definition\n        cmp options\n    }\n';
    this.i22_1 = "\n        namespace net.akehurst.language\n          styles Base {\n            $$ \"'([^']+)'\" {\n              foreground: darkgreen;\n              font-weight: bold;\n            }\n          }\n      ";
    var tmp = this;
    tmp.j22_1 = lazy(AglBase$grammarModel$delegate$lambda);
    var tmp_0 = this;
    tmp_0.k22_1 = lazy(AglBase$typesModel$delegate$lambda);
    var tmp_1 = this;
    tmp_1.l22_1 = lazy(AglBase$asmTransformModel$delegate$lambda);
    var tmp_2 = this;
    tmp_2.m22_1 = lazy(AglBase$crossReferenceModel$delegate$lambda);
    var tmp_3 = this;
    tmp_3.n22_1 = lazy(AglBase$formatModel$delegate$lambda);
    var tmp_4 = this;
    tmp_4.o22_1 = lazy(AglBase$styleModel$delegate$lambda);
    this.p22_1 = 'qualifiedName';
    var tmp_5 = this;
    tmp_5.q22_1 = lazy(AglBase$defaultTargetGrammar$delegate$lambda);
    var tmp_6 = this;
    tmp_6.r22_1 = lazy(AglBase$syntaxAnalyser$delegate$lambda);
    var tmp_7 = this;
    tmp_7.s22_1 = lazy(AglBase$semanticAnalyser$delegate$lambda);
    var tmp_8 = this;
    tmp_8.t22_1 = lazy(AglBase$completionProvider$delegate$lambda);
  }
  u2t() {
    return this.NAMESPACE_NAME;
  }
  v2t() {
    return this.NAME;
  }
  g1u() {
    return this.f22_1;
  }
  u2n() {
    return this.g22_1;
  }
  w2n() {
    return this.h22_1;
  }
  z2n() {
    return this.i22_1;
  }
  i1u() {
    var tmp0 = this.j22_1;
    // Inline function 'kotlin.getValue' call
    grammarModel$factory_1();
    return tmp0.b3();
  }
  p1u() {
    var tmp0 = this.k22_1;
    // Inline function 'kotlin.getValue' call
    typesModel$factory();
    return tmp0.b3();
  }
  j2k() {
    var tmp0 = this.l22_1;
    // Inline function 'kotlin.getValue' call
    asmTransformModel$factory();
    return tmp0.b3();
  }
  r1u() {
    var tmp0 = this.m22_1;
    // Inline function 'kotlin.getValue' call
    crossReferenceModel$factory_0();
    return tmp0.b3();
  }
  i1t() {
    var tmp0 = this.n22_1;
    // Inline function 'kotlin.getValue' call
    formatModel$factory_0();
    return tmp0.b3();
  }
  w1u() {
    var tmp0 = this.o22_1;
    // Inline function 'kotlin.getValue' call
    styleModel$factory();
    return tmp0.b3();
  }
  d2o() {
    return this.p22_1;
  }
  c2o() {
    var tmp0 = this.q22_1;
    // Inline function 'kotlin.getValue' call
    defaultTargetGrammar$factory();
    return tmp0.b3();
  }
  s1u() {
    var tmp0 = this.r22_1;
    // Inline function 'kotlin.getValue' call
    syntaxAnalyser$factory_0();
    return tmp0.b3();
  }
  t1u() {
    var tmp0 = this.s22_1;
    // Inline function 'kotlin.getValue' call
    semanticAnalyser$factory_0();
    return tmp0.b3();
  }
  p1y() {
    var tmp0 = this.t22_1;
    // Inline function 'kotlin.getValue' call
    completionProvider$factory_0();
    return tmp0.b3();
  }
  toString() {
    return trimIndent(this.g22_1);
  }
}
class BaseSemanticAnalyser {
  clear() {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  w2t(sentenceIdentity, asm, locationMap, options) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  y2j(sentenceIdentity, asm, locationMap, options) {
    return this.w2t(sentenceIdentity, !(asm == null) ? asm : THROW_CCE(), locationMap, options);
  }
}
class BaseSyntaxAnalyser extends SyntaxAnalyserByMethodRegistrationAbstract {
  registerHandlers() {
    super.register(BaseSyntaxAnalyser$unit$ref(this));
    super.register(BaseSyntaxAnalyser$namespace$ref(this));
    super.register(BaseSyntaxAnalyser$import$ref(this));
    super.register(BaseSyntaxAnalyser$definition$ref(this));
    super.register(BaseSyntaxAnalyser$option$ref(this));
    super.register(BaseSyntaxAnalyser$possiblyQualifiedName$ref(this));
  }
}
class BaseCompletionProvider {
  provide(nextExpected, options) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
}
class Expression {}
function asString_2(indent, imports, $super) {
  imports = imports === VOID ? emptyList() : imports;
  return $super === VOID ? this.x2t(indent, imports) : $super.x2t.call(this, indent, imports);
}
class RootExpression {}
class LiteralExpression {}
class CreateObjectExpression {}
class CreateTupleExpression {}
class OnExpression {}
class NavigationExpression {}
class NavigationPart {}
class PropertyCall {}
class MethodCall {}
class LambdaExpression {}
class IndexOperation {}
class AssignmentStatement {}
function asString_3(indent, imports, $super) {
  imports = imports === VOID ? emptyList() : imports;
  return $super === VOID ? this.x2t(indent, imports) : $super.x2t.call(this, indent, imports);
}
class WithExpression {}
class WhenExpression {}
class WhenOption {}
class WhenOptionElse {}
class InfixExpression {}
class CastExpression {}
class TypeTestExpression {}
class TypeReference {}
class GroupExpression {}
class ExpressionAbstract {
  x2t(indent, imports) {
    return toString(this);
  }
}
class CreateTupleExpressionDefault extends ExpressionAbstract {
  constructor(propertyAssignments) {
    super();
    this.r2u_1 = propertyAssignments;
  }
  c2u() {
    return this.r2u_1;
  }
  x2t(indent, imports) {
    var sb = StringBuilder.j();
    sb.cb('tuple {\n');
    var ni = indent.inc;
    var props = joinToString(this.r2u_1, '\n', VOID, VOID, VOID, VOID, CreateTupleExpressionDefault$asString$lambda(ni, imports));
    sb.cb(props + '\n');
    sb.cb(indent.toString() + '}');
    return sb.toString();
  }
  toString() {
    return 'tuple { ... }';
  }
  bh() {
    return this.r2u_1;
  }
  s2u(propertyAssignments) {
    return new CreateTupleExpressionDefault(propertyAssignments);
  }
  copy(propertyAssignments, $super) {
    propertyAssignments = propertyAssignments === VOID ? this.r2u_1 : propertyAssignments;
    return $super === VOID ? this.s2u(propertyAssignments) : $super.s2u.call(this, propertyAssignments);
  }
  hashCode() {
    return hashCode(this.r2u_1);
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof CreateTupleExpressionDefault))
      return false;
    var tmp0_other_with_cast = other instanceof CreateTupleExpressionDefault ? other : THROW_CCE();
    if (!equals(this.r2u_1, tmp0_other_with_cast.r2u_1))
      return false;
    return true;
  }
  get propertyAssignments() {
    return this.c2u();
  }
}
class CreateObjectExpressionDefault extends ExpressionAbstract {
  constructor(possiblyQualifiedTypeName, constructorArguments) {
    super();
    this.t2g_1 = possiblyQualifiedTypeName;
    this.u2g_1 = constructorArguments;
    this.v2g_1 = emptyList();
  }
  a2u() {
    return this.t2g_1;
  }
  b2u() {
    return this.u2g_1;
  }
  t2u(_set____db54di) {
    this.v2g_1 = _set____db54di;
  }
  c2u() {
    return this.v2g_1;
  }
  x2t(indent, imports) {
    var sb = StringBuilder.j();
    var tmp;
    var tmp$ret$0;
    $l$block_0: {
      // Inline function 'kotlin.collections.any' call
      var tmp_0;
      if (isInterface(imports, Collection)) {
        tmp_0 = imports.a1();
      } else {
        tmp_0 = false;
      }
      if (tmp_0) {
        tmp$ret$0 = false;
        break $l$block_0;
      }
      var _iterator__ex2g4s = imports.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        var it = element.p2i_1;
        if (_Import___get_value__impl__o1bac0(it) === _QualifiedName___get_value__impl__nkc4gq(_QualifiedName___get_front__impl__24j8eq(this.t2g_1.asQualifiedName(null)))) {
          tmp$ret$0 = true;
          break $l$block_0;
        }
      }
      tmp$ret$0 = false;
    }
    if (tmp$ret$0) {
      tmp = _SimpleName___get_value__impl__rl2r3c(this.t2g_1.simpleName);
    } else {
      tmp = this.t2g_1.value;
    }
    var pqn = tmp;
    var cArgs = joinToString(this.u2g_1, ', ', VOID, VOID, VOID, VOID, CreateObjectExpressionDefault$asString$lambda(imports));
    sb.cb(pqn + '(' + cArgs + ') {\n');
    var ni = indent.inc;
    var tmp_1 = this.v2g_1;
    var props = joinToString(tmp_1, '\n', VOID, VOID, VOID, VOID, CreateObjectExpressionDefault$asString$lambda_0(ni, imports));
    sb.cb(props + '\n');
    sb.cb(indent.toString() + '}');
    return sb.toString();
  }
  toString() {
    return toString(this.t2g_1) + ' { ... }';
  }
  bh() {
    return this.t2g_1;
  }
  ch() {
    return this.u2g_1;
  }
  u2u(possiblyQualifiedTypeName, constructorArguments) {
    return new CreateObjectExpressionDefault(possiblyQualifiedTypeName, constructorArguments);
  }
  copy(possiblyQualifiedTypeName, constructorArguments, $super) {
    possiblyQualifiedTypeName = possiblyQualifiedTypeName === VOID ? this.t2g_1 : possiblyQualifiedTypeName;
    constructorArguments = constructorArguments === VOID ? this.u2g_1 : constructorArguments;
    return $super === VOID ? this.u2u(possiblyQualifiedTypeName, constructorArguments) : $super.u2u.call(this, possiblyQualifiedTypeName, constructorArguments);
  }
  hashCode() {
    var result = hashCode(this.t2g_1);
    result = imul(result, 31) + hashCode(this.u2g_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof CreateObjectExpressionDefault))
      return false;
    var tmp0_other_with_cast = other instanceof CreateObjectExpressionDefault ? other : THROW_CCE();
    if (!equals(this.t2g_1, tmp0_other_with_cast.t2g_1))
      return false;
    if (!equals(this.u2g_1, tmp0_other_with_cast.u2g_1))
      return false;
    return true;
  }
  get possiblyQualifiedTypeName() {
    return this.a2u();
  }
  get constructorArguments() {
    return this.b2u();
  }
  get propertyAssignments() {
    return this.c2u();
  }
  set propertyAssignments(value) {
    this.t2u(value);
  }
}
class WithExpressionDefault extends ExpressionAbstract {
  constructor(withContext, expression) {
    super();
    this.v2u_1 = withContext;
    this.w2u_1 = expression;
  }
  k2u() {
    return this.v2u_1;
  }
  v1j() {
    return this.w2u_1;
  }
  x2t(indent, imports) {
    var sb = StringBuilder.j();
    sb.cb('with(' + this.v2u_1.asString(indent, imports) + ') ');
    var ni = indent.inc;
    sb.cb(this.w2u_1.asString(ni, imports));
    return sb.toString();
  }
  toString() {
    return 'with(' + toString(this.v2u_1) + ') ' + toString(this.w2u_1);
  }
  get withContext() {
    return this.k2u();
  }
  get expression() {
    return this.v1j();
  }
}
class WhenExpressionDefault extends ExpressionAbstract {
  constructor(options, elseOption) {
    super();
    this.x2u_1 = options;
    this.y2u_1 = elseOption;
  }
  x1c() {
    return this.x2u_1;
  }
  l2u() {
    return this.y2u_1;
  }
  x2t(indent, imports) {
    var sb = StringBuilder.j();
    sb.cb('when {\n');
    var ni = indent.inc;
    var opts = joinToString(this.x2u_1, '\n', VOID, VOID, VOID, VOID, WhenExpressionDefault$asString$lambda(ni, imports));
    sb.cb(opts + '\n');
    sb.cb(indent.toString() + '}');
    return sb.toString();
  }
  toString() {
    return 'when { ' + joinToString(this.x2u_1, ' ', VOID, VOID, VOID, VOID, WhenExpressionDefault$toString$lambda) + ' }';
  }
  get options() {
    return this.x1c();
  }
  get elseOption() {
    return this.l2u();
  }
}
class WhenOptionDefault {
  constructor(condition, expression) {
    this.z2u_1 = condition;
    this.a2v_1 = expression;
  }
  m2u() {
    return this.z2u_1;
  }
  v1j() {
    return this.a2v_1;
  }
  toString() {
    return toString(this.z2u_1) + ' -> ' + toString(this.a2v_1);
  }
  get condition() {
    return this.m2u();
  }
  get expression() {
    return this.v1j();
  }
}
class WhenOptionElseDefault {
  constructor(expression) {
    this.b2v_1 = expression;
  }
  v1j() {
    return this.b2v_1;
  }
  toString() {
    return 'else -> ' + toString(this.b2v_1);
  }
  get expression() {
    return this.v1j();
  }
}
class OnExpressionDefault extends ExpressionAbstract {
  constructor(expression) {
    super();
    this.c2v_1 = expression;
    this.d2v_1 = emptyList();
  }
  v1j() {
    return this.c2v_1;
  }
  t2u(_set____db54di) {
    this.d2v_1 = _set____db54di;
  }
  c2u() {
    return this.d2v_1;
  }
  get expression() {
    return this.v1j();
  }
  get propertyAssignments() {
    return this.c2u();
  }
  set propertyAssignments(value) {
    this.t2u(value);
  }
}
class Companion_12 {
  constructor() {
    Companion_instance_13 = this;
    this.NOTHING = new RootExpressionDefault('$nothing');
    this.SELF = new RootExpressionDefault('$self');
    this.ERROR = new RootExpressionDefault('$error');
  }
  e2v() {
    return this.NOTHING;
  }
  f2v() {
    return this.SELF;
  }
  g2v() {
    return this.ERROR;
  }
}
class RootExpressionDefault extends ExpressionAbstract {
  constructor(name) {
    Companion_getInstance_15();
    super();
    this.o2j_1 = name;
  }
  e3() {
    return this.o2j_1;
  }
  y2t() {
    return Companion_getInstance_15().NOTHING.equals(this);
  }
  z2t() {
    return Companion_getInstance_15().SELF.equals(this);
  }
  toString() {
    return this.o2j_1;
  }
  hashCode() {
    return getStringHashCode(this.o2j_1);
  }
  equals(other) {
    var tmp;
    if (!(other instanceof RootExpressionDefault)) {
      tmp = false;
    } else {
      tmp = other.o2j_1 === this.o2j_1;
    }
    return tmp;
  }
  bh() {
    return this.o2j_1;
  }
  xo(name) {
    return new RootExpressionDefault(name);
  }
  copy(name, $super) {
    name = name === VOID ? this.o2j_1 : name;
    return $super === VOID ? this.xo(name) : $super.xo.call(this, name);
  }
  get name() {
    return this.e3();
  }
  get isNothing() {
    return this.y2t();
  }
  get isSelf() {
    return this.z2t();
  }
}
class LiteralExpressionDefault extends ExpressionAbstract {
  constructor(qualifiedTypeName, value) {
    super();
    this.h2v_1 = qualifiedTypeName;
    this.i2v_1 = value;
  }
  z2o() {
    return this.h2v_1;
  }
  b3() {
    return this.i2v_1;
  }
  toString() {
    return toString(this.i2v_1);
  }
  j2v() {
    return this.h2v_1;
  }
  ch() {
    return this.i2v_1;
  }
  k2v(qualifiedTypeName, value) {
    return new LiteralExpressionDefault(qualifiedTypeName, value);
  }
  copy(qualifiedTypeName, value, $super) {
    qualifiedTypeName = qualifiedTypeName === VOID ? this.h2v_1 : qualifiedTypeName;
    value = value === VOID ? this.i2v_1 : value;
    return $super === VOID ? this.k2v(qualifiedTypeName, value) : $super.k2v.call(this, new QualifiedName(qualifiedTypeName), value);
  }
  hashCode() {
    var result = QualifiedName__hashCode_impl_dcqht7(this.h2v_1);
    result = imul(result, 31) + hashCode(this.i2v_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof LiteralExpressionDefault))
      return false;
    var tmp0_other_with_cast = other instanceof LiteralExpressionDefault ? other : THROW_CCE();
    if (!(this.h2v_1 === tmp0_other_with_cast.h2v_1))
      return false;
    if (!equals(this.i2v_1, tmp0_other_with_cast.i2v_1))
      return false;
    return true;
  }
  get qualifiedTypeName() {
    return this.z2o();
  }
  get value() {
    return this.b3();
  }
}
class NavigationExpressionDefault extends ExpressionAbstract {
  constructor(start, parts) {
    super();
    this.l2v_1 = start;
    this.m2v_1 = parts;
  }
  qf() {
    return this.l2v_1;
  }
  d2u() {
    return this.m2v_1;
  }
  toString() {
    return toString(this.l2v_1) + joinToString(this.m2v_1, '');
  }
  bh() {
    return this.l2v_1;
  }
  ch() {
    return this.m2v_1;
  }
  n2v(start, parts) {
    return new NavigationExpressionDefault(start, parts);
  }
  copy(start, parts, $super) {
    start = start === VOID ? this.l2v_1 : start;
    parts = parts === VOID ? this.m2v_1 : parts;
    return $super === VOID ? this.n2v(start, parts) : $super.n2v.call(this, start, parts);
  }
  hashCode() {
    var result = hashCode(this.l2v_1);
    result = imul(result, 31) + hashCode(this.m2v_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof NavigationExpressionDefault))
      return false;
    var tmp0_other_with_cast = other instanceof NavigationExpressionDefault ? other : THROW_CCE();
    if (!equals(this.l2v_1, tmp0_other_with_cast.l2v_1))
      return false;
    if (!equals(this.m2v_1, tmp0_other_with_cast.m2v_1))
      return false;
    return true;
  }
  get start() {
    return this.qf();
  }
  get parts() {
    return this.d2u();
  }
}
class PropertyCallDefault {
  constructor(propertyName) {
    this.o2v_1 = propertyName;
  }
  e2u() {
    return this.o2v_1;
  }
  toString() {
    return '.' + this.o2v_1;
  }
  bh() {
    return this.o2v_1;
  }
  xo(propertyName) {
    return new PropertyCallDefault(propertyName);
  }
  copy(propertyName, $super) {
    propertyName = propertyName === VOID ? this.o2v_1 : propertyName;
    return $super === VOID ? this.xo(propertyName) : $super.xo.call(this, propertyName);
  }
  hashCode() {
    return getStringHashCode(this.o2v_1);
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof PropertyCallDefault))
      return false;
    var tmp0_other_with_cast = other instanceof PropertyCallDefault ? other : THROW_CCE();
    if (!(this.o2v_1 === tmp0_other_with_cast.o2v_1))
      return false;
    return true;
  }
  get propertyName() {
    return this.e2u();
  }
}
class MethodCallDefault {
  constructor(methodName, arguments_0) {
    this.p2v_1 = methodName;
    this.q2v_1 = arguments_0;
  }
  f2u() {
    return this.p2v_1;
  }
  g2u() {
    return this.q2v_1;
  }
  toString() {
    return '.' + this.p2v_1 + '(' + joinToString(this.q2v_1) + ')';
  }
  bh() {
    return this.p2v_1;
  }
  ch() {
    return this.q2v_1;
  }
  r2v(methodName, arguments_0) {
    return new MethodCallDefault(methodName, arguments_0);
  }
  copy(methodName, arguments_0, $super) {
    methodName = methodName === VOID ? this.p2v_1 : methodName;
    arguments_0 = arguments_0 === VOID ? this.q2v_1 : arguments_0;
    return $super === VOID ? this.r2v(methodName, arguments_0) : $super.r2v.call(this, methodName, arguments_0);
  }
  hashCode() {
    var result = getStringHashCode(this.p2v_1);
    result = imul(result, 31) + hashCode(this.q2v_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof MethodCallDefault))
      return false;
    var tmp0_other_with_cast = other instanceof MethodCallDefault ? other : THROW_CCE();
    if (!(this.p2v_1 === tmp0_other_with_cast.p2v_1))
      return false;
    if (!equals(this.q2v_1, tmp0_other_with_cast.q2v_1))
      return false;
    return true;
  }
  get methodName() {
    return this.f2u();
  }
  get arguments() {
    return this.g2u();
  }
}
class LambdaExpressionDefault {
  constructor(expression) {
    this.s2v_1 = expression;
  }
  v1j() {
    return this.s2v_1;
  }
  x2t(indent, imports) {
    return '{ ' + this.s2v_1.asString(indent, imports) + '} }';
  }
  toString() {
    return '{ ' + toString(this.s2v_1) + ' }';
  }
  bh() {
    return this.s2v_1;
  }
  t2v(expression) {
    return new LambdaExpressionDefault(expression);
  }
  copy(expression, $super) {
    expression = expression === VOID ? this.s2v_1 : expression;
    return $super === VOID ? this.t2v(expression) : $super.t2v.call(this, expression);
  }
  hashCode() {
    return hashCode(this.s2v_1);
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof LambdaExpressionDefault))
      return false;
    var tmp0_other_with_cast = other instanceof LambdaExpressionDefault ? other : THROW_CCE();
    if (!equals(this.s2v_1, tmp0_other_with_cast.s2v_1))
      return false;
    return true;
  }
  get expression() {
    return this.v1j();
  }
}
class IndexOperationDefault {
  constructor(indices) {
    this.u2v_1 = indices;
  }
  h2u() {
    return this.u2v_1;
  }
  toString() {
    return '[' + joinToString(this.u2v_1, VOID, VOID, VOID, VOID, VOID, IndexOperationDefault$toString$lambda) + ']';
  }
  bh() {
    return this.u2v_1;
  }
  v2v(indices) {
    return new IndexOperationDefault(indices);
  }
  copy(indices, $super) {
    indices = indices === VOID ? this.u2v_1 : indices;
    return $super === VOID ? this.v2v(indices) : $super.v2v.call(this, indices);
  }
  hashCode() {
    return hashCode(this.u2v_1);
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof IndexOperationDefault))
      return false;
    var tmp0_other_with_cast = other instanceof IndexOperationDefault ? other : THROW_CCE();
    if (!equals(this.u2v_1, tmp0_other_with_cast.u2v_1))
      return false;
    return true;
  }
  get indices() {
    return this.h2u();
  }
}
class AssignmentStatementDefault {
  constructor(lhsPropertyName, lhsGrammarRuleIndex, rhs) {
    this.w2v_1 = lhsPropertyName;
    this.x2v_1 = lhsGrammarRuleIndex;
    this.y2v_1 = rhs;
  }
  i2u() {
    return this.w2v_1;
  }
  j2u() {
    return this.x2v_1;
  }
  l12() {
    return this.y2v_1;
  }
  x2t(indent, imports) {
    return this.w2v_1 + ' := ' + this.y2v_1.asString(indent, imports);
  }
  toString() {
    return this.w2v_1 + ' := ' + toString(this.y2v_1);
  }
  get lhsPropertyName() {
    return this.i2u();
  }
  get lhsGrammarRuleIndex() {
    return this.j2u();
  }
  get rhs() {
    return this.l12();
  }
}
class InfixExpressionDefault {
  constructor(expressions, operators) {
    this.z2v_1 = expressions;
    this.a2w_1 = operators;
  }
  i21() {
    return this.z2v_1;
  }
  b1d() {
    return this.a2w_1;
  }
  x2t(indent, imports) {
    return indent.toString() + this.toString();
  }
  toString() {
    var tmp = toString(first(this.z2v_1));
    var tmp_0 = get_indices(this.a2w_1);
    return tmp + ' ' + joinToString(tmp_0, VOID, VOID, VOID, VOID, VOID, InfixExpressionDefault$toString$lambda(this));
  }
  get expressions() {
    return this.i21();
  }
  get operators() {
    return this.b1d();
  }
}
class CastExpressionDefault {
  constructor(expression, targetType) {
    this.b2w_1 = expression;
    this.c2w_1 = targetType;
  }
  v1j() {
    return this.b2w_1;
  }
  n2u() {
    return this.c2w_1;
  }
  x2t(indent, imports) {
    var ttn = this.c2w_1.asString(indent, imports);
    return this.b2w_1.asString(indent, imports) + ' as ' + ttn;
  }
  toString() {
    return toString(this.b2w_1) + ' as ' + toString(this.c2w_1);
  }
  get expression() {
    return this.v1j();
  }
  get targetType() {
    return this.n2u();
  }
}
class TypeTestExpressionDefault {
  constructor(expression, targetType) {
    this.d2w_1 = expression;
    this.e2w_1 = targetType;
  }
  v1j() {
    return this.d2w_1;
  }
  n2u() {
    return this.e2w_1;
  }
  x2t(indent, imports) {
    var ttn = this.e2w_1.asString(indent, imports);
    return this.d2w_1.asString(indent, imports) + ' as ' + ttn;
  }
  toString() {
    return toString(this.d2w_1) + ' as ' + toString(this.e2w_1);
  }
  get expression() {
    return this.v1j();
  }
  get targetType() {
    return this.n2u();
  }
}
class TypeReferenceDefault {
  constructor(possiblyQualifiedName, typeArguments, isNullable) {
    this.f2w_1 = possiblyQualifiedName;
    this.g2w_1 = typeArguments;
    this.h2w_1 = isNullable;
  }
  o2u() {
    return this.f2w_1;
  }
  p2u() {
    return this.g2w_1;
  }
  q2u() {
    return this.h2w_1;
  }
  asString(indent, imports) {
    var tmp;
    var tmp$ret$0;
    $l$block_0: {
      // Inline function 'kotlin.collections.any' call
      var tmp_0;
      if (isInterface(imports, Collection)) {
        tmp_0 = imports.a1();
      } else {
        tmp_0 = false;
      }
      if (tmp_0) {
        tmp$ret$0 = false;
        break $l$block_0;
      }
      var _iterator__ex2g4s = imports.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        var it = element.p2i_1;
        if (_QualifiedName___get_value__impl__nkc4gq(_Import___get_asQualifiedName__impl__htdpak(it)) === this.f2w_1.value) {
          tmp$ret$0 = true;
          break $l$block_0;
        }
      }
      tmp$ret$0 = false;
    }
    if (tmp$ret$0) {
      tmp = _SimpleName___get_value__impl__rl2r3c(this.f2w_1.simpleName);
    } else {
      tmp = this.f2w_1.value;
    }
    var tn = tmp;
    var tmp_1;
    if (this.g2w_1.a1()) {
      tmp_1 = '';
    } else {
      tmp_1 = '<' + joinToString(this.g2w_1, VOID, VOID, VOID, VOID, VOID, TypeReferenceDefault$asString$lambda(indent, imports)) + '>';
    }
    var targs = tmp_1;
    return tn + targs;
  }
  toString() {
    return this.f2w_1.value + ': ' + toString(this.g2w_1) + ' ' + (this.h2w_1 ? '?' : '');
  }
  bh() {
    return this.f2w_1;
  }
  ch() {
    return this.g2w_1;
  }
  ds() {
    return this.h2w_1;
  }
  i2w(possiblyQualifiedName, typeArguments, isNullable) {
    return new TypeReferenceDefault(possiblyQualifiedName, typeArguments, isNullable);
  }
  copy(possiblyQualifiedName, typeArguments, isNullable, $super) {
    possiblyQualifiedName = possiblyQualifiedName === VOID ? this.f2w_1 : possiblyQualifiedName;
    typeArguments = typeArguments === VOID ? this.g2w_1 : typeArguments;
    isNullable = isNullable === VOID ? this.h2w_1 : isNullable;
    return $super === VOID ? this.i2w(possiblyQualifiedName, typeArguments, isNullable) : $super.i2w.call(this, possiblyQualifiedName, typeArguments, isNullable);
  }
  hashCode() {
    var result = hashCode(this.f2w_1);
    result = imul(result, 31) + hashCode(this.g2w_1) | 0;
    result = imul(result, 31) + getBooleanHashCode(this.h2w_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof TypeReferenceDefault))
      return false;
    var tmp0_other_with_cast = other instanceof TypeReferenceDefault ? other : THROW_CCE();
    if (!equals(this.f2w_1, tmp0_other_with_cast.f2w_1))
      return false;
    if (!equals(this.g2w_1, tmp0_other_with_cast.g2w_1))
      return false;
    if (!(this.h2w_1 === tmp0_other_with_cast.h2w_1))
      return false;
    return true;
  }
  get possiblyQualifiedName() {
    return this.o2u();
  }
  get typeArguments() {
    return this.p2u();
  }
  get isNullable() {
    return this.q2u();
  }
}
class GroupExpressionDefault {
  constructor(expression) {
    this.j2w_1 = expression;
  }
  v1j() {
    return this.j2w_1;
  }
  x2t(indent, imports) {
    return '(' + this.j2w_1.asString(indent, imports) + ')';
  }
  toString() {
    return '(' + toString(this.j2w_1) + ')';
  }
  get expression() {
    return this.v1j();
  }
}
class AglExpressions_0 extends LanguageObjectAbstract {
  constructor() {
    AglExpressions_instance = null;
    super();
    AglExpressions_instance = this;
    this.NAMESPACE_NAME = 'net.akehurst.language';
    this.NAME = 'Expressions';
    this.b23_1 = _LanguageIdentity___init__impl__3hnnkb('net.akehurst.language.Expressions');
    this.c23_1 = "namespace net.akehurst.language\n  grammar Expressions : Base {\n    expression\n      = rootExpression\n      | literalExpression\n      | navigationExpression\n      | infixExpression\n      | tuple\n      | object\n      | with\n      | when\n      | cast\n      | typeTest\n      | group\n      ;\n    rootExpression = propertyReference ;\n    literalExpression = literal ;\n    \n    navigationExpression = navigationRoot navigationPart+ ;\n    navigationRoot \n     = rootExpression\n     | literalExpression\n     | group\n    ;\n    navigationPart\n     = propertyCall\n     | methodCall\n     | indexOperation\n    ;\n    \n    infixExpression = [expression / INFIX_OPERATOR]2+ ;\n    leaf INFIX_OPERATOR\n      = 'or' | 'and' | 'xor'  // logical \n      | '==' | '!=' | '<=' | '>=' | '<' | '>'  // comparison\n      | '/' | '*' | '%' | '+' | '-' // arithmetic\n      ;\n    \n    object = possiblyQualifiedName constructorArguments assignmentBlock? ;\n    constructorArguments = '(' assignmentList ')' ;\n\n    tuple = 'tuple' assignmentBlock ;\n    assignmentBlock = '{' assignmentList  '}' ;\n    assignmentList = assignment* ;\n    assignment = propertyName grammarRuleIndex? ':=' expression ;\n    propertyName = SPECIAL | IDENTIFIER ;\n    grammarRuleIndex = '$' POSITIVE_INTEGER ;\n        \n    with = 'with' '(' expression ')' expression ;\n    \n    when = 'when' '{' whenOption+ whenOptionElse '}' ;\n    whenOption = expression '->' expression ;\n    whenOptionElse = 'else' '->' expression ;\n    \n    cast = expression 'as' typeReference ;\n    typeTest = expression 'is' typeReference ;\n    \n    group = '(' expression ')' ;\n    \n    propertyCall = '.' propertyReference ;\n    methodCall = '.' methodReference '(' argumentList ')' lambda? ;\n    argumentList = [expression / ',']* ;\n    \n    lambda = '{' expression '}' ;\n    \n    propertyReference = SPECIAL | IDENTIFIER ;\n    methodReference = IDENTIFIER ;\n    indexOperation = '[' indexList ']' ;\n    indexList = [expression / ',']+ ;\n    \n    typeReference = possiblyQualifiedName typeArgumentList? '?'?;\n    typeArgumentList = '<' [ typeReference / ',']+ '>' ;\n    \n    literal = BOOLEAN | INTEGER | REAL | STRING ;\n\n    leaf SPECIAL = '$' IDENTIFIER ;\n    leaf BOOLEAN = \"true|false\" ;\n    leaf INTEGER = \"[0-9]+\" ;\n    leaf REAL = \"[0-9]+[.][0-9]+\" ;\n    leaf STRING = \"'([^'\\\\\\\\]|\\\\\\\\.)*'\" ;\n    leaf POSITIVE_INTEGER = \"[0-9]+\" ;\n  }";
    this.d23_1 = 'namespace net.akehurst.language.expressions.api\n    interface CreateTupleExpression {\n        cmp propertyAssignments\n    }\n    interface CreateObjectExpression {\n        cmp arguments\n    }\n    interface WithExpression {\n        cmp withContext\n        cmp expression\n    }\n    interface WhenExpression {\n        cmp options\n    }\n    interface WhenOption {\n        cmp condition\n        cmp expression\n    }\n    interface OnExpression {\n        cmp expression\n    }\n    interface NavigationExpression {\n        cmp start\n        cmp parts\n    }\n    interface MethodCall {\n        cmp arguments\n    }\n    interface IndexOperation {\n        cmp indices\n    }\n    interface AssignmentStatement {\n        cmp rhs\n    }\n    interface InfixExpression {\n        cmp expressions\n    }';
    this.e23_1 = "namespace net.akehurst.language\n  styles Expressions {\n    $$ \"'[^']+'\" {\n      foreground: darkgreen;\n      font-weight: bold;\n    }\n  }";
    var tmp = this;
    tmp.f23_1 = lazy(AglExpressions$grammarModel$delegate$lambda);
    var tmp_0 = this;
    tmp_0.g23_1 = lazy(AglExpressions$typesModel$delegate$lambda);
    var tmp_1 = this;
    tmp_1.h23_1 = lazy(AglExpressions$asmTransformModel$delegate$lambda);
    var tmp_2 = this;
    tmp_2.i23_1 = lazy(AglExpressions$crossReferenceModel$delegate$lambda);
    var tmp_3 = this;
    tmp_3.j23_1 = lazy(AglExpressions$formatModel$delegate$lambda);
    var tmp_4 = this;
    tmp_4.k23_1 = lazy(AglExpressions$styleModel$delegate$lambda);
    var tmp_5 = this;
    tmp_5.l23_1 = lazy(AglExpressions$defaultTargetGrammar$delegate$lambda);
    this.m23_1 = 'expression';
    var tmp_6 = this;
    tmp_6.n23_1 = lazy(AglExpressions$syntaxAnalyser$delegate$lambda);
    var tmp_7 = this;
    tmp_7.o23_1 = lazy(AglExpressions$semanticAnalyser$delegate$lambda);
    var tmp_8 = this;
    tmp_8.p23_1 = lazy(AglExpressions$completionProvider$delegate$lambda);
  }
  u2t() {
    return this.NAMESPACE_NAME;
  }
  v2t() {
    return this.NAME;
  }
  g1u() {
    return this.b23_1;
  }
  u2n() {
    return this.c23_1;
  }
  w2n() {
    return this.d23_1;
  }
  z2n() {
    return this.e23_1;
  }
  i1u() {
    var tmp0 = this.f23_1;
    // Inline function 'kotlin.getValue' call
    grammarModel$factory_2();
    return tmp0.b3();
  }
  p1u() {
    var tmp0 = this.g23_1;
    // Inline function 'kotlin.getValue' call
    typesModel$factory_0();
    return tmp0.b3();
  }
  j2k() {
    var tmp0 = this.h23_1;
    // Inline function 'kotlin.getValue' call
    asmTransformModel$factory_0();
    return tmp0.b3();
  }
  r1u() {
    var tmp0 = this.i23_1;
    // Inline function 'kotlin.getValue' call
    crossReferenceModel$factory_1();
    return tmp0.b3();
  }
  i1t() {
    var tmp0 = this.j23_1;
    // Inline function 'kotlin.getValue' call
    formatModel$factory_1();
    return tmp0.b3();
  }
  w1u() {
    var tmp0 = this.k23_1;
    // Inline function 'kotlin.getValue' call
    styleModel$factory_0();
    return tmp0.b3();
  }
  c2o() {
    var tmp0 = this.l23_1;
    // Inline function 'kotlin.getValue' call
    defaultTargetGrammar$factory_0();
    return tmp0.b3();
  }
  d2o() {
    return this.m23_1;
  }
  s1u() {
    var tmp0 = this.n23_1;
    // Inline function 'kotlin.getValue' call
    syntaxAnalyser$factory_1();
    return tmp0.b3();
  }
  t1u() {
    var tmp0 = this.o23_1;
    // Inline function 'kotlin.getValue' call
    semanticAnalyser$factory_1();
    return tmp0.b3();
  }
  p1y() {
    var tmp0 = this.p23_1;
    // Inline function 'kotlin.getValue' call
    completionProvider$factory_1();
    return tmp0.b3();
  }
  toString() {
    return 'net.akehurst.language.Grammar';
  }
}
class ExpressionTypeResolver {
  constructor(typeModel, contextNamespace, issues) {
    this.typeModel = typeModel;
    this.contextNamespace = contextNamespace;
    this.issues = issues;
  }
  m2e() {
    return this.typeModel;
  }
  l2w() {
    return this.contextNamespace;
  }
  n16() {
    return this.issues;
  }
  typeFor(expression, self_0) {
    return this.typeOfExpressionFor(expression, self_0);
  }
  typeOfExpressionStr(expression, self_0) {
    var result = ensureNotNull(Agl_getInstance().registry.agl.expressions.processor).process(expression);
    // Inline function 'kotlin.check' call
    if (!result.allIssues.errors.a1()) {
      var message = toString(result.allIssues);
      throw IllegalStateException.v4(toString(message));
    }
    var asm = ensureNotNull(result.asm);
    return this.typeOfExpressionFor(asm, self_0.type());
  }
  typeOfExpressionFor(_this__u8e3s4, self_0) {
    var tmp;
    if (isInterface(_this__u8e3s4, RootExpression)) {
      tmp = this.typeOfRootExpressionFor(_this__u8e3s4, self_0);
    } else {
      if (isInterface(_this__u8e3s4, LiteralExpression)) {
        tmp = this.typeOfLiteralExpressionFor(_this__u8e3s4, self_0);
      } else {
        if (isInterface(_this__u8e3s4, CreateObjectExpression)) {
          tmp = this.typeOfCreateObjectExpressionFor(_this__u8e3s4, self_0);
        } else {
          if (isInterface(_this__u8e3s4, CreateTupleExpression)) {
            tmp = this.typeOfCreateTupleExpressionFor(_this__u8e3s4, self_0);
          } else {
            if (isInterface(_this__u8e3s4, OnExpression)) {
              tmp = this.typeOfOnExpressionFor(_this__u8e3s4, self_0);
            } else {
              if (isInterface(_this__u8e3s4, NavigationExpression)) {
                tmp = this.typeOfNavigationExpressionFor(_this__u8e3s4, self_0);
              } else {
                if (isInterface(_this__u8e3s4, LambdaExpression)) {
                  tmp = this.typeOfLambdaExpressionFor(_this__u8e3s4, self_0);
                } else {
                  if (isInterface(_this__u8e3s4, WithExpression)) {
                    tmp = this.typeOfWithExpressionFor(_this__u8e3s4, self_0);
                  } else {
                    if (isInterface(_this__u8e3s4, WhenExpression)) {
                      tmp = this.typeOfWhenExpressionFor(_this__u8e3s4, self_0);
                    } else {
                      if (isInterface(_this__u8e3s4, InfixExpression)) {
                        tmp = this.typeOfInfixExpressionFor(_this__u8e3s4, self_0);
                      } else {
                        if (isInterface(_this__u8e3s4, CastExpression)) {
                          tmp = this.typeOfCastExpressionFor(_this__u8e3s4, self_0);
                        } else {
                          if (isInterface(_this__u8e3s4, GroupExpression)) {
                            tmp = this.typeOfGroupExpressionFor(_this__u8e3s4, self_0);
                          } else {
                            var message = "Subtype of Expression not handled in 'typeOfExpressionFor' : '" + getKClassFromExpression(_this__u8e3s4).zc() + "'";
                            throw IllegalStateException.v4(toString(message));
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    return tmp;
  }
  typeOfLiteralExpressionFor(_this__u8e3s4, self_0) {
    var tmp0_safe_receiver = this.typeModel.findByQualifiedNameOrNull(_this__u8e3s4.qualifiedTypeName);
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.type();
    return tmp1_elvis_lhs == null ? StdLibDefault_getInstance().NothingType : tmp1_elvis_lhs;
  }
  typeOfRootExpressionFor(_this__u8e3s4, self_0) {
    var tmp;
    if (_this__u8e3s4.isNothing) {
      tmp = StdLibDefault_getInstance().NothingType;
    } else if (_this__u8e3s4.isSelf) {
      tmp = self_0;
    } else {
      var tmp0_subject = self_0.resolvedDeclaration;
      var tmp_0;
      if (isInterface(tmp0_subject, StructuredType)) {
        var tmp1_safe_receiver = self_0.allResolvedProperty.z2(new PropertyName(_PropertyName___init__impl__sz2wu9(_this__u8e3s4.name)));
        var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.typeInstance;
        var tmp_1;
        if (tmp2_elvis_lhs == null) {
          // Inline function 'kotlin.run' call
          this.issues.error(null, "'" + toString(self_0) + "' has no property named '" + _this__u8e3s4.name + "'");
          tmp_1 = StdLibDefault_getInstance().NothingType;
        } else {
          tmp_1 = tmp2_elvis_lhs;
        }
        tmp_0 = tmp_1;
      } else {
        this.issues.error(null, "'" + toString(self_0) + "' is not a StructuredType cannot access property named '" + _this__u8e3s4.name + "'");
        tmp_0 = StdLibDefault_getInstance().NothingType;
      }
      tmp = tmp_0;
    }
    return tmp;
  }
  typeOfNavigationExpressionFor(_this__u8e3s4, self_0) {
    var st = _this__u8e3s4.start;
    var tmp;
    if (isInterface(st, LiteralExpression)) {
      throw NotImplementedError.uj();
    } else {
      if (isInterface(st, RootExpression)) {
        var tmp_0;
        if (st.isNothing) {
          tmp_0 = StdLibDefault_getInstance().NothingType;
        } else if (st.isSelf) {
          tmp_0 = self_0;
        } else {
          var tmp1_safe_receiver = self_0.allResolvedProperty.z2(new PropertyName(_PropertyName___init__impl__sz2wu9(st.name)));
          tmp_0 = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.typeInstance;
        }
        tmp = tmp_0;
      } else {
        var message = 'type of Navigation.start not handled';
        throw IllegalStateException.v4(toString(message));
      }
    }
    var start = tmp;
    // Inline function 'kotlin.collections.fold' call
    var accumulator = start;
    var _iterator__ex2g4s = _this__u8e3s4.parts.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var acc = accumulator;
      accumulator = acc == null ? StdLibDefault_getInstance().NothingType : this.typeOfNavigationPartFor(element, acc);
    }
    var r = accumulator;
    return r == null ? StdLibDefault_getInstance().NothingType : r;
  }
  typeOfNavigationPartFor(_this__u8e3s4, self_0) {
    var tmp;
    if (isInterface(_this__u8e3s4, PropertyCall)) {
      tmp = this.typeOfPropertyCallFor(_this__u8e3s4, self_0);
    } else {
      if (isInterface(_this__u8e3s4, MethodCall)) {
        tmp = this.typeOfMethodCallFor(_this__u8e3s4, self_0);
      } else {
        if (isInterface(_this__u8e3s4, IndexOperation)) {
          tmp = this.typeOfIndexOperationFor(_this__u8e3s4, self_0);
        } else {
          var message = 'subtype of NavigationPart not handled';
          throw IllegalStateException.v4(toString(message));
        }
      }
    }
    return tmp;
  }
  lastPropertyDeclarationFor(expr, self_0) {
    var st = expr.start;
    var tmp;
    if (isInterface(st, LiteralExpression)) {
      tmp = null;
    } else {
      if (isInterface(st, RootExpression)) {
        var tmp_0;
        if (st.isNothing) {
          tmp_0 = null;
        } else if (st.isSelf) {
          tmp_0 = null;
        } else {
          tmp_0 = self_0.allResolvedProperty.z2(new PropertyName(_PropertyName___init__impl__sz2wu9(st.name)));
        }
        tmp = tmp_0;
      } else {
        var message = 'type of Navigation.start not handled';
        throw IllegalStateException.v4(toString(message));
      }
    }
    var pd = tmp;
    var tmp1_safe_receiver = pd;
    var acc = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.typeInstance;
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = expr.parts.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp_1;
      if (isInterface(element, PropertyCall)) {
        var tmp1_safe_receiver_0 = acc;
        var tmp2_safe_receiver = tmp1_safe_receiver_0 == null ? null : tmp1_safe_receiver_0.allResolvedProperty;
        tmp_1 = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.z2(new PropertyName(_PropertyName___init__impl__sz2wu9(element.propertyName)));
      } else {
        tmp_1 = null;
      }
      pd = tmp_1;
      var tmp3_safe_receiver = pd;
      acc = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.typeInstance;
    }
    var r = Unit_instance;
    return pd;
  }
  typeOfPropertyCallFor(_this__u8e3s4, self_0) {
    var tmp1_safe_receiver = self_0 == null ? null : self_0.allResolvedProperty;
    var tmp2_safe_receiver = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.z2(new PropertyName(_PropertyName___init__impl__sz2wu9(_this__u8e3s4.propertyName)));
    var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.typeInstance;
    return tmp3_elvis_lhs == null ? StdLibDefault_getInstance().NothingType : tmp3_elvis_lhs;
  }
  typeOfMethodCallFor(_this__u8e3s4, self_0) {
    var tmp1_safe_receiver = self_0 == null ? null : self_0.allResolvedMethod;
    var tmp2_safe_receiver = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.z2(new MethodName(_MethodName___init__impl__2ggy8b(_this__u8e3s4.methodName)));
    var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.returnType;
    return tmp3_elvis_lhs == null ? StdLibDefault_getInstance().NothingType : tmp3_elvis_lhs;
  }
  typeOfIndexOperationFor(_this__u8e3s4, self_0) {
    var tmp1_safe_receiver = self_0 == null ? null : self_0.typeArguments;
    var tmp2_safe_receiver = tmp1_safe_receiver == null ? null : firstOrNull(tmp1_safe_receiver);
    var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.type;
    return tmp3_elvis_lhs == null ? StdLibDefault_getInstance().NothingType : tmp3_elvis_lhs;
  }
  typeOfWithExpressionFor(_this__u8e3s4, self_0) {
    var ctxType = this.typeOfExpressionFor(_this__u8e3s4.withContext, self_0);
    return this.typeOfExpressionFor(_this__u8e3s4.expression, ctxType);
  }
  typeOfWhenExpressionFor(_this__u8e3s4, self_0) {
    // Inline function 'kotlin.collections.map' call
    var this_0 = _this__u8e3s4.options;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = this.typeOfExpressionFor(item.expression, self_0);
      destination.r(tmp$ret$0);
    }
    var opts = destination;
    return this.commonSuperTypeOf(opts);
  }
  typeOfInfixExpressionFor(_this__u8e3s4, self_0) {
    var result = this.typeOfExpressionFor(first(_this__u8e3s4.expressions), self_0);
    var inductionVariable = 0;
    var last = _this__u8e3s4.operators.v() - 1 | 0;
    if (inductionVariable <= last)
      do {
        var i = inductionVariable;
        inductionVariable = inductionVariable + 1 | 0;
        var op = _this__u8e3s4.operators.z(i);
        var rhsExpr = _this__u8e3s4.expressions.z(i + 1 | 0);
        var rhs = this.typeOfExpressionFor(rhsExpr, self_0);
        result = typeOfInfixOperator(this, result, op, rhs);
      }
       while (inductionVariable <= last);
    return result;
  }
  typeOfCreateObjectExpressionFor(_this__u8e3s4, self_0) {
    var tmp0_safe_receiver = this.typeModel.findFirstDefinitionByPossiblyQualifiedNameOrNull(_this__u8e3s4.possiblyQualifiedTypeName);
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.type();
    return tmp1_elvis_lhs == null ? StdLibDefault_getInstance().NothingType : tmp1_elvis_lhs;
  }
  typeOfCreateTupleExpressionFor(_this__u8e3s4, self_0) {
    // Inline function 'kotlin.collections.map' call
    var this_0 = _this__u8e3s4.propertyAssignments;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var t = this.typeFor(item.rhs, self_0);
      var n = _PropertyName___init__impl__sz2wu9(item.lhsPropertyName);
      var tmp$ret$0 = new TypeArgumentNamedSimple(n, t);
      destination.r(tmp$ret$0);
    }
    var args = destination;
    return StdLibDefault_getInstance().TupleType.typeTuple(args);
  }
  typeOfOnExpressionFor(_this__u8e3s4, self_0) {
    // Inline function 'kotlin.TODO' call
    throw NotImplementedError.uj();
  }
  typeOfLambdaExpressionFor(_this__u8e3s4, self_0) {
    // Inline function 'kotlin.TODO' call
    throw NotImplementedError.uj();
  }
  typeOfCastExpressionFor(_this__u8e3s4, self_0) {
    return this.typeOfTypeReference(_this__u8e3s4.targetType);
  }
  typeOfGroupExpressionFor(_this__u8e3s4, self_0) {
    return this.typeOfExpressionFor(_this__u8e3s4.expression, self_0);
  }
  typeOfTypeReference(_this__u8e3s4) {
    // Inline function 'kotlin.collections.map' call
    var this_0 = _this__u8e3s4.typeArguments;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      // Inline function 'kotlin.collections.map' call
      var this_1 = item.typeArguments;
      // Inline function 'kotlin.collections.mapTo' call
      var destination_0 = ArrayList.w(collectionSizeOrDefault(this_1, 10));
      var _iterator__ex2g4s_0 = this_1.s();
      while (_iterator__ex2g4s_0.t()) {
        var item_0 = _iterator__ex2g4s_0.u();
        var tmp$ret$0 = this.typeOfTypeReference(item_0).asTypeArgument;
        destination_0.r(tmp$ret$0);
      }
      var argTArgs = destination_0;
      var tmp$ret$3 = this.contextNamespace.createTypeInstance(null, item.possiblyQualifiedName, argTArgs, item.isNullable).asTypeArgument;
      destination.r(tmp$ret$3);
    }
    var targs = destination;
    return this.contextNamespace.createTypeInstance(null, _this__u8e3s4.possiblyQualifiedName, targs, _this__u8e3s4.isNullable);
  }
  commonSuperTypeOf(types) {
    var tmp;
    if (toSet(types).v() === 1) {
      tmp = first(types);
    } else {
      // Inline function 'kotlin.collections.reduce' call
      var iterator = types.s();
      if (!iterator.t())
        throw UnsupportedOperationException.j9("Empty collection can't be reduced.");
      var accumulator = iterator.u();
      while (iterator.t()) {
        var tmp1 = accumulator;
        var it = iterator.u();
        accumulator = tmp1.commonSuperType(it);
      }
      tmp = accumulator;
    }
    return tmp;
  }
}
class ExpressionsCompletionProvider extends CompletionProviderAbstract {}
class Companion_13 {
  m2w(namedValues, parent) {
    return new EvaluationContext(parent, namedValues);
  }
  of(namedValues, parent, $super) {
    parent = parent === VOID ? null : parent;
    return $super === VOID ? this.m2w(namedValues, parent) : $super.m2w.call(this, namedValues, parent);
  }
  ofSelf(self_0) {
    return this.of(mapOf(to(Companion_getInstance_15().SELF.o2j_1, self_0)));
  }
}
class EvaluationContext {
  constructor(parent, namedValues) {
    this.parent = parent;
    this.namedValues = namedValues;
    this.self = this.namedValues.z2(Companion_getInstance_15().SELF.o2j_1);
  }
  ox() {
    return this.parent;
  }
  n2w() {
    return this.namedValues;
  }
  o2w() {
    return this.self;
  }
  getOrInParent(name) {
    var tmp0_elvis_lhs = this.namedValues.z2(name);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp1_safe_receiver = this.parent;
      tmp = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.getOrInParent(name);
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  child(namedValues) {
    return Companion_instance_14.of(namedValues, this);
  }
  toString() {
    var sb = StringBuilder.j();
    var tmp0_safe_receiver = this.parent;
    if (tmp0_safe_receiver == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      sb.cb(tmp0_safe_receiver.toString());
      sb.cb('----------\n');
    }
    // Inline function 'kotlin.collections.forEach' call
    // Inline function 'kotlin.collections.iterator' call
    var _iterator__ex2g4s = this.namedValues.w2().s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      sb.cb(element.a3());
      sb.cb(' := ');
      sb.cb(toString(element.b3()));
      sb.cb('\n');
    }
    return sb.toString();
  }
  bh() {
    return this.parent;
  }
  ch() {
    return this.namedValues;
  }
  p2w(parent, namedValues) {
    return new EvaluationContext(parent, namedValues);
  }
  copy(parent, namedValues, $super) {
    parent = parent === VOID ? this.parent : parent;
    namedValues = namedValues === VOID ? this.namedValues : namedValues;
    return $super === VOID ? this.p2w(parent, namedValues) : $super.p2w.call(this, parent, namedValues);
  }
  hashCode() {
    var result = this.parent == null ? 0 : this.parent.hashCode();
    result = imul(result, 31) + hashCode(this.namedValues) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof EvaluationContext))
      return false;
    var tmp0_other_with_cast = other instanceof EvaluationContext ? other : THROW_CCE();
    if (!equals(this.parent, tmp0_other_with_cast.parent))
      return false;
    if (!equals(this.namedValues, tmp0_other_with_cast.namedValues))
      return false;
    return true;
  }
}
class TypedObject {}
class ExpressionsInterpreterOverTypedObject {
  constructor(objectGraph, issues) {
    this.objectGraph = objectGraph;
    this.issues = issues;
    this.typeModel = this.objectGraph.typeModel;
  }
  r2w() {
    return this.objectGraph;
  }
  n16() {
    return this.issues;
  }
  m2e() {
    return this.typeModel;
  }
  evaluateStr(evc, expression) {
    var result = ensureNotNull(Agl_getInstance().registry.agl.expressions.processor).process(expression);
    // Inline function 'kotlin.check' call
    if (!result.allIssues.errors.a1()) {
      var message = toString(result.allIssues);
      throw IllegalStateException.v4(toString(message));
    }
    var asm = ensureNotNull(result.asm);
    return this.evaluateExpression(evc, asm);
  }
  evaluateExpression(evc, expression) {
    var tmp;
    if (isInterface(expression, RootExpression)) {
      tmp = evaluateRootExpression(this, evc, expression);
    } else {
      if (isInterface(expression, LiteralExpression)) {
        tmp = evaluateLiteralExpression(this, expression);
      } else {
        if (isInterface(expression, CreateObjectExpression)) {
          tmp = evaluateCreateObject(this, evc, expression);
        } else {
          if (isInterface(expression, CreateTupleExpression)) {
            tmp = evaluateCreateTuple(this, evc, expression);
          } else {
            if (isInterface(expression, OnExpression)) {
              throw NotImplementedError.uj();
            } else {
              if (isInterface(expression, NavigationExpression)) {
                tmp = evaluateNavigation(this, evc, expression);
              } else {
                if (isInterface(expression, LambdaExpression)) {
                  tmp = evaluateLambda(this, evc, expression);
                } else {
                  if (isInterface(expression, WithExpression)) {
                    tmp = evaluateWith(this, evc, expression);
                  } else {
                    if (isInterface(expression, WhenExpression)) {
                      tmp = evaluateWhen(this, evc, expression);
                    } else {
                      if (isInterface(expression, InfixExpression)) {
                        tmp = evaluateInfix(this, evc, expression);
                      } else {
                        if (isInterface(expression, CastExpression)) {
                          tmp = evaluateCast(this, evc, expression);
                        } else {
                          if (isInterface(expression, TypeTestExpression)) {
                            tmp = evaluateTypeTest(this, evc, expression);
                          } else {
                            if (isInterface(expression, GroupExpression)) {
                              tmp = evaluateGroup(this, evc, expression);
                            } else {
                              var message = "Subtype of Expression not handled in evaluateExpression '" + getKClassFromExpression(expression).zc() + "'";
                              throw IllegalStateException.v4(toString(message));
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    return tmp;
  }
  evaluateTypeReference(typeReference) {
    var tmp0_elvis_lhs = this.typeModel.findFirstDefinitionByPossiblyQualifiedNameOrNull(typeReference.possiblyQualifiedName);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = 'Type not found ' + toString(typeReference.possiblyQualifiedName);
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var decl = tmp;
    // Inline function 'kotlin.collections.map' call
    var this_0 = typeReference.typeArguments;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = this.evaluateTypeReference(item).asTypeArgument;
      destination.r(tmp$ret$0);
    }
    var targs = destination;
    return decl.type(targs, typeReference.isNullable);
  }
}
class ExpressionsSemanticAnalyser {
  constructor() {
    this.s2w_1 = new IssueHolder(LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance());
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.t2w_1 = ArrayList.y();
    this.u2w_1 = new LocationMapDefault();
    this.v2w_1 = null;
  }
  clear() {
    this.v2w_1 = null;
    this.u2w_1.clear();
    this.s2w_1.clear();
    this.t2w_1.n2();
  }
  w2w(sentenceIdentity, asm, locationMap, options) {
    return new SemanticAnalysisResultDefault(this.t2w_1, this.s2w_1);
  }
  y2j(sentenceIdentity, asm, locationMap, options) {
    return this.w2w(sentenceIdentity, isInterface(asm, Expression) ? asm : THROW_CCE(), locationMap, options);
  }
}
class PropertyValue {
  constructor(asmObject, value) {
    this.asmObject = asmObject;
    this.value = value;
  }
  x2w() {
    return this.asmObject;
  }
  b3() {
    return this.value;
  }
  bh() {
    return this.asmObject;
  }
  ch() {
    return this.value;
  }
  y2w(asmObject, value) {
    return new PropertyValue(asmObject, value);
  }
  copy(asmObject, value, $super) {
    asmObject = asmObject === VOID ? this.asmObject : asmObject;
    value = value === VOID ? this.value : value;
    return $super === VOID ? this.y2w(asmObject, value) : $super.y2w.call(this, asmObject, value);
  }
  toString() {
    return 'PropertyValue(asmObject=' + toString(this.asmObject) + ', value=' + this.value + ')';
  }
  hashCode() {
    var result = hashCode(this.asmObject);
    result = imul(result, 31) + getStringHashCode(this.value) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof PropertyValue))
      return false;
    var tmp0_other_with_cast = other instanceof PropertyValue ? other : THROW_CCE();
    if (!equals(this.asmObject, tmp0_other_with_cast.asmObject))
      return false;
    if (!(this.value === tmp0_other_with_cast.value))
      return false;
    return true;
  }
}
class ExpressionsSyntaxAnalyser extends SyntaxAnalyserByMethodRegistrationAbstract {
  constructor() {
    super();
    this.f2x_1 = mapOf(to(new QualifiedName(_QualifiedName___init__impl__8ed982('Base')), new BaseSyntaxAnalyser()));
  }
  s2k() {
    return this.f2x_1;
  }
  registerHandlers() {
    super.register(ExpressionsSyntaxAnalyser$expression$ref(this));
    super.register(ExpressionsSyntaxAnalyser$rootExpression$ref(this));
    super.register(ExpressionsSyntaxAnalyser$literalExpression$ref(this));
    super.register(ExpressionsSyntaxAnalyser$navigationExpression$ref(this));
    super.register(ExpressionsSyntaxAnalyser$navigationRoot$ref(this));
    super.register(ExpressionsSyntaxAnalyser$navigationPartList$ref(this));
    super.register(ExpressionsSyntaxAnalyser$navigationPart$ref(this));
    super.register(ExpressionsSyntaxAnalyser$infixExpression$ref(this));
    super.registerFor('object', ExpressionsSyntaxAnalyser$object_$ref(this));
    super.register(ExpressionsSyntaxAnalyser$constructorArguments$ref(this));
    super.register(ExpressionsSyntaxAnalyser$tuple$ref(this));
    super.register(ExpressionsSyntaxAnalyser$assignmentBlock$ref(this));
    super.register(ExpressionsSyntaxAnalyser$assignmentList$ref(this));
    super.register(ExpressionsSyntaxAnalyser$assignment$ref(this));
    super.register(ExpressionsSyntaxAnalyser$propertyName$ref(this));
    super.register(ExpressionsSyntaxAnalyser$grammarRuleIndex$ref(this));
    super.register(ExpressionsSyntaxAnalyser$with$ref(this));
    super.registerFor('when', ExpressionsSyntaxAnalyser$when_$ref(this));
    super.register(ExpressionsSyntaxAnalyser$whenOption$ref(this));
    super.register(ExpressionsSyntaxAnalyser$whenOptionElse$ref(this));
    super.register(ExpressionsSyntaxAnalyser$cast$ref(this));
    super.register(ExpressionsSyntaxAnalyser$typeTest$ref(this));
    super.register(ExpressionsSyntaxAnalyser$group$ref(this));
    super.register(ExpressionsSyntaxAnalyser$propertyCall$ref(this));
    super.register(ExpressionsSyntaxAnalyser$methodCall$ref(this));
    super.register(ExpressionsSyntaxAnalyser$argumentList$ref(this));
    super.register(ExpressionsSyntaxAnalyser$lambda$ref(this));
    super.register(ExpressionsSyntaxAnalyser$propertyReference$ref(this));
    super.register(ExpressionsSyntaxAnalyser$methodReference$ref(this));
    super.register(ExpressionsSyntaxAnalyser$indexOperation$ref(this));
    super.register(ExpressionsSyntaxAnalyser$indexList$ref(this));
    super.register(ExpressionsSyntaxAnalyser$typeReference$ref(this));
    super.register(ExpressionsSyntaxAnalyser$typeArgumentList$ref(this));
    super.register(ExpressionsSyntaxAnalyser$literal$ref(this));
  }
}
class StdLibPrimitiveExecutions_0 {
  constructor() {
    StdLibPrimitiveExecutions_instance = this;
    var tmp = this;
    var tmp_0 = StdLibDefault_getInstance().List;
    var tmp_1 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('size')));
    var tmp_2 = to(tmp_1, StdLibPrimitiveExecutions$property$lambda);
    var tmp_3 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('first')));
    var tmp_4 = to(tmp_3, StdLibPrimitiveExecutions$property$lambda_0);
    var tmp_5 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('last')));
    var tmp_6 = to(tmp_5, StdLibPrimitiveExecutions$property$lambda_1);
    var tmp_7 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('back')));
    var tmp_8 = to(tmp_7, StdLibPrimitiveExecutions$property$lambda_2);
    var tmp_9 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('front')));
    var tmp_10 = to(tmp_9, StdLibPrimitiveExecutions$property$lambda_3);
    var tmp_11 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('join')));
    var tmp_12 = to(tmp_11, StdLibPrimitiveExecutions$property$lambda_4);
    var tmp_13 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('asMap')));
    var tmp_14 = to(tmp_0, mapOf_0([tmp_2, tmp_4, tmp_6, tmp_8, tmp_10, tmp_12, to(tmp_13, StdLibPrimitiveExecutions$property$lambda_5)]));
    var tmp_15 = StdLibDefault_getInstance().ListSeparated;
    var tmp_16 = ensureNotNull(StdLibDefault_getInstance().ListSeparated.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('items')));
    var tmp_17 = to(tmp_16, StdLibPrimitiveExecutions$property$lambda_6);
    var tmp_18 = ensureNotNull(StdLibDefault_getInstance().ListSeparated.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('separators')));
    tmp.property = mapOf_0([tmp_14, to(tmp_15, mapOf_0([tmp_17, to(tmp_18, StdLibPrimitiveExecutions$property$lambda_7)]))]);
    var tmp_19 = this;
    var tmp_20 = StdLibDefault_getInstance().List;
    var tmp_21 = ensureNotNull(StdLibDefault_getInstance().List.findAllMethodOrNull(_MethodName___init__impl__2ggy8b('get')));
    var tmp_22 = to(tmp_21, StdLibPrimitiveExecutions$method$lambda);
    var tmp_23 = ensureNotNull(StdLibDefault_getInstance().Collection.findAllMethodOrNull(_MethodName___init__impl__2ggy8b('map')));
    tmp_19.method = mapOf(to(tmp_20, mapOf_0([tmp_22, to(tmp_23, StdLibPrimitiveExecutions$method$lambda_0)])));
  }
  z2h() {
    return this.property;
  }
  a2i() {
    return this.method;
  }
}
class TypedObjectAsmValue {
  constructor(type, self_0) {
    this.g2x_1 = type;
    this.h2x_1 = self_0;
  }
  q2w() {
    return this.g2x_1;
  }
  o2w() {
    return this.h2x_1;
  }
  asString() {
    return this.h2x_1.asString();
  }
  hashCode() {
    return hashCode(this.h2x_1);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, TypedObject) : false)) {
      tmp = false;
    } else {
      tmp = equals(this.h2x_1, other.self);
    }
    return tmp;
  }
  toString() {
    return toString(this.h2x_1) + ' : ' + QualifiedName__toString_impl_z3wem2(this.g2x_1.qualifiedTypeName);
  }
  get type() {
    return this.q2w();
  }
  get self() {
    return this.o2w();
  }
}
class StdLibPrimitiveExecutionsForReflection_0 {
  constructor() {
    StdLibPrimitiveExecutionsForReflection_instance = this;
    var tmp = this;
    var tmp_0 = StdLibDefault_getInstance().List;
    var tmp_1 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('size')));
    var tmp_2 = to(tmp_1, StdLibPrimitiveExecutionsForReflection$property$lambda);
    var tmp_3 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('first')));
    var tmp_4 = to(tmp_3, StdLibPrimitiveExecutionsForReflection$property$lambda_0);
    var tmp_5 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('last')));
    var tmp_6 = to(tmp_5, StdLibPrimitiveExecutionsForReflection$property$lambda_1);
    var tmp_7 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('back')));
    var tmp_8 = to(tmp_7, StdLibPrimitiveExecutionsForReflection$property$lambda_2);
    var tmp_9 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('front')));
    var tmp_10 = to(tmp_9, StdLibPrimitiveExecutionsForReflection$property$lambda_3);
    var tmp_11 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('join')));
    var tmp_12 = to(tmp_11, StdLibPrimitiveExecutionsForReflection$property$lambda_4);
    var tmp_13 = ensureNotNull(StdLibDefault_getInstance().List.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('asMap')));
    var tmp_14 = to(tmp_0, mapOf_0([tmp_2, tmp_4, tmp_6, tmp_8, tmp_10, tmp_12, to(tmp_13, StdLibPrimitiveExecutionsForReflection$property$lambda_5)]));
    var tmp_15 = StdLibDefault_getInstance().ListSeparated;
    var tmp_16 = ensureNotNull(StdLibDefault_getInstance().ListSeparated.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('items')));
    var tmp_17 = to(tmp_16, StdLibPrimitiveExecutionsForReflection$property$lambda_6);
    var tmp_18 = ensureNotNull(StdLibDefault_getInstance().ListSeparated.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9('separators')));
    tmp.property = mapOf_0([tmp_14, to(tmp_15, mapOf_0([tmp_17, to(tmp_18, StdLibPrimitiveExecutionsForReflection$property$lambda_7)]))]);
    var tmp_19 = this;
    var tmp_20 = StdLibDefault_getInstance().String.resolvedDeclaration;
    var tmp_21 = ensureNotNull(StdLibDefault_getInstance().String.resolvedDeclaration.findAllMethodOrNull(_MethodName___init__impl__2ggy8b('toBoolean')));
    var tmp_22 = to(tmp_21, StdLibPrimitiveExecutionsForReflection$method$lambda);
    var tmp_23 = ensureNotNull(StdLibDefault_getInstance().String.resolvedDeclaration.findAllMethodOrNull(_MethodName___init__impl__2ggy8b('toInteger')));
    var tmp_24 = to(tmp_23, StdLibPrimitiveExecutionsForReflection$method$lambda_0);
    var tmp_25 = ensureNotNull(StdLibDefault_getInstance().String.resolvedDeclaration.findAllMethodOrNull(_MethodName___init__impl__2ggy8b('toReal')));
    var tmp_26 = to(tmp_25, StdLibPrimitiveExecutionsForReflection$method$lambda_1);
    var tmp_27 = ensureNotNull(StdLibDefault_getInstance().String.resolvedDeclaration.findAllMethodOrNull(_MethodName___init__impl__2ggy8b('removeSurrounding')));
    var tmp_28 = to(tmp_20, mapOf_0([tmp_22, tmp_24, tmp_26, to(tmp_27, StdLibPrimitiveExecutionsForReflection$method$lambda_2)]));
    var tmp_29 = StdLibDefault_getInstance().Collection;
    var tmp_30 = ensureNotNull(StdLibDefault_getInstance().Collection.findAllMethodOrNull(_MethodName___init__impl__2ggy8b('map')));
    var tmp_31 = to(tmp_29, mapOf(to(tmp_30, StdLibPrimitiveExecutionsForReflection$method$lambda_3)));
    var tmp_32 = StdLibDefault_getInstance().List;
    var tmp_33 = ensureNotNull(StdLibDefault_getInstance().List.findAllMethodOrNull(_MethodName___init__impl__2ggy8b('map')));
    var tmp_34 = to(tmp_33, StdLibPrimitiveExecutionsForReflection$method$lambda_4);
    var tmp_35 = ensureNotNull(StdLibDefault_getInstance().List.findAllMethodOrNull(_MethodName___init__impl__2ggy8b('get')));
    var tmp_36 = to(tmp_35, StdLibPrimitiveExecutionsForReflection$method$lambda_5);
    var tmp_37 = ensureNotNull(StdLibDefault_getInstance().List.findAllMethodOrNull(_MethodName___init__impl__2ggy8b('separate')));
    tmp_19.method = mapOf_0([tmp_28, tmp_31, to(tmp_32, mapOf_0([tmp_34, tmp_36, to(tmp_37, StdLibPrimitiveExecutionsForReflection$method$lambda_6)]))]);
  }
  z2h() {
    return this.property;
  }
  a2i() {
    return this.method;
  }
}
class TypedObjectAny {
  constructor(type, self_0) {
    this.i2x_1 = type;
    this.j2x_1 = self_0;
  }
  q2w() {
    return this.i2x_1;
  }
  o2w() {
    return this.j2x_1;
  }
  asString() {
    return toString(this.j2x_1);
  }
  hashCode() {
    return hashCode(this.j2x_1);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, TypedObject) : false)) {
      tmp = false;
    } else {
      tmp = equals(this.j2x_1, other.self);
    }
    return tmp;
  }
  toString() {
    return toString(this.j2x_1) + ' : ' + QualifiedName__toString_impl_z3wem2(this.i2x_1.qualifiedTypeName);
  }
  get type() {
    return this.q2w();
  }
  get self() {
    return this.o2w();
  }
}
class ObjectGraphByReflection {
  constructor(typeModel, issues) {
    this.k2x_1 = typeModel;
    this.issues = issues;
  }
  v2k(_set____db54di) {
    this.k2x_1 = _set____db54di;
  }
  m2e() {
    return this.k2x_1;
  }
  n16() {
    return this.issues;
  }
  untyped(typedObj) {
    var obj = typedObj.self;
    var tmp;
    if (isInterface(obj, KtList)) {
      // Inline function 'kotlin.collections.map' call
      // Inline function 'kotlin.collections.mapTo' call
      var destination = ArrayList.w(collectionSizeOrDefault(obj, 10));
      var _iterator__ex2g4s = obj.s();
      while (_iterator__ex2g4s.t()) {
        var item = _iterator__ex2g4s.u();
        var tmp$ret$0 = this.untypedAny(item);
        destination.r(tmp$ret$0);
      }
      tmp = destination;
    } else {
      if (isInterface(obj, KtMap)) {
        // Inline function 'kotlin.collections.associate' call
        var this_0 = obj.w2();
        var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_0, 10)), 16);
        // Inline function 'kotlin.collections.associateTo' call
        var destination_0 = LinkedHashMap.kb(capacity);
        var _iterator__ex2g4s_0 = this_0.s();
        while (_iterator__ex2g4s_0.t()) {
          var element = _iterator__ex2g4s_0.u();
          // Inline function 'kotlin.collections.plusAssign' call
          var pair = new Pair(this.untypedAny(element.a3()), this.untypedAny(element.b3()));
          destination_0.r2(pair.zg_1, pair.ah_1);
        }
        tmp = destination_0;
      } else {
        tmp = obj;
      }
    }
    return tmp;
  }
  untypedAny(possiblyTypedObject) {
    var tmp;
    if (possiblyTypedObject == null) {
      tmp = Unit_instance;
    } else {
      if (!(possiblyTypedObject == null) ? isInterface(possiblyTypedObject, TypedObject) : false) {
        tmp = this.untyped(isInterface(possiblyTypedObject, TypedObject) ? possiblyTypedObject : THROW_CCE());
      } else {
        if (!(possiblyTypedObject == null) ? isInterface(possiblyTypedObject, KtList) : false) {
          // Inline function 'kotlin.collections.map' call
          // Inline function 'kotlin.collections.mapTo' call
          var destination = ArrayList.w(collectionSizeOrDefault(possiblyTypedObject, 10));
          var _iterator__ex2g4s = possiblyTypedObject.s();
          while (_iterator__ex2g4s.t()) {
            var item = _iterator__ex2g4s.u();
            var tmp$ret$0 = this.untypedAny(item);
            destination.r(tmp$ret$0);
          }
          tmp = destination;
        } else {
          if (!(possiblyTypedObject == null) ? isInterface(possiblyTypedObject, KtMap) : false) {
            // Inline function 'kotlin.collections.associate' call
            var this_0 = possiblyTypedObject.w2();
            var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_0, 10)), 16);
            // Inline function 'kotlin.collections.associateTo' call
            var destination_0 = LinkedHashMap.kb(capacity);
            var _iterator__ex2g4s_0 = this_0.s();
            while (_iterator__ex2g4s_0.t()) {
              var element = _iterator__ex2g4s_0.u();
              // Inline function 'kotlin.collections.plusAssign' call
              var pair = new Pair(this.untypedAny(element.a3()), this.untypedAny(element.b3()));
              destination_0.r2(pair.zg_1, pair.ah_1);
            }
            tmp = destination_0;
          } else {
            tmp = possiblyTypedObject;
          }
        }
      }
    }
    return tmp;
  }
  typeFor(obj) {
    var tmp;
    if (obj == null) {
      tmp = StdLibDefault_getInstance().NothingType;
    } else {
      if (!(obj == null) ? typeof obj === 'boolean' : false) {
        tmp = StdLibDefault_getInstance().Boolean;
      } else {
        if (obj instanceof Long) {
          tmp = StdLibDefault_getInstance().Integer;
        } else {
          if (!(obj == null) ? typeof obj === 'string' : false) {
            tmp = StdLibDefault_getInstance().String;
          } else {
            if (!(obj == null) ? typeof obj === 'number' : false) {
              tmp = StdLibDefault_getInstance().Real;
            } else {
              if (!(obj == null) ? isInterface(obj, KtList) : false) {
                tmp = StdLibDefault_getInstance().List.type(listOf(StdLibDefault_getInstance().AnyType.asTypeArgument));
              } else {
                if (!(obj == null) ? isInterface(obj, KtMap) : false) {
                  var me = firstOrNull_0(obj.w2());
                  var tmp_0;
                  if (me == null) {
                    tmp_0 = StdLibDefault_getInstance().Map.type(listOf_0([StdLibDefault_getInstance().AnyType.asTypeArgument, StdLibDefault_getInstance().AnyType.asTypeArgument]));
                  } else {
                    var tmp2_subject = me.a3();
                    var tmp_1;
                    if (!(tmp2_subject == null) ? typeof tmp2_subject === 'string' : false) {
                      // Inline function 'kotlin.collections.map' call
                      // Inline function 'kotlin.collections.mapTo' call
                      var destination = ArrayList.w(obj.v());
                      // Inline function 'kotlin.collections.iterator' call
                      var _iterator__ex2g4s = obj.w2().s();
                      while (_iterator__ex2g4s.t()) {
                        var item = _iterator__ex2g4s.u();
                        // Inline function 'kotlin.collections.component1' call
                        var k = item.a3();
                        // Inline function 'kotlin.collections.component2' call
                        var v = item.b3();
                        var tmp_2 = _PropertyName___init__impl__sz2wu9((!(k == null) ? typeof k === 'string' : false) ? k : THROW_CCE());
                        var tmp$ret$3 = new TypeArgumentNamedSimple(tmp_2, this.typeFor(!(v == null) ? v : THROW_CCE()));
                        destination.r(tmp$ret$3);
                      }
                      var ttargs = destination;
                      tmp_1 = StdLibDefault_getInstance().TupleType.type(ttargs);
                    } else {
                      tmp_1 = StdLibDefault_getInstance().Map.type(listOf_0([StdLibDefault_getInstance().AnyType.asTypeArgument, StdLibDefault_getInstance().AnyType.asTypeArgument]));
                    }
                    tmp_0 = tmp_1;
                  }
                  tmp = tmp_0;
                } else {
                  var tp = this.typeModel.findFirstDefinitionByNameOrNull(_SimpleName___init__impl__6s45d0(ensureNotNull(getKClassFromExpression(obj).zc())));
                  var tmp_3;
                  if (tp == null) {
                    this.issues.error(null, 'ObjectGraphByReflection cannot get type for ' + getKClassFromExpression(obj).zc());
                    tmp_3 = StdLibDefault_getInstance().AnyType;
                  } else {
                    tmp_3 = tp.type();
                  }
                  tmp = tmp_3;
                }
              }
            }
          }
        }
      }
    }
    return tmp;
  }
  toTypedObject(obj) {
    var tmp;
    if (!(obj == null) ? isInterface(obj, TypedObject) : false) {
      tmp = (!(obj == null) ? isInterface(obj, TypedObject) : false) ? obj : THROW_CCE();
    } else {
      var tmp_0;
      if (obj == null) {
        tmp_0 = null;
      } else {
        // Inline function 'kotlin.let' call
        tmp_0 = new TypedObjectAny(this.typeFor(obj), obj);
      }
      var tmp1_elvis_lhs = tmp_0;
      tmp = tmp1_elvis_lhs == null ? this.nothing() : tmp1_elvis_lhs;
    }
    return tmp;
  }
  nothing() {
    var tmp = new TypedObjectAny(StdLibDefault_getInstance().NothingType, Unit_instance);
    return isInterface(tmp, TypedObject) ? tmp : THROW_CCE();
  }
  any(value) {
    var tmp = new TypedObjectAny(StdLibDefault_getInstance().AnyType, value);
    return isInterface(tmp, TypedObject) ? tmp : THROW_CCE();
  }
  createPrimitiveValue(qualifiedTypeName, value) {
    return this.toTypedObject(!(value == null) ? value : THROW_CCE());
  }
  createTupleValue(typeArgs) {
    var tupleType = StdLibDefault_getInstance().TupleType;
    // Inline function 'kotlin.collections.mutableMapOf' call
    var tuple = LinkedHashMap.l4();
    var tmp = new TypedObjectAny(tupleType.type(typeArgs), tuple);
    return isInterface(tmp, TypedObject) ? tmp : THROW_CCE();
  }
  createStructureValue(possiblyQualifiedTypeName, constructorArgs) {
    var tmp0_elvis_lhs = this.typeModel.findFirstDefinitionByPossiblyQualifiedNameOrNull(possiblyQualifiedTypeName);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = "Cannot createStructureValue, no type found for '" + toString(possiblyQualifiedTypeName) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var typeDef = tmp;
    var tmp_0;
    if (isInterface(typeDef, SingletonType)) {
      tmp_0 = objectInstance(typeDef);
    } else {
      if (isInterface(typeDef, StructuredType)) {
        var tmp_1;
        if (isInterface(typeDef, DataType)) {
          // Inline function 'kotlin.collections.map' call
          var this_0 = constructorArgs.v2();
          // Inline function 'kotlin.collections.mapTo' call
          var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
          var _iterator__ex2g4s = this_0.s();
          while (_iterator__ex2g4s.t()) {
            var item = _iterator__ex2g4s.u();
            var tmp$ret$0 = this.untyped(item);
            destination.r(tmp$ret$0);
          }
          // Inline function 'kotlin.collections.toTypedArray' call
          var tmp$ret$3 = copyToArray(destination);
          tmp_1 = constructDataType(typeDef, tmp$ret$3.slice());
        } else {
          if (isInterface(typeDef, ValueType)) {
            // Inline function 'kotlin.collections.map' call
            var this_1 = constructorArgs.v2();
            // Inline function 'kotlin.collections.mapTo' call
            var destination_0 = ArrayList.w(collectionSizeOrDefault(this_1, 10));
            var _iterator__ex2g4s_0 = this_1.s();
            while (_iterator__ex2g4s_0.t()) {
              var item_0 = _iterator__ex2g4s_0.u();
              var tmp$ret$4 = this.untyped(item_0);
              destination_0.r(tmp$ret$4);
            }
            tmp_1 = constructValueType(typeDef, first(destination_0));
          } else {
            if (isInterface(typeDef, CollectionType)) {
              var message_0 = "use 'createCollection' for CollectionType";
              throw IllegalStateException.v4(toString(message_0));
            } else {
              if (isInterface(typeDef, InterfaceType)) {
                var message_1 = 'Should not create an instance of a InterfaceType';
                throw IllegalStateException.v4(toString(message_1));
              } else {
                var message_2 = "Unsupported subtype of StructuredType: '" + getKClassFromExpression(typeDef).zc() + "'";
                throw IllegalStateException.v4(toString(message_2));
              }
            }
          }
        }
        tmp_0 = tmp_1;
      } else {
        if (isInterface(typeDef, SpecialType)) {
          var message_3 = 'Should not create an instance of a SpecialType';
          throw IllegalStateException.v4(toString(message_3));
        } else {
          if (isInterface(typeDef, PrimitiveType)) {
            var message_4 = "use 'createPrimitiveValue' for PrimitiveType";
            throw IllegalStateException.v4(toString(message_4));
          } else {
            if (isInterface(typeDef, EnumType)) {
              var message_5 = "use '??' for EnumType";
              throw IllegalStateException.v4(toString(message_5));
            } else {
              if (isInterface(typeDef, TupleType)) {
                var message_6 = "use 'createTupleValue' for TupleType";
                throw IllegalStateException.v4(toString(message_6));
              } else {
                if (isInterface(typeDef, UnionType)) {
                  var message_7 = 'Should not create an instance of a UnionType';
                  throw IllegalStateException.v4(toString(message_7));
                } else {
                  var message_8 = "Unsupported subtype of TypeDefinition: '" + getKClassFromExpression(typeDef).zc() + "'";
                  throw IllegalStateException.v4(toString(message_8));
                }
              }
            }
          }
        }
      }
    }
    var obj = tmp_0;
    var tmp_2 = new TypedObjectAny(typeDef.type(), obj);
    return isInterface(tmp_2, TypedObject) ? tmp_2 : THROW_CCE();
  }
  createCollection(qualifiedTypeName, collection) {
    var tmp;
    if (qualifiedTypeName === StdLibDefault_getInstance().List.qualifiedName) {
      var tmp1_safe_receiver = firstOrNull_0(collection);
      var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.type;
      var elType = tmp2_elvis_lhs == null ? StdLibDefault_getInstance().AnyType : tmp2_elvis_lhs;
      var type = StdLibDefault_getInstance().List.type(listOf(elType.asTypeArgument));
      var tmp_0 = new TypedObjectAny(type, toList(collection));
      tmp = isInterface(tmp_0, TypedObject) ? tmp_0 : THROW_CCE();
    } else if (qualifiedTypeName === StdLibDefault_getInstance().ListSeparated.qualifiedName) {
      var list = toList(collection);
      var tmp3_safe_receiver = getOrNull(list, 0);
      var tmp4_elvis_lhs = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.type;
      var elType_0 = tmp4_elvis_lhs == null ? StdLibDefault_getInstance().AnyType : tmp4_elvis_lhs;
      var tmp5_safe_receiver = getOrNull(list, 1);
      var tmp6_elvis_lhs = tmp5_safe_receiver == null ? null : tmp5_safe_receiver.type;
      var sepType = tmp6_elvis_lhs == null ? StdLibDefault_getInstance().AnyType : tmp6_elvis_lhs;
      var tmp_1 = StdLibDefault_getInstance().ListSeparated.type(listOf_0([elType_0.asTypeArgument, sepType.asTypeArgument]));
      // Inline function 'net.akehurst.language.collections.toSeparatedList' call
      var tmp$ret$0 = ListSeparatedArrayList.gk(list);
      var tmp_2 = new TypedObjectAny(tmp_1, tmp$ret$0);
      tmp = isInterface(tmp_2, TypedObject) ? tmp_2 : THROW_CCE();
    } else if (qualifiedTypeName === StdLibDefault_getInstance().Set.qualifiedName) {
      var tmp7_safe_receiver = firstOrNull_0(collection);
      var tmp8_elvis_lhs = tmp7_safe_receiver == null ? null : tmp7_safe_receiver.type;
      var elType_1 = tmp8_elvis_lhs == null ? StdLibDefault_getInstance().AnyType : tmp8_elvis_lhs;
      var type_0 = StdLibDefault_getInstance().Set.type(listOf(elType_1.asTypeArgument));
      var tmp_3 = new TypedObjectAny(type_0, toList(collection));
      tmp = isInterface(tmp_3, TypedObject) ? tmp_3 : THROW_CCE();
    } else if (qualifiedTypeName === StdLibDefault_getInstance().Map.qualifiedName) {
      var tmp9_safe_receiver = firstOrNull_0(collection);
      var tmp10_elvis_lhs = tmp9_safe_receiver == null ? null : tmp9_safe_receiver.type;
      var fstElType = tmp10_elvis_lhs == null ? StdLibDefault_getInstance().Pair.type(listOf_0([StdLibDefault_getInstance().AnyType.asTypeArgument, StdLibDefault_getInstance().AnyType.asTypeArgument])) : tmp10_elvis_lhs;
      var keyType = fstElType.typeArguments.z(0);
      var valType = fstElType.typeArguments.z(1);
      // Inline function 'kotlin.collections.associate' call
      var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(collection, 10)), 16);
      // Inline function 'kotlin.collections.associateTo' call
      var destination = LinkedHashMap.kb(capacity);
      var _iterator__ex2g4s = collection.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        // Inline function 'kotlin.collections.plusAssign' call
        var pair = element instanceof Pair ? element : THROW_CCE();
        destination.r2(pair.zg_1, pair.ah_1);
      }
      var map = destination;
      var tmp_4 = new TypedObjectAny(StdLibDefault_getInstance().Map.type(listOf_0([keyType, valType])), map);
      tmp = isInterface(tmp_4, TypedObject) ? tmp_4 : THROW_CCE();
    } else {
      var message = "Unsupported collection type: '" + _QualifiedName___get_value__impl__nkc4gq(qualifiedTypeName) + "'";
      throw IllegalStateException.v4(toString(message));
    }
    return tmp;
  }
  createLambdaValue(lambda) {
    var lambdaType = StdLibDefault_getInstance().Lambda;
    var lmb = ObjectGraphByReflection$createLambdaValue$lambda(this, lambda);
    var tmp = new TypedObjectAny(lambdaType, lmb);
    return isInterface(tmp, TypedObject) ? tmp : THROW_CCE();
  }
  valueOf(value) {
    return this.untyped(value);
  }
  getIndex(tobj, index) {
    var self_0 = this.untyped(tobj);
    var tmp;
    if (isInterface(self_0, KtList)) {
      var el = getOrNull(self_0, index);
      var tmp_0;
      if (el == null) {
        this.issues.error(null, "In getIndex argument index '" + index + "' out of range");
        tmp_0 = this.nothing();
      } else {
        tmp_0 = this.toTypedObject(!(el == null) ? el : THROW_CCE());
      }
      tmp = tmp_0;
    } else {
      this.issues.error(null, "getIndex not supported on type '" + SimpleName__toString_impl_vxsxyc(tobj.type.typeName) + "'");
      tmp = this.nothing();
    }
    return tmp;
  }
  getProperty(tobj, propertyName) {
    var tmp;
    if (StdLibDefault_getInstance().TupleType.equals(tobj.type.resolvedDeclaration)) {
      var obj = this.untyped(tobj);
      var tmp_0;
      if (isInterface(obj, KtMap)) {
        var value = (isInterface(obj, KtMap) ? obj : THROW_CCE()).z2(propertyName);
        var tmp_1;
        if (value == null) {
          tmp_1 = null;
        } else {
          // Inline function 'kotlin.let' call
          tmp_1 = this.toTypedObject(!(value == null) ? value : THROW_CCE());
        }
        var tmp2_elvis_lhs = tmp_1;
        tmp_0 = tmp2_elvis_lhs == null ? this.nothing() : tmp2_elvis_lhs;
      } else {
        tmp_0 = this.nothing();
      }
      tmp = tmp_0;
    } else {
      var propRes = tobj.type.allResolvedProperty.z2(new PropertyName(_PropertyName___init__impl__sz2wu9(propertyName)));
      var tmp_2;
      if (propRes == null) {
        var obj_0 = tobj.self;
        var value_0 = reflect_0(obj_0).fq(propertyName);
        var tmp_3;
        if (value_0 == null) {
          tmp_3 = null;
        } else {
          // Inline function 'kotlin.let' call
          tmp_3 = this.toTypedObject(!(value_0 == null) ? value_0 : THROW_CCE());
        }
        var tmp5_elvis_lhs = tmp_3;
        tmp_2 = tmp5_elvis_lhs == null ? this.nothing() : tmp5_elvis_lhs;
      } else {
        var tmp6_subject = propRes.original;
        var tmp_4;
        if (tmp6_subject instanceof PropertyDeclarationDerived) {
          throw NotImplementedError.uj();
        } else {
          if (tmp6_subject instanceof PropertyDeclarationPrimitive) {
            var type = tobj.type.resolvedDeclaration;
            var tmp7_elvis_lhs = StdLibPrimitiveExecutionsForReflection_getInstance().property.z2(type);
            var tmp_5;
            if (tmp7_elvis_lhs == null) {
              var message = "StdLibPrimitiveExecutions not found for TypeDeclaration '" + QualifiedName__toString_impl_z3wem2(type.qualifiedName) + "'";
              throw IllegalStateException.v4(toString(message));
            } else {
              tmp_5 = tmp7_elvis_lhs;
            }
            var typeProps = tmp_5;
            var tmp8_elvis_lhs = typeProps.z2(propRes.original);
            var tmp_6;
            if (tmp8_elvis_lhs == null) {
              var message_0 = "StdLibPrimitiveExecutionsForReflection not found for property '" + propertyName + "' of TypeDeclaration '" + QualifiedName__toString_impl_z3wem2(type.qualifiedName) + "'";
              throw IllegalStateException.v4(toString(message_0));
            } else {
              tmp_6 = tmp8_elvis_lhs;
            }
            var propExec = tmp_6;
            var tmp_7 = propExec(this.untyped(tobj), propRes);
            tmp_4 = this.toTypedObject(!(tmp_7 == null) ? tmp_7 : THROW_CCE());
          } else {
            if (tmp6_subject instanceof PropertyDeclarationStored) {
              var obj_1 = tobj.self;
              var value_1 = reflect_0(obj_1).fq(propertyName);
              var tmp_8;
              if (value_1 == null) {
                tmp_8 = null;
              } else {
                // Inline function 'kotlin.let' call
                tmp_8 = this.toTypedObject(!(value_1 == null) ? value_1 : THROW_CCE());
              }
              var tmp10_elvis_lhs = tmp_8;
              tmp_4 = tmp10_elvis_lhs == null ? this.nothing() : tmp10_elvis_lhs;
            } else {
              var message_1 = "Subtype of PropertyDeclaration not handled: '" + getKClassFromExpression(this).zc() + "'";
              throw IllegalStateException.v4(toString(message_1));
            }
          }
        }
        tmp_2 = tmp_4;
      }
      tmp = tmp_2;
    }
    return tmp;
  }
  setProperty(tobj, propertyName, value) {
    if (StdLibDefault_getInstance().TupleType.equals(tobj.type.resolvedDeclaration)) {
      var tmp0_subject = tobj.self;
      if (isInterface(tmp0_subject, KtMutableMap)) {
        var tmp = tobj.self;
        var tmp0 = isInterface(tmp, KtMutableMap) ? tmp : THROW_CCE();
        // Inline function 'kotlin.collections.set' call
        var value_0 = this.untyped(value);
        tmp0.r2(propertyName, value_0);
      }
    } else {
      var obj = tobj.self;
      reflect_0(obj).gq(propertyName, this.untyped(value));
    }
  }
  executeMethod(tobj, methodName, args) {
    var meth = tobj.type.allResolvedMethod.z2(new MethodName(_MethodName___init__impl__2ggy8b(methodName)));
    var tmp;
    if (meth == null) {
      var obj = this.untyped(tobj);
      // Inline function 'kotlin.collections.map' call
      // Inline function 'kotlin.collections.mapTo' call
      var destination = ArrayList.w(collectionSizeOrDefault(args, 10));
      var _iterator__ex2g4s = args.s();
      while (_iterator__ex2g4s.t()) {
        var item = _iterator__ex2g4s.u();
        var tmp$ret$0 = this.untyped(item);
        destination.r(tmp$ret$0);
      }
      var arguments_0 = destination;
      var value = reflect_0(obj).hq(methodName, [arguments_0]);
      var tmp_0;
      if (value == null) {
        tmp_0 = null;
      } else {
        // Inline function 'kotlin.let' call
        tmp_0 = this.toTypedObject(!(value == null) ? value : THROW_CCE());
      }
      var tmp2_elvis_lhs = tmp_0;
      tmp = tmp2_elvis_lhs == null ? this.nothing() : tmp2_elvis_lhs;
    } else {
      var tmp3_subject = meth.original;
      var tmp_1;
      if (isInterface(tmp3_subject, MethodDeclarationDerived)) {
        throw NotImplementedError.uj();
      } else {
        if (isInterface(tmp3_subject, MethodDeclarationPrimitive)) {
          var type = tobj.type.resolvedDeclaration;
          var tmp4_elvis_lhs = StdLibPrimitiveExecutionsForReflection_getInstance().method.z2(type);
          var tmp_2;
          if (tmp4_elvis_lhs == null) {
            var message = "StdLibPrimitiveExecutions not found for TypeDeclaration '" + QualifiedName__toString_impl_z3wem2(type.qualifiedName) + "'";
            throw IllegalStateException.v4(toString(message));
          } else {
            tmp_2 = tmp4_elvis_lhs;
          }
          var methProps = tmp_2;
          var tmp5_elvis_lhs = methProps.z2(meth.original);
          var tmp_3;
          if (tmp5_elvis_lhs == null) {
            var message_0 = "StdLibPrimitiveExecutionsForReflection not found for method '" + methodName + "' of TypeDeclaration '" + QualifiedName__toString_impl_z3wem2(type.qualifiedName) + "'";
            throw IllegalStateException.v4(toString(message_0));
          } else {
            tmp_3 = tmp5_elvis_lhs;
          }
          var methExec = tmp_3;
          var res = methExec(this.untyped(tobj), meth, args);
          tmp_1 = this.toTypedObject(!(res == null) ? res : THROW_CCE());
        } else {
          var message_1 = "Subtype of MethodDeclaration not handled: '" + getKClassFromExpression(this).zc() + "'";
          throw IllegalStateException.v4(toString(message_1));
        }
      }
      tmp = tmp_1;
    }
    return tmp;
  }
  cast(tobj, newType) {
    return new TypedObjectAny(newType, tobj.self);
  }
  get typeModel() {
    return this.m2e();
  }
  set typeModel(value) {
    this.v2k(value);
  }
}
class FormatModelBuilder {
  constructor(name) {
    this.name = name;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.l2x_1 = ArrayList.y();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_0.m2x_1 = LinkedHashMap.l4();
    this.n2x_1 = new AglFormatModelDefault(this.name, new OptionHolderDefault(null, this.m2x_1), this.l2x_1);
    this.o2x_1 = new AsmSimple();
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_1.p2x_1 = ArrayList.y();
    var tmp_2 = this;
    // Inline function 'kotlin.also' call
    var this_0 = this.o2x_1.createStructure('/', _QualifiedName___init__impl__8ed982('Unit'));
    this.o2x_1.addRoot(this_0);
    this_0.setProperty(_PropertyValueName___init__impl__cmfy0i('ruleList'), new AsmListSimple(this.p2x_1), 0);
    tmp_2.q2x_1 = this_0;
  }
  f2h() {
    return this.name;
  }
  rule(forTypeName, init) {
    var b = new FormatExpressionBuilder(this.o2x_1);
    init(b);
    var expr = b.build();
    var formatRuleElement = this.o2x_1.createStructure('/', _QualifiedName___init__impl__8ed982('FormatRule'));
    var typeReference = this.o2x_1.createStructure('/', _QualifiedName___init__impl__8ed982('TypeReference'));
    typeReference.setProperty(_PropertyValueName___init__impl__cmfy0i('identifier'), Companion_instance_9.stdString(forTypeName), 0);
    formatRuleElement.setProperty(_PropertyValueName___init__impl__cmfy0i('typeReference'), typeReference, 0);
    formatRuleElement.setProperty(_PropertyValueName___init__impl__cmfy0i('formatExpression'), expr, 0);
    this.p2x_1.r(formatRuleElement);
  }
  build() {
    return this.n2x_1;
  }
}
class FormatExpressionBuilder {
  constructor(_asm) {
    this.r2x_1 = _asm;
  }
  literalString(value) {
    var el = this.r2x_1.createStructure('/', _QualifiedName___init__impl__8ed982('LiteralString'));
    el.setProperty(_PropertyValueName___init__impl__cmfy0i('literal_string'), Companion_instance_9.stdString(value), 0);
    this.s2x_1 = el;
  }
  build() {
    return _get__exp__d2m08d(this);
  }
}
class AglFormatModel {}
class FormatNamespace {}
class FormatSetReference {}
class FormatSet {}
class AglFormatRule {}
class FormatExpression {}
class FormatExpressionExpression {}
class FormatExpressionTemplate {}
class FormatExpressionWhen {}
class FormatWhenOption {}
class FormatWhenOptionElse {}
class TemplateElement {}
class TemplateElementText {}
class TemplateElementExpressionProperty {}
class TemplateElementExpressionList {}
class TemplateElementExpressionEmbedded {}
class Companion_14 {
  fromGrammar(grammarModel, typeModel) {
    var issues = new IssueHolder(LanguageProcessorPhase_ALL_getInstance());
    var formatModel = new AglFormatModelDefault(grammarModel.name);
    var _iterator__ex2g4s = typeModel.namespace.s();
    while (_iterator__ex2g4s.t()) {
      var ns = _iterator__ex2g4s.u();
      if (isInterface(ns, GrammarTypeNamespace)) {
        var tmp0 = grammarModel.allDefinitions;
        var tmp$ret$1;
        $l$block: {
          // Inline function 'kotlin.collections.firstOrNull' call
          var _iterator__ex2g4s_0 = tmp0.s();
          while (_iterator__ex2g4s_0.t()) {
            var element = _iterator__ex2g4s_0.u();
            if (element.qualifiedName === ns.qualifiedName) {
              tmp$ret$1 = element;
              break $l$block;
            }
          }
          tmp$ret$1 = null;
        }
        var grammar = tmp$ret$1;
        if (!(null == grammar)) {
          // Inline function 'kotlin.collections.iterator' call
          var _iterator__ex2g4s_1 = ns.allRuleNameToType.w2().s();
          while (_iterator__ex2g4s_1.t()) {
            var _destruct__k2r9zo = _iterator__ex2g4s_1.u();
            // Inline function 'kotlin.collections.component1' call
            var rn = _destruct__k2r9zo.a3().d1u_1;
            // Inline function 'kotlin.collections.component2' call
            var ty = _destruct__k2r9zo.b3();
            var grule = grammar.findOwnedGrammarRuleOrNull(rn);
            if (!(null == grule))
              fromRuleItem(this, grammar, grule.rhs);
            else {
              // Inline function 'kotlin.TODO' call
              throw NotImplementedError.uj();
            }
            formatModel.addRule(ty.typeName);
          }
        }
      }
    }
    return new ProcessResultDefault(formatModel, VOID, VOID, VOID, issues);
  }
  fromString(context, formatModelStr) {
    var tmp0_elvis_lhs = Agl_getInstance().registry.agl.format.processor;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = 'Agl Format language not found!';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var proc = tmp;
    var tmp_0 = _FormatString___get_value__impl__b4w1sj(formatModelStr);
    var tmp_1 = Agl_getInstance();
    var res = proc.process(tmp_0, tmp_1.options(VOID, AglFormatModelDefault$Companion$fromString$lambda(context)));
    var tmp_2;
    if (res.allIssues.errors.a1()) {
      tmp_2 = res;
    } else {
      var message_0 = toString(res.allIssues);
      throw IllegalStateException.v4(toString(message_0));
    }
    return tmp_2;
  }
}
class AglFormatModelDefault extends ModelAbstract {
  constructor(name, options, namespaces) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    namespaces = namespaces === VOID ? emptyList() : namespaces;
    super(namespaces, options);
    this.d2y_1 = name;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.e2y_1 = LinkedHashMap.l4();
  }
  f2h() {
    return this.d2y_1;
  }
  t2x() {
    return ' ';
  }
  u2x() {
    return this.e2y_1;
  }
  addRule(typeName) {
    // Inline function 'kotlin.TODO' call
    var reason = 'is it needed ?';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  get defaultWhiteSpace() {
    return this.t2x();
  }
  get rules() {
    return this.u2x();
  }
}
class AglFormatNamespaceDefault extends NamespaceAbstract {
  constructor(qualifiedName, options, import_0) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    import_0 = import_0 === VOID ? emptyList() : import_0;
    super(options, import_0);
    this.h2y_1 = qualifiedName;
  }
  u2h() {
    return this.h2y_1;
  }
  v2x() {
    return this.definition;
  }
  get formatSet() {
    return this.v2x();
  }
}
class FormatSetReferenceDefault {
  constructor(localNamespace, nameOrQName) {
    this.i2y_1 = localNamespace;
    this.j2y_1 = nameOrQName;
    this.k2y_1 = null;
  }
  f2t() {
    return this.i2y_1;
  }
  g2t() {
    return this.j2y_1;
  }
  l2y(_set____db54di) {
    this.k2y_1 = _set____db54di;
  }
  i2t() {
    return this.k2y_1;
  }
  resolveAs(resolved) {
    this.k2y_1 = resolved;
  }
  get localNamespace() {
    return this.f2t();
  }
  get nameOrQName() {
    return this.g2t();
  }
  get resolved() {
    return this.i2t();
  }
  set resolved(value) {
    this.l2y(value);
  }
}
class FormatSetDefault extends DefinitionAbstract {
  constructor(namespace, name, extends_0, options, rules) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    super();
    this.m2y_1 = namespace;
    this.n2y_1 = name;
    this.o2y_1 = extends_0;
    this.p2y_1 = options;
    this.q2y_1 = rules;
  }
  e2h() {
    return this.m2y_1;
  }
  f2h() {
    return this.n2y_1;
  }
  w2x() {
    return this.o2y_1;
  }
  x1c() {
    return this.p2y_1;
  }
  u2x() {
    return this.q2y_1;
  }
  get extends() {
    return this.w2x();
  }
  get rules() {
    return this.u2x();
  }
}
class AglFormatRuleDefault {
  constructor(forTypeName, formatExpression) {
    this.r2y_1 = forTypeName;
    this.s2y_1 = formatExpression;
  }
  x2x() {
    return this.r2y_1;
  }
  y2x() {
    return this.s2y_1;
  }
  get forTypeName() {
    return this.x2x();
  }
  get formatExpression() {
    return this.y2x();
  }
}
class FormatExpressionWhenDefault {
  constructor(options) {
    this.t2y_1 = options;
  }
  x1c() {
    return this.t2y_1;
  }
  x2t(indent, imports) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  get options() {
    return this.x1c();
  }
}
class FormatWhenOptionDefault {
  constructor(condition, format) {
    this.u2y_1 = condition;
    this.v2y_1 = format;
    this.w2y_1 = this.v2y_1;
  }
  m2u() {
    return this.u2y_1;
  }
  o21() {
    return this.v2y_1;
  }
  v1j() {
    return this.w2y_1;
  }
  get condition() {
    return this.m2u();
  }
  get format() {
    return this.o21();
  }
  get expression() {
    return this.v1j();
  }
}
class FormatWhenOptionElseDefault {
  constructor(format) {
    this.x2y_1 = format;
    this.y2y_1 = this.x2y_1;
  }
  o21() {
    return this.x2y_1;
  }
  v1j() {
    return this.y2y_1;
  }
  get format() {
    return this.o21();
  }
  get expression() {
    return this.v1j();
  }
}
class FormatExpressionExpressionDefault {
  constructor(expression) {
    this.z2y_1 = expression;
  }
  v1j() {
    return this.z2y_1;
  }
  x2t(indent, imports) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  get expression() {
    return this.v1j();
  }
}
class FormatExpressionTemplateDefault {
  constructor(content) {
    this.a2z_1 = content;
  }
  e13() {
    return this.a2z_1;
  }
  x2t(indent, imports) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  get content() {
    return this.e13();
  }
}
class TemplateElementTextDefault {
  constructor(text) {
    this.b2z_1 = text;
  }
  w1e() {
    return this.b2z_1;
  }
  toString() {
    return this.b2z_1;
  }
  get text() {
    return this.w1e();
  }
}
class TemplateElementExpressionPropertyDefault {
  constructor(propertyName) {
    this.c2z_1 = propertyName;
  }
  e2u() {
    return this.c2z_1;
  }
  toString() {
    return '$' + this.c2z_1;
  }
  get propertyName() {
    return this.e2u();
  }
}
class TemplateElementExpressionListDefault {
  constructor(listPropertyName, separator) {
    this.d2z_1 = listPropertyName;
    this.e2z_1 = separator;
  }
  z2x() {
    return this.d2z_1;
  }
  a2y() {
    return this.e2z_1;
  }
  toString() {
    return '$[' + this.d2z_1 + " / '" + this.e2z_1 + "']";
  }
  get listPropertyName() {
    return this.z2x();
  }
  get separator() {
    return this.a2y();
  }
}
class TemplateElementExpressionEmbeddedDefault {
  constructor(expression) {
    this.f2z_1 = expression;
  }
  v1j() {
    return this.f2z_1;
  }
  toString() {
    return '${' + toString(this.f2z_1) + '}';
  }
  get expression() {
    return this.v1j();
  }
}
class AglFormat_0 extends LanguageObjectAbstract {
  constructor() {
    AglFormat_instance = null;
    super();
    AglFormat_instance = this;
    this.NAMESPACE_NAME = 'net.akehurst.language';
    this.NAME = 'Format';
    this.goalRuleName = 'unit';
    this.l26_1 = _LanguageIdentity___init__impl__3hnnkb('net.akehurst.language.Format');
    this.m26_1 = "\n        namespace net.akehurst.language\n        grammar Template {\n            // no skip rules\n            templateString = '\"' templateContentList '\"' ;\n            templateContentList = templateContent* ;\n            templateContent = text | templateExpression ;\n            text = RAW_TEXT ;\n            templateExpression = templateExpressionProperty | templateExpressionList | templateExpressionEmbedded ;\n            templateExpressionProperty = DOLLAR_IDENTIFIER ;\n            templateExpressionList = '$[' Expressions::propertyName '/' Expressions::STRING ']' ;\n            templateExpressionEmbedded = '${' AglFormat::formatExpression '}'\n            \n            leaf DOLLAR_IDENTIFIER = '$' IDENTIFIER ;\n            leaf RAW_TEXT = \"(\\\\\\\"|[^\\\"])+\" ;\n        }\n        \n        grammar Format extends Expressions {        \n            override definition = format ;\n            format = 'format' IDENTIFIER extends? '{' ruleList '}' ;\n            extends = ':' [possiblyQualifiedName / ',']+ ;\n            ruleList = formatRule* ;\n            formatRule = typeReference '->' formatExpression ;\n            \n            // TODO: override expression +=| formatExpression\n            \n            formatExpression\n              = expression\n              | Template::templateString\n           //   | whenExpression\n              ;\n           // whenExpression = 'when' '{' whenOptionList '}' ;\n           // whenOptionList = whenOption* ;\n            override whenOption = expression '->' formatExpression ;\n            override whenOptionElse = 'else' '->' formatExpression ;\n        }\n    ";
    var tmp = this;
    tmp.n26_1 = lazy(AglFormat$grammarModel$delegate$lambda);
    this.komposite = '\n    ';
    var tmp_0 = this;
    tmp_0.o26_1 = lazy(AglFormat$typesModel$delegate$lambda);
    var tmp_1 = this;
    tmp_1.p26_1 = lazy(AglFormat$asmTransformModel$delegate$lambda);
    var tmp_2 = this;
    tmp_2.q26_1 = lazy(AglFormat$crossReferenceModel$delegate$lambda);
    var tmp_3 = this;
    tmp_3.r26_1 = lazy(AglFormat$styleModel$delegate$lambda);
    var tmp_4 = this;
    tmp_4.s26_1 = lazy(AglFormat$formatModel$delegate$lambda);
    var tmp_5 = this;
    tmp_5.t26_1 = lazy(AglFormat$defaultTargetGrammar$delegate$lambda);
    this.u26_1 = 'unit';
    var tmp_6 = this;
    tmp_6.v26_1 = lazy(AglFormat$syntaxAnalyser$delegate$lambda);
    var tmp_7 = this;
    tmp_7.w26_1 = lazy(AglFormat$semanticAnalyser$delegate$lambda);
    var tmp_8 = this;
    tmp_8.x26_1 = lazy(AglFormat$completionProvider$delegate$lambda);
  }
  u2t() {
    return this.NAMESPACE_NAME;
  }
  v2t() {
    return this.NAME;
  }
  b16() {
    return this.goalRuleName;
  }
  g1u() {
    return this.l26_1;
  }
  u2n() {
    return this.m26_1;
  }
  i1u() {
    var tmp0 = this.n26_1;
    // Inline function 'kotlin.getValue' call
    grammarModel$factory_3();
    return tmp0.b3();
  }
  k2p() {
    return this.komposite;
  }
  p1u() {
    var tmp0 = this.o26_1;
    // Inline function 'kotlin.getValue' call
    typesModel$factory_1();
    return tmp0.b3();
  }
  j2k() {
    var tmp0 = this.p26_1;
    // Inline function 'kotlin.getValue' call
    asmTransformModel$factory_1();
    return tmp0.b3();
  }
  r1u() {
    var tmp0 = this.q26_1;
    // Inline function 'kotlin.getValue' call
    crossReferenceModel$factory_2();
    return tmp0.b3();
  }
  w1u() {
    var tmp0 = this.r26_1;
    // Inline function 'kotlin.getValue' call
    styleModel$factory_1();
    return tmp0.b3();
  }
  i1t() {
    var tmp0 = this.s26_1;
    // Inline function 'kotlin.getValue' call
    formatModel$factory_2();
    return tmp0.b3();
  }
  c2o() {
    var tmp0 = this.t26_1;
    // Inline function 'kotlin.getValue' call
    defaultTargetGrammar$factory_1();
    return tmp0.b3();
  }
  d2o() {
    return this.u26_1;
  }
  s1u() {
    var tmp0 = this.v26_1;
    // Inline function 'kotlin.getValue' call
    syntaxAnalyser$factory_2();
    return tmp0.b3();
  }
  t1u() {
    var tmp0 = this.w26_1;
    // Inline function 'kotlin.getValue' call
    semanticAnalyser$factory_2();
    return tmp0.b3();
  }
  p1y() {
    var tmp0 = this.x26_1;
    // Inline function 'kotlin.getValue' call
    completionProvider$factory_2();
    return tmp0.b3();
  }
}
class AglFormatCompletionProvider extends CompletionProviderAbstract {}
class AglFormatSemanticAnalyser {
  clear() {
  }
  h2z(sentenceIdentity, asm, locationMap, options) {
    return new SemanticAnalysisResultDefault(emptyList(), new IssueHolder(LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance()));
  }
  y2j(sentenceIdentity, asm, locationMap, options) {
    return this.h2z(sentenceIdentity, isInterface(asm, AglFormatModel) ? asm : THROW_CCE(), locationMap, options);
  }
}
class AglFormatSyntaxAnalyser extends SyntaxAnalyserByMethodRegistrationAbstract {
  constructor() {
    super();
    this.o2z_1 = mapOf(to(new QualifiedName(_QualifiedName___init__impl__8ed982('Expressions')), new ExpressionsSyntaxAnalyser()));
    var tmp = this;
    // Inline function 'kotlin.also' call
    var this_0 = new AglTemplateSyntaxAnalyser();
    this_0.setEmbeddedSyntaxAnalyser(_QualifiedName___init__impl__8ed982('net.akehurst.language.Format'), this);
    tmp.p2z_1 = this_0;
    this.q2z_1 = mapOf(to(new QualifiedName(_QualifiedName___init__impl__8ed982('net.akehurst.language.Template')), this.p2z_1));
  }
  s2k() {
    return this.o2z_1;
  }
  e2k() {
    return this.q2z_1;
  }
  registerHandlers() {
    super.register(AglFormatSyntaxAnalyser$unit$ref(this));
    super.register(AglFormatSyntaxAnalyser$namespace$ref(this));
    super.register(AglFormatSyntaxAnalyser$definition$ref(this));
    super.register(AglFormatSyntaxAnalyser$format$ref(this));
    super.register(AglFormatSyntaxAnalyser$formatRule$ref(this));
    super.register(AglFormatSyntaxAnalyser$formatExpression$ref(this));
    super.register(AglFormatSyntaxAnalyser$whenExpression$ref(this));
    super.register(AglFormatSyntaxAnalyser$whenOption$ref(this));
    super.register(AglFormatSyntaxAnalyser$whenOptionElse$ref(this));
  }
  r2z(nodeInfo, children, sentence) {
    var tmp = children.z(0);
    var options = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
    var tmp_0 = children.z(1);
    var namespace = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
    // Inline function 'kotlin.collections.associate' call
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(options, 10)), 16);
    // Inline function 'kotlin.collections.associateTo' call
    var destination = LinkedHashMap.kb(capacity);
    var _iterator__ex2g4s = options.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      // Inline function 'kotlin.collections.plusAssign' call
      destination.r2(element.zg_1, element.ah_1);
    }
    var optHolder = new OptionHolderDefault(null, destination);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = namespace.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      var tmp_1 = element_0.options;
      (tmp_1 instanceof OptionHolderDefault ? tmp_1 : THROW_CCE()).g2s_1 = optHolder;
    }
    var result = new AglFormatModelDefault(_SimpleName___init__impl__6s45d0('Unit'), optHolder, namespace);
    return result;
  }
  s2z(nodeInfo, children, sentence) {
    var tmp = children.z(1);
    var pqn = (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
    var tmp_0 = children.z(2);
    var options = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
    var tmp_1 = children.z(3);
    var import_0 = (!(tmp_1 == null) ? isInterface(tmp_1, KtList) : false) ? tmp_1 : THROW_CCE();
    var tmp_2 = children.z(4);
    var definition = (!(tmp_2 == null) ? isInterface(tmp_2, KtList) : false) ? tmp_2 : THROW_CCE();
    // Inline function 'kotlin.collections.associate' call
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(options, 10)), 16);
    // Inline function 'kotlin.collections.associateTo' call
    var destination = LinkedHashMap.kb(capacity);
    var _iterator__ex2g4s = options.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      // Inline function 'kotlin.collections.plusAssign' call
      destination.r2(element.zg_1, element.ah_1);
    }
    var optHolder = new OptionHolderDefault(null, destination);
    var ns = new AglFormatNamespaceDefault(pqn.asQualifiedName(null), optHolder, import_0);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = definition.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      var def = element_0(ns);
      ns.addDefinition(def);
    }
    return ns;
  }
  t2z(nodeInfo, children, sentence) {
    var tmp = children.z(0);
    return (!(tmp == null) ? typeof tmp === 'function' : false) ? tmp : THROW_CCE();
  }
  u2z(nodeInfo, children, sentence) {
    var tmp = children.z(1);
    var name = _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
    var tmp_0 = children.z(2);
    var tmp0_elvis_lhs = (tmp_0 == null ? true : isInterface(tmp_0, KtList)) ? tmp_0 : THROW_CCE();
    var extendsFunc = tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs;
    var options = new OptionHolderDefault();
    var tmp_1 = children.z(4);
    var rules = (!(tmp_1 == null) ? isInterface(tmp_1, KtList) : false) ? tmp_1 : THROW_CCE();
    return AglFormatSyntaxAnalyser$format$lambda(extendsFunc, name, options, rules);
  }
  v2z(nodeInfo, children, sentence) {
    var tmp = children.z(0);
    var forTypeName = (!(tmp == null) ? isInterface(tmp, TypeReference) : false) ? tmp : THROW_CCE();
    var tmp_0 = children.z(2);
    var expression = (!(tmp_0 == null) ? isInterface(tmp_0, FormatExpression) : false) ? tmp_0 : THROW_CCE();
    return new AglFormatRuleDefault(forTypeName, expression);
  }
  w2z(nodeInfo, children, sentence) {
    var tmp;
    switch (_OptionNum___get_value__impl__ebz44c(nodeInfo.alt.option)) {
      case 0:
        var tmp_0 = children.z(0);
        tmp = new FormatExpressionExpressionDefault((!(tmp_0 == null) ? isInterface(tmp_0, Expression) : false) ? tmp_0 : THROW_CCE());
        break;
      case 1:
        var tmp_1 = children.z(0);
        tmp = (!(tmp_1 == null) ? isInterface(tmp_1, FormatExpressionTemplate) : false) ? tmp_1 : THROW_CCE();
        break;
      case 2:
        var tmp_2 = children.z(0);
        tmp = (!(tmp_2 == null) ? isInterface(tmp_2, FormatExpressionWhen) : false) ? tmp_2 : THROW_CCE();
        break;
      default:
        var message = 'Option not handled';
        throw IllegalStateException.v4(toString(message));
    }
    return tmp;
  }
}
class AglTemplateSyntaxAnalyser extends SyntaxAnalyserByMethodRegistrationAbstract {
  constructor() {
    super();
    this.d30_1 = emptyMap();
    this.e30_1 = mutableMapOf([to(new QualifiedName(_QualifiedName___init__impl__8ed982('net.akehurst.language.Expressions')), new ExpressionsSyntaxAnalyser())]);
  }
  s2k() {
    return this.d30_1;
  }
  e2k() {
    return this.e30_1;
  }
  registerHandlers() {
    super.register(AglTemplateSyntaxAnalyser$templateString$ref(this));
    super.register(AglTemplateSyntaxAnalyser$templateContent$ref(this));
    super.register(AglTemplateSyntaxAnalyser$text$ref(this));
    super.register(AglTemplateSyntaxAnalyser$templateExpression$ref(this));
    super.register(AglTemplateSyntaxAnalyser$templateExpressionProperty$ref(this));
    super.register(AglTemplateSyntaxAnalyser$templateExpressionList$ref(this));
    super.register(AglTemplateSyntaxAnalyser$templateExpressionEmbedded$ref(this));
  }
  f30(nodeInfo, children, sentence) {
    var tmp = children.z(1);
    var content = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
    return new FormatExpressionTemplateDefault(content);
  }
  g30(nodeInfo, children, sentence) {
    var tmp = children.z(0);
    return (!(tmp == null) ? isInterface(tmp, TemplateElement) : false) ? tmp : THROW_CCE();
  }
  h30(nodeInfo, children, sentence) {
    var tmp = children.z(0);
    var parsedText = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
    var unescaped = replace(parsedText, '\\', '');
    return new TemplateElementTextDefault(unescaped);
  }
  i30(nodeInfo, children, sentence) {
    var tmp = children.z(0);
    return (!(tmp == null) ? isInterface(tmp, TemplateElement) : false) ? tmp : THROW_CCE();
  }
  j30(nodeInfo, children, sentence) {
    var tmp = children.z(0);
    return new TemplateElementExpressionPropertyDefault(drop_0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE(), 1));
  }
  k30(nodeInfo, children, sentence) {
    var tmp = children.z(1);
    var expression = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
    var tmp_0 = children.z(3);
    var separator = replace(removeSurrounding((!(tmp_0 == null) ? typeof tmp_0 === 'string' : false) ? tmp_0 : THROW_CCE(), "'"), '\\\\n', '\n');
    return new TemplateElementExpressionListDefault(expression, separator);
  }
  l30(nodeInfo, children, sentence) {
    var tmp = children.z(1);
    return new TemplateElementExpressionEmbeddedDefault((!(tmp == null) ? isInterface(tmp, FormatExpression) : false) ? tmp : THROW_CCE());
  }
}
class FormatterOverAsmSimple {
  constructor(formatModel, typeModel, issues) {
    this.m30_1 = formatModel;
    this.typeModel = typeModel;
    this.issues = issues;
    this.n30_1 = new FormatterOverTypedObject(this.m30_1, new ObjectGraphAsmSimple(this.typeModel, this.issues), this.issues);
  }
  i1t() {
    return this.m30_1;
  }
  m2e() {
    return this.typeModel;
  }
  n16() {
    return this.issues;
  }
  format(formatSetName, asm) {
    var sb = StringBuilder.j();
    var _iterator__ex2g4s = asm.root.s();
    while (_iterator__ex2g4s.t()) {
      var root = _iterator__ex2g4s.u();
      var str = this.n30_1.format(formatSetName, root).sentence;
      sb.cb(str);
    }
    return new FormatResultDefault(sb.toString(), new IssueHolder(LanguageProcessorPhase_FORMAT_getInstance()));
  }
  get formatModel() {
    return this.i1t();
  }
}
class Companion_15 {
  constructor() {
    Companion_instance_16 = this;
    this.prefixMatchPattern = Regex.pe('\\s+');
  }
  o30() {
    return this.prefixMatchPattern;
  }
}
class FormatterOverTypedObject extends ExpressionsInterpreterOverTypedObject {
  constructor(formatModel, objectGraph, issues) {
    Companion_getInstance_18();
    super(objectGraph, issues);
    this.p30_1 = formatModel;
    var tmp = this;
    tmp.r30_1 = lazy(FormatterOverTypedObject$_rules$delegate$lambda(this));
  }
  i1t() {
    return this.p30_1;
  }
  findRuleFor(type) {
    var tmp0 = _get__rules__3nlhbh(this).w2();
    var tmp$ret$3;
    $l$block: {
      // Inline function 'kotlin.collections.firstOrNull' call
      var _iterator__ex2g4s = tmp0.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        // Inline function 'kotlin.collections.component1' call
        var ti = element.a3();
        // Inline function 'kotlin.collections.component2' call
        var rl = element.b3();
        if (type.conformsTo(ti)) {
          tmp$ret$3 = element;
          break $l$block;
        }
      }
      tmp$ret$3 = null;
    }
    var tmp0_safe_receiver = tmp$ret$3;
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.b3();
  }
  format(formatSetName, asm) {
    var tmp = this;
    var tmp0_elvis_lhs = this.p30_1.findFirstDefinitionByPossiblyQualifiedNameOrNull(formatSetName);
    var tmp_0;
    if (tmp0_elvis_lhs == null) {
      var message = "FormatSet named '" + formatSetName.value + "' cannot be found";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_0 = tmp0_elvis_lhs;
    }
    tmp.q30_1 = tmp_0;
    var typesSelf = this.objectGraph.toTypedObject(asm);
    var evc = Companion_instance_14.ofSelf(typesSelf);
    var str = formatSelf(this, evc);
    return new FormatResultDefault(str, this.issues);
  }
  evaluateExpression(evc, expression) {
    var tmp;
    if (isInterface(expression, FormatExpression)) {
      var tmp_0;
      if (isInterface(expression, FormatExpressionExpression)) {
        tmp_0 = formatFromExpression(this, evc, expression);
      } else {
        if (isInterface(expression, FormatExpressionTemplate)) {
          tmp_0 = formatFromTemplate(this, evc, expression);
        } else {
          if (isInterface(expression, FormatExpressionWhen)) {
            tmp_0 = formatFromWhen(this, evc, expression);
          } else {
            var message = "Subtype of FormatExpression not handled in evaluateExpression '" + getKClassFromExpression(expression).zc() + "'";
            throw IllegalStateException.v4(toString(message));
          }
        }
      }
      var fmt = tmp_0;
      tmp = this.objectGraph.toTypedObject(!(fmt == null) ? fmt : THROW_CCE());
    } else {
      tmp = super.evaluateExpression(evc, expression);
    }
    return tmp;
  }
  get formatModel() {
    return this.i1t();
  }
}
class GrammarModel {}
function get_primary() {
  var tmp0_safe_receiver = lastOrNull(this.namespace);
  var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.definition;
  return tmp1_safe_receiver == null ? null : lastOrNull(tmp1_safe_receiver);
}
class GrammarModelDefault extends ModelAbstract {
  constructor(name, options, namespace) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    namespace = namespace === VOID ? emptyList() : namespace;
    super(namespace, options);
    this.v30_1 = name;
  }
  f2h() {
    return this.v30_1;
  }
  hashCode() {
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    var tmp$ret$2 = [new SimpleName(this.v30_1), this.namespace];
    return contentHashCode(tmp$ret$2);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, GrammarModel) : false)) {
      tmp = false;
    } else {
      if (!(this.v30_1 === other.name)) {
        tmp = false;
      } else {
        if (!equals(this.namespace, other.namespace)) {
          tmp = false;
        } else {
          tmp = true;
        }
      }
    }
    return tmp;
  }
  toString() {
    return "GrammarModel '" + SimpleName__toString_impl_vxsxyc(this.v30_1) + "'";
  }
  get primary() {
    return this.w30();
  }
}
class GrammarNamespace {}
class GrammarNamespaceDefault extends NamespaceAbstract {
  constructor(qualifiedName, options, import_0) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    import_0 = import_0 === VOID ? emptyList() : import_0;
    super(options, import_0);
    this.z30_1 = qualifiedName;
  }
  u2h() {
    return this.z30_1;
  }
}
class Companion_16 {
  fromString() {
  }
}
class Grammar {}
function findAllResolvedEmbeddedGrammars(found, $super) {
  found = found === VOID ? emptySet() : found;
  return $super === VOID ? this.g33(found) : $super.g33.call(this, found);
}
class GrammarAbstract {
  constructor(namespace, name, options) {
    this.namespace = namespace;
    this.name = name;
    this.u31_1 = options;
    this.namespace.addDefinition(this);
    var tmp = this;
    tmp.v31_1 = lazy(GrammarAbstract$selfReference$delegate$lambda(this));
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_0.w31_1 = ArrayList.y();
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_1.x31_1 = ArrayList.y();
    var tmp_2 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_2.y31_1 = ArrayList.y();
    var tmp_3 = this;
    tmp_3.z31_1 = lazy(GrammarAbstract$allGrammarReferencesInRules$delegate$lambda(this));
    var tmp_4 = this;
    tmp_4.a32_1 = lazy(GrammarAbstract$allExtends$delegate$lambda(this));
    var tmp_5 = this;
    tmp_5.b32_1 = lazy(GrammarAbstract$directInheritedGrammarRule$delegate$lambda(this));
    var tmp_6 = this;
    tmp_6.c32_1 = lazy(GrammarAbstract$allGrammarRule$delegate$lambda(this));
    var tmp_7 = this;
    tmp_7.d32_1 = lazy(GrammarAbstract$directInheritedResolvedGrammarRule$delegate$lambda(this));
    var tmp_8 = this;
    tmp_8.e32_1 = lazy(GrammarAbstract$allInheritedResolvedGrammarRule$delegate$lambda(this));
    var tmp_9 = this;
    tmp_9.f32_1 = lazy(GrammarAbstract$resolvedGrammarRule$delegate$lambda(this));
    var tmp_10 = this;
    tmp_10.g32_1 = lazy(GrammarAbstract$allResolvedGrammarRule$delegate$lambda(this));
    var tmp_11 = this;
    tmp_11.h32_1 = lazy(GrammarAbstract$allResolvedTerminal$delegate$lambda(this));
    var tmp_12 = this;
    tmp_12.i32_1 = lazy(GrammarAbstract$allResolvedSkipTerminal$delegate$lambda(this));
    var tmp_13 = this;
    tmp_13.j32_1 = lazy(GrammarAbstract$allResolvedNonTerminalRule$delegate$lambda(this));
    var tmp_14 = this;
    tmp_14.k32_1 = lazy(GrammarAbstract$allResolvedPreferenceRuleRule$delegate$lambda(this));
    var tmp_15 = this;
    tmp_15.l32_1 = lazy(GrammarAbstract$allResolvedEmbeddedRules$delegate$lambda(this));
    var tmp_16 = this;
    tmp_16.m32_1 = lazy(GrammarAbstract$allResolvedEmbeddedGrammars$delegate$lambda(this));
  }
  e2h() {
    return this.namespace;
  }
  f2h() {
    return this.name;
  }
  x1c() {
    return this.u31_1;
  }
  n32() {
    var tmp0 = this.v31_1;
    // Inline function 'kotlin.getValue' call
    selfReference$factory();
    return tmp0.b3();
  }
  u2h() {
    return QualifiedName__append_impl_hhmte4(this.namespace.qualifiedName, this.name);
  }
  w2x() {
    return this.w31_1;
  }
  o32() {
    return this.x31_1;
  }
  p32() {
    return this.y31_1;
  }
  q32() {
    var tmp0 = this.z31_1;
    // Inline function 'kotlin.getValue' call
    allGrammarReferencesInRules$factory();
    return tmp0.b3();
  }
  r32() {
    // Inline function 'kotlin.collections.mapNotNull' call
    var tmp0 = this.extends;
    // Inline function 'kotlin.collections.mapNotNullTo' call
    var destination = ArrayList.y();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0_safe_receiver = element.resolved;
      if (tmp0_safe_receiver == null)
        null;
      else {
        // Inline function 'kotlin.let' call
        destination.r(tmp0_safe_receiver);
      }
    }
    return destination;
  }
  s32() {
    var tmp0 = this.a32_1;
    // Inline function 'kotlin.getValue' call
    allExtends$factory();
    return tmp0.b3();
  }
  t32() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.allExtends;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0_safe_receiver = element.resolved;
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.allExtendsResolved;
      var list = tmp1_elvis_lhs == null ? orderedSetOf([]) : tmp1_elvis_lhs;
      addAll(destination, list);
    }
    return plus_5(toOrderedSet(destination), this.extendsResolved);
  }
  u32() {
    var tmp0 = this.b32_1;
    // Inline function 'kotlin.getValue' call
    directInheritedGrammarRule$factory();
    return tmp0.b3();
  }
  v32() {
    var tmp0 = this.c32_1;
    // Inline function 'kotlin.getValue' call
    allGrammarRule$factory();
    return tmp0.b3();
  }
  w32() {
    var tmp0 = this.d32_1;
    // Inline function 'kotlin.getValue' call
    directInheritedResolvedGrammarRule$factory();
    return tmp0.b3();
  }
  x32() {
    var tmp0 = this.e32_1;
    // Inline function 'kotlin.getValue' call
    allInheritedResolvedGrammarRule$factory();
    return tmp0.b3();
  }
  y32() {
    var tmp0 = this.f32_1;
    // Inline function 'kotlin.getValue' call
    resolvedGrammarRule$factory();
    return tmp0.b3();
  }
  z32() {
    var tmp0 = this.g32_1;
    // Inline function 'kotlin.getValue' call
    allResolvedGrammarRule$factory();
    return tmp0.b3();
  }
  a33() {
    var tmp0 = this.h32_1;
    // Inline function 'kotlin.getValue' call
    allResolvedTerminal$factory();
    return tmp0.b3();
  }
  b33() {
    var tmp0 = this.i32_1;
    // Inline function 'kotlin.getValue' call
    allResolvedSkipTerminal$factory();
    return tmp0.b3();
  }
  c33() {
    var tmp0 = this.j32_1;
    // Inline function 'kotlin.getValue' call
    allResolvedNonTerminalRule$factory();
    return tmp0.b3();
  }
  d33() {
    var tmp0 = this.k32_1;
    // Inline function 'kotlin.getValue' call
    allResolvedPreferenceRuleRule$factory();
    return tmp0.b3();
  }
  e33() {
    var tmp0 = this.l32_1;
    // Inline function 'kotlin.getValue' call
    allResolvedEmbeddedRules$factory();
    return tmp0.b3();
  }
  f33() {
    var tmp0 = this.m32_1;
    // Inline function 'kotlin.getValue' call
    allResolvedEmbeddedGrammars$factory();
    return tmp0.b3();
  }
  findOwnedGrammarRuleOrNull(ruleName) {
    var tmp0 = this.grammarRule;
    var tmp$ret$1;
    $l$block: {
      // Inline function 'kotlin.collections.firstOrNull' call
      var _iterator__ex2g4s = tmp0.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        if (element.name === ruleName) {
          tmp$ret$1 = element;
          break $l$block;
        }
      }
      tmp$ret$1 = null;
    }
    return tmp$ret$1;
  }
  findAllSuperGrammarRule(ruleName) {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.extends;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0_safe_receiver = element.resolved;
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.allGrammarRule;
      var list = tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs;
      addAll(destination, list);
    }
    var rules = toMutableOrderedSet(destination);
    // Inline function 'kotlin.collections.filter' call
    // Inline function 'kotlin.collections.filterTo' call
    var destination_0 = ArrayList.y();
    var _iterator__ex2g4s_0 = rules.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      if (!equals(element_0.grammar, this) && element_0.name === ruleName) {
        destination_0.r(element_0);
      }
    }
    return destination_0;
  }
  findAllGrammarRuleList(ruleName) {
    // Inline function 'kotlin.collections.filter' call
    var tmp0 = this.allGrammarRule;
    // Inline function 'kotlin.collections.filterTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (element.name === ruleName) {
        destination.r(element);
      }
    }
    return destination;
  }
  findAllResolvedGrammarRule(ruleName) {
    // Inline function 'kotlin.collections.filter' call
    var tmp0 = this.allResolvedGrammarRule;
    // Inline function 'kotlin.collections.filterTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (element.name === ruleName) {
        destination.r(element);
      }
    }
    var all = destination;
    var tmp;
    if (all.a1()) {
      tmp = null;
    } else if (toSet(all).v() > 1) {
      var message = "More than one rule named '" + GrammarRuleName__toString_impl_przz03(ruleName) + "' in grammar '" + SimpleName__toString_impl_vxsxyc(this.name) + "', have you remembered the 'override' modifier";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = first(all);
    }
    return tmp;
  }
  findAllResolvedTerminalRule(terminalPattern) {
    // Inline function 'kotlin.collections.filter' call
    var tmp0 = this.allResolvedTerminal;
    // Inline function 'kotlin.collections.filterTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (element.value === terminalPattern) {
        destination.r(element);
      }
    }
    var all = destination;
    if (all.a1()) {
      // Inline function 'kotlin.error' call
      var message = terminalPattern + ' in Grammar(' + SimpleName__toString_impl_vxsxyc(this.name) + ').findTerminalRule';
      throw IllegalStateException.v4(toString(message));
    } else if (all.v() > 1) {
      // Inline function 'kotlin.error' call
      var message_0 = 'More than one rule named ' + terminalPattern + ' in Grammar(' + SimpleName__toString_impl_vxsxyc(this.name) + ').findTerminalRule';
      throw IllegalStateException.v4(toString(message_0));
    }
    return first(all);
  }
  g33(found) {
    var tmp;
    if (found.e1(this)) {
      tmp = emptySet();
    } else {
      // Inline function 'kotlin.collections.mapNotNull' call
      var tmp0 = this.allResolvedEmbeddedRules;
      // Inline function 'kotlin.collections.mapNotNullTo' call
      var destination = ArrayList.y();
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s = tmp0.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        var tmp0_safe_receiver = element.embeddedGrammarReference.resolved;
        if (tmp0_safe_receiver == null)
          null;
        else {
          // Inline function 'kotlin.let' call
          destination.r(tmp0_safe_receiver);
        }
      }
      var egs = toSet(destination);
      // Inline function 'kotlin.collections.flatMap' call
      // Inline function 'kotlin.collections.flatMapTo' call
      var destination_0 = ArrayList.y();
      var _iterator__ex2g4s_0 = egs.s();
      while (_iterator__ex2g4s_0.t()) {
        var element_0 = _iterator__ex2g4s_0.u();
        var list = element_0.findAllResolvedEmbeddedGrammars(plus_2(found, egs));
        addAll(destination_0, list);
      }
      tmp = plus_2(egs, toSet(destination_0));
    }
    return tmp;
  }
  h2f(indent) {
    var sb = StringBuilder.j();
    sb.cb('grammar ' + SimpleName__toString_impl_vxsxyc(this.name));
    var tmp;
    if (this.extends.a1()) {
      tmp = '';
    } else {
      var tmp_0 = this.extends;
      tmp = ' : ' + joinToString(tmp_0, ', ', VOID, VOID, VOID, VOID, GrammarAbstract$asString$lambda);
    }
    var extendsStr = tmp;
    sb.cb(extendsStr);
    sb.cb(' {\n');
    var ni = indent.inc;
    var tmp_1 = this.grammarRule;
    var rulesStr = joinToString(tmp_1, '\n', VOID, VOID, VOID, VOID, GrammarAbstract$asString$lambda_0(ni));
    sb.cb(rulesStr);
    sb.cb('\n' + indent.toString() + '}');
    return sb.toString();
  }
  hashCode() {
    return QualifiedName__hashCode_impl_dcqht7(this.qualifiedName);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, Grammar) : false)) {
      tmp = false;
    } else {
      tmp = this.qualifiedName === other.qualifiedName;
    }
    return tmp;
  }
  toString() {
    return _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  get options() {
    return this.x1c();
  }
  get selfReference() {
    return this.n32();
  }
  get qualifiedName() {
    return this.u2h();
  }
  get extends() {
    return this.w2x();
  }
  get grammarRule() {
    return this.o32();
  }
  get preferenceRule() {
    return this.p32();
  }
  get allGrammarReferencesInRules() {
    return this.q32();
  }
  get extendsResolved() {
    return this.r32();
  }
  get allExtends() {
    return this.s32();
  }
  get allExtendsResolved() {
    return this.t32();
  }
  get directInheritedGrammarRule() {
    return this.u32();
  }
  get allGrammarRule() {
    return this.v32();
  }
  get directInheritedResolvedGrammarRule() {
    return this.w32();
  }
  get allInheritedResolvedGrammarRule() {
    return this.x32();
  }
  get resolvedGrammarRule() {
    return this.y32();
  }
  get allResolvedGrammarRule() {
    return this.z32();
  }
  get allResolvedTerminal() {
    return this.a33();
  }
  get allResolvedSkipTerminal() {
    return this.b33();
  }
  get allResolvedNonTerminalRule() {
    return this.c33();
  }
  get allResolvedPreferenceRuleRule() {
    return this.d33();
  }
  get allResolvedEmbeddedRules() {
    return this.e33();
  }
  get allResolvedEmbeddedGrammars() {
    return this.f33();
  }
  get defaultGoalRule() {
    return this.t31();
  }
}
class GrammarDefault extends GrammarAbstract {
  t31() {
    var tmp0_safe_receiver = this.options.get('defaultGoalRule');
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp = this.findAllResolvedGrammarRule(_GrammarRuleName___init__impl__yqiut(tmp0_safe_receiver));
    }
    var tmp1_elvis_lhs = tmp;
    var tmp_0;
    if (tmp1_elvis_lhs == null) {
      var tmp2 = this.allResolvedGrammarRule;
      var tmp$ret$3;
      $l$block: {
        // Inline function 'kotlin.collections.firstOrNull' call
        var _iterator__ex2g4s = tmp2.s();
        while (_iterator__ex2g4s.t()) {
          var element = _iterator__ex2g4s.u();
          if (!element.isSkip) {
            tmp$ret$3 = element;
            break $l$block;
          }
        }
        tmp$ret$3 = null;
      }
      tmp_0 = tmp$ret$3;
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    var tmp2_elvis_lhs = tmp_0;
    var tmp_1;
    if (tmp2_elvis_lhs == null) {
      var message = 'Could not find default grammar rule or first non skip rule';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_1 = tmp2_elvis_lhs;
    }
    return tmp_1;
  }
}
class GrammarReference {}
class GrammarReferenceDefault {
  constructor(localNamespace, nameOrQName) {
    this.h33_1 = localNamespace;
    this.i33_1 = nameOrQName;
    this.j33_1 = null;
  }
  f2t() {
    return this.h33_1;
  }
  g2t() {
    return this.i33_1;
  }
  k33(_set____db54di) {
    this.j33_1 = _set____db54di;
  }
  i2t() {
    return this.j33_1;
  }
  resolveAs(resolved) {
    this.j33_1 = resolved;
  }
  bh() {
    return this.h33_1;
  }
  ch() {
    return this.i33_1;
  }
  l33(localNamespace, nameOrQName) {
    return new GrammarReferenceDefault(localNamespace, nameOrQName);
  }
  copy(localNamespace, nameOrQName, $super) {
    localNamespace = localNamespace === VOID ? this.h33_1 : localNamespace;
    nameOrQName = nameOrQName === VOID ? this.i33_1 : nameOrQName;
    return $super === VOID ? this.l33(localNamespace, nameOrQName) : $super.l33.call(this, localNamespace, nameOrQName);
  }
  toString() {
    return 'GrammarReferenceDefault(localNamespace=' + toString(this.h33_1) + ', nameOrQName=' + toString(this.i33_1) + ')';
  }
  hashCode() {
    var result = hashCode(this.h33_1);
    result = imul(result, 31) + hashCode(this.i33_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof GrammarReferenceDefault))
      return false;
    var tmp0_other_with_cast = other instanceof GrammarReferenceDefault ? other : THROW_CCE();
    if (!equals(this.h33_1, tmp0_other_with_cast.h33_1))
      return false;
    if (!equals(this.i33_1, tmp0_other_with_cast.i33_1))
      return false;
    return true;
  }
  get localNamespace() {
    return this.f2t();
  }
  get nameOrQName() {
    return this.g2t();
  }
  get resolved() {
    return this.i2t();
  }
  set resolved(value) {
    this.k33(value);
  }
}
class Companion_17 {
  m33(rule, inheritedRules) {
    var tmp;
    if (isInterface(rule, OverrideRule)) {
      // Inline function 'kotlin.collections.find' call
      var tmp$ret$1;
      $l$block: {
        // Inline function 'kotlin.collections.firstOrNull' call
        var _iterator__ex2g4s = inheritedRules.s();
        while (_iterator__ex2g4s.t()) {
          var element = _iterator__ex2g4s.u();
          if (element.name === rule.name) {
            tmp$ret$1 = element;
            break $l$block;
          }
        }
        tmp$ret$1 = null;
      }
      var overridden = tmp$ret$1;
      var tmp_0;
      if (overridden == null) {
        var nr = new NormalRuleDefault(rule.grammar, rule.name, rule.isSkip, rule.isLeaf);
        nr.rhs = (isInterface(rule, OverrideRule) ? rule : THROW_CCE()).overriddenRhs;
        nr.rhs.setOwningRule(nr, emptyList());
        tmp_0 = nr;
      } else {
        tmp_0 = rule;
      }
      tmp = tmp_0;
    } else {
      // Inline function 'kotlin.collections.find' call
      var tmp$ret$4;
      $l$block_0: {
        // Inline function 'kotlin.collections.firstOrNull' call
        var _iterator__ex2g4s_0 = inheritedRules.s();
        while (_iterator__ex2g4s_0.t()) {
          var element_0 = _iterator__ex2g4s_0.u();
          var tmp_1;
          if (element_0.name === rule.name) {
            tmp_1 = isInterface(element_0, OverrideRule);
          } else {
            tmp_1 = false;
          }
          if (tmp_1) {
            tmp$ret$4 = element_0;
            break $l$block_0;
          }
        }
        tmp$ret$4 = null;
      }
      var overriddenBy = tmp$ret$4;
      tmp = overriddenBy == null ? rule : overriddenBy;
    }
    return tmp;
  }
}
class GrammarItem {}
class GrammarItemAbstract {
  get grammar() {
    return this.j21();
  }
}
class RuleItem {}
class ConcatenationItem {}
class SimpleItem {}
class TangibleItem {}
class Terminal {}
class RuleItemAbstract {
  constructor() {
    this._owningRule = null;
    this.index = null;
  }
  b34(_set____db54di) {
    this._owningRule = _set____db54di;
  }
  c34() {
    return this._owningRule;
  }
  a34() {
    var tmp0_elvis_lhs = this._owningRule;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = 'Internal Error: owningRule must be set';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  d34(_set____db54di) {
    this.index = _set____db54di;
  }
  f1m() {
    return this.index;
  }
  get owningRule() {
    return this.a34();
  }
  get allTerminal() {
    return this.t33();
  }
  get allNonTerminal() {
    return this.u33();
  }
  get allEmbedded() {
    return this.v33();
  }
  get firstTerminal() {
    return this.w33();
  }
  get firstTangible() {
    return this.x33();
  }
  get firstTangibleRecursive() {
    return this.y33();
  }
  get firstConcatenationRecursive() {
    return this.z33();
  }
}
class CompressedLeafRule extends RuleItemAbstract {
  constructor(id, value, isPattern) {
    super();
    this.n33_1 = id;
    this.o33_1 = value;
    this.p33_1 = isPattern;
    this.q33_1 = setOf(this);
    this.r33_1 = emptySet();
    this.s33_1 = emptySet();
  }
  n2n() {
    return this.n33_1;
  }
  b3() {
    return this.o33_1;
  }
  o1c() {
    return this.p33_1;
  }
  n1c() {
    return !this.p33_1;
  }
  t33() {
    return this.q33_1;
  }
  u33() {
    return this.r33_1;
  }
  v33() {
    return this.s33_1;
  }
  w33() {
    return emptySet();
  }
  x33() {
    return emptySet();
  }
  y33() {
    return emptySet();
  }
  z33() {
    return emptySet();
  }
  setOwningRule(rule, indices) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  subItem(index) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  itemsForChild(childNumber) {
    return emptySet();
  }
  get id() {
    return this.n2n();
  }
  get value() {
    return this.b3();
  }
  get isPattern() {
    return this.o1c();
  }
  get isLiteral() {
    return this.n1c();
  }
}
class Companion_18 {
  compressRuleItem(compressedName, item) {
    var grammar = item.owningRule.grammar;
    var tmp;
    if (isInterface(item, Terminal)) {
      tmp = item.isPattern ? new CompressedLeafRule(compressedName, item.value, true) : new CompressedLeafRule(compressedName, toRegEx(this, item.value), false);
    } else {
      if (isInterface(item, Concatenation)) {
        var tmp_0;
        if (1 === item.items.v()) {
          tmp_0 = this.compressRuleItem(compressedName, item.items.z(0));
        } else {
          // Inline function 'kotlin.collections.mapIndexed' call
          var this_0 = item.items;
          // Inline function 'kotlin.collections.mapIndexedTo' call
          var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
          var index = 0;
          var _iterator__ex2g4s = this_0.s();
          while (_iterator__ex2g4s.t()) {
            var item_0 = _iterator__ex2g4s.u();
            var _unary__edvuaz = index;
            index = _unary__edvuaz + 1 | 0;
            var idx = checkIndexOverflow(_unary__edvuaz);
            var tmp$ret$0 = Companion_instance_19.compressRuleItem(compressedName + idx, item_0);
            destination.r(tmp$ret$0);
          }
          var items = destination;
          var pattern = joinToString(items, '', VOID, VOID, VOID, VOID, GrammarRuleAbstract$Companion$compressRuleItem$lambda);
          tmp_0 = new CompressedLeafRule(compressedName, pattern, true);
        }
        tmp = tmp_0;
      } else {
        if (isInterface(item, Choice)) {
          var tmp_1;
          if (item.alternative.v() === 1) {
            tmp_1 = this.compressRuleItem(compressedName, item.alternative.z(0));
          } else {
            // Inline function 'kotlin.collections.mapIndexed' call
            var this_1 = item.alternative;
            // Inline function 'kotlin.collections.mapIndexedTo' call
            var destination_0 = ArrayList.w(collectionSizeOrDefault(this_1, 10));
            var index_0 = 0;
            var _iterator__ex2g4s_0 = this_1.s();
            while (_iterator__ex2g4s_0.t()) {
              var item_1 = _iterator__ex2g4s_0.u();
              var _unary__edvuaz_0 = index_0;
              index_0 = _unary__edvuaz_0 + 1 | 0;
              var idx_0 = checkIndexOverflow(_unary__edvuaz_0);
              var tmp$ret$3 = Companion_instance_19.compressRuleItem(compressedName + idx_0, item_1);
              destination_0.r(tmp$ret$3);
            }
            var ct = destination_0;
            var pattern_0 = joinToString(ct, '|', VOID, VOID, VOID, VOID, GrammarRuleAbstract$Companion$compressRuleItem$lambda_0);
            tmp_1 = new CompressedLeafRule(compressedName, pattern_0, true);
          }
          tmp = tmp_1;
        } else {
          if (isInterface(item, OptionalItem)) {
            var ct_0 = this.compressRuleItem(compressedName + 'List', item.item);
            var pattern_1 = '(' + ct_0.o33_1 + ')?';
            tmp = new CompressedLeafRule(compressedName, pattern_1, true);
          } else {
            if (isInterface(item, SimpleList)) {
              var ct_1 = this.compressRuleItem(compressedName + 'List', item.item);
              var min = item.min;
              var max = -1 === item.max ? '' : item.max;
              var pattern_2 = '(' + ct_1.o33_1 + '){' + min + ',' + toString(max) + '}';
              tmp = new CompressedLeafRule(compressedName, pattern_2, true);
            } else {
              if (isInterface(item, Group)) {
                var ct_2 = this.compressRuleItem(compressedName + 'Group', item.groupedContent);
                var pattern_3 = '(' + ct_2.o33_1 + ')';
                tmp = new CompressedLeafRule(compressedName, pattern_3, true);
              } else {
                if (isInterface(item, NonTerminal)) {
                  tmp = this.compressRuleItem(compressedName, item.referencedRule(grammar).rhs);
                } else {
                  var message = 'GrammarRule ' + GrammarRuleName__toString_impl_przz03(item.owningRule.name) + ', compressing ' + getKClassFromExpression(item).zc() + ' to leaf is not yet supported';
                  throw IllegalStateException.v4(toString(message));
                }
              }
            }
          }
        }
      }
    }
    var cr = tmp;
    return cr;
  }
}
class GrammarRule {}
class GrammarRuleAbstract extends GrammarItemAbstract {
  constructor() {
    super();
    var tmp = this;
    tmp.e34_1 = lazy(GrammarRuleAbstract$compressedLeaf$delegate$lambda(this));
  }
  u2h() {
    return QualifiedName__append_impl_hhmte4(this.grammar.qualifiedName, _SimpleName___init__impl__6s45d0(_GrammarRuleName___get_value__impl__470s0v(this.name)));
  }
  f34() {
    var tmp;
    var tmp_0 = this.rhs;
    if (isInterface(tmp_0, Embedded)) {
      tmp = true;
    } else {
      var tmp_1;
      var tmp_2 = this.rhs;
      if (isInterface(tmp_2, Concatenation)) {
        var tmp_3 = this.rhs;
        var tmp_4 = (isInterface(tmp_3, Concatenation) ? tmp_3 : THROW_CCE()).items.z(0);
        tmp_1 = isInterface(tmp_4, Embedded);
      } else {
        tmp_1 = false;
      }
      tmp = tmp_1;
    }
    return tmp;
  }
  g34() {
    var tmp0 = this.e34_1;
    // Inline function 'kotlin.getValue' call
    compressedLeaf$factory();
    return tmp0.b3();
  }
  get qualifiedName() {
    return this.u2h();
  }
  get isOneEmbedded() {
    return this.f34();
  }
  get compressedLeaf() {
    return this.g34();
  }
  get grammar() {
    return this.j21();
  }
  get name() {
    return this.h34();
  }
  get isOverride() {
    return this.i34();
  }
  get isSkip() {
    return this.cv();
  }
  get isLeaf() {
    return this.c11();
  }
  get rhs() {
    return this.l12();
  }
}
class NormalRule {}
class NormalRuleDefault extends GrammarRuleAbstract {
  constructor(grammar, name, isSkip, isLeaf) {
    super();
    this.k34_1 = grammar;
    this.l34_1 = name;
    this.m34_1 = isSkip;
    this.n34_1 = isLeaf;
    this.o34_1 = false;
    this.p34_1 = null;
  }
  j21() {
    return this.k34_1;
  }
  h34() {
    return this.l34_1;
  }
  cv() {
    return this.m34_1;
  }
  c11() {
    return this.n34_1;
  }
  i34() {
    return this.o34_1;
  }
  q34(value) {
    value.setOwningRule(this, listOf(0));
    this.p34_1 = value;
  }
  l12() {
    var tmp0_elvis_lhs = this.p34_1;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = 'rhs of rule must be set';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  h2f(indent) {
    var f = '';
    if (this.m34_1)
      f = f + 'skip ';
    if (this.n34_1)
      f = f + 'leaf ';
    var rhsStr = toString(this.rhs);
    return f + GrammarRuleName__toString_impl_przz03(this.l34_1) + ' = ' + rhsStr + ' ;';
  }
  hashCode() {
    return hashCode(listOf_0([new GrammarRuleName(this.l34_1), this.k34_1]));
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, NormalRule) : false)) {
      tmp = false;
    } else {
      tmp = (this.l34_1 === other.name && equals(other.grammar, this.k34_1));
    }
    return tmp;
  }
  toString() {
    var f = '';
    if (this.m34_1)
      f = f + 'skip ';
    if (this.n34_1)
      f = f + 'leaf ';
    return f + GrammarRuleName__toString_impl_przz03(this.l34_1) + ' = ' + toString(this.rhs) + ' ;';
  }
  get rhs() {
    return this.l12();
  }
  set rhs(value) {
    this.q34(value);
  }
}
class OverrideRule {}
class OverrideRuleDefault extends GrammarRuleAbstract {
  constructor(grammar, name, isSkip, isLeaf, overrideKind) {
    super();
    this.s34_1 = grammar;
    this.t34_1 = name;
    this.u34_1 = isSkip;
    this.v34_1 = isLeaf;
    this.w34_1 = overrideKind;
    this.x34_1 = true;
    this.y34_1 = null;
  }
  j21() {
    return this.s34_1;
  }
  h34() {
    return this.t34_1;
  }
  cv() {
    return this.u34_1;
  }
  c11() {
    return this.v34_1;
  }
  z34() {
    return this.w34_1;
  }
  i34() {
    return this.x34_1;
  }
  a35(value) {
    value.setOwningRule(this, listOf(0));
    this.y34_1 = value;
  }
  b35() {
    var tmp0_elvis_lhs = this.y34_1;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = 'overridenRhs of rule must be set';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  l12() {
    var tmp;
    switch (this.w34_1.d3_1) {
      case 0:
        tmp = this.overriddenRhs;
        break;
      case 2:
        var tmp1_subject = this.overriddenRhs;
        var tmp_0;
        if (isInterface(tmp1_subject, NonTerminal)) {
          var tmp_1 = this.overriddenRhs;
          var tmp2_safe_receiver = (isInterface(tmp_1, NonTerminal) ? tmp_1 : THROW_CCE()).targetGrammar;
          var tg = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.resolved;
          var tmp_2;
          if (tg == null) {
            var message = 'Override rule using substitution must contain a "qualified" non-terminal, there is no reference to an extended grammar.';
            throw IllegalStateException.v4(toString(message));
          } else {
            var tmp1 = this.s34_1.allExtendsResolved;
            var tmp$ret$0;
            $l$block_0: {
              // Inline function 'kotlin.collections.any' call
              var tmp_3;
              if (isInterface(tmp1, Collection)) {
                tmp_3 = tmp1.a1();
              } else {
                tmp_3 = false;
              }
              if (tmp_3) {
                tmp$ret$0 = false;
                break $l$block_0;
              }
              var _iterator__ex2g4s = tmp1.s();
              while (_iterator__ex2g4s.t()) {
                var element = _iterator__ex2g4s.u();
                if (equals(tg, element)) {
                  tmp$ret$0 = true;
                  break $l$block_0;
                }
              }
              tmp$ret$0 = false;
            }
            if (tmp$ret$0) {
              var or = tg.findAllResolvedGrammarRule(this.t34_1);
              var tmp_4;
              if (null == or) {
                var tmp_5 = this.overriddenRhs;
                var message_0 = "Cannot find rule '" + GrammarRuleName__toString_impl_przz03((isInterface(tmp_5, NonTerminal) ? tmp_5 : THROW_CCE()).ruleReference) + "' in grammar '" + SimpleName__toString_impl_vxsxyc(tg.name) + "' for override substitution.";
                throw IllegalStateException.v4(toString(message_0));
              } else {
                tmp_4 = or.rhs;
              }
              tmp_2 = tmp_4;
            } else {
              var message_1 = "Grammar '" + SimpleName__toString_impl_vxsxyc(tg.name) + "' is not extended by this grammar, cannot substitute a rule if it is not inherited.";
              throw IllegalStateException.v4(toString(message_1));
            }
          }
          tmp_0 = tmp_2;
        } else {
          // Inline function 'kotlin.error' call
          var message_2 = 'Override rule using inherited rule must contain a single qualified non-terminal.';
          throw IllegalStateException.v4(toString(message_2));
        }

        tmp = tmp_0;
        break;
      case 1:
        var or_0 = firstOrNull(this.s34_1.findAllSuperGrammarRule(this.t34_1));
        var tmp_6;
        if (null == or_0) {
          // Inline function 'kotlin.error' call
          var message_3 = 'Rule ' + GrammarRuleName__toString_impl_przz03(this.t34_1) + ' is marked as override, but there is no super rule with that name to override.';
          throw IllegalStateException.v4(toString(message_3));
        } else {
          var tmp3_subject = or_0.rhs;
          var tmp_7;
          if (isInterface(tmp3_subject, ChoiceLongest)) {
            var tmp_8 = or_0.rhs;
            var appendedAlternatives = plus_0((isInterface(tmp_8, ChoiceLongest) ? tmp_8 : THROW_CCE()).alternative, this.overriddenRhs);
            var ac = new ChoiceLongestDefault(appendedAlternatives);
            var tmp_9 = or_0.rhs;
            var indices = ensureNotNull((tmp_9 instanceof ChoiceLongestDefault ? tmp_9 : THROW_CCE()).index);
            var ni = plus_0(plus_0(dropLast(indices, 1), last(indices)), 1);
            ac.setOwningRule(this, ni);
            tmp_7 = ac;
          } else {
            if (isInterface(tmp3_subject, NonTerminal)) {
              var appendedAlternatives_0 = listOf_0([or_0.rhs, this.overriddenRhs]);
              var ac_0 = new ChoiceLongestDefault(appendedAlternatives_0);
              var ni_0 = listOf_0([0, 1]);
              ac_0.setOwningRule(this, ni_0);
              tmp_7 = ac_0;
            } else {
              if (isInterface(tmp3_subject, Terminal)) {
                var appendedAlternatives_1 = listOf_0([or_0.rhs, this.overriddenRhs]);
                var ac_1 = new ChoiceLongestDefault(appendedAlternatives_1);
                var ni_1 = listOf_0([0, 1]);
                ac_1.setOwningRule(this, ni_1);
                tmp_7 = ac_1;
              } else {
                var message_4 = 'Cannot append choice overriden rule is not a choice or single NonTerminal';
                throw IllegalStateException.v4(toString(message_4));
              }
            }
          }
          tmp_6 = tmp_7;
        }

        tmp = tmp_6;
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
    return tmp;
  }
  h2f(indent) {
    var f = '';
    if (this.u34_1)
      f = f + 'skip ';
    if (this.v34_1)
      f = f + 'leaf ';
    var rhsStr = toString(this.rhs);
    return 'override ' + f + GrammarRuleName__toString_impl_przz03(this.t34_1) + ' = ' + rhsStr + ' ;';
  }
  hashCode() {
    return hashCode(listOf_0([new GrammarRuleName(this.t34_1), this.s34_1]));
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, OverrideRule) : false)) {
      tmp = false;
    } else {
      tmp = (this.t34_1 === other.name && equals(other.grammar, this.s34_1));
    }
    return tmp;
  }
  toString() {
    var f = '';
    if (this.u34_1)
      f = f + 'skip ';
    if (this.v34_1)
      f = f + 'leaf ';
    return 'override ' + f + GrammarRuleName__toString_impl_przz03(this.t34_1) + ' = ' + toString(this.rhs) + ' ;';
  }
  bh() {
    return this.s34_1;
  }
  c35() {
    return this.t34_1;
  }
  ds() {
    return this.u34_1;
  }
  es() {
    return this.v34_1;
  }
  fs() {
    return this.w34_1;
  }
  d35(grammar, name, isSkip, isLeaf, overrideKind) {
    return new OverrideRuleDefault(grammar, name, isSkip, isLeaf, overrideKind);
  }
  copy(grammar, name, isSkip, isLeaf, overrideKind, $super) {
    grammar = grammar === VOID ? this.s34_1 : grammar;
    name = name === VOID ? this.t34_1 : name;
    isSkip = isSkip === VOID ? this.u34_1 : isSkip;
    isLeaf = isLeaf === VOID ? this.v34_1 : isLeaf;
    overrideKind = overrideKind === VOID ? this.w34_1 : overrideKind;
    return $super === VOID ? this.d35(grammar, name, isSkip, isLeaf, overrideKind) : $super.d35.call(this, grammar, new GrammarRuleName(name), isSkip, isLeaf, overrideKind);
  }
  get overrideKind() {
    return this.z34();
  }
  get overriddenRhs() {
    return this.b35();
  }
  set overriddenRhs(value) {
    this.a35(value);
  }
}
class PreferenceRule {}
class PreferenceRuleDefault extends GrammarItemAbstract {
  constructor(grammar, forItem, optionList) {
    super();
    this.e35_1 = grammar;
    this.f35_1 = forItem;
    this.g35_1 = optionList;
  }
  j21() {
    return this.e35_1;
  }
  h35() {
    return this.f35_1;
  }
  v10() {
    return this.g35_1;
  }
  h2f(indent) {
    var ni = indent.inc;
    var optStr = joinToString(this.g35_1, '\n', VOID, VOID, VOID, VOID, PreferenceRuleDefault$asString$lambda(ni));
    return 'preference ' + toString(this.f35_1) + ' {\n' + optStr + '\n' + indent.toString() + '}';
  }
  toString() {
    return 'preference ' + toString(this.f35_1) + ' { ... }';
  }
  bh() {
    return this.e35_1;
  }
  ch() {
    return this.f35_1;
  }
  ds() {
    return this.g35_1;
  }
  i35(grammar, forItem, optionList) {
    return new PreferenceRuleDefault(grammar, forItem, optionList);
  }
  copy(grammar, forItem, optionList, $super) {
    grammar = grammar === VOID ? this.e35_1 : grammar;
    forItem = forItem === VOID ? this.f35_1 : forItem;
    optionList = optionList === VOID ? this.g35_1 : optionList;
    return $super === VOID ? this.i35(grammar, forItem, optionList) : $super.i35.call(this, grammar, forItem, optionList);
  }
  hashCode() {
    var result = hashCode(this.e35_1);
    result = imul(result, 31) + hashCode(this.f35_1) | 0;
    result = imul(result, 31) + hashCode(this.g35_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof PreferenceRuleDefault))
      return false;
    var tmp0_other_with_cast = other instanceof PreferenceRuleDefault ? other : THROW_CCE();
    if (!equals(this.e35_1, tmp0_other_with_cast.e35_1))
      return false;
    if (!equals(this.f35_1, tmp0_other_with_cast.f35_1))
      return false;
    if (!equals(this.g35_1, tmp0_other_with_cast.g35_1))
      return false;
    return true;
  }
  get forItem() {
    return this.h35();
  }
  get optionList() {
    return this.v10();
  }
}
class PreferenceOption {}
class PreferenceOptionDefault {
  constructor(spine, choiceIndicator, choiceNumber, onTerminals, associativity) {
    this.j35_1 = spine;
    this.k35_1 = choiceIndicator;
    this.l35_1 = choiceNumber;
    this.m35_1 = onTerminals;
    this.n35_1 = associativity;
  }
  a18() {
    return this.j35_1;
  }
  o35() {
    return this.k35_1;
  }
  p35() {
    return this.l35_1;
  }
  q35() {
    return this.m35_1;
  }
  c1d() {
    return this.n35_1;
  }
  h2f(indent) {
    return toString(this.j35_1) + ' ' + this.l35_1 + " 'on' " + joinToString(this.m35_1, ', ') + ' ' + this.n35_1.toString() + ' ;';
  }
  bh() {
    return this.j35_1;
  }
  ch() {
    return this.k35_1;
  }
  ds() {
    return this.l35_1;
  }
  es() {
    return this.m35_1;
  }
  fs() {
    return this.n35_1;
  }
  r35(spine, choiceIndicator, choiceNumber, onTerminals, associativity) {
    return new PreferenceOptionDefault(spine, choiceIndicator, choiceNumber, onTerminals, associativity);
  }
  copy(spine, choiceIndicator, choiceNumber, onTerminals, associativity, $super) {
    spine = spine === VOID ? this.j35_1 : spine;
    choiceIndicator = choiceIndicator === VOID ? this.k35_1 : choiceIndicator;
    choiceNumber = choiceNumber === VOID ? this.l35_1 : choiceNumber;
    onTerminals = onTerminals === VOID ? this.m35_1 : onTerminals;
    associativity = associativity === VOID ? this.n35_1 : associativity;
    return $super === VOID ? this.r35(spine, choiceIndicator, choiceNumber, onTerminals, associativity) : $super.r35.call(this, spine, choiceIndicator, choiceNumber, onTerminals, associativity);
  }
  toString() {
    return 'PreferenceOptionDefault(spine=' + toString(this.j35_1) + ', choiceIndicator=' + this.k35_1.toString() + ', choiceNumber=' + this.l35_1 + ', onTerminals=' + toString(this.m35_1) + ', associativity=' + this.n35_1.toString() + ')';
  }
  hashCode() {
    var result = hashCode(this.j35_1);
    result = imul(result, 31) + this.k35_1.hashCode() | 0;
    result = imul(result, 31) + this.l35_1 | 0;
    result = imul(result, 31) + hashCode(this.m35_1) | 0;
    result = imul(result, 31) + this.n35_1.hashCode() | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof PreferenceOptionDefault))
      return false;
    var tmp0_other_with_cast = other instanceof PreferenceOptionDefault ? other : THROW_CCE();
    if (!equals(this.j35_1, tmp0_other_with_cast.j35_1))
      return false;
    if (!this.k35_1.equals(tmp0_other_with_cast.k35_1))
      return false;
    if (!(this.l35_1 === tmp0_other_with_cast.l35_1))
      return false;
    if (!equals(this.m35_1, tmp0_other_with_cast.m35_1))
      return false;
    if (!this.n35_1.equals(tmp0_other_with_cast.n35_1))
      return false;
    return true;
  }
  get spine() {
    return this.a18();
  }
  get choiceIndicator() {
    return this.o35();
  }
  get choiceNumber() {
    return this.p35();
  }
  get onTerminals() {
    return this.q35();
  }
  get associativity() {
    return this.c1d();
  }
}
class Spine_0 {}
class SpineDefault_0 {
  constructor(parts) {
    this.s35_1 = parts;
  }
  d2u() {
    return this.s35_1;
  }
  bh() {
    return this.s35_1;
  }
  t35(parts) {
    return new SpineDefault_0(parts);
  }
  copy(parts, $super) {
    parts = parts === VOID ? this.s35_1 : parts;
    return $super === VOID ? this.t35(parts) : $super.t35.call(this, parts);
  }
  toString() {
    return 'SpineDefault(parts=' + toString(this.s35_1) + ')';
  }
  hashCode() {
    return hashCode(this.s35_1);
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof SpineDefault_0))
      return false;
    var tmp0_other_with_cast = other instanceof SpineDefault_0 ? other : THROW_CCE();
    if (!equals(this.s35_1, tmp0_other_with_cast.s35_1))
      return false;
    return true;
  }
  get parts() {
    return this.d2u();
  }
}
class Concatenation {}
class ConcatenationDefault extends RuleItemAbstract {
  constructor(items) {
    super();
    this.u35_1 = items;
    var tmp = this;
    tmp.v35_1 = lazy(ConcatenationDefault$allTerminal$delegate$lambda(this));
    var tmp_0 = this;
    tmp_0.w35_1 = lazy(ConcatenationDefault$allNonTerminal$delegate$lambda(this));
    var tmp_1 = this;
    tmp_1.x35_1 = lazy(ConcatenationDefault$allEmbedded$delegate$lambda(this));
  }
  ck() {
    return this.u35_1;
  }
  t33() {
    var tmp0 = this.v35_1;
    // Inline function 'kotlin.getValue' call
    allTerminal$factory();
    return tmp0.b3();
  }
  u33() {
    var tmp0 = this.w35_1;
    // Inline function 'kotlin.getValue' call
    allNonTerminal$factory();
    return tmp0.b3();
  }
  v33() {
    var tmp0 = this.x35_1;
    // Inline function 'kotlin.getValue' call
    allEmbedded$factory();
    return tmp0.b3();
  }
  w33() {
    return this.u35_1.z(0).firstTerminal;
  }
  x33() {
    return this.u35_1.z(0).firstTangible;
  }
  y33() {
    return this.u35_1.z(0).firstTangibleRecursive;
  }
  z33() {
    return setOf(this);
  }
  setOwningRule(rule, indices) {
    this._owningRule = rule;
    this.index = indices;
    var i = 0;
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.u35_1.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var _unary__edvuaz = i;
      i = _unary__edvuaz + 1 | 0;
      var nextIndex = plus_0(indices, _unary__edvuaz);
      element.setOwningRule(rule, nextIndex);
    }
  }
  subItem(index) {
    return this.u35_1.z(index);
  }
  itemsForChild(childNumber) {
    var tmp0_safe_receiver = getOrNull(this.u35_1, childNumber);
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp = setOf(tmp0_safe_receiver);
    }
    var tmp1_elvis_lhs = tmp;
    return tmp1_elvis_lhs == null ? emptySet() : tmp1_elvis_lhs;
  }
  toString() {
    return joinToString(this.u35_1, ' ');
  }
  get items() {
    return this.ck();
  }
}
class Choice {}
class ChoiceAbstract extends RuleItemAbstract {
  constructor(alternative) {
    super();
    this.y35_1 = alternative;
    var tmp = this;
    tmp.z35_1 = lazy(ChoiceAbstract$allTerminal$delegate$lambda(this));
    var tmp_0 = this;
    tmp_0.a36_1 = lazy(ChoiceAbstract$allNonTerminal$delegate$lambda(this));
    var tmp_1 = this;
    tmp_1.b36_1 = lazy(ChoiceAbstract$allEmbedded$delegate$lambda(this));
  }
  c36() {
    return this.y35_1;
  }
  t33() {
    var tmp0 = this.z35_1;
    // Inline function 'kotlin.getValue' call
    allTerminal$factory_0();
    return tmp0.b3();
  }
  u33() {
    var tmp0 = this.a36_1;
    // Inline function 'kotlin.getValue' call
    allNonTerminal$factory_0();
    return tmp0.b3();
  }
  v33() {
    var tmp0 = this.b36_1;
    // Inline function 'kotlin.getValue' call
    allEmbedded$factory_0();
    return tmp0.b3();
  }
  w33() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.alternative;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.firstTerminal;
      addAll(destination, list);
    }
    return toSet(destination);
  }
  x33() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.alternative;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.firstTangible;
      addAll(destination, list);
    }
    return toSet(destination);
  }
  y33() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.alternative;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.firstTangibleRecursive;
      addAll(destination, list);
    }
    return toSet(destination);
  }
  z33() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.alternative;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.firstConcatenationRecursive;
      addAll(destination, list);
    }
    return toSet(destination);
  }
  setOwningRule(rule, indices) {
    this._owningRule = rule;
    this.index = indices;
    var i = 0;
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.alternative.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var _unary__edvuaz = i;
      i = _unary__edvuaz + 1 | 0;
      var nextIndex = plus_0(indices, _unary__edvuaz);
      element.setOwningRule(rule, nextIndex);
    }
  }
  subItem(index) {
    return this.alternative.z(index);
  }
  itemsForChild(childNumber) {
    return childNumber === 0 ? toSet(this.alternative) : emptySet();
  }
  toString() {
    return joinToString(this.alternative, ' | ');
  }
  get alternative() {
    return this.c36();
  }
}
class ChoiceLongest {}
class ChoiceLongestDefault extends ChoiceAbstract {
  constructor(alternative) {
    super(alternative);
    this.h36_1 = alternative;
  }
  c36() {
    return this.h36_1;
  }
}
class ChoicePriority {}
class ChoicePriorityDefault extends ChoiceAbstract {
  constructor(alternative) {
    super(alternative);
    this.m36_1 = alternative;
  }
  c36() {
    return this.m36_1;
  }
}
class ChoiceAmbiguous {}
class ChoiceAmbiguousDefault extends ChoiceAbstract {
  constructor(alternative) {
    super(alternative);
    this.r36_1 = alternative;
  }
  c36() {
    return this.r36_1;
  }
}
class ConcatenationItemAbstract extends RuleItemAbstract {
  get allEmbedded() {
    return this.v33();
  }
  get firstTerminal() {
    return this.w33();
  }
  get firstTangible() {
    return this.x33();
  }
  get firstTangibleRecursive() {
    return this.y33();
  }
  get firstConcatenationRecursive() {
    return this.z33();
  }
}
class OptionalItem {}
class OptionalItemDefault extends ConcatenationItemAbstract {
  constructor(item) {
    super();
    this.s36_1 = item;
  }
  t36() {
    return this.s36_1;
  }
  t33() {
    return this.s36_1.allTerminal;
  }
  u33() {
    return this.s36_1.allNonTerminal;
  }
  v33() {
    return this.s36_1.allEmbedded;
  }
  w33() {
    return this.s36_1.firstTerminal;
  }
  x33() {
    return this.s36_1.firstTangible;
  }
  y33() {
    return this.s36_1.firstTangibleRecursive;
  }
  z33() {
    return this.s36_1.firstConcatenationRecursive;
  }
  setOwningRule(rule, indices) {
    this._owningRule = rule;
    this.index = indices;
    var nextIndex = plus_0(indices, 0);
    this.s36_1.setOwningRule(rule, nextIndex);
  }
  subItem(index) {
    var tmp;
    if (0 === index) {
      tmp = this.s36_1;
    } else {
      var message = 'subitem ' + index + ' not found';
      throw IllegalStateException.v4(toString(message));
    }
    return tmp;
  }
  itemsForChild(childNumber) {
    return childNumber === 0 ? setOf(this.s36_1) : emptySet();
  }
  toString() {
    var tmp0_subject = this.s36_1;
    var tmp;
    if (isInterface(tmp0_subject, Choice)) {
      tmp = '(' + toString(this.s36_1) + ')?';
    } else {
      if (isInterface(tmp0_subject, Concatenation)) {
        tmp = '(' + toString(this.s36_1) + ')?';
      } else {
        tmp = toString(this.s36_1) + '?';
      }
    }
    return tmp;
  }
  get item() {
    return this.t36();
  }
}
class SimpleItemAbstract extends ConcatenationItemAbstract {
  get allEmbedded() {
    return this.v33();
  }
  get firstTerminal() {
    return this.w33();
  }
  get firstTangible() {
    return this.x33();
  }
  get firstTangibleRecursive() {
    return this.y33();
  }
  get firstConcatenationRecursive() {
    return this.z33();
  }
}
class Group {}
class GroupDefault extends SimpleItemAbstract {
  constructor(groupedContent) {
    super();
    this.u36_1 = groupedContent;
  }
  v36() {
    return this.u36_1;
  }
  t33() {
    return this.u36_1.allTerminal;
  }
  u33() {
    return this.u36_1.allNonTerminal;
  }
  v33() {
    return this.u36_1.allEmbedded;
  }
  w33() {
    return this.u36_1.firstTerminal;
  }
  x33() {
    return this.u36_1.firstTangible;
  }
  y33() {
    return this.u36_1.firstTangibleRecursive;
  }
  z33() {
    return this.u36_1.firstConcatenationRecursive;
  }
  setOwningRule(rule, indices) {
    this._owningRule = rule;
    this.index = indices;
    var nextIndex = plus_0(indices, 0);
    this.u36_1.setOwningRule(rule, nextIndex);
  }
  subItem(index) {
    var tmp;
    if (0 === index) {
      tmp = this.u36_1;
    } else {
      var message = 'subitem ' + index + ' not found';
      throw IllegalStateException.v4(toString(message));
    }
    return tmp;
  }
  itemsForChild(childNumber) {
    return childNumber === 0 ? setOf(this.u36_1) : emptySet();
  }
  toString() {
    return '( ' + toString(this.u36_1) + ' )';
  }
  get groupedContent() {
    return this.v36();
  }
}
class TangibleItemAbstract extends SimpleItemAbstract {
  x33() {
    return setOf(this);
  }
  itemsForChild(childNumber) {
    return emptySet();
  }
  get allEmbedded() {
    return this.v33();
  }
  get firstTerminal() {
    return this.w33();
  }
  get firstTangibleRecursive() {
    return this.y33();
  }
  get firstConcatenationRecursive() {
    return this.z33();
  }
}
class EmptyRule {}
class EmptyRuleDefault extends TangibleItemAbstract {
  t33() {
    return emptySet();
  }
  u33() {
    return emptySet();
  }
  v33() {
    return emptySet();
  }
  w33() {
    return emptySet();
  }
  y33() {
    return emptySet();
  }
  z33() {
    return emptySet();
  }
  setOwningRule(rule, indices) {
    this._owningRule = rule;
    this.index = indices;
  }
  subItem(index) {
    // Inline function 'kotlin.error' call
    var message = 'subitem ' + index + ' not found';
    throw IllegalStateException.v4(toString(message));
  }
  toString() {
    return '/* empty */';
  }
}
class TerminalDefault extends TangibleItemAbstract {
  constructor(value, isPattern) {
    super();
    this.w36_1 = value;
    this.x36_1 = isPattern;
    this.y36_1 = this.x36_1 ? '"' + this.w36_1 + '"' : "'" + this.w36_1 + "'";
  }
  b3() {
    return this.w36_1;
  }
  o1c() {
    return this.x36_1;
  }
  n2n() {
    return this.y36_1;
  }
  n1c() {
    return !this.x36_1;
  }
  t33() {
    return setOf(this);
  }
  u33() {
    return emptySet();
  }
  v33() {
    return emptySet();
  }
  w33() {
    return setOf(this);
  }
  y33() {
    return setOf(this);
  }
  z33() {
    return emptySet();
  }
  setOwningRule(rule, indices) {
    this._owningRule = rule;
    this.index = indices;
  }
  subItem(index) {
    // Inline function 'kotlin.error' call
    var message = 'subitem ' + index + ' not found';
    throw IllegalStateException.v4(toString(message));
  }
  toString() {
    var tmp;
    if (this.x36_1) {
      tmp = '"' + replace(replace(this.w36_1, '\\', '\\\\'), '"', '\\"') + '"';
    } else {
      tmp = "'" + replace(replace(this.w36_1, '\\', '\\\\'), "'", "\\'") + "'";
    }
    return tmp;
  }
  get value() {
    return this.b3();
  }
  get isPattern() {
    return this.o1c();
  }
  get id() {
    return this.n2n();
  }
  get isLiteral() {
    return this.n1c();
  }
}
class NonTerminal {}
class NonTerminalDefault extends TangibleItemAbstract {
  constructor(targetGrammar, ruleReference) {
    super();
    this.z36_1 = targetGrammar;
    this.a37_1 = ruleReference;
  }
  j1u() {
    return this.z36_1;
  }
  b37() {
    return this.a37_1;
  }
  t33() {
    return emptySet();
  }
  u33() {
    return setOf(this);
  }
  v33() {
    return emptySet();
  }
  w33() {
    return emptySet();
  }
  y33() {
    var refRule = this.referencedRule(this.owningRule.grammar);
    return refRule.isLeaf ? setOf(this) : refRule.rhs.firstTangibleRecursive;
  }
  z33() {
    var refRule = this.referencedRule(this.owningRule.grammar);
    return refRule.isLeaf ? emptySet() : refRule.rhs.firstConcatenationRecursive;
  }
  referencedRuleOrNull(targetGrammar) {
    var tmp0_safe_receiver = this.z36_1;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.resolved;
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.findAllResolvedGrammarRule(this.a37_1);
    return tmp2_elvis_lhs == null ? targetGrammar.findAllResolvedGrammarRule(this.a37_1) : tmp2_elvis_lhs;
  }
  referencedRule(targetGrammar) {
    var tmp0_elvis_lhs = this.referencedRuleOrNull(targetGrammar);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = "Grammar Rule '" + GrammarRuleName__toString_impl_przz03(this.a37_1) + "' not found in grammar '" + QualifiedName__toString_impl_z3wem2(targetGrammar.qualifiedName) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  setOwningRule(rule, indices) {
    this._owningRule = rule;
    this.index = indices;
  }
  subItem(index) {
    // Inline function 'kotlin.error' call
    var message = 'subitem ' + index + ' not found';
    throw IllegalStateException.v4(toString(message));
  }
  toString() {
    return _GrammarRuleName___get_value__impl__470s0v(this.a37_1);
  }
  get targetGrammar() {
    return this.j1u();
  }
  get ruleReference() {
    return this.b37();
  }
}
class Embedded {}
class EmbeddedDefault extends TangibleItemAbstract {
  constructor(embeddedGoalName, embeddedGrammarReference) {
    super();
    this.c37_1 = embeddedGoalName;
    this.d37_1 = embeddedGrammarReference;
  }
  e37() {
    return this.c37_1;
  }
  f37() {
    return this.d37_1;
  }
  y32() {
    var tmp0_safe_receiver = this.d37_1.resolved;
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.findAllResolvedGrammarRule(this.c37_1);
  }
  t33() {
    return emptySet();
  }
  u33() {
    return emptySet();
  }
  v33() {
    return setOf(this);
  }
  w33() {
    return emptySet();
  }
  y33() {
    var tmp0_safe_receiver = this.resolvedGrammarRule;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.rhs;
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.firstTangibleRecursive;
    var tmp;
    if (tmp2_elvis_lhs == null) {
      var message = 'Embedded RuleItem is not resolved!';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp2_elvis_lhs;
    }
    return tmp;
  }
  z33() {
    var tmp0_safe_receiver = this.resolvedGrammarRule;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.rhs;
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.firstConcatenationRecursive;
    var tmp;
    if (tmp2_elvis_lhs == null) {
      var message = 'Embedded RuleItem is not resolved!';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp2_elvis_lhs;
    }
    return tmp;
  }
  referencedRule(targetGrammar) {
    var tmp0_elvis_lhs = targetGrammar.findAllResolvedGrammarRule(this.c37_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = "Grammar GrammarRule '" + GrammarRuleName__toString_impl_przz03(this.c37_1) + "' not found in grammar '" + SimpleName__toString_impl_vxsxyc(targetGrammar.name) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  setOwningRule(rule, indices) {
    this._owningRule = rule;
    this.index = indices;
  }
  subItem(index) {
    // Inline function 'kotlin.error' call
    var message = 'subitem ' + index + ' not found';
    throw IllegalStateException.v4(toString(message));
  }
  toString() {
    return toString(this.d37_1.nameOrQName) + '.' + GrammarRuleName__toString_impl_przz03(this.c37_1);
  }
  get embeddedGoalName() {
    return this.e37();
  }
  get embeddedGrammarReference() {
    return this.f37();
  }
  get resolvedGrammarRule() {
    return this.y32();
  }
}
class ListOfItems {}
class ListOfItemsAbstract extends ConcatenationItemAbstract {
  w33() {
    return this.item.firstTerminal;
  }
  x33() {
    return this.item.firstTangible;
  }
  y33() {
    return this.item.firstTangibleRecursive;
  }
  z33() {
    return this.item.firstConcatenationRecursive;
  }
  get allEmbedded() {
    return this.v33();
  }
  get min() {
    return this.m12();
  }
  get max() {
    return this.n12();
  }
  get item() {
    return this.t36();
  }
}
class SimpleList {}
class SimpleListDefault extends ListOfItemsAbstract {
  constructor(min, max, item) {
    super();
    this.g37_1 = min;
    this.h37_1 = max;
    this.i37_1 = item;
  }
  m12() {
    return this.g37_1;
  }
  n12() {
    return this.h37_1;
  }
  t36() {
    return this.i37_1;
  }
  t33() {
    return this.i37_1.allTerminal;
  }
  u33() {
    return this.i37_1.allNonTerminal;
  }
  v33() {
    return this.i37_1.allEmbedded;
  }
  setOwningRule(rule, indices) {
    this._owningRule = rule;
    this.index = indices;
    var nextIndex = plus_0(indices, 0);
    this.i37_1.setOwningRule(rule, nextIndex);
  }
  subItem(index) {
    var tmp;
    if (0 === index) {
      tmp = this.i37_1;
    } else {
      var message = 'subitem ' + index + ' not found';
      throw IllegalStateException.v4(toString(message));
    }
    return tmp;
  }
  itemsForChild(childNumber) {
    return !(-1 === this.h37_1) && childNumber > this.h37_1 ? emptySet() : setOf(this.i37_1);
  }
  toString() {
    var mult = 0 === this.g37_1 && 1 === this.h37_1 ? '?' : 0 === this.g37_1 && -1 === this.h37_1 ? '*' : 1 === this.g37_1 && -1 === this.h37_1 ? '+' : -1 === this.h37_1 ? ' ' + this.g37_1 + '+' : ' ' + this.g37_1 + '..' + this.h37_1;
    return toString(this.i37_1) + mult;
  }
}
class SeparatedList {}
class SeparatedListDefault extends ListOfItemsAbstract {
  constructor(min, max, item, separator) {
    super();
    this.j37_1 = min;
    this.k37_1 = max;
    this.l37_1 = item;
    this.m37_1 = separator;
  }
  m12() {
    return this.j37_1;
  }
  n12() {
    return this.k37_1;
  }
  t36() {
    return this.l37_1;
  }
  a2y() {
    return this.m37_1;
  }
  t33() {
    return plus_2(this.l37_1.allTerminal, this.m37_1.allTerminal);
  }
  u33() {
    return plus_2(this.l37_1.allNonTerminal, this.m37_1.allNonTerminal);
  }
  v33() {
    return plus_2(this.l37_1.allEmbedded, this.m37_1.allEmbedded);
  }
  setOwningRule(rule, indices) {
    this._owningRule = rule;
    this.index = indices;
    var nextIndex = plus_0(indices, 0);
    this.l37_1.setOwningRule(rule, nextIndex);
    this.m37_1.setOwningRule(rule, nextIndex);
  }
  subItem(index) {
    var tmp;
    switch (index) {
      case 0:
        tmp = this.l37_1;
        break;
      case 1:
        tmp = this.m37_1;
        break;
      default:
        var message = 'subitem ' + index + ' not found';
        throw IllegalStateException.v4(toString(message));
    }
    return tmp;
  }
  itemsForChild(childNumber) {
    var tmp;
    if (!(-1 === this.k37_1) && childNumber > this.k37_1) {
      tmp = emptySet();
    } else {
      var tmp_0;
      switch (childNumber % 2 | 0) {
        case 0:
          tmp_0 = setOf(this.l37_1);
          break;
        case 1:
          tmp_0 = setOf(this.m37_1);
          break;
        default:
          var message = 'Internal error: should not happen!';
          throw IllegalStateException.v4(toString(message));
      }
      tmp = tmp_0;
    }
    return tmp;
  }
  toString() {
    var mult = 0 === this.j37_1 && 1 === this.k37_1 ? '?' : 0 === this.j37_1 && -1 === this.k37_1 ? '*' : 1 === this.j37_1 && -1 === this.k37_1 ? '+' : -1 === this.k37_1 ? ' ' + this.j37_1 + '+' : ' ' + this.j37_1 + '..' + this.k37_1;
    return '[' + toString(this.l37_1) + ' / ' + toString(this.m37_1) + ']' + mult;
  }
  get separator() {
    return this.a2y();
  }
}
class Associativity extends Enum {
  get name() {
    return this.e3();
  }
  get ordinal() {
    return this.f3();
  }
}
class ChoiceIndicator extends Enum {
  get name() {
    return this.e3();
  }
  get ordinal() {
    return this.f3();
  }
}
class OverrideKind extends Enum {
  get name() {
    return this.e3();
  }
  get ordinal() {
    return this.f3();
  }
}
class SeparatedListKind extends Enum {
  get name() {
    return this.e3();
  }
  get ordinal() {
    return this.f3();
  }
}
class GrammarRuleName {
  constructor(value) {
    this.d1u_1 = value;
  }
  b3() {
    return _GrammarRuleName___get_value__impl__470s0v(this.d1u_1);
  }
  toString() {
    return GrammarRuleName__toString_impl_przz03(this.d1u_1);
  }
  hashCode() {
    return GrammarRuleName__hashCode_impl_40u278(this.d1u_1);
  }
  equals(other) {
    return GrammarRuleName__equals_impl_smhds0(this.d1u_1, other);
  }
  get value() {
    return this.b3();
  }
}
class GrammarModelBuilder {
  constructor(name, namespaces) {
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.v37_1 = LinkedHashMap.l4();
    this.w37_1 = new GrammarModelDefault(name, new OptionHolderDefault(null, this.v37_1), namespaces);
  }
  option(key, value) {
    // Inline function 'kotlin.collections.set' call
    this.v37_1.r2(key, value);
  }
  namespace(qualifiedName, init) {
    var b = new GrammarNamespaceBuilder(this.w37_1, qualifiedName);
    init(b);
    var ns = b.build();
    this.w37_1.addNamespace(ns);
  }
  build() {
    return this.w37_1;
  }
}
class GrammarNamespaceBuilder {
  constructor(grammarModel, qualifiedName) {
    this.grammarModel = grammarModel;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.x37_1 = LinkedHashMap.l4();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_0.y37_1 = ArrayList.y();
    this.z37_1 = new GrammarNamespaceDefault(get_asQualifiedName(qualifiedName), new OptionHolderDefault(null, this.x37_1), this.y37_1);
  }
  i1u() {
    return this.grammarModel;
  }
  option(key, value) {
    // Inline function 'kotlin.collections.set' call
    this.x37_1.r2(key, value);
  }
  import(qualifiedName) {
    this.y37_1.r(new Import(_Import___init__impl__786z8c(qualifiedName)));
  }
  grammar(name, init) {
    var b = new GrammarBuilder(this.z37_1, _SimpleName___init__impl__6s45d0(name));
    init(b);
    b.build();
  }
  build() {
    return this.z37_1;
  }
}
class GrammarBuilder {
  constructor(namespace, name) {
    this.a38_1 = new GrammarDefault(namespace, name, new OptionHolderDefault(null, emptyMap()));
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.b38_1 = LinkedHashMap.l4();
  }
  extends(nameOrQName) {
    this.a38_1.extends.r(new GrammarReferenceDefault(this.a38_1.namespace, get_asPossiblyQualifiedName(nameOrQName)));
  }
  extendsGrammar(extended) {
    this.a38_1.extends.r(extended);
  }
  terminalLiteral(value) {
    return terminal(this, value, false);
  }
  terminalPattern(value) {
    return terminal(this, value, true);
  }
  c38(grammarRuleName, overrideKind, isSkip, isLeaf) {
    var rhs = new EmptyRuleDefault();
    var gr = createRule(this, _GrammarRuleName___init__impl__yqiut(grammarRuleName), overrideKind, isSkip, isLeaf, rhs);
    this.a38_1.grammarRule.r(gr);
  }
  empty(grammarRuleName, overrideKind, isSkip, isLeaf, $super) {
    overrideKind = overrideKind === VOID ? null : overrideKind;
    isSkip = isSkip === VOID ? false : isSkip;
    isLeaf = isLeaf === VOID ? false : isLeaf;
    var tmp;
    if ($super === VOID) {
      this.c38(grammarRuleName, overrideKind, isSkip, isLeaf);
      tmp = Unit_instance;
    } else {
      tmp = $super.c38.call(this, grammarRuleName, overrideKind, isSkip, isLeaf);
    }
    return tmp;
  }
  d38(grammarRuleName, overrideKind, isSkip, isLeaf, init) {
    var ib = new ChoiceItemBuilder(this.a38_1.namespace);
    init(ib);
    var items = ib.wm();
    var rhs = new ChoiceLongestDefault(items);
    var gr = createRule(this, _GrammarRuleName___init__impl__yqiut(grammarRuleName), overrideKind, isSkip, isLeaf, rhs);
    this.a38_1.grammarRule.r(gr);
  }
  choice(grammarRuleName, overrideKind, isSkip, isLeaf, init, $super) {
    overrideKind = overrideKind === VOID ? null : overrideKind;
    isSkip = isSkip === VOID ? false : isSkip;
    isLeaf = isLeaf === VOID ? false : isLeaf;
    var tmp;
    if ($super === VOID) {
      this.d38(grammarRuleName, overrideKind, isSkip, isLeaf, init);
      tmp = Unit_instance;
    } else {
      tmp = $super.d38.call(this, grammarRuleName, overrideKind, isSkip, isLeaf, init);
    }
    return tmp;
  }
  h38(grammarRuleName, overrideKind, isSkip, isLeaf, init) {
    var ib = new ConcatenationItemBuilder(this.a38_1.namespace);
    init(ib);
    var items = ib.wm();
    var rhs = new ConcatenationDefault(items);
    var gr = createRule(this, _GrammarRuleName___init__impl__yqiut(grammarRuleName), overrideKind, isSkip, isLeaf, rhs);
    this.a38_1.grammarRule.r(gr);
  }
  concatenation(grammarRuleName, overrideKind, isSkip, isLeaf, init, $super) {
    overrideKind = overrideKind === VOID ? null : overrideKind;
    isSkip = isSkip === VOID ? false : isSkip;
    isLeaf = isLeaf === VOID ? false : isLeaf;
    var tmp;
    if ($super === VOID) {
      this.h38(grammarRuleName, overrideKind, isSkip, isLeaf, init);
      tmp = Unit_instance;
    } else {
      tmp = $super.h38.call(this, grammarRuleName, overrideKind, isSkip, isLeaf, init);
    }
    return tmp;
  }
  i38(grammarRuleName, overrideKind, isSkip, isLeaf, init) {
    var ib = new SimpleItemsBuilder(this.a38_1.namespace);
    init(ib);
    var items = ib.wm();
    switch (items.v()) {
      case 0:
        // Inline function 'kotlin.error' call

        var message = 'An optional must have one item defined';
        throw IllegalStateException.v4(toString(message));
      case 1:
        break;
      default:
        // Inline function 'kotlin.error' call

        var message_0 = 'An optional must have only one item defined';
        throw IllegalStateException.v4(toString(message_0));
    }
    var rhs = new OptionalItemDefault(items.z(0));
    var gr = createRule(this, _GrammarRuleName___init__impl__yqiut(grammarRuleName), overrideKind, isSkip, isLeaf, rhs);
    this.a38_1.grammarRule.r(gr);
  }
  optional(grammarRuleName, overrideKind, isSkip, isLeaf, init, $super) {
    overrideKind = overrideKind === VOID ? null : overrideKind;
    isSkip = isSkip === VOID ? false : isSkip;
    isLeaf = isLeaf === VOID ? false : isLeaf;
    var tmp;
    if ($super === VOID) {
      this.i38(grammarRuleName, overrideKind, isSkip, isLeaf, init);
      tmp = Unit_instance;
    } else {
      tmp = $super.i38.call(this, grammarRuleName, overrideKind, isSkip, isLeaf, init);
    }
    return tmp;
  }
  j38(grammarRuleName, min, max, overrideKind, isSkip, isLeaf, init) {
    var ib = new SimpleItemsBuilder(this.a38_1.namespace);
    init(ib);
    var items = ib.wm();
    switch (items.v()) {
      case 0:
        // Inline function 'kotlin.error' call

        var message = 'A simple list must have one item defined';
        throw IllegalStateException.v4(toString(message));
      case 1:
        break;
      default:
        // Inline function 'kotlin.error' call

        var message_0 = 'A simple list must have only one item defined';
        throw IllegalStateException.v4(toString(message_0));
    }
    var rhs = new SimpleListDefault(min, max, items.z(0));
    var gr = createRule(this, _GrammarRuleName___init__impl__yqiut(grammarRuleName), overrideKind, isSkip, isLeaf, rhs);
    this.a38_1.grammarRule.r(gr);
  }
  list(grammarRuleName, min, max, overrideKind, isSkip, isLeaf, init, $super) {
    overrideKind = overrideKind === VOID ? null : overrideKind;
    isSkip = isSkip === VOID ? false : isSkip;
    isLeaf = isLeaf === VOID ? false : isLeaf;
    var tmp;
    if ($super === VOID) {
      this.j38(grammarRuleName, min, max, overrideKind, isSkip, isLeaf, init);
      tmp = Unit_instance;
    } else {
      tmp = $super.j38.call(this, grammarRuleName, min, max, overrideKind, isSkip, isLeaf, init);
    }
    return tmp;
  }
  k38(grammarRuleName, min, max, overrideKind, isSkip, isLeaf, init) {
    var ib = new SimpleItemsBuilder(this.a38_1.namespace);
    init(ib);
    var items = ib.wm();
    switch (items.v()) {
      case 0:
        // Inline function 'kotlin.error' call

        var message = 'A separated list must have two items defined - item & separator';
        throw IllegalStateException.v4(toString(message));
      case 1:
        // Inline function 'kotlin.error' call

        var message_0 = 'A separated list must have two items defined - item & separator';
        throw IllegalStateException.v4(toString(message_0));
      case 2:
        break;
      default:
        // Inline function 'kotlin.error' call

        var message_1 = 'A simple list must have only two items defined - item & separator';
        throw IllegalStateException.v4(toString(message_1));
    }
    var rhs = new SeparatedListDefault(min, max, items.z(0), items.z(1));
    var gr = createRule(this, _GrammarRuleName___init__impl__yqiut(grammarRuleName), overrideKind, isSkip, isLeaf, rhs);
    this.a38_1.grammarRule.r(gr);
  }
  separatedList(grammarRuleName, min, max, overrideKind, isSkip, isLeaf, init, $super) {
    overrideKind = overrideKind === VOID ? null : overrideKind;
    isSkip = isSkip === VOID ? false : isSkip;
    isLeaf = isLeaf === VOID ? false : isLeaf;
    var tmp;
    if ($super === VOID) {
      this.k38(grammarRuleName, min, max, overrideKind, isSkip, isLeaf, init);
      tmp = Unit_instance;
    } else {
      tmp = $super.k38.call(this, grammarRuleName, min, max, overrideKind, isSkip, isLeaf, init);
    }
    return tmp;
  }
  preference(itemReference, init) {
    var forItem = new NonTerminalDefault(this.a38_1.selfReference, _GrammarRuleName___init__impl__yqiut(itemReference));
    var prb = new PreferenceRuleBuilder(this.a38_1, forItem);
    init(prb);
    var pr = prb.build();
    this.a38_1.preferenceRule.r(pr);
  }
  build() {
    return this.a38_1;
  }
}
class GroupChoiceBuilder {
  constructor(localNamespace) {
    this.localNamespace = localNamespace;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.alternatives = ArrayList.y();
  }
  f2t() {
    return this.localNamespace;
  }
  l38() {
    return this.alternatives;
  }
  alt(init) {
    var b = new ConcatenationItemBuilder(this.localNamespace);
    init(b);
    var items = b.wm();
    var alt = new ConcatenationDefault(items);
    this.alternatives.r(alt);
  }
  build() {
    return new ChoiceLongestDefault(this.alternatives);
  }
}
class PreferenceRuleBuilder {
  constructor(grammar, forItem) {
    this.grammar = grammar;
    this.forItem = forItem;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.optionList = ArrayList.y();
  }
  j21() {
    return this.grammar;
  }
  h35() {
    return this.forItem;
  }
  v10() {
    return this.optionList;
  }
  optionLeft(spine, choiceIndicator, choiceNumber, terminals) {
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(spine, 10));
    var _iterator__ex2g4s = spine.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = new NonTerminalDefault(null, _GrammarRuleName___init__impl__yqiut(item));
      destination.r(tmp$ret$0);
    }
    var tmp = new SpineDefault_0(destination);
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination_0 = ArrayList.w(collectionSizeOrDefault(terminals, 10));
    var _iterator__ex2g4s_0 = terminals.s();
    while (_iterator__ex2g4s_0.t()) {
      var item_0 = _iterator__ex2g4s_0.u();
      var tmp$ret$3 = new TerminalDefault(item_0, false);
      destination_0.r(tmp$ret$3);
    }
    this.optionList.r(new PreferenceOptionDefault(tmp, choiceIndicator, choiceNumber, destination_0, Associativity_LEFT_getInstance()));
  }
  optionRight(spine, choiceIndicator, choiceNumber, terminals) {
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(spine, 10));
    var _iterator__ex2g4s = spine.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = new NonTerminalDefault(null, _GrammarRuleName___init__impl__yqiut(item));
      destination.r(tmp$ret$0);
    }
    var tmp = new SpineDefault_0(destination);
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination_0 = ArrayList.w(collectionSizeOrDefault(terminals, 10));
    var _iterator__ex2g4s_0 = terminals.s();
    while (_iterator__ex2g4s_0.t()) {
      var item_0 = _iterator__ex2g4s_0.u();
      var tmp$ret$3 = new TerminalDefault(item_0, false);
      destination_0.r(tmp$ret$3);
    }
    this.optionList.r(new PreferenceOptionDefault(tmp, choiceIndicator, choiceNumber, destination_0, Associativity_RIGHT_getInstance()));
  }
  build() {
    return new PreferenceRuleDefault(this.grammar, this.forItem, this.optionList);
  }
}
class GrammarBuilderMarker {
  equals(other) {
    if (!(other instanceof GrammarBuilderMarker))
      return false;
    other instanceof GrammarBuilderMarker || THROW_CCE();
    return true;
  }
  hashCode() {
    return 0;
  }
  toString() {
    return '@net.akehurst.language.grammar.builder.GrammarBuilderMarker(' + ')';
  }
}
class SimpleItemsBuilder {
  constructor(localNamespace) {
    this.j2t_1 = localNamespace;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.k2t_1 = ArrayList.y();
  }
  m38(item) {
    this.k2t_1.r(isInterface(item, SimpleItem) ? item : THROW_CCE());
  }
  r2t(value) {
    this.m38(new TerminalDefault(value, false));
  }
  l2t(value) {
    this.m38(new TerminalDefault(value, true));
  }
  g2z(embeddedGrammarReference, embeddedGoalName) {
    var gr = new GrammarReferenceDefault(this.j2t_1, get_asPossiblyQualifiedName(embeddedGrammarReference));
    this.m38(new EmbeddedDefault(_GrammarRuleName___init__impl__yqiut(embeddedGoalName), gr));
  }
  n38(embeddedGrammarReference, embeddedGoalName) {
    this.m38(new EmbeddedDefault(_GrammarRuleName___init__impl__yqiut(embeddedGoalName), embeddedGrammarReference));
  }
  q2t(ruleReference) {
    this.m38(new NonTerminalDefault(null, _GrammarRuleName___init__impl__yqiut(ruleReference)));
  }
  t2t(init) {
    var gb = new ConcatenationItemBuilder(this.j2t_1);
    init(gb);
    var items = gb.wm();
    this.m38(new GroupDefault(new ConcatenationDefault(items)));
  }
  wm() {
    return this.k2t_1;
  }
}
class ChoiceItemBuilder extends SimpleItemsBuilder {
  constructor(localNamespace) {
    super(localNamespace);
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.g38_1 = ArrayList.y();
  }
  m38(item) {
    this.g38_1.r(item);
  }
  o38(init) {
    var b = new ConcatenationItemBuilder(this.j2t_1);
    init(b);
    var items = b.wm();
    this.m38(new ConcatenationDefault(items));
  }
  wm() {
    return this.g38_1;
  }
}
class ConcatenationItemBuilder extends SimpleItemsBuilder {
  constructor(localNamespace) {
    super(localNamespace);
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.o2t_1 = ArrayList.y();
  }
  m38(item) {
    this.o2t_1.r(item);
  }
  s2t(init) {
    var b = new SimpleItemsBuilder(this.j2t_1);
    init(b);
    var items = b.wm();
    switch (items.v()) {
      case 0:
        // Inline function 'kotlin.error' call

        var message = 'An optional must have one item defined';
        throw IllegalStateException.v4(toString(message));
      case 1:
        break;
      default:
        // Inline function 'kotlin.error' call

        var message_0 = 'An optional must have only one item defined';
        throw IllegalStateException.v4(toString(message_0));
    }
    this.m38(new OptionalItemDefault(items.z(0)));
  }
  p2t(min, max, init) {
    var b = new SimpleItemsBuilder(this.j2t_1);
    init(b);
    var items = b.wm();
    switch (items.v()) {
      case 0:
        // Inline function 'kotlin.error' call

        var message = 'A simple list must have one item defined';
        throw IllegalStateException.v4(toString(message));
      case 1:
        break;
      default:
        // Inline function 'kotlin.error' call

        var message_0 = 'A simple list must have only one item defined';
        throw IllegalStateException.v4(toString(message_0));
    }
    this.m38(new SimpleListDefault(min, max, items.z(0)));
  }
  k2w(min, max, init) {
    var b = new SimpleItemsBuilder(this.j2t_1);
    init(b);
    var items = b.wm();
    switch (items.v()) {
      case 0:
        // Inline function 'kotlin.error' call

        var message = 'A separated list must have two items defined - item & separator';
        throw IllegalStateException.v4(toString(message));
      case 1:
        // Inline function 'kotlin.error' call

        var message_0 = 'A separated list must have two items defined - item & separator';
        throw IllegalStateException.v4(toString(message_0));
      case 2:
        break;
      default:
        // Inline function 'kotlin.error' call

        var message_1 = 'A simple list must have only two items defined - item & separator';
        throw IllegalStateException.v4(toString(message_1));
    }
    this.m38(new SeparatedListDefault(min, max, items.z(0), items.z(1)));
  }
  wm() {
    return this.o2t_1;
  }
}
class AglGrammar_0 extends LanguageObjectAbstract {
  constructor() {
    AglGrammar_instance = null;
    super();
    AglGrammar_instance = this;
    this.OPTION_defaultGoalRule = 'defaultGoalRule';
    this.NAMESPACE_NAME = 'net.akehurst.language';
    this.NAME = 'Grammar';
    this.x23_1 = _LanguageIdentity___init__impl__3hnnkb('net.akehurst.language.Grammar');
    this.y23_1 = "namespace net.akehurst.language\n  grammar Grammar : Base {\n    override namespace = 'namespace' possiblyQualifiedName option* import* grammar* ;\n    grammar = 'grammar' IDENTIFIER extends? '{' option* rule+ '}' ;\n    extends = ':' [possiblyQualifiedName / ',']+ ;\n    rule = grammarRule | overrideRule | preferenceRule ;\n    grammarRule = ruleTypeLabels IDENTIFIER '=' rhs ';' ;\n    overrideRule = 'override' ruleTypeLabels IDENTIFIER overrideOperator rhs ';' ;\n    overrideOperator = '==' | '=' | '+=|' ;\n    ruleTypeLabels = 'skip'? 'leaf'? ;\n    rhs = empty | concatenation | choice ;\n    empty = /* empty */ ;\n    choice = ambiguousChoice | priorityChoice | simpleChoice ;\n    ambiguousChoice = [concatenation / '||'] 2+ ;\n    priorityChoice = [concatenation / '<'] 2+ ;\n    simpleChoice = [concatenation / '|'] 2+ ;\n    concatenation = concatenationItem+ ;\n    concatenationItem = simpleItemOrGroup | listOfItems ;\n    simpleItemOrGroup = simpleItem | group ;\n    simpleItem = terminal | nonTerminal | embedded ;\n    listOfItems = simpleList | separatedList ;\n    multiplicity = '*' | '+' | '?' | range ;\n    range = rangeUnBraced | rangeBraced ;\n    rangeUnBraced = POSITIVE_INTEGER rangeMax? ;\n    rangeBraced = '{' POSITIVE_INTEGER rangeMax? '}' ;\n    rangeMax = rangeMaxUnbounded | rangeMaxBounded ;\n    rangeMaxUnbounded = '+' ;\n    rangeMaxBounded = '..' POSITIVE_INTEGER_GT_ZERO ;\n    simpleList = simpleItemOrGroup multiplicity ;\n    separatedList = '[' simpleItemOrGroup '/' simpleItemOrGroup ']' multiplicity ;\n    group = '(' groupedContent ')' ;\n    groupedContent = concatenation | choice ;\n    nonTerminal = possiblyQualifiedName ;\n    embedded = possiblyQualifiedName '::' nonTerminal ;\n    terminal = LITERAL | PATTERN ;\n    leaf LITERAL = \"'([^'\\\\\\\\]|\\\\\\\\.)+'\" ;\n    leaf PATTERN = \"\\\"([^\\\"\\\\\\\\]|\\\\\\\\.)+\\\"\" ;\n    leaf POSITIVE_INTEGER = \"[0-9]+\" ;\n    leaf POSITIVE_INTEGER_GT_ZERO = \"[1-9][0-9]*\" ;\n    preferenceRule = 'preference' simpleItem '{' preferenceOption+ '}' ;\n    preferenceOption = spine choiceNumber? 'on' terminalList associativity ;\n    choiceNumber = POSITIVE_INTEGER | CHOICE_INDICATOR ;\n    terminalList = [simpleItem / ',']+ ;\n    spine = [nonTerminal / '<-']+ ;\n    associativity = 'left' | 'right' ;\n    leaf CHOICE_INDICATOR = \"EMPTY|ITEM\" ;\n  }";
    this.z23_1 = 'namespace net.akehurst.language.grammar.api\n    interface Grammar {\n        cmp extends\n        cmp options\n        cmp grammarRule\n        cmp preferenceRule\n    }\n    interface GrammarRule {\n        cmp rhs\n    }\n    interface OverrideRule {\n        cmp overridenRhs\n    }\n    interface PreferenceRule {\n        cmp optionList\n    }\n    interface Choice {\n        cmp alternative\n    }\n    interface Concatenation {\n        cmp items\n    }\n    interface OptionalItem {\n        cmp item\n    }\n    interface ListOfItems {\n        cmp item\n    }\n    interface SeparatedList {\n        cmp separator\n    }\n    interface Group {\n        cmp groupedContent\n    }\n    interface NonTerminal {\n        cmp targetGrammar\n    }\n    interface Embedded {\n        cmp embeddedGrammarReference\n    }';
    this.a24_1 = "namespace net.akehurst.language\n  styles Grammar {\n    $$ \"'[^']+'\" {\n      foreground: darkgreen;\n      font-weight: bold;\n    }\n    LITERAL {\n      foreground: blue;\n    }\n    PATTERN {\n      foreground: darkblue;\n    }\n    IDENTIFIER {\n      foreground: darkred;\n      font-style: italic;\n    }\n    SINGLE_LINE_COMMENT, MULTI_LINE_COMMENT {\n      foreground: LightSlateGrey;\n    }\n  }";
    var tmp = this;
    tmp.b24_1 = lazy(AglGrammar$grammarModel$delegate$lambda);
    var tmp_0 = this;
    tmp_0.c24_1 = lazy(AglGrammar$typesModel$delegate$lambda);
    var tmp_1 = this;
    tmp_1.d24_1 = lazy(AglGrammar$asmTransformModel$delegate$lambda);
    var tmp_2 = this;
    tmp_2.e24_1 = lazy(AglGrammar$crossReferenceModel$delegate$lambda);
    var tmp_3 = this;
    tmp_3.f24_1 = lazy(AglGrammar$formatModel$delegate$lambda);
    var tmp_4 = this;
    tmp_4.g24_1 = lazy(AglGrammar$styleModel$delegate$lambda);
    this.formatStr = replace("namespace net.akehurst.language.Grammar {\n    Namespace -> 'namespace $possiblyQualifiedName'\n    Grammar -> 'grammar $name ${extendsOpt()}{\n                 ${options.join($eol)}\n                 ${rules.join($eol)}\n               }'\n    fun Grammar.extendsOpt() = when {\n      extends.isEmpty -> ''\n      else -> ': ${extends.join(',')} '\n    }\n    GrammarReference -> nameOrQName\n    GrammarOption -> '@$name $value'\n    GrammarRule -> '${isOverride?'override ':''}${isSkip?'skip ':''}${isLeaf?'leaf ':''}$name = $rhs ;'\n    PreferenceRule -> ''\n    ChoiceLongest -> when {\n         2 >= alternative.size -> alternative.join(' | ')\n         else -> alternative.join('$eol$indent| ')\n    }\n    ChoiceAmbiguous -> when {\n         2 >= alternative.size -> alternative.join(' || ')\n         else -> alternative.join('$eol$indent| ')\n    }\n    Concatenation -> items.join(' ')\n    OptionalItem -> '${item}?'\n    SimpleList -> '$item${multiplicity()}'\n    SeparatedList -> '[ $item / $separator ]${multiplicity()}'\n    fun ListOfItems.multiplicity() = when {\n        0==min && 1==max -> '?'\n        1==min && -1==max -> '+'\n        0==min && -1==max -> '*'\n        -1==max -> '$min+'\n        else -> '{$min..$max}'\n    }\n    Group -> '($groupedContent)'\n    EmptyRule -> ''\n    Terminal -> when {\n        isPattern -> '\"value\"'\n        else '\\'$value\\''\n    }\n    NonTerminal -> name\n    Embedded -> '${embeddedGrammarReference}::${embeddedGoalName}'\n}", '$', '$');
    var tmp_5 = this;
    tmp_5.h24_1 = lazy(AglGrammar$defaultTargetGrammar$delegate$lambda);
    this.i24_1 = 'unit';
    var tmp_6 = this;
    tmp_6.j24_1 = lazy(AglGrammar$syntaxAnalyser$delegate$lambda);
    var tmp_7 = this;
    tmp_7.k24_1 = lazy(AglGrammar$semanticAnalyser$delegate$lambda);
    var tmp_8 = this;
    tmp_8.l24_1 = lazy(AglGrammar$completionProvider$delegate$lambda);
  }
  u38() {
    return this.OPTION_defaultGoalRule;
  }
  u2t() {
    return this.NAMESPACE_NAME;
  }
  v2t() {
    return this.NAME;
  }
  g1u() {
    return this.x23_1;
  }
  u2n() {
    return this.y23_1;
  }
  w2n() {
    return this.z23_1;
  }
  z2n() {
    return this.a24_1;
  }
  i1u() {
    var tmp0 = this.b24_1;
    // Inline function 'kotlin.getValue' call
    grammarModel$factory_4();
    return tmp0.b3();
  }
  p1u() {
    var tmp0 = this.c24_1;
    // Inline function 'kotlin.getValue' call
    typesModel$factory_2();
    return tmp0.b3();
  }
  j2k() {
    var tmp0 = this.d24_1;
    // Inline function 'kotlin.getValue' call
    asmTransformModel$factory_2();
    return tmp0.b3();
  }
  r1u() {
    var tmp0 = this.e24_1;
    // Inline function 'kotlin.getValue' call
    crossReferenceModel$factory_3();
    return tmp0.b3();
  }
  i1t() {
    var tmp0 = this.f24_1;
    // Inline function 'kotlin.getValue' call
    formatModel$factory_3();
    return tmp0.b3();
  }
  w1u() {
    var tmp0 = this.g24_1;
    // Inline function 'kotlin.getValue' call
    styleModel$factory_2();
    return tmp0.b3();
  }
  v38() {
    return this.formatStr;
  }
  c2o() {
    var tmp0 = this.h24_1;
    // Inline function 'kotlin.getValue' call
    defaultTargetGrammar$factory_2();
    return tmp0.b3();
  }
  d2o() {
    return this.i24_1;
  }
  s1u() {
    var tmp0 = this.j24_1;
    // Inline function 'kotlin.getValue' call
    syntaxAnalyser$factory_3();
    return tmp0.b3();
  }
  t1u() {
    var tmp0 = this.k24_1;
    // Inline function 'kotlin.getValue' call
    semanticAnalyser$factory_3();
    return tmp0.b3();
  }
  p1y() {
    var tmp0 = this.l24_1;
    // Inline function 'kotlin.getValue' call
    completionProvider$factory_3();
    return tmp0.b3();
  }
  toString() {
    return 'net.akehurst.language.Grammar';
  }
}
class AglGrammarCompletionProvider extends CompletionProviderAbstract {}
class Companion_19 {
  constructor() {
    this.w38_1 = 'net.akehurst.language.agl.grammar.grammar';
    this.OPTIONS_KEY_AMBIGUITY_ANALYSIS = 'net.akehurst.language.agl.grammar.grammar.ambiguity.analysis';
  }
  x38() {
    return this.OPTIONS_KEY_AMBIGUITY_ANALYSIS;
  }
  findGrammarOrNull(context, localNamespace, grammarNameOrQName) {
    // Inline function 'kotlin.collections.map' call
    var this_0 = _QualifiedName___get_parts__impl__mdubdj(grammarNameOrQName.asQualifiedName(localNamespace));
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var it = item.a1u_1;
      var tmp$ret$0 = _SimpleName___get_value__impl__rl2r3c(it);
      destination.r(tmp$ret$0);
    }
    var tmp = destination;
    var tmp0_safe_receiver = firstOrNull(context.findItemsByQualifiedNameConformingTo(tmp, AglGrammarSemanticAnalyser$Companion$findGrammarOrNull$lambda));
    var tmp_0 = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.item;
    return (!(tmp_0 == null) ? isInterface(tmp_0, Grammar) : false) ? tmp_0 : THROW_CCE();
  }
}
class AglGrammarSemanticAnalyser {
  constructor() {
    this.y38_1 = new IssueHolder(LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance());
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.z38_1 = ArrayList.y();
    this.a39_1 = null;
    this.b39_1 = true;
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_0.c39_1 = LinkedHashMap.l4();
  }
  clear() {
    this.c39_1.n2();
    this.y38_1.clear();
    this.z38_1.n2();
    this.a39_1 = null;
  }
  e39(sentenceIdentity, asm, locationMap, options) {
    var context = options.context;
    var tmp = this;
    tmp.a39_1 = locationMap == null ? new LocationMapDefault() : locationMap;
    var tmp_0 = this;
    var tmp_1 = options.other.z2('net.akehurst.language.agl.grammar.grammar.ambiguity.analysis');
    tmp_0.b39_1 = ((tmp_1 == null ? true : typeof tmp_1 === 'boolean') ? tmp_1 : THROW_CCE()) === true;
    if (null == context) {
      issueWarn(this, null, 'No ContextFromGrammarRegistry supplied, grammar references cannot be resolved', null);
    } else {
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s = asm.allDefinitions.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        // Inline function 'kotlin.collections.map' call
        var this_0 = _QualifiedName___get_parts__impl__mdubdj(element.qualifiedName);
        // Inline function 'kotlin.collections.mapTo' call
        var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
        var _iterator__ex2g4s_0 = this_0.s();
        while (_iterator__ex2g4s_0.t()) {
          var item = _iterator__ex2g4s_0.u();
          var it = item.a1u_1;
          var tmp$ret$0 = _SimpleName___get_value__impl__rl2r3c(it);
          destination.r(tmp$ret$0);
        }
        context.addToScope(sentenceIdentity, destination, _QualifiedName___init__impl__8ed982('Grammar'), null, element);
      }
    }
    checkGrammar(this, context, asm, AutomatonKind_LOOKAHEAD_1_getInstance());
    return new SemanticAnalysisResultDefault(this.z38_1, this.y38_1);
  }
  y2j(sentenceIdentity, asm, locationMap, options) {
    return this.e39(sentenceIdentity, isInterface(asm, GrammarModel) ? asm : THROW_CCE(), locationMap, options);
  }
}
class AglGrammarSyntaxAnalyser extends SyntaxAnalyserByMethodRegistrationAbstract {
  constructor() {
    super();
    this.l39_1 = new IssueHolder(LanguageProcessorPhase_SYNTAX_ANALYSIS_getInstance());
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.m39_1 = LinkedHashMap.l4();
    this.n39_1 = mapOf(to(new QualifiedName(_QualifiedName___init__impl__8ed982('Base')), new BaseSyntaxAnalyser()));
    this.o39_1 = emptyMap();
  }
  s2k() {
    return this.n39_1;
  }
  e2k() {
    return this.o39_1;
  }
  o2k(done) {
    super.clear(done, protoOf(SyntaxAnalyserByMethodRegistrationAbstract));
    this.m39_1.n2();
  }
  registerHandlers() {
    this.register(AglGrammarSyntaxAnalyser$unit$ref(this));
    this.register(AglGrammarSyntaxAnalyser$namespace$ref(this));
    this.register(AglGrammarSyntaxAnalyser$grammar$ref(this));
    this.register(AglGrammarSyntaxAnalyser$extends$ref(this));
    this.register(AglGrammarSyntaxAnalyser$rules$ref(this));
    this.register(AglGrammarSyntaxAnalyser$rule$ref(this));
    this.register(AglGrammarSyntaxAnalyser$grammarRule$ref(this));
    this.register(AglGrammarSyntaxAnalyser$overrideRule$ref(this));
    this.register(AglGrammarSyntaxAnalyser$overrideOperator$ref(this));
    this.register(AglGrammarSyntaxAnalyser$preferenceRule$ref(this));
    this.register(AglGrammarSyntaxAnalyser$ruleTypeLabels$ref(this));
    this.register(AglGrammarSyntaxAnalyser$rhs$ref(this));
    this.register(AglGrammarSyntaxAnalyser$empty$ref(this));
    this.register(AglGrammarSyntaxAnalyser$choice$ref(this));
    this.register(AglGrammarSyntaxAnalyser$simpleChoice$ref(this));
    this.register(AglGrammarSyntaxAnalyser$priorityChoice$ref(this));
    this.register(AglGrammarSyntaxAnalyser$ambiguousChoice$ref(this));
    this.register(AglGrammarSyntaxAnalyser$concatenation$ref(this));
    this.register(AglGrammarSyntaxAnalyser$concatenationItem$ref(this));
    this.register(AglGrammarSyntaxAnalyser$simpleItemOrGroup$ref(this));
    this.register(AglGrammarSyntaxAnalyser$simpleItem$ref(this));
    this.register(AglGrammarSyntaxAnalyser$listOfItems$ref(this));
    this.register(AglGrammarSyntaxAnalyser$multiplicity$ref(this));
    this.register(AglGrammarSyntaxAnalyser$range$ref(this));
    this.register(AglGrammarSyntaxAnalyser$rangeUnBraced$ref(this));
    this.register(AglGrammarSyntaxAnalyser$rangeBraced$ref(this));
    this.register(AglGrammarSyntaxAnalyser$rangeMaxOpt$ref(this));
    this.register(AglGrammarSyntaxAnalyser$rangeMax$ref(this));
    this.register(AglGrammarSyntaxAnalyser$rangeMaxBounded$ref(this));
    this.register(AglGrammarSyntaxAnalyser$rangeMaxUnbounded$ref(this));
    this.register(AglGrammarSyntaxAnalyser$simpleList$ref(this));
    this.register(AglGrammarSyntaxAnalyser$group$ref(this));
    this.register(AglGrammarSyntaxAnalyser$groupedContent$ref(this));
    this.register(AglGrammarSyntaxAnalyser$separatedList$ref(this));
    this.register(AglGrammarSyntaxAnalyser$nonTerminal$ref(this));
    this.register(AglGrammarSyntaxAnalyser$embedded$ref(this));
    this.register(AglGrammarSyntaxAnalyser$terminal$ref(this));
    this.register(AglGrammarSyntaxAnalyser$preferenceOption$ref(this));
    this.register(AglGrammarSyntaxAnalyser$spine$ref(this));
    this.register(AglGrammarSyntaxAnalyser$choiceNumber$ref(this));
    this.register(AglGrammarSyntaxAnalyser$terminalList$ref(this));
    this.register(AglGrammarSyntaxAnalyser$associativity$ref(this));
  }
}
class ConverterToRuntimeRules {
  constructor(grammar) {
    this.j1x_1 = grammar;
    var tmp = this;
    tmp.k1x_1 = lazy(ConverterToRuntimeRules$runtimeRuleSet$delegate$lambda(this));
    this.l1x_1 = new IssueHolder(LanguageProcessorPhase_SYNTAX_ANALYSIS_getInstance());
    var tmp_0 = this;
    tmp_0.m1x_1 = lazy(ConverterToRuntimeRules$_ruleSetNumber$delegate$lambda(this));
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_1.n1x_1 = LinkedHashMap.l4();
    this.o1x_1 = emptyList();
    var tmp_2 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_2.p1x_1 = LinkedHashMap.l4();
    var tmp_3 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_3.q1x_1 = LinkedHashMap.l4();
    var tmp_4 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_4.r1x_1 = LinkedHashMap.l4();
    var tmp_5 = this;
    tmp_5.s1x_1 = lazy(ConverterToRuntimeRules$_pseudoRuleNameGenerator$delegate$lambda(this));
  }
  jr() {
    var tmp0 = this.k1x_1;
    // Inline function 'kotlin.getValue' call
    runtimeRuleSet$factory();
    return tmp0.b3();
  }
  b20() {
    return this.r1x_1;
  }
  d39(runtimeRuleSetNumber, runtimeRuleNumber) {
    return this.r1x_1.z2(new Pair(runtimeRuleSetNumber, runtimeRuleNumber));
  }
  a20(embeddedConverters) {
    // Inline function 'kotlin.collections.forEach' call
    // Inline function 'kotlin.collections.iterator' call
    var _iterator__ex2g4s = this.q1x_1.w2().s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      // Inline function 'kotlin.collections.component1' call
      var ebd = element.a3();
      // Inline function 'kotlin.collections.component2' call
      var rule = element.b3();
      var embeddedGrammar = ensureNotNull(ebd.embeddedGrammarReference.resolved);
      var embeddedGoalRuleName = _GrammarRuleName___get_value__impl__470s0v(ebd.embeddedGoalName);
      var tmp0_elvis_lhs = embeddedConverters.z2(embeddedGrammar);
      var tmp;
      if (tmp0_elvis_lhs == null) {
        var message = "Embedded ConverterToRuntimeRules not found for grammar '" + _QualifiedName___get_value__impl__nkc4gq(embeddedGrammar.qualifiedName) + "'";
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp = tmp0_elvis_lhs;
      }
      var embeddedRuntimeRuleSet = tmp;
      var embeddedStartRuntimeRule = embeddedRuntimeRuleSet.findRuntimeRule(embeddedGoalRuleName);
      rule.setRhs(new RuntimeRuleRhsEmbedded(rule, embeddedRuntimeRuleSet, embeddedStartRuntimeRule));
    }
  }
  toString() {
    return "Converter for '" + QualifiedName__toString_impl_z3wem2(this.j1x_1.qualifiedName) + "'";
  }
}
class PseudoRuleNames {
  constructor(grammar) {
    this.p39_1 = grammar;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.q39_1 = LinkedHashMap.l4();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_0.r39_1 = LinkedHashMap.l4();
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_1.s39_1 = LinkedHashMap.l4();
    var tmp_2 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_2.t39_1 = LinkedHashMap.l4();
    var tmp_3 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_3.u39_1 = LinkedHashMap.l4();
    var tmp_4 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_4.v39_1 = LinkedHashMap.l4();
    var tmp_5 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_5.w39_1 = LinkedHashMap.l4();
    var tmp_6 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_6.x39_1 = LinkedHashMap.l4();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.p39_1.allResolvedNonTerminalRule.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!element.isLeaf)
        if (element.isOneEmbedded) {
          var tmp_7;
          var tmp_8 = element.rhs;
          if (isInterface(tmp_8, Embedded)) {
            var tmp_9 = element.rhs;
            tmp_7 = isInterface(tmp_9, Embedded) ? tmp_9 : THROW_CCE();
          } else {
            var tmp_10 = element.rhs;
            var tmp_11 = (isInterface(tmp_10, Concatenation) ? tmp_10 : THROW_CCE()).items.z(0);
            tmp_7 = isInterface(tmp_11, Embedded) ? tmp_11 : THROW_CCE();
          }
          var e = tmp_7;
          var pseudoRuleNames = pseudoRulesFor(this, element.rhs);
          // Inline function 'kotlin.collections.forEach' call
          var _iterator__ex2g4s_0 = pseudoRuleNames.s();
          while (_iterator__ex2g4s_0.t()) {
            var element_0 = _iterator__ex2g4s_0.u();
            var tmp0 = this.w39_1;
            var tmp1 = element_0.zg_1;
            // Inline function 'kotlin.collections.set' call
            var value = element_0.ah_1;
            tmp0.r2(tmp1, value);
            var tmp3 = this.x39_1;
            var tmp4 = element_0.ah_1;
            // Inline function 'kotlin.collections.set' call
            var value_0 = element_0.zg_1;
            tmp3.r2(tmp4, value_0);
          }
        } else {
          var pseudoRuleNames_0 = pseudoRulesFor(this, element.rhs);
          // Inline function 'kotlin.collections.forEach' call
          var _iterator__ex2g4s_1 = pseudoRuleNames_0.s();
          while (_iterator__ex2g4s_1.t()) {
            var element_1 = _iterator__ex2g4s_1.u();
            var tmp0_0 = this.w39_1;
            var tmp1_0 = element_1.zg_1;
            // Inline function 'kotlin.collections.set' call
            var value_1 = element_1.ah_1;
            tmp0_0.r2(tmp1_0, value_1);
            var tmp3_0 = this.x39_1;
            var tmp4_0 = element_1.ah_1;
            // Inline function 'kotlin.collections.set' call
            var value_2 = element_1.zg_1;
            tmp3_0.r2(tmp4_0, value_2);
          }
        }
    }
  }
  y39(item) {
    var tmp0_elvis_lhs = this.w39_1.z2(item);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = "Internal Error: name for RuleItem '" + toString(item) + "' not found";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
}
class Companion_20 {
  findOrCreateGrammarNamespace(typeModel, qualifiedName) {
    var tmp = typeModel.findNamespaceOrNull(qualifiedName);
    var tmp0_elvis_lhs = (tmp == null ? true : tmp instanceof GrammarTypeNamespaceSimple) ? tmp : THROW_CCE();
    var tmp_0;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.let' call
      var imports = listOf(new Import(_Import___init__impl__786z8c(_QualifiedName___get_value__impl__nkc4gq(StdLibDefault_getInstance().t2e_1))));
      var ns = new GrammarTypeNamespaceSimple(qualifiedName, VOID, imports);
      typeModel.addNamespace(ns);
      tmp_0 = ns;
    } else {
      tmp_0 = tmp0_elvis_lhs;
    }
    return tmp_0;
  }
}
class TypeNamespace {}
function createTypeInstance(contextQualifiedTypeName, qualifiedOrImportedTypeName, typeArguments, isNullable, $super) {
  typeArguments = typeArguments === VOID ? emptyList() : typeArguments;
  isNullable = isNullable === VOID ? false : isNullable;
  var tmp;
  if ($super === VOID) {
    tmp = this.i3b(contextQualifiedTypeName, qualifiedOrImportedTypeName, typeArguments, isNullable);
  } else {
    var tmp_0 = $super.i3b;
    var tmp_1 = contextQualifiedTypeName;
    tmp = tmp_0.call(this, tmp_1 == null ? null : new QualifiedName(tmp_1), qualifiedOrImportedTypeName, typeArguments, isNullable);
  }
  return tmp;
}
class TypeNamespaceAbstract extends NamespaceAbstract {
  constructor(options, import_0) {
    super(options, import_0);
    this.t3a_1 = 0;
    var tmp = this;
    // Inline function 'kotlin.collections.hashMapOf' call
    tmp.u3a_1 = HashMap.r7();
    this.v3a_1 = 0;
    this.w3a_1 = toMutableList(import_0);
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_0.ownedUnnamedSupertypeType = ArrayList.y();
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_1.ownedTupleTypes = ArrayList.y();
  }
  s2s() {
    return this.w3a_1;
  }
  x3a() {
    return this.definitionByName;
  }
  y3a() {
    return this.ownedTypesByName.v2();
  }
  z3a() {
    return this.ownedUnnamedSupertypeType;
  }
  a3b() {
    return this.ownedTupleTypes;
  }
  b3b() {
    // Inline function 'kotlin.collections.filterIsInstance' call
    var tmp0 = this.ownedTypesByName.v2();
    // Inline function 'kotlin.collections.filterIsInstanceTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!(element == null) ? isInterface(element, SingletonType) : false) {
        destination.r(element);
      }
    }
    return toSet(destination);
  }
  c3b() {
    // Inline function 'kotlin.collections.filterIsInstance' call
    var tmp0 = this.ownedTypesByName.v2();
    // Inline function 'kotlin.collections.filterIsInstanceTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!(element == null) ? isInterface(element, PrimitiveType) : false) {
        destination.r(element);
      }
    }
    return toSet(destination);
  }
  d3b() {
    // Inline function 'kotlin.collections.filterIsInstance' call
    var tmp0 = this.ownedTypesByName.v2();
    // Inline function 'kotlin.collections.filterIsInstanceTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!(element == null) ? isInterface(element, ValueType) : false) {
        destination.r(element);
      }
    }
    return toSet(destination);
  }
  e3b() {
    // Inline function 'kotlin.collections.filterIsInstance' call
    var tmp0 = this.ownedTypesByName.v2();
    // Inline function 'kotlin.collections.filterIsInstanceTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!(element == null) ? isInterface(element, EnumType) : false) {
        destination.r(element);
      }
    }
    return toSet(destination);
  }
  f3b() {
    // Inline function 'kotlin.collections.filterIsInstance' call
    var tmp0 = this.ownedTypesByName.v2();
    // Inline function 'kotlin.collections.filterIsInstanceTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!(element == null) ? isInterface(element, CollectionType) : false) {
        destination.r(element);
      }
    }
    return toSet(destination);
  }
  g3b() {
    // Inline function 'kotlin.collections.filterIsInstance' call
    var tmp0 = this.ownedTypesByName.v2();
    // Inline function 'kotlin.collections.filterIsInstanceTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!(element == null) ? isInterface(element, InterfaceType) : false) {
        destination.r(element);
      }
    }
    return toSet(destination);
  }
  h3b() {
    // Inline function 'kotlin.collections.filterIsInstance' call
    var tmp0 = this.ownedTypesByName.v2();
    // Inline function 'kotlin.collections.filterIsInstanceTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!(element == null) ? isInterface(element, DataType) : false) {
        destination.r(element);
      }
    }
    return toSet(destination);
  }
  isImported(qualifiedNamespaceName) {
    return this.import.e1(new Import(_Import___init__impl__786z8c(_QualifiedName___get_value__impl__nkc4gq(qualifiedNamespaceName))));
  }
  findOwnedTypeNamed(typeName) {
    return this.ownedTypesByName.z2(new SimpleName(typeName));
  }
  findTypeNamed(qualifiedOrImportedTypeName) {
    var tmp;
    if (qualifiedOrImportedTypeName instanceof QualifiedName) {
      var qn = qualifiedOrImportedTypeName;
      var ns = _QualifiedName___get_front__impl__24j8eq(qn.f27_1);
      var tn = _QualifiedName___get_last__impl__838y8h(qn.f27_1);
      var tmp_0;
      if (ns === this.qualifiedName) {
        tmp_0 = this.findOwnedTypeNamed(tn);
      } else {
        var tns = this._importedNamespaces.z2(new QualifiedName(ns));
        var tmp2_safe_receiver = (tns == null ? true : isInterface(tns, TypeNamespace)) ? tns : THROW_CCE();
        tmp_0 = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.findOwnedTypeNamed(tn);
      }
      tmp = tmp_0;
    } else {
      if (qualifiedOrImportedTypeName instanceof SimpleName) {
        var tn_0 = qualifiedOrImportedTypeName;
        var tmp3_elvis_lhs = this.findOwnedTypeNamed(tn_0.a1u_1);
        var tmp_1;
        if (tmp3_elvis_lhs == null) {
          var tmp0 = this.import;
          var tmp$ret$1;
          $l$block: {
            // Inline function 'kotlin.collections.firstNotNullOfOrNull' call
            var _iterator__ex2g4s = tmp0.s();
            while (_iterator__ex2g4s.t()) {
              var element = _iterator__ex2g4s.u();
              var it = element.p2i_1;
              var tns_0 = this._importedNamespaces.z2(new QualifiedName(_Import___get_asQualifiedName__impl__htdpak(it)));
              var tmp0_safe_receiver = (tns_0 == null ? true : isInterface(tns_0, TypeNamespace)) ? tns_0 : THROW_CCE();
              var result = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.findOwnedTypeNamed(tn_0.a1u_1);
              if (!(result == null)) {
                tmp$ret$1 = result;
                break $l$block;
              }
            }
            tmp$ret$1 = null;
          }
          tmp_1 = tmp$ret$1;
        } else {
          tmp_1 = tmp3_elvis_lhs;
        }
        tmp = tmp_1;
      } else {
        noWhenBranchMatchedException();
      }
    }
    return tmp;
  }
  findOwnedUnnamedSupertypeTypeOrNull(subtypes) {
    return this.u3a_1.z2(subtypes);
  }
  findTupleTypeWithIdOrNull(id) {
    return getOrNull(this.ownedTupleTypes, id);
  }
  findOwnedSpecialTypeNamedOrNull(typeName) {
    var tmp = this.findOwnedTypeNamed(typeName);
    return (tmp == null ? true : tmp instanceof SpecialTypeSimple) ? tmp : THROW_CCE();
  }
  findOwnedSingletonTypeNamedOrNull(typeName) {
    var tmp = this.findOwnedTypeNamed(typeName);
    return (tmp == null ? true : isInterface(tmp, SingletonType)) ? tmp : THROW_CCE();
  }
  findOwnedPrimitiveTypeNamedOrNull(typeName) {
    var tmp = this.findOwnedTypeNamed(typeName);
    return (tmp == null ? true : isInterface(tmp, PrimitiveType)) ? tmp : THROW_CCE();
  }
  findOwnedEnumTypeNamedOrNull(typeName) {
    var tmp = this.findOwnedTypeNamed(typeName);
    return (tmp == null ? true : isInterface(tmp, EnumType)) ? tmp : THROW_CCE();
  }
  findOwnedCollectionTypeNamedOrNull(typeName) {
    var tmp = this.findOwnedTypeNamed(typeName);
    return (tmp == null ? true : isInterface(tmp, CollectionType)) ? tmp : THROW_CCE();
  }
  findOwnedValueTypeNamedOrNull(typeName) {
    var tmp = this.findOwnedTypeNamed(typeName);
    return (tmp == null ? true : isInterface(tmp, ValueType)) ? tmp : THROW_CCE();
  }
  findOwnedInterfaceTypeNamedOrNull(typeName) {
    var tmp = this.findOwnedTypeNamed(typeName);
    return (tmp == null ? true : isInterface(tmp, InterfaceType)) ? tmp : THROW_CCE();
  }
  findOwnedDataTypeNamedOrNull(typeName) {
    var tmp = this.findOwnedTypeNamed(typeName);
    return (tmp == null ? true : isInterface(tmp, DataType)) ? tmp : THROW_CCE();
  }
  findOwnedUnionTypeNamedOrNull(typeName) {
    var tmp = this.findOwnedTypeNamed(typeName);
    return (tmp == null ? true : isInterface(tmp, UnionType)) ? tmp : THROW_CCE();
  }
  createOwnedDataTypeNamed(typeName) {
    return new DataTypeSimple(this, typeName);
  }
  findOwnedOrCreateSpecialTypeNamed(typeName) {
    var existing = this.findOwnedTypeNamed(typeName);
    var tmp;
    if (null == existing) {
      tmp = new SpecialTypeSimple(this, typeName);
    } else {
      tmp = existing instanceof SpecialTypeSimple ? existing : THROW_CCE();
    }
    return tmp;
  }
  findOwnedOrCreateSingletonTypeNamed(typeName) {
    var existing = this.findOwnedTypeNamed(typeName);
    var tmp;
    if (null == existing) {
      tmp = new SingletonTypeSimple(this, typeName);
    } else {
      tmp = (!(existing == null) ? isInterface(existing, SingletonType) : false) ? existing : THROW_CCE();
    }
    return tmp;
  }
  findOwnedOrCreatePrimitiveTypeNamed(typeName) {
    var existing = this.findOwnedTypeNamed(typeName);
    var tmp;
    if (null == existing) {
      tmp = new PrimitiveTypeSimple(this, typeName);
    } else {
      tmp = (!(existing == null) ? isInterface(existing, PrimitiveType) : false) ? existing : THROW_CCE();
    }
    return tmp;
  }
  findOwnedOrCreateEnumTypeNamed(typeName, literals) {
    var existing = this.findOwnedTypeNamed(typeName);
    var tmp;
    if (null == existing) {
      tmp = new EnumTypeSimple(this, typeName, literals);
    } else {
      tmp = (!(existing == null) ? isInterface(existing, EnumType) : false) ? existing : THROW_CCE();
    }
    return tmp;
  }
  findOwnedOrCreateCollectionTypeNamed(typeName) {
    var existing = this.findOwnedTypeNamed(typeName);
    var tmp;
    if (null == existing) {
      tmp = new CollectionTypeSimple(this, typeName);
    } else {
      tmp = (!(existing == null) ? isInterface(existing, CollectionType) : false) ? existing : THROW_CCE();
    }
    return tmp;
  }
  findOwnedOrCreateValueTypeNamed(typeName) {
    var existing = this.findOwnedTypeNamed(typeName);
    var tmp;
    if (null == existing) {
      tmp = new ValueTypeSimple(this, typeName);
    } else {
      tmp = (!(existing == null) ? isInterface(existing, ValueType) : false) ? existing : THROW_CCE();
    }
    return tmp;
  }
  findOwnedOrCreateInterfaceTypeNamed(typeName) {
    var existing = this.findOwnedTypeNamed(typeName);
    var tmp;
    if (null == existing) {
      tmp = new InterfaceTypeSimple(this, typeName);
    } else {
      tmp = (!(existing == null) ? isInterface(existing, InterfaceType) : false) ? existing : THROW_CCE();
    }
    return tmp;
  }
  findOwnedOrCreateDataTypeNamed(typeName) {
    var tmp0_elvis_lhs = this.findOwnedDataTypeNamedOrNull(typeName);
    return tmp0_elvis_lhs == null ? this.createOwnedDataTypeNamed(typeName) : tmp0_elvis_lhs;
  }
  findOwnedOrCreateUnionTypeNamed(typeName, ifCreate) {
    var existing = this.findOwnedTypeNamed(typeName);
    var tmp;
    if (null == existing) {
      // Inline function 'kotlin.also' call
      var this_0 = new UnionTypeSimple(this, typeName);
      ifCreate(this_0);
      tmp = this_0;
    } else {
      tmp = (!(existing == null) ? isInterface(existing, UnionType) : false) ? existing : THROW_CCE();
    }
    return tmp;
  }
  createTupleType() {
    return StdLibDefault_getInstance().TupleType;
  }
  i3b(contextQualifiedTypeName, qualifiedOrImportedTypeName, typeArguments, isNullable) {
    return new TypeInstanceSimple(contextQualifiedTypeName, this, qualifiedOrImportedTypeName, typeArguments, isNullable);
  }
  createTupleTypeInstance(typeArguments, nullable) {
    return new TupleTypeInstanceSimple(this, typeArguments, nullable);
  }
  h2f(indent) {
    var tmp = this.ownedTypesByName.w2();
    // Inline function 'kotlin.comparisons.compareBy' call
    var tmp_0 = TypeNamespaceAbstract$asString$lambda;
    // Inline function 'kotlin.comparisons.thenBy' call
    var this_0 = new sam$kotlin_Comparator$0_5(tmp_0);
    var tmp_1 = TypeNamespaceAbstract$asString$lambda_0(this_0);
    var tmp$ret$1 = new sam$kotlin_Comparator$0_5(tmp_1);
    var tmp_2 = sortedWith(tmp, tmp$ret$1);
    var types = joinToString(tmp_2, '\n  ', '  ', VOID, VOID, VOID, TypeNamespaceAbstract$asString$lambda_1(this));
    var tmp_3 = this.import;
    var importstr = joinToString(tmp_3, '\n  ', '  ', VOID, VOID, VOID, TypeNamespaceAbstract$asString$lambda_2);
    var s = trimIndent('namespace ' + QualifiedName__toString_impl_z3wem2(this.qualifiedName) + '\n' + importstr + '\n' + types + '\n');
    return s;
  }
  hashCode() {
    return QualifiedName__hashCode_impl_dcqht7(this.qualifiedName);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, TypeNamespace) : false)) {
      tmp = false;
    } else {
      tmp = this.qualifiedName === other.qualifiedName;
    }
    return tmp;
  }
  toString() {
    return _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  get ownedTypesByName() {
    return this.x3a();
  }
  get ownedTypes() {
    return this.y3a();
  }
  get singletonType() {
    return this.b3b();
  }
  get primitiveType() {
    return this.c3b();
  }
  get valueType() {
    return this.d3b();
  }
  get enumType() {
    return this.e3b();
  }
  get collectionType() {
    return this.f3b();
  }
  get interfaceType() {
    return this.g3b();
  }
  get dataType() {
    return this.h3b();
  }
  get qualifiedName() {
    return this.u2h();
  }
}
class GrammarTypeNamespace {}
class GrammarTypeNamespaceAbstract extends TypeNamespaceAbstract {
  constructor(options, import_0) {
    super(options, import_0);
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.n3a_1 = LinkedHashMap.l4();
  }
  setTypeForGrammarRule(grammarRuleName, typeUse) {
    var tmp0 = this.allRuleNameToType;
    // Inline function 'kotlin.collections.set' call
    var key = new GrammarRuleName(grammarRuleName);
    tmp0.r2(key, typeUse);
  }
  o3a(_set____db54di) {
    this.n3a_1 = _set____db54di;
  }
  p3a() {
    return this.n3a_1;
  }
  q3a() {
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.allRuleNameToType.w2();
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = new Pair(item.a3(), item.b3());
      destination.r(tmp$ret$0);
    }
    return destination;
  }
  findTypeForRule(ruleName) {
    var tmp0_elvis_lhs = this.allRuleNameToType.z2(new GrammarRuleName(ruleName));
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp0 = this._importedNamespaces.v2();
      var tmp$ret$1;
      $l$block: {
        // Inline function 'kotlin.collections.firstNotNullOfOrNull' call
        var _iterator__ex2g4s = tmp0.s();
        while (_iterator__ex2g4s.t()) {
          var element = _iterator__ex2g4s.u();
          var tmp_0;
          if (!(element == null) ? isInterface(element, GrammarTypeNamespace) : false) {
            tmp_0 = element.findTypeForRule(ruleName);
          } else {
            tmp_0 = null;
          }
          var result = tmp_0;
          if (!(result == null)) {
            tmp$ret$1 = result;
            break $l$block;
          }
        }
        tmp$ret$1 = null;
      }
      tmp = tmp$ret$1;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  get allRuleNameToType() {
    return this.p3a();
  }
  set allRuleNameToType(value) {
    this.o3a(value);
  }
  get allTypesByRuleName() {
    return this.q3a();
  }
  get qualifiedName() {
    return this.u2h();
  }
}
class GrammarTypeNamespaceSimple extends GrammarTypeNamespaceAbstract {
  constructor(qualifiedName, options, import_0) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    super(options, import_0);
    this.g3a_1 = qualifiedName;
  }
  u2h() {
    return this.g3a_1;
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = other.findNamespaceOrNull(this.g3a_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.also' call
      var this_0 = new GrammarTypeNamespaceSimple(this.g3a_1, this.options, this.import);
      this_0.allRuleNameToType = this.allRuleNameToType;
      other.addNamespace(this_0);
      tmp = this_0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
}
class TypeNamespaceBuilder {
  constructor(qualifiedName, imports) {
    this.qualifiedName = qualifiedName;
    this.l3b_1 = new TypeNamespaceSimple(this.qualifiedName, VOID, imports);
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.m3b_1 = ArrayList.y();
  }
  u2h() {
    return this.qualifiedName;
  }
  k3b() {
    return this.l3b_1;
  }
  imports(imports) {
    // Inline function 'kotlin.collections.forEach' call
    var inductionVariable = 0;
    var last = imports.length;
    while (inductionVariable < last) {
      var element = imports[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      this._namespace.addImport(_Import___init__impl__786z8c(element));
    }
  }
  singleton(typeName) {
    return this._namespace.findOwnedOrCreateSingletonTypeNamed(_SimpleName___init__impl__6s45d0(typeName));
  }
  primitive(typeName) {
    return this._namespace.findOwnedOrCreatePrimitiveTypeNamed(_SimpleName___init__impl__6s45d0(typeName));
  }
  n3b(typeName, init) {
    var b = new ValueTypeBuilder(this._namespace, this.m3b_1, _SimpleName___init__impl__6s45d0(typeName));
    init(b);
    b.build();
  }
  value(typeName, init, $super) {
    var tmp;
    if (init === VOID) {
      tmp = TypeNamespaceBuilder$value$lambda;
    } else {
      tmp = init;
    }
    init = tmp;
    var tmp_0;
    if ($super === VOID) {
      this.n3b(typeName, init);
      tmp_0 = Unit_instance;
    } else {
      tmp_0 = $super.n3b.call(this, typeName, init);
    }
    return tmp_0;
  }
  o3b(typeName, init) {
    var b = new InterfaceTypeBuilder(this._namespace, this.m3b_1, _SimpleName___init__impl__6s45d0(typeName));
    init(b);
    return b.build();
  }
  interface_(typeName, init, $super) {
    var tmp;
    if (init === VOID) {
      tmp = TypeNamespaceBuilder$interface_$lambda;
    } else {
      tmp = init;
    }
    init = tmp;
    return $super === VOID ? this.o3b(typeName, init) : $super.o3b.call(this, typeName, init);
  }
  enum(typeName, literals) {
    return this._namespace.findOwnedOrCreateEnumTypeNamed(_SimpleName___init__impl__6s45d0(typeName), literals);
  }
  collection(typeName, typeParams) {
    // Inline function 'kotlin.also' call
    var this_0 = this._namespace.findOwnedOrCreateCollectionTypeNamed(_SimpleName___init__impl__6s45d0(typeName));
    var tmp = this_0.typeParameters;
    var tmp_0 = isInterface(tmp, KtMutableList) ? tmp : THROW_CCE();
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(typeParams, 10));
    var _iterator__ex2g4s = typeParams.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = new TypeParameterSimple(_SimpleName___init__impl__6s45d0(item));
      destination.r(tmp$ret$0);
    }
    tmp_0.x(destination);
    return this_0;
  }
  p3b(typeName, init) {
    var b = new DataTypeBuilder(this._namespace, this.m3b_1, _SimpleName___init__impl__6s45d0(typeName));
    init(b);
    var et = b.build();
    return et;
  }
  data(typeName, init, $super) {
    var tmp;
    if (init === VOID) {
      tmp = TypeNamespaceBuilder$data$lambda;
    } else {
      tmp = init;
    }
    init = tmp;
    return $super === VOID ? this.p3b(typeName, init) : $super.p3b.call(this, typeName, init);
  }
  union(typeName, init) {
    var b = new SubtypeListBuilder(this._namespace, this.m3b_1);
    init(b);
    var stu = b.build();
    var tmp = this._namespace;
    var tmp_0 = _SimpleName___init__impl__6s45d0(typeName);
    var t = tmp.findOwnedOrCreateUnionTypeNamed(tmp_0, TypeNamespaceBuilder$union$lambda);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = stu.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      t.addAlternative(element);
    }
    return t;
  }
  build() {
    return this._namespace;
  }
  get _namespace() {
    return this.k3b();
  }
}
class GrammarTypeNamespaceBuilder extends TypeNamespaceBuilder {
  constructor(typeModel, namespaceQualifiedName, imports, resolveImports) {
    super(namespaceQualifiedName, imports);
    var tmp = this;
    // Inline function 'kotlin.also' call
    var this_0 = new GrammarTypeNamespaceSimple(namespaceQualifiedName, VOID, imports);
    if (resolveImports) {
      this_0.resolveImports(isInterface(typeModel, Model) ? typeModel : THROW_CCE());
    }
    tmp.r38_1 = this_0;
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_0.s38_1 = ArrayList.y();
  }
  k3b() {
    return this.r38_1;
  }
  t38(grammarRuleName, typeName, init) {
    var tp = super.interface_(typeName, init, protoOf(TypeNamespaceBuilder));
    _get__grammarNamespace__4jqlgi(this).setTypeForGrammarRule(_GrammarRuleName___init__impl__yqiut(grammarRuleName), tp.type());
  }
}
class AglCrossReference_0 {
  constructor() {
    AglCrossReference_instance = this;
    this.NAMESPACE_NAME = 'net.akehurst.language';
    this.NAME = 'CrossReferences';
    this.goalRuleName = 'unit';
    this.identity = _LanguageIdentity___init__impl__3hnnkb('net.akehurst.language.CrossReferences');
    this.grammarStr = "namespace net.akehurst.language\n\ngrammar CrossReferences extends Expressions {\n\n    override namespace = 'namespace' possiblyQualifiedName import* declarations ;\n    declarations = rootIdentifiables scopes references? ;\n    rootIdentifiables = identifiable* ;\n    scopes = scope* ;\n    scope = 'scope' simpleTypeName '{' identifiables '}' ;\n    identifiables = identifiable* ;\n    identifiable = 'identify' simpleTypeName 'by' expression ;\n\n    references = 'references' '{' referenceDefinitions '}' ;\n    referenceDefinitions = referenceDefinition* ;\n    referenceDefinition = 'in' simpleTypeName '{' referenceExpression* '}' ;\n    referenceExpression = propertyReferenceExpression | collectionReferenceExpression ;\n    propertyReferenceExpression = 'property' rootOrNavigation 'refers-to' typeReferences from? ;\n    from = 'from' navigationExpression ;\n    collectionReferenceExpression = 'forall' rootOrNavigation ofType? '{' referenceExpressionList '}' ;\n    ofType = 'of-type' possiblyQualifiedTypeReference ;\n    \n    rootOrNavigation = rootExpression | navigationExpression ;\n    \n    typeReferences = [possiblyQualifiedTypeReference / '|']+ ;\n    possiblyQualifiedTypeReference = possiblyQualifiedName ;\n    simpleTypeName = IDENTIFIER ;\n}\n";
    var tmp = this;
    tmp.grammar = grammar('net.akehurst.language', 'CrossReferences', AglCrossReference$grammar$lambda);
    this.komposite = 'namespace net.akehurst.language.reference.api\ninterface DeclarationsForNamespace {\n    cmp scopeDefinition\n    cmp references\n    cmp options\n}\n\ninterface ScopeDefinition {\n    cmp identifiables\n}\ninterface Identifiable {\n    cmp identifiedBy\n}\ninterface ReferenceDefinition {\n    cmp referenceExpressionList\n}\ninterface ReferenceExpressionProperty {\n    cmp referringPropertyNavigation\n    cmp fromNavigation\n}\ninterface ReferenceExpressionCollection {\n    cmp expression\n    cmp referenceExpressionList\n}\n';
    var tmp_0 = this;
    tmp_0.p21_1 = lazy(AglCrossReference$typeModel$delegate$lambda);
    this.styleStr = 'namespace net.akehurst.language\nstyles CrossReferences : Base {\n}';
    this.formatterStr = '\n@TODO\nReferences -> when {\n    referenceDefinitions.isEmpty -> "references { }"\n    else -> "\n      references {\n        referenceDefinitions\n      }\n    "\n}\nReferenceDefinitions -> [referenceDefinition / \'\\n\']\nReferenceDefinition -> "in \xA7typeReference property \xA7propertyReference refers-to \xA7typeReferences"\n    ';
  }
  u2t() {
    return this.NAMESPACE_NAME;
  }
  v2t() {
    return this.NAME;
  }
  b16() {
    return this.goalRuleName;
  }
  g1u() {
    return this.identity;
  }
  q3b() {
    return this.grammarStr;
  }
  j21() {
    return this.grammar;
  }
  k2p() {
    return this.komposite;
  }
  m2e() {
    var tmp0 = this.p21_1;
    // Inline function 'kotlin.getValue' call
    typeModel$factory_0();
    return tmp0.b3();
  }
  r3b() {
    return this.styleStr;
  }
  s3b() {
    return this.formatterStr;
  }
  toString() {
    return "namespace net.akehurst.language\n\ngrammar CrossReferences extends Expressions {\n\n    override namespace = 'namespace' possiblyQualifiedName import* declarations ;\n    declarations = rootIdentifiables scopes references? ;\n    rootIdentifiables = identifiable* ;\n    scopes = scope* ;\n    scope = 'scope' simpleTypeName '{' identifiables '}' ;\n    identifiables = identifiable* ;\n    identifiable = 'identify' simpleTypeName 'by' expression ;\n\n    references = 'references' '{' referenceDefinitions '}' ;\n    referenceDefinitions = referenceDefinition* ;\n    referenceDefinition = 'in' simpleTypeName '{' referenceExpression* '}' ;\n    referenceExpression = propertyReferenceExpression | collectionReferenceExpression ;\n    propertyReferenceExpression = 'property' rootOrNavigation 'refers-to' typeReferences from? ;\n    from = 'from' navigationExpression ;\n    collectionReferenceExpression = 'forall' rootOrNavigation ofType? '{' referenceExpressionList '}' ;\n    ofType = 'of-type' possiblyQualifiedTypeReference ;\n    \n    rootOrNavigation = rootExpression | navigationExpression ;\n    \n    typeReferences = [possiblyQualifiedTypeReference / '|']+ ;\n    possiblyQualifiedTypeReference = possiblyQualifiedName ;\n    simpleTypeName = IDENTIFIER ;\n}";
  }
  get typeModel() {
    return this.m2e();
  }
}
class ReferencesCompletionProvider extends CompletionProviderAbstract {}
class ReferencesSemanticAnalyser {
  constructor() {
    this.t3b_1 = new IssueHolder(LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance());
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.u3b_1 = ArrayList.y();
    this.v3b_1 = new LocationMapDefault();
    this.w3b_1 = null;
    this.x3b_1 = null;
    this.y3b_1 = null;
  }
  clear() {
    this.w3b_1 = null;
    this.v3b_1.clear();
    this.x3b_1 = null;
    this.t3b_1.clear();
    this.u3b_1.n2();
  }
  d3c(sentenceIdentity, asm, locationMap, options) {
    var tmp = this;
    tmp.v3b_1 = locationMap == null ? new LocationMapDefault() : locationMap;
    this.x3b_1 = options.context;
    if (!(null == this.x3b_1)) {
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s = asm.declarationsForNamespace.v2().s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        // Inline function 'kotlin.collections.mapNotNull' call
        var tmp0 = element.importedNamespaces;
        // Inline function 'kotlin.collections.mapNotNullTo' call
        var destination = ArrayList.y();
        // Inline function 'kotlin.collections.forEach' call
        var _iterator__ex2g4s_0 = tmp0.s();
        while (_iterator__ex2g4s_0.t()) {
          var element_0 = _iterator__ex2g4s_0.u();
          var impNs = element_0.p2i_1;
          var ns = ensureNotNull(this.x3b_1).typeModel.findNamespaceOrNull(_Import___get_asQualifiedName__impl__htdpak(impNs));
          if (ns == null) {
            raiseError_0(this, element, 'Namespace to import not found');
          }
          if (ns == null)
            null;
          else {
            // Inline function 'kotlin.let' call
            destination.r(ns);
          }
        }
        var importedNamespaces = destination;
        var ns_0 = ensureNotNull(this.x3b_1).typeModel.findNamespaceOrNull(element.namespace.qualifiedName);
        if (ns_0 == null) {
          this.t3b_1.raise(LanguageIssueKind_ERROR_getInstance(), LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance(), null, "Namespace '" + QualifiedName__toString_impl_z3wem2(element.namespace.qualifiedName) + "' not found in typeModel.");
        } else {
          var tmp_0 = this;
          var tmp1_safe_receiver = this.x3b_1;
          var tmp_1;
          if (tmp1_safe_receiver == null) {
            tmp_1 = null;
          } else {
            // Inline function 'kotlin.let' call
            tmp_1 = new ExpressionTypeResolver(tmp1_safe_receiver.typeModel, ns_0, this.t3b_1);
          }
          tmp_0.y3b_1 = tmp_1;
          var tmp_2 = this;
          tmp_2.w3b_1 = (!(ns_0 == null) ? isInterface(ns_0, GrammarTypeNamespace) : false) ? ns_0 : THROW_CCE();
          // Inline function 'kotlin.collections.forEach' call
          var _iterator__ex2g4s_1 = element.scopeDefinition.v2().s();
          while (_iterator__ex2g4s_1.t()) {
            var element_1 = _iterator__ex2g4s_1.u();
            checkScopeDefinition(this, element_1 instanceof ScopeDefinitionDefault ? element_1 : THROW_CCE());
          }
          // Inline function 'kotlin.collections.forEach' call
          var _iterator__ex2g4s_2 = element.references.s();
          while (_iterator__ex2g4s_2.t()) {
            var element_2 = _iterator__ex2g4s_2.u();
            checkReferenceDefinition(this, asm, element_2 instanceof ReferenceDefinitionDefault ? element_2 : THROW_CCE(), importedNamespaces);
          }
        }
      }
    } else {
      this.t3b_1.raise(LanguageIssueKind_WARNING_getInstance(), LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance(), null, 'No context provided, cannot perform semantic analysis. If you do not want to do semantic analysis then switch it off.');
    }
    return new SemanticAnalysisResultDefault(this.u3b_1, this.t3b_1);
  }
  y2j(sentenceIdentity, asm, locationMap, options) {
    return this.d3c(sentenceIdentity, isInterface(asm, CrossReferenceModel) ? asm : THROW_CCE(), locationMap, options);
  }
}
class PropertyValue_0 {
  constructor(asmObject, value) {
    this.asmObject = asmObject;
    this.value = value;
  }
  x2w() {
    return this.asmObject;
  }
  b3() {
    return this.value;
  }
  bh() {
    return this.asmObject;
  }
  ch() {
    return this.value;
  }
  y2w(asmObject, value) {
    return new PropertyValue_0(asmObject, value);
  }
  copy(asmObject, value, $super) {
    asmObject = asmObject === VOID ? this.asmObject : asmObject;
    value = value === VOID ? this.value : value;
    return $super === VOID ? this.y2w(asmObject, value) : $super.y2w.call(this, asmObject, value);
  }
  toString() {
    return 'PropertyValue(asmObject=' + toString(this.asmObject) + ', value=' + this.value + ')';
  }
  hashCode() {
    var result = hashCode(this.asmObject);
    result = imul(result, 31) + getStringHashCode(this.value) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof PropertyValue_0))
      return false;
    var tmp0_other_with_cast = other instanceof PropertyValue_0 ? other : THROW_CCE();
    if (!equals(this.asmObject, tmp0_other_with_cast.asmObject))
      return false;
    if (!(this.value === tmp0_other_with_cast.value))
      return false;
    return true;
  }
}
class ReferencesSyntaxAnalyser extends SyntaxAnalyserByMethodRegistrationAbstract {
  constructor() {
    super();
    this.p3c_1 = mapOf(to(new QualifiedName(_QualifiedName___init__impl__8ed982('Expressions')), new ExpressionsSyntaxAnalyser()));
  }
  registerHandlers() {
    super.register(ReferencesSyntaxAnalyser$unit$ref(this));
    super.register(ReferencesSyntaxAnalyser$namespace$ref(this));
    super.register(ReferencesSyntaxAnalyser$declarations$ref(this));
    super.register(ReferencesSyntaxAnalyser$rootIdentifiables$ref(this));
    super.register(ReferencesSyntaxAnalyser$scopes$ref(this));
    super.register(ReferencesSyntaxAnalyser$scope$ref(this));
    super.register(ReferencesSyntaxAnalyser$identifiables$ref(this));
    super.register(ReferencesSyntaxAnalyser$identifiable$ref(this));
    super.register(ReferencesSyntaxAnalyser$referencesOpt$ref(this));
    super.register(ReferencesSyntaxAnalyser$references$ref(this));
    super.register(ReferencesSyntaxAnalyser$referenceDefinitions$ref(this));
    super.register(ReferencesSyntaxAnalyser$referenceDefinition$ref(this));
    super.register(ReferencesSyntaxAnalyser$referenceExpressionList$ref(this));
    super.register(ReferencesSyntaxAnalyser$referenceExpression$ref(this));
    super.register(ReferencesSyntaxAnalyser$propertyReferenceExpression$ref(this));
    super.register(ReferencesSyntaxAnalyser$from$ref(this));
    super.register(ReferencesSyntaxAnalyser$collectionReferenceExpression$ref(this));
    super.register(ReferencesSyntaxAnalyser$rootOrNavigation$ref(this));
    super.register(ReferencesSyntaxAnalyser$ofType$ref(this));
    super.register(ReferencesSyntaxAnalyser$typeReferences$ref(this));
    super.register(ReferencesSyntaxAnalyser$possiblyQualifiedTypeReference$ref(this));
    super.register(ReferencesSyntaxAnalyser$simpleTypeName$ref(this));
  }
  s2k() {
    return this.p3c_1;
  }
}
class CrossReferenceModel {}
class CrossReferenceNamespace {}
class DeclarationsForNamespace {}
class ReferenceDefinition {}
class ScopeDefinition {}
class Identifiable {}
class ReferenceExpression {}
class ReferenceExpressionProperty {}
class ReferenceExpressionCollection {}
class Companion_21 {
  constructor() {
    Companion_instance_22 = this;
    this.ROOT_SCOPE_TYPE_NAME = _QualifiedName___init__impl__8ed982('\xA7root');
    this.IDENTIFY_BY_NOTHING = '\xA7nothing';
  }
  d3d() {
    return this.ROOT_SCOPE_TYPE_NAME;
  }
  e3d() {
    return this.IDENTIFY_BY_NOTHING;
  }
  fromString(context, crossReferenceString) {
    var tmp0_elvis_lhs = Agl_getInstance().registry.agl.crossReference.processor;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = 'Agl CrossReference language not found!';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var proc = tmp;
    var tmp_0 = _CrossReferenceString___get_value__impl__vi2q2h(crossReferenceString);
    var tmp_1 = Agl_getInstance();
    return proc.process(tmp_0, tmp_1.options(VOID, CrossReferenceModelDefault$Companion$fromString$lambda(context)));
  }
}
class CrossReferenceModelDefault extends ModelAbstract {
  constructor(name, options, namespace) {
    Companion_getInstance_24();
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    namespace = namespace === VOID ? emptyList() : namespace;
    super(namespace, options);
    this.h3d_1 = name;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.i3d_1 = LinkedHashMap.l4();
  }
  f2h() {
    return this.h3d_1;
  }
  q3c() {
    // Inline function 'kotlin.collections.associate' call
    var this_0 = this.namespace;
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_0, 10)), 16);
    // Inline function 'kotlin.collections.associateTo' call
    var destination = LinkedHashMap.kb(capacity);
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      // Inline function 'kotlin.collections.plusAssign' call
      var pair = new Pair(new QualifiedName(element.qualifiedName), element.declarationsForNamespace);
      destination.r2(pair.zg_1, pair.ah_1);
    }
    return destination;
  }
  mk() {
    var tmp;
    if (this.declarationsForNamespace.a1()) {
      tmp = true;
    } else {
      var tmp0 = this.declarationsForNamespace.v2();
      var tmp$ret$0;
      $l$block_0: {
        // Inline function 'kotlin.collections.all' call
        var tmp_0;
        if (isInterface(tmp0, Collection)) {
          tmp_0 = tmp0.a1();
        } else {
          tmp_0 = false;
        }
        if (tmp_0) {
          tmp$ret$0 = true;
          break $l$block_0;
        }
        var _iterator__ex2g4s = tmp0.s();
        while (_iterator__ex2g4s.t()) {
          var element = _iterator__ex2g4s.u();
          if (!element.isEmpty) {
            tmp$ret$0 = false;
            break $l$block_0;
          }
        }
        tmp$ret$0 = true;
      }
      tmp = tmp$ret$0;
    }
    return tmp;
  }
  isScopeDefinedFor(possiblyQualifiedTypeName) {
    var tmp;
    if (possiblyQualifiedTypeName instanceof QualifiedName) {
      var qn = possiblyQualifiedTypeName;
      var qName = _QualifiedName___get_front__impl__24j8eq(qn.f27_1);
      var tName = _QualifiedName___get_last__impl__838y8h(qn.f27_1);
      var ns = this.declarationsForNamespace.z2(new QualifiedName(qName));
      var tmp2_elvis_lhs = ns == null ? null : ns.isScopeDefinedFor(tName);
      return tmp2_elvis_lhs == null ? false : tmp2_elvis_lhs;
    } else {
      if (possiblyQualifiedTypeName instanceof SimpleName) {
        var tmp0 = this.declarationsForNamespace.v2();
        var tmp$ret$0;
        $l$block_0: {
          // Inline function 'kotlin.collections.any' call
          var tmp_0;
          if (isInterface(tmp0, Collection)) {
            tmp_0 = tmp0.a1();
          } else {
            tmp_0 = false;
          }
          if (tmp_0) {
            tmp$ret$0 = false;
            break $l$block_0;
          }
          var _iterator__ex2g4s = tmp0.s();
          while (_iterator__ex2g4s.t()) {
            var element = _iterator__ex2g4s.u();
            if (element.isScopeDefinedFor(possiblyQualifiedTypeName.a1u_1)) {
              tmp$ret$0 = true;
              break $l$block_0;
            }
          }
          tmp$ret$0 = false;
        }
        tmp = tmp$ret$0;
      } else {
        noWhenBranchMatchedException();
      }
    }
    return tmp;
  }
  referencesFor(possiblyQualifiedTypeName) {
    var tmp;
    if (possiblyQualifiedTypeName instanceof QualifiedName) {
      var qn = possiblyQualifiedTypeName;
      var qName = _QualifiedName___get_front__impl__24j8eq(qn.f27_1);
      var tName = _QualifiedName___get_last__impl__838y8h(qn.f27_1);
      var ns = this.declarationsForNamespace.z2(new QualifiedName(qName));
      var tmp2_elvis_lhs = ns == null ? null : ns.referencesFor(tName);
      return tmp2_elvis_lhs == null ? emptyList() : tmp2_elvis_lhs;
    } else {
      if (possiblyQualifiedTypeName instanceof SimpleName) {
        // Inline function 'kotlin.collections.flatMap' call
        var tmp0 = this.declarationsForNamespace.v2();
        // Inline function 'kotlin.collections.flatMapTo' call
        var destination = ArrayList.y();
        var _iterator__ex2g4s = tmp0.s();
        while (_iterator__ex2g4s.t()) {
          var element = _iterator__ex2g4s.u();
          var list = element.referencesFor(possiblyQualifiedTypeName.a1u_1);
          addAll(destination, list);
        }
        tmp = destination;
      } else {
        noWhenBranchMatchedException();
      }
    }
    return tmp;
  }
  identifyingExpressionFor(scopeForTypeName, possiblyQualifiedTypeName) {
    var tmp;
    if (possiblyQualifiedTypeName instanceof QualifiedName) {
      var qn = possiblyQualifiedTypeName;
      var qName = _QualifiedName___get_front__impl__24j8eq(qn.f27_1);
      var tName = _QualifiedName___get_last__impl__838y8h(qn.f27_1);
      var ns = this.declarationsForNamespace.z2(new QualifiedName(qName));
      return ns == null ? null : ns.identifyingExpressionFor(scopeForTypeName, tName);
    } else {
      if (possiblyQualifiedTypeName instanceof SimpleName) {
        var tmp0 = this.declarationsForNamespace.v2();
        var tmp$ret$1;
        $l$block: {
          // Inline function 'kotlin.collections.firstNotNullOfOrNull' call
          var _iterator__ex2g4s = tmp0.s();
          while (_iterator__ex2g4s.t()) {
            var element = _iterator__ex2g4s.u();
            var result = element.identifyingExpressionFor(scopeForTypeName, possiblyQualifiedTypeName.a1u_1);
            if (!(result == null)) {
              tmp$ret$1 = result;
              break $l$block;
            }
          }
          tmp$ret$1 = null;
        }
        tmp = tmp$ret$1;
      } else {
        noWhenBranchMatchedException();
      }
    }
    return tmp;
  }
  referenceForProperty(typeQualifiedName, propertyName) {
    var tmp0_elvis_lhs = this.i3d_1.z2(new Pair(new QualifiedName(typeQualifiedName), propertyName));
    return tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs;
  }
  addRecordReferenceForProperty(typeQualifiedName, propertyName, refersToQualifiedTypeNames) {
    var tmp0 = this.i3d_1;
    // Inline function 'kotlin.collections.set' call
    var key = new Pair(new QualifiedName(typeQualifiedName), propertyName);
    tmp0.r2(key, refersToQualifiedTypeNames);
  }
  get declarationsForNamespace() {
    return this.q3c();
  }
}
class CrossReferenceNamespaceDefault extends NamespaceAbstract {
  constructor(qualifiedName, options, import_0) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    import_0 = import_0 === VOID ? emptyList() : import_0;
    super(options, import_0);
    this.l3d_1 = qualifiedName;
  }
  u2h() {
    return this.l3d_1;
  }
  q3c() {
    return first(this.definition);
  }
  get declarationsForNamespace() {
    return this.q3c();
  }
}
class DeclarationsForNamespaceDefault extends DefinitionAbstract {
  constructor(namespace, options) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    super();
    this.e3c_1 = namespace;
    this.f3c_1 = options;
    this.g3c_1 = _SimpleName___init__impl__6s45d0('Declarations');
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.h3c_1 = LinkedHashMap.l4();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_0.i3c_1 = ArrayList.y();
    this.e3c_1.addDefinition(this);
    var tmp0 = this.h3c_1;
    var tmp1 = new SimpleName(_QualifiedName___get_last__impl__838y8h(Companion_getInstance_24().ROOT_SCOPE_TYPE_NAME));
    // Inline function 'kotlin.collections.set' call
    var value = new ScopeDefinitionDefault(_QualifiedName___get_last__impl__838y8h(Companion_getInstance_24().ROOT_SCOPE_TYPE_NAME));
    tmp0.r2(tmp1, value);
  }
  e2h() {
    return this.e3c_1;
  }
  x1c() {
    return this.f3c_1;
  }
  f2h() {
    return this.g3c_1;
  }
  r3c() {
    return this.e3c_1.import;
  }
  s3c() {
    return this.h3c_1;
  }
  t3c() {
    return this.i3c_1;
  }
  mk() {
    return this.h3c_1.a1() && this.i3c_1.a1();
  }
  isScopeDefinedFor(typeName) {
    return this.h3c_1.x2(new SimpleName(typeName));
  }
  referencesFor(typeName) {
    // Inline function 'kotlin.collections.filter' call
    var tmp0 = this.i3c_1;
    // Inline function 'kotlin.collections.filterTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (element.inTypeName === typeName) {
        destination.r(element);
      }
    }
    // Inline function 'kotlin.collections.flatMap' call
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination_0 = ArrayList.y();
    var _iterator__ex2g4s_0 = destination.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      var list = element_0.referenceExpressionList;
      addAll(destination_0, list);
    }
    return destination_0;
  }
  referenceForPropertyOrNull(typeName, propertyName) {
    var refs = this.referencesFor(typeName);
    var tmp$ret$1;
    $l$block: {
      // Inline function 'kotlin.collections.firstOrNull' call
      var _iterator__ex2g4s = refs.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        if (element instanceof ReferenceExpressionPropertyDefault) {
          tmp$ret$1 = element;
          break $l$block;
        }
      }
      tmp$ret$1 = null;
    }
    return tmp$ret$1;
  }
  identifyingExpressionFor(scopeForTypeName, typeName) {
    var scope = this.h3c_1.z2(new SimpleName(scopeForTypeName));
    var tmp1_safe_receiver = scope == null ? null : scope.identifiables;
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      var tmp$ret$1;
      $l$block: {
        // Inline function 'kotlin.collections.firstOrNull' call
        var _iterator__ex2g4s = tmp1_safe_receiver.s();
        while (_iterator__ex2g4s.t()) {
          var element = _iterator__ex2g4s.u();
          if (element.typeName === typeName) {
            tmp$ret$1 = element;
            break $l$block;
          }
        }
        tmp$ret$1 = null;
      }
      tmp = tmp$ret$1;
    }
    var identifiable = tmp;
    return identifiable == null ? null : identifiable.identifiedBy;
  }
  h2f(indent) {
    var sb = StringBuilder.j();
    var tmp = this.h3c_1.v2();
    var scps = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, DeclarationsForNamespaceDefault$asString$lambda(indent));
    sb.cb(scps);
    return sb.toString();
  }
  bh() {
    return this.e3c_1;
  }
  ch() {
    return this.f3c_1;
  }
  m3d(namespace, options) {
    return new DeclarationsForNamespaceDefault(namespace, options);
  }
  copy(namespace, options, $super) {
    namespace = namespace === VOID ? this.e3c_1 : namespace;
    options = options === VOID ? this.f3c_1 : options;
    return $super === VOID ? this.m3d(namespace, options) : $super.m3d.call(this, namespace, options);
  }
  toString() {
    return 'DeclarationsForNamespaceDefault(namespace=' + toString(this.e3c_1) + ', options=' + toString(this.f3c_1) + ')';
  }
  hashCode() {
    var result = hashCode(this.e3c_1);
    result = imul(result, 31) + hashCode(this.f3c_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof DeclarationsForNamespaceDefault))
      return false;
    var tmp0_other_with_cast = other instanceof DeclarationsForNamespaceDefault ? other : THROW_CCE();
    if (!equals(this.e3c_1, tmp0_other_with_cast.e3c_1))
      return false;
    if (!equals(this.f3c_1, tmp0_other_with_cast.f3c_1))
      return false;
    return true;
  }
  get importedNamespaces() {
    return this.r3c();
  }
  get scopeDefinition() {
    return this.s3c();
  }
  get references() {
    return this.t3c();
  }
  get isEmpty() {
    return this.mk();
  }
}
class ScopeDefinitionDefault {
  constructor(scopeForTypeName) {
    this.z3b_1 = scopeForTypeName;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.a3c_1 = ArrayList.y();
  }
  w3c() {
    return this.z3b_1;
  }
  x3c() {
    return this.a3c_1;
  }
  h2f(indent) {
    var sb = StringBuilder.j();
    sb.cb('scope ' + _SimpleName___get_value__impl__rl2r3c(this.z3b_1) + ' {');
    if (this.a3c_1.a1()) {
      sb.cb(' }');
    } else {
      sb.cb('\n');
      var _iterator__ex2g4s = this.a3c_1.s();
      while (_iterator__ex2g4s.t()) {
        var id = _iterator__ex2g4s.u();
        sb.cb(id.asString(indent.inc));
      }
      sb.cb('\n' + indent.toString() + '}');
    }
    return sb.toString();
  }
  n3d() {
    return this.z3b_1;
  }
  o3d(scopeForTypeName) {
    return new ScopeDefinitionDefault(scopeForTypeName);
  }
  copy(scopeForTypeName, $super) {
    scopeForTypeName = scopeForTypeName === VOID ? this.z3b_1 : scopeForTypeName;
    return $super === VOID ? this.o3d(scopeForTypeName) : $super.o3d.call(this, new SimpleName(scopeForTypeName));
  }
  toString() {
    return 'ScopeDefinitionDefault(scopeForTypeName=' + SimpleName__toString_impl_vxsxyc(this.z3b_1) + ')';
  }
  hashCode() {
    return SimpleName__hashCode_impl_a6n15h(this.z3b_1);
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof ScopeDefinitionDefault))
      return false;
    var tmp0_other_with_cast = other instanceof ScopeDefinitionDefault ? other : THROW_CCE();
    if (!(this.z3b_1 === tmp0_other_with_cast.z3b_1))
      return false;
    return true;
  }
  get scopeForTypeName() {
    return this.w3c();
  }
  get identifiables() {
    return this.x3c();
  }
}
class IdentifiableDefault {
  constructor(typeName, identifiedBy) {
    this.p3d_1 = typeName;
    this.q3d_1 = identifiedBy;
  }
  a2p() {
    return this.p3d_1;
  }
  y3c() {
    return this.q3d_1;
  }
  h2f(indent) {
    return indent.toString() + 'identify ' + _SimpleName___get_value__impl__rl2r3c(this.p3d_1) + ' by ' + this.q3d_1.asString(indent, emptyList());
  }
  n3d() {
    return this.p3d_1;
  }
  ch() {
    return this.q3d_1;
  }
  r3d(typeName, identifiedBy) {
    return new IdentifiableDefault(typeName, identifiedBy);
  }
  copy(typeName, identifiedBy, $super) {
    typeName = typeName === VOID ? this.p3d_1 : typeName;
    identifiedBy = identifiedBy === VOID ? this.q3d_1 : identifiedBy;
    return $super === VOID ? this.r3d(typeName, identifiedBy) : $super.r3d.call(this, new SimpleName(typeName), identifiedBy);
  }
  toString() {
    return 'IdentifiableDefault(typeName=' + SimpleName__toString_impl_vxsxyc(this.p3d_1) + ', identifiedBy=' + toString(this.q3d_1) + ')';
  }
  hashCode() {
    var result = SimpleName__hashCode_impl_a6n15h(this.p3d_1);
    result = imul(result, 31) + hashCode(this.q3d_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof IdentifiableDefault))
      return false;
    var tmp0_other_with_cast = other instanceof IdentifiableDefault ? other : THROW_CCE();
    if (!(this.p3d_1 === tmp0_other_with_cast.p3d_1))
      return false;
    if (!equals(this.q3d_1, tmp0_other_with_cast.q3d_1))
      return false;
    return true;
  }
  get typeName() {
    return this.a2p();
  }
  get identifiedBy() {
    return this.y3c();
  }
}
class ReferenceDefinitionDefault {
  constructor(inTypeName, referenceExpressionList) {
    this.b3c_1 = inTypeName;
    this.c3c_1 = referenceExpressionList;
  }
  u3c() {
    return this.b3c_1;
  }
  v3c() {
    return this.c3c_1;
  }
  h2f(indent) {
    var sb = StringBuilder.j();
    sb.cb('in ' + _SimpleName___get_value__impl__rl2r3c(this.b3c_1) + ' {\n');
    var _iterator__ex2g4s = this.c3c_1.s();
    while (_iterator__ex2g4s.t()) {
      var re = _iterator__ex2g4s.u();
      sb.cb(re.asString(indent.inc));
    }
    return sb.toString();
  }
  n3d() {
    return this.b3c_1;
  }
  ch() {
    return this.c3c_1;
  }
  s3d(inTypeName, referenceExpressionList) {
    return new ReferenceDefinitionDefault(inTypeName, referenceExpressionList);
  }
  copy(inTypeName, referenceExpressionList, $super) {
    inTypeName = inTypeName === VOID ? this.b3c_1 : inTypeName;
    referenceExpressionList = referenceExpressionList === VOID ? this.c3c_1 : referenceExpressionList;
    return $super === VOID ? this.s3d(inTypeName, referenceExpressionList) : $super.s3d.call(this, new SimpleName(inTypeName), referenceExpressionList);
  }
  toString() {
    return 'ReferenceDefinitionDefault(inTypeName=' + SimpleName__toString_impl_vxsxyc(this.b3c_1) + ', referenceExpressionList=' + toString(this.c3c_1) + ')';
  }
  hashCode() {
    var result = SimpleName__hashCode_impl_a6n15h(this.b3c_1);
    result = imul(result, 31) + hashCode(this.c3c_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof ReferenceDefinitionDefault))
      return false;
    var tmp0_other_with_cast = other instanceof ReferenceDefinitionDefault ? other : THROW_CCE();
    if (!(this.b3c_1 === tmp0_other_with_cast.b3c_1))
      return false;
    if (!equals(this.c3c_1, tmp0_other_with_cast.c3c_1))
      return false;
    return true;
  }
  get inTypeName() {
    return this.u3c();
  }
  get referenceExpressionList() {
    return this.v3c();
  }
}
class ReferenceExpressionAbstract {}
class ReferenceExpressionPropertyDefault extends ReferenceExpressionAbstract {
  constructor(referringPropertyNavigation, refersToTypeName, fromNavigation) {
    super();
    this.i2j_1 = referringPropertyNavigation;
    this.j2j_1 = refersToTypeName;
    this.k2j_1 = fromNavigation;
  }
  z3c() {
    return this.i2j_1;
  }
  a3d() {
    return this.j2j_1;
  }
  b3d() {
    return this.k2j_1;
  }
  h2f(indent) {
    var sb = StringBuilder.j();
    var rp = this.i2j_1.asString(indent, emptyList());
    var rt = joinToString(this.j2j_1, ' | ', VOID, VOID, VOID, VOID, ReferenceExpressionPropertyDefault$asString$lambda);
    var fr = this.k2j_1 == null ? '' : ' ' + this.k2j_1.asString(indent, emptyList());
    sb.cb(indent.toString() + 'property ' + rp + ' refers-to ' + rt + fr);
    return sb.toString();
  }
  bh() {
    return this.i2j_1;
  }
  ch() {
    return this.j2j_1;
  }
  ds() {
    return this.k2j_1;
  }
  t3d(referringPropertyNavigation, refersToTypeName, fromNavigation) {
    return new ReferenceExpressionPropertyDefault(referringPropertyNavigation, refersToTypeName, fromNavigation);
  }
  copy(referringPropertyNavigation, refersToTypeName, fromNavigation, $super) {
    referringPropertyNavigation = referringPropertyNavigation === VOID ? this.i2j_1 : referringPropertyNavigation;
    refersToTypeName = refersToTypeName === VOID ? this.j2j_1 : refersToTypeName;
    fromNavigation = fromNavigation === VOID ? this.k2j_1 : fromNavigation;
    return $super === VOID ? this.t3d(referringPropertyNavigation, refersToTypeName, fromNavigation) : $super.t3d.call(this, referringPropertyNavigation, refersToTypeName, fromNavigation);
  }
  toString() {
    return 'ReferenceExpressionPropertyDefault(referringPropertyNavigation=' + toString(this.i2j_1) + ', refersToTypeName=' + toString(this.j2j_1) + ', fromNavigation=' + toString_0(this.k2j_1) + ')';
  }
  hashCode() {
    var result = hashCode(this.i2j_1);
    result = imul(result, 31) + hashCode(this.j2j_1) | 0;
    result = imul(result, 31) + (this.k2j_1 == null ? 0 : hashCode(this.k2j_1)) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof ReferenceExpressionPropertyDefault))
      return false;
    var tmp0_other_with_cast = other instanceof ReferenceExpressionPropertyDefault ? other : THROW_CCE();
    if (!equals(this.i2j_1, tmp0_other_with_cast.i2j_1))
      return false;
    if (!equals(this.j2j_1, tmp0_other_with_cast.j2j_1))
      return false;
    if (!equals(this.k2j_1, tmp0_other_with_cast.k2j_1))
      return false;
    return true;
  }
  get referringPropertyNavigation() {
    return this.z3c();
  }
  get refersToTypeName() {
    return this.a3d();
  }
  get fromNavigation() {
    return this.b3d();
  }
}
class ReferenceExpressionCollectionDefault extends ReferenceExpressionAbstract {
  constructor(expression, ofType, referenceExpressionList) {
    super();
    this.l2j_1 = expression;
    this.m2j_1 = ofType;
    this.n2j_1 = referenceExpressionList;
  }
  v1j() {
    return this.l2j_1;
  }
  c3d() {
    return this.m2j_1;
  }
  v3c() {
    return this.n2j_1;
  }
  h2f(indent) {
    var sb = StringBuilder.j();
    var ex = this.l2j_1.asString(indent, emptyList());
    var ot = this.m2j_1 == null ? '' : ' of-type' + this.m2j_1.value;
    sb.cb(indent.toString() + 'forall ' + ex + ot + ' refers-to {\n');
    if (this.n2j_1.a1())
      sb.cb(' }');
    else {
      var _iterator__ex2g4s = this.n2j_1.s();
      while (_iterator__ex2g4s.t()) {
        var re = _iterator__ex2g4s.u();
        sb.cb(re.asString(indent.inc));
      }
      sb.cb('\n' + indent.toString() + '}');
    }
    return sb.toString();
  }
  bh() {
    return this.l2j_1;
  }
  ch() {
    return this.m2j_1;
  }
  ds() {
    return this.n2j_1;
  }
  u3d(expression, ofType, referenceExpressionList) {
    return new ReferenceExpressionCollectionDefault(expression, ofType, referenceExpressionList);
  }
  copy(expression, ofType, referenceExpressionList, $super) {
    expression = expression === VOID ? this.l2j_1 : expression;
    ofType = ofType === VOID ? this.m2j_1 : ofType;
    referenceExpressionList = referenceExpressionList === VOID ? this.n2j_1 : referenceExpressionList;
    return $super === VOID ? this.u3d(expression, ofType, referenceExpressionList) : $super.u3d.call(this, expression, ofType, referenceExpressionList);
  }
  toString() {
    return 'ReferenceExpressionCollectionDefault(expression=' + toString(this.l2j_1) + ', ofType=' + toString_0(this.m2j_1) + ', referenceExpressionList=' + toString(this.n2j_1) + ')';
  }
  hashCode() {
    var result = hashCode(this.l2j_1);
    result = imul(result, 31) + (this.m2j_1 == null ? 0 : hashCode(this.m2j_1)) | 0;
    result = imul(result, 31) + hashCode(this.n2j_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof ReferenceExpressionCollectionDefault))
      return false;
    var tmp0_other_with_cast = other instanceof ReferenceExpressionCollectionDefault ? other : THROW_CCE();
    if (!equals(this.l2j_1, tmp0_other_with_cast.l2j_1))
      return false;
    if (!equals(this.m2j_1, tmp0_other_with_cast.m2j_1))
      return false;
    if (!equals(this.n2j_1, tmp0_other_with_cast.n2j_1))
      return false;
    return true;
  }
  get expression() {
    return this.v1j();
  }
  get ofType() {
    return this.c3d();
  }
  get referenceExpressionList() {
    return this.v3c();
  }
}
class CrossReferenceModelBuilder {
  constructor(_name) {
    this.v3d_1 = _name;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.w3d_1 = ArrayList.y();
  }
  declarationsFor(namespaceQualifiedName, init) {
    var ns = new CrossReferenceNamespaceDefault(_QualifiedName___init__impl__8ed982(namespaceQualifiedName));
    var b = new DeclarationsForNamespaceBuilder(ns);
    init(b);
    var _destruct__k2r9zo = b.build();
    var def = _destruct__k2r9zo.bh();
    var imps = _destruct__k2r9zo.ch();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = imps.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var it = element.p2i_1;
      ns.addImport(it);
    }
    this.w3d_1.r(ns);
  }
  build() {
    var result = new CrossReferenceModelDefault(_SimpleName___init__impl__6s45d0(this.v3d_1), VOID, this.w3d_1);
    return result;
  }
}
class DeclarationsForNamespaceBuilder {
  constructor(namespace) {
    this.x3d_1 = namespace;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.y3d_1 = ArrayList.y();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_0.z3d_1 = ArrayList.y();
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_1.a3e_1 = ArrayList.y();
  }
  import(namespaceQualifiedName) {
    this.y3d_1.r(new Import(_Import___init__impl__786z8c(namespaceQualifiedName)));
  }
  scope(forTypeName, init) {
    var b = new ScopeDefinitionBuilder(_SimpleName___init__impl__6s45d0(forTypeName));
    init(b);
    this.a3e_1.r(b.build());
  }
  reference(inType, init) {
    var b = new ReferenceDefinitionBuilder(_SimpleName___init__impl__6s45d0(inType));
    init(b);
    this.z3d_1.r(b.build());
  }
  build() {
    var result = new DeclarationsForNamespaceDefault(this.x3d_1);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.a3e_1.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0 = result.h3c_1;
      // Inline function 'kotlin.collections.set' call
      var key = new SimpleName(element.scopeForTypeName);
      tmp0.r2(key, element);
    }
    result.i3c_1.x(this.z3d_1);
    return new Pair(result, this.y3d_1);
  }
}
class ScopeDefinitionBuilder {
  constructor(_forTypeName) {
    this.b3e_1 = _forTypeName;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.c3e_1 = ArrayList.y();
  }
  identify(typeName, expressionStr) {
    var exprResult = ensureNotNull(Agl_getInstance().registry.agl.expressions.processor).process(expressionStr);
    // Inline function 'kotlin.check' call
    if (!exprResult.allIssues.errors.a1()) {
      var message = toString(exprResult.allIssues);
      throw IllegalStateException.v4(toString(message));
    }
    var tmp0_elvis_lhs = exprResult.asm;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message_0 = 'No expression created from given expressionStr';
      throw IllegalStateException.v4(toString(message_0));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var expression = tmp;
    var i = new IdentifiableDefault(_SimpleName___init__impl__6s45d0(typeName), expression);
    this.c3e_1.r(i);
  }
  build() {
    var result = new ScopeDefinitionDefault(this.b3e_1);
    result.a3c_1.x(this.c3e_1);
    return result;
  }
}
class ReferenceDefinitionBuilder {
  constructor(_inType) {
    this.d3e_1 = _inType;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp._refExpressionList = ArrayList.y();
  }
  e3e() {
    return this._refExpressionList;
  }
  property(referringPropertyStr, refersToTypes, fromExpressionStr) {
    var exprResult = ensureNotNull(Agl_getInstance().registry.agl.expressions.processor).process(referringPropertyStr);
    // Inline function 'kotlin.check' call
    if (!exprResult.allIssues.errors.a1()) {
      var message = toString(exprResult.allIssues);
      throw IllegalStateException.v4(toString(message));
    }
    var tmp0_safe_receiver = exprResult.asm;
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      var tmp_0;
      if (isInterface(tmp0_safe_receiver, NavigationExpression)) {
        tmp_0 = tmp0_safe_receiver;
      } else {
        if (isInterface(tmp0_safe_receiver, RootExpression)) {
          tmp_0 = new NavigationExpressionDefault(new RootExpressionDefault(tmp0_safe_receiver.name), emptyList());
        } else {
          var message_0 = "Navigation cannot be created from given referringPropertyStr '" + toString(tmp0_safe_receiver) + "'";
          throw IllegalStateException.v4(toString(message_0));
        }
      }
      tmp = tmp_0;
    }
    var tmp1_elvis_lhs = tmp;
    var tmp_1;
    if (tmp1_elvis_lhs == null) {
      var message_1 = "Navigation cannot be created from given expression '" + fromExpressionStr + "'";
      throw IllegalStateException.v4(toString(message_1));
    } else {
      tmp_1 = tmp1_elvis_lhs;
    }
    var refPropNav = tmp_1;
    var tmp_2;
    if (fromExpressionStr == null) {
      tmp_2 = null;
    } else {
      // Inline function 'kotlin.let' call
      var fromResult = ensureNotNull(Agl_getInstance().registry.agl.expressions.processor).process(fromExpressionStr);
      // Inline function 'kotlin.check' call
      if (!fromResult.allIssues.errors.a1()) {
        var message_2 = toString(fromResult.allIssues);
        throw IllegalStateException.v4(toString(message_2));
      }
      var tmp0_safe_receiver_0 = fromResult.asm;
      var tmp_3;
      if (tmp0_safe_receiver_0 == null) {
        tmp_3 = null;
      } else {
        // Inline function 'kotlin.let' call
        var tmp_4;
        if (isInterface(tmp0_safe_receiver_0, NavigationExpression)) {
          tmp_4 = tmp0_safe_receiver_0;
        } else {
          tmp_4 = null;
        }
        tmp_3 = tmp_4;
      }
      var tmp1_elvis_lhs_0 = tmp_3;
      var tmp_5;
      if (tmp1_elvis_lhs_0 == null) {
        var message_3 = 'Navigation not created from given fromExpressionStr';
        throw IllegalStateException.v4(toString(message_3));
      } else {
        tmp_5 = tmp1_elvis_lhs_0;
      }
      tmp_2 = tmp_5;
    }
    var fromNav = tmp_2;
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(refersToTypes, 10));
    var _iterator__ex2g4s = refersToTypes.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$10 = get_asPossiblyQualifiedName(item);
      destination.r(tmp$ret$10);
    }
    this._refExpressionList.r(new ReferenceExpressionPropertyDefault(refPropNav, destination, fromNav));
  }
  collection() {
  }
  build() {
    return new ReferenceDefinitionDefault(this.d3e_1, this._refExpressionList);
  }
}
class CrossReferenceModelBuilderMarker {
  equals(other) {
    if (!(other instanceof CrossReferenceModelBuilderMarker))
      return false;
    other instanceof CrossReferenceModelBuilderMarker || THROW_CCE();
    return true;
  }
  hashCode() {
    return 0;
  }
  toString() {
    return '@net.akehurst.language.reference.builder.CrossReferenceModelBuilderMarker(' + ')';
  }
}
class AglScope_0 {
  constructor() {
    AglScope_instance = this;
    this.komposite = 'namespace net.akehurst.language.scope.api\ninterface Scope {\n    cmp scopeMap\n    cmp childScopes\n    cmp items\n}\n';
    var tmp = this;
    tmp.f3e_1 = lazy(AglScope$typeModel$delegate$lambda);
  }
  k2p() {
    return this.komposite;
  }
  m2e() {
    var tmp0 = this.f3e_1;
    // Inline function 'kotlin.getValue' call
    typeModel$factory_1();
    return tmp0.b3();
  }
  get typeModel() {
    return this.m2e();
  }
}
class ItemInScope {
  constructor(referableName, qualifiedTypeName, location, item) {
    this.referableName = referableName;
    this.qualifiedTypeName = qualifiedTypeName;
    this.location = location;
    this.item = item;
  }
  g3e() {
    return this.referableName;
  }
  z2o() {
    return this.qualifiedTypeName;
  }
  d15() {
    return this.location;
  }
  t36() {
    return this.item;
  }
  bh() {
    return this.referableName;
  }
  h3e() {
    return this.qualifiedTypeName;
  }
  ds() {
    return this.location;
  }
  es() {
    return this.item;
  }
  i3e(referableName, qualifiedTypeName, location, item) {
    return new ItemInScope(referableName, qualifiedTypeName, location, item);
  }
  copy(referableName, qualifiedTypeName, location, item, $super) {
    referableName = referableName === VOID ? this.referableName : referableName;
    qualifiedTypeName = qualifiedTypeName === VOID ? this.qualifiedTypeName : qualifiedTypeName;
    location = location === VOID ? this.location : location;
    item = item === VOID ? this.item : item;
    return $super === VOID ? this.i3e(referableName, qualifiedTypeName, location, item) : $super.i3e.call(this, referableName, new QualifiedName(qualifiedTypeName), location, item);
  }
  toString() {
    return 'ItemInScope(referableName=' + this.referableName + ', qualifiedTypeName=' + QualifiedName__toString_impl_z3wem2(this.qualifiedTypeName) + ', location=' + toString_0(this.location) + ', item=' + toString_0(this.item) + ')';
  }
  hashCode() {
    var result = getStringHashCode(this.referableName);
    result = imul(result, 31) + QualifiedName__hashCode_impl_dcqht7(this.qualifiedTypeName) | 0;
    result = imul(result, 31) + (this.location == null ? 0 : hashCode(this.location)) | 0;
    result = imul(result, 31) + (this.item == null ? 0 : hashCode(this.item)) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof ItemInScope))
      return false;
    var tmp0_other_with_cast = other instanceof ItemInScope ? other : THROW_CCE();
    if (!(this.referableName === tmp0_other_with_cast.referableName))
      return false;
    if (!(this.qualifiedTypeName === tmp0_other_with_cast.qualifiedTypeName))
      return false;
    if (!equals(this.location, tmp0_other_with_cast.location))
      return false;
    if (!equals(this.item, tmp0_other_with_cast.item))
      return false;
    return true;
  }
}
class Scope {}
class Companion_22 {
  constructor() {
    this.ROOT_ID = '';
  }
  o3e() {
    return this.ROOT_ID;
  }
}
class ScopeSimple {
  constructor(parent, scopeIdentityInParent, forTypeName) {
    this.parent = parent;
    this.scopeIdentityInParent = scopeIdentityInParent;
    this.f2r_1 = forTypeName;
    var tmp = this;
    tmp.g2r_1 = lazy(ScopeSimple$scopeIdentity$delegate$lambda(this));
    var tmp_0 = this;
    tmp_0.h2r_1 = lazy(ScopeSimple$scopePath$delegate$lambda(this));
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_1.i2r_1 = LinkedHashMap.l4();
    var tmp_2 = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp_2.j2r_1 = LinkedHashMap.l4();
    var tmp_3 = this;
    tmp_3.k2r_1 = lazy(ScopeSimple$rootScope$delegate$lambda(this));
    this.l2r_1 = this.i2r_1;
  }
  ox() {
    return this.parent;
  }
  p3e() {
    return this.scopeIdentityInParent;
  }
  j3e() {
    return this.f2r_1;
  }
  k3e() {
    var tmp0 = this.g2r_1;
    // Inline function 'kotlin.getValue' call
    scopeIdentity$factory();
    return tmp0.b3();
  }
  l3e() {
    var tmp0 = this.h2r_1;
    // Inline function 'kotlin.getValue' call
    scopePath$factory();
    return tmp0.b3();
  }
  n3e() {
    var tmp0 = this.k2r_1;
    // Inline function 'kotlin.getValue' call
    rootScope$factory();
    return tmp0.b3();
  }
  m3e() {
    return this.l2r_1;
  }
  ck() {
    return this.j2r_1;
  }
  mk() {
    return this.items.a1() && this.l2r_1.a1();
  }
  clear() {
    this.i2r_1.n2();
    this.j2r_1.n2();
  }
  contains(referableName, conformsToFunc) {
    var tmp0_safe_receiver = this.items.z2(referableName);
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.w2();
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      var tmp$ret$0;
      $l$block_0: {
        // Inline function 'kotlin.collections.any' call
        var tmp_0;
        if (isInterface(tmp1_safe_receiver, Collection)) {
          tmp_0 = tmp1_safe_receiver.a1();
        } else {
          tmp_0 = false;
        }
        if (tmp_0) {
          tmp$ret$0 = false;
          break $l$block_0;
        }
        var _iterator__ex2g4s = tmp1_safe_receiver.s();
        while (_iterator__ex2g4s.t()) {
          var element = _iterator__ex2g4s.u();
          if (conformsToFunc(element.a3())) {
            tmp$ret$0 = true;
            break $l$block_0;
          }
        }
        tmp$ret$0 = false;
      }
      tmp = tmp$ret$0;
    }
    var tmp2_elvis_lhs = tmp;
    return tmp2_elvis_lhs == null ? false : tmp2_elvis_lhs;
  }
  getChildScopeOrNull(childScopeIdentityInThis) {
    return this.i2r_1.z2(childScopeIdentityInThis);
  }
  createOrGetChildScope(childScopeIdentityInThis, forTypeName) {
    var child = this.i2r_1.z2(childScopeIdentityInThis);
    if (null == child) {
      child = new ScopeSimple(this, childScopeIdentityInThis, forTypeName);
      var tmp0 = this.i2r_1;
      // Inline function 'kotlin.collections.set' call
      var value = child;
      tmp0.r2(childScopeIdentityInThis, value);
    }
    return child;
  }
  addToScope(referableName, qualifiedTypeName, location, itemInScope, replaceIfAlreadyExists) {
    var map = this.j2r_1.z2(referableName);
    var tmp;
    if (map == null) {
      var m = mutableMapOf([to(new QualifiedName(qualifiedTypeName), new Pair(location, itemInScope))]);
      // Inline function 'kotlin.collections.set' call
      this.j2r_1.r2(referableName, m);
      tmp = true;
    } else {
      var tmp_0;
      if (!replaceIfAlreadyExists && map.x2(new QualifiedName(qualifiedTypeName))) {
        tmp_0 = false;
      } else {
        var tmp4 = new QualifiedName(qualifiedTypeName);
        // Inline function 'kotlin.collections.set' call
        var value = new Pair(location, itemInScope);
        map.r2(tmp4, value);
        tmp_0 = true;
      }
      tmp = tmp_0;
    }
    return tmp;
  }
  removeItemsWithLocation(location) {
    // Inline function 'kotlin.collections.forEach' call
    // Inline function 'kotlin.collections.iterator' call
    var _iterator__ex2g4s = this.j2r_1.w2().s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      // Inline function 'kotlin.collections.component1' call
      var k = element.a3();
      // Inline function 'kotlin.collections.component2' call
      var v = element.b3();
      // Inline function 'kotlin.collections.filter' call
      // Inline function 'kotlin.collections.filterTo' call
      var destination = LinkedHashMap.l4();
      // Inline function 'kotlin.collections.iterator' call
      var _iterator__ex2g4s_0 = v.w2().s();
      while (_iterator__ex2g4s_0.t()) {
        var element_0 = _iterator__ex2g4s_0.u();
        if (equals(element_0.b3().zg_1, location)) {
          destination.r2(element_0.a3(), element_0.b3());
        }
      }
      var toGo = destination;
      // Inline function 'kotlin.collections.forEach' call
      // Inline function 'kotlin.collections.iterator' call
      var _iterator__ex2g4s_1 = toGo.w2().s();
      while (_iterator__ex2g4s_1.t()) {
        var element_1 = _iterator__ex2g4s_1.u();
        v.s2(element_1.a3());
      }
    }
  }
  removeItemsIf(func) {
    // Inline function 'kotlin.collections.forEach' call
    // Inline function 'kotlin.collections.iterator' call
    var _iterator__ex2g4s = this.j2r_1.w2().s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      // Inline function 'kotlin.collections.component1' call
      var referableName = element.a3();
      // Inline function 'kotlin.collections.component2' call
      var map = element.b3();
      // Inline function 'kotlin.collections.filter' call
      // Inline function 'kotlin.collections.filterTo' call
      var destination = LinkedHashMap.l4();
      // Inline function 'kotlin.collections.iterator' call
      var _iterator__ex2g4s_0 = map.w2().s();
      while (_iterator__ex2g4s_0.t()) {
        var element_0 = _iterator__ex2g4s_0.u();
        // Inline function 'kotlin.collections.component1' call
        var typeName = element_0.a3().f27_1;
        // Inline function 'kotlin.collections.component2' call
        var p = element_0.b3();
        if (func(new ItemInScope(referableName, typeName, p.zg_1, p.ah_1))) {
          destination.r2(element_0.a3(), element_0.b3());
        }
      }
      var toGo = destination;
      // Inline function 'kotlin.collections.forEach' call
      // Inline function 'kotlin.collections.iterator' call
      var _iterator__ex2g4s_1 = toGo.w2().s();
      while (_iterator__ex2g4s_1.t()) {
        var element_1 = _iterator__ex2g4s_1.u();
        map.s2(element_1.a3());
      }
    }
  }
  findItemsNamed(name) {
    var tmp0_safe_receiver = this.items.z2(name);
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.collections.map' call
      // Inline function 'kotlin.collections.mapTo' call
      var destination = ArrayList.w(tmp0_safe_receiver.v());
      // Inline function 'kotlin.collections.iterator' call
      var _iterator__ex2g4s = tmp0_safe_receiver.w2().s();
      while (_iterator__ex2g4s.t()) {
        var item = _iterator__ex2g4s.u();
        // Inline function 'kotlin.collections.component1' call
        var typeName = item.a3().f27_1;
        // Inline function 'kotlin.collections.component2' call
        var p = item.b3();
        var tmp$ret$3 = new ItemInScope(name, typeName, p.zg_1, p.ah_1);
        destination.r(tmp$ret$3);
      }
      tmp = destination;
    }
    var tmp1_safe_receiver = tmp;
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toSet(tmp1_safe_receiver);
    return tmp2_elvis_lhs == null ? emptySet() : tmp2_elvis_lhs;
  }
  findItemsConformingTo(conformsToFunc) {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.items.w2();
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      // Inline function 'kotlin.collections.component1' call
      var referableName = element.a3();
      // Inline function 'kotlin.collections.component2' call
      var map = element.b3();
      // Inline function 'kotlin.collections.filter' call
      var tmp0_0 = map.w2();
      // Inline function 'kotlin.collections.filterTo' call
      var destination_0 = ArrayList.y();
      var _iterator__ex2g4s_0 = tmp0_0.s();
      while (_iterator__ex2g4s_0.t()) {
        var element_0 = _iterator__ex2g4s_0.u();
        // Inline function 'kotlin.collections.component1' call
        var typeName = element_0.a3().f27_1;
        if (conformsToFunc(new QualifiedName(typeName))) {
          destination_0.r(element_0);
        }
      }
      // Inline function 'kotlin.collections.map' call
      // Inline function 'kotlin.collections.mapTo' call
      var destination_1 = ArrayList.w(collectionSizeOrDefault(destination_0, 10));
      var _iterator__ex2g4s_1 = destination_0.s();
      while (_iterator__ex2g4s_1.t()) {
        var item = _iterator__ex2g4s_1.u();
        // Inline function 'kotlin.collections.component1' call
        var typeName_0 = item.a3().f27_1;
        // Inline function 'kotlin.collections.component2' call
        var p = item.b3();
        var tmp$ret$8 = new ItemInScope(referableName, typeName_0, p.zg_1, p.ah_1);
        destination_1.r(tmp$ret$8);
      }
      var list = destination_1;
      addAll(destination, list);
    }
    return destination;
  }
  findItemsNamedConformingTo(name, conformsToFunc) {
    var tmp0_safe_receiver = this.items.z2(name);
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.collections.filter' call
      // Inline function 'kotlin.collections.filterTo' call
      var destination = LinkedHashMap.l4();
      // Inline function 'kotlin.collections.iterator' call
      var _iterator__ex2g4s = tmp0_safe_receiver.w2().s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        // Inline function 'kotlin.collections.component1' call
        var typeName = element.a3().f27_1;
        if (conformsToFunc(new QualifiedName(typeName))) {
          destination.r2(element.a3(), element.b3());
        }
      }
      tmp = destination;
    }
    var tmp1_safe_receiver = tmp;
    var tmp_0;
    if (tmp1_safe_receiver == null) {
      tmp_0 = null;
    } else {
      // Inline function 'kotlin.collections.map' call
      // Inline function 'kotlin.collections.mapTo' call
      var destination_0 = ArrayList.w(tmp1_safe_receiver.v());
      // Inline function 'kotlin.collections.iterator' call
      var _iterator__ex2g4s_0 = tmp1_safe_receiver.w2().s();
      while (_iterator__ex2g4s_0.t()) {
        var item = _iterator__ex2g4s_0.u();
        // Inline function 'kotlin.collections.component1' call
        var typeName_0 = item.a3().f27_1;
        // Inline function 'kotlin.collections.component2' call
        var p = item.b3();
        var tmp$ret$8 = new ItemInScope(name, typeName_0, p.zg_1, p.ah_1);
        destination_0.r(tmp$ret$8);
      }
      tmp_0 = destination_0;
    }
    var tmp2_elvis_lhs = tmp_0;
    var tmp_1;
    if (tmp2_elvis_lhs == null) {
      var tmp3_safe_receiver = this.parent;
      tmp_1 = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.findItemsNamedConformingTo(name, conformsToFunc);
    } else {
      tmp_1 = tmp2_elvis_lhs;
    }
    var tmp4_elvis_lhs = tmp_1;
    return tmp4_elvis_lhs == null ? emptyList() : tmp4_elvis_lhs;
  }
  findItemsByQualifiedName(qualifiedName) {
    var tmp;
    switch (qualifiedName.v()) {
      case 0:
        tmp = emptySet();
        break;
      case 1:
        tmp = this.findItemsNamed(first(qualifiedName));
        break;
      default:
        var child = this.l2r_1.z2(first(qualifiedName));
        var tmp2_elvis_lhs = child == null ? null : child.findItemsByQualifiedName(drop(qualifiedName, 1));
        tmp = tmp2_elvis_lhs == null ? emptySet() : tmp2_elvis_lhs;
        break;
    }
    return tmp;
  }
  findItemsByQualifiedNameConformingTo(qualifiedName, conformsToFunc) {
    var tmp;
    switch (qualifiedName.v()) {
      case 0:
        tmp = emptyList();
        break;
      case 1:
        tmp = this.findItemsNamedConformingTo(first(qualifiedName), conformsToFunc);
        break;
      default:
        var child = this.l2r_1.z2(first(qualifiedName));
        var tmp2_elvis_lhs = child == null ? null : child.findItemsByQualifiedNameConformingTo(drop(qualifiedName, 1), conformsToFunc);
        tmp = tmp2_elvis_lhs == null ? emptyList() : tmp2_elvis_lhs;
        break;
    }
    return tmp;
  }
  asString(indent) {
    var scopeIndent = indent.inc;
    var tmp = this.items.w2();
    var content = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, ScopeSimple$asString$lambda(scopeIndent, this));
    var tmp_0 = this.l2r_1.w2();
    var childScopes = joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, ScopeSimple$asString$lambda_0(scopeIndent));
    var tmp_1;
    var tmp_2;
    if (this.items.a1()) {
      // Inline function 'kotlin.text.isEmpty' call
      tmp_2 = charSequenceLength(childScopes) === 0;
    } else {
      tmp_2 = false;
    }
    if (tmp_2) {
      tmp_1 = '{ }';
    } else {
      if (this.items.a1()) {
        tmp_1 = '{\n' + childScopes + '\n' + indent.toString() + '}';
      } else {
        // Inline function 'kotlin.text.isEmpty' call
        if (charSequenceLength(childScopes) === 0) {
          tmp_1 = '{\n' + content + '\n' + indent.toString() + '}';
        } else {
          tmp_1 = '{\n' + content + '\n' + childScopes + '\n' + indent.toString() + '}';
        }
      }
    }
    return tmp_1;
  }
  hashCode() {
    // Inline function 'kotlin.arrayOf' call
    // Inline function 'kotlin.js.unsafeCast' call
    // Inline function 'kotlin.js.asDynamic' call
    var tmp$ret$2 = [this.parent, this.scopeIdentityInParent, this.scopeIdentity];
    return contentHashCode(tmp$ret$2);
  }
  equals(other) {
    var tmp;
    if (!(other instanceof ScopeSimple)) {
      tmp = false;
    } else {
      if (!equals(this.parent, other.parent)) {
        tmp = false;
      } else {
        if (!(this.scopeIdentityInParent === other.scopeIdentityInParent)) {
          tmp = false;
        } else {
          if (!(this.scopeIdentity === other.scopeIdentity)) {
            tmp = false;
          } else {
            tmp = true;
          }
        }
      }
    }
    return tmp;
  }
  toString() {
    return this.scopeIdentity;
  }
  get forTypeName() {
    return this.j3e();
  }
  get scopeIdentity() {
    return this.k3e();
  }
  get scopePath() {
    return this.l3e();
  }
  get rootScope() {
    return this.n3e();
  }
  get childScopes() {
    return this.m3e();
  }
  get items() {
    return this.ck();
  }
  get isEmpty() {
    return this.mk();
  }
}
class AglStyle_0 extends LanguageObjectAbstract {
  constructor() {
    AglStyle_instance = null;
    super();
    AglStyle_instance = this;
    this.NAMESPACE_NAME = 'net.akehurst.language';
    this.NAME = 'Style';
    this.goalRuleName = 'unit';
    this.p25_1 = _LanguageIdentity___init__impl__3hnnkb('net.akehurst.language.Style');
    this.q25_1 = "namespace net.akehurst.language\n    grammar Style : Base {\n        override unit = namespace styleSet* ;\n        styleSet = 'styles' IDENTIFIER extends? '{' rule* '}' ;\n        extends = ':' [possiblyQualifiedName / ',']+ ;\n        rule = metaRule | tagRule ;\n        metaRule = '$$' PATTERN '{' styleList '}' ;\n        tagRule = selectorExpression '{' styleList '}' ;\n        selectorExpression\n         = selectorAndComposition\n         | selectorSingle\n         ; //TODO\n        selectorAndComposition = [selectorSingle /',']2+ ;\n        selectorSingle = LITERAL | PATTERN | IDENTIFIER | SPECIAL_IDENTIFIER ;\n        styleList = style* ;\n        style = STYLE_ID ':' styleValue ';' ;\n        styleValue = STYLE_VALUE | STRING ;\n        \n        leaf LITERAL = \"'([^'\\\\\\\\]|\\\\.)+'\" ;\n        leaf PATTERN = \"\\\"([^\\\"\\\\\\\\]|\\\\.)+\\\"\" ;\n        leaf SPECIAL_IDENTIFIER = \"[\\\\$][a-zA-Z_][a-zA-Z_0-9-]*\" ;\n        leaf STYLE_ID = \"[-a-zA-Z_][-a-zA-Z_0-9]*\" ;\n        leaf STYLE_VALUE = \"[^;: \\t\\n\\x0B\\f\\r]+\" ;\n        leaf STRING = \"'([^'\\\\\\\\]|\\\\'|\\\\\\\\)*'\" ;\n    }";
    this.r25_1 = 'namespace net.akehurst.language\n  references {\n    in scope property typeReference refers-to GrammarRule\n    in identifiable property typeReference refers-to GrammarRule\n    in referenceDefinition property typeReference refers-to GrammarRule\n    in referenceDefinition property propertyReference refers-to GrammarRule\n  }';
    this.s25_1 = "namespace net.akehurst.language\n    styles Style {\n        $$ \"'([^']+)'\" {\n          foreground: darkgreen;\n          font-weight: bold;\n        }\n        SPECIAL_IDENTIFIER {\n          foreground: orange;\n          font-weight: bold;\n        }\n        IDENTIFIER {\n          foreground: blue;\n          font-weight: bold;\n        }\n        LITERAL {\n          foreground: blue;\n          font-weight: bold;\n        }\n        PATTERN {\n          foreground: darkblue;\n          font-weight: bold;\n        }\n        STYLE_ID {\n          foreground: darkred;\n          font-style: italic;\n        }\n    }";
    var tmp = this;
    tmp.t25_1 = lazy(AglStyle$grammarModel$delegate$lambda);
    this.komposite = 'namespace net.akehurst.language.style.api\ninterface StyleSet {\n    cmp extends\n    cmp rules\n}\ninterface AglStyleRule {\n    cmp selector\n    cmp declaration\n}\n';
    var tmp_0 = this;
    tmp_0.u25_1 = lazy(AglStyle$typesModel$delegate$lambda);
    var tmp_1 = this;
    tmp_1.v25_1 = lazy(AglStyle$asmTransformModel$delegate$lambda);
    var tmp_2 = this;
    tmp_2.w25_1 = lazy(AglStyle$crossReferenceModel$delegate$lambda);
    var tmp_3 = this;
    tmp_3.x25_1 = lazy(AglStyle$styleModel$delegate$lambda);
    var tmp_4 = this;
    tmp_4.y25_1 = lazy(AglStyle$formatModel$delegate$lambda);
    var tmp_5 = this;
    tmp_5.z25_1 = lazy(AglStyle$defaultTargetGrammar$delegate$lambda);
    this.a26_1 = 'unit';
    var tmp_6 = this;
    tmp_6.b26_1 = lazy(AglStyle$syntaxAnalyser$delegate$lambda);
    var tmp_7 = this;
    tmp_7.c26_1 = lazy(AglStyle$semanticAnalyser$delegate$lambda);
    var tmp_8 = this;
    tmp_8.d26_1 = lazy(AglStyle$completionProvider$delegate$lambda);
  }
  u2t() {
    return this.NAMESPACE_NAME;
  }
  v2t() {
    return this.NAME;
  }
  b16() {
    return this.goalRuleName;
  }
  g1u() {
    return this.p25_1;
  }
  u2n() {
    return this.q25_1;
  }
  y2n() {
    return this.r25_1;
  }
  z2n() {
    return this.s25_1;
  }
  i1u() {
    var tmp0 = this.t25_1;
    // Inline function 'kotlin.getValue' call
    grammarModel$factory_5();
    return tmp0.b3();
  }
  k2p() {
    return this.komposite;
  }
  p1u() {
    var tmp0 = this.u25_1;
    // Inline function 'kotlin.getValue' call
    typesModel$factory_3();
    return tmp0.b3();
  }
  j2k() {
    var tmp0 = this.v25_1;
    // Inline function 'kotlin.getValue' call
    asmTransformModel$factory_3();
    return tmp0.b3();
  }
  r1u() {
    var tmp0 = this.w25_1;
    // Inline function 'kotlin.getValue' call
    crossReferenceModel$factory_4();
    return tmp0.b3();
  }
  w1u() {
    var tmp0 = this.x25_1;
    // Inline function 'kotlin.getValue' call
    styleModel$factory_3();
    return tmp0.b3();
  }
  i1t() {
    var tmp0 = this.y25_1;
    // Inline function 'kotlin.getValue' call
    formatModel$factory_4();
    return tmp0.b3();
  }
  c2o() {
    var tmp0 = this.z25_1;
    // Inline function 'kotlin.getValue' call
    defaultTargetGrammar$factory_3();
    return tmp0.b3();
  }
  d2o() {
    return this.a26_1;
  }
  s1u() {
    var tmp0 = this.b26_1;
    // Inline function 'kotlin.getValue' call
    syntaxAnalyser$factory_4();
    return tmp0.b3();
  }
  t1u() {
    var tmp0 = this.c26_1;
    // Inline function 'kotlin.getValue' call
    semanticAnalyser$factory_4();
    return tmp0.b3();
  }
  p1y() {
    var tmp0 = this.d26_1;
    // Inline function 'kotlin.getValue' call
    completionProvider$factory_4();
    return tmp0.b3();
  }
}
class Companion_23 {
  constructor() {
    Companion_instance_24 = this;
    var tmp = this;
    var tmp0_elvis_lhs = AglStyle_getInstance().asmTransformModel.findDefinitionByQualifiedNameOrNull(AglStyle_getInstance().defaultTargetGrammar.qualifiedName);
    var tmp_0;
    if (tmp0_elvis_lhs == null) {
      var message = 'Internal error: styleTransformRuleSet not found';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_0 = tmp0_elvis_lhs;
    }
    tmp.q3e_1 = tmp_0;
    var tmp_1 = this;
    var tmp0_elvis_lhs_0 = AglGrammar_getInstance().typesModel.findByQualifiedNameOrNull(_QualifiedName___init__impl__8ed982('net.akehurst.language.grammar.api.GrammarRule'));
    var tmp_2;
    if (tmp0_elvis_lhs_0 == null) {
      var message_0 = "Internal error: type for 'grammarRule' not found";
      throw IllegalStateException.v4(toString(message_0));
    } else {
      tmp_2 = tmp0_elvis_lhs_0;
    }
    tmp_1.r3e_1 = tmp_2;
  }
}
class AglStyleCompletionProvider {
  constructor() {
    Companion_getInstance_26();
  }
  provide(spines, options) {
    var context = options.context;
    var tmp;
    if (null == context) {
      tmp = emptyList();
    } else {
      // Inline function 'kotlin.collections.flatMap' call
      // Inline function 'kotlin.collections.flatMapTo' call
      var destination = ArrayList.y();
      var _iterator__ex2g4s = spines.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        // Inline function 'kotlin.collections.flatMap' call
        var tmp0 = element.expectedNextLeafNonTerminalOrTerminal;
        // Inline function 'kotlin.collections.flatMapTo' call
        var destination_0 = ArrayList.y();
        var _iterator__ex2g4s_0 = tmp0.s();
        while (_iterator__ex2g4s_0.t()) {
          var element_0 = _iterator__ex2g4s_0.u();
          var list = provideForTerminalItem(this, element, element_0, options);
          addAll(destination_0, list);
        }
        var list_0 = destination_0;
        addAll(destination, list_0);
      }
      var items = destination;
      tmp = Companion_instance_0.defaultSortAndFilter(items);
    }
    return tmp;
  }
}
class Companion_24 {
  constructor() {
    Companion_instance_25 = this;
    this.s3e_1 = _QualifiedName___init__impl__8ed982('net.akehurst.language.grammar.api.GrammarRule');
  }
}
class AglStyleSemanticAnalyser {
  constructor() {
    Companion_getInstance_27();
    this._issues = new IssueHolder(LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance());
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.t3e_1 = ArrayList.y();
  }
  i1v() {
    return this._issues;
  }
  clear() {
    this._issues.clear();
    this.t3e_1.n2();
  }
  u3e(sentenceIdentity, asm, locationMap, options) {
    var context = options.context;
    var locMap = locationMap == null ? new LocationMapDefault() : locationMap;
    if (!(null == context)) {
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s = asm.allDefinitions.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        // Inline function 'kotlin.collections.forEach' call
        var _iterator__ex2g4s_0 = element.rules.s();
        while (_iterator__ex2g4s_0.t()) {
          var element_0 = _iterator__ex2g4s_0.u();
          if (isInterface(element_0, AglStyleMetaRule)) {
            analyseMetaRule(this, element_0, locMap, context);
          } else {
            if (isInterface(element_0, AglStyleTagRule)) {
              analyseTagRule(this, element_0, locMap, context);
            }
          }
        }
      }
    }
    return new SemanticAnalysisResultDefault(this.t3e_1, this._issues);
  }
  y2j(sentenceIdentity, asm, locationMap, options) {
    return this.u3e(sentenceIdentity, isInterface(asm, AglStyleModel) ? asm : THROW_CCE(), locationMap, options);
  }
}
class AglStyleSyntaxAnalyser extends SyntaxAnalyserByMethodRegistrationAbstract {
  constructor() {
    super();
    this.b3f_1 = mapOf(to(new QualifiedName(_QualifiedName___init__impl__8ed982('Base')), new BaseSyntaxAnalyser()));
    this.c3f_1 = emptyMap();
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.d3f_1 = LinkedHashMap.l4();
  }
  s2k() {
    return this.b3f_1;
  }
  e2k() {
    return this.c3f_1;
  }
  registerHandlers() {
    super.register(AglStyleSyntaxAnalyser$unit$ref(this));
    super.register(AglStyleSyntaxAnalyser$namespace$ref(this));
    super.register(AglStyleSyntaxAnalyser$styleSet$ref(this));
    super.register(AglStyleSyntaxAnalyser$rule$ref(this));
    super.register(AglStyleSyntaxAnalyser$metaRule$ref(this));
    super.register(AglStyleSyntaxAnalyser$tagRule$ref(this));
    super.register(AglStyleSyntaxAnalyser$selectorExpression$ref(this));
    super.register(AglStyleSyntaxAnalyser$selectorAndComposition$ref(this));
    super.register(AglStyleSyntaxAnalyser$selectorSingle$ref(this));
    super.register(AglStyleSyntaxAnalyser$styleList$ref(this));
    super.register(AglStyleSyntaxAnalyser$style$ref(this));
    super.register(AglStyleSyntaxAnalyser$styleValue$ref(this));
  }
  r2z(nodeInfo, children, sentence) {
    var tmp = children.z(0);
    var ns = tmp instanceof StyleNamespaceDefault ? tmp : THROW_CCE();
    var tmp_0 = children.z(1);
    var ruleBuilder = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = ruleBuilder.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      element(ns);
    }
    var su = new AglStyleModelDefault(_SimpleName___init__impl__6s45d0('ParsedStyleUnit'), VOID, listOf(ns));
    return su;
  }
  s2z(nodeInfo, children, sentence) {
    var tmp = children.z(1);
    var qualifiedName = (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
    var imports = emptyList();
    return new StyleNamespaceDefault(qualifiedName.asQualifiedName(null), VOID, imports);
  }
  e3f(nodeInfo, children, sentence) {
    var tmp = children.z(1);
    var name = _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
    var tmp_0 = children.z(2);
    var tmp0_elvis_lhs = (tmp_0 == null ? true : isInterface(tmp_0, KtList)) ? tmp_0 : THROW_CCE();
    var extends_0 = tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs;
    var tmp_1 = children.z(4);
    var rules = (!(tmp_1 == null) ? isInterface(tmp_1, KtList) : false) ? tmp_1 : THROW_CCE();
    return AglStyleSyntaxAnalyser$styleSet$lambda(name, extends_0, this, nodeInfo, sentence, rules);
  }
  f3f(nodeInfo, children, sentence) {
    var tmp = children.z(0);
    return (!(tmp == null) ? isInterface(tmp, AglStyleRule) : false) ? tmp : THROW_CCE();
  }
  g3f(nodeInfo, children, sentence) {
    var tmp = children.z(1);
    var patternStr = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
    var escaped = replace(patternStr, '\\"', '"');
    var regex = Regex.pe(trim(escaped, charArrayOf([_Char___init__impl__6a9atx(34)])));
    var tmp_0 = children.z(3);
    var styles = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
    var rule = new AglStyleMetaRuleDefault(regex);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = styles.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0 = rule.u3f_1;
      // Inline function 'kotlin.collections.set' call
      var key = element.name;
      tmp0.r2(key, element);
    }
    return rule;
  }
  h3f(nodeInfo, children, sentence) {
    var tmp = children.z(0);
    var selector = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
    var tmp_0 = children.z(2);
    var styles = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
    var rule = new AglStyleTagRuleDefault(selector);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = styles.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0 = rule.w3f_1;
      // Inline function 'kotlin.collections.set' call
      var key = element.name;
      tmp0.r2(key, element);
    }
    return rule;
  }
  i3f(nodeInfo, children, sentence) {
    var tmp;
    switch (_OptionNum___get_asIndex__impl__fdwc2b(nodeInfo.alt.option)) {
      case 0:
        var tmp_0 = children.z(0);
        tmp = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
        break;
      case 1:
        var tmp_1 = children.z(0);
        tmp = listOf(tmp_1 instanceof AglStyleSelector ? tmp_1 : THROW_CCE());
        break;
      default:
        var message = "Internal error: alternative 'selectorExpression' not handled";
        throw IllegalStateException.v4(toString(message));
    }
    return tmp;
  }
  j3f(nodeInfo, children, sentence) {
    // Inline function 'net.akehurst.language.collections.toSeparatedList' call
    var this_0 = isInterface(children, KtList) ? children : THROW_CCE();
    return ListSeparatedArrayList.gk(this_0).ck();
  }
  k3f(nodeInfo, children, sentence) {
    var isPattern = nodeInfo.node.rule.tag === 'PATTERN';
    var tmp = children.z(0);
    var mt = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
    var tmp_0;
    if (isPattern) {
      tmp_0 = replace(mt, '\\"', '"');
    } else {
      tmp_0 = replace(replace(mt, "\\'", "'"), '\\\\', '\\');
    }
    var value = tmp_0;
    var tmp_1;
    switch (_OptionNum___get_asIndex__impl__fdwc2b(nodeInfo.alt.option)) {
      case 0:
        tmp_1 = AglStyleSelectorKind_LITERAL_getInstance();
        break;
      case 1:
        tmp_1 = AglStyleSelectorKind_PATTERN_getInstance();
        break;
      case 2:
        tmp_1 = AglStyleSelectorKind_RULE_NAME_getInstance();
        break;
      case 3:
        tmp_1 = AglStyleSelectorKind_SPECIAL_getInstance();
        break;
      default:
        var message = 'Internal error: AglStyleSelectorKind not handled';
        throw IllegalStateException.v4(toString(message));
    }
    var kind = tmp_1;
    return new AglStyleSelector(mt, kind);
  }
  l3f(nodeInfo, children, sentence) {
    return isInterface(children, KtList) ? children : THROW_CCE();
  }
  m3f(nodeInfo, children, sentence) {
    var tmp = children.z(0);
    var name = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
    var tmp_0 = children.z(2);
    var value = (!(tmp_0 == null) ? typeof tmp_0 === 'string' : false) ? tmp_0 : THROW_CCE();
    return new AglStyleDeclaration(name, value);
  }
  n3f(nodeInfo, children, sentence) {
    var tmp = children.z(0);
    return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
  }
}
class Companion_25 {
  constructor() {
    Companion_instance_26 = this;
    this.KEYWORD_STYLE_ID = new AglStyleSelector('$keyword', AglStyleSelectorKind_SPECIAL_getInstance());
    this.NO_STYLE_ID = new AglStyleSelector('$nostyle', AglStyleSelectorKind_SPECIAL_getInstance());
  }
  x3f() {
    return this.KEYWORD_STYLE_ID;
  }
  y3f() {
    return this.NO_STYLE_ID;
  }
  fromString(context, aglStyleModelSentence) {
    var tmp0_elvis_lhs = Agl_getInstance().registry.agl.style.processor;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = 'Styles language not found!';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var proc = tmp;
    var tmp_0 = _StyleString___get_value__impl__2hufp(aglStyleModelSentence);
    var tmp_1 = Agl_getInstance();
    return proc.process(tmp_0, tmp_1.options(VOID, AglStyleModelDefault$Companion$fromString$lambda(context)));
  }
}
class AglStyleModel {}
class AglStyleModelDefault extends ModelAbstract {
  constructor(name, options, namespace) {
    Companion_getInstance_28();
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    namespace = namespace === VOID ? emptyList() : namespace;
    super(namespace, options);
    this.b3g_1 = name;
  }
  f2h() {
    return this.b3g_1;
  }
}
class StyleNamespace {}
class StyleNamespaceDefault extends NamespaceAbstract {
  constructor(qualifiedName, options, import_0) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    import_0 = import_0 === VOID ? emptyList() : import_0;
    super(options, import_0);
    this.e3g_1 = qualifiedName;
  }
  u2h() {
    return this.e3g_1;
  }
  f3g() {
    return this.definition;
  }
  get styleSet() {
    return this.f3g();
  }
}
class StyleSetReference {}
class StyleSetReferenceDefault {
  constructor(localNamespace, nameOrQName) {
    this.g3g_1 = localNamespace;
    this.h3g_1 = nameOrQName;
    this.i3g_1 = null;
  }
  f2t() {
    return this.g3g_1;
  }
  g2t() {
    return this.h3g_1;
  }
  j3g(_set____db54di) {
    this.i3g_1 = _set____db54di;
  }
  i2t() {
    return this.i3g_1;
  }
  resolveAs(resolved) {
    this.i3g_1 = resolved;
  }
  bh() {
    return this.g3g_1;
  }
  ch() {
    return this.h3g_1;
  }
  k3g(localNamespace, nameOrQName) {
    return new StyleSetReferenceDefault(localNamespace, nameOrQName);
  }
  copy(localNamespace, nameOrQName, $super) {
    localNamespace = localNamespace === VOID ? this.g3g_1 : localNamespace;
    nameOrQName = nameOrQName === VOID ? this.h3g_1 : nameOrQName;
    return $super === VOID ? this.k3g(localNamespace, nameOrQName) : $super.k3g.call(this, localNamespace, nameOrQName);
  }
  toString() {
    return 'StyleSetReferenceDefault(localNamespace=' + toString(this.g3g_1) + ', nameOrQName=' + toString(this.h3g_1) + ')';
  }
  hashCode() {
    var result = hashCode(this.g3g_1);
    result = imul(result, 31) + hashCode(this.h3g_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof StyleSetReferenceDefault))
      return false;
    var tmp0_other_with_cast = other instanceof StyleSetReferenceDefault ? other : THROW_CCE();
    if (!equals(this.g3g_1, tmp0_other_with_cast.g3g_1))
      return false;
    if (!equals(this.h3g_1, tmp0_other_with_cast.h3g_1))
      return false;
    return true;
  }
  get localNamespace() {
    return this.f2t();
  }
  get nameOrQName() {
    return this.g2t();
  }
  get resolved() {
    return this.i2t();
  }
  set resolved(value) {
    this.j3g(value);
  }
}
class StyleSet {}
class AglStyleSetDefault extends DefinitionAbstract {
  constructor(namespace, name, extends_0, options) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    super();
    this.o3f_1 = namespace;
    this.p3f_1 = name;
    this.q3f_1 = extends_0;
    this.r3f_1 = options;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.s3f_1 = ArrayList.y();
    this.o3f_1.addDefinition(this);
  }
  e2h() {
    return this.o3f_1;
  }
  f2h() {
    return this.p3f_1;
  }
  w2x() {
    return this.q3f_1;
  }
  x1c() {
    return this.r3f_1;
  }
  u2x() {
    return this.s3f_1;
  }
  l3g() {
    // Inline function 'kotlin.collections.filterIsInstance' call
    var tmp0 = this.s3f_1;
    // Inline function 'kotlin.collections.filterIsInstanceTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!(element == null) ? isInterface(element, AglStyleMetaRule) : false) {
        destination.r(element);
      }
    }
    return destination;
  }
  m3g() {
    // Inline function 'kotlin.collections.filterIsInstance' call
    var tmp0 = this.s3f_1;
    // Inline function 'kotlin.collections.filterIsInstanceTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!(element == null) ? isInterface(element, AglStyleTagRule) : false) {
        destination.r(element);
      }
    }
    return destination;
  }
  h2f(indent) {
    var sb = StringBuilder.j();
    sb.cb('styles ' + _SimpleName___get_value__impl__rl2r3c(this.p3f_1) + ' {\n');
    var newIndent = indent.inc;
    var rules = joinToString(this.s3f_1, '\n', VOID, VOID, VOID, VOID, AglStyleSetDefault$asString$lambda(newIndent));
    sb.cb(rules);
    sb.cb('\n' + indent.toString() + '}');
    return sb.toString();
  }
  get extends() {
    return this.w2x();
  }
  get rules() {
    return this.u2x();
  }
  get metaRules() {
    return this.l3g();
  }
  get tagRules() {
    return this.m3g();
  }
}
class AglStyleRule {}
class AglStyleMetaRule {}
class AglStyleMetaRuleDefault {
  constructor(pattern) {
    this.t3f_1 = pattern;
    var tmp = this;
    // Inline function 'kotlin.collections.linkedMapOf' call
    tmp.u3f_1 = LinkedHashMap.l4();
  }
  n3g() {
    return this.t3f_1;
  }
  o3g(_set____db54di) {
    this.u3f_1 = _set____db54di;
  }
  p3g() {
    return this.u3f_1;
  }
  h2f(indent) {
    var sb = StringBuilder.j();
    var sel = this.t3f_1.de_1;
    sb.cb('$$ "' + sel + '" {\n');
    var newIndent = indent.inc;
    var tmp = this.u3f_1.v2();
    var decls = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, AglStyleMetaRuleDefault$asString$lambda(newIndent));
    sb.cb(decls);
    sb.cb('\n' + indent.toString() + '}');
    return sb.toString();
  }
  bh() {
    return this.t3f_1;
  }
  zo(pattern) {
    return new AglStyleMetaRuleDefault(pattern);
  }
  copy(pattern, $super) {
    pattern = pattern === VOID ? this.t3f_1 : pattern;
    return $super === VOID ? this.zo(pattern) : $super.zo.call(this, pattern);
  }
  toString() {
    return 'AglStyleMetaRuleDefault(pattern=' + this.t3f_1.toString() + ')';
  }
  hashCode() {
    return hashCode(this.t3f_1);
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof AglStyleMetaRuleDefault))
      return false;
    var tmp0_other_with_cast = other instanceof AglStyleMetaRuleDefault ? other : THROW_CCE();
    if (!equals(this.t3f_1, tmp0_other_with_cast.t3f_1))
      return false;
    return true;
  }
  get pattern() {
    return this.n3g();
  }
  get declaration() {
    return this.p3g();
  }
  set declaration(value) {
    this.o3g(value);
  }
}
class AglStyleTagRule {}
class AglStyleTagRuleDefault {
  constructor(selector) {
    this.v3f_1 = selector;
    var tmp = this;
    // Inline function 'kotlin.collections.linkedMapOf' call
    tmp.w3f_1 = LinkedHashMap.l4();
  }
  q3g() {
    return this.v3f_1;
  }
  o3g(_set____db54di) {
    this.w3f_1 = _set____db54di;
  }
  p3g() {
    return this.w3f_1;
  }
  h2f(indent) {
    var sb = StringBuilder.j();
    var sel = joinToString(this.v3f_1, VOID, VOID, VOID, VOID, VOID, AglStyleTagRuleDefault$asString$lambda);
    sb.cb(sel + ' {\n');
    var newIndent = indent.inc;
    var tmp = this.w3f_1.v2();
    var decls = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, AglStyleTagRuleDefault$asString$lambda_0(newIndent));
    sb.cb(decls);
    sb.cb('\n' + indent.toString() + '}');
    return sb.toString();
  }
  bh() {
    return this.v3f_1;
  }
  r3g(selector) {
    return new AglStyleTagRuleDefault(selector);
  }
  copy(selector, $super) {
    selector = selector === VOID ? this.v3f_1 : selector;
    return $super === VOID ? this.r3g(selector) : $super.r3g.call(this, selector);
  }
  toString() {
    return 'AglStyleTagRuleDefault(selector=' + toString(this.v3f_1) + ')';
  }
  hashCode() {
    return hashCode(this.v3f_1);
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof AglStyleTagRuleDefault))
      return false;
    var tmp0_other_with_cast = other instanceof AglStyleTagRuleDefault ? other : THROW_CCE();
    if (!equals(this.v3f_1, tmp0_other_with_cast.v3f_1))
      return false;
    return true;
  }
  get selector() {
    return this.q3g();
  }
  get declaration() {
    return this.p3g();
  }
  set declaration(value) {
    this.o3g(value);
  }
}
class AglStyleSelectorKind extends Enum {
  get name() {
    return this.e3();
  }
  get ordinal() {
    return this.f3();
  }
}
class AglStyleSelector {
  constructor(value, kind) {
    this.value = value;
    this.kind = kind;
  }
  b3() {
    return this.value;
  }
  yo() {
    return this.kind;
  }
  bh() {
    return this.value;
  }
  ch() {
    return this.kind;
  }
  u3g(value, kind) {
    return new AglStyleSelector(value, kind);
  }
  copy(value, kind, $super) {
    value = value === VOID ? this.value : value;
    kind = kind === VOID ? this.kind : kind;
    return $super === VOID ? this.u3g(value, kind) : $super.u3g.call(this, value, kind);
  }
  toString() {
    return 'AglStyleSelector(value=' + this.value + ', kind=' + this.kind.toString() + ')';
  }
  hashCode() {
    var result = getStringHashCode(this.value);
    result = imul(result, 31) + this.kind.hashCode() | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof AglStyleSelector))
      return false;
    var tmp0_other_with_cast = other instanceof AglStyleSelector ? other : THROW_CCE();
    if (!(this.value === tmp0_other_with_cast.value))
      return false;
    if (!this.kind.equals(tmp0_other_with_cast.kind))
      return false;
    return true;
  }
}
class AglStyleDeclaration {
  constructor(name, value) {
    this.name = name;
    this.value = value;
  }
  e3() {
    return this.name;
  }
  b3() {
    return this.value;
  }
  bh() {
    return this.name;
  }
  ch() {
    return this.value;
  }
  v3g(name, value) {
    return new AglStyleDeclaration(name, value);
  }
  copy(name, value, $super) {
    name = name === VOID ? this.name : name;
    value = value === VOID ? this.value : value;
    return $super === VOID ? this.v3g(name, value) : $super.v3g.call(this, name, value);
  }
  toString() {
    return 'AglStyleDeclaration(name=' + this.name + ', value=' + this.value + ')';
  }
  hashCode() {
    var result = getStringHashCode(this.name);
    result = imul(result, 31) + getStringHashCode(this.value) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof AglStyleDeclaration))
      return false;
    var tmp0_other_with_cast = other instanceof AglStyleDeclaration ? other : THROW_CCE();
    if (!(this.name === tmp0_other_with_cast.name))
      return false;
    if (!(this.value === tmp0_other_with_cast.value))
      return false;
    return true;
  }
}
class StyleModelBuilder {
  constructor(_name) {
    this.w3g_1 = _name;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.x3g_1 = ArrayList.y();
  }
  namespace(qualifiedName, init) {
    var b = new StyleNamespaceBuilder(_QualifiedName___init__impl__8ed982(qualifiedName));
    init(b);
    this.x3g_1.r(b.build());
  }
  build() {
    // Inline function 'kotlin.also' call
    var this_0 = new AglStyleModelDefault(this.w3g_1);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.x3g_1.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      this_0.addNamespace(element);
    }
    return this_0;
  }
}
class StyleNamespaceBuilder {
  constructor(qualifiedName) {
    this.y3g_1 = new StyleNamespaceDefault(qualifiedName);
  }
  styles(name, init) {
    var b = new StylesBuilder(this.y3g_1, _SimpleName___init__impl__6s45d0(name));
    init(b);
    b.build();
  }
  build() {
    return this.y3g_1;
  }
}
class StylesBuilder {
  constructor(_namespace, _name) {
    this.z3g_1 = _namespace;
    this.a3h_1 = _name;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.b3h_1 = ArrayList.y();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_0.c3h_1 = ArrayList.y();
  }
  metaRule(pattern, init) {
    var b = new StyleMetaRuleBuilder(Regex.pe(pattern));
    init(b);
    this.c3h_1.r(b.build());
  }
  tagRule(tag, init) {
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(tag.length);
    var inductionVariable = 0;
    var last = tag.length;
    while (inductionVariable < last) {
      var item = tag[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      var kind = startsWith(item, "'") ? AglStyleSelectorKind_LITERAL_getInstance() : startsWith(item, '"') ? AglStyleSelectorKind_PATTERN_getInstance() : startsWith(item, '$') ? AglStyleSelectorKind_SPECIAL_getInstance() : AglStyleSelectorKind_RULE_NAME_getInstance();
      var tmp$ret$0 = new AglStyleSelector(item, kind);
      destination.r(tmp$ret$0);
    }
    var b = new StyleTagRuleBuilder(destination);
    init(b);
    this.c3h_1.r(b.build());
  }
  build() {
    // Inline function 'kotlin.also' call
    var this_0 = new AglStyleSetDefault(this.z3g_1, this.a3h_1, this.b3h_1);
    var tmp = this_0.s3f_1;
    (isInterface(tmp, KtMutableList) ? tmp : THROW_CCE()).x(this.c3h_1);
    return this_0;
  }
}
class StyleMetaRuleBuilder {
  constructor(_pattern) {
    this.d3h_1 = _pattern;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.e3h_1 = ArrayList.y();
  }
  declaration(name, value) {
    this.e3h_1.r(new AglStyleDeclaration(name, value));
  }
  build() {
    // Inline function 'kotlin.also' call
    var this_0 = new AglStyleMetaRuleDefault(this.d3h_1);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.e3h_1.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0 = this_0.u3f_1;
      // Inline function 'kotlin.collections.set' call
      var key = element.name;
      tmp0.r2(key, element);
    }
    return this_0;
  }
}
class StyleTagRuleBuilder {
  constructor(_selectors) {
    this.f3h_1 = _selectors;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.g3h_1 = ArrayList.y();
  }
  declaration(name, value) {
    this.g3h_1.r(new AglStyleDeclaration(name, value));
  }
  build() {
    // Inline function 'kotlin.also' call
    var this_0 = new AglStyleTagRuleDefault(this.f3h_1);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.g3h_1.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0 = this_0.w3f_1;
      // Inline function 'kotlin.collections.set' call
      var key = element.name;
      tmp0.r2(key, element);
    }
    return this_0;
  }
}
class StyleModelDslMarker {
  equals(other) {
    if (!(other instanceof StyleModelDslMarker))
      return false;
    other instanceof StyleModelDslMarker || THROW_CCE();
    return true;
  }
  hashCode() {
    return 0;
  }
  toString() {
    return '@net.akehurst.language.style.builder.StyleModelDslMarker(' + ')';
  }
}
class AsmTransform_0 {
  constructor() {
    AsmTransform_instance = this;
    this.NAMESPACE_NAME = 'net.akehurst.language';
    this.NAME = 'Transform';
    this.goalRuleName = 'unit';
    this.identity = _LanguageIdentity___init__impl__3hnnkb('net.akehurst.language.Transform');
    this.grammarString = "\nnamespace net.akehurst.language\n\ngrammar Transform : Base {\n    override namespace = 'namespace' possiblyQualifiedName option* import* transform* ;\n    transform = 'transform' IDENTIFIER extends? '{' option* typeImport* transformRule* '} ;\n    typeImport = 'import-types' possiblyQualifiedName ;\n    extends = ':' [possiblyQualifiedName / ',']+ ;\n    transformRule = grammarRuleName ':' transformRuleRhs ;\n    transformRuleRhs = expressionRule | modifyRule ;\n    expressionRule = expression ;\n    modifyRule = '{' possiblyQualifiedTypeName '->' statement+ '}' ;\n    statement\n      = assignmentStatement\n      ;\n    assignmentStatement = propertyName grammarRuleIndex? ':=' expression ;\n    propertyName = IDENTIFIER ;\n    expression = Expression::expression ;\n   \n    grammarRuleName = IDENTIFIER ;\n    grammarRuleIndex = '$' POSITIVE_INTEGER ;\n    possiblyQualifiedTypeName = possiblyQualifiedName ;\n\n    leaf POSITIVE_INTEGER = \"[0-9]+\" ;\n}\n    ";
    var tmp = this;
    tmp.grammar = grammar('net.akehurst.language', 'Transform', AsmTransform$grammar$lambda);
    this.styleStr = '\n    ';
  }
  u2t() {
    return this.NAMESPACE_NAME;
  }
  v2t() {
    return this.NAME;
  }
  b16() {
    return this.goalRuleName;
  }
  g1u() {
    return this.identity;
  }
  u2n() {
    return this.grammarString;
  }
  j21() {
    return this.grammar;
  }
  r3b() {
    return this.styleStr;
  }
  toString() {
    return trimIndent(this.grammarString);
  }
}
class AsmTransformCompletionProvider extends CompletionProviderAbstract {}
class Companion_26 {
  constructor() {
    Companion_instance_27 = this;
    this.SELF = '$self';
    this.PATH = _PropertyName___init__impl__sz2wu9('$path');
    this.ALTERNATIVE = _PropertyName___init__impl__sz2wu9('$alternative');
    this.CHILD = _PropertyName___init__impl__sz2wu9('child');
    this.CHILDREN = _PropertyName___init__impl__sz2wu9('children');
    this.MATCHED_TEXT = _PropertyName___init__impl__sz2wu9('$matchedText');
    this.LIST_OF_ANY = StdLibDefault_getInstance().List.type(listOf(StdLibDefault_getInstance().AnyType.nullable().asTypeArgument));
    this.SLIST_OF_ANY = StdLibDefault_getInstance().ListSeparated.type(listOf(StdLibDefault_getInstance().AnyType.asTypeArgument));
    this.CMP_STR_MEM = setOf_0([PropertyCharacteristic_COMPOSITE_getInstance(), PropertyCharacteristic_READ_WRITE_getInstance(), PropertyCharacteristic_STORED_getInstance()]);
    var tmp = this;
    tmp.parseNodeTypeModel = typeModel('ParseNodes', true, VOID, AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda);
    this.parseNodeNamespace = ensureNotNull(this.parseNodeTypeModel.findNamespaceOrNull(_QualifiedName___init__impl__8ed982('parse')));
    this.PARSE_NODE_TYPE_LEAF = ensureNotNull(this.parseNodeNamespace.findOwnedTypeNamed(_SimpleName___init__impl__6s45d0('Leaf')));
    this.PARSE_NODE_TYPE_BRANCH_SIMPLE = ensureNotNull(this.parseNodeNamespace.findOwnedTypeNamed(_SimpleName___init__impl__6s45d0('Branch'))).type();
    this.PARSE_NODE_TYPE_BRANCH_SEPARATED = ensureNotNull(this.parseNodeNamespace.findOwnedTypeNamed(_SimpleName___init__impl__6s45d0('BranchSeparated'))).type();
  }
  f2v() {
    return this.SELF;
  }
  h3h() {
    return this.PATH;
  }
  i3h() {
    return this.ALTERNATIVE;
  }
  j3h() {
    return this.CHILD;
  }
  k3h() {
    return this.CHILDREN;
  }
  l3h() {
    return this.MATCHED_TEXT;
  }
  m3h() {
    return this.LIST_OF_ANY;
  }
  n3h() {
    return this.SLIST_OF_ANY;
  }
  o3h() {
    return this.CMP_STR_MEM;
  }
  p3h() {
    return this.parseNodeTypeModel;
  }
  q3h() {
    return this.parseNodeNamespace;
  }
  r3h() {
    return this.PARSE_NODE_TYPE_LEAF;
  }
  s3h() {
    return this.PARSE_NODE_TYPE_BRANCH_SIMPLE;
  }
  t3h() {
    return this.PARSE_NODE_TYPE_BRANCH_SEPARATED;
  }
}
class AsmTransformInterpreter {
  constructor(typeModel, objectGraph) {
    Companion_getInstance_29();
    this.typeModel = typeModel;
    this.objectGraph = objectGraph;
    this.exprInterpreter = new ExpressionsInterpreterOverTypedObject(this.objectGraph, this.issues);
  }
  m2e() {
    return this.typeModel;
  }
  r2w() {
    return this.objectGraph;
  }
  n16() {
    return new IssueHolder(LanguageProcessorPhase_INTERPRET_getInstance());
  }
  u3h() {
    return this.exprInterpreter;
  }
  clear() {
    this.issues.clear();
  }
  evaluate(evc, trRule) {
    var tObj = evaluateSelfStatement(this, evc, trRule.expression);
    var asm = tObj;
    return asm;
  }
  get issues() {
    return this.n16();
  }
}
class Companion_27 {
  constructor() {
    this.OPTION_CREATE_TYPES = 'create-missing-types';
    this.OPTION_OVERRIDE_DEFAULT = 'override-default-transform';
  }
  v3h() {
    return this.OPTION_CREATE_TYPES;
  }
  w3h() {
    return this.OPTION_OVERRIDE_DEFAULT;
  }
}
class AsmTransformSemanticAnalyser {
  constructor() {
    this.x3h_1 = new IssueHolder(LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance());
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.y3h_1 = ArrayList.y();
    this.z3h_1 = null;
    this.a3i_1 = null;
    var tmp_0 = this;
    tmp_0.b3i_1 = cached(AsmTransformSemanticAnalyser$transformFromGrammar$lambda(this));
  }
  clear() {
    this.x3h_1.clear();
    this.y3h_1.n2();
    this.z3h_1 = null;
    this.a3i_1 = null;
    this.b3i_1.reset();
  }
  j3i(sentenceIdentity, asm, locationMap, options) {
    this.z3h_1 = options.context;
    this.a3i_1 = asm;
    if (null == this.z3h_1) {
      this.x3h_1.warn(null, 'No context, semantic analysis cannot be performed');
    } else {
      (asm instanceof TransformDomainDefault ? asm : THROW_CCE()).z2i_1 = _get__typeModel__vdou7v(this);
      var _iterator__ex2g4s = asm.namespace.s();
      while (_iterator__ex2g4s.t()) {
        var trns = _iterator__ex2g4s.u();
        overrideDefaultNamespace(this, trns);
        var _iterator__ex2g4s_0 = trns.definition.s();
        while (_iterator__ex2g4s_0.t()) {
          var trs = _iterator__ex2g4s_0.u();
          createMissingTypeNamespaces(this, trs);
        }
      }
      _get__typeModel__vdou7v(this).resolveImports();
      var _iterator__ex2g4s_1 = asm.namespace.s();
      while (_iterator__ex2g4s_1.t()) {
        var trns_0 = _iterator__ex2g4s_1.u();
        var _iterator__ex2g4s_2 = trns_0.definition.s();
        while (_iterator__ex2g4s_2.t()) {
          var trs_0 = _iterator__ex2g4s_2.u();
          overrideDefaultRuleSet(this, trs_0);
          convertRulesThatSimplyRedefineDefaultType(this, trs_0);
          createMissingTypes(this, trs_0);
          var _iterator__ex2g4s_3 = trs_0.extends.s();
          while (_iterator__ex2g4s_3.t()) {
            var ref = _iterator__ex2g4s_3.u();
            var resolved = asm.resolveReference(ref);
            if (resolved == null) {
              this.x3h_1.error(null, "Cannot resolve '" + toString(ref.nameOrQName) + "' in context '" + QualifiedName__toString_impl_z3wem2(ref.localNamespace.qualifiedName) + "'");
            }
          }
          var _iterator__ex2g4s_4 = trs_0.rules.v2().s();
          while (_iterator__ex2g4s_4.t()) {
            var trr = _iterator__ex2g4s_4.u();
            var ti = typeFor(this, trs_0, trr);
            (trr instanceof TransformationRuleDefault ? trr : THROW_CCE()).resolveTypeAs(ti);
          }
        }
      }
      _get__typeModel__vdou7v(this).resolveImports();
    }
    return new SemanticAnalysisResultDefault(this.y3h_1, this.x3h_1);
  }
  y2j(sentenceIdentity, asm, locationMap, options) {
    return this.j3i(sentenceIdentity, isInterface(asm, TransformModel) ? asm : THROW_CCE(), locationMap, options);
  }
}
class AsmTransformSyntaxAnalyser extends SyntaxAnalyserByMethodRegistrationAbstract {
  constructor() {
    super();
    this.q3i_1 = mapOf(to(new QualifiedName(_QualifiedName___init__impl__8ed982('Base')), new BaseSyntaxAnalyser()));
    this.r3i_1 = mapOf(to(new QualifiedName(AglExpressions_getInstance().defaultTargetGrammar.qualifiedName), new ExpressionsSyntaxAnalyser()));
  }
  s2k() {
    return this.q3i_1;
  }
  e2k() {
    return this.r3i_1;
  }
  registerHandlers() {
    super.register(AsmTransformSyntaxAnalyser$unit$ref(this));
    super.register(AsmTransformSyntaxAnalyser$namespace$ref(this));
    super.register(AsmTransformSyntaxAnalyser$transform$ref(this));
    super.register(AsmTransformSyntaxAnalyser$extends$ref(this));
    super.register(AsmTransformSyntaxAnalyser$typeImport$ref(this));
    super.register(AsmTransformSyntaxAnalyser$transformRule$ref(this));
    super.register(AsmTransformSyntaxAnalyser$transformRuleRhs$ref(this));
    super.register(AsmTransformSyntaxAnalyser$expressionRule$ref(this));
    super.register(AsmTransformSyntaxAnalyser$modifyRule$ref(this));
    super.register(AsmTransformSyntaxAnalyser$assignmentStatement$ref(this));
    super.register(AsmTransformSyntaxAnalyser$propertyName$ref(this));
    super.register(AsmTransformSyntaxAnalyser$grammarRuleIndex$ref(this));
    super.register(AsmTransformSyntaxAnalyser$grammarRuleName$ref(this));
    super.register(AsmTransformSyntaxAnalyser$possiblyQualifiedTypeName$ref(this));
    super.register(AsmTransformSyntaxAnalyser$expression$ref(this));
  }
}
class TransformModel {}
class TransformNamespace {}
class TransformRuleSetReference {}
class TransformRuleSet {}
class TransformationRule {}
function asString_4(indent, imports, $super) {
  indent = indent === VOID ? new Indent() : indent;
  imports = imports === VOID ? emptyList() : imports;
  return $super === VOID ? this.x2t(indent, imports) : $super.x2t.call(this, indent, imports);
}
class CreateObjectRule {}
class SelfStatement {}
class ModifyObjectRule {}
class Companion_28 {
  fromString(context, transformStr) {
    var tmp0_elvis_lhs = Agl_getInstance().registry.agl.transform.processor;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = 'Asm-Transform language not found!';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var proc = tmp;
    var tmp_0 = _TransformString___get_value__impl__kxu2ls(transformStr);
    var tmp_1 = Agl_getInstance();
    var res = proc.process(tmp_0, tmp_1.options(VOID, TransformDomainDefault$Companion$fromString$lambda(context)));
    var tmp_2;
    if (res.allIssues.errors.a1()) {
      tmp_2 = res;
    } else {
      var message_0 = toString(res.allIssues);
      throw IllegalStateException.v4(toString(message_0));
    }
    return tmp_2;
  }
  z3i(grammarModel, typeModel, configuration) {
    var atfg = new GrammarModel2TransformModel(typeModel, grammarModel, configuration);
    var trModel = atfg.wm();
    return new ProcessResultDefault(trModel, VOID, VOID, VOID, atfg.t2i_1);
  }
  fromGrammarModel(grammarModel, typeModel, configuration, $super) {
    typeModel = typeModel === VOID ? new TypeModelSimple(last(grammarModel.allDefinitions).name) : typeModel;
    configuration = configuration === VOID ? Companion_getInstance_3().defaultConfiguration : configuration;
    return $super === VOID ? this.z3i(grammarModel, typeModel, configuration) : $super.z3i.call(this, grammarModel, typeModel, configuration);
  }
}
class TransformDomainDefault extends ModelAbstract {
  constructor(name, options, namespace) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    namespace = namespace === VOID ? emptyList() : namespace;
    super(namespace, options);
    this.y2i_1 = name;
    this.z2i_1 = null;
  }
  f2h() {
    return this.y2i_1;
  }
  a3j(_set____db54di) {
    this.z2i_1 = _set____db54di;
  }
  m2e() {
    return this.z2i_1;
  }
  findOrCreateNamespace(qualifiedName, imports) {
    var existing = this.findNamespaceOrNull(qualifiedName);
    var tmp;
    if (existing == null) {
      var ns = new TransformNamespaceDefault(qualifiedName, VOID, imports);
      this.addNamespace(ns);
      tmp = ns;
    } else {
      tmp = (!(existing == null) ? isInterface(existing, TransformNamespace) : false) ? existing : THROW_CCE();
    }
    return tmp;
  }
  findTypeForGrammarRule(grammarQualifiedName, ruleName) {
    var ruleSet = this.findDefinitionByQualifiedNameOrNull(grammarQualifiedName);
    var tmp1_safe_receiver = ruleSet == null ? null : ruleSet.findAllTrRuleForGrammarRuleNamedOrNull(ruleName);
    return tmp1_safe_receiver == null ? null : tmp1_safe_receiver.resolvedType;
  }
  get typeModel() {
    return this.m2e();
  }
  set typeModel(value) {
    this.a3j(value);
  }
}
class sam$kotlin_Comparator$0_2 {
  constructor(function_0) {
    this.b3j_1 = function_0;
  }
  wh(a, b) {
    return this.b3j_1(a, b);
  }
  compare(a, b) {
    return this.wh(a, b);
  }
  w3() {
    return this.b3j_1;
  }
  equals(other) {
    var tmp;
    if (!(other == null) ? isInterface(other, Comparator) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.w3(), other.w3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.w3());
  }
}
class TransformNamespaceDefault extends NamespaceAbstract {
  constructor(qualifiedName, options, import_0) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    var tmp;
    if (import_0 === VOID) {
      // Inline function 'kotlin.collections.mutableListOf' call
      tmp = ArrayList.y();
    } else {
      tmp = import_0;
    }
    import_0 = tmp;
    super(options, import_0);
    this.e3j_1 = qualifiedName;
  }
  u2h() {
    return this.e3j_1;
  }
  createOwnedTransformRuleSet(name, extends_0, options) {
    return new TransformRuleSetDefault(this, name, extends_0, options, emptyList());
  }
  h2f(indent) {
    var sb = StringBuilder.j();
    sb.cb('namespace ' + QualifiedName__toString_impl_z3wem2(this.e3j_1) + '\n');
    var newIndent = indent.inc;
    // Inline function 'kotlin.collections.isNotEmpty' call
    if (!this.import.a1()) {
      // Inline function 'kotlin.collections.sortedBy' call
      var this_0 = this.import;
      // Inline function 'kotlin.comparisons.compareBy' call
      var tmp = TransformNamespaceDefault$asString$lambda;
      var tmp$ret$1 = new sam$kotlin_Comparator$0_2(tmp);
      var tmp_0 = sortedWith(this_0, tmp$ret$1);
      var importStr = joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TransformNamespaceDefault$asString$lambda_0(newIndent));
      sb.cb(importStr);
      sb.cb('\n');
    }
    // Inline function 'kotlin.collections.sortedBy' call
    var this_1 = this.definition;
    // Inline function 'kotlin.comparisons.compareBy' call
    var tmp_1 = TransformNamespaceDefault$asString$lambda_1;
    var tmp$ret$3 = new sam$kotlin_Comparator$0_2(tmp_1);
    var tmp_2 = sortedWith(this_1, tmp$ret$3);
    var defs = joinToString(tmp_2, '\n', VOID, VOID, VOID, VOID, TransformNamespaceDefault$asString$lambda_2(newIndent));
    sb.cb(defs);
    return sb.toString();
  }
}
class TransformRuleSetReferenceDefault {
  constructor(localNamespace, nameOrQName) {
    this.f3j_1 = localNamespace;
    this.g3j_1 = nameOrQName;
    this.h3j_1 = null;
  }
  f2t() {
    return this.f3j_1;
  }
  g2t() {
    return this.g3j_1;
  }
  i3j(_set____db54di) {
    this.h3j_1 = _set____db54di;
  }
  h2t(_set____db54di) {
    return this.resolved = (_set____db54di == null ? true : isInterface(_set____db54di, TransformRuleSet)) ? _set____db54di : THROW_CCE();
  }
  i2t() {
    return this.h3j_1;
  }
  resolveAs(resolved) {
    this.h3j_1 = resolved;
  }
  cloneTo(ns) {
    // Inline function 'kotlin.also' call
    var this_0 = new TransformRuleSetReferenceDefault(ns, this.g3j_1);
    var resolved = this.h3j_1;
    if (!(null == resolved)) {
      this_0.resolveAs(resolved);
    }
    return this_0;
  }
  bh() {
    return this.f3j_1;
  }
  ch() {
    return this.g3j_1;
  }
  j3j(localNamespace, nameOrQName) {
    return new TransformRuleSetReferenceDefault(localNamespace, nameOrQName);
  }
  copy(localNamespace, nameOrQName, $super) {
    localNamespace = localNamespace === VOID ? this.f3j_1 : localNamespace;
    nameOrQName = nameOrQName === VOID ? this.g3j_1 : nameOrQName;
    return $super === VOID ? this.j3j(localNamespace, nameOrQName) : $super.j3j.call(this, localNamespace, nameOrQName);
  }
  toString() {
    return 'TransformRuleSetReferenceDefault(localNamespace=' + toString(this.f3j_1) + ', nameOrQName=' + toString(this.g3j_1) + ')';
  }
  hashCode() {
    var result = hashCode(this.f3j_1);
    result = imul(result, 31) + hashCode(this.g3j_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof TransformRuleSetReferenceDefault))
      return false;
    var tmp0_other_with_cast = other instanceof TransformRuleSetReferenceDefault ? other : THROW_CCE();
    if (!equals(this.f3j_1, tmp0_other_with_cast.f3j_1))
      return false;
    if (!equals(this.g3j_1, tmp0_other_with_cast.g3j_1))
      return false;
    return true;
  }
  get localNamespace() {
    return this.f2t();
  }
  get nameOrQName() {
    return this.g2t();
  }
  get resolved() {
    return this.i2t();
  }
  set resolved(value) {
    this.i3j(value);
  }
}
class sam$kotlin_Comparator$0_3 {
  constructor(function_0) {
    this.k3j_1 = function_0;
  }
  wh(a, b) {
    return this.k3j_1(a, b);
  }
  compare(a, b) {
    return this.wh(a, b);
  }
  w3() {
    return this.k3j_1;
  }
  equals(other) {
    var tmp;
    if (!(other == null) ? isInterface(other, Comparator) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.w3(), other.w3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.w3());
  }
}
class TransformRuleSetDefault extends DefinitionAbstract {
  constructor(namespace, name, argExtends, options, _rules) {
    argExtends = argExtends === VOID ? emptyList() : argExtends;
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    super();
    this.l3j_1 = namespace;
    this.m3j_1 = name;
    this.n3j_1 = options;
    this.o3j_1 = toMutableList(argExtends);
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.p3j_1 = ArrayList.y();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.associateBy' call
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(_rules, 10)), 16);
    // Inline function 'kotlin.collections.associateByTo' call
    var destination = LinkedHashMap.kb(capacity);
    var _iterator__ex2g4s = _rules.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp$ret$1 = element.grammarRuleName;
      destination.r2(new GrammarRuleName(tmp$ret$1), element);
    }
    tmp_0.q3j_1 = toMutableMap(destination);
    this.l3j_1.addDefinition(this);
  }
  e2h() {
    return this.l3j_1;
  }
  f2h() {
    return this.m3j_1;
  }
  x1c() {
    return this.n3j_1;
  }
  w2x() {
    return this.o3j_1;
  }
  s3i() {
    return this.p3j_1;
  }
  u2x() {
    return this.q3j_1;
  }
  t3i() {
    // Inline function 'kotlin.collections.filterIsInstance' call
    var tmp0 = this.q3j_1.v2();
    // Inline function 'kotlin.collections.filterIsInstanceTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!(element == null) ? isInterface(element, CreateObjectRule) : false) {
        destination.r(element);
      }
    }
    return destination;
  }
  u3i() {
    // Inline function 'kotlin.collections.filterIsInstance' call
    var tmp0 = this.q3j_1.v2();
    // Inline function 'kotlin.collections.filterIsInstanceTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!(element == null) ? isInterface(element, ModifyObjectRule) : false) {
        destination.r(element);
      }
    }
    return destination;
  }
  addImportType(value) {
    if (!this.p3j_1.e1(new Import(value))) {
      var tmp = this.p3j_1;
      (isInterface(tmp, KtMutableList) ? tmp : THROW_CCE()).r(new Import(value));
    }
  }
  findOwnedTrRuleForGrammarRuleNamedOrNull(grmRuleName) {
    return this.q3j_1.z2(new GrammarRuleName(grmRuleName));
  }
  findAllTrRuleForGrammarRuleNamedOrNull(grmRuleName) {
    var tmp0_elvis_lhs = this.findOwnedTrRuleForGrammarRuleNamedOrNull(grmRuleName);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp0 = this.o3j_1;
      var tmp$ret$1;
      $l$block: {
        // Inline function 'kotlin.collections.firstNotNullOfOrNull' call
        var _iterator__ex2g4s = tmp0.s();
        while (_iterator__ex2g4s.t()) {
          var element = _iterator__ex2g4s.u();
          var tmp0_elvis_lhs_0 = element.resolved;
          var tmp_0;
          if (tmp0_elvis_lhs_0 == null) {
            var message = 'Should be resolved!';
            throw IllegalStateException.v4(toString(message));
          } else {
            tmp_0 = tmp0_elvis_lhs_0;
          }
          var res = tmp_0;
          var result = res.findAllTrRuleForGrammarRuleNamedOrNull(grmRuleName);
          if (!(result == null)) {
            tmp$ret$1 = result;
            break $l$block;
          }
        }
        tmp$ret$1 = null;
      }
      tmp = tmp$ret$1;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  cloneTo(ns) {
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.o3j_1;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item.cloneTo(ns);
      destination.r(tmp$ret$0);
    }
    var rrs = new TransformRuleSetDefault(ns, this.m3j_1, destination, this.n3j_1, toMutableList(this.q3j_1.v2()));
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = this.p3j_1.s();
    while (_iterator__ex2g4s_0.t()) {
      var element = _iterator__ex2g4s_0.u();
      var it = element.p2i_1;
      rrs.addImportType(it);
    }
    return rrs;
  }
  addExtends(other) {
    var tmp = this.o3j_1;
    (isInterface(tmp, KtMutableList) ? tmp : THROW_CCE()).r(other);
  }
  setRule(rule) {
    var tmp = this.q3j_1;
    var tmp0 = isInterface(tmp, KtMutableMap) ? tmp : THROW_CCE();
    // Inline function 'kotlin.collections.set' call
    var key = new GrammarRuleName(rule.grammarRuleName);
    tmp0.r2(key, rule);
  }
  h2f(indent) {
    var sb = StringBuilder.j();
    var tmp;
    if (this.o3j_1.a1()) {
      tmp = ' ';
    } else {
      // Inline function 'kotlin.collections.map' call
      var this_0 = this.o3j_1;
      // Inline function 'kotlin.collections.mapTo' call
      var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
      var _iterator__ex2g4s = this_0.s();
      while (_iterator__ex2g4s.t()) {
        var item = _iterator__ex2g4s.u();
        var tmp$ret$0 = equals(item.localNamespace, this.l3j_1) ? _SimpleName___get_value__impl__rl2r3c(item.nameOrQName.simpleName) : item.nameOrQName.value;
        destination.r(tmp$ret$0);
      }
      var refsStr = destination;
      tmp = ' : ' + joinToString(refsStr, ', ', VOID, VOID, VOID, VOID, TransformRuleSetDefault$asString$lambda);
    }
    var extStr = tmp;
    sb.cb('transform ' + SimpleName__toString_impl_vxsxyc(this.m3j_1) + extStr + '{\n');
    var newIndent = indent.inc;
    // Inline function 'kotlin.collections.isNotEmpty' call
    if (!this.p3j_1.a1()) {
      // Inline function 'kotlin.collections.sortedBy' call
      var this_1 = this.p3j_1;
      // Inline function 'kotlin.comparisons.compareBy' call
      var tmp_0 = TransformRuleSetDefault$asString$lambda_0;
      var tmp$ret$4 = new sam$kotlin_Comparator$0_3(tmp_0);
      var tmp_1 = sortedWith(this_1, tmp$ret$4);
      var importStr = joinToString(tmp_1, '\n', VOID, VOID, VOID, VOID, TransformRuleSetDefault$asString$lambda_1(newIndent));
      sb.cb(importStr);
      sb.cb('\n');
    }
    // Inline function 'kotlin.collections.sortedBy' call
    var this_2 = this.q3j_1.w2();
    // Inline function 'kotlin.comparisons.compareBy' call
    var tmp_2 = TransformRuleSetDefault$asString$lambda_2;
    var tmp$ret$6 = new sam$kotlin_Comparator$0_3(tmp_2);
    // Inline function 'kotlin.collections.map' call
    var this_3 = sortedWith(this_2, tmp$ret$6);
    // Inline function 'kotlin.collections.mapTo' call
    var destination_0 = ArrayList.w(collectionSizeOrDefault(this_3, 10));
    var _iterator__ex2g4s_0 = this_3.s();
    while (_iterator__ex2g4s_0.t()) {
      var item_0 = _iterator__ex2g4s_0.u();
      var tmp$ret$8 = item_0.b3().asString(newIndent, this.p3j_1);
      destination_0.r(tmp$ret$8);
    }
    var rulesStr = joinToString(destination_0, '\n');
    sb.cb(rulesStr);
    sb.cb('\n' + indent.toString() + '}');
    return sb.toString();
  }
  toString() {
    return 'transform ' + _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName) + ' {...}';
  }
  get extends() {
    return this.w2x();
  }
  get importTypes() {
    return this.s3i();
  }
  get rules() {
    return this.u2x();
  }
  get createObjectRules() {
    return this.t3i();
  }
  get modifyObjectRules() {
    return this.u3i();
  }
}
class TransformationRuleDefault {
  constructor(expression) {
    this.q2g_1 = expression;
    this.r2g_1 = _GrammarRuleName___init__impl__yqiut('<unset>');
    this.s2g_1 = null;
  }
  v1j() {
    return this.q2g_1;
  }
  v3i(_set____db54di) {
    this.r2g_1 = _set____db54di;
  }
  w3i() {
    return this.r2g_1;
  }
  x3i() {
    return !(null == this.s2g_1);
  }
  y3i() {
    var tmp0_elvis_lhs = this.s2g_1;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = "TransformationRule for '" + _GrammarRuleName___get_value__impl__470s0v(this.r2g_1) + "' has not been resolved";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  resolveTypeAs(type) {
    this.s2g_1 = type;
  }
  x2t(indent, imports) {
    return indent.toString() + GrammarRuleName__toString_impl_przz03(this.r2g_1) + ': ' + this.q2g_1.asString(indent, imports);
  }
  toString() {
    return _GrammarRuleName___get_value__impl__470s0v(this.r2g_1) + ': ' + toString(this.q2g_1);
  }
  get expression() {
    return this.v1j();
  }
  get grammarRuleName() {
    return this.w3i();
  }
  set grammarRuleName(value) {
    this.v3i(value);
  }
  get isResolved() {
    return this.x3i();
  }
  get resolvedType() {
    return this.y3i();
  }
}
class AsmTransformModelBuilder {
  constructor(name, typeModel, createTypes) {
    this.r3j_1 = name;
    this.s3j_1 = typeModel;
    this.t3j_1 = createTypes;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.u3j_1 = ArrayList.y();
  }
  namespace(qualifiedName, init) {
    var b = new AsmTransformNamespaceBuilder(_QualifiedName___init__impl__8ed982(qualifiedName), this.s3j_1, this.t3j_1);
    init(b);
    var v = b.build();
    this.u3j_1.r(v);
  }
  build() {
    // Inline function 'kotlin.also' call
    var this_0 = new TransformDomainDefault(this.r3j_1, VOID, this.u3j_1);
    this_0.z2i_1 = this.s3j_1;
    return this_0;
  }
}
class AsmTransformNamespaceBuilder {
  constructor(qualifiedName, typeModel, createTypes) {
    this.v3j_1 = qualifiedName;
    this.w3j_1 = typeModel;
    this.x3j_1 = createTypes;
    this.y3j_1 = new TransformNamespaceDefault(this.v3j_1);
  }
  imports(imports) {
    // Inline function 'kotlin.collections.forEach' call
    var inductionVariable = 0;
    var last = imports.length;
    while (inductionVariable < last) {
      var element = imports[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      this.y3j_1.addImport(_Import___init__impl__786z8c(element));
    }
  }
  transform(name, init) {
    var b = new AsmTransformRuleSetBuilder(this.y3j_1, _SimpleName___init__impl__6s45d0(name), this.w3j_1, this.x3j_1);
    init(b);
    b.build();
  }
  build() {
    return this.y3j_1;
  }
}
class AsmTransformRuleSetBuilder {
  constructor(namespace, name, typeModel, createTypes) {
    this.z3j_1 = namespace;
    this.a3k_1 = name;
    this.b3k_1 = typeModel;
    this.c3k_1 = createTypes;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.d3k_1 = ArrayList.y();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_0.e3k_1 = ArrayList.y();
    var tmp_1 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_1.f3k_1 = ArrayList.y();
    this.g3k_1 = QualifiedName__append_impl_hhmte4(this.z3j_1.e3j_1, this.a3k_1);
  }
  expression(expressionStr) {
    var res = ensureNotNull(Agl_getInstance().registry.agl.expressions.processor).process(expressionStr);
    // Inline function 'kotlin.check' call
    if (!res.allIssues.a1()) {
      var message = toString(res.allIssues);
      throw IllegalStateException.v4(toString(message));
    }
    return ensureNotNull(res.asm);
  }
  extends(list) {
    // Inline function 'kotlin.collections.forEach' call
    var inductionVariable = 0;
    var last = list.length;
    while (inductionVariable < last) {
      var element = list[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      this.e3k_1.r(new TransformRuleSetReferenceDefault(this.z3j_1, get_asPossiblyQualifiedName(element)));
    }
  }
  importTypes(imports) {
    // Inline function 'kotlin.collections.forEach' call
    var inductionVariable = 0;
    var last = imports.length;
    while (inductionVariable < last) {
      var element = imports[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      this.d3k_1.r(new Import(_Import___init__impl__786z8c(element)));
    }
  }
  leafStringRule(grammarRuleName) {
    var tr = new TransformationRuleDefault(Companion_getInstance_15().SELF);
    tr.r2g_1 = _GrammarRuleName___init__impl__yqiut(grammarRuleName);
    tr.resolveTypeAs(StdLibDefault_getInstance().String);
    this.f3k_1.r(tr);
  }
  transRule(grammarRuleName, typeName, expressionStr) {
    var expression = this.expression(expressionStr);
    var tmp0_elvis_lhs = this.b3k_1.findFirstDefinitionByNameOrNull(_SimpleName___init__impl__6s45d0(typeName));
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = "Type '" + typeName + "' not found in type-model '" + SimpleName__toString_impl_vxsxyc(this.b3k_1.name) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var typeDef = tmp;
    var tr = transformationRule(typeDef.type(), expression);
    tr.r2g_1 = _GrammarRuleName___init__impl__yqiut(grammarRuleName);
    tr.resolveTypeAs(StdLibDefault_getInstance().String);
    this.f3k_1.r(tr);
  }
  transToListOf(grammarRuleName, elementTypeName, expressionStr) {
    var expression = this.expression(expressionStr);
    var tmp0_elvis_lhs = this.b3k_1.findFirstDefinitionByNameOrNull(_SimpleName___init__impl__6s45d0(elementTypeName));
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = "Type '" + elementTypeName + "' not found in type-model '" + SimpleName__toString_impl_vxsxyc(this.b3k_1.name) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var elTypeDef = tmp;
    var listType = StdLibDefault_getInstance().List.type(listOf(elTypeDef.type().asTypeArgument));
    var tr = transformationRule(listType, expression);
    tr.r2g_1 = _GrammarRuleName___init__impl__yqiut(grammarRuleName);
    tr.resolveTypeAs(StdLibDefault_getInstance().String);
    this.f3k_1.r(tr);
  }
  child0StringRule(grammarRuleName) {
    return this.transRule(grammarRuleName, 'String', 'child[0]');
  }
  subtypeRule(grammarRuleName, typeName) {
    trRule(this, grammarRuleName, typeName, this.expression('child[0]'));
  }
  unionRule(grammarRuleName, typeName, expressionStr, init) {
    var ns = this.b3k_1.findOrCreateNamespace(this.g3k_1, listOf(new Import(_QualifiedName___get_asImport__impl__hufagg(StdLibDefault_getInstance().t2e_1))));
    // Inline function 'kotlin.collections.mutableListOf' call
    var tmp$ret$0 = ArrayList.y();
    var b = new SubtypeListBuilder(ns, tmp$ret$0);
    init(b);
    var subtypes = b.build();
    var expr = this.expression(expressionStr);
    var tr = new TransformationRuleDefault(expr);
    tr.r2g_1 = _GrammarRuleName___init__impl__yqiut(grammarRuleName);
    var tmp = _SimpleName___init__impl__6s45d0(typeName);
    var t = ns.findOwnedOrCreateUnionTypeNamed(tmp, AsmTransformRuleSetBuilder$unionRule$lambda(subtypes));
    tr.resolveTypeAs(t.type());
    this.f3k_1.r(tr);
  }
  h3k(grammarRuleName, typeName, modifyStatements) {
    var qtn = resolveType(this, _GrammarRuleName___init__impl__yqiut(grammarRuleName), typeName).qualifiedName;
    var expr = new CreateObjectExpressionDefault(new QualifiedName(qtn), emptyList());
    var ab = new AssignmentBuilder();
    modifyStatements(ab);
    var ass = ab.build();
    expr.v2g_1 = ass;
    trRule(this, grammarRuleName, typeName, expr);
  }
  createObject(grammarRuleName, typeName, modifyStatements, $super) {
    var tmp;
    if (modifyStatements === VOID) {
      tmp = AsmTransformRuleSetBuilder$createObject$lambda;
    } else {
      tmp = modifyStatements;
    }
    modifyStatements = tmp;
    var tmp_0;
    if ($super === VOID) {
      this.h3k(grammarRuleName, typeName, modifyStatements);
      tmp_0 = Unit_instance;
    } else {
      tmp_0 = $super.h3k.call(this, grammarRuleName, typeName, modifyStatements);
    }
    return tmp_0;
  }
  build() {
    var tmp0_namespace = this.z3j_1;
    var tmp1_name = this.a3k_1;
    var tmp2__rules = this.f3k_1;
    var tmp3_argExtends = this.e3k_1;
    var trs = new TransformRuleSetDefault(tmp0_namespace, tmp1_name, tmp3_argExtends, VOID, tmp2__rules);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.d3k_1.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var it = element.p2i_1;
      trs.addImportType(it);
    }
    return trs;
  }
}
class AssignmentBuilder {
  constructor() {
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.i3k_1 = ArrayList.y();
  }
  assignment(lhsPropertyName, lhsGrammarRuleIndex, expressionStr) {
    var res = ensureNotNull(Agl_getInstance().registry.agl.expressions.processor).process(expressionStr);
    // Inline function 'kotlin.check' call
    if (!res.allIssues.a1()) {
      var message = toString(res.allIssues);
      throw IllegalStateException.v4(toString(message));
    }
    var expr = ensureNotNull(res.asm);
    this.i3k_1.r(new Triple(lhsPropertyName, lhsGrammarRuleIndex, expr));
  }
  build() {
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.i3k_1;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = new AssignmentStatementDefault(item.vj_1, item.wj_1, item.xj_1);
      destination.r(tmp$ret$0);
    }
    return destination;
  }
}
class StdLibDefault_0 extends TypeNamespaceAbstract {
  constructor() {
    StdLibDefault_instance = null;
    super(new OptionHolderDefault(null, emptyMap()), emptyList());
    StdLibDefault_instance = this;
    this.t2e_1 = _QualifiedName___init__impl__8ed982('std');
    this.u2e_1 = _SimpleName___init__impl__6s45d0('LambdaType');
    this.v2e_1 = _SimpleName___init__impl__6s45d0('TupleType');
    this.w2e_1 = _SimpleName___init__impl__6s45d0('Collection');
    this.x2e_1 = _SimpleName___init__impl__6s45d0('List');
    this.y2e_1 = _SimpleName___init__impl__6s45d0('ListSeparated');
    this.z2e_1 = _SimpleName___init__impl__6s45d0('Set');
    this.a2f_1 = _SimpleName___init__impl__6s45d0('OrderedSet');
    this.b2f_1 = _SimpleName___init__impl__6s45d0('Map');
    this.AnyType = super.findOwnedOrCreateSpecialTypeNamed(_SimpleName___init__impl__6s45d0('Any')).type();
    this.NothingType = super.findOwnedOrCreateSpecialTypeNamed(_SimpleName___init__impl__6s45d0('Nothing')).type();
    this.String = super.findOwnedOrCreatePrimitiveTypeNamed(_SimpleName___init__impl__6s45d0('String')).type();
    this.Boolean = super.findOwnedOrCreatePrimitiveTypeNamed(_SimpleName___init__impl__6s45d0('Boolean')).type();
    this.Integer = super.findOwnedOrCreatePrimitiveTypeNamed(_SimpleName___init__impl__6s45d0('Integer')).type();
    this.Real = super.findOwnedOrCreatePrimitiveTypeNamed(_SimpleName___init__impl__6s45d0('Real')).type();
    this.Timestamp = super.findOwnedOrCreatePrimitiveTypeNamed(_SimpleName___init__impl__6s45d0('Timestamp')).type();
    this.Exception = super.findOwnedOrCreatePrimitiveTypeNamed(_SimpleName___init__impl__6s45d0('Exception')).type();
    var tmp = this;
    // Inline function 'kotlin.also' call
    var this_0 = super.findOwnedOrCreateDataTypeNamed(_SimpleName___init__impl__6s45d0('Pair'));
    var tmp_0 = this_0.typeParameters;
    (isInterface(tmp_0, KtMutableList) ? tmp_0 : THROW_CCE()).r(new TypeParameterSimple(_SimpleName___init__impl__6s45d0('F')));
    var tmp_1 = this_0.typeParameters;
    (isInterface(tmp_1, KtMutableList) ? tmp_1 : THROW_CCE()).r(new TypeParameterSimple(_SimpleName___init__impl__6s45d0('S')));
    (this_0 instanceof DataTypeSimple ? this_0 : THROW_CCE()).addConstructor(listOf_0([new ParameterDefinitionSimple(_ParameterName___init__impl__84hwrp('first'), StdLibDefault_getInstance().createTypeInstance(this_0.qualifiedName, new SimpleName(_SimpleName___init__impl__6s45d0('F'))), null), new ParameterDefinitionSimple(_ParameterName___init__impl__84hwrp('second'), StdLibDefault_getInstance().createTypeInstance(this_0.qualifiedName, new SimpleName(_SimpleName___init__impl__6s45d0('S'))), null)]));
    this_0.appendPropertyStored(_PropertyName___init__impl__sz2wu9('first'), new TypeParameterReference(this_0, _SimpleName___init__impl__6s45d0('F')), setOf_0([PropertyCharacteristic_READ_ONLY_getInstance(), PropertyCharacteristic_COMPOSITE_getInstance()]), 0);
    this_0.appendPropertyStored(_PropertyName___init__impl__sz2wu9('second'), new TypeParameterReference(this_0, _SimpleName___init__impl__6s45d0('S')), setOf_0([PropertyCharacteristic_READ_ONLY_getInstance(), PropertyCharacteristic_COMPOSITE_getInstance()]), 1);
    tmp.Pair = this_0;
    this.Lambda = super.findOwnedOrCreateSpecialTypeNamed(this.u2e_1).type();
    this.TupleType = new TupleTypeSimple(this, this.v2e_1);
    var tmp_2 = this;
    // Inline function 'kotlin.also' call
    var this_1 = super.findOwnedOrCreateCollectionTypeNamed(this.w2e_1);
    var tmp_3 = this_1.typeParameters;
    (isInterface(tmp_3, KtMutableList) ? tmp_3 : THROW_CCE()).r(new TypeParameterSimple(_SimpleName___init__impl__6s45d0('E')));
    this_1.appendPropertyPrimitive(_PropertyName___init__impl__sz2wu9('asMap'), StdLibDefault_getInstance().createTypeInstance(this_1.qualifiedName, new QualifiedName(_QualifiedName___init__impl__8ed982('std.Map')), listOf_0([StdLibDefault_getInstance().AnyType.asTypeArgument, StdLibDefault_getInstance().AnyType.asTypeArgument]), false), 'A Map object with elements being the Pairs of this List.');
    this_1.appendMethodPrimitive(_MethodName___init__impl__2ggy8b('map'), listOf(new ParameterDefinitionSimple(_ParameterName___init__impl__84hwrp('lambda'), StdLibDefault_getInstance().createTypeInstance(this_1.qualifiedName, new SimpleName(StdLibDefault_getInstance().u2e_1)), null)), StdLibDefault_getInstance().AnyType, 'A list created by mapping each element using the given lambda expression.');
    tmp_2.Collection = this_1;
    var tmp_4 = this;
    // Inline function 'kotlin.also' call
    var this_2 = super.findOwnedOrCreateCollectionTypeNamed(this.x2e_1);
    var tmp_5 = this_2.typeParameters;
    (isInterface(tmp_5, KtMutableList) ? tmp_5 : THROW_CCE()).r(new TypeParameterSimple(_SimpleName___init__impl__6s45d0('E')));
    this_2.addSupertype(StdLibDefault_getInstance().Collection.type(listOf(new TypeArgumentSimple(new TypeParameterReference(this_2, _SimpleName___init__impl__6s45d0('E'))))));
    tmp_4.List = this_2;
    var tmp_6 = this;
    // Inline function 'kotlin.also' call
    var this_3 = super.findOwnedOrCreateCollectionTypeNamed(this.y2e_1);
    this_3.addSupertype(StdLibDefault_getInstance().List.type(listOf(StdLibDefault_getInstance().AnyType.asTypeArgument)));
    var tmp_7 = this_3.typeParameters;
    (isInterface(tmp_7, KtMutableList) ? tmp_7 : THROW_CCE()).x(listOf_0([new TypeParameterSimple(_SimpleName___init__impl__6s45d0('I')), new TypeParameterSimple(_SimpleName___init__impl__6s45d0('S'))]));
    tmp_6.ListSeparated = this_3;
    var tmp_8 = this;
    // Inline function 'kotlin.also' call
    var this_4 = super.findOwnedOrCreateCollectionTypeNamed(this.z2e_1);
    var tmp_9 = this_4.typeParameters;
    (isInterface(tmp_9, KtMutableList) ? tmp_9 : THROW_CCE()).r(new TypeParameterSimple(_SimpleName___init__impl__6s45d0('E')));
    this_4.addSupertype(StdLibDefault_getInstance().Collection.type(listOf(new TypeArgumentSimple(new TypeParameterReference(this_4, _SimpleName___init__impl__6s45d0('E'))))));
    tmp_8.Set = this_4;
    var tmp_10 = this;
    // Inline function 'kotlin.also' call
    var this_5 = super.findOwnedOrCreateCollectionTypeNamed(this.a2f_1);
    var tmp_11 = this_5.typeParameters;
    (isInterface(tmp_11, KtMutableList) ? tmp_11 : THROW_CCE()).r(new TypeParameterSimple(_SimpleName___init__impl__6s45d0('E')));
    this_5.addSupertype(StdLibDefault_getInstance().Collection.type(listOf(new TypeArgumentSimple(new TypeParameterReference(this_5, _SimpleName___init__impl__6s45d0('E'))))));
    tmp_10.OrderedSet = this_5;
    var tmp_12 = this;
    // Inline function 'kotlin.also' call
    var this_6 = super.findOwnedOrCreateCollectionTypeNamed(this.b2f_1);
    var tmp_13 = this_6.typeParameters;
    (isInterface(tmp_13, KtMutableList) ? tmp_13 : THROW_CCE()).x(listOf_0([new TypeParameterSimple(_SimpleName___init__impl__6s45d0('K')), new TypeParameterSimple(_SimpleName___init__impl__6s45d0('V'))]));
    this_6.addSupertype(StdLibDefault_getInstance().Collection.type(listOf(StdLibDefault_getInstance().Pair.type(listOf_0([(new TypeParameterReference(this_6, _SimpleName___init__impl__6s45d0('K'))).asTypeArgument, (new TypeParameterReference(this_6, _SimpleName___init__impl__6s45d0('V'))).asTypeArgument])).asTypeArgument)));
    tmp_12.Map = this_6;
    createProperties(this);
    createMethods(this);
  }
  u2h() {
    return this.t2e_1;
  }
  j3k() {
    return this.AnyType;
  }
  k3k() {
    return this.NothingType;
  }
  l3k() {
    return this.String;
  }
  m3k() {
    return this.Boolean;
  }
  n3k() {
    return this.Integer;
  }
  o3k() {
    return this.Real;
  }
  p3k() {
    return this.Timestamp;
  }
  q3k() {
    return this.Exception;
  }
  r3k() {
    return this.Pair;
  }
  s3k() {
    return this.Lambda;
  }
  t3k() {
    return this.TupleType;
  }
  u3k() {
    return this.Collection;
  }
  v3k() {
    return this.List;
  }
  w3k() {
    return this.ListSeparated;
  }
  x3k() {
    return this.Set;
  }
  y3k() {
    return this.OrderedSet;
  }
  z3k() {
    return this.Map;
  }
  findInOrCloneTo(other) {
    return this;
  }
}
class Companion_29 {
  fromString(name, context, typesString) {
    var tmp;
    if (isBlank(_TypesString___get_value__impl__8slfz1(typesString))) {
      var tmp_0 = _SimpleName___get_value__impl__rl2r3c(name);
      tmp = new ProcessResultDefault(typeModel(tmp_0, true, VOID, TypeModelSimple$Companion$fromString$lambda));
    } else {
      var tmp0_elvis_lhs = Agl_getInstance().registry.agl.types.processor;
      var tmp_1;
      if (tmp0_elvis_lhs == null) {
        var message = 'Types language not found!';
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp_1 = tmp0_elvis_lhs;
      }
      var proc = tmp_1;
      var tmp_2 = _TypesString___get_value__impl__8slfz1(typesString);
      var tmp_3 = Agl_getInstance();
      tmp = proc.process(tmp_2, tmp_3.options(VOID, TypeModelSimple$Companion$fromString$lambda_0(context)));
    }
    return tmp;
  }
}
class TypeModel {}
class TypeModelSimpleAbstract {
  constructor() {
    var tmp = this;
    tmp.e3l_1 = cached(TypeModelSimpleAbstract$_namespace$lambda(this));
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_0.f3l_1 = ArrayList.y();
  }
  j3k() {
    return StdLibDefault_getInstance().AnyType.resolvedDeclaration;
  }
  k3k() {
    return StdLibDefault_getInstance().NothingType.resolvedDeclaration;
  }
  e2h() {
    return this.f3l_1;
  }
  resolveImports() {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.namespace.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      element.resolveImports(isInterface(this, Model) ? this : THROW_CCE());
    }
  }
  addNamespace(value) {
    if (this.e3l_1.value.x2(new QualifiedName(value.qualifiedName))) {
      if (this.e3l_1.value.z2(new QualifiedName(value.qualifiedName)) !== value) {
        // Inline function 'kotlin.error' call
        var message = "TypeModel '" + SimpleName__toString_impl_vxsxyc(this.name) + "' already contains a namespace '" + QualifiedName__toString_impl_z3wem2(value.qualifiedName) + "'";
        throw IllegalStateException.v4(toString(message));
      }
    } else {
      var tmp = this.namespace;
      var tmp_0 = isInterface(tmp, KtMutableList) ? tmp : THROW_CCE();
      tmp_0.r(isInterface(value, TypeNamespace) ? value : THROW_CCE());
      this.e3l_1.reset();
    }
  }
  findOrCreateNamespace(qualifiedName, imports) {
    var tmp;
    if (this.e3l_1.value.x2(new QualifiedName(qualifiedName))) {
      tmp = ensureNotNull(this.e3l_1.value.z2(new QualifiedName(qualifiedName)));
    } else {
      var ns = new TypeNamespaceSimple(qualifiedName, VOID, imports);
      this.addNamespace(ns);
      tmp = ns;
    }
    return tmp;
  }
  findFirstDefinitionByPossiblyQualifiedNameOrNull(typeName) {
    var tmp;
    if (typeName instanceof QualifiedName) {
      var tmp1_safe_receiver = this.findNamespaceOrNull(_QualifiedName___get_front__impl__24j8eq(typeName.f27_1));
      tmp = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.findOwnedTypeNamed(_QualifiedName___get_last__impl__838y8h(typeName.f27_1));
    } else {
      if (typeName instanceof SimpleName) {
        tmp = this.findFirstDefinitionByNameOrNull(typeName.a1u_1);
      } else {
        noWhenBranchMatchedException();
      }
    }
    return tmp;
  }
  findFirstDefinitionByNameOrNull(typeName) {
    var _iterator__ex2g4s = this.namespace.s();
    while (_iterator__ex2g4s.t()) {
      var ns = _iterator__ex2g4s.u();
      var t = ns.findOwnedTypeNamed(typeName);
      if (!(null == t)) {
        return t;
      }
    }
    return null;
  }
  findByQualifiedNameOrNull(qualifiedName) {
    var nsn = _QualifiedName___get_front__impl__24j8eq(qualifiedName);
    var tn = _QualifiedName___get_last__impl__838y8h(qualifiedName);
    var tmp0_safe_receiver = this.e3l_1.value.z2(new QualifiedName(nsn));
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.findOwnedTypeNamed(tn);
  }
  addAllNamespaceAndResolveImports(namespaces) {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = namespaces.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      this.addNamespace(element);
    }
    this.resolveImports();
  }
  k2s() {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this.namespace;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.definition;
      addAll(destination, list);
    }
    return destination;
  }
  mk() {
    return this.namespace.a1();
  }
  findNamespaceOrNull(qualifiedName) {
    return this.e3l_1.value.z2(new QualifiedName(qualifiedName));
  }
  findDefinitionByQualifiedNameOrNull(qualifiedName) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  resolveReference(reference) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  h2f(indent) {
    // Inline function 'kotlin.collections.filterNot' call
    var tmp0 = this.namespace;
    // Inline function 'kotlin.collections.filterNotTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!equals(element, StdLibDefault_getInstance())) {
        destination.r(element);
      }
    }
    // Inline function 'kotlin.collections.sortedBy' call
    // Inline function 'kotlin.comparisons.compareBy' call
    var tmp = TypeModelSimpleAbstract$asString$lambda;
    var tmp$ret$3 = new sam$kotlin_Comparator$0_4(tmp);
    var tmp_0 = sortedWith(destination, tmp$ret$3);
    var ns = joinToString(tmp_0, '\n', VOID, VOID, VOID, VOID, TypeModelSimpleAbstract$asString$lambda_0);
    return ns;
  }
  hashCode() {
    return SimpleName__hashCode_impl_a6n15h(this.name);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, TypeModel) : false)) {
      tmp = false;
    } else {
      if (!(this.name === other.name)) {
        tmp = false;
      } else {
        if (!equals(this.namespace, other.namespace)) {
          tmp = false;
        } else {
          tmp = true;
        }
      }
    }
    return tmp;
  }
  get AnyType() {
    return this.j3k();
  }
  get NothingType() {
    return this.k3k();
  }
  get namespace() {
    return this.e2h();
  }
  get allDefinitions() {
    return this.k2s();
  }
  get isEmpty() {
    return this.mk();
  }
  get name() {
    return this.f2h();
  }
  get options() {
    return this.x1c();
  }
}
class TypeModelSimple extends TypeModelSimpleAbstract {
  constructor(name, options) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    super();
    this.c3l_1 = name;
    this.d3l_1 = options;
  }
  f2h() {
    return this.c3l_1;
  }
  x1c() {
    return this.d3l_1;
  }
}
class sam$kotlin_Comparator$0_4 {
  constructor(function_0) {
    this.g3l_1 = function_0;
  }
  wh(a, b) {
    return this.g3l_1(a, b);
  }
  compare(a, b) {
    return this.wh(a, b);
  }
  w3() {
    return this.g3l_1;
  }
  equals(other) {
    var tmp;
    if (!(other == null) ? isInterface(other, Comparator) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.w3(), other.w3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.w3());
  }
}
class TypeInstance {}
class TypeInstanceAbstract {
  h3l() {
    var typeArgMap = this.createTypeArgMap();
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.resolvedDeclaration.supertypes;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var resIt = item.resolved(typeArgMap);
      var tmp$ret$0 = resIt.allResolvedProperty;
      destination.r(tmp$ret$0);
    }
    // Inline function 'kotlin.collections.mapOf' call
    // Inline function 'kotlin.collections.fold' call
    var accumulator = emptyMap();
    var _iterator__ex2g4s_0 = destination.s();
    while (_iterator__ex2g4s_0.t()) {
      var element = _iterator__ex2g4s_0.u();
      var acc = accumulator;
      accumulator = plus_3(acc, element);
    }
    var superProps = accumulator;
    // Inline function 'kotlin.collections.associate' call
    var this_1 = this.resolvedDeclaration.property;
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_1, 10)), 16);
    // Inline function 'kotlin.collections.associateTo' call
    var destination_0 = LinkedHashMap.kb(capacity);
    var _iterator__ex2g4s_1 = this_1.s();
    while (_iterator__ex2g4s_1.t()) {
      var element_0 = _iterator__ex2g4s_1.u();
      var rp = element_0.resolved(typeArgMap);
      // Inline function 'kotlin.collections.plusAssign' call
      var pair = new Pair(new PropertyName(element_0.name), rp);
      destination_0.r2(pair.zg_1, pair.ah_1);
    }
    var ownResolveProps = destination_0;
    return plus_3(superProps, ownResolveProps);
  }
  i3l() {
    var typeArgMap = this.createTypeArgMap();
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.resolvedDeclaration.supertypes;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var resIt = item.resolved(typeArgMap);
      var tmp$ret$0 = resIt.allResolvedMethod;
      destination.r(tmp$ret$0);
    }
    // Inline function 'kotlin.collections.mapOf' call
    // Inline function 'kotlin.collections.fold' call
    var accumulator = emptyMap();
    var _iterator__ex2g4s_0 = destination.s();
    while (_iterator__ex2g4s_0.t()) {
      var element = _iterator__ex2g4s_0.u();
      var acc = accumulator;
      accumulator = plus_3(acc, element);
    }
    var superProps = accumulator;
    // Inline function 'kotlin.collections.associate' call
    var this_1 = this.resolvedDeclaration.method;
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_1, 10)), 16);
    // Inline function 'kotlin.collections.associateTo' call
    var destination_0 = LinkedHashMap.kb(capacity);
    var _iterator__ex2g4s_1 = this_1.s();
    while (_iterator__ex2g4s_1.t()) {
      var element_0 = _iterator__ex2g4s_1.u();
      var rp = element_0.resolved(typeArgMap);
      // Inline function 'kotlin.collections.plusAssign' call
      var pair = new Pair(new MethodName(element_0.name), rp);
      destination_0.r2(pair.zg_1, pair.ah_1);
    }
    var ownResolveProps = destination_0;
    return plus_3(superProps, ownResolveProps);
  }
  j3l() {
    return new TypeArgumentSimple(this);
  }
  notNullable() {
    return this.resolvedDeclaration.type(this.typeArguments, false);
  }
  nullable() {
    return this.resolvedDeclaration.type(this.typeArguments, true);
  }
  signature(context, currentDepth) {
    var tmp;
    if (currentDepth >= 10) {
      tmp = '...';
    } else {
      var tmp_0;
      if (this.typeArguments.a1()) {
        tmp_0 = '';
      } else {
        var tmp_1 = this.typeArguments;
        tmp_0 = '<' + joinToString(tmp_1, VOID, VOID, VOID, VOID, VOID, TypeInstanceAbstract$signature$lambda(context, currentDepth)) + '>';
      }
      var args = tmp_0;
      var n = this.isNullable === true ? '?' : '';
      var tmp_2;
      if (this.typeArguments.a1()) {
        var tmp1_safe_receiver = this.resolvedDeclarationOrNull;
        var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.signature(context, currentDepth + 1 | 0);
        tmp_2 = tmp2_elvis_lhs == null ? _SimpleName___get_value__impl__rl2r3c(this.typeName) : tmp2_elvis_lhs;
      } else {
        tmp_2 = _SimpleName___get_value__impl__rl2r3c(this.resolvedDeclaration.name);
      }
      var name = tmp_2;
      return name + args + n;
    }
    return tmp;
  }
  conformsTo(other) {
    var tmp;
    if (other === this) {
      tmp = true;
    } else if (this.equals(StdLibDefault_getInstance().NothingType)) {
      tmp = other.isNullable;
    } else if (equals(other, StdLibDefault_getInstance().NothingType)) {
      tmp = false;
    } else if (equals(other, StdLibDefault_getInstance().AnyType)) {
      tmp = true;
    } else if (!this.resolvedDeclaration.conformsTo(other.resolvedDeclaration)) {
      tmp = false;
    } else if (!(this.typeArguments.v() === other.typeArguments.v())) {
      tmp = false;
    } else {
      var result = true;
      var inductionVariable = 0;
      var last = this.typeArguments.v() - 1 | 0;
      if (inductionVariable <= last)
        $l$loop_0: do {
          var i = inductionVariable;
          inductionVariable = inductionVariable + 1 | 0;
          if (this.typeArguments.z(i).conformsTo(other.typeArguments.z(i))) {
            continue $l$loop_0;
          } else {
            result = false;
            break $l$loop_0;
          }
        }
         while (inductionVariable <= last);
      tmp = result;
    }
    return tmp;
  }
  commonSuperType(other) {
    return other.conformsTo(this) ? this : this.conformsTo(other) ? other : StdLibDefault_getInstance().AnyType;
  }
  toString() {
    var tmp;
    if (this.typeArguments.a1()) {
      tmp = '';
    } else {
      var tmp_0 = this.typeArguments;
      tmp = '<' + joinToString(tmp_0, VOID, VOID, VOID, VOID, VOID, TypeInstanceAbstract$toString$lambda) + '>';
    }
    var args = tmp;
    var n = this.isNullable === true ? '?' : '';
    return SimpleName__toString_impl_vxsxyc(this.typeName) + args + n;
  }
  createTypeArgMap() {
    // Inline function 'kotlin.collections.mutableMapOf' call
    var typeArgMap = LinkedHashMap.l4();
    var tmp0_safe_receiver = this.resolvedDeclarationOrNull;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.typeParameters;
    if (tmp1_safe_receiver == null)
      null;
    else {
      // Inline function 'kotlin.collections.forEachIndexed' call
      var index = 0;
      var _iterator__ex2g4s = tmp1_safe_receiver.s();
      while (_iterator__ex2g4s.t()) {
        var item = _iterator__ex2g4s.u();
        var _unary__edvuaz = index;
        index = _unary__edvuaz + 1 | 0;
        var index_0 = checkIndexOverflow(_unary__edvuaz);
        var tp = item;
        var tmp0_elvis_lhs = getOrNull(this.typeArguments, index_0);
        var ta = tmp0_elvis_lhs == null ? StdLibDefault_getInstance().AnyType.asTypeArgument : tmp0_elvis_lhs;
        var tmp;
        if (isInterface(ta, TypeArgument)) {
          tmp = ta.type;
        } else {
          var message = 'Unsupported';
          throw IllegalStateException.v4(toString(message));
        }
        // Inline function 'kotlin.collections.set' call
        var value = tmp;
        typeArgMap.r2(tp, value);
      }
    }
    return typeArgMap;
  }
  get allResolvedProperty() {
    return this.h3l();
  }
  get allResolvedMethod() {
    return this.i3l();
  }
  get asTypeArgument() {
    return this.j3l();
  }
  get namespace() {
    return this.e2h();
  }
  get typeArguments() {
    return this.p2u();
  }
  get isNullable() {
    return this.q2u();
  }
  get typeName() {
    return this.a2p();
  }
  get qualifiedTypeName() {
    return this.z2o();
  }
  get resolvedDeclaration() {
    return this.k3l();
  }
  get resolvedDeclarationOrNull() {
    return this.l3l();
  }
}
class TypeParameterReference extends TypeInstanceAbstract {
  constructor(context, typeParameterName, isNullable) {
    isNullable = isNullable === VOID ? false : isNullable;
    super();
    this.context = context;
    this.typeParameterName = typeParameterName;
    this.m3l_1 = isNullable;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.n3l_1 = ArrayList.y();
    this.o3l_1 = null;
  }
  cs() {
    return this.context;
  }
  p3l() {
    return this.typeParameterName;
  }
  q2u() {
    return this.m3l_1;
  }
  e2h() {
    return this.context.namespace;
  }
  z2o() {
    return QualifiedName__append_impl_hhmte4(this.context.qualifiedName, this.typeParameterName);
  }
  a2p() {
    return this.typeParameterName;
  }
  p2u() {
    return this.n3l_1;
  }
  l3l() {
    return this.o3l_1;
  }
  k3l() {
    var message = 'TypeParameterReference does not have a declaration';
    throw IllegalStateException.v4(toString(message));
  }
  conformsTo(other) {
    // Inline function 'kotlin.TODO' call
    var reason = 'not implemented';
    throw NotImplementedError.uj('An operation is not implemented: ' + reason);
  }
  signature(context, currentDepth) {
    return _SimpleName___get_value__impl__rl2r3c(this.typeParameterName);
  }
  resolved(resolvingTypeArguments) {
    var tmp0 = this.context.typeParameters;
    var tmp$ret$1;
    $l$block: {
      // Inline function 'kotlin.collections.firstOrNull' call
      var _iterator__ex2g4s = tmp0.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        if (element.name === this.typeParameterName) {
          tmp$ret$1 = element;
          break $l$block;
        }
      }
      tmp$ret$1 = null;
    }
    var tmp0_safe_receiver = tmp$ret$1;
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp = resolvingTypeArguments.z2(tmp0_safe_receiver);
    }
    var tmp1_elvis_lhs = tmp;
    var tmp_0;
    if (tmp1_elvis_lhs == null) {
      var message = "Cannot resolve TypeArgument named '" + SimpleName__toString_impl_vxsxyc(this.typeParameterName) + "' in context of '" + QualifiedName__toString_impl_z3wem2(this.context.qualifiedName) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    return tmp_0;
  }
  possiblyQualifiedNameInContext(context) {
    return new SimpleName(this.typeParameterName);
  }
  findInOrCloneTo(other) {
    return new TypeParameterReference(this.context.findInOrCloneTo(other), this.typeParameterName, this.m3l_1);
  }
  hashCode() {
    return hashCode(listOf_0([this.context, new SimpleName(this.typeParameterName)]));
  }
  equals(other) {
    var tmp;
    if (!(other instanceof TypeParameterReference)) {
      tmp = false;
    } else {
      if (!equals(this.context, other.context)) {
        tmp = false;
      } else {
        if (!(this.typeParameterName === other.typeParameterName)) {
          tmp = false;
        } else {
          tmp = true;
        }
      }
    }
    return tmp;
  }
  toString() {
    return _SimpleName___get_value__impl__rl2r3c(this.typeParameterName);
  }
}
class TypeArgument {}
class TypeArgumentSimple {
  constructor(type) {
    this.q3l_1 = type;
  }
  q2w() {
    return this.q3l_1;
  }
  conformsTo(other) {
    return this.q3l_1.conformsTo(other.type);
  }
  resolved(resolvingTypeArguments) {
    return this.q3l_1.resolved(resolvingTypeArguments);
  }
  signature(context, currentDepth) {
    return this.q3l_1.signature(context, currentDepth);
  }
  findInOrCloneTo(other) {
    var clonedType = this.q3l_1.findInOrCloneTo(other);
    return new TypeArgumentSimple(clonedType);
  }
  toString() {
    return this.signature(null, 0);
  }
  bh() {
    return this.q3l_1;
  }
  r3l(type) {
    return new TypeArgumentSimple(type);
  }
  copy(type, $super) {
    type = type === VOID ? this.q3l_1 : type;
    return $super === VOID ? this.r3l(type) : $super.r3l.call(this, type);
  }
  hashCode() {
    return hashCode(this.q3l_1);
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof TypeArgumentSimple))
      return false;
    var tmp0_other_with_cast = other instanceof TypeArgumentSimple ? other : THROW_CCE();
    if (!equals(this.q3l_1, tmp0_other_with_cast.q3l_1))
      return false;
    return true;
  }
  get type() {
    return this.q2w();
  }
}
class Companion_30 {
  combineTypeArgMap(first, second) {
    var result = toMutableMap(second);
    // Inline function 'kotlin.collections.forEach' call
    // Inline function 'kotlin.collections.iterator' call
    var _iterator__ex2g4s = first.w2().s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      // Inline function 'kotlin.collections.component1' call
      var k = element.a3();
      // Inline function 'kotlin.collections.component2' call
      var v = element.b3();
      if (!result.x2(k)) {
        if (v instanceof TypeParameterReference) {
          var tmp$ret$3;
          $l$block_0: {
            // Inline function 'kotlin.collections.any' call
            if (result.a1()) {
              tmp$ret$3 = false;
              break $l$block_0;
            }
            // Inline function 'kotlin.collections.iterator' call
            var _iterator__ex2g4s_0 = result.w2().s();
            while (_iterator__ex2g4s_0.t()) {
              var element_0 = _iterator__ex2g4s_0.u();
              if (element_0.a3().name === v.typeParameterName) {
                tmp$ret$3 = true;
                break $l$block_0;
              }
            }
            tmp$ret$3 = false;
          }
          if (tmp$ret$3) {
            // Inline function 'kotlin.collections.set' call
            var value = ensureNotNull(result.z2(new TypeParameterSimple(v.typeParameterName)));
            result.r2(k, value);
          }
        } else {
          // Inline function 'kotlin.collections.set' call
          result.r2(k, v);
        }
      }
    }
    return result;
  }
}
class TypeInstanceSimple extends TypeInstanceAbstract {
  constructor(contextQualifiedTypeName, namespace, qualifiedOrImportedTypeName, typeArguments, isNullable) {
    super();
    this.contextQualifiedTypeName = contextQualifiedTypeName;
    this.s3l_1 = namespace;
    this.qualifiedOrImportedTypeName = qualifiedOrImportedTypeName;
    this.t3l_1 = typeArguments;
    this.u3l_1 = isNullable;
  }
  v3l() {
    return this.contextQualifiedTypeName;
  }
  e2h() {
    return this.s3l_1;
  }
  w3l() {
    return this.qualifiedOrImportedTypeName;
  }
  p2u() {
    return this.t3l_1;
  }
  q2u() {
    return this.u3l_1;
  }
  cs() {
    var tmp0_safe_receiver = this.contextQualifiedTypeName;
    var tmp;
    var tmp_0 = tmp0_safe_receiver;
    if ((tmp_0 == null ? null : new QualifiedName(tmp_0)) == null) {
      tmp = null;
    } else {
      var tmp_1 = tmp0_safe_receiver;
      // Inline function 'kotlin.let' call
      var it = (tmp_1 == null ? null : new QualifiedName(tmp_1)).f27_1;
      tmp = this.s3l_1.findTypeNamed(new QualifiedName(it));
    }
    return tmp;
  }
  a2p() {
    var tmp0_safe_receiver = this.resolvedDeclarationOrNull;
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.name;
    var tmp;
    var tmp_0 = tmp1_elvis_lhs;
    if ((tmp_0 == null ? null : new SimpleName(tmp_0)) == null) {
      tmp = this.qualifiedOrImportedTypeName.simpleName;
    } else {
      tmp = tmp1_elvis_lhs;
    }
    return tmp;
  }
  z2o() {
    var tmp0_safe_receiver = this.resolvedDeclarationOrNull;
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.qualifiedName;
    var tmp;
    var tmp_0 = tmp1_elvis_lhs;
    if ((tmp_0 == null ? null : new QualifiedName(tmp_0)) == null) {
      var tmp2_subject = this.qualifiedOrImportedTypeName;
      var tmp_1;
      if (tmp2_subject instanceof QualifiedName) {
        tmp_1 = this.qualifiedOrImportedTypeName.f27_1;
      } else {
        if (tmp2_subject instanceof SimpleName) {
          var tmp3_safe_receiver = this.context;
          var tmp4_safe_receiver = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.namespace;
          var tmp5_safe_receiver = tmp4_safe_receiver == null ? null : tmp4_safe_receiver.qualifiedName;
          var tmp_2;
          var tmp_3 = tmp5_safe_receiver;
          if ((tmp_3 == null ? null : new QualifiedName(tmp_3)) == null) {
            tmp_2 = null;
          } else {
            tmp_2 = QualifiedName__append_impl_hhmte4(tmp5_safe_receiver, this.qualifiedOrImportedTypeName.a1u_1);
          }
          var tmp6_elvis_lhs = tmp_2;
          var tmp_4;
          var tmp_5 = tmp6_elvis_lhs;
          if ((tmp_5 == null ? null : new QualifiedName(tmp_5)) == null) {
            var tmp7_safe_receiver = this.s3l_1.findTypeNamed(this.qualifiedOrImportedTypeName);
            tmp_4 = tmp7_safe_receiver == null ? null : tmp7_safe_receiver.qualifiedName;
          } else {
            tmp_4 = tmp6_elvis_lhs;
          }
          tmp_1 = tmp_4;
        } else {
          noWhenBranchMatchedException();
        }
      }
      tmp = tmp_1;
    } else {
      tmp = tmp1_elvis_lhs;
    }
    var tmp8_elvis_lhs = tmp;
    var tmp_6;
    var tmp_7 = tmp8_elvis_lhs;
    if ((tmp_7 == null ? null : new QualifiedName(tmp_7)) == null) {
      var tmp_8 = toString(this.qualifiedOrImportedTypeName);
      var tmp_9 = this.contextQualifiedTypeName;
      var message = "Cannot construct a Qualified name for '" + tmp_8 + "' in context of '" + toString_0(tmp_9 == null ? null : new QualifiedName(tmp_9)) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_6 = tmp8_elvis_lhs;
    }
    return tmp_6;
  }
  l3l() {
    return this.s3l_1.findTypeNamed(this.qualifiedOrImportedTypeName);
  }
  k3l() {
    var tmp0_elvis_lhs = this.resolvedDeclarationOrNull;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = "Cannot resolve TypeDefinition '" + toString(this.qualifiedOrImportedTypeName) + "', not found in namespace '" + QualifiedName__toString_impl_z3wem2(this.s3l_1.qualifiedName) + "'. Is an import needed?";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  resolved(resolvingTypeArguments) {
    var tmp;
    var thisTypeArgMap = Companion_instance_31.combineTypeArgMap(this.createTypeArgMap(), resolvingTypeArguments);
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.t3l_1;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var ti = item.resolved(thisTypeArgMap);
      var tmp$ret$0 = new TypeArgumentSimple(ti);
      destination.r(tmp$ret$0);
    }
    var resolvedTypeArgs = destination;
    tmp = new TypeInstanceSimple(this.contextQualifiedTypeName, this.s3l_1, this.qualifiedOrImportedTypeName, resolvedTypeArgs, this.u3l_1);
    return tmp;
  }
  possiblyQualifiedNameInContext(context) {
    return equals(this.resolvedDeclaration.namespace, context) ? new SimpleName(this.typeName) : new QualifiedName(this.qualifiedTypeName);
  }
  findInOrCloneTo(other) {
    var tmp = this.s3l_1.findInOrCloneTo(other);
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.t3l_1;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item.findInOrCloneTo(other);
      destination.r(tmp$ret$0);
    }
    return new TypeInstanceSimple(this.contextQualifiedTypeName, tmp, this.qualifiedOrImportedTypeName, destination, this.u3l_1);
  }
  hashCode() {
    return hashCode(listOf_0([this.qualifiedOrImportedTypeName, this.t3l_1, this.u3l_1]));
  }
  equals(other) {
    var tmp;
    if (!(other instanceof TypeInstanceSimple)) {
      tmp = false;
    } else {
      if (!(this.u3l_1 === other.u3l_1)) {
        tmp = false;
      } else {
        if (!equals(this.t3l_1, other.t3l_1)) {
          tmp = false;
        } else {
          var tmp_0;
          var tmp_1;
          var tmp_2 = this.contextQualifiedTypeName;
          if (null == (tmp_2 == null ? null : new QualifiedName(tmp_2))) {
            tmp_1 = true;
          } else {
            var tmp_3 = other.contextQualifiedTypeName;
            tmp_1 = null == (tmp_3 == null ? null : new QualifiedName(tmp_3));
          }
          if (tmp_1) {
            tmp_0 = equals(this.qualifiedOrImportedTypeName, other.qualifiedOrImportedTypeName);
          } else {
            var tmp_4;
            var tmp_5 = this.contextQualifiedTypeName;
            var tmp_6 = tmp_5 == null ? null : new QualifiedName(tmp_5);
            var tmp_7 = other.contextQualifiedTypeName;
            if (equals(tmp_6, tmp_7 == null ? null : new QualifiedName(tmp_7))) {
              tmp_4 = equals(this.qualifiedOrImportedTypeName, other.qualifiedOrImportedTypeName);
            } else {
              tmp_4 = false;
            }
            if (tmp_4) {
              tmp_0 = true;
            } else {
              tmp_0 = this.qualifiedTypeName === other.qualifiedTypeName;
            }
          }
          tmp = tmp_0;
        }
      }
    }
    return tmp;
  }
  get context() {
    return this.cs();
  }
}
class TupleTypeInstance {}
class TupleTypeInstanceSimple extends TypeInstanceAbstract {
  constructor(namespace, typeArguments, isNullable) {
    super();
    this.x3l_1 = namespace;
    this.y3l_1 = typeArguments;
    this.z3l_1 = isNullable;
    this.a3m_1 = StdLibDefault_getInstance().TupleType;
  }
  e2h() {
    return this.x3l_1;
  }
  p2u() {
    return this.y3l_1;
  }
  q2u() {
    return this.z3l_1;
  }
  a2p() {
    return this.a3m_1.name;
  }
  z2o() {
    return this.a3m_1.qualifiedName;
  }
  l3l() {
    return this.a3m_1;
  }
  k3l() {
    return this.a3m_1;
  }
  resolved(resolvingTypeArguments) {
    var thisTypeArgMap = this.createTypeArgMap();
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.y3l_1;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var ti = item.resolved(plus_3(thisTypeArgMap, resolvingTypeArguments));
      var tmp$ret$0 = new TypeArgumentNamedSimple(item.name, ti);
      destination.r(tmp$ret$0);
    }
    var resolvedTypeArgs = destination;
    return new TupleTypeInstanceSimple(this.x3l_1, resolvedTypeArgs, this.z3l_1);
  }
  createTypeArgMap() {
    return emptyMap();
  }
  possiblyQualifiedNameInContext(context) {
    return equals(this.a3m_1.namespace, context) ? new SimpleName(this.typeName) : new QualifiedName(this.qualifiedTypeName);
  }
  findInOrCloneTo(other) {
    var tmp = this.x3l_1.findInOrCloneTo(other);
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.y3l_1;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item.findInOrCloneTo(other);
      destination.r(tmp$ret$0);
    }
    return new TupleTypeInstanceSimple(tmp, destination, this.z3l_1);
  }
  hashCode() {
    return hashCode(listOf_0([this.a3m_1, this.y3l_1, this.z3l_1]));
  }
  equals(other) {
    var tmp;
    if (!(other instanceof TypeInstanceSimple)) {
      tmp = false;
    } else {
      if (!equals(this.a3m_1, other.resolvedDeclaration)) {
        tmp = false;
      } else {
        if (!(this.z3l_1 === other.u3l_1)) {
          tmp = false;
        } else {
          if (!equals(this.y3l_1, other.t3l_1)) {
            tmp = false;
          } else {
            tmp = true;
          }
        }
      }
    }
    return tmp;
  }
  toString() {
    var args = joinToString(this.y3l_1, ', ', VOID, VOID, VOID, VOID, TupleTypeInstanceSimple$toString$lambda);
    return SimpleName__toString_impl_vxsxyc(this.typeName) + '<' + args + '>';
  }
}
class TypeNamespaceSimple extends TypeNamespaceAbstract {
  constructor(qualifiedName, options, import_0) {
    options = options === VOID ? new OptionHolderDefault(null, emptyMap()) : options;
    import_0 = import_0 === VOID ? emptyList() : import_0;
    super(options, import_0);
    this.h3m_1 = qualifiedName;
  }
  u2h() {
    return this.h3m_1;
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = other.findNamespaceOrNull(this.h3m_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      // Inline function 'kotlin.also' call
      var this_0 = new TypeNamespaceSimple(this.h3m_1, this.options.clone(other.options), this.import);
      other.addNamespace(this_0);
      tmp = this_0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
}
class sam$kotlin_Comparator$0_5 {
  constructor(function_0) {
    this.i3m_1 = function_0;
  }
  wh(a, b) {
    return this.i3m_1(a, b);
  }
  compare(a, b) {
    return this.wh(a, b);
  }
  w3() {
    return this.i3m_1;
  }
  equals(other) {
    var tmp;
    if (!(other == null) ? isInterface(other, Comparator) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.w3(), other.w3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.w3());
  }
}
class TypeParameter {}
class TypeParameterSimple {
  constructor(name) {
    this.j3m_1 = name;
  }
  f2h() {
    return this.j3m_1;
  }
  clone() {
    return new TypeParameterSimple(this.j3m_1);
  }
  hashCode() {
    return SimpleName__hashCode_impl_a6n15h(this.j3m_1);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, TypeParameter) : false)) {
      tmp = false;
    } else {
      if (!(other.name === this.j3m_1)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    return _SimpleName___get_value__impl__rl2r3c(this.j3m_1);
  }
  get name() {
    return this.f2h();
  }
}
class TypeParameterMultiple_0 {
  constructor() {
    TypeParameterMultiple_instance = this;
    this.k3m_1 = _SimpleName___init__impl__6s45d0('...');
  }
  f2h() {
    return this.k3m_1;
  }
  clone() {
    return this;
  }
  get name() {
    return this.f2h();
  }
}
class Companion_31 {
  constructor() {
    this.maxDepth = 10;
  }
  l3m() {
    return this.maxDepth;
  }
}
class SpecialType {}
class SpecialTypeSimple extends TypeDefinitionSimpleAbstract {
  constructor(namespace, name) {
    super();
    this.s3m_1 = namespace;
    this.t3m_1 = name;
    this.s3m_1.addDefinition(this);
  }
  e2h() {
    return this.s3m_1;
  }
  f2h() {
    return this.t3m_1;
  }
  g2h(context, currentDepth) {
    return null == context ? _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName) : equals(context, this.s3m_1) ? _SimpleName___get_value__impl__rl2r3c(this.t3m_1) : context.isImported(this.s3m_1.qualifiedName) ? _SimpleName___get_value__impl__rl2r3c(this.t3m_1) : _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  findInOrCloneTo(other) {
    var tmp = this.s3m_1.findInOrCloneTo(other);
    var tmp0_elvis_lhs = (tmp instanceof TypeNamespaceAbstract ? tmp : THROW_CCE()).findOwnedSpecialTypeNamedOrNull(this.t3m_1);
    var tmp_0;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      var tmp_1 = this.s3m_1.findInOrCloneTo(other);
      // Inline function 'kotlin.also' call
      var this_0 = (tmp_1 instanceof TypeNamespaceAbstract ? tmp_1 : THROW_CCE()).findOwnedOrCreateSpecialTypeNamed(this.t3m_1);
      super.findInOrCloneTo(other, this_0);
      tmp_0 = this_0;
    } else {
      tmp_0 = tmp0_elvis_lhs;
    }
    return tmp_0;
  }
  asStringInContext(context) {
    return 'special ' + this.signature(context);
  }
  hashCode() {
    return QualifiedName__hashCode_impl_dcqht7(this.qualifiedName);
  }
  equals(other) {
    var tmp;
    if (!(other instanceof SpecialTypeSimple)) {
      tmp = false;
    } else {
      if (!(this.qualifiedName === other.qualifiedName)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    return _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
}
class SingletonType {}
class SingletonTypeSimple extends TypeDefinitionSimpleAbstract {
  constructor(namespace, name) {
    super();
    this.a3n_1 = namespace;
    this.b3n_1 = name;
    this.a3n_1.addDefinition(this);
  }
  e2h() {
    return this.a3n_1;
  }
  f2h() {
    return this.b3n_1;
  }
  g2h(context, currentDepth) {
    return null == context ? _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName) : equals(context, this.a3n_1) ? _SimpleName___get_value__impl__rl2r3c(this.b3n_1) : context.isImported(this.a3n_1.qualifiedName) ? _SimpleName___get_value__impl__rl2r3c(this.b3n_1) : _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = this.a3n_1.findInOrCloneTo(other).findOwnedSingletonTypeNamedOrNull(this.b3n_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      // Inline function 'kotlin.also' call
      var this_0 = this.a3n_1.findInOrCloneTo(other).findOwnedOrCreateSingletonTypeNamed(this.b3n_1);
      super.findInOrCloneTo(other, this_0 instanceof TypeDefinitionSimpleAbstract ? this_0 : THROW_CCE());
      tmp = this_0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  asStringInContext(context) {
    return 'singleton ' + this.signature(context);
  }
  hashCode() {
    return QualifiedName__hashCode_impl_dcqht7(this.qualifiedName);
  }
  equals(other) {
    var tmp;
    if (!(other instanceof SpecialTypeSimple)) {
      tmp = false;
    } else {
      if (!(this.qualifiedName === other.qualifiedName)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    return _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
}
class PrimitiveType {}
class PrimitiveTypeSimple extends TypeDefinitionSimpleAbstract {
  constructor(namespace, name) {
    super();
    this.i3n_1 = namespace;
    this.j3n_1 = name;
    this.i3n_1.addDefinition(this);
  }
  e2h() {
    return this.i3n_1;
  }
  f2h() {
    return this.j3n_1;
  }
  g2h(context, currentDepth) {
    return null == context ? _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName) : equals(context, this.i3n_1) ? _SimpleName___get_value__impl__rl2r3c(this.j3n_1) : context.isImported(this.i3n_1.qualifiedName) ? _SimpleName___get_value__impl__rl2r3c(this.j3n_1) : _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = this.i3n_1.findInOrCloneTo(other).findOwnedPrimitiveTypeNamedOrNull(this.j3n_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      // Inline function 'kotlin.also' call
      var this_0 = this.i3n_1.findInOrCloneTo(other).findOwnedOrCreatePrimitiveTypeNamed(this.j3n_1);
      super.findInOrCloneTo(other, this_0 instanceof TypeDefinitionSimpleAbstract ? this_0 : THROW_CCE());
      tmp = this_0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  asStringInContext(context) {
    return 'primitive ' + this.signature(context);
  }
  hashCode() {
    return QualifiedName__hashCode_impl_dcqht7(this.qualifiedName);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, PrimitiveType) : false)) {
      tmp = false;
    } else {
      if (!(this.qualifiedName === other.qualifiedName)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    return _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
}
class EnumType {}
class EnumTypeSimple extends TypeDefinitionSimpleAbstract {
  constructor(namespace, name, literals) {
    super();
    this.q3n_1 = namespace;
    this.r3n_1 = name;
    this.s3n_1 = literals;
    this.q3n_1.addDefinition(this);
  }
  e2h() {
    return this.q3n_1;
  }
  f2h() {
    return this.r3n_1;
  }
  t3n() {
    return this.s3n_1;
  }
  g2h(context, currentDepth) {
    return null == context ? _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName) : equals(context, this.q3n_1) ? _SimpleName___get_value__impl__rl2r3c(this.r3n_1) : context.isImported(this.q3n_1.qualifiedName) ? _SimpleName___get_value__impl__rl2r3c(this.r3n_1) : _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = this.q3n_1.findInOrCloneTo(other).findOwnedEnumTypeNamedOrNull(this.r3n_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      // Inline function 'kotlin.also' call
      var this_0 = this.q3n_1.findInOrCloneTo(other).findOwnedOrCreateEnumTypeNamed(this.r3n_1, this.s3n_1);
      super.findInOrCloneTo(other, this_0 instanceof TypeDefinitionSimpleAbstract ? this_0 : THROW_CCE());
      tmp = this_0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  asStringInContext(context) {
    return 'enum ' + this.signature(context);
  }
  hashCode() {
    return QualifiedName__hashCode_impl_dcqht7(this.qualifiedName);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, PrimitiveType) : false)) {
      tmp = false;
    } else {
      if (!(this.qualifiedName === other.qualifiedName)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    return _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  get literals() {
    return this.t3n();
  }
}
class UnionType {}
class UnionTypeSimple extends TypeDefinitionSimpleAbstract {
  constructor(namespace, name) {
    super();
    this.a3o_1 = namespace;
    this.b3o_1 = name;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.c3o_1 = ArrayList.y();
    this.a3o_1.addDefinition(this);
  }
  e2h() {
    return this.a3o_1;
  }
  f2h() {
    return this.b3o_1;
  }
  l38() {
    return this.c3o_1;
  }
  addAlternative(value) {
    this.c3o_1.r(value);
  }
  g2h(context, currentDepth) {
    return null == context ? _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName) : equals(context, this.a3o_1) ? _SimpleName___get_value__impl__rl2r3c(this.b3o_1) : context.isImported(this.a3o_1.qualifiedName) ? _SimpleName___get_value__impl__rl2r3c(this.b3o_1) : _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  conformsTo(other) {
    var tmp;
    if (this === other) {
      tmp = true;
    } else {
      if (equals(other, StdLibDefault_getInstance().NothingType.resolvedDeclaration)) {
        tmp = false;
      } else {
        if (equals(other, StdLibDefault_getInstance().AnyType.resolvedDeclaration)) {
          tmp = true;
        } else {
          if (isInterface(other, UnionType)) {
            tmp = equals(this.c3o_1, other.alternatives);
          } else {
            tmp = false;
          }
        }
      }
    }
    return tmp;
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = this.a3o_1.findInOrCloneTo(other).findOwnedUnionTypeNamedOrNull(this.b3o_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      var tmp_0 = this.a3o_1.findInOrCloneTo(other);
      // Inline function 'kotlin.also' call
      var this_0 = tmp_0.findOwnedOrCreateUnionTypeNamed(this.b3o_1, UnionTypeSimple$findInOrCloneTo$lambda(this, other));
      super.findInOrCloneTo(other, this_0 instanceof UnionTypeSimple ? this_0 : THROW_CCE());
      tmp = this_0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  asStringInContext(context) {
    var alts = joinToString(this.c3o_1, ' | ', VOID, VOID, VOID, VOID, UnionTypeSimple$asStringInContext$lambda(context));
    var tmp;
    if (alts.length < 80) {
      tmp = 'union ' + this.signature(context) + ' { ' + alts + ' }';
    } else {
      var altsnl = joinToString(this.c3o_1, '\n    | ', VOID, VOID, VOID, VOID, UnionTypeSimple$asStringInContext$lambda_0(context));
      tmp = 'union ' + this.signature(context) + ' {\n   ' + altsnl + '\n  }';
    }
    return tmp;
  }
  hashCode() {
    return QualifiedName__hashCode_impl_dcqht7(this.qualifiedName);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, UnionType) : false)) {
      tmp = false;
    } else {
      if (!(this.qualifiedName === other.qualifiedName)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  get alternatives() {
    return this.l38();
  }
}
class TypeArgumentNamed {}
class TypeArgumentNamedSimple {
  constructor(name, type) {
    this.d3o_1 = name;
    this.e3o_1 = type;
  }
  f3o() {
    return this.d3o_1;
  }
  q2w() {
    return this.e3o_1;
  }
  conformsTo(other) {
    var tmp;
    if (isInterface(other, TypeArgumentNamed)) {
      tmp = (this.d3o_1 === other.name && this.e3o_1.conformsTo(other.type));
    } else {
      tmp = this.e3o_1.conformsTo(other.type);
    }
    return tmp;
  }
  resolved(resolvingTypeArguments) {
    return this.e3o_1.resolved(resolvingTypeArguments);
  }
  signature(context, currentDepth) {
    return _PropertyName___get_value__impl__p219lh(this.d3o_1) + ':' + this.e3o_1.signature(context, currentDepth);
  }
  findInOrCloneTo(other) {
    return new TypeArgumentNamedSimple(this.d3o_1, this.e3o_1.findInOrCloneTo(other));
  }
  toString() {
    return PropertyName__toString_impl_hcnfa7(this.d3o_1) + ': ' + this.e3o_1.signature(null, 0);
  }
  get name() {
    return this.f3o();
  }
  get type() {
    return this.q2w();
  }
}
class TupleType {}
function typeTuple(typeArguments, nullable, $super) {
  nullable = nullable === VOID ? false : nullable;
  return $super === VOID ? this.g3o(typeArguments, nullable) : $super.g3o.call(this, typeArguments, nullable);
}
class TupleTypeSimple extends TypeDefinitionSimpleAbstract {
  constructor(namespace, name) {
    super();
    this.s2r_1 = namespace;
    this.t2r_1 = name;
    this.u2r_1 = listOf(TypeParameterMultiple_getInstance());
    this.s2r_1.addDefinition(this);
  }
  e2h() {
    return this.s2r_1;
  }
  f2h() {
    return this.t2r_1;
  }
  x2h() {
    return this.u2r_1;
  }
  g2i(typeArguments, isNullable) {
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(typeArguments, 10));
    var _iterator__ex2g4s = typeArguments.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = isInterface(item, TypeArgumentNamed) ? item : THROW_CCE();
      destination.r(tmp$ret$0);
    }
    return this.typeTuple(destination, isNullable);
  }
  g3o(typeArguments, nullable) {
    return this.s2r_1.createTupleTypeInstance(typeArguments, nullable);
  }
  g2h(context, currentDepth) {
    var tmp;
    if (currentDepth >= 10) {
      tmp = '...';
    } else {
      var tmp_0 = SimpleName__toString_impl_vxsxyc(this.t2r_1);
      var tmp_1 = this.property;
      tmp = tmp_0 + '<' + joinToString(tmp_1, VOID, VOID, VOID, VOID, VOID, TupleTypeSimple$signature$lambda(context, currentDepth)) + '>';
    }
    return tmp;
  }
  findInOrCloneTo(other) {
    return StdLibDefault_getInstance().TupleType;
  }
  conformsTo(other) {
    var tmp;
    if (this === other) {
      tmp = true;
    } else {
      if (equals(other, StdLibDefault_getInstance().NothingType.resolvedDeclaration)) {
        tmp = false;
      } else {
        if (equals(other, StdLibDefault_getInstance().AnyType.resolvedDeclaration)) {
          tmp = true;
        } else {
          if (isInterface(other, TupleType)) {
            tmp = other.typeParameters.f2(this.u2r_1);
          } else {
            tmp = false;
          }
        }
      }
    }
    return tmp;
  }
  equalTo(other) {
    return equals(this.u2r_1, other.typeParameters);
  }
  asStringInContext(context) {
    return 'tuple ' + this.signature(context);
  }
}
class sam$kotlin_Comparator$0_6 {
  constructor(function_0) {
    this.h3o_1 = function_0;
  }
  wh(a, b) {
    return this.h3o_1(a, b);
  }
  compare(a, b) {
    return this.wh(a, b);
  }
  w3() {
    return this.h3o_1;
  }
  equals(other) {
    var tmp;
    if (!(other == null) ? isInterface(other, Comparator) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.w3(), other.w3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.w3());
  }
}
class ValueType {}
class ValueTypeSimple extends StructuredTypeSimpleAbstract {
  constructor(namespace, name) {
    super();
    this.o3o_1 = namespace;
    this.p3o_1 = name;
    this.o3o_1.addDefinition(this);
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.q3o_1 = ArrayList.y();
  }
  e2h() {
    return this.o3o_1;
  }
  f2h() {
    return this.p3o_1;
  }
  r3o() {
    return this.q3o_1;
  }
  s3o() {
    var tmp;
    if (this.q3o_1.v() === 0) {
      var message = 'ValueType must have a constructor before its valuePropertyName can be read.';
      throw IllegalStateException.v4(toString(message));
    } else {
      var tmp_0;
      switch (this.q3o_1.z(0).parameters.v()) {
        case 0:
          var message_0 = 'ValueType primary (first) constructor must have at least one parameter';
          throw IllegalStateException.v4(toString(message_0));
        case 1:
          var tmp2_elvis_lhs = this.findAllPropertyOrNull(_PropertyName___init__impl__sz2wu9(_ParameterName___get_value__impl__c8iwft(this.q3o_1.z(0).parameters.z(0).name)));
          var tmp_1;
          if (tmp2_elvis_lhs == null) {
            var message_1 = "There is no property with name '" + _ParameterName___get_value__impl__c8iwft(this.q3o_1.z(0).parameters.z(0).name) + "' corresponding the the primary constructor argument";
            throw IllegalStateException.v4(toString(message_1));
          } else {
            tmp_1 = tmp2_elvis_lhs;
          }

          tmp_0 = tmp_1;
          break;
        default:
          var message_2 = 'ValueType primary (first) constructor must have only one parameter';
          throw IllegalStateException.v4(toString(message_2));
      }
      tmp = tmp_0;
    }
    return tmp;
  }
  addConstructor(parameters) {
    var cons = new ConstructorDeclarationSimple(this, parameters);
    var tmp = this.q3o_1;
    (isInterface(tmp, KtMutableList) ? tmp : THROW_CCE()).r(cons);
  }
  g2h(context, currentDepth) {
    return null == context ? _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName) : equals(context, this.o3o_1) ? _SimpleName___get_value__impl__rl2r3c(this.p3o_1) : context.isImported(this.o3o_1.qualifiedName) ? _SimpleName___get_value__impl__rl2r3c(this.p3o_1) : _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = this.o3o_1.findInOrCloneTo(other).findOwnedValueTypeNamedOrNull(this.p3o_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      // Inline function 'kotlin.also' call
      var this_0 = this.o3o_1.findInOrCloneTo(other).findOwnedOrCreateValueTypeNamed(this.p3o_1);
      super.findInOrCloneTo(other, this_0 instanceof TypeDefinitionSimpleAbstract ? this_0 : THROW_CCE());
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s = this.q3o_1.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        // Inline function 'kotlin.collections.map' call
        var this_1 = element.parameters;
        // Inline function 'kotlin.collections.mapTo' call
        var destination = ArrayList.w(collectionSizeOrDefault(this_1, 10));
        var _iterator__ex2g4s_0 = this_1.s();
        while (_iterator__ex2g4s_0.t()) {
          var item = _iterator__ex2g4s_0.u();
          var tmp$ret$0 = item.findInOrCloneTo(other);
          destination.r(tmp$ret$0);
        }
        this_0.addConstructor(destination);
      }
      tmp = this_0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  asStringInContext(context) {
    var tmp;
    if (this.supertypes.a1()) {
      tmp = '';
    } else {
      // Inline function 'kotlin.collections.sortedBy' call
      var this_0 = this.supertypes;
      // Inline function 'kotlin.comparisons.compareBy' call
      var tmp_0 = ValueTypeSimple$asStringInContext$lambda(context);
      var tmp$ret$0 = new sam$kotlin_Comparator$0_6(tmp_0);
      var tmp_1 = sortedWith(this_0, tmp$ret$0);
      tmp = ' : ' + joinToString(tmp_1, VOID, VOID, VOID, VOID, VOID, ValueTypeSimple$asStringInContext$lambda_0(context));
    }
    var sups = tmp;
    var tmp_2 = this.property;
    var cargs = joinToString(tmp_2, ', ', VOID, VOID, VOID, VOID, ValueTypeSimple$asStringInContext$lambda_1(context));
    var tmp_3 = this.property;
    var props = joinToString(tmp_3, '\n    ', VOID, VOID, VOID, VOID, ValueTypeSimple$asStringInContext$lambda_2(context));
    return 'value ' + SimpleName__toString_impl_vxsxyc(this.p3o_1) + sups + ' ( ' + cargs + ' )';
  }
  hashCode() {
    return QualifiedName__hashCode_impl_dcqht7(this.qualifiedName);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, ValueType) : false)) {
      tmp = false;
    } else {
      if (!(this.qualifiedName === other.qualifiedName)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    return _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  get constructors() {
    return this.r3o();
  }
  get valueProperty() {
    return this.s3o();
  }
}
class sam$kotlin_Comparator$0_7 {
  constructor(function_0) {
    this.t3o_1 = function_0;
  }
  wh(a, b) {
    return this.t3o_1(a, b);
  }
  compare(a, b) {
    return this.wh(a, b);
  }
  w3() {
    return this.t3o_1;
  }
  equals(other) {
    var tmp;
    if (!(other == null) ? isInterface(other, Comparator) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.w3(), other.w3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.w3());
  }
}
class InterfaceType {}
class InterfaceTypeSimple extends StructuredTypeSimpleAbstract {
  constructor(namespace, name) {
    super();
    this.a3p_1 = namespace;
    this.b3p_1 = name;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.c3p_1 = ArrayList.y();
    this.a3p_1.addDefinition(this);
  }
  e2h() {
    return this.a3p_1;
  }
  f2h() {
    return this.b3p_1;
  }
  w2h() {
    return this.c3p_1;
  }
  g2h(context, currentDepth) {
    return null == context ? _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName) : equals(context, this.a3p_1) ? _SimpleName___get_value__impl__rl2r3c(this.b3p_1) : context.isImported(this.a3p_1.qualifiedName) ? _SimpleName___get_value__impl__rl2r3c(this.b3p_1) : _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = this.a3p_1.findInOrCloneTo(other).findOwnedInterfaceTypeNamedOrNull(this.b3p_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      // Inline function 'kotlin.also' call
      var this_0 = this.a3p_1.findInOrCloneTo(other).findOwnedOrCreateInterfaceTypeNamed(this.b3p_1);
      super.findInOrCloneTo(other, this_0 instanceof TypeDefinitionSimpleAbstract ? this_0 : THROW_CCE());
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s = this.c3p_1.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        this_0.addSubtype(element.findInOrCloneTo(other));
      }
      tmp = this_0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  addSubtype(typeInstance) {
    this.c3p_1.r(typeInstance);
  }
  asStringInContext(context) {
    var tmp;
    if (this.typeParameters.a1()) {
      tmp = '';
    } else {
      var tmp_0 = this.typeParameters;
      tmp = '<' + joinToString(tmp_0, ',', VOID, VOID, VOID, VOID, InterfaceTypeSimple$asStringInContext$lambda) + '>';
    }
    var targs = tmp;
    var tmp_1;
    if (this.supertypes.a1()) {
      tmp_1 = '';
    } else {
      // Inline function 'kotlin.collections.sortedBy' call
      var this_0 = this.supertypes;
      // Inline function 'kotlin.comparisons.compareBy' call
      var tmp_2 = InterfaceTypeSimple$asStringInContext$lambda_0(context);
      var tmp$ret$0 = new sam$kotlin_Comparator$0_7(tmp_2);
      var tmp_3 = sortedWith(this_0, tmp$ret$0);
      tmp_1 = ' : ' + joinToString(tmp_3, VOID, VOID, VOID, VOID, VOID, InterfaceTypeSimple$asStringInContext$lambda_1(context));
    }
    var sups = tmp_1;
    var tmp_4 = this.property;
    var props = joinToString(tmp_4, '\n    ', VOID, VOID, VOID, VOID, InterfaceTypeSimple$asStringInContext$lambda_2(context));
    return 'interface ' + SimpleName__toString_impl_vxsxyc(this.b3p_1) + targs + sups + ' {\n    ' + props + '\n  }';
  }
  hashCode() {
    return QualifiedName__hashCode_impl_dcqht7(this.qualifiedName);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, InterfaceType) : false)) {
      tmp = false;
    } else {
      if (!(this.qualifiedName === other.qualifiedName)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    return _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
}
class sam$kotlin_Comparator$0_8 {
  constructor(function_0) {
    this.d3p_1 = function_0;
  }
  wh(a, b) {
    return this.d3p_1(a, b);
  }
  compare(a, b) {
    return this.wh(a, b);
  }
  w3() {
    return this.d3p_1;
  }
  equals(other) {
    var tmp;
    if (!(other == null) ? isInterface(other, Comparator) : false) {
      var tmp_0;
      if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
        tmp_0 = equals(this.w3(), other.w3());
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    } else {
      tmp = false;
    }
    return tmp;
  }
  hashCode() {
    return hashCode(this.w3());
  }
}
class DataType {}
class DataTypeSimple extends StructuredTypeSimpleAbstract {
  constructor(namespace, name) {
    super();
    this.k3p_1 = namespace;
    this.l3p_1 = name;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.m3p_1 = ArrayList.y();
    var tmp_0 = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_0.n3p_1 = ArrayList.y();
    this.k3p_1.addDefinition(this);
  }
  e2h() {
    return this.k3p_1;
  }
  f2h() {
    return this.l3p_1;
  }
  r3o() {
    return this.m3p_1;
  }
  w2h() {
    return this.n3p_1;
  }
  addConstructor(parameters) {
    var cons = new ConstructorDeclarationSimple(this, parameters);
    var tmp = this.m3p_1;
    (isInterface(tmp, KtMutableList) ? tmp : THROW_CCE()).r(cons);
  }
  g2h(context, currentDepth) {
    return null == context ? _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName) : equals(context, this.k3p_1) ? _SimpleName___get_value__impl__rl2r3c(this.l3p_1) : context.isImported(this.k3p_1.qualifiedName) ? _SimpleName___get_value__impl__rl2r3c(this.l3p_1) : _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = this.k3p_1.findInOrCloneTo(other).findOwnedDataTypeNamedOrNull(this.l3p_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      // Inline function 'kotlin.also' call
      var this_0 = this.k3p_1.findInOrCloneTo(other).createOwnedDataTypeNamed(this.l3p_1);
      super.findInOrCloneTo(other, this_0 instanceof TypeDefinitionSimpleAbstract ? this_0 : THROW_CCE());
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s = this.m3p_1.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        // Inline function 'kotlin.collections.map' call
        var this_1 = element.parameters;
        // Inline function 'kotlin.collections.mapTo' call
        var destination = ArrayList.w(collectionSizeOrDefault(this_1, 10));
        var _iterator__ex2g4s_0 = this_1.s();
        while (_iterator__ex2g4s_0.t()) {
          var item = _iterator__ex2g4s_0.u();
          var tmp$ret$0 = item.findInOrCloneTo(other);
          destination.r(tmp$ret$0);
        }
        this_0.addConstructor(destination);
      }
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s_1 = this.n3p_1.s();
      while (_iterator__ex2g4s_1.t()) {
        var element_0 = _iterator__ex2g4s_1.u();
        this_0.addSubtype(element_0.findInOrCloneTo(other));
      }
      tmp = this_0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  addSubtype_dep(qualifiedTypeName) {
    var ti = this.k3p_1.createTypeInstance(this.qualifiedName, qualifiedTypeName, emptyList(), false);
    this.addSubtype(ti);
  }
  addSubtype(typeInstance) {
    if (!this.n3p_1.e1(typeInstance)) {
      this.n3p_1.r(typeInstance);
    }
  }
  asStringInContext(context) {
    var tmp;
    if (this.typeParameters.a1()) {
      tmp = '';
    } else {
      var tmp_0 = this.typeParameters;
      tmp = '<' + joinToString(tmp_0, ',', VOID, VOID, VOID, VOID, DataTypeSimple$asStringInContext$lambda) + '>';
    }
    var targs = tmp;
    var tmp_1;
    if (this.supertypes.a1()) {
      tmp_1 = '';
    } else {
      // Inline function 'kotlin.collections.sortedBy' call
      var this_0 = this.supertypes;
      // Inline function 'kotlin.comparisons.compareBy' call
      var tmp_2 = DataTypeSimple$asStringInContext$lambda_0(context);
      var tmp$ret$0 = new sam$kotlin_Comparator$0_8(tmp_2);
      var tmp_3 = sortedWith(this_0, tmp$ret$0);
      tmp_1 = ' : ' + joinToString(tmp_3, VOID, VOID, VOID, VOID, VOID, DataTypeSimple$asStringInContext$lambda_1(context));
    }
    var sups = tmp_1;
    var tmp_4 = this.property;
    var props = joinToString(tmp_4, '\n    ', VOID, VOID, VOID, VOID, DataTypeSimple$asStringInContext$lambda_2(context));
    return 'data ' + SimpleName__toString_impl_vxsxyc(this.l3p_1) + targs + sups + ' {\n    ' + props + '\n  }';
  }
  hashCode() {
    return QualifiedName__hashCode_impl_dcqht7(this.qualifiedName);
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, DataType) : false)) {
      tmp = false;
    } else {
      if (!(this.qualifiedName === other.qualifiedName)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    return _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  get constructors() {
    return this.r3o();
  }
}
class CollectionType {}
class CollectionTypeSimple extends StructuredTypeSimpleAbstract {
  constructor(namespace, name) {
    super();
    this.u3p_1 = namespace;
    this.v3p_1 = name;
    this.u3p_1.addDefinition(this);
  }
  e2h() {
    return this.u3p_1;
  }
  f2h() {
    return this.v3p_1;
  }
  w3p() {
    return this.equals(StdLibDefault_getInstance().List);
  }
  x3p() {
    return this.equals(StdLibDefault_getInstance().Set);
  }
  y3p() {
    return this.equals(StdLibDefault_getInstance().Map);
  }
  g2h(context, currentDepth) {
    return null == context ? _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName) : equals(context, this.u3p_1) ? _SimpleName___get_value__impl__rl2r3c(this.v3p_1) : context.isImported(this.u3p_1.qualifiedName) ? _SimpleName___get_value__impl__rl2r3c(this.v3p_1) : _QualifiedName___get_value__impl__nkc4gq(this.qualifiedName);
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = this.u3p_1.findInOrCloneTo(other).findOwnedCollectionTypeNamedOrNull(this.v3p_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      // Inline function 'kotlin.also' call
      var this_0 = this.u3p_1.findInOrCloneTo(other).findOwnedOrCreateCollectionTypeNamed(this.v3p_1);
      super.findInOrCloneTo(other, this_0 instanceof TypeDefinitionSimpleAbstract ? this_0 : THROW_CCE());
      tmp = this_0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  asStringInContext(context) {
    var tmp;
    if (this.typeParameters.a1()) {
      tmp = '';
    } else {
      var tmp_0 = this.typeParameters;
      tmp = '<' + joinToString(tmp_0, ',', VOID, VOID, VOID, VOID, CollectionTypeSimple$asStringInContext$lambda) + '>';
    }
    var targs = tmp;
    return 'collection ' + this.signature(context) + targs;
  }
  get isStdList() {
    return this.w3p();
  }
  get isStdSet() {
    return this.x3p();
  }
  get isStdMap() {
    return this.y3p();
  }
}
class ConstructorDeclaration {}
class ConstructorDeclarationSimple {
  constructor(owner, parameters) {
    this.z3p_1 = owner;
    this.a3q_1 = parameters;
  }
  b3q() {
    return this.z3p_1;
  }
  c3q() {
    return this.a3q_1;
  }
  findInOrCloneTo(other) {
    var tmp = this.z3p_1.findInOrCloneTo(other);
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.a3q_1;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item.findInOrCloneTo(other);
      destination.r(tmp$ret$0);
    }
    return new ConstructorDeclarationSimple(tmp, destination);
  }
  get owner() {
    return this.b3q();
  }
  get parameters() {
    return this.c3q();
  }
}
class PropertyDeclaration {}
class PropertyDeclarationAbstract {
  constructor() {
    var tmp = this;
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp.d3q_1 = LinkedHashMap.l4();
  }
  e2i(_set____db54di) {
    this.d3q_1 = _set____db54di;
  }
  f2i() {
    return this.d3q_1;
  }
  e3q() {
    return this.characteristics.e1(PropertyCharacteristic_CONSTRUCTOR_getInstance());
  }
  f3q() {
    return this.characteristics.e1(PropertyCharacteristic_IDENTITY_getInstance());
  }
  g3q() {
    return this.characteristics.e1(PropertyCharacteristic_COMPOSITE_getInstance());
  }
  h2p() {
    return this.characteristics.e1(PropertyCharacteristic_REFERENCE_getInstance());
  }
  h3q() {
    return this.characteristics.e1(PropertyCharacteristic_READ_ONLY_getInstance());
  }
  i3q() {
    return this.characteristics.e1(PropertyCharacteristic_READ_WRITE_getInstance());
  }
  j3q() {
    return this.characteristics.e1(PropertyCharacteristic_DERIVED_getInstance());
  }
  k3q() {
    return this.characteristics.e1(PropertyCharacteristic_STORED_getInstance());
  }
  l3q() {
    return this.characteristics.e1(PropertyCharacteristic_PRIMITIVE_getInstance());
  }
  resolved(typeArguments) {
    return new PropertyDeclarationResolvedSimple(this, this.owner, this.name, this.typeInstance.resolved(typeArguments), this.characteristics, this.description);
  }
  hashCode() {
    return hashCode(listOf_0([this.owner, new PropertyName(this.name)]));
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, PropertyDeclaration) : false)) {
      tmp = false;
    } else {
      if (!(this.name === other.name)) {
        tmp = false;
      } else {
        if (!equals(this.owner, other.owner)) {
          tmp = false;
        } else {
          tmp = true;
        }
      }
    }
    return tmp;
  }
  toString() {
    var nullable = this.typeInstance.isNullable ? '?' : '';
    var chrsStr = this.characteristics.a1() ? '' : joinToString(this.characteristics, VOID, ' {', '}');
    return SimpleName__toString_impl_vxsxyc(this.owner.name) + '.' + PropertyName__toString_impl_hcnfa7(this.name) + ': ' + this.typeInstance.signature(this.owner.namespace, 0) + nullable + ' [' + this.index + ']' + chrsStr;
  }
  get metaInfo() {
    return this.f2i();
  }
  set metaInfo(value) {
    this.e2i(value);
  }
  get isConstructor() {
    return this.e3q();
  }
  get isIdentity() {
    return this.f3q();
  }
  get isComposite() {
    return this.g3q();
  }
  get isReference() {
    return this.h2p();
  }
  get isReadOnly() {
    return this.h3q();
  }
  get isReadWrite() {
    return this.i3q();
  }
  get isDerived() {
    return this.j3q();
  }
  get isStored() {
    return this.k3q();
  }
  get isPrimitive() {
    return this.l3q();
  }
  get owner() {
    return this.b3q();
  }
  get name() {
    return this.f3o();
  }
  get typeInstance() {
    return this.m3q();
  }
  get characteristics() {
    return this.n3q();
  }
  get description() {
    return this.p2n();
  }
  get index() {
    return this.f1m();
  }
}
class PropertyDeclarationStored extends PropertyDeclarationAbstract {
  constructor(owner, name, typeInstance, characteristics, index) {
    super();
    this.d3i_1 = owner;
    this.e3i_1 = name;
    this.f3i_1 = typeInstance;
    this.g3i_1 = characteristics;
    this.h3i_1 = index;
    this.i3i_1 = 'Stored property value.';
  }
  b3q() {
    return this.d3i_1;
  }
  f3o() {
    return this.e3i_1;
  }
  m3q() {
    return this.f3i_1;
  }
  n3q() {
    return this.g3i_1;
  }
  f1m() {
    return this.h3i_1;
  }
  p2n() {
    return this.i3i_1;
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = this.d3i_1.findInOrCloneTo(other).findOwnedPropertyOrNull(this.e3i_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      tmp = this.d3i_1.findInOrCloneTo(other).appendPropertyStored(this.e3i_1, this.f3i_1.findInOrCloneTo(other), this.g3i_1, this.h3i_1);
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
}
class PropertyDeclarationPrimitive extends PropertyDeclarationAbstract {
  constructor(owner, name, typeInstance, description, index) {
    super();
    this.p3q_1 = owner;
    this.q3q_1 = name;
    this.r3q_1 = typeInstance;
    this.s3q_1 = description;
    this.t3q_1 = index;
  }
  b3q() {
    return this.p3q_1;
  }
  f3o() {
    return this.q3q_1;
  }
  m3q() {
    return this.r3q_1;
  }
  p2n() {
    return this.s3q_1;
  }
  f1m() {
    return this.t3q_1;
  }
  n3q() {
    return setOf_0([PropertyCharacteristic_READ_WRITE_getInstance(), PropertyCharacteristic_PRIMITIVE_getInstance()]);
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = this.p3q_1.findInOrCloneTo(other).findOwnedPropertyOrNull(this.q3q_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      tmp = this.p3q_1.findInOrCloneTo(other).appendPropertyPrimitive(this.q3q_1, this.r3q_1.findInOrCloneTo(other), this.s3q_1);
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
}
class PropertyDeclarationDerived extends PropertyDeclarationAbstract {
  constructor(owner, name, typeInstance, description, expression, index) {
    super();
    this.v3q_1 = owner;
    this.w3q_1 = name;
    this.x3q_1 = typeInstance;
    this.y3q_1 = description;
    this.expression = expression;
    this.z3q_1 = index;
  }
  b3q() {
    return this.v3q_1;
  }
  f3o() {
    return this.w3q_1;
  }
  m3q() {
    return this.x3q_1;
  }
  p2n() {
    return this.y3q_1;
  }
  v1j() {
    return this.expression;
  }
  f1m() {
    return this.z3q_1;
  }
  n3q() {
    return setOf_0([PropertyCharacteristic_READ_ONLY_getInstance(), PropertyCharacteristic_DERIVED_getInstance()]);
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = this.v3q_1.findInOrCloneTo(other).findOwnedPropertyOrNull(this.w3q_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      tmp = this.v3q_1.findInOrCloneTo(other).appendPropertyDerived(this.w3q_1, this.x3q_1.findInOrCloneTo(other), this.y3q_1, this.expression);
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
}
class PropertyDeclarationResolved {}
class PropertyDeclarationResolvedSimple extends PropertyDeclarationAbstract {
  constructor(original, owner, name, typeInstance, characteristics, description) {
    super();
    this.b3r_1 = original;
    this.c3r_1 = owner;
    this.d3r_1 = name;
    this.e3r_1 = typeInstance;
    this.f3r_1 = characteristics;
    this.g3r_1 = description;
  }
  h3r() {
    return this.b3r_1;
  }
  b3q() {
    return this.c3r_1;
  }
  f3o() {
    return this.d3r_1;
  }
  m3q() {
    return this.e3r_1;
  }
  n3q() {
    return this.f3r_1;
  }
  p2n() {
    return this.g3r_1;
  }
  f1m() {
    return -1;
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = this.c3r_1.findInOrCloneTo(other).findOwnedPropertyOrNull(this.d3r_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      tmp = new PropertyDeclarationResolvedSimple(this.b3r_1.findInOrCloneTo(other), this.c3r_1.findInOrCloneTo(other), this.d3r_1, this.e3r_1.findInOrCloneTo(other), this.f3r_1, this.g3r_1);
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  get original() {
    return this.h3r();
  }
}
class MethodDeclaration {}
class MethodDeclarationAbstract {
  resolved(typeArguments) {
    var tmp = this.owner;
    var tmp_0 = this.name;
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.parameters;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = new ParameterDefinitionSimple(item.name, item.typeInstance.resolved(typeArguments), item.defaultValue);
      destination.r(tmp$ret$0);
    }
    return new MethodDeclarationResolvedSimple(this, tmp, tmp_0, destination, this.returnType.resolved(typeArguments), this.description);
  }
  get owner() {
    return this.b3q();
  }
  get name() {
    return this.i3r();
  }
  get parameters() {
    return this.c3q();
  }
  get returnType() {
    return this.j3r();
  }
  get description() {
    return this.p2n();
  }
}
class MethodDeclarationDerived {}
class MethodDeclarationDerivedSimple extends MethodDeclarationAbstract {
  constructor(owner, name, parameters, returnType, description, body) {
    super();
    this.k3r_1 = owner;
    this.l3r_1 = name;
    this.m3r_1 = parameters;
    this.n3r_1 = returnType;
    this.o3r_1 = description;
    this.body = body;
    var tmp = this.k3r_1;
    (tmp instanceof TypeDefinitionSimpleAbstract ? tmp : THROW_CCE()).addMethod(this);
  }
  b3q() {
    return this.k3r_1;
  }
  i3r() {
    return this.l3r_1;
  }
  c3q() {
    return this.m3r_1;
  }
  j3r() {
    return this.n3r_1;
  }
  p2n() {
    return this.o3r_1;
  }
  p3r() {
    return this.body;
  }
  findInOrCloneTo(other) {
    var tmp = this.k3r_1.findInOrCloneTo(other).findOwnedMethodOrNull(this.l3r_1);
    var tmp0_elvis_lhs = (tmp == null ? true : isInterface(tmp, MethodDeclarationDerived)) ? tmp : THROW_CCE();
    var tmp_0;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      var tmp_1 = this.k3r_1.findInOrCloneTo(other);
      // Inline function 'kotlin.collections.map' call
      var this_0 = this.m3r_1;
      // Inline function 'kotlin.collections.mapTo' call
      var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
      var _iterator__ex2g4s = this_0.s();
      while (_iterator__ex2g4s.t()) {
        var item = _iterator__ex2g4s.u();
        var tmp$ret$0 = item.findInOrCloneTo(other);
        destination.r(tmp$ret$0);
      }
      tmp_0 = tmp_1.appendMethodDerived(this.l3r_1, destination, this.n3r_1.findInOrCloneTo(other), this.o3r_1, this.body);
    } else {
      tmp_0 = tmp0_elvis_lhs;
    }
    return tmp_0;
  }
}
class MethodDeclarationResolved {}
class MethodDeclarationResolvedSimple extends MethodDeclarationAbstract {
  constructor(original, owner, name, parameters, returnType, description) {
    super();
    this.q3r_1 = original;
    this.r3r_1 = owner;
    this.s3r_1 = name;
    this.t3r_1 = parameters;
    this.u3r_1 = returnType;
    this.v3r_1 = description;
  }
  h3r() {
    return this.q3r_1;
  }
  b3q() {
    return this.r3r_1;
  }
  i3r() {
    return this.s3r_1;
  }
  c3q() {
    return this.t3r_1;
  }
  j3r() {
    return this.u3r_1;
  }
  p2n() {
    return this.v3r_1;
  }
  findInOrCloneTo(other) {
    var tmp0_elvis_lhs = this.r3r_1.findInOrCloneTo(other).findOwnedMethodOrNull(this.s3r_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      var tmp_0 = this.q3r_1.findInOrCloneTo(other);
      var tmp_1 = this.r3r_1.findInOrCloneTo(other);
      // Inline function 'kotlin.collections.map' call
      var this_0 = this.t3r_1;
      // Inline function 'kotlin.collections.mapTo' call
      var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
      var _iterator__ex2g4s = this_0.s();
      while (_iterator__ex2g4s.t()) {
        var item = _iterator__ex2g4s.u();
        var tmp$ret$0 = item.findInOrCloneTo(other);
        destination.r(tmp$ret$0);
      }
      tmp = new MethodDeclarationResolvedSimple(tmp_0, tmp_1, this.s3r_1, destination, this.u3r_1.findInOrCloneTo(other), this.v3r_1);
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  get original() {
    return this.h3r();
  }
}
class ParameterDeclaration {}
class ParameterDefinitionSimple {
  constructor(name, typeInstance, defaultValue) {
    this.w3r_1 = name;
    this.x3r_1 = typeInstance;
    this.y3r_1 = defaultValue;
  }
  z3r() {
    return this.w3r_1;
  }
  m3q() {
    return this.x3r_1;
  }
  a3s() {
    return this.y3r_1;
  }
  findInOrCloneTo(other) {
    return new ParameterDefinitionSimple(this.w3r_1, this.x3r_1.findInOrCloneTo(other), this.y3r_1);
  }
  hashCode() {
    return hashCode(listOf(new ParameterName(this.w3r_1)));
  }
  equals(other) {
    var tmp;
    if (!(!(other == null) ? isInterface(other, ParameterDeclaration) : false)) {
      tmp = false;
    } else {
      if (!(this.w3r_1 === other.name)) {
        tmp = false;
      } else {
        tmp = true;
      }
    }
    return tmp;
  }
  toString() {
    return ParameterName__toString_impl_rf7x9v(this.w3r_1) + ': ' + toString(this.x3r_1) + (!(null == this.y3r_1) ? ' = ' + this.y3r_1 : '');
  }
  get name() {
    return this.z3r();
  }
  get typeInstance() {
    return this.m3q();
  }
  get defaultValue() {
    return this.a3s();
  }
}
class MethodDeclarationPrimitive {}
class MethodDeclarationPrimitiveSimple extends MethodDeclarationAbstract {
  constructor(owner, name, parameters, returnType, description) {
    super();
    this.b3s_1 = owner;
    this.c3s_1 = name;
    this.d3s_1 = parameters;
    this.e3s_1 = returnType;
    this.f3s_1 = description;
    var tmp = this.b3s_1;
    (tmp instanceof TypeDefinitionSimpleAbstract ? tmp : THROW_CCE()).addMethod(this);
  }
  b3q() {
    return this.b3s_1;
  }
  i3r() {
    return this.c3s_1;
  }
  c3q() {
    return this.d3s_1;
  }
  j3r() {
    return this.e3s_1;
  }
  p2n() {
    return this.f3s_1;
  }
  findInOrCloneTo(other) {
    var tmp = this.b3s_1.findInOrCloneTo(other).findOwnedMethodOrNull(this.c3s_1);
    var tmp0_elvis_lhs = (tmp == null ? true : isInterface(tmp, MethodDeclarationPrimitive)) ? tmp : THROW_CCE();
    var tmp_0;
    if (tmp0_elvis_lhs == null) {
      // Inline function 'kotlin.run' call
      var tmp_1 = this.b3s_1.findInOrCloneTo(other);
      // Inline function 'kotlin.collections.map' call
      var this_0 = this.d3s_1;
      // Inline function 'kotlin.collections.mapTo' call
      var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
      var _iterator__ex2g4s = this_0.s();
      while (_iterator__ex2g4s.t()) {
        var item = _iterator__ex2g4s.u();
        var tmp$ret$0 = item.findInOrCloneTo(other);
        destination.r(tmp$ret$0);
      }
      tmp_0 = tmp_1.appendMethodPrimitive(this.c3s_1, destination, this.e3s_1.findInOrCloneTo(other), this.f3s_1);
    } else {
      tmp_0 = tmp0_elvis_lhs;
    }
    return tmp_0;
  }
}
class AglTypes_0 extends LanguageObjectAbstract {
  constructor() {
    AglTypes_instance = null;
    super();
    AglTypes_instance = this;
    this.NAMESPACE_NAME = 'net.akehurst.language';
    this.NAME = 'Types';
    this.goalRuleName = 'unit';
    this.t24_1 = _LanguageIdentity___init__impl__3hnnkb('net.akehurst.language.Types');
    this.u24_1 = "namespace net.akehurst.language\n  grammar Types : Base {\n    override definition\n      = singletonDefinition\n      | primitiveDefinition\n      | enumDefinition\n      | valueDefinition\n      | collectionDefinition\n      | dataDefinition\n      | interfaceDefinition\n      | unionDefinition\n      ;\n    singletonDefinition = 'singleton' IDENTIFIER ;\n    primitiveDefinition = 'primitive' IDENTIFIER ;\n    enumDefinition = 'enum' IDENTIFIER enumLiterals? ;\n    enumLiterals = '{' [IDENTIFIER / ',']+ '}' ;\n    valueDefinition = 'value' IDENTIFIER supertypes? '(' constructorParameter ')' ;\n    collectionDefinition = 'collection' IDENTIFIER typeParameterList ;\n    unionDefinition = 'union' IDENTIFIER '{' alternatives '}' ;\n    interfaceDefinition = 'interface' IDENTIFIER typeParameterList? supertypes? interfaceBody? ;\n    interfaceBody = '{' property* '}' ;\n    dataDefinition =\n      'data' IDENTIFIER typeParameterList? supertypes? '{'\n        constructor*\n        property*\n      '}'\n    ;\n    alternatives = [typeReference / '|']+ ;\n    typeParameterList = '<' [IDENTIFIER / ',']+ '>' ;\n    supertypes = ':' [typeReference / ',']+ ;\n    constructor = 'constructor' '(' constructorParameter* ')' ;\n    constructorParameter = cmp_ref? val_var? IDENTIFIER ':' typeReference ;\n    property = cmp_ref? val_var IDENTIFIER ':' typeReference ;\n    typeReference = possiblyQualifiedName typeArgumentList? '?'?;\n    typeArgumentList = '<' [ typeReference / ',']+ '>' ;\n    cmp_ref = 'cmp' | 'ref' ;\n    val_var = 'val' | 'var' ;\n  }";
    this.v24_1 = 'namespace net.akehurst.language.typemodel.api\n    interface TypeInstance {\n        cmp typeArguments\n    }\n    interface TypeDefinition {\n        cmp supertypes\n        cmp typeParameters\n    }\n    interface ValueType {\n        cmp constructors\n    }\n    interface DataType {\n        cmp constructors\n    }\n    interface UnionType {\n        cmp alternatives\n    }\n    interface PropertyDeclaration {\n        cmp typeInstance\n    }\n    interface ConstructorDeclaration {\n        cmp parameters\n    }\n    interface MethodDeclaration {\n        cmp parameters\n    }\n    interface ParameterDeclaration {\n        cmp typeInstance\n    }\n\nnamespace net.akehurst.language.typemodel.asm\n    class TypeNamespaceAbstract {\n        cmp ownedUnnamedSupertypeType\n        cmp ownedTupleTypes\n    }\n    class TypeDefinitionSimpleAbstract {\n        cmp propertyByIndex\n    }\n    class TypeInstanceSimple {\n        // must be explicitly cmp because it is declared an interface\n        cmp qualifiedOrImportedTypeName\n    }\n\nnamespace net.akehurst.language.grammarTypemodel.api\n    interface GrammarTypeNamespace {\n        cmp allRuleNameToType\n    }\n\n';
    this.w24_1 = "\n        namespace net.akehurst.language\n          styles Types {\n            $$ \"'[^']+'\" {\n              foreground: darkgreen;\n              font-weight: bold;\n            }\n          }        \n    ";
    var tmp = this;
    tmp.x24_1 = lazy(AglTypes$grammarModel$delegate$lambda);
    var tmp_0 = this;
    tmp_0.y24_1 = lazy(AglTypes$typesModel$delegate$lambda);
    var tmp_1 = this;
    tmp_1.z24_1 = lazy(AglTypes$asmTransformModel$delegate$lambda);
    var tmp_2 = this;
    tmp_2.a25_1 = lazy(AglTypes$crossReferenceModel$delegate$lambda);
    var tmp_3 = this;
    tmp_3.b25_1 = lazy(AglTypes$styleModel$delegate$lambda);
    var tmp_4 = this;
    tmp_4.c25_1 = lazy(AglTypes$formatModel$delegate$lambda);
    var tmp_5 = this;
    tmp_5.d25_1 = lazy(AglTypes$defaultTargetGrammar$delegate$lambda);
    this.e25_1 = 'unit';
    var tmp_6 = this;
    tmp_6.f25_1 = lazy(AglTypes$syntaxAnalyser$delegate$lambda);
    var tmp_7 = this;
    tmp_7.g25_1 = lazy(AglTypes$semanticAnalyser$delegate$lambda);
    var tmp_8 = this;
    tmp_8.h25_1 = lazy(AglTypes$completionProvider$delegate$lambda);
  }
  u2t() {
    return this.NAMESPACE_NAME;
  }
  v2t() {
    return this.NAME;
  }
  b16() {
    return this.goalRuleName;
  }
  g1u() {
    return this.t24_1;
  }
  u2n() {
    return this.u24_1;
  }
  w2n() {
    return this.v24_1;
  }
  z2n() {
    return this.w24_1;
  }
  i1u() {
    var tmp0 = this.x24_1;
    // Inline function 'kotlin.getValue' call
    grammarModel$factory_6();
    return tmp0.b3();
  }
  p1u() {
    var tmp0 = this.y24_1;
    // Inline function 'kotlin.getValue' call
    typesModel$factory_4();
    return tmp0.b3();
  }
  j2k() {
    var tmp0 = this.z24_1;
    // Inline function 'kotlin.getValue' call
    asmTransformModel$factory_4();
    return tmp0.b3();
  }
  r1u() {
    var tmp0 = this.a25_1;
    // Inline function 'kotlin.getValue' call
    crossReferenceModel$factory_5();
    return tmp0.b3();
  }
  w1u() {
    var tmp0 = this.b25_1;
    // Inline function 'kotlin.getValue' call
    styleModel$factory_4();
    return tmp0.b3();
  }
  i1t() {
    var tmp0 = this.c25_1;
    // Inline function 'kotlin.getValue' call
    formatModel$factory_5();
    return tmp0.b3();
  }
  c2o() {
    var tmp0 = this.d25_1;
    // Inline function 'kotlin.getValue' call
    defaultTargetGrammar$factory_4();
    return tmp0.b3();
  }
  d2o() {
    return this.e25_1;
  }
  s1u() {
    var tmp0 = this.f25_1;
    // Inline function 'kotlin.getValue' call
    syntaxAnalyser$factory_5();
    return tmp0.b3();
  }
  t1u() {
    var tmp0 = this.g25_1;
    // Inline function 'kotlin.getValue' call
    semanticAnalyser$factory_5();
    return tmp0.b3();
  }
  p1y() {
    var tmp0 = this.h25_1;
    // Inline function 'kotlin.getValue' call
    completionProvider$factory_5();
    return tmp0.b3();
  }
}
class TypemodelCompletionProvider extends CompletionProviderAbstract {
  provide(nextExpected, options) {
    return super.provide(nextExpected, options);
  }
}
class Companion_32 {
  constructor() {
    this.OPTION_INCLUDE_STD = 'include-std';
  }
  g3s() {
    return this.OPTION_INCLUDE_STD;
  }
}
class TypemodelSemanticAnalyser {
  constructor() {
    this.h3s_1 = new IssueHolder(LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance());
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.i3s_1 = ArrayList.y();
  }
  clear() {
    this.h3s_1.clear();
    this.i3s_1.n2();
  }
  j3s(sentenceIdentity, asm, locationMap, options) {
    if (_get_includeStd__qn8wa8(Companion_instance_33, asm.options)) {
      asm.addNamespace(StdLibDefault_getInstance());
    }
    return new SemanticAnalysisResultDefault(this.i3s_1, this.h3s_1);
  }
  y2j(sentenceIdentity, asm, locationMap, options) {
    return this.j3s(sentenceIdentity, isInterface(asm, TypeModel) ? asm : THROW_CCE(), locationMap, options);
  }
}
class TypeRefInfo {
  constructor(name, args, isNullable) {
    this.k3s_1 = name;
    this.l3s_1 = args;
    this.m3s_1 = isNullable;
  }
  n3s(contextType) {
    // Inline function 'kotlin.collections.map' call
    var this_0 = this.l3s_1;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item.n3s(contextType).asTypeArgument;
      destination.r(tmp$ret$0);
    }
    var targs = destination;
    return contextType.namespace.createTypeInstance(contextType.qualifiedName, this.k3s_1, targs, this.m3s_1);
  }
  toString() {
    return 'TypeRefInfo(name=' + toString(this.k3s_1) + ', args=' + toString(this.l3s_1) + ', isNullable=' + this.m3s_1 + ')';
  }
  hashCode() {
    var result = hashCode(this.k3s_1);
    result = imul(result, 31) + hashCode(this.l3s_1) | 0;
    result = imul(result, 31) + getBooleanHashCode(this.m3s_1) | 0;
    return result;
  }
  equals(other) {
    if (this === other)
      return true;
    if (!(other instanceof TypeRefInfo))
      return false;
    var tmp0_other_with_cast = other instanceof TypeRefInfo ? other : THROW_CCE();
    if (!equals(this.k3s_1, tmp0_other_with_cast.k3s_1))
      return false;
    if (!equals(this.l3s_1, tmp0_other_with_cast.l3s_1))
      return false;
    if (!(this.m3s_1 === tmp0_other_with_cast.m3s_1))
      return false;
    return true;
  }
}
class TypesSyntaxAnalyser extends SyntaxAnalyserByMethodRegistrationAbstract {
  constructor() {
    super();
    this.u3s_1 = mapOf(to(new QualifiedName(_QualifiedName___init__impl__8ed982('Base')), new BaseSyntaxAnalyser()));
  }
  s2k() {
    return this.u3s_1;
  }
  registerHandlers() {
    super.register(TypesSyntaxAnalyser$unit$ref(this));
    super.register(TypesSyntaxAnalyser$namespace$ref(this));
    super.register(TypesSyntaxAnalyser$definition$ref(this));
    super.register(TypesSyntaxAnalyser$singletonDefinition$ref(this));
    super.register(TypesSyntaxAnalyser$primitiveDefinition$ref(this));
    super.register(TypesSyntaxAnalyser$enumDefinition$ref(this));
    super.register(TypesSyntaxAnalyser$enumLiterals$ref(this));
    super.register(TypesSyntaxAnalyser$valueDefinition$ref(this));
    super.register(TypesSyntaxAnalyser$collectionDefinition$ref(this));
    super.register(TypesSyntaxAnalyser$unionDefinition$ref(this));
    super.register(TypesSyntaxAnalyser$interfaceDefinition$ref(this));
    super.register(TypesSyntaxAnalyser$interfaceBody$ref(this));
    super.register(TypesSyntaxAnalyser$dataDefinition$ref(this));
    super.register(TypesSyntaxAnalyser$typeParameterList$ref(this));
    super.register(TypesSyntaxAnalyser$supertypes$ref(this));
    super.register(TypesSyntaxAnalyser$constructor$ref(this));
    super.register(TypesSyntaxAnalyser$constructorParameter$ref(this));
    super.register(TypesSyntaxAnalyser$property$ref(this));
    super.register(TypesSyntaxAnalyser$cmp_ref$ref(this));
    super.register(TypesSyntaxAnalyser$val_var$ref(this));
    super.register(TypesSyntaxAnalyser$typeReference$ref(this));
    super.register(TypesSyntaxAnalyser$typeArgumentList$ref(this));
  }
}
class PropertyCharacteristic extends Enum {
  h2f(indent) {
    var tmp;
    switch (this.d3_1) {
      case 2:
        tmp = 'val';
        break;
      case 3:
        tmp = 'var';
        break;
      case 0:
        tmp = 'ref';
        break;
      case 1:
        tmp = 'cmp';
        break;
      case 4:
        tmp = 'str';
        break;
      case 5:
        tmp = 'drv';
        break;
      case 6:
        tmp = 'prm';
        break;
      case 7:
        tmp = 'cns';
        break;
      case 8:
        tmp = 'idn';
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
    return tmp;
  }
  asString(indent, $super) {
    indent = indent === VOID ? new Indent() : indent;
    return $super === VOID ? this.h2f(indent) : $super.h2f.call(this, indent);
  }
  get name() {
    return this.e3();
  }
  get ordinal() {
    return this.f3();
  }
}
class PropertyName {
  constructor(value) {
    this.s30_1 = value;
  }
  b3() {
    return _PropertyName___get_value__impl__p219lh(this.s30_1);
  }
  toString() {
    return PropertyName__toString_impl_hcnfa7(this.s30_1);
  }
  hashCode() {
    return PropertyName__hashCode_impl_vxapw2(this.s30_1);
  }
  equals(other) {
    return PropertyName__equals_impl_oqi1da(this.s30_1, other);
  }
  get value() {
    return this.b3();
  }
}
class MethodName {
  constructor(value) {
    this.x3s_1 = value;
  }
  b3() {
    return _MethodName___get_value__impl__37ln07(this.x3s_1);
  }
  toString() {
    return MethodName__toString_impl_y7ited(this.x3s_1);
  }
  hashCode() {
    return MethodName__hashCode_impl_cgcwli(this.x3s_1);
  }
  equals(other) {
    return MethodName__equals_impl_j1h1r2(this.x3s_1, other);
  }
  get value() {
    return this.b3();
  }
}
class ParameterName {
  constructor(value) {
    this.y3s_1 = value;
  }
  b3() {
    return _ParameterName___get_value__impl__c8iwft(this.y3s_1);
  }
  toString() {
    return ParameterName__toString_impl_rf7x9v(this.y3s_1);
  }
  hashCode() {
    return ParameterName__hashCode_impl_luq7we(this.y3s_1);
  }
  equals(other) {
    return ParameterName__equals_impl_w9j8ey(this.y3s_1, other);
  }
  get value() {
    return this.b3();
  }
}
class TypeModelBuilder {
  constructor(name, resolveImports, namespaces) {
    this.name = name;
    this.j3b_1 = resolveImports;
    this.namespaces = namespaces;
    var tmp = this;
    // Inline function 'kotlin.also' call
    var this_0 = new TypeModelSimple(this.name);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this.namespaces.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      this_0.addNamespace(element);
    }
    tmp._model = this_0;
  }
  f2h() {
    return this.name;
  }
  z3s() {
    return this.namespaces;
  }
  a3t() {
    return this._model;
  }
  b3t(qualifiedName, imports, init) {
    var tmp = _QualifiedName___init__impl__8ed982(qualifiedName);
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(imports, 10));
    var _iterator__ex2g4s = imports.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = new Import(_Import___init__impl__786z8c(item));
      destination.r(tmp$ret$0);
    }
    var b = new TypeNamespaceBuilder(tmp, destination);
    init(b);
    var ns = b.build();
    this._model.addNamespace(ns);
    return ns;
  }
  namespace(qualifiedName, imports, init, $super) {
    imports = imports === VOID ? listOf(_QualifiedName___get_value__impl__nkc4gq(StdLibDefault_getInstance().t2e_1)) : imports;
    return $super === VOID ? this.b3t(qualifiedName, imports, init) : $super.b3t.call(this, qualifiedName, imports, init);
  }
  build() {
    if (this.j3b_1) {
      this._model.resolveImports();
    }
    return this._model;
  }
}
class StructuredTypeBuilder {
  constructor(_namespace, _typeReferences) {
    this._namespace = _namespace;
    this._typeReferences = _typeReferences;
    this.CON = PropertyCharacteristic_CONSTRUCTOR_getInstance();
    this.IDY = PropertyCharacteristic_IDENTITY_getInstance();
    this.CMP = PropertyCharacteristic_COMPOSITE_getInstance();
    this.REF = PropertyCharacteristic_REFERENCE_getInstance();
    this.VAL = PropertyCharacteristic_READ_ONLY_getInstance();
    this.VAR = PropertyCharacteristic_READ_WRITE_getInstance();
    this.STR = PropertyCharacteristic_STORED_getInstance();
    this.DER = PropertyCharacteristic_DERIVED_getInstance();
  }
  k3b() {
    return this._namespace;
  }
  c3t() {
    return this._typeReferences;
  }
  e3t() {
    return this.CON;
  }
  f3t() {
    return this.IDY;
  }
  g3t() {
    return this.CMP;
  }
  h3t() {
    return this.REF;
  }
  i3t() {
    return this.VAL;
  }
  j3t() {
    return this.VAR;
  }
  k3t() {
    return this.STR;
  }
  l3t() {
    return this.DER;
  }
  m3t(characteristics, propertyName, typeName, isNullable, init) {
    var tab = new TypeArgumentBuilder(this._structuredType, this._namespace);
    init(tab);
    var btargs = tab.build();
    var targs = btargs;
    var ti = this._namespace.createTypeInstance(this._structuredType.qualifiedName, get_asPossiblyQualifiedName(typeName), targs, isNullable);
    return this._structuredType.appendPropertyStored(_PropertyName___init__impl__sz2wu9(propertyName), ti, characteristics);
  }
  propertyOf(characteristics, propertyName, typeName, isNullable, init, $super) {
    isNullable = isNullable === VOID ? false : isNullable;
    var tmp;
    if (init === VOID) {
      tmp = StructuredTypeBuilder$propertyOf$lambda;
    } else {
      tmp = init;
    }
    init = tmp;
    return $super === VOID ? this.m3t(characteristics, propertyName, typeName, isNullable, init) : $super.m3t.call(this, characteristics, propertyName, typeName, isNullable, init);
  }
  propertyPrimitiveType(propertyName, typeName, isNullable, childIndex) {
    return this.property(propertyName, this._namespace.createTypeInstance(this._structuredType.qualifiedName, get_asPossiblyQualifiedName(typeName), emptyList(), isNullable), childIndex);
  }
  propertyListTypeOf(propertyName, dataTypeName, nullable, childIndex) {
    return this.propertyListType(propertyName, nullable, childIndex, StructuredTypeBuilder$propertyListTypeOf$lambda(dataTypeName));
  }
  propertyListType(propertyName, isNullable, childIndex, init) {
    var collType = StdLibDefault_getInstance().List.qualifiedName;
    var tb = new TypeInstanceArgBuilder(this._structuredType, this._namespace, new QualifiedName(collType), isNullable, this._typeReferences);
    init(tb);
    this._typeReferences.r(tb);
    var tu = tb.build();
    return this.property(propertyName, tu, childIndex);
  }
  propertyListSeparatedTypeOf(propertyName, itemTypeName, separatorTypeName, isNullable, childIndex) {
    var tmp0_elvis_lhs = this._namespace.findTypeNamed(get_asPossiblyQualifiedName(itemTypeName));
    var itemType = tmp0_elvis_lhs == null ? this._namespace.findOwnedOrCreateDataTypeNamed(_SimpleName___init__impl__6s45d0(itemTypeName)) : tmp0_elvis_lhs;
    var tmp1_elvis_lhs = this._namespace.findTypeNamed(get_asPossiblyQualifiedName(itemTypeName));
    var separatorType = tmp1_elvis_lhs == null ? this._namespace.findOwnedOrCreateDataTypeNamed(_SimpleName___init__impl__6s45d0(separatorTypeName)) : tmp1_elvis_lhs;
    var collType = StdLibDefault_getInstance().ListSeparated;
    var propType = collType.type(listOf_0([itemType.type().asTypeArgument, separatorType.type().asTypeArgument]), isNullable);
    return this.property(propertyName, propType, childIndex);
  }
  propertyListSeparatedType(propertyName, isNullable, childIndex, init) {
    var collType = StdLibDefault_getInstance().ListSeparated.qualifiedName;
    var tb = new TypeInstanceArgBuilder(this._structuredType, this._namespace, new QualifiedName(collType), isNullable, this._typeReferences);
    init(tb);
    this._typeReferences.r(tb);
    var tu = tb.build();
    return this.property(propertyName, tu, childIndex);
  }
  n3t(propertyName, isNullable, childIndex, init) {
    var tt = StdLibDefault_getInstance().TupleType;
    var b = new TypeInstanceArgNamedBuilder(this._structuredType, this._namespace, tt, isNullable, this._typeReferences);
    init(b);
    var tti = b.build();
    var collType = StdLibDefault_getInstance().List;
    var t = collType.type(listOf(tti.asTypeArgument));
    return this.property(propertyName, t, childIndex);
  }
  propertyListOfTupleType(propertyName, isNullable, childIndex, init, $super) {
    var tmp;
    if (init === VOID) {
      tmp = StructuredTypeBuilder$propertyListOfTupleType$lambda;
    } else {
      tmp = init;
    }
    init = tmp;
    return $super === VOID ? this.n3t(propertyName, isNullable, childIndex, init) : $super.n3t.call(this, propertyName, isNullable, childIndex, init);
  }
  propertyTupleType(propertyName, isNullable, childIndex, init) {
    var tt = StdLibDefault_getInstance().TupleType;
    var b = new TypeInstanceArgNamedBuilder(this._structuredType, this._namespace, tt, isNullable, this._typeReferences);
    init(b);
    var tti = b.build();
    return this.property(propertyName, tti, childIndex);
  }
  propertyDataTypeOf(propertyName, typeName, isNullable, childIndex) {
    var pqn = get_asPossiblyQualifiedName(typeName);
    var tmp0_elvis_lhs = this._namespace.findTypeNamed(pqn);
    var t = tmp0_elvis_lhs == null ? this._namespace.findOwnedOrCreateDataTypeNamed(pqn.simpleName) : tmp0_elvis_lhs;
    var ti = t.type(VOID, isNullable);
    return this.property(propertyName, ti, childIndex);
  }
  propertyUnionTypeOf(propertyName, typeName, isNullable, childIndex) {
    var pqn = get_asPossiblyQualifiedName(typeName);
    var tmp0_elvis_lhs = this._namespace.findTypeNamed(pqn);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp_0 = pqn.simpleName;
      tmp = this._namespace.findOwnedOrCreateUnionTypeNamed(tmp_0, StructuredTypeBuilder$propertyUnionTypeOf$lambda);
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var t = tmp;
    var ti = t.type(VOID, isNullable);
    return this.property(propertyName, ti, childIndex);
  }
  property(propertyName, typeUse, childIndex) {
    // Inline function 'kotlin.check' call
    if (!(childIndex >= this._structuredType.property.v())) {
      var message = 'Incorrect property index';
      throw IllegalStateException.v4(toString(message));
    }
    var characteristics = setOf(PropertyCharacteristic_COMPOSITE_getInstance());
    return this._structuredType.appendPropertyStored(_PropertyName___init__impl__sz2wu9(propertyName), typeUse, characteristics, childIndex);
  }
  get _structuredType() {
    return this.d3t();
  }
}
class ValueTypeBuilder extends StructuredTypeBuilder {
  constructor(_namespace, _typeReferences, _name) {
    super(_namespace, _typeReferences);
    var tmp = this;
    var tmp_0 = _namespace.findOwnedOrCreateValueTypeNamed(_name);
    tmp.o3t_1 = isInterface(tmp_0, ValueType) ? tmp_0 : THROW_CCE();
  }
  d3t() {
    return this.o3t_1;
  }
  p3t(typeDeclarationName, init) {
    var pqn = get_asPossiblyQualifiedName(typeDeclarationName);
    var tb = new TypeInstanceArgBuilder(this._structuredType, this._namespace, pqn, false, this._typeReferences);
    init(tb);
    var ti = tb.build();
    this.o3t_1.addSupertype(ti);
  }
  supertype(typeDeclarationName, init, $super) {
    var tmp;
    if (init === VOID) {
      tmp = ValueTypeBuilder$supertype$lambda;
    } else {
      tmp = init;
    }
    init = tmp;
    var tmp_0;
    if ($super === VOID) {
      this.p3t(typeDeclarationName, init);
      tmp_0 = Unit_instance;
    } else {
      tmp_0 = $super.p3t.call(this, typeDeclarationName, init);
    }
    return tmp_0;
  }
  constructor_(init) {
    var b = new ConstructorBuilder(this._namespace, this.o3t_1, this._typeReferences);
    init(b);
    var params = b.build();
    var tmp = this.o3t_1;
    (tmp instanceof ValueTypeSimple ? tmp : THROW_CCE()).addConstructor(params);
  }
  build() {
    return this.o3t_1;
  }
}
class InterfaceTypeBuilder extends StructuredTypeBuilder {
  constructor(_namespace, _typeReferences, _name) {
    super(_namespace, _typeReferences);
    var tmp = this;
    var tmp_0 = _namespace.findOwnedOrCreateInterfaceTypeNamed(_name);
    tmp.q3t_1 = isInterface(tmp_0, InterfaceType) ? tmp_0 : THROW_CCE();
  }
  d3t() {
    return this.q3t_1;
  }
  typeParameters(parameters) {
    var tmp = this.q3t_1.typeParameters;
    var tmp_0 = isInterface(tmp, KtMutableList) ? tmp : THROW_CCE();
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(parameters.length);
    var inductionVariable = 0;
    var last = parameters.length;
    while (inductionVariable < last) {
      var item = parameters[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      var tmp$ret$0 = new TypeParameterSimple(_SimpleName___init__impl__6s45d0(item));
      destination.r(tmp$ret$0);
    }
    tmp_0.x(destination);
  }
  p3t(typeDeclarationName, init) {
    var pqn = get_asPossiblyQualifiedName(typeDeclarationName);
    var tb = new TypeInstanceArgBuilder(this._structuredType, this._namespace, pqn, false, this._typeReferences);
    init(tb);
    var ti = tb.build();
    this.q3t_1.addSupertype(ti);
  }
  supertype(typeDeclarationName, init, $super) {
    var tmp;
    if (init === VOID) {
      tmp = InterfaceTypeBuilder$supertype$lambda;
    } else {
      tmp = init;
    }
    init = tmp;
    var tmp_0;
    if ($super === VOID) {
      this.p3t(typeDeclarationName, init);
      tmp_0 = Unit_instance;
    } else {
      tmp_0 = $super.p3t.call(this, typeDeclarationName, init);
    }
    return tmp_0;
  }
  subtypes(elementTypeName) {
    // Inline function 'kotlin.collections.forEach' call
    var inductionVariable = 0;
    var last = elementTypeName.length;
    while (inductionVariable < last) {
      var element = elementTypeName[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      var pqn = get_asPossiblyQualifiedName(element);
      var ti = this._namespace.createTypeInstance(this.q3t_1.qualifiedName, pqn, emptyList(), false);
      this.q3t_1.addSubtype(ti);
      var tmp = this._namespace.findTypeNamed(pqn);
      var tmp0_safe_receiver = (tmp == null ? true : isInterface(tmp, DataType)) ? tmp : THROW_CCE();
      if (tmp0_safe_receiver == null)
        null;
      else {
        tmp0_safe_receiver.addSupertype_dep(new QualifiedName(this.q3t_1.qualifiedName));
      }
    }
  }
  build() {
    return this.q3t_1;
  }
}
class DataTypeBuilder extends StructuredTypeBuilder {
  constructor(_namespace, _typeReferences, _name) {
    super(_namespace, _typeReferences);
    var tmp = this;
    var tmp_0 = _namespace.findOwnedOrCreateDataTypeNamed(_name);
    tmp.r3t_1 = isInterface(tmp_0, DataType) ? tmp_0 : THROW_CCE();
  }
  d3t() {
    return this.r3t_1;
  }
  typeParameters(parameters) {
    var tmp = this.r3t_1.typeParameters;
    var tmp_0 = isInterface(tmp, KtMutableList) ? tmp : THROW_CCE();
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(parameters.length);
    var inductionVariable = 0;
    var last = parameters.length;
    while (inductionVariable < last) {
      var item = parameters[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      var tmp$ret$0 = new TypeParameterSimple(_SimpleName___init__impl__6s45d0(item));
      destination.r(tmp$ret$0);
    }
    tmp_0.x(destination);
  }
  supertypes(superTypes) {
    // Inline function 'kotlin.collections.forEach' call
    var inductionVariable = 0;
    var last = superTypes.length;
    while (inductionVariable < last) {
      var element = superTypes[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      var pqn = get_asPossiblyQualifiedName(element);
      var ti = this._namespace.createTypeInstance(this.r3t_1.qualifiedName, pqn, emptyList(), false);
      this.r3t_1.addSupertype(ti);
    }
  }
  p3t(typeDeclarationName, init) {
    var pqn = get_asPossiblyQualifiedName(typeDeclarationName);
    var tb = new TypeInstanceArgBuilder(this._structuredType, this._namespace, pqn, false, this._typeReferences);
    init(tb);
    var ti = tb.build();
    this.r3t_1.addSupertype(ti);
  }
  supertype(typeDeclarationName, init, $super) {
    var tmp;
    if (init === VOID) {
      tmp = DataTypeBuilder$supertype$lambda;
    } else {
      tmp = init;
    }
    init = tmp;
    var tmp_0;
    if ($super === VOID) {
      this.p3t(typeDeclarationName, init);
      tmp_0 = Unit_instance;
    } else {
      tmp_0 = $super.p3t.call(this, typeDeclarationName, init);
    }
    return tmp_0;
  }
  subtypes(elementTypeName) {
    // Inline function 'kotlin.collections.forEach' call
    var inductionVariable = 0;
    var last = elementTypeName.length;
    while (inductionVariable < last) {
      var element = elementTypeName[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      var pqn = get_asPossiblyQualifiedName(element);
      var ti = this._namespace.createTypeInstance(this.r3t_1.qualifiedName, pqn, emptyList(), false);
      this.r3t_1.addSubtype(ti);
    }
  }
  constructor_(init) {
    var b = new ConstructorBuilder(this._namespace, this.r3t_1, this._typeReferences);
    init(b);
    var params = b.build();
    var tmp = this.r3t_1;
    (tmp instanceof DataTypeSimple ? tmp : THROW_CCE()).addConstructor(params);
  }
  build() {
    return this.r3t_1;
  }
}
class ConstructorBuilder {
  constructor(_namespace, _type, _typeReferences) {
    this._namespace = _namespace;
    this.s3t_1 = _type;
    this.t3t_1 = _typeReferences;
    this.CMP = PropertyCharacteristic_COMPOSITE_getInstance();
    this.REF = PropertyCharacteristic_REFERENCE_getInstance();
    this.VAL = PropertyCharacteristic_READ_ONLY_getInstance();
    this.VAR = PropertyCharacteristic_READ_WRITE_getInstance();
    this.DER = PropertyCharacteristic_DERIVED_getInstance();
    this.STR = PropertyCharacteristic_STORED_getInstance();
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.u3t_1 = ArrayList.y();
  }
  k3b() {
    return this._namespace;
  }
  g3t() {
    return this.CMP;
  }
  h3t() {
    return this.REF;
  }
  i3t() {
    return this.VAL;
  }
  j3t() {
    return this.VAR;
  }
  l3t() {
    return this.DER;
  }
  k3t() {
    return this.STR;
  }
  v3t(name, typeName, nullable) {
    var ty = this._namespace.createTypeInstance(this.s3t_1.qualifiedName, get_asPossiblyQualifiedName(typeName), emptyList(), nullable);
    this.u3t_1.r(new ParameterDefinitionSimple(_ParameterName___init__impl__84hwrp(name), ty, null));
  }
  parameter(name, typeName, nullable, $super) {
    nullable = nullable === VOID ? false : nullable;
    var tmp;
    if ($super === VOID) {
      this.v3t(name, typeName, nullable);
      tmp = Unit_instance;
    } else {
      tmp = $super.v3t.call(this, name, typeName, nullable);
    }
    return tmp;
  }
  build() {
    return this.u3t_1;
  }
}
class TypeInstanceArgBuilder {
  constructor(context, _namespace, possiblyQualifiedName, nullable, _typeReferences) {
    this.context = context;
    this._namespace = _namespace;
    this.possiblyQualifiedName = possiblyQualifiedName;
    this.nullable = nullable;
    this._typeReferences = _typeReferences;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.w3t_1 = ArrayList.y();
  }
  cs() {
    return this.context;
  }
  k3b() {
    return this._namespace;
  }
  o2u() {
    return this.possiblyQualifiedName;
  }
  x3t() {
    return this.nullable;
  }
  c3t() {
    return this._typeReferences;
  }
  ref(possiblyQualifiedTypeDeclarationName) {
    var pqn = get_asPossiblyQualifiedName(possiblyQualifiedTypeDeclarationName);
    var tmp;
    if (pqn instanceof QualifiedName) {
      var tmp1_safe_receiver = this.context;
      tmp = this._namespace.createTypeInstance(tmp1_safe_receiver == null ? null : tmp1_safe_receiver.qualifiedName, get_asPossiblyQualifiedName(possiblyQualifiedTypeDeclarationName), emptyList(), this.nullable);
    } else {
      if (pqn instanceof SimpleName) {
        var tmp2_safe_receiver = this.context;
        var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.typeParameters;
        var tmp_0;
        if (tmp3_safe_receiver == null) {
          tmp_0 = null;
        } else {
          var tmp$ret$1;
          $l$block: {
            // Inline function 'kotlin.collections.firstOrNull' call
            var _iterator__ex2g4s = tmp3_safe_receiver.s();
            while (_iterator__ex2g4s.t()) {
              var element = _iterator__ex2g4s.u();
              if (equals(new SimpleName(element.name), pqn)) {
                tmp$ret$1 = element;
                break $l$block;
              }
            }
            tmp$ret$1 = null;
          }
          tmp_0 = tmp$ret$1;
        }
        var tp = tmp_0;
        var tmp_1;
        if (null == tp || null == this.context) {
          var tmp4_safe_receiver = this.context;
          tmp_1 = this._namespace.createTypeInstance(tmp4_safe_receiver == null ? null : tmp4_safe_receiver.qualifiedName, get_asPossiblyQualifiedName(possiblyQualifiedTypeDeclarationName), emptyList(), this.nullable);
        } else {
          tmp_1 = new TypeParameterReference(this.context, tp.name);
        }
        tmp = tmp_1;
      } else {
        noWhenBranchMatchedException();
      }
    }
    var ti = tmp;
    this.w3t_1.r(ti.asTypeArgument);
  }
  build() {
    var tmp0_safe_receiver = this.context;
    return this._namespace.createTypeInstance(tmp0_safe_receiver == null ? null : tmp0_safe_receiver.qualifiedName, this.possiblyQualifiedName, this.w3t_1, this.nullable);
  }
}
class TypeInstanceArgNamedBuilder {
  constructor(context, _namespace, type, instanceIsNullable, _typeReferences) {
    this.context = context;
    this._namespace = _namespace;
    this.type = type;
    this.instanceIsNullable = instanceIsNullable;
    this._typeReferences = _typeReferences;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.y3t_1 = ArrayList.y();
  }
  cs() {
    return this.context;
  }
  k3b() {
    return this._namespace;
  }
  q2w() {
    return this.type;
  }
  z3t() {
    return this.instanceIsNullable;
  }
  c3t() {
    return this._typeReferences;
  }
  typeRef(name, typeName, isNullable) {
    var tmp0_safe_receiver = this._namespace.findTypeNamed(get_asPossiblyQualifiedName(typeName));
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.type(emptyList(), isNullable);
    var tmp;
    if (tmp1_elvis_lhs == null) {
      var tmp2_safe_receiver = this.context;
      tmp = this._namespace.createTypeInstance(tmp2_safe_receiver == null ? null : tmp2_safe_receiver.qualifiedName, get_asPossiblyQualifiedName(typeName), emptyList(), isNullable);
    } else {
      tmp = tmp1_elvis_lhs;
    }
    var t = tmp;
    var ta = new TypeArgumentNamedSimple(_PropertyName___init__impl__sz2wu9(name), t);
    this.y3t_1.r(ta);
  }
  tupleType(name, isNullable, init) {
    var tt = StdLibDefault_getInstance().TupleType;
    var b = new TypeInstanceArgNamedBuilder(this.context, this._namespace, tt, isNullable, this._typeReferences);
    init(b);
    var tti = b.build();
    var ta = new TypeArgumentNamedSimple(_PropertyName___init__impl__sz2wu9(name), tti);
    this.y3t_1.r(ta);
  }
  build() {
    return this.type.type(this.y3t_1, this.instanceIsNullable);
  }
}
class TypeArgumentBuilder {
  constructor(_context, _namespace) {
    this.a3u_1 = _context;
    this.b3u_1 = _namespace;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp.c3u_1 = ArrayList.y();
  }
  d3u(possiblyQualifiedTypeDeclarationName, nullable, typeArguments) {
    var tab = new TypeArgumentBuilder(this.a3u_1, this.b3u_1);
    typeArguments(tab);
    var typeArgs = tab.build();
    var pqn = get_asPossiblyQualifiedName(possiblyQualifiedTypeDeclarationName);
    var tmp;
    if (pqn instanceof QualifiedName) {
      var tmp1_safe_receiver = this.a3u_1;
      tmp = this.b3u_1.createTypeInstance(tmp1_safe_receiver == null ? null : tmp1_safe_receiver.qualifiedName, get_asPossiblyQualifiedName(possiblyQualifiedTypeDeclarationName), typeArgs, nullable);
    } else {
      if (pqn instanceof SimpleName) {
        var tmp2_safe_receiver = this.a3u_1;
        var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.typeParameters;
        var tmp_0;
        if (tmp3_safe_receiver == null) {
          tmp_0 = null;
        } else {
          var tmp$ret$1;
          $l$block: {
            // Inline function 'kotlin.collections.firstOrNull' call
            var _iterator__ex2g4s = tmp3_safe_receiver.s();
            while (_iterator__ex2g4s.t()) {
              var element = _iterator__ex2g4s.u();
              if (equals(new SimpleName(element.name), pqn)) {
                tmp$ret$1 = element;
                break $l$block;
              }
            }
            tmp$ret$1 = null;
          }
          tmp_0 = tmp$ret$1;
        }
        var tp = tmp_0;
        var tmp_1;
        if (null == tp || null == this.a3u_1) {
          var tmp4_safe_receiver = this.a3u_1;
          tmp_1 = this.b3u_1.createTypeInstance(tmp4_safe_receiver == null ? null : tmp4_safe_receiver.qualifiedName, get_asPossiblyQualifiedName(possiblyQualifiedTypeDeclarationName), typeArgs, nullable);
        } else {
          tmp_1 = new TypeParameterReference(this.a3u_1, tp.name);
        }
        tmp = tmp_1;
      } else {
        noWhenBranchMatchedException();
      }
    }
    var ti = tmp;
    this.c3u_1.r(ti.asTypeArgument);
  }
  typeArgument(possiblyQualifiedTypeDeclarationName, nullable, typeArguments, $super) {
    nullable = nullable === VOID ? false : nullable;
    var tmp;
    if (typeArguments === VOID) {
      tmp = TypeArgumentBuilder$typeArgument$lambda;
    } else {
      tmp = typeArguments;
    }
    typeArguments = tmp;
    var tmp_0;
    if ($super === VOID) {
      this.d3u(possiblyQualifiedTypeDeclarationName, nullable, typeArguments);
      tmp_0 = Unit_instance;
    } else {
      tmp_0 = $super.d3u.call(this, possiblyQualifiedTypeDeclarationName, nullable, typeArguments);
    }
    return tmp_0;
  }
  build() {
    return this.c3u_1;
  }
}
class SubtypeListBuilder {
  constructor(_namespace, _typeReferences) {
    this._namespace = _namespace;
    this.e3u_1 = _typeReferences;
    var tmp = this;
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp._subtypeList = ArrayList.y();
  }
  k3b() {
    return this._namespace;
  }
  f3u() {
    return this._subtypeList;
  }
  g3u(typeName, isNullable) {
    var pqn = get_asPossiblyQualifiedName(typeName);
    var ti = this._namespace.createTypeInstance(null, pqn, emptyList(), isNullable);
    this._subtypeList.r(ti);
  }
  typeRef(typeName, isNullable, $super) {
    isNullable = isNullable === VOID ? false : isNullable;
    var tmp;
    if ($super === VOID) {
      this.g3u(typeName, isNullable);
      tmp = Unit_instance;
    } else {
      tmp = $super.g3u.call(this, typeName, isNullable);
    }
    return tmp;
  }
  h3u(isNullable, init) {
    var collType = StdLibDefault_getInstance().List.qualifiedName;
    var tb = new TypeInstanceArgBuilder(null, this._namespace, new QualifiedName(collType), isNullable, this.e3u_1);
    init(tb);
    this.e3u_1.r(tb);
    var tu = tb.build();
    this._subtypeList.r(tu);
  }
  listType(isNullable, init, $super) {
    isNullable = isNullable === VOID ? false : isNullable;
    var tmp;
    if ($super === VOID) {
      this.h3u(isNullable, init);
      tmp = Unit_instance;
    } else {
      tmp = $super.h3u.call(this, isNullable, init);
    }
    return tmp;
  }
  i3u(isNullable, init) {
    var collType = StdLibDefault_getInstance().ListSeparated.qualifiedName;
    var tb = new TypeInstanceArgBuilder(null, this._namespace, new QualifiedName(collType), isNullable, this.e3u_1);
    init(tb);
    this.e3u_1.r(tb);
    var tu = tb.build();
    this._subtypeList.r(tu);
  }
  listSeparatedType(isNullable, init, $super) {
    isNullable = isNullable === VOID ? false : isNullable;
    var tmp;
    if ($super === VOID) {
      this.i3u(isNullable, init);
      tmp = Unit_instance;
    } else {
      tmp = $super.i3u.call(this, isNullable, init);
    }
    return tmp;
  }
  j3u(isNullable, init) {
    var tt = StdLibDefault_getInstance().TupleType;
    var b = new TypeInstanceArgNamedBuilder(null, this._namespace, tt, isNullable, this.e3u_1);
    init(b);
    var tti = b.build();
    this._subtypeList.r(tti);
  }
  tupleType(isNullable, init, $super) {
    isNullable = isNullable === VOID ? false : isNullable;
    var tmp;
    if ($super === VOID) {
      this.j3u(isNullable, init);
      tmp = Unit_instance;
    } else {
      tmp = $super.j3u.call(this, isNullable, init);
    }
    return tmp;
  }
  build() {
    return this._subtypeList;
  }
}
class TypeModelDslMarker {
  equals(other) {
    if (!(other instanceof TypeModelDslMarker))
      return false;
    other instanceof TypeModelDslMarker || THROW_CCE();
    return true;
  }
  hashCode() {
    return 0;
  }
  toString() {
    return '@net.akehurst.language.typemodel.builder.TypeModelDslMarker(' + ')';
  }
}
//endregion
var BuildConfig_instance;
function BuildConfig_getInstance() {
  return BuildConfig_instance;
}
function CompletionItemKind$values$ref() {
  var l = () => values();
  l.callableName = 'values';
  return l;
}
function ParserKind$values$ref() {
  var l = () => values_0();
  l.callableName = 'values';
  return l;
}
function Associativity$values$ref() {
  var l = () => values_1();
  l.callableName = 'values';
  return l;
}
function ChoiceIndicator$values$ref() {
  var l = () => values_2();
  l.callableName = 'values';
  return l;
}
function OverrideKind$values$ref() {
  var l = () => values_3();
  l.callableName = 'values';
  return l;
}
function SeparatedListKind$values$ref() {
  var l = () => values_4();
  l.callableName = 'values';
  return l;
}
function AglStyleSelectorKind$values$ref() {
  var l = () => values_5();
  l.callableName = 'values';
  return l;
}
function PropertyCharacteristic$values$ref() {
  var l = () => values_6();
  l.callableName = 'values';
  return l;
}
var KotlinxReflectForModule_instance;
function KotlinxReflectForModule_getInstance() {
  return KotlinxReflectForModule_instance;
}
function Agl$configurationFromLanguageObject$lambda($languageObject) {
  return (p) => new ProcessResultDefault($languageObject.typesModel);
}
function Agl$configurationFromLanguageObject$lambda_0($languageObject) {
  return (p) => new ProcessResultDefault($languageObject.asmTransformModel);
}
function Agl$configurationFromLanguageObject$lambda_1($languageObject) {
  return (p) => new ProcessResultDefault($languageObject.crossReferenceModel);
}
function Agl$configurationFromLanguageObject$lambda_2($languageObject) {
  return (p) => new ProcessResultDefault($languageObject.syntaxAnalyser);
}
function Agl$configurationFromLanguageObject$lambda_3($languageObject) {
  return (p) => new ProcessResultDefault($languageObject.semanticAnalyser);
}
function Agl$configurationFromLanguageObject$lambda_4($languageObject) {
  return (p) => new ProcessResultDefault($languageObject.formatModel);
}
function Agl$configurationFromLanguageObject$lambda_5($languageObject) {
  return (p) => new ProcessResultDefault($languageObject.styleModel);
}
function Agl$configurationFromLanguageObject$lambda_6($languageObject) {
  return (p) => new ProcessResultDefault($languageObject.completionProvider);
}
function Agl$processorFromStringSimple$lambda($this$options) {
  $this$options.semanticAnalysis(Agl$processorFromStringSimple$lambda$lambda);
  return Unit_instance;
}
function Agl$processorFromStringSimple$lambda$lambda($this$semanticAnalysis) {
  $this$semanticAnalysis.context(ContextFromGrammarRegistry(Agl_getInstance().registry));
  return Unit_instance;
}
function Agl$processorFromStringSimple$lambda$lambda_0($typeStr) {
  return (p) => Companion_instance_30.fromString(_SimpleName___init__impl__6s45d0('FromGrammar' + _SimpleName___get_value__impl__rl2r3c(ensureNotNull(p.grammarModel).name)), contextFromGrammar(ensureNotNull(p.grammarModel)), $typeStr);
}
function Agl$processorFromStringSimple$lambda$lambda_1($transformStr) {
  return (p) => Companion_instance_29.fromString(new ContextFromGrammarAndTypeModel(ensureNotNull(p.grammarModel), p.baseTypeModel), $transformStr);
}
function Agl$processorFromStringSimple$lambda$lambda_2($referenceStr) {
  return (p) => Companion_getInstance_24().fromString(new ContextFromTypeModel(p.typesModel), $referenceStr);
}
function Agl$processorFromStringSimple$lambda$lambda_3($styleStr) {
  return (p) => Companion_getInstance_28().fromString(contextFromGrammar(ensureNotNull(p.grammarModel)), $styleStr);
}
function Agl$processorFromStringSimple$lambda$lambda_4($formatterModelStr) {
  return (p) => Companion_instance_15.fromString(contextFromTypeModel(p.typesModel), $formatterModelStr);
}
function Agl$processorFromStringSimple$lambda_0($typeStr, $transformStr, $referenceStr, $styleStr, $formatterModelStr) {
  return ($this$configuration) => {
    var tmp;
    var tmp_0 = $typeStr;
    if (!(null == (tmp_0 == null ? null : new TypesString(tmp_0)))) {
      $this$configuration.typesResolver(Agl$processorFromStringSimple$lambda$lambda_0($typeStr));
      tmp = Unit_instance;
    }
    var tmp_1;
    var tmp_2 = $transformStr;
    if (!(null == (tmp_2 == null ? null : new TransformString(tmp_2)))) {
      $this$configuration.transformResolver(Agl$processorFromStringSimple$lambda$lambda_1($transformStr));
      tmp_1 = Unit_instance;
    }
    var tmp_3;
    var tmp_4 = $referenceStr;
    if (!(null == (tmp_4 == null ? null : new CrossReferenceString(tmp_4)))) {
      $this$configuration.crossReferenceResolver(Agl$processorFromStringSimple$lambda$lambda_2($referenceStr));
      tmp_3 = Unit_instance;
    }
    var tmp_5;
    var tmp_6 = $styleStr;
    if (!(null == (tmp_6 == null ? null : new StyleString(tmp_6)))) {
      $this$configuration.styleResolver(Agl$processorFromStringSimple$lambda$lambda_3($styleStr));
      tmp_5 = Unit_instance;
    }
    var tmp_7;
    var tmp_8 = $formatterModelStr;
    if (!(null == (tmp_8 == null ? null : new FormatString(tmp_8)))) {
      $this$configuration.formatResolver(Agl$processorFromStringSimple$lambda$lambda_4($formatterModelStr));
      tmp_7 = Unit_instance;
    }
    return Unit_instance;
  };
}
function Agl$processorFromStringSimpleJava$lambda($this$options) {
  $this$options.semanticAnalysis(Agl$processorFromStringSimpleJava$lambda$lambda);
  return Unit_instance;
}
function Agl$processorFromStringSimpleJava$lambda$lambda($this$semanticAnalysis) {
  $this$semanticAnalysis.context(ContextFromGrammarRegistry(Agl_getInstance().registry));
  return Unit_instance;
}
function Agl$processorFromString$lambda($this$options) {
  $this$options.semanticAnalysis(Agl$processorFromString$lambda$lambda);
  return Unit_instance;
}
function Agl$processorFromString$lambda$lambda($this$semanticAnalysis) {
  $this$semanticAnalysis.context(ContextFromGrammarRegistry(Agl_getInstance().registry));
  return Unit_instance;
}
function Agl$grammarFromString$lambda($this$options) {
  $this$options.semanticAnalysis(Agl$grammarFromString$lambda$lambda);
  return Unit_instance;
}
function Agl$grammarFromString$lambda$lambda($this$semanticAnalysis) {
  $this$semanticAnalysis.context(ContextFromGrammarRegistry(Agl_getInstance().registry));
  return Unit_instance;
}
function Agl$languageDefinitionFromString$lambda($this$options) {
  $this$options.semanticAnalysis(Agl$languageDefinitionFromString$lambda$lambda);
  return Unit_instance;
}
function Agl$languageDefinitionFromString$lambda$lambda($this$semanticAnalysis) {
  $this$semanticAnalysis.context(ContextFromGrammarRegistry(Agl_getInstance().registry));
  return Unit_instance;
}
function Agl$languageDefinitionFromString$lambda_0($grammarDefinitionStr, $typeStr, $transformStr, $referenceStr, $styleStr, $formatterModelStr) {
  return ($this$configuration) => {
    $this$configuration.grammarString($grammarDefinitionStr);
    $this$configuration.typesString($typeStr);
    $this$configuration.transformString($transformStr);
    $this$configuration.crossReferenceString($referenceStr);
    $this$configuration.styleString($styleStr);
    $this$configuration.formatString($formatterModelStr);
    return Unit_instance;
  };
}
function Agl$languageDefinitionFromStringSimple$lambda($this$options) {
  $this$options.semanticAnalysis(Agl$languageDefinitionFromStringSimple$lambda$lambda);
  return Unit_instance;
}
function Agl$languageDefinitionFromStringSimple$lambda$lambda($this$semanticAnalysis) {
  $this$semanticAnalysis.context(ContextFromGrammarRegistry(Agl_getInstance().registry));
  return Unit_instance;
}
function Agl$languageDefinitionFromStringSimple$lambda_0($grammarDefinitionStr, $typeStr, $transformStr, $referenceStr, $styleStr, $formatterModelStr) {
  return ($this$configuration) => {
    $this$configuration.grammarString($grammarDefinitionStr);
    $this$configuration.typesString($typeStr);
    $this$configuration.transformString($transformStr);
    $this$configuration.crossReferenceString($referenceStr);
    $this$configuration.styleString($styleStr);
    $this$configuration.formatString($formatterModelStr);
    return Unit_instance;
  };
}
var Agl_instance;
function Agl_getInstance() {
  if (Agl_instance === VOID)
    new Agl_0();
  return Agl_instance;
}
function CompletionProviderAbstract$Companion$defaultSortAndFilter$lambda(a, b) {
  // Inline function 'kotlin.comparisons.compareValuesBy' call
  var tmp = b.kind;
  var tmp$ret$1 = a.kind;
  return compareValues(tmp, tmp$ret$1);
}
function CompletionProviderAbstract$Companion$defaultSortAndFilter$lambda_0($this) {
  return (a, b) => {
    var previousCompare = $this.compare(a, b);
    var tmp;
    if (!(previousCompare === 0)) {
      tmp = previousCompare;
    } else {
      // Inline function 'kotlin.comparisons.compareValuesBy' call
      var tmp_0 = a.label;
      var tmp$ret$1 = b.label;
      tmp = compareValues(tmp_0, tmp$ret$1);
    }
    return tmp;
  };
}
function CompletionProviderAbstract$Companion$defaultSortAndFilter$lambda_1($this) {
  return (a, b) => {
    var previousCompare = $this.compare(a, b);
    var tmp;
    if (!(previousCompare === 0)) {
      tmp = previousCompare;
    } else {
      // Inline function 'kotlin.comparisons.compareValuesBy' call
      var tmp_0 = b.text.length;
      var tmp$ret$1 = a.text.length;
      tmp = compareValues(tmp_0, tmp$ret$1);
    }
    return tmp;
  };
}
function CompletionProviderAbstract$Companion$defaultSortAndFilter$lambda_2($this) {
  return (a, b) => {
    var previousCompare = $this.compare(a, b);
    var tmp;
    if (!(previousCompare === 0)) {
      tmp = previousCompare;
    } else {
      // Inline function 'kotlin.comparisons.compareValuesBy' call
      var tmp_0 = b.text;
      var tmp$ret$1 = a.text;
      tmp = compareValues(tmp_0, tmp$ret$1);
    }
    return tmp;
  };
}
function CompletionProviderAbstract$Companion$expandItem$lambda(exp) {
  return null;
}
function CompletionProviderAbstract$Companion$expandItem$lambda_0(exp) {
  return exp.name;
}
function CompletionProviderAbstract$Companion$textFor$lambda($options) {
  return (it) => Companion_instance_0.textFor(it, $options).list;
}
function CompletionProviderAbstract$Companion$textFor$lambda_0($options) {
  return (it) => Companion_instance_0.textFor(it, $options).list;
}
var Companion_instance_0;
function Companion_getInstance_2() {
  return Companion_instance_0;
}
function SpineDefault$expectedNextLeafNonTerminalOrTerminal$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = this$0.c1t_1.expectedNextTerminals;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var rr = item instanceof RuntimeRule ? item : THROW_CCE();
      var tmp = this$0.d1t_1(rr.runtimeRuleSetNumber, rr.ruleNumber);
      var tmp$ret$0 = (!(tmp == null) ? isInterface(tmp, TangibleItem) : false) ? tmp : THROW_CCE();
      destination.r(tmp$ret$0);
    }
    return toSet(destination);
  };
}
function SpineDefault$expectedNextRuleItems$delegate$lambda(this$0) {
  return () => this$0.elements.z(0).nextExpectedItems;
}
function SpineDefault$elements$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = this$0.c1t_1.elements;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var rp = item instanceof RulePositionRuntime ? item : THROW_CCE();
      var tmp;
      if (rp.isGoal) {
        var tmp_0 = rp.er_1.rhs;
        var rr = (tmp_0 instanceof RuntimeRuleRhsGoal ? tmp_0 : THROW_CCE()).userGoalRuleItem;
        var tmp0_elvis_lhs = this$0.d1t_1(rr.runtimeRuleSetNumber, rr.ruleNumber);
        var tmp_1;
        if (tmp0_elvis_lhs == null) {
          var message = "No Grammar Rule item for root runtime-rule '" + rr.toString() + "'";
          throw IllegalStateException.v4(toString(message));
        } else {
          tmp_1 = tmp0_elvis_lhs;
        }
        var gr = tmp_1;
        tmp = new SpineNodeRoot(gr);
      } else {
        var tmp_2 = item.er_1;
        var rr_0 = tmp_2 instanceof RuntimeRule ? tmp_2 : THROW_CCE();
        var tmp1_elvis_lhs = this$0.d1t_1(rr_0.runtimeRuleSetNumber, rr_0.ruleNumber);
        var tmp_3;
        if (tmp1_elvis_lhs == null) {
          var message_0 = "No Grammar Rule item for runtime-rule '" + rr_0.toString() + "'";
          throw IllegalStateException.v4(toString(message_0));
        } else {
          tmp_3 = tmp1_elvis_lhs;
        }
        var ri = tmp_3;
        tmp = new SpineNodeDefault(ri, item.gr_1);
      }
      var tmp$ret$0 = tmp;
      destination.r(tmp$ret$0);
    }
    return destination;
  };
}
function SpineDefault$toString$lambda(it) {
  return toString(it);
}
function expectedNextLeafNonTerminalOrTerminal$factory() {
  return getPropertyCallableRef('expectedNextLeafNonTerminalOrTerminal', 1, KProperty1, (receiver) => receiver.expectedNextLeafNonTerminalOrTerminal, null);
}
function expectedNextRuleItems$factory() {
  return getPropertyCallableRef('expectedNextRuleItems', 1, KProperty1, (receiver) => receiver.expectedNextRuleItems, null);
}
function elements$factory() {
  return getPropertyCallableRef('elements', 1, KProperty1, (receiver) => receiver.elements, null);
}
function LanguageDefinitionAbstract$_processor_cache$lambda(this$0, $argBuildForDefaultGoal) {
  return () => {
    var tg = this$0.targetGrammar;
    var gm = this$0.grammarModel;
    var tmp;
    if (null == tg || null == gm) {
      tmp = null;
    } else {
      var proc = Agl_getInstance().processorFromGrammar(gm, this$0.configuration);
      if ($argBuildForDefaultGoal) {
        proc.buildFor(null);
      }
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s = this$0.processorObservers.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        element(null, proc);
      }
      tmp = proc;
    }
    return tmp;
  };
}
function LanguageDefinitionAbstract$_processor_cache$lambda_0(this$0) {
  return (old) => {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this$0.processorObservers.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      element(old, null);
    }
    return Unit_instance;
  };
}
function LanguageDefinitionAbstract$_style_cache$lambda(this$0) {
  return () => {
    var tmp0_safe_receiver = this$0._styleResolver;
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      var p = this$0.processor;
      var tmp_0;
      if (null == p) {
        tmp_0 = null;
      } else {
        var r = tmp0_safe_receiver(p);
        this$0._issues.addAllFrom(r.allIssues);
        tmp_0 = r.asm;
      }
      tmp = tmp_0;
    }
    return tmp;
  };
}
function grammarModel$factory() {
  return getPropertyCallableRef('grammarModel', 1, KMutableProperty1, (receiver) => receiver.grammarModel, (receiver, value) => receiver.grammarModel = value);
}
function grammarModel$factory_0() {
  return getPropertyCallableRef('grammarModel', 1, KMutableProperty1, (receiver) => receiver.grammarModel, (receiver, value) => receiver.grammarModel = value);
}
function targetGrammarName$factory() {
  return getPropertyCallableRef('targetGrammarName', 1, KMutableProperty1, (receiver) => {
    var tmp = receiver.targetGrammarName;
    return tmp == null ? null : new SimpleName(tmp);
  }, (receiver, value) => {
    var tmp = value;
    return receiver.targetGrammarName = tmp == null ? null : tmp.a1u_1;
  });
}
function targetGrammarName$factory_0() {
  return getPropertyCallableRef('targetGrammarName', 1, KMutableProperty1, (receiver) => {
    var tmp = receiver.targetGrammarName;
    return tmp == null ? null : new SimpleName(tmp);
  }, (receiver, value) => {
    var tmp = value;
    return receiver.targetGrammarName = tmp == null ? null : tmp.a1u_1;
  });
}
function defaultGoalRule$factory() {
  return getPropertyCallableRef('defaultGoalRule', 1, KMutableProperty1, (receiver) => {
    var tmp = receiver.defaultGoalRule;
    return tmp == null ? null : new GrammarRuleName(tmp);
  }, (receiver, value) => {
    var tmp = value;
    return receiver.defaultGoalRule = tmp == null ? null : tmp.d1u_1;
  });
}
function defaultGoalRule$factory_0() {
  return getPropertyCallableRef('defaultGoalRule', 1, KMutableProperty1, (receiver) => {
    var tmp = receiver.defaultGoalRule;
    return tmp == null ? null : new GrammarRuleName(tmp);
  }, (receiver, value) => {
    var tmp = value;
    return receiver.defaultGoalRule = tmp == null ? null : tmp.d1u_1;
  });
}
function _styleResolver$factory() {
  return getPropertyCallableRef('_styleResolver', 1, KMutableProperty1, (receiver) => receiver._styleResolver, (receiver, value) => receiver._styleResolver = value);
}
function _styleResolver$factory_0() {
  return getPropertyCallableRef('_styleResolver', 1, KMutableProperty1, (receiver) => receiver._styleResolver, (receiver, value) => receiver._styleResolver = value);
}
function notifyGrammarStringObservers($this, oldValue, newValue) {
  var tmp = oldValue;
  var tmp_0 = tmp == null ? null : new GrammarString(tmp);
  var tmp_1 = newValue;
  if (!equals(tmp_0, tmp_1 == null ? null : new GrammarString(tmp_1))) {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $this.grammarStrObservers.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp_2 = oldValue;
      var tmp_3 = tmp_2 == null ? null : new GrammarString(tmp_2);
      var tmp_4 = newValue;
      element(tmp_3, tmp_4 == null ? null : new GrammarString(tmp_4));
    }
  }
}
function notifyTypesStringObservers($this, oldValue, newValue) {
  var tmp = oldValue;
  var tmp_0 = tmp == null ? null : new TypesString(tmp);
  var tmp_1 = newValue;
  if (!equals(tmp_0, tmp_1 == null ? null : new TypesString(tmp_1))) {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $this.typeModelStrObservers.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp_2 = oldValue;
      var tmp_3 = tmp_2 == null ? null : new TypesString(tmp_2);
      var tmp_4 = newValue;
      element(tmp_3, tmp_4 == null ? null : new TypesString(tmp_4));
    }
  }
}
function notifyTransformStringObservers($this, oldValue, newValue) {
  var tmp = oldValue;
  var tmp_0 = tmp == null ? null : new TransformString(tmp);
  var tmp_1 = newValue;
  if (!equals(tmp_0, tmp_1 == null ? null : new TransformString(tmp_1))) {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $this.asmTransformStrObservers.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp_2 = oldValue;
      var tmp_3 = tmp_2 == null ? null : new TransformString(tmp_2);
      var tmp_4 = newValue;
      element(tmp_3, tmp_4 == null ? null : new TransformString(tmp_4));
    }
  }
}
function notifyCrossReferenceStringObservers($this, oldValue, newValue) {
  var tmp = oldValue;
  var tmp_0 = tmp == null ? null : new CrossReferenceString(tmp);
  var tmp_1 = newValue;
  if (!equals(tmp_0, tmp_1 == null ? null : new CrossReferenceString(tmp_1))) {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $this.crossReferenceStrObservers.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp_2 = oldValue;
      var tmp_3 = tmp_2 == null ? null : new CrossReferenceString(tmp_2);
      var tmp_4 = newValue;
      element(tmp_3, tmp_4 == null ? null : new CrossReferenceString(tmp_4));
    }
  }
}
function notifyStyleStringObservers($this, oldValue, newValue) {
  var tmp = oldValue;
  var tmp_0 = tmp == null ? null : new StyleString(tmp);
  var tmp_1 = newValue;
  if (!equals(tmp_0, tmp_1 == null ? null : new StyleString(tmp_1))) {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $this.styleStrObservers.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp_2 = oldValue;
      var tmp_3 = tmp_2 == null ? null : new StyleString(tmp_2);
      var tmp_4 = newValue;
      element(tmp_3, tmp_4 == null ? null : new StyleString(tmp_4));
    }
  }
}
function notifyFormatStringObservers($this, oldValue, newValue) {
  var tmp = oldValue;
  var tmp_0 = tmp == null ? null : new FormatString(tmp);
  var tmp_1 = newValue;
  if (!equals(tmp_0, tmp_1 == null ? null : new FormatString(tmp_1))) {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $this.formatterStrObservers.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp_2 = oldValue;
      var tmp_3 = tmp_2 == null ? null : new FormatString(tmp_2);
      var tmp_4 = newValue;
      element(tmp_3, tmp_4 == null ? null : new FormatString(tmp_4));
    }
  }
}
function LanguageDefinitionDefault$update$lambda($grammarString, $typesString, $transformString, $crossReferenceString, $styleString, $formatString) {
  return ($this$configuration) => {
    var tmp0_safe_receiver = $grammarString;
    var tmp = tmp0_safe_receiver;
    if ((tmp == null ? null : new GrammarString(tmp)) == null)
      null;
    else {
      var tmp_0 = tmp0_safe_receiver;
      // Inline function 'kotlin.let' call
      var it = (tmp_0 == null ? null : new GrammarString(tmp_0)).u1v_1;
      $this$configuration.grammarString(it);
    }
    var tmp1_safe_receiver = $typesString;
    var tmp_1 = tmp1_safe_receiver;
    if ((tmp_1 == null ? null : new TypesString(tmp_1)) == null)
      null;
    else {
      var tmp_2 = tmp1_safe_receiver;
      // Inline function 'kotlin.let' call
      var it_0 = (tmp_2 == null ? null : new TypesString(tmp_2)).e1s_1;
      $this$configuration.typesString(it_0);
    }
    var tmp2_safe_receiver = $transformString;
    var tmp_3 = tmp2_safe_receiver;
    if ((tmp_3 == null ? null : new TransformString(tmp_3)) == null)
      null;
    else {
      var tmp_4 = tmp2_safe_receiver;
      // Inline function 'kotlin.let' call
      var it_1 = (tmp_4 == null ? null : new TransformString(tmp_4)).f1s_1;
      $this$configuration.transformString(it_1);
    }
    var tmp3_safe_receiver = $crossReferenceString;
    var tmp_5 = tmp3_safe_receiver;
    if ((tmp_5 == null ? null : new CrossReferenceString(tmp_5)) == null)
      null;
    else {
      var tmp_6 = tmp3_safe_receiver;
      // Inline function 'kotlin.let' call
      var it_2 = (tmp_6 == null ? null : new CrossReferenceString(tmp_6)).g1s_1;
      $this$configuration.crossReferenceString(it_2);
    }
    var tmp4_safe_receiver = $styleString;
    var tmp_7 = tmp4_safe_receiver;
    if ((tmp_7 == null ? null : new StyleString(tmp_7)) == null)
      null;
    else {
      var tmp_8 = tmp4_safe_receiver;
      // Inline function 'kotlin.let' call
      var it_3 = (tmp_8 == null ? null : new StyleString(tmp_8)).h1s_1;
      $this$configuration.styleString(it_3);
    }
    var tmp5_safe_receiver = $formatString;
    var tmp_9 = tmp5_safe_receiver;
    if ((tmp_9 == null ? null : new FormatString(tmp_9)) == null)
      null;
    else {
      var tmp_10 = tmp5_safe_receiver;
      // Inline function 'kotlin.let' call
      var it_4 = (tmp_10 == null ? null : new FormatString(tmp_10)).i1s_1;
      $this$configuration.formatString(it_4);
    }
    return Unit_instance;
  };
}
function LanguageProcessorAbstract$scanner$delegate$lambda(this$0) {
  return () => {
    var tmp0_safe_receiver = this$0.configuration.scannerResolver;
    var res = tmp0_safe_receiver == null ? null : tmp0_safe_receiver(this$0);
    if (res == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      this$0.issues.addAllFrom(res.allIssues);
    }
    return res == null ? null : res.asm;
  };
}
function LanguageProcessorAbstract$parser$delegate$lambda(this$0) {
  return () => {
    var tmp0_safe_receiver = this$0.configuration.parserResolver;
    var res = tmp0_safe_receiver == null ? null : tmp0_safe_receiver(this$0);
    if (res == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      this$0.issues.addAllFrom(res.allIssues);
    }
    return res == null ? null : res.asm;
  };
}
function LanguageProcessorAbstract$spptParser$delegate$lambda(this$0) {
  return () => {
    var tmp0_safe_receiver = this$0.targetGrammar;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.allResolvedEmbeddedGrammars;
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.collections.map' call
      // Inline function 'kotlin.collections.mapTo' call
      var destination = ArrayList.w(collectionSizeOrDefault(tmp1_safe_receiver, 10));
      var _iterator__ex2g4s = tmp1_safe_receiver.s();
      while (_iterator__ex2g4s.t()) {
        var item = _iterator__ex2g4s.u();
        var cvt = new ConverterToRuntimeRules(item);
        var rrs = cvt.jr();
        var tmp$ret$0 = new Pair(_QualifiedName___get_value__impl__nkc4gq(item.qualifiedName), rrs);
        destination.r(tmp$ret$0);
      }
      tmp = destination;
    }
    var tmp2_safe_receiver = tmp;
    var tmp_0;
    if (tmp2_safe_receiver == null) {
      tmp_0 = null;
    } else {
      // Inline function 'kotlin.collections.associate' call
      var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(tmp2_safe_receiver, 10)), 16);
      // Inline function 'kotlin.collections.associateTo' call
      var destination_0 = LinkedHashMap.kb(capacity);
      var _iterator__ex2g4s_0 = tmp2_safe_receiver.s();
      while (_iterator__ex2g4s_0.t()) {
        var element = _iterator__ex2g4s_0.u();
        // Inline function 'kotlin.collections.plusAssign' call
        destination_0.r2(element.zg_1, element.ah_1);
      }
      tmp_0 = destination_0;
    }
    var tmp3_elvis_lhs = tmp_0;
    var embeddedRuntimeRuleSets = tmp3_elvis_lhs == null ? emptyMap() : tmp3_elvis_lhs;
    var tmp_1 = this$0.parser;
    return new SPPTParserDefault((tmp_1 instanceof LeftCornerParser ? tmp_1 : THROW_CCE()).ruleSet, embeddedRuntimeRuleSets);
  };
}
function LanguageProcessorAbstract$defaultGoalRuleName$delegate$lambda(this$0) {
  return () => {
    var tmp0_elvis_lhs = this$0.configuration.defaultGoalRuleName;
    var tmp;
    var tmp_0 = tmp0_elvis_lhs;
    if ((tmp_0 == null ? null : new GrammarRuleName(tmp_0)) == null) {
      var tmp1_safe_receiver = this$0.targetGrammar;
      var tmp2_safe_receiver = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.options;
      var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.get('defaultGoalRule');
      var tmp_1;
      if (tmp3_safe_receiver == null) {
        tmp_1 = null;
      } else {
        // Inline function 'kotlin.let' call
        tmp_1 = _GrammarRuleName___init__impl__yqiut(tmp3_safe_receiver);
      }
      tmp = tmp_1;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var tmp4_elvis_lhs = tmp;
    var tmp_2;
    var tmp_3 = tmp4_elvis_lhs;
    if ((tmp_3 == null ? null : new GrammarRuleName(tmp_3)) == null) {
      var tmp5_safe_receiver = this$0.targetGrammar;
      var tmp6_safe_receiver = tmp5_safe_receiver == null ? null : tmp5_safe_receiver.grammarRule;
      var tmp_4;
      if (tmp6_safe_receiver == null) {
        tmp_4 = null;
      } else {
        var tmp$ret$3;
        $l$block: {
          // Inline function 'kotlin.collections.firstOrNull' call
          var _iterator__ex2g4s = tmp6_safe_receiver.s();
          while (_iterator__ex2g4s.t()) {
            var element = _iterator__ex2g4s.u();
            if (!element.isSkip) {
              tmp$ret$3 = element;
              break $l$block;
            }
          }
          tmp$ret$3 = null;
        }
        tmp_4 = tmp$ret$3;
      }
      var tmp7_safe_receiver = tmp_4;
      tmp_2 = tmp7_safe_receiver == null ? null : tmp7_safe_receiver.name;
    } else {
      tmp_2 = tmp4_elvis_lhs;
    }
    var tmp_5 = tmp_2;
    return tmp_5 == null ? null : new GrammarRuleName(tmp_5);
  };
}
function LanguageProcessorAbstract$targetGrammar$delegate$lambda(this$0) {
  return () => {
    var tmp0 = this$0.grammarModel.allDefinitions;
    var tmp$ret$1;
    $l$block: {
      // Inline function 'kotlin.collections.lastOrNull' call
      var iterator = tmp0.j1(tmp0.v());
      while (iterator.i6()) {
        var element = iterator.k6();
        var tmp = element.name;
        var tmp_0 = this$0.configuration.targetGrammarName;
        if (equals(new SimpleName(tmp), tmp_0 == null ? null : new SimpleName(tmp_0))) {
          tmp$ret$1 = element;
          break $l$block;
        }
      }
      tmp$ret$1 = null;
    }
    var tmp0_elvis_lhs = tmp$ret$1;
    return tmp0_elvis_lhs == null ? this$0.grammarModel.primary : tmp0_elvis_lhs;
  };
}
function LanguageProcessorAbstract$baseTypeModel$delegate$lambda$lambda($this$typeModel) {
  return Unit_instance;
}
function LanguageProcessorAbstract$baseTypeModel$delegate$lambda(this$0) {
  return () => {
    var tmp0_safe_receiver = this$0.configuration.typesResolver;
    var res = tmp0_safe_receiver == null ? null : tmp0_safe_receiver(this$0);
    if (res == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      this$0.issues.addAllFrom(res.allIssues);
    }
    var tmp3_elvis_lhs = res == null ? null : res.asm;
    var tmp;
    if (tmp3_elvis_lhs == null) {
      var tmp_0 = 'FromGrammar' + _SimpleName___get_value__impl__rl2r3c(this$0.grammarModel.name);
      tmp = typeModel(tmp_0, true, VOID, LanguageProcessorAbstract$baseTypeModel$delegate$lambda$lambda);
    } else {
      tmp = tmp3_elvis_lhs;
    }
    return tmp;
  };
}
function LanguageProcessorAbstract$transformModel$delegate$lambda(this$0) {
  return () => {
    var tmp0_safe_receiver = this$0.configuration.transformResolver;
    var res = tmp0_safe_receiver == null ? null : tmp0_safe_receiver(this$0);
    if (res == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      this$0.issues.addAllFrom(res.allIssues);
    }
    var tmp3_elvis_lhs = res == null ? null : res.asm;
    var tmp4_elvis_lhs = tmp3_elvis_lhs == null ? Companion_instance_29.fromGrammarModel(this$0.grammarModel, this$0.baseTypeModel).asm : tmp3_elvis_lhs;
    var tmp;
    if (tmp4_elvis_lhs == null) {
      var message = 'should not happen';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp4_elvis_lhs;
    }
    return tmp;
  };
}
function LanguageProcessorAbstract$targetTransformRuleSet$delegate$lambda(this$0) {
  return () => {
    var tmp0_safe_receiver = this$0.targetGrammar;
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      var tmp0_safe_receiver_0 = this$0.transformModel.findNamespaceOrNull(tmp0_safe_receiver.namespace.qualifiedName);
      tmp = tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.findOwnedDefinitionOrNull(tmp0_safe_receiver.name);
    }
    var tmp1_elvis_lhs = tmp;
    var tmp_0;
    if (tmp1_elvis_lhs == null) {
      var tmp2_safe_receiver = this$0.targetGrammar;
      var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.qualifiedName;
      var tmp_1;
      var tmp_2 = tmp3_elvis_lhs;
      if ((tmp_2 == null ? null : new QualifiedName(tmp_2)) == null) {
        tmp_1 = 'null';
      } else {
        tmp_1 = new QualifiedName(tmp3_elvis_lhs);
      }
      var message = "Target TransformRuleSet not found for grammar '" + toString(tmp_1) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    return tmp_0;
  };
}
function LanguageProcessorAbstract$crossReferenceModel$delegate$lambda(this$0) {
  return () => {
    var tmp0_safe_receiver = this$0.configuration.crossReferenceResolver;
    var res = tmp0_safe_receiver == null ? null : tmp0_safe_receiver(this$0);
    if (res == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      this$0.issues.addAllFrom(res.allIssues);
    }
    var tmp3_elvis_lhs = res == null ? null : res.asm;
    return tmp3_elvis_lhs == null ? new CrossReferenceModelDefault(_SimpleName___init__impl__6s45d0('FromGrammar' + _SimpleName___get_value__impl__rl2r3c(this$0.grammarModel.name))) : tmp3_elvis_lhs;
  };
}
function LanguageProcessorAbstract$syntaxAnalyser$delegate$lambda(this$0) {
  return () => {
    var tmp0_safe_receiver = this$0.configuration.syntaxAnalyserResolver;
    var res = tmp0_safe_receiver == null ? null : tmp0_safe_receiver(this$0);
    if (res == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      this$0.issues.addAllFrom(res.allIssues);
    }
    return res == null ? null : res.asm;
  };
}
function LanguageProcessorAbstract$semanticAnalyser$delegate$lambda(this$0) {
  return () => {
    var tmp0_safe_receiver = this$0.configuration.semanticAnalyserResolver;
    var res = tmp0_safe_receiver == null ? null : tmp0_safe_receiver(this$0);
    if (res == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      this$0.issues.addAllFrom(res.allIssues);
    }
    return res == null ? null : res.asm;
  };
}
function LanguageProcessorAbstract$formatModel$delegate$lambda(this$0) {
  return () => {
    var tmp0_safe_receiver = this$0.configuration.formatResolver;
    var res = tmp0_safe_receiver == null ? null : tmp0_safe_receiver(this$0);
    if (res == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      this$0.issues.addAllFrom(res.allIssues);
    }
    return res == null ? null : res.asm;
  };
}
function LanguageProcessorAbstract$formatter$delegate$lambda(this$0) {
  return () => {
    var tmp0_safe_receiver = this$0.configuration.formatResolver;
    var res = tmp0_safe_receiver == null ? null : tmp0_safe_receiver(this$0);
    var tmp;
    if (res == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      this$0.issues.addAllFrom(res.allIssues);
      var tmp0_safe_receiver_0 = res.asm;
      var tmp_0;
      if (tmp0_safe_receiver_0 == null) {
        tmp_0 = null;
      } else {
        // Inline function 'kotlin.let' call
        var tmp_1 = new FormatterOverAsmSimple(tmp0_safe_receiver_0, this$0.typesModel, this$0.issues);
        tmp_0 = isInterface(tmp_1, Formatter) ? tmp_1 : THROW_CCE();
      }
      tmp = tmp_0;
    }
    return tmp;
  };
}
function LanguageProcessorAbstract$completionProvider$delegate$lambda(this$0) {
  return () => {
    var tmp0_safe_receiver = this$0.configuration.completionProviderResolver;
    var res = tmp0_safe_receiver == null ? null : tmp0_safe_receiver(this$0);
    if (res == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      this$0.issues.addAllFrom(res.allIssues);
    }
    return res == null ? null : res.asm;
  };
}
function scanner$factory() {
  return getPropertyCallableRef('scanner', 1, KProperty1, (receiver) => receiver.scanner, null);
}
function parser$factory() {
  return getPropertyCallableRef('parser', 1, KProperty1, (receiver) => receiver.parser, null);
}
function spptParser$factory() {
  return getPropertyCallableRef('spptParser', 1, KProperty1, (receiver) => receiver.spptParser, null);
}
function defaultGoalRuleName$factory() {
  return getPropertyCallableRef('defaultGoalRuleName', 1, KProperty1, (receiver) => {
    var tmp = receiver.m1y();
    return tmp == null ? null : new GrammarRuleName(tmp);
  }, null);
}
function targetGrammar$factory() {
  return getPropertyCallableRef('targetGrammar', 1, KProperty1, (receiver) => receiver.targetGrammar, null);
}
function baseTypeModel$factory() {
  return getPropertyCallableRef('baseTypeModel', 1, KProperty1, (receiver) => receiver.baseTypeModel, null);
}
function transformModel$factory() {
  return getPropertyCallableRef('transformModel', 1, KProperty1, (receiver) => receiver.transformModel, null);
}
function targetTransformRuleSet$factory() {
  return getPropertyCallableRef('targetTransformRuleSet', 1, KProperty1, (receiver) => receiver.targetTransformRuleSet, null);
}
function crossReferenceModel$factory() {
  return getPropertyCallableRef('crossReferenceModel', 1, KProperty1, (receiver) => receiver.crossReferenceModel, null);
}
function syntaxAnalyser$factory() {
  return getPropertyCallableRef('syntaxAnalyser', 1, KProperty1, (receiver) => receiver.syntaxAnalyser, null);
}
function semanticAnalyser$factory() {
  return getPropertyCallableRef('semanticAnalyser', 1, KProperty1, (receiver) => receiver.semanticAnalyser, null);
}
function formatModel$factory() {
  return getPropertyCallableRef('formatModel', 1, KProperty1, (receiver) => receiver.formatModel, null);
}
function formatter$factory() {
  return getPropertyCallableRef('formatter', 1, KProperty1, (receiver) => receiver.formatter, null);
}
function completionProvider$factory() {
  return getPropertyCallableRef('completionProvider', 1, KProperty1, (receiver) => receiver.completionProvider, null);
}
function LanguageProcessorDefault$mapToGrammar$lambda(this$0) {
  return (ruleSetNumber, ruleNumber) => this$0.y1z_1.z2(new Pair(ruleSetNumber, ruleNumber));
}
function contextFromGrammarRegistry(registry) {
  registry = registry === VOID ? Agl_getInstance().registry : registry;
  var context = new ContextWithScope();
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = registry.grammars.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.map' call
    var this_0 = _QualifiedName___get_parts__impl__mdubdj(element.qualifiedName);
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s_0 = this_0.s();
    while (_iterator__ex2g4s_0.t()) {
      var item = _iterator__ex2g4s_0.u();
      var it = item.a1u_1;
      var tmp$ret$0 = _SimpleName___get_value__impl__rl2r3c(it);
      destination.r(tmp$ret$0);
    }
    context.addToScope(registry, destination, _QualifiedName___init__impl__8ed982('GrammarNamespace'), null, element);
  }
  return context;
}
function LanguageRegistryDefault$agl$o$base$delegate$lambda(this$0) {
  return () => this$0.registerFromLanguageObject(AglBase_getInstance());
}
function LanguageRegistryDefault$agl$o$expressions$delegate$lambda(this$0, this$1) {
  return () => {
    this$0.base;
    return this$1.registerFromLanguageObject(AglExpressions_getInstance());
  };
}
function LanguageRegistryDefault$agl$o$grammar$delegate$lambda(this$0, this$1) {
  return () => {
    this$0.base;
    return this$1.registerFromLanguageObject(AglGrammar_getInstance());
  };
}
function LanguageRegistryDefault$agl$o$types$delegate$lambda(this$0, this$1) {
  return () => {
    this$0.base;
    return this$1.registerFromLanguageObject(AglTypes_getInstance());
  };
}
function LanguageRegistryDefault$agl$o$transform$delegate$lambda$lambda$lambda(it) {
  return new ProcessResultDefault(new AsmTransformSyntaxAnalyser());
}
function LanguageRegistryDefault$agl$o$transform$delegate$lambda$lambda$lambda_0(it) {
  return new ProcessResultDefault(new AsmTransformSemanticAnalyser());
}
function LanguageRegistryDefault$agl$o$transform$delegate$lambda$lambda$lambda_1(it) {
  return Agl_getInstance().fromString(ensureNotNull(Agl_getInstance().registry.agl.style.processor), ensureNotNull(Agl_getInstance().registry.agl.style.processor).optionsDefault(), '\n    ');
}
function LanguageRegistryDefault$agl$o$transform$delegate$lambda$lambda$lambda_2(it) {
  return new ProcessResultDefault(new AsmTransformCompletionProvider());
}
function LanguageRegistryDefault$agl$o$transform$delegate$lambda$lambda($lang) {
  return ($this$configuration) => {
    $this$configuration.targetGrammarName(_SimpleName___get_value__impl__rl2r3c($lang.grammar.name));
    $this$configuration.defaultGoalRuleName('unit');
    $this$configuration.syntaxAnalyserResolver(LanguageRegistryDefault$agl$o$transform$delegate$lambda$lambda$lambda);
    $this$configuration.semanticAnalyserResolver(LanguageRegistryDefault$agl$o$transform$delegate$lambda$lambda$lambda_0);
    $this$configuration.styleResolver(LanguageRegistryDefault$agl$o$transform$delegate$lambda$lambda$lambda_1);
    $this$configuration.completionProvider(LanguageRegistryDefault$agl$o$transform$delegate$lambda$lambda$lambda_2);
    return Unit_instance;
  };
}
function LanguageRegistryDefault$agl$o$transform$delegate$lambda(this$0, this$1) {
  return () => {
    this$0.base;
    var lang = AsmTransform_getInstance();
    var tmp = this$0.transformLanguageIdentity;
    var tmp_0 = asGrammarModel(lang.grammar);
    var tmp_1 = Agl_getInstance();
    return this$1.registerFromDefinition(new LanguageDefinitionFromAsm(tmp, tmp_0, false, tmp_1.configuration(VOID, LanguageRegistryDefault$agl$o$transform$delegate$lambda$lambda(lang))));
  };
}
function LanguageRegistryDefault$agl$o$crossReference$delegate$lambda$lambda($this$configuration) {
  $this$configuration.targetGrammarName(_SimpleName___get_value__impl__rl2r3c(AglCrossReference_getInstance().grammar.name));
  $this$configuration.defaultGoalRuleName('unit');
  $this$configuration.syntaxAnalyserResolver(LanguageRegistryDefault$agl$o$crossReference$delegate$lambda$lambda$lambda);
  $this$configuration.semanticAnalyserResolver(LanguageRegistryDefault$agl$o$crossReference$delegate$lambda$lambda$lambda_0);
  $this$configuration.styleResolver(LanguageRegistryDefault$agl$o$crossReference$delegate$lambda$lambda$lambda_1);
  $this$configuration.completionProvider(LanguageRegistryDefault$agl$o$crossReference$delegate$lambda$lambda$lambda_2);
  return Unit_instance;
}
function LanguageRegistryDefault$agl$o$crossReference$delegate$lambda$lambda$lambda(it) {
  return new ProcessResultDefault(new ReferencesSyntaxAnalyser());
}
function LanguageRegistryDefault$agl$o$crossReference$delegate$lambda$lambda$lambda_0(it) {
  return new ProcessResultDefault(new ReferencesSemanticAnalyser());
}
function LanguageRegistryDefault$agl$o$crossReference$delegate$lambda$lambda$lambda_1(it) {
  return Agl_getInstance().fromString(ensureNotNull(Agl_getInstance().registry.agl.style.processor), ensureNotNull(Agl_getInstance().registry.agl.style.processor).optionsDefault(), 'namespace net.akehurst.language\nstyles CrossReferences : Base {\n}');
}
function LanguageRegistryDefault$agl$o$crossReference$delegate$lambda$lambda$lambda_2(it) {
  return new ProcessResultDefault(new ReferencesCompletionProvider());
}
function LanguageRegistryDefault$agl$o$crossReference$delegate$lambda(this$0, this$1) {
  return () => {
    this$0.expressions;
    var tmp = this$0.crossReferenceLanguageIdentity;
    var tmp_0 = asGrammarModel(AglCrossReference_getInstance().grammar);
    var tmp_1 = Agl_getInstance();
    return this$1.registerFromDefinition(new LanguageDefinitionFromAsm(tmp, tmp_0, false, tmp_1.configuration(VOID, LanguageRegistryDefault$agl$o$crossReference$delegate$lambda$lambda)));
  };
}
function LanguageRegistryDefault$agl$o$format$delegate$lambda(this$0, this$1) {
  return () => {
    this$0.expressions;
    return this$1.registerFromLanguageObject(AglFormat_getInstance());
  };
}
function LanguageRegistryDefault$agl$o$style$delegate$lambda(this$0, this$1) {
  return () => {
    this$0.base;
    return this$1.registerFromLanguageObject(AglStyle_getInstance());
  };
}
function base$factory() {
  return getPropertyCallableRef('base', 1, KProperty1, (receiver) => receiver.base, null);
}
function expressions$factory() {
  return getPropertyCallableRef('expressions', 1, KProperty1, (receiver) => receiver.expressions, null);
}
function grammar$factory() {
  return getPropertyCallableRef('grammar', 1, KProperty1, (receiver) => receiver.grammar, null);
}
function types$factory() {
  return getPropertyCallableRef('types', 1, KProperty1, (receiver) => receiver.types, null);
}
function transform$factory() {
  return getPropertyCallableRef('transform', 1, KProperty1, (receiver) => receiver.transform, null);
}
function crossReference$factory() {
  return getPropertyCallableRef('crossReference', 1, KProperty1, (receiver) => receiver.crossReference, null);
}
function format$factory() {
  return getPropertyCallableRef('format', 1, KProperty1, (receiver) => receiver.format, null);
}
function style$factory() {
  return getPropertyCallableRef('style', 1, KProperty1, (receiver) => receiver.style, null);
}
function LanguageProcessorConfigurationBase$_init_$lambda_d8he5e($regexEngineKind, $scannerKind) {
  return (it) => {
    var tmp;
    switch ($regexEngineKind.d3_1) {
      case 0:
        tmp = RegexEnginePlatform_getInstance();
        break;
      case 1:
        tmp = RegexEngineAgl_getInstance();
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
    var regexEngine = tmp;
    var tmp_0;
    switch ($scannerKind.d3_1) {
      case 1:
        var tmp2_safe_receiver = it.targetRuleSet;
        var tmp_1;
        if (tmp2_safe_receiver == null) {
          tmp_1 = null;
        } else {
          // Inline function 'kotlin.let' call
          tmp_1 = plus(tmp2_safe_receiver.terminals, tmp2_safe_receiver.embeddedTerminals);
        }

        var tmp3_elvis_lhs = tmp_1;
        tmp_0 = new ScannerClassic(regexEngine, tmp3_elvis_lhs == null ? emptyList() : tmp3_elvis_lhs);
        break;
      case 0:
        var tmp4_safe_receiver = it.targetRuleSet;
        var tmp_2;
        if (tmp4_safe_receiver == null) {
          tmp_2 = null;
        } else {
          // Inline function 'kotlin.let' call
          tmp_2 = plus(tmp4_safe_receiver.terminals, tmp4_safe_receiver.embeddedTerminals);
        }

        var tmp5_elvis_lhs = tmp_2;
        tmp_0 = new ScannerOnDemand(regexEngine, tmp5_elvis_lhs == null ? emptyList() : tmp5_elvis_lhs);
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
    var scanner = tmp_0;
    return new ProcessResultDefault(scanner);
  };
}
function LanguageProcessorConfigurationBase$_init_$lambda_d8he5e_0(p) {
  var tmp0_safe_receiver = p.targetRuleSet;
  var tmp;
  if (tmp0_safe_receiver == null) {
    tmp = null;
  } else {
    // Inline function 'kotlin.let' call
    tmp = new LeftCornerParser(ensureNotNull(p.scanner), tmp0_safe_receiver);
  }
  return new ProcessResultDefault(tmp);
}
function LanguageProcessorConfigurationBase$_init_$lambda_d8he5e_1(p) {
  var tmp = Companion_instance_30;
  var tmp_0 = _SimpleName___init__impl__6s45d0('FromGrammar' + _SimpleName___get_value__impl__rl2r3c(ensureNotNull(p.grammarModel).name));
  var tmp_1 = contextFromGrammar(ensureNotNull(p.grammarModel));
  var tmp0_elvis_lhs = p.configuration.typesString;
  var tmp_2;
  var tmp_3 = tmp0_elvis_lhs;
  if ((tmp_3 == null ? null : new TypesString(tmp_3)) == null) {
    tmp_2 = _TypesString___init__impl__keabg1('');
  } else {
    tmp_2 = tmp0_elvis_lhs;
  }
  return tmp.fromString(tmp_0, tmp_1, tmp_2);
}
function LanguageProcessorConfigurationBase$_init_$lambda_d8he5e_2(p) {
  var tmp0_safe_receiver = p.configuration.transformString;
  var tmp;
  var tmp_0 = tmp0_safe_receiver;
  if ((tmp_0 == null ? null : new TransformString(tmp_0)) == null) {
    tmp = null;
  } else {
    var tmp_1 = tmp0_safe_receiver;
    // Inline function 'kotlin.let' call
    var it = (tmp_1 == null ? null : new TransformString(tmp_1)).f1s_1;
    tmp = Companion_instance_29.fromString(new ContextFromGrammarAndTypeModel(ensureNotNull(p.grammarModel), p.baseTypeModel), it);
  }
  var tmp1_elvis_lhs = tmp;
  return tmp1_elvis_lhs == null ? Companion_instance_29.fromGrammarModel(ensureNotNull(p.grammarModel), p.baseTypeModel) : tmp1_elvis_lhs;
}
function LanguageProcessorConfigurationBase$_init_$lambda_d8he5e_3(p) {
  var tmp = Companion_getInstance_24();
  var tmp_0 = new ContextFromTypeModel(p.typesModel);
  var tmp0_elvis_lhs = p.configuration.crossReferenceString;
  var tmp_1;
  var tmp_2 = tmp0_elvis_lhs;
  if ((tmp_2 == null ? null : new CrossReferenceString(tmp_2)) == null) {
    tmp_1 = _CrossReferenceString___init__impl__2ehjbv('');
  } else {
    tmp_1 = tmp0_elvis_lhs;
  }
  return tmp.fromString(tmp_0, tmp_1);
}
function LanguageProcessorConfigurationBase$_init_$lambda_d8he5e_4(p) {
  var tmp = Companion_instance_15;
  var tmp_0 = contextFromTypeModel(p.typesModel);
  var tmp0_elvis_lhs = p.configuration.formatString;
  var tmp_1;
  var tmp_2 = tmp0_elvis_lhs;
  if ((tmp_2 == null ? null : new FormatString(tmp_2)) == null) {
    tmp_1 = _FormatString___init__impl__5jzgt5('');
  } else {
    tmp_1 = tmp0_elvis_lhs;
  }
  return tmp.fromString(tmp_0, tmp_1);
}
function LanguageProcessorConfigurationBase$_init_$lambda_d8he5e_5(p) {
  var tmp = Companion_getInstance_28();
  var tmp_0 = contextFromGrammar(ensureNotNull(p.grammarModel));
  var tmp0_elvis_lhs = p.configuration.styleString;
  var tmp_1;
  var tmp_2 = tmp0_elvis_lhs;
  if ((tmp_2 == null ? null : new StyleString(tmp_2)) == null) {
    tmp_1 = _StyleString___init__impl__vpzm3t('');
  } else {
    tmp_1 = tmp0_elvis_lhs;
  }
  return tmp.fromString(tmp_0, tmp_1);
}
function LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx($regexEngineKind, $scannerKind) {
  return (it) => {
    var tmp;
    switch ($regexEngineKind.d3_1) {
      case 0:
        tmp = RegexEnginePlatform_getInstance();
        break;
      case 1:
        tmp = RegexEngineAgl_getInstance();
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
    var regexEngine = tmp;
    var tmp_0;
    switch ($scannerKind.d3_1) {
      case 1:
        var tmp2_safe_receiver = it.targetRuleSet;
        var tmp_1;
        if (tmp2_safe_receiver == null) {
          tmp_1 = null;
        } else {
          // Inline function 'kotlin.let' call
          tmp_1 = plus(tmp2_safe_receiver.terminals, tmp2_safe_receiver.embeddedTerminals);
        }

        var tmp3_elvis_lhs = tmp_1;
        tmp_0 = new ScannerClassic(regexEngine, tmp3_elvis_lhs == null ? emptyList() : tmp3_elvis_lhs);
        break;
      case 0:
        var tmp4_safe_receiver = it.targetRuleSet;
        var tmp_2;
        if (tmp4_safe_receiver == null) {
          tmp_2 = null;
        } else {
          // Inline function 'kotlin.let' call
          tmp_2 = plus(tmp4_safe_receiver.terminals, tmp4_safe_receiver.embeddedTerminals);
        }

        var tmp5_elvis_lhs = tmp_2;
        tmp_0 = new ScannerOnDemand(regexEngine, tmp5_elvis_lhs == null ? emptyList() : tmp5_elvis_lhs);
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
    var scanner = tmp_0;
    return new ProcessResultDefault(scanner);
  };
}
function LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_0(p) {
  var tmp0_safe_receiver = p.targetRuleSet;
  var tmp;
  if (tmp0_safe_receiver == null) {
    tmp = null;
  } else {
    // Inline function 'kotlin.let' call
    tmp = new LeftCornerParser(ensureNotNull(p.scanner), tmp0_safe_receiver);
  }
  return new ProcessResultDefault(tmp);
}
function LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_1(p) {
  var tmp = Companion_instance_30;
  var tmp_0 = _SimpleName___init__impl__6s45d0('FromGrammar' + _SimpleName___get_value__impl__rl2r3c(ensureNotNull(p.grammarModel).name));
  var tmp_1 = contextFromGrammar(ensureNotNull(p.grammarModel));
  var tmp0_elvis_lhs = p.configuration.typesString;
  var tmp_2;
  var tmp_3 = tmp0_elvis_lhs;
  if ((tmp_3 == null ? null : new TypesString(tmp_3)) == null) {
    tmp_2 = _TypesString___init__impl__keabg1('');
  } else {
    tmp_2 = tmp0_elvis_lhs;
  }
  return tmp.fromString(tmp_0, tmp_1, tmp_2);
}
function LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_2(p) {
  var tmp0_safe_receiver = p.configuration.transformString;
  var tmp;
  var tmp_0 = tmp0_safe_receiver;
  if ((tmp_0 == null ? null : new TransformString(tmp_0)) == null) {
    tmp = null;
  } else {
    var tmp_1 = tmp0_safe_receiver;
    // Inline function 'kotlin.let' call
    var it = (tmp_1 == null ? null : new TransformString(tmp_1)).f1s_1;
    tmp = Companion_instance_29.fromString(new ContextFromGrammarAndTypeModel(ensureNotNull(p.grammarModel), p.baseTypeModel), it);
  }
  var tmp1_elvis_lhs = tmp;
  return tmp1_elvis_lhs == null ? Companion_instance_29.fromGrammarModel(ensureNotNull(p.grammarModel), p.baseTypeModel) : tmp1_elvis_lhs;
}
function LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_3(p) {
  var tmp = Companion_getInstance_24();
  var tmp_0 = new ContextFromTypeModel(p.typesModel);
  var tmp0_elvis_lhs = p.configuration.crossReferenceString;
  var tmp_1;
  var tmp_2 = tmp0_elvis_lhs;
  if ((tmp_2 == null ? null : new CrossReferenceString(tmp_2)) == null) {
    tmp_1 = _CrossReferenceString___init__impl__2ehjbv('');
  } else {
    tmp_1 = tmp0_elvis_lhs;
  }
  return tmp.fromString(tmp_0, tmp_1);
}
function LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_4(p) {
  return new ProcessResultDefault(new SyntaxAnalyserSimple(p.typesModel, p.transformModel, p.targetTransformRuleSet.qualifiedName));
}
function LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_5(p) {
  return new ProcessResultDefault(new SemanticAnalyserSimple(p.typesModel, p.crossReferenceModel));
}
function LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_6(p) {
  var tmp = Companion_instance_15;
  var tmp_0 = contextFromTypeModel(p.typesModel);
  var tmp0_elvis_lhs = p.configuration.formatString;
  var tmp_1;
  var tmp_2 = tmp0_elvis_lhs;
  if ((tmp_2 == null ? null : new FormatString(tmp_2)) == null) {
    tmp_1 = _FormatString___init__impl__5jzgt5('');
  } else {
    tmp_1 = tmp0_elvis_lhs;
  }
  return tmp.fromString(tmp_0, tmp_1);
}
function LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_7(p) {
  var tmp = Companion_getInstance_28();
  var tmp_0 = contextFromGrammar(ensureNotNull(p.grammarModel));
  var tmp0_elvis_lhs = p.configuration.styleString;
  var tmp_1;
  var tmp_2 = tmp0_elvis_lhs;
  if ((tmp_2 == null ? null : new StyleString(tmp_2)) == null) {
    tmp_1 = _StyleString___init__impl__vpzm3t('');
  } else {
    tmp_1 = tmp0_elvis_lhs;
  }
  return tmp.fromString(tmp_0, tmp_1);
}
function LanguageProcessorConfigurationSimple$_init_$lambda_kve2nx_8(p) {
  return new ProcessResultDefault(new CompletionProviderSimple(ensureNotNull(p.targetGrammar), Companion_getInstance_3().defaultConfiguration, p.typesModel, p.crossReferenceModel));
}
function LanguageProcessorConfigurationBuilder$scanner$lambda($regexEngineKind, $scannerKind) {
  return (it) => {
    var tmp;
    switch ($regexEngineKind.d3_1) {
      case 0:
        tmp = RegexEnginePlatform_getInstance();
        break;
      case 1:
        tmp = RegexEngineAgl_getInstance();
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
    var regexEngine = tmp;
    var tmp_0;
    switch ($scannerKind.d3_1) {
      case 1:
        var tmp2_safe_receiver = it.targetRuleSet;
        var tmp_1;
        if (tmp2_safe_receiver == null) {
          tmp_1 = null;
        } else {
          // Inline function 'kotlin.let' call
          tmp_1 = plus(tmp2_safe_receiver.terminals, tmp2_safe_receiver.embeddedTerminals);
        }

        var tmp3_elvis_lhs = tmp_1;
        tmp_0 = new ScannerClassic(regexEngine, tmp3_elvis_lhs == null ? emptyList() : tmp3_elvis_lhs);
        break;
      case 0:
        var tmp4_safe_receiver = it.targetRuleSet;
        var tmp_2;
        if (tmp4_safe_receiver == null) {
          tmp_2 = null;
        } else {
          // Inline function 'kotlin.let' call
          tmp_2 = plus(tmp4_safe_receiver.terminals, tmp4_safe_receiver.embeddedTerminals);
        }

        var tmp5_elvis_lhs = tmp_2;
        tmp_0 = new ScannerOnDemand(regexEngine, tmp5_elvis_lhs == null ? emptyList() : tmp5_elvis_lhs);
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
    var scanner = tmp_0;
    return new ProcessResultDefault(scanner);
  };
}
function LanguageProcessorConfigurationBuilder$syntaxAnalyserResolverResult$lambda($func) {
  return (it) => new ProcessResultDefault($func());
}
function LanguageProcessorConfigurationBuilder$semanticAnalyserResolverResult$lambda($func) {
  return (it) => new ProcessResultDefault($func());
}
function contextFromTypeModel(typeModel) {
  var context = new ContextWithScope();
  var sentenceIdentity = _SimpleName___get_value__impl__rl2r3c(typeModel.name);
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = typeModel.allDefinitions.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.map' call
    var this_0 = _QualifiedName___get_parts__impl__mdubdj(element.qualifiedName);
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s_0 = this_0.s();
    while (_iterator__ex2g4s_0.t()) {
      var item = _iterator__ex2g4s_0.u();
      var it = item.a1u_1;
      var tmp$ret$0 = _SimpleName___get_value__impl__rl2r3c(it);
      destination.r(tmp$ret$0);
    }
    var qualifiedName = destination;
    var itemTypeName = get_asQualifiedName(ensureNotNull(getKClassFromExpression(element).zc()));
    var location = null;
    context.addToScope(sentenceIdentity, qualifiedName, itemTypeName, location, element);
  }
  return context;
}
function provideForType($this, type, firstSpineNode, context) {
  try {
    var prop = type.resolvedDeclaration.getOwnedPropertyByIndexOrNull(firstSpineNode.nextChildNumber);
    var tmp;
    if (prop == null) {
      tmp = emptyList();
    } else {
      var strProps = setOf(prop);
      $l$loop: while (true) {
        var tmp_0;
        // Inline function 'kotlin.collections.isNotEmpty' call
        if (!strProps.a1()) {
          var tmp1 = strProps;
          var tmp$ret$1;
          $l$block_0: {
            // Inline function 'kotlin.collections.all' call
            var tmp_1;
            if (isInterface(tmp1, Collection)) {
              tmp_1 = tmp1.a1();
            } else {
              tmp_1 = false;
            }
            if (tmp_1) {
              tmp$ret$1 = true;
              break $l$block_0;
            }
            var _iterator__ex2g4s = tmp1.s();
            while (_iterator__ex2g4s.t()) {
              var element = _iterator__ex2g4s.u();
              if (!!equals(element.typeInstance, StdLibDefault_getInstance().String)) {
                tmp$ret$1 = false;
                break $l$block_0;
              }
            }
            tmp$ret$1 = true;
          }
          tmp_0 = tmp$ret$1;
        } else {
          tmp_0 = false;
        }
        if (!tmp_0) {
          break $l$loop;
        }
        // Inline function 'kotlin.collections.filter' call
        var tmp0 = strProps;
        // Inline function 'kotlin.collections.filterTo' call
        var destination = ArrayList.y();
        var _iterator__ex2g4s_0 = tmp0.s();
        while (_iterator__ex2g4s_0.t()) {
          var element_0 = _iterator__ex2g4s_0.u();
          if (equals(element_0.typeInstance, StdLibDefault_getInstance().String)) {
            destination.r(element_0);
          }
        }
        var tmp_2 = toSet(destination);
        // Inline function 'kotlin.collections.filter' call
        var tmp0_0 = strProps;
        // Inline function 'kotlin.collections.filterTo' call
        var destination_0 = ArrayList.y();
        var _iterator__ex2g4s_1 = tmp0_0.s();
        while (_iterator__ex2g4s_1.t()) {
          var element_1 = _iterator__ex2g4s_1.u();
          if (!equals(element_1.typeInstance, StdLibDefault_getInstance().String)) {
            destination_0.r(element_1);
          }
        }
        // Inline function 'kotlin.collections.flatMap' call
        // Inline function 'kotlin.collections.flatMapTo' call
        var destination_1 = ArrayList.y();
        var _iterator__ex2g4s_2 = destination_0.s();
        while (_iterator__ex2g4s_2.t()) {
          var element_2 = _iterator__ex2g4s_2.u();
          var type_0 = element_2.typeInstance;
          var td = type_0.resolvedDeclaration;
          var tmp_3;
          if (isInterface(td, CollectionType)) {
            tmp_3 = firstPropertyOf($this, type_0.typeArguments.z(0).type);
          } else {
            if (isInterface(td, StructuredType)) {
              tmp_3 = firstPropertyOf($this, type_0);
            } else {
              tmp_3 = emptyList();
            }
          }
          var list = tmp_3;
          addAll(destination_1, list);
        }
        strProps = plus_2(tmp_2, toSet(destination_1));
      }
      // Inline function 'kotlin.collections.flatMap' call
      var tmp0_1 = strProps;
      // Inline function 'kotlin.collections.flatMapTo' call
      var destination_2 = ArrayList.y();
      var _iterator__ex2g4s_3 = tmp0_1.s();
      while (_iterator__ex2g4s_3.t()) {
        var element_3 = _iterator__ex2g4s_3.u();
        var refTypeNames = $this.crossReferenceModel.referenceForProperty(element_3.owner.qualifiedName, _PropertyName___get_value__impl__p219lh(element_3.name));
        // Inline function 'kotlin.collections.mapNotNull' call
        // Inline function 'kotlin.collections.mapNotNullTo' call
        var destination_3 = ArrayList.y();
        // Inline function 'kotlin.collections.forEach' call
        var _iterator__ex2g4s_4 = refTypeNames.s();
        while (_iterator__ex2g4s_4.t()) {
          var element_4 = _iterator__ex2g4s_4.u();
          var it = element_4.f27_1;
          var tmp0_safe_receiver = $this.typeModel.findByQualifiedNameOrNull(it);
          if (tmp0_safe_receiver == null)
            null;
          else {
            // Inline function 'kotlin.let' call
            destination_3.r(tmp0_safe_receiver);
          }
        }
        var refTypes = destination_3;
        // Inline function 'kotlin.collections.flatMap' call
        // Inline function 'kotlin.collections.flatMapTo' call
        var destination_4 = ArrayList.y();
        var _iterator__ex2g4s_5 = refTypes.s();
        while (_iterator__ex2g4s_5.t()) {
          var element_5 = _iterator__ex2g4s_5.u();
          var list_0 = context.findItemsConformingTo(CompletionProviderSimple$provideForType$lambda($this, element_5));
          addAll(destination_4, list_0);
        }
        var items = destination_4;
        // Inline function 'kotlin.collections.map' call
        // Inline function 'kotlin.collections.mapTo' call
        var destination_5 = ArrayList.w(collectionSizeOrDefault(items, 10));
        var _iterator__ex2g4s_6 = items.s();
        while (_iterator__ex2g4s_6.t()) {
          var item = _iterator__ex2g4s_6.u();
          var tmp$ret$22 = new CompletionItem(CompletionItemKind_REFERRED_getInstance(), _SimpleName___get_value__impl__rl2r3c(_QualifiedName___get_last__impl__838y8h(item.qualifiedTypeName)), item.referableName);
          destination_5.r(tmp$ret$22);
        }
        var list_1 = destination_5;
        addAll(destination_2, list_1);
      }
      tmp = destination_2;
    }
    return tmp;
  } catch ($p) {
    if ($p instanceof Error) {
      var t = $p;
      printStackTrace(t);
      return emptyList();
    } else {
      throw $p;
    }
  }
}
function firstPropertyOf($this, type) {
  var tmp = setOf(type);
  var typesClosure = transitiveClosure(tmp, VOID, CompletionProviderSimple$firstPropertyOf$lambda);
  // Inline function 'kotlin.collections.mapNotNull' call
  // Inline function 'kotlin.collections.mapNotNullTo' call
  var destination = ArrayList.y();
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = typesClosure.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var tmp0 = element.allResolvedProperty.v2();
    var tmp$ret$0;
    $l$block_0: {
      // Inline function 'kotlin.collections.minByOrNull' call
      var iterator = tmp0.s();
      if (!iterator.t()) {
        tmp$ret$0 = null;
        break $l$block_0;
      }
      var minElem = iterator.u();
      if (!iterator.t()) {
        tmp$ret$0 = minElem;
        break $l$block_0;
      }
      var minValue = minElem.index;
      do {
        var e = iterator.u();
        var v = e.index;
        if (compareTo(minValue, v) > 0) {
          minElem = e;
          minValue = v;
        }
      }
       while (iterator.t());
      tmp$ret$0 = minElem;
    }
    var tmp0_safe_receiver = tmp$ret$0;
    if (tmp0_safe_receiver == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      destination.r(tmp0_safe_receiver);
    }
  }
  var minProps = destination;
  // Inline function 'kotlin.collections.minOf' call
  var iterator_0 = minProps.s();
  if (!iterator_0.t())
    throw NoSuchElementException.d1();
  var minValue_0 = iterator_0.u().index;
  while (iterator_0.t()) {
    var v_0 = iterator_0.u().index;
    if (compareTo(minValue_0, v_0) > 0) {
      minValue_0 = v_0;
    }
  }
  var minOfMin = minValue_0;
  // Inline function 'kotlin.collections.filter' call
  // Inline function 'kotlin.collections.filterTo' call
  var destination_0 = ArrayList.y();
  var _iterator__ex2g4s_0 = minProps.s();
  while (_iterator__ex2g4s_0.t()) {
    var element_0 = _iterator__ex2g4s_0.u();
    if (minOfMin === element_0.index) {
      destination_0.r(element_0);
    }
  }
  return destination_0;
}
function CompletionProviderSimple$provideForType$lambda(this$0, $refType) {
  return (it) => {
    var tmp0_elvis_lhs = this$0.typeModel.findFirstDefinitionByPossiblyQualifiedNameOrNull(it);
    var itemType = tmp0_elvis_lhs == null ? StdLibDefault_getInstance().NothingType.resolvedDeclaration : tmp0_elvis_lhs;
    return itemType.conformsTo($refType);
  };
}
function CompletionProviderSimple$firstPropertyOf$lambda(it) {
  return toSet(it.resolvedDeclaration.subtypes);
}
var NULL_SENTENCE_IDENTIFIER_instance;
function NULL_SENTENCE_IDENTIFIER_getInstance() {
  return NULL_SENTENCE_IDENTIFIER_instance;
}
function ContextWithScope$asString$lambda($scopeIndent) {
  return (_destruct__k2r9zo) => {
    // Inline function 'kotlin.collections.component1' call
    var k = _destruct__k2r9zo.a3();
    // Inline function 'kotlin.collections.component2' call
    var v = _destruct__k2r9zo.b3();
    return $scopeIndent.toString() + 'sentence ' + toString(k) + ' = ' + v.asString($scopeIndent);
  };
}
function allOfType($this, _this__u8e3s4, typeDecl) {
  var tmp$ret$0;
  $l$block_0: {
    // Inline function 'kotlin.collections.all' call
    var tmp;
    if (isInterface(_this__u8e3s4, Collection)) {
      tmp = _this__u8e3s4.a1();
    } else {
      tmp = false;
    }
    if (tmp) {
      tmp$ret$0 = true;
      break $l$block_0;
    }
    var _iterator__ex2g4s = _this__u8e3s4.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!equals(element.resolvedType.resolvedDeclaration, typeDecl)) {
        tmp$ret$0 = false;
        break $l$block_0;
      }
    }
    tmp$ret$0 = true;
  }
  return tmp$ret$0;
}
function allOfTypeIs($this, _this__u8e3s4, klass) {
  var tmp$ret$0;
  $l$block_0: {
    // Inline function 'kotlin.collections.all' call
    var tmp;
    if (isInterface(_this__u8e3s4, Collection)) {
      tmp = _this__u8e3s4.a1();
    } else {
      tmp = false;
    }
    if (tmp) {
      tmp$ret$0 = true;
      break $l$block_0;
    }
    var _iterator__ex2g4s = _this__u8e3s4.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!klass.ad(element.resolvedType.resolvedDeclaration)) {
        tmp$ret$0 = false;
        break $l$block_0;
      }
    }
    tmp$ret$0 = true;
  }
  return tmp$ret$0;
}
function allTupleTypesMatch($this, _this__u8e3s4) {
  // Inline function 'kotlin.collections.map' call
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(_this__u8e3s4, 10));
  var _iterator__ex2g4s = _this__u8e3s4.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var tmp = item.resolvedType;
    var tmp$ret$0 = toSet((isInterface(tmp, TupleTypeInstance) ? tmp : THROW_CCE()).typeArguments);
    destination.r(tmp$ret$0);
  }
  return 1 === toSet(destination).v();
}
var Companion_instance_1;
function Companion_getInstance_3() {
  if (Companion_instance_1 === VOID)
    new Companion_0();
  return Companion_instance_1;
}
function findOrCreateTrRule($this, rule, cnm) {
  var ruleName = rule.name;
  var existing = $this.a2g_1.z2(new GrammarRuleName(ruleName));
  var tmp;
  if (null == existing) {
    var tmp0_safe_receiver = $this.x2f_1;
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.typeNameFor(rule);
    var tmp_0;
    var tmp_1 = tmp1_elvis_lhs;
    if ((tmp_1 == null ? null : new SimpleName(tmp_1)) == null) {
      tmp_0 = _SimpleName___init__impl__6s45d0(_GrammarRuleName___get_value__impl__470s0v(ruleName));
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    var tn = tmp_0;
    var tmp_2;
    if (isInterface(rule, NormalRule)) {
      tmp_2 = $this.t2f_1.findOwnedOrCreateDataTypeNamed(tn);
    } else {
      if (isInterface(rule, OverrideRule)) {
        var tmp_3;
        switch (rule.overrideKind.d3_1) {
          case 1:
            var tmp4_elvis_lhs = $this.t2f_1.findTypeNamed(new SimpleName(tn));
            var tmp_4;
            if (tmp4_elvis_lhs == null) {
              var message = "Type for override rule '" + QualifiedName__toString_impl_z3wem2(rule.qualifiedName) + "' not found";
              throw IllegalStateException.v4(toString(message));
            } else {
              tmp_4 = tmp4_elvis_lhs;
            }

            tmp_3 = tmp_4;
            break;
          case 0:
            tmp_3 = $this.t2f_1.findOwnedOrCreateDataTypeNamed(tn);
            break;
          case 2:
            throw NotImplementedError.uj();
          default:
            noWhenBranchMatchedException();
            break;
        }
        tmp_2 = tmp_3;
      } else {
        var message_0 = "Subtype of GrammarRule '" + getKClassFromExpression(rule).zc() + "' not supported";
        throw IllegalStateException.v4(toString(message_0));
      }
    }
    var tp = tmp_2;
    var tt = tp.type();
    var tr = cnm.e2g_1(isInterface(tp, DataType) ? tp : THROW_CCE());
    tr.grammarRuleName = rule.name;
    tr.resolveTypeAs(tt);
    var tmp2 = $this.a2g_1;
    // Inline function 'kotlin.collections.set' call
    var key = new GrammarRuleName(ruleName);
    tmp2.r2(key, tr);
    cnm.f2g_1(tr);
    tmp = tr;
  } else {
    tmp = existing;
  }
  return tmp;
}
function builderForEmbedded($this, ruleItem) {
  var embGrammar = ensureNotNull(ruleItem.embeddedGrammarReference.resolved);
  var tmp0_elvis_lhs = $this.w2f_1.z2(new QualifiedName(embGrammar.qualifiedName));
  var tmp;
  if (tmp0_elvis_lhs == null) {
    // Inline function 'kotlin.let' call
    var x = new Grammar2Namespaces($this.q2f_1, $this.r2f_1, $this.s2f_1, embGrammar, $this.w2f_1, $this.x2f_1);
    x.fb();
    tmp = x;
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var g2ns = tmp;
  $this.t2f_1.addImport(_Import___init__impl__786z8c(_QualifiedName___get_value__impl__nkc4gq(ensureNotNull(g2ns.m2g_1).qualifiedName)));
  return g2ns;
}
function createOrFindTrRuleForGrammarRule($this, gr) {
  var cor = $this.p2g(gr);
  var tmp;
  if (!(null == cor)) {
    tmp = cor;
  } else if (gr.isLeaf) {
    var t = StdLibDefault_getInstance().String;
    var trRule = Companion_getInstance_3().toLeafAsStringTrRule(t);
    trRule.r2g_1 = gr.name;
    var tmp0 = $this.a2g_1;
    // Inline function 'kotlin.collections.set' call
    var key = new GrammarRuleName(gr.name);
    tmp0.r2(key, trRule);
    tmp = trRule;
  } else {
    var rhs = gr.rhs;
    var trRule_0 = trRuleForRhs($this, gr, rhs);
    trRule_0.grammarRuleName = gr.name;
    var tmp3 = $this.a2g_1;
    // Inline function 'kotlin.collections.set' call
    var key_0 = new GrammarRuleName(gr.name);
    tmp3.r2(key_0, trRule_0);
    tmp = trRule_0;
  }
  return tmp;
}
function trRuleForRhs($this, gr, rhs) {
  var tmp;
  if (isInterface(rhs, EmptyRule)) {
    tmp = trRuleForRhsItemList($this, gr, emptyList());
  } else {
    if (isInterface(rhs, Terminal)) {
      tmp = trRuleForRhsItemList($this, gr, listOf(rhs));
    } else {
      if (isInterface(rhs, NonTerminal)) {
        tmp = trRuleForRhsItemList($this, gr, listOf(rhs));
      } else {
        if (isInterface(rhs, Embedded)) {
          tmp = trRuleForRhsItemList($this, gr, listOf(rhs));
        } else {
          if (isInterface(rhs, Concatenation)) {
            tmp = trRuleForRhsItemList($this, gr, rhs.items);
          } else {
            if (isInterface(rhs, Choice)) {
              tmp = trRuleForRhsChoice($this, rhs, gr);
            } else {
              if (isInterface(rhs, OptionalItem)) {
                tmp = trRuleForRhsOptional($this, gr, rhs);
              } else {
                if (isInterface(rhs, SimpleList)) {
                  tmp = trRuleForRhsListSimple($this, gr, rhs);
                } else {
                  if (isInterface(rhs, SeparatedList)) {
                    tmp = trRuleForRhsListSeparated($this, gr, rhs);
                  } else {
                    if (isInterface(rhs, Group)) {
                      tmp = trRuleForRhsGroup($this, gr, rhs);
                    } else {
                      var message = "Internal error, unhandled subtype of rule '" + GrammarRuleName__toString_impl_przz03(gr.name) + "'.rhs '" + getKClassFromExpression(rhs).zc() + "' when creating TypeNamespace from grammar '" + QualifiedName__toString_impl_z3wem2($this.v2f_1.qualifiedName) + "'";
                      throw IllegalStateException.v4(toString(message));
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  return tmp;
}
function trRuleForRhsItemList($this, rule, items) {
  var tmp = Grammar2TransformRuleSet$trRuleForRhsItemList$lambda;
  var trRule = findOrCreateTrRule($this, rule, new ConstructAndModify(tmp, Grammar2TransformRuleSet$trRuleForRhsItemList$lambda_0(items, $this)));
  return trRule;
}
function trRuleForRhsChoice($this, choice, choiceRule) {
  var tmp;
  if (choice.alternative.v() === 1) {
    var message = 'Internal Error: choice should have more than one alternative';
    throw IllegalStateException.v4(toString(message));
  } else {
    // Inline function 'kotlin.collections.map' call
    var this_0 = choice.alternative;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var itemTr = trRuleForRuleItem($this, item, false);
      var tmp_0;
      if (isInterface(item, Concatenation)) {
        tmp_0 = itemTr;
      } else {
        var expr = new WithExpressionDefault(Companion_getInstance_3().EXPRESSION_CHILD(0), itemTr.expression);
        tmp_0 = transformationRule(itemTr.resolvedType, expr);
      }
      var tmp$ret$0 = tmp_0;
      destination.r(tmp$ret$0);
    }
    var subtypeTransforms = destination;
    var tmp_1;
    var tmp$ret$3;
    $l$block_0: {
      // Inline function 'kotlin.collections.all' call
      var tmp_2;
      if (isInterface(subtypeTransforms, Collection)) {
        tmp_2 = subtypeTransforms.a1();
      } else {
        tmp_2 = false;
      }
      if (tmp_2) {
        tmp$ret$3 = true;
        break $l$block_0;
      }
      var _iterator__ex2g4s_0 = subtypeTransforms.s();
      while (_iterator__ex2g4s_0.t()) {
        var element = _iterator__ex2g4s_0.u();
        if (!equals(element.resolvedType, StdLibDefault_getInstance().NothingType)) {
          tmp$ret$3 = false;
          break $l$block_0;
        }
      }
      tmp$ret$3 = true;
    }
    if (tmp$ret$3) {
      var tmp_3 = StdLibDefault_getInstance().NothingType.resolvedDeclaration;
      var tmp_4 = emptyList();
      var tmp$ret$5;
      $l$block_2: {
        // Inline function 'kotlin.collections.any' call
        var tmp_5;
        if (isInterface(subtypeTransforms, Collection)) {
          tmp_5 = subtypeTransforms.a1();
        } else {
          tmp_5 = false;
        }
        if (tmp_5) {
          tmp$ret$5 = false;
          break $l$block_2;
        }
        var _iterator__ex2g4s_1 = subtypeTransforms.s();
        while (_iterator__ex2g4s_1.t()) {
          var element_0 = _iterator__ex2g4s_1.u();
          if (element_0.resolvedType.isNullable) {
            tmp$ret$5 = true;
            break $l$block_2;
          }
        }
        tmp$ret$5 = false;
      }
      var t = tmp_3.type(tmp_4, tmp$ret$5);
      tmp_1 = Companion_getInstance_3().toNoActionTrRule(t);
    } else {
      var tmp$ret$7;
      $l$block_4: {
        // Inline function 'kotlin.collections.all' call
        var tmp_6;
        if (isInterface(subtypeTransforms, Collection)) {
          tmp_6 = subtypeTransforms.a1();
        } else {
          tmp_6 = false;
        }
        if (tmp_6) {
          tmp$ret$7 = true;
          break $l$block_4;
        }
        var _iterator__ex2g4s_2 = subtypeTransforms.s();
        while (_iterator__ex2g4s_2.t()) {
          var element_1 = _iterator__ex2g4s_2.u();
          var tmp_7 = element_1.resolvedType.resolvedDeclaration;
          if (!isInterface(tmp_7, PrimitiveType)) {
            tmp$ret$7 = false;
            break $l$block_4;
          }
        }
        tmp$ret$7 = true;
      }
      if (tmp$ret$7) {
        tmp_1 = transformationRule(StdLibDefault_getInstance().String, Companion_getInstance_3().EXPRESSION_CHILD(0));
      } else {
        var tmp$ret$9;
        $l$block_6: {
          // Inline function 'kotlin.collections.all' call
          var tmp_8;
          if (isInterface(subtypeTransforms, Collection)) {
            tmp_8 = subtypeTransforms.a1();
          } else {
            tmp_8 = false;
          }
          if (tmp_8) {
            tmp$ret$9 = true;
            break $l$block_6;
          }
          var _iterator__ex2g4s_3 = subtypeTransforms.s();
          while (_iterator__ex2g4s_3.t()) {
            var element_2 = _iterator__ex2g4s_3.u();
            var tmp_9 = element_2.resolvedType.resolvedDeclaration;
            if (!isInterface(tmp_9, DataType)) {
              tmp$ret$9 = false;
              break $l$block_6;
            }
          }
          tmp$ret$9 = true;
        }
        if (tmp$ret$9) {
          var tmp_10 = Grammar2TransformRuleSet$trRuleForRhsChoice$lambda;
          tmp_1 = findOrCreateTrRule($this, choiceRule, new ConstructAndModify(tmp_10, Grammar2TransformRuleSet$trRuleForRhsChoice$lambda_0(subtypeTransforms)));
        } else {
          var tmp$ret$11;
          $l$block_8: {
            // Inline function 'kotlin.collections.all' call
            var tmp_11;
            if (isInterface(subtypeTransforms, Collection)) {
              tmp_11 = subtypeTransforms.a1();
            } else {
              tmp_11 = false;
            }
            if (tmp_11) {
              tmp$ret$11 = true;
              break $l$block_8;
            }
            var _iterator__ex2g4s_4 = subtypeTransforms.s();
            while (_iterator__ex2g4s_4.t()) {
              var element_3 = _iterator__ex2g4s_4.u();
              if (!equals(element_3.resolvedType.resolvedDeclaration, StdLibDefault_getInstance().List)) {
                tmp$ret$11 = false;
                break $l$block_8;
              }
            }
            tmp$ret$11 = true;
          }
          if (tmp$ret$11) {
            var itemType = StdLibDefault_getInstance().AnyType;
            var choiceType = StdLibDefault_getInstance().List.type(listOf(itemType.asTypeArgument));
            tmp_1 = Companion_getInstance_3().toSubtypeTrRule(choiceType);
          } else {
            var tmp$ret$13;
            $l$block_10: {
              // Inline function 'kotlin.collections.all' call
              var tmp_12;
              if (isInterface(subtypeTransforms, Collection)) {
                tmp_12 = subtypeTransforms.a1();
              } else {
                tmp_12 = false;
              }
              if (tmp_12) {
                tmp$ret$13 = true;
                break $l$block_10;
              }
              var _iterator__ex2g4s_5 = subtypeTransforms.s();
              while (_iterator__ex2g4s_5.t()) {
                var element_4 = _iterator__ex2g4s_5.u();
                var tmp_13 = element_4.resolvedType.resolvedDeclaration;
                if (!isInterface(tmp_13, TupleType)) {
                  tmp$ret$13 = false;
                  break $l$block_10;
                }
              }
              tmp$ret$13 = true;
            }
            if (tmp$ret$13) {
              var tmp_14;
              // Inline function 'kotlin.collections.map' call
              // Inline function 'kotlin.collections.mapTo' call
              var destination_0 = ArrayList.w(collectionSizeOrDefault(subtypeTransforms, 10));
              var _iterator__ex2g4s_6 = subtypeTransforms.s();
              while (_iterator__ex2g4s_6.t()) {
                var item_0 = _iterator__ex2g4s_6.u();
                var tmp_15 = item_0.resolvedType;
                var tmp$ret$15 = toSet((isInterface(tmp_15, TupleTypeInstance) ? tmp_15 : THROW_CCE()).typeArguments);
                destination_0.r(tmp$ret$15);
              }
              if (1 === toSet(destination_0).v()) {
                var t_0 = first(subtypeTransforms);
                var tmp_16;
                var tmp_17;
                var tmp_18 = t_0.resolvedType.resolvedDeclaration;
                if (isInterface(tmp_18, TupleType)) {
                  var tmp_19 = t_0.resolvedType.resolvedDeclaration;
                  tmp_17 = (isInterface(tmp_19, TupleType) ? tmp_19 : THROW_CCE()).property.a1();
                } else {
                  tmp_17 = false;
                }
                if (tmp_17) {
                  tmp_16 = Companion_getInstance_3().toNoActionTrRule(StdLibDefault_getInstance().NothingType);
                } else {
                  tmp_16 = t_0;
                }
                tmp_14 = tmp_16;
              } else {
                var name = _SimpleName___init__impl__6s45d0(get_capitalise(_GrammarRuleName___get_value__impl__470s0v(choiceRule.name)));
                var unionType = $this.t2f_1.findOwnedOrCreateUnionTypeNamed(name, Grammar2TransformRuleSet$trRuleForRhsChoice$lambda_1(subtypeTransforms));
                // Inline function 'kotlin.collections.mapIndexed' call
                // Inline function 'kotlin.collections.mapIndexedTo' call
                var destination_1 = ArrayList.w(collectionSizeOrDefault(subtypeTransforms, 10));
                var index = 0;
                var _iterator__ex2g4s_7 = subtypeTransforms.s();
                while (_iterator__ex2g4s_7.t()) {
                  var item_1 = _iterator__ex2g4s_7.u();
                  var _unary__edvuaz = index;
                  index = _unary__edvuaz + 1 | 0;
                  var idx = checkIndexOverflow(_unary__edvuaz);
                  var tmp$ret$18 = new WhenOptionDefault(new InfixExpressionDefault(listOf_0([new LiteralExpressionDefault(StdLibDefault_getInstance().Integer.qualifiedTypeName, toLong(idx)), new RootExpressionDefault('$alternative')]), listOf('==')), item_1.expression);
                  destination_1.r(tmp$ret$18);
                }
                var options = destination_1;
                tmp_14 = transformationRule(unionType.type(), new WhenExpressionDefault(options, new WhenOptionElseDefault(Companion_getInstance_15().NOTHING)));
              }
              tmp_1 = tmp_14;
            } else {
              var name_0 = _SimpleName___init__impl__6s45d0(get_capitalise(_GrammarRuleName___get_value__impl__470s0v(choiceRule.name)));
              var unionType_0 = $this.t2f_1.findOwnedOrCreateUnionTypeNamed(name_0, Grammar2TransformRuleSet$trRuleForRhsChoice$lambda_2(subtypeTransforms));
              // Inline function 'kotlin.collections.mapIndexed' call
              // Inline function 'kotlin.collections.mapIndexedTo' call
              var destination_2 = ArrayList.w(collectionSizeOrDefault(subtypeTransforms, 10));
              var index_0 = 0;
              var _iterator__ex2g4s_8 = subtypeTransforms.s();
              while (_iterator__ex2g4s_8.t()) {
                var item_2 = _iterator__ex2g4s_8.u();
                var _unary__edvuaz_0 = index_0;
                index_0 = _unary__edvuaz_0 + 1 | 0;
                var idx_0 = checkIndexOverflow(_unary__edvuaz_0);
                var tmp$ret$21 = new WhenOptionDefault(new InfixExpressionDefault(listOf_0([new LiteralExpressionDefault(StdLibDefault_getInstance().Integer.qualifiedTypeName, toLong(idx_0)), new RootExpressionDefault('$alternative')]), listOf('==')), item_2.expression);
                destination_2.r(tmp$ret$21);
              }
              var options_0 = destination_2;
              tmp_1 = transformationRule(unionType_0.type(), new WhenExpressionDefault(options_0, new WhenOptionElseDefault(Companion_getInstance_15().NOTHING)));
            }
          }
        }
      }
    }
    tmp = tmp_1;
  }
  return tmp;
}
function trRuleForRhsOptional($this, rule, optItem) {
  var tmp = Grammar2TransformRuleSet$trRuleForRhsOptional$lambda;
  var trRule = findOrCreateTrRule($this, rule, new ConstructAndModify(tmp, Grammar2TransformRuleSet$trRuleForRhsOptional$lambda_0($this, optItem)));
  return trRule;
}
function trRuleForRhsListSimple($this, rule, listItem) {
  var tmp = Grammar2TransformRuleSet$trRuleForRhsListSimple$lambda;
  var trRule = findOrCreateTrRule($this, rule, new ConstructAndModify(tmp, Grammar2TransformRuleSet$trRuleForRhsListSimple$lambda_0($this, listItem)));
  return trRule;
}
function trRuleForRhsListSeparated($this, rule, listItem) {
  var tmp = Grammar2TransformRuleSet$trRuleForRhsListSeparated$lambda;
  var trRule = findOrCreateTrRule($this, rule, new ConstructAndModify(tmp, Grammar2TransformRuleSet$trRuleForRhsListSeparated$lambda_0($this, listItem)));
  return trRule;
}
function trRuleForRhsGroup($this, rule, group) {
  return trRuleForRuleItemGroup($this, group, false);
}
function trRuleForRuleItem($this, ruleItem, forProperty) {
  var existing = $this.b2g_1.z2(ruleItem);
  var tmp;
  if (!(null == existing)) {
    tmp = existing;
  } else {
    var tmp_0;
    if (isInterface(ruleItem, EmptyRule)) {
      tmp_0 = trRuleForRuleItemEmpty($this, ruleItem, forProperty);
    } else {
      if (isInterface(ruleItem, Terminal)) {
        tmp_0 = trRuleForRuleItemTerminal($this, ruleItem, forProperty);
      } else {
        if (isInterface(ruleItem, NonTerminal)) {
          tmp_0 = trRuleForRuleItemNonTerminal($this, ruleItem, forProperty);
        } else {
          if (isInterface(ruleItem, Embedded)) {
            tmp_0 = trRuleForRuleItemEmbedded($this, ruleItem, forProperty);
          } else {
            if (isInterface(ruleItem, Concatenation)) {
              tmp_0 = trRuleForRuleItemConcatenation($this, ruleItem, ruleItem.items);
            } else {
              if (isInterface(ruleItem, Choice)) {
                tmp_0 = trRuleForRuleItemChoice($this, ruleItem, forProperty);
              } else {
                if (isInterface(ruleItem, OptionalItem)) {
                  tmp_0 = trRuleForRuleItemOptional($this, ruleItem, forProperty);
                } else {
                  if (isInterface(ruleItem, SimpleList)) {
                    tmp_0 = trRuleForRuleItemListSimple($this, ruleItem, forProperty);
                  } else {
                    if (isInterface(ruleItem, SeparatedList)) {
                      tmp_0 = trRuleForRuleItemListSeparated($this, ruleItem, forProperty);
                    } else {
                      if (isInterface(ruleItem, Group)) {
                        tmp_0 = trRuleForRuleItemGroup($this, ruleItem, forProperty);
                      } else {
                        var message = 'Internal error, unhandled subtype of RuleItem';
                        throw IllegalStateException.v4(toString(message));
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    var trRule = tmp_0;
    // Inline function 'kotlin.collections.set' call
    $this.b2g_1.r2(ruleItem, trRule);
    tmp = trRule;
  }
  return tmp;
}
function trRuleForRuleItemEmpty($this, ruleItem, forProperty) {
  return Companion_getInstance_3().toNoActionTrRule(StdLibDefault_getInstance().NothingType);
}
function trRuleForRuleItemTerminal($this, ruleItem, forProperty) {
  var tmp;
  if (forProperty) {
    tmp = Companion_getInstance_3().toNoActionTrRule(StdLibDefault_getInstance().NothingType);
  } else {
    tmp = Companion_getInstance_3().toLeafAsStringTrRule(StdLibDefault_getInstance().String);
  }
  return tmp;
}
function trRuleForRuleItemNonTerminal($this, ruleItem, forProperty) {
  var refRule = ruleItem.referencedRuleOrNull($this.v2f_1);
  var tmp;
  if (null == refRule) {
    tmp = Companion_getInstance_3().toNoActionTrRule(StdLibDefault_getInstance().NothingType);
  } else {
    if (refRule.isLeaf) {
      tmp = transformationRule(StdLibDefault_getInstance().String, Companion_getInstance_15().SELF);
    } else {
      var tmp_0 = refRule.rhs;
      if (isInterface(tmp_0, EmptyRule)) {
        tmp = Companion_getInstance_3().toNoActionTrRule(StdLibDefault_getInstance().NothingType);
      } else {
        var trForRefRule = createOrFindTrRuleForGrammarRule($this, refRule);
        tmp = transformationRule(trForRefRule.resolvedType, Companion_getInstance_15().SELF);
      }
    }
  }
  return tmp;
}
function trRuleForRuleItemEmbedded($this, ruleItem, forProperty) {
  var g2ns = builderForEmbedded($this, ruleItem);
  var tmp0_elvis_lhs = ensureNotNull(g2ns.m2g_1).findTypeForRule(ruleItem.embeddedGoalName);
  var tmp;
  if (tmp0_elvis_lhs == null) {
    var message = "Internal error: type for '" + GrammarRuleName__toString_impl_przz03(ruleItem.embeddedGoalName) + "' not found";
    throw IllegalStateException.v4(toString(message));
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var t = tmp;
  return transformationRule(t, Companion_getInstance_15().SELF);
}
function trRuleForRuleItemChoice($this, choice, forProperty) {
  // Inline function 'kotlin.collections.map' call
  var this_0 = choice.alternative;
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
  var _iterator__ex2g4s = this_0.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var itemTr = trRuleForRuleItem($this, item, forProperty);
    var tmp;
    if (isInterface(item, Concatenation)) {
      tmp = itemTr;
    } else {
      var expr = new WithExpressionDefault(Companion_getInstance_3().EXPRESSION_CHILD(0), itemTr.expression);
      tmp = transformationRule(itemTr.resolvedType, expr);
    }
    var tmp$ret$0 = tmp;
    destination.r(tmp$ret$0);
  }
  var subtypeTransforms = destination;
  var tmp_0;
  if (allOfType(Companion_getInstance_3(), subtypeTransforms, StdLibDefault_getInstance().NothingType.resolvedDeclaration)) {
    var tmp_1 = StdLibDefault_getInstance().NothingType.resolvedDeclaration;
    var tmp_2 = emptyList();
    var tmp$ret$3;
    $l$block_0: {
      // Inline function 'kotlin.collections.any' call
      var tmp_3;
      if (isInterface(subtypeTransforms, Collection)) {
        tmp_3 = subtypeTransforms.a1();
      } else {
        tmp_3 = false;
      }
      if (tmp_3) {
        tmp$ret$3 = false;
        break $l$block_0;
      }
      var _iterator__ex2g4s_0 = subtypeTransforms.s();
      while (_iterator__ex2g4s_0.t()) {
        var element = _iterator__ex2g4s_0.u();
        if (element.resolvedType.isNullable) {
          tmp$ret$3 = true;
          break $l$block_0;
        }
      }
      tmp$ret$3 = false;
    }
    var t = tmp_1.type(tmp_2, tmp$ret$3);
    tmp_0 = Companion_getInstance_3().toNoActionTrRule(t);
  } else if (allOfType(Companion_getInstance_3(), subtypeTransforms, StdLibDefault_getInstance().String.resolvedDeclaration)) {
    tmp_0 = transformationRule(StdLibDefault_getInstance().String, Companion_getInstance_3().EXPRESSION_CHILD(0));
  } else if (allOfTypeIs(Companion_getInstance_3(), subtypeTransforms, getKClass(DataType))) {
    var name = typeNameForChoiceItem($this, choice);
    var unionType = $this.t2f_1.findOwnedOrCreateUnionTypeNamed(name, Grammar2TransformRuleSet$trRuleForRuleItemChoice$lambda(subtypeTransforms));
    tmp_0 = Companion_getInstance_3().toSubtypeTrRule(unionType.type());
  } else if (allOfType(Companion_getInstance_3(), subtypeTransforms, StdLibDefault_getInstance().List)) {
    var itemType = StdLibDefault_getInstance().AnyType;
    var choiceType = StdLibDefault_getInstance().List.type(listOf(itemType.asTypeArgument));
    tmp_0 = Companion_getInstance_3().toSubtypeTrRule(choiceType);
  } else if (allOfTypeIs(Companion_getInstance_3(), subtypeTransforms, getKClass(TupleType)) && allTupleTypesMatch(Companion_getInstance_3(), subtypeTransforms)) {
    var t_0 = first(subtypeTransforms);
    var rt = t_0.resolvedType;
    var tmp_4;
    var tmp_5;
    var tmp_6 = rt.resolvedDeclaration;
    if (isInterface(tmp_6, TupleType)) {
      tmp_5 = (isInterface(rt, TupleTypeInstance) ? rt : THROW_CCE()).typeArguments.a1();
    } else {
      tmp_5 = false;
    }
    if (tmp_5) {
      tmp_4 = Companion_getInstance_3().toNoActionTrRule(StdLibDefault_getInstance().NothingType);
    } else {
      tmp_4 = t_0;
    }
    tmp_0 = tmp_4;
  } else {
    var name_0 = typeNameForChoiceItem($this, choice);
    var unionType_0 = $this.t2f_1.findOwnedOrCreateUnionTypeNamed(name_0, Grammar2TransformRuleSet$trRuleForRuleItemChoice$lambda_0(subtypeTransforms));
    // Inline function 'kotlin.collections.mapIndexed' call
    // Inline function 'kotlin.collections.mapIndexedTo' call
    var destination_0 = ArrayList.w(collectionSizeOrDefault(subtypeTransforms, 10));
    var index = 0;
    var _iterator__ex2g4s_1 = subtypeTransforms.s();
    while (_iterator__ex2g4s_1.t()) {
      var item_0 = _iterator__ex2g4s_1.u();
      var _unary__edvuaz = index;
      index = _unary__edvuaz + 1 | 0;
      var idx = checkIndexOverflow(_unary__edvuaz);
      var tmp$ret$5 = new WhenOptionDefault(new InfixExpressionDefault(listOf_0([new LiteralExpressionDefault(StdLibDefault_getInstance().Integer.qualifiedTypeName, toLong(idx)), new RootExpressionDefault('$alternative')]), listOf('==')), item_0.expression);
      destination_0.r(tmp$ret$5);
    }
    var options = destination_0;
    tmp_0 = transformationRule(unionType_0.type(), new WhenExpressionDefault(options, new WhenOptionElseDefault(Companion_getInstance_15().NOTHING)));
  }
  return tmp_0;
}
function trRuleForRuleItemConcatenation($this, ruleItem, items) {
  // Inline function 'kotlin.collections.mutableListOf' call
  var assignments = ArrayList.y();
  // Inline function 'kotlin.collections.mutableListOf' call
  var typeArgs = ArrayList.y();
  var ti = $this.t2f_1.createTupleTypeInstance(typeArgs, false);
  var tr = transformationRule(ti, new CreateTupleExpressionDefault(assignments));
  // Inline function 'kotlin.collections.set' call
  $this.b2g_1.r2(ruleItem, tr);
  var ttSub = new Grammar2TransformRuleSet$trRuleForRuleItemConcatenation$ttSub$1($this);
  // Inline function 'kotlin.collections.mapIndexedNotNull' call
  // Inline function 'kotlin.collections.mapIndexedNotNullTo' call
  var destination = ArrayList.y();
  // Inline function 'kotlin.collections.forEachIndexed' call
  var index = 0;
  var _iterator__ex2g4s = items.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var _unary__edvuaz = index;
    index = _unary__edvuaz + 1 | 0;
    var idx = checkIndexOverflow(_unary__edvuaz);
    var tmp0_safe_receiver = createPropertyDeclarationAndAssignment($this, ttSub, item, idx);
    if (tmp0_safe_receiver == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      destination.r(tmp0_safe_receiver);
    }
  }
  var asses = destination;
  var props = ttSub.property;
  assignments.x(asses);
  // Inline function 'kotlin.collections.map' call
  // Inline function 'kotlin.collections.mapTo' call
  var destination_0 = ArrayList.w(collectionSizeOrDefault(props, 10));
  var _iterator__ex2g4s_0 = props.s();
  while (_iterator__ex2g4s_0.t()) {
    var item_0 = _iterator__ex2g4s_0.u();
    var tmp$ret$10 = new TypeArgumentNamedSimple(item_0.name, item_0.typeInstance);
    destination_0.r(tmp$ret$10);
  }
  typeArgs.x(destination_0);
  var tmp;
  if (props.a1()) {
    var trn = Companion_getInstance_3().toNoActionTrRule(StdLibDefault_getInstance().NothingType);
    // Inline function 'kotlin.collections.set' call
    $this.b2g_1.r2(ruleItem, tr);
    tmp = trn;
  } else {
    tmp = tr;
  }
  return tmp;
}
function trRuleForRuleItemOptional($this, ruleItem, forProperty) {
  var trRule = trRuleForRuleItem($this, ruleItem.item, forProperty);
  var tmp0_subject = trRule.resolvedType.resolvedDeclaration;
  var tmp;
  if (equals(tmp0_subject, StdLibDefault_getInstance().NothingType.resolvedDeclaration)) {
    tmp = Companion_getInstance_3().toNoActionTrRule(StdLibDefault_getInstance().NothingType);
  } else {
    var optType = trRule.resolvedType.resolvedDeclaration.type(emptyList(), true);
    ruleItem.item;
    var expr = new WithExpressionDefault(Companion_getInstance_3().EXPRESSION_CHILD(0), trRule.expression);
    var optTr = transformationRule(optType, expr);
    // Inline function 'kotlin.collections.set' call
    $this.b2g_1.r2(ruleItem, optTr);
    tmp = optTr;
  }
  return tmp;
}
function trRuleForRuleItemListSimple($this, ruleItem, forProperty) {
  var listItem = ruleItem.item;
  var tmp;
  if (isInterface(listItem, NonTerminal)) {
    // Inline function 'kotlin.collections.mutableListOf' call
    var typeArgs = ArrayList.y();
    var ti = StdLibDefault_getInstance().List.type(typeArgs);
    var tr = transformationRule(ti, new RootExpressionDefault('children'));
    // Inline function 'kotlin.collections.set' call
    $this.b2g_1.r2(ruleItem, tr);
    var trRuleForItem = trRuleForRuleItem($this, ruleItem.item, forProperty);
    typeArgs.r(trRuleForItem.resolvedType.asTypeArgument);
    tmp = new Pair(tr, trRuleForItem.resolvedType.resolvedDeclaration);
  } else {
    // Inline function 'kotlin.collections.mutableListOf' call
    var typeArgs_0 = ArrayList.y();
    var ti_0 = StdLibDefault_getInstance().List.type(typeArgs_0);
    // Inline function 'kotlin.collections.mutableListOf' call
    var nav = ArrayList.y();
    var exp = new NavigationExpressionDefault(new RootExpressionDefault('children'), nav);
    var tr_0 = transformationRule(ti_0, exp);
    // Inline function 'kotlin.collections.set' call
    $this.b2g_1.r2(ruleItem, tr_0);
    var trRuleForItem_0 = trRuleForRuleItem($this, ruleItem.item, forProperty);
    nav.r(new MethodCallDefault('map', listOf(new LambdaExpressionDefault(new WithExpressionDefault(new RootExpressionDefault('it'), trRuleForItem_0.expression)))));
    typeArgs_0.r(trRuleForItem_0.resolvedType.asTypeArgument);
    tmp = new Pair(tr_0, trRuleForItem_0.resolvedType.resolvedDeclaration);
  }
  var _destruct__k2r9zo = tmp;
  var tr_1 = _destruct__k2r9zo.bh();
  var itemType = _destruct__k2r9zo.ch();
  var tmp_0;
  if (equals(itemType, StdLibDefault_getInstance().NothingType.resolvedDeclaration)) {
    $this.b2g_1.s2(ruleItem);
    tmp_0 = Companion_getInstance_3().toNoActionTrRule(StdLibDefault_getInstance().NothingType);
  } else {
    tmp_0 = tr_1;
  }
  return tmp_0;
}
function trRuleForRuleItemListSeparated($this, ruleItem, forProperty) {
  // Inline function 'kotlin.collections.mutableListOf' call
  var typeArgs = ArrayList.y();
  var t = Companion_getInstance_3().toListTrRule(StdLibDefault_getInstance().ListSeparated.type(typeArgs));
  // Inline function 'kotlin.collections.set' call
  $this.b2g_1.r2(ruleItem, t);
  var trRuleForItem = trRuleForRuleItem($this, ruleItem.item, forProperty);
  var trRuleForSep = trRuleForRuleItem($this, ruleItem.separator, forProperty);
  var tmp;
  if (equals(trRuleForItem.resolvedType.resolvedDeclaration, StdLibDefault_getInstance().NothingType.resolvedDeclaration)) {
    $this.b2g_1.s2(ruleItem);
    tmp = Companion_getInstance_3().toNoActionTrRule(StdLibDefault_getInstance().NothingType);
  } else if (equals(trRuleForSep.resolvedType.resolvedDeclaration, StdLibDefault_getInstance().NothingType.resolvedDeclaration)) {
    var lt = Companion_getInstance_3().toSListItemsTrRule(StdLibDefault_getInstance().List.type(listOf(trRuleForItem.resolvedType.asTypeArgument)));
    // Inline function 'kotlin.collections.set' call
    $this.b2g_1.r2(ruleItem, lt);
    tmp = lt;
  } else {
    typeArgs.r(trRuleForItem.resolvedType.asTypeArgument);
    typeArgs.r(trRuleForSep.resolvedType.asTypeArgument);
    tmp = t;
  }
  return tmp;
}
function trRuleForRuleItemGroup($this, group, forProperty) {
  var content = group.groupedContent;
  var tmp;
  if (isInterface(content, Choice)) {
    tmp = trRuleForRuleItemChoice($this, content, forProperty);
  } else {
    if (isInterface(content, OptionalItem)) {
      tmp = trRuleForGroupContentOptional($this, content);
    } else {
      var tmp_0;
      if (isInterface(content, Concatenation)) {
        tmp_0 = content.items;
      } else {
        tmp_0 = listOf(content);
      }
      var items = tmp_0;
      tmp = trRuleForRuleItemConcatenation($this, group, items);
    }
  }
  return tmp;
}
function trRuleForGroupContentOptional($this, optItem) {
  var ttSub = new Grammar2TransformRuleSet$trRuleForGroupContentOptional$ttSub$1($this);
  var assignment = createPropertyDeclarationAndAssignment($this, ttSub, optItem.item, 0);
  var tmp;
  if (null == assignment) {
    tmp = Companion_getInstance_3().toNoActionTrRule($this.t2f_1.createTupleTypeInstance(emptyList(), false));
  } else {
    // Inline function 'kotlin.collections.map' call
    var this_0 = ttSub.property;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = new TypeArgumentNamedSimple(item.name, item.typeInstance.nullable());
      destination.r(tmp$ret$0);
    }
    var typeArgs = destination;
    var ti = $this.t2f_1.createTupleTypeInstance(typeArgs, false);
    var tr = transformationRule(ti, new CreateTupleExpressionDefault(listOf(assignment)));
    tmp = tr;
  }
  return tmp;
}
function createPropertyDeclarationAndAssignment($this, et, ruleItem, childIndex) {
  var tmp;
  if (isInterface(ruleItem, EmptyRule)) {
    tmp = null;
  } else {
    if (isInterface(ruleItem, Terminal)) {
      tmp = null;
    } else {
      if (isInterface(ruleItem, NonTerminal)) {
        var refRule = ruleItem.referencedRuleOrNull($this.v2f_1);
        tmp = createPropertyDeclarationAndAssignmentForReferencedRule($this, refRule, et, ruleItem, childIndex);
      } else {
        var tr = trRuleForRuleItem($this, ruleItem, true);
        var tmp_0;
        var tmp_1;
        if (isInterface(ruleItem, Terminal)) {
          tmp_1 = true;
        } else {
          tmp_1 = isInterface(ruleItem, NonTerminal);
        }
        if (tmp_1) {
          tmp_0 = Companion_getInstance_3().EXPRESSION_CHILD(childIndex);
        } else {
          tmp_0 = new WithExpressionDefault(Companion_getInstance_3().EXPRESSION_CHILD(childIndex), tr.expression);
        }
        var rhs = tmp_0;
        var tmp_2;
        if (isInterface(ruleItem, OptionalItem)) {
          tmp_2 = propertyNameFor($this, ruleItem.item, tr.resolvedType.resolvedDeclaration);
        } else {
          if (isInterface(ruleItem, ListOfItems)) {
            tmp_2 = propertyNameFor($this, ruleItem.item, tr.resolvedType.resolvedDeclaration);
          } else {
            tmp_2 = propertyNameFor($this, ruleItem, tr.resolvedType.resolvedDeclaration);
          }
        }
        var n = tmp_2;
        var tmp3_subject = tr.resolvedType.resolvedDeclaration;
        var ass = equals(tmp3_subject, StdLibDefault_getInstance().NothingType.resolvedDeclaration) ? null : createUniquePropertyDeclarationAndAssignment($this, et, n, tr.resolvedType, childIndex, rhs);
        tmp = ass;
      }
    }
  }
  return tmp;
}
function createPropertyDeclarationAndAssignmentForReferencedRule($this, refRule, et, ruleItem, childIndex) {
  var rhs = refRule == null ? null : refRule.rhs;
  var tmp;
  if (!(rhs == null) ? isInterface(rhs, ListOfItems) : false) {
    var tmp_0;
    if (isInterface(rhs, SimpleList)) {
      var tmp3_subject = rhs.item;
      var tmp_1;
      if (isInterface(tmp3_subject, Terminal)) {
        tmp_1 = true;
      } else {
        tmp_1 = false;
      }
      tmp_0 = tmp_1;
    } else {
      if (isInterface(rhs, SeparatedList)) {
        var tmp4_subject = rhs.item;
        var tmp_2;
        if (isInterface(tmp4_subject, Terminal)) {
          tmp_2 = true;
        } else {
          tmp_2 = false;
        }
        tmp_0 = tmp_2;
      } else {
        var message = 'Internal Error: not handled ' + getKClassFromExpression(rhs).zc();
        throw IllegalStateException.v4(toString(message));
      }
    }
    var ignore = tmp_0;
    var tmp_3;
    if (ignore) {
      tmp_3 = null;
    } else {
      var propTr = trRuleForRuleItem($this, rhs, true);
      var pName = propertyNameFor($this, ruleItem, propTr.resolvedType.resolvedDeclaration);
      var tmp_4;
      if (isInterface(rhs, SimpleList)) {
        tmp_4 = rhs.item;
      } else {
        if (isInterface(rhs, SeparatedList)) {
          tmp_4 = rhs.item;
        } else {
          var message_0 = 'Internal Error: not handled ' + getKClassFromExpression(rhs).zc();
          throw IllegalStateException.v4(toString(message_0));
        }
      }
      var colItem = tmp_4;
      var colPName = propertyNameFor($this, colItem, propTr.resolvedType.resolvedDeclaration);
      var expr = new WithExpressionDefault(Companion_getInstance_3().EXPRESSION_CHILD_i_prop(childIndex, colPName), propTr.expression);
      tmp_3 = createUniquePropertyDeclarationAndAssignment($this, et, pName, propTr.resolvedType, childIndex, Companion_getInstance_3().EXPRESSION_CHILD_i_prop(childIndex, colPName));
    }
    tmp = tmp_3;
  } else {
    var propType = trRuleForRuleItem($this, ruleItem, true);
    var pName_0 = propertyNameFor($this, ruleItem, propType.resolvedType.resolvedDeclaration);
    tmp = createUniquePropertyDeclarationAndAssignment($this, et, pName_0, propType.resolvedType, childIndex, Companion_getInstance_3().EXPRESSION_CHILD(childIndex));
  }
  return tmp;
}
function propertyNameFor($this, ruleItem, ruleItemType) {
  var tmp;
  if ($this.x2f_1 == null) {
    var tmp_0;
    if (isInterface(ruleItem, EmptyRule)) {
      var message = 'should not happen';
      throw IllegalStateException.v4(toString(message));
    } else {
      if (isInterface(ruleItem, Terminal)) {
        var tmp_1;
        if (isInterface(ruleItemType, PrimitiveType)) {
          tmp_1 = Companion_getInstance_3().UNNAMED_PRIMITIVE_PROPERTY_NAME;
        } else {
          if (isInterface(ruleItemType, CollectionType)) {
            tmp_1 = Companion_getInstance_3().UNNAMED_LIST_PROPERTY_NAME;
          } else {
            if (isInterface(ruleItemType, TupleType)) {
              tmp_1 = Companion_getInstance_3().UNNAMED_TUPLE_PROPERTY_NAME;
            } else {
              tmp_1 = Companion_getInstance_3().UNNAMED_PRIMITIVE_PROPERTY_NAME;
            }
          }
        }
        tmp_0 = tmp_1;
      } else {
        if (isInterface(ruleItem, Embedded)) {
          tmp_0 = _PropertyName___init__impl__sz2wu9(lower(_GrammarRuleName___get_value__impl__470s0v(ruleItem.embeddedGoalName)));
        } else {
          if (isInterface(ruleItem, NonTerminal)) {
            tmp_0 = _PropertyName___init__impl__sz2wu9(_GrammarRuleName___get_value__impl__470s0v(ruleItem.ruleReference));
          } else {
            if (isInterface(ruleItem, Group)) {
              tmp_0 = Companion_getInstance_3().UNNAMED_GROUP_PROPERTY_NAME;
            } else {
              var message_0 = 'Internal error, unhandled subtype of SimpleItem';
              throw IllegalStateException.v4(toString(message_0));
            }
          }
        }
      }
    }
    tmp = tmp_0;
  } else {
    tmp = $this.x2f_1.propertyNameFor($this.v2f_1, ruleItem, ruleItemType);
  }
  return tmp;
}
function typeNameForChoiceItem($this, choice) {
  var ruleName = choice.owningRule.name;
  var tmp0_elvis_lhs = $this.c2g_1.z2(new GrammarRuleName(ruleName));
  var tmp;
  if (tmp0_elvis_lhs == null) {
    // Inline function 'kotlin.let' call
    var tmp0 = $this.c2g_1;
    // Inline function 'kotlin.collections.set' call
    var key = new GrammarRuleName(ruleName);
    tmp0.r2(key, 1);
    tmp = 1;
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var nextNum = tmp;
  var tmp2 = $this.c2g_1;
  var tmp3 = new GrammarRuleName(ruleName);
  // Inline function 'kotlin.collections.set' call
  var value = nextNum + 1 | 0;
  tmp2.r2(tmp3, value);
  return _SimpleName___init__impl__6s45d0(get_capitalise(_GrammarRuleName___get_value__impl__470s0v(ruleName)) + '$' + nextNum);
}
function createUniquePropertyDeclarationAndAssignment($this, et, name, type, childIndex, rhsExpression) {
  var uniqueName = createUniquePropertyNameFor($this, et, name);
  var characteristics = setOf(PropertyCharacteristic_COMPOSITE_getInstance());
  var pd = et.appendPropertyStored(uniqueName, type, characteristics, childIndex);
  return new AssignmentStatementDefault(_PropertyName___get_value__impl__p219lh(uniqueName), childIndex, rhsExpression);
}
function createUniquePropertyNameFor($this, et, name) {
  var key = new Pair(et, new PropertyName(name));
  var nameCount = $this.z2f_1.z2(key);
  var tmp;
  if (null == nameCount) {
    // Inline function 'kotlin.collections.set' call
    $this.z2f_1.r2(key, 2);
    tmp = name;
  } else {
    var tmp3 = $this.z2f_1;
    // Inline function 'kotlin.collections.set' call
    var value = nameCount + 1 | 0;
    tmp3.r2(key, value);
    tmp = _PropertyName___init__impl__sz2wu9(_PropertyName___get_value__impl__p219lh(name) + nameCount);
  }
  var uniqueName = tmp;
  return uniqueName;
}
function Grammar2TransformRuleSet$trRuleForRhsItemList$lambda(it) {
  return transformationRule(it.type(), new CreateObjectExpressionDefault(new QualifiedName(it.qualifiedName), emptyList()));
}
function Grammar2TransformRuleSet$trRuleForRhsItemList$lambda_0($items, this$0) {
  return (tr) => {
    // Inline function 'kotlin.collections.mapIndexedNotNull' call
    var tmp0 = $items;
    // Inline function 'kotlin.collections.mapIndexedNotNullTo' call
    var destination = ArrayList.y();
    // Inline function 'kotlin.collections.forEachIndexed' call
    var index = 0;
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var _unary__edvuaz = index;
      index = _unary__edvuaz + 1 | 0;
      var idx = checkIndexOverflow(_unary__edvuaz);
      var tmp = tr.resolvedType.resolvedDeclaration;
      var tmp0_safe_receiver = createPropertyDeclarationAndAssignment(this$0, isInterface(tmp, StructuredType) ? tmp : THROW_CCE(), item, idx);
      if (tmp0_safe_receiver == null)
        null;
      else {
        // Inline function 'kotlin.let' call
        destination.r(tmp0_safe_receiver);
      }
    }
    var ass = destination;
    var tmp_0 = tr.q2g_1;
    (tmp_0 instanceof CreateObjectExpressionDefault ? tmp_0 : THROW_CCE()).v2g_1 = ass;
    return Unit_instance;
  };
}
function Grammar2TransformRuleSet$trRuleForRhsChoice$lambda(it) {
  return transformationRule(it.type(), Companion_getInstance_3().EXPRESSION_CHILD(0));
}
function Grammar2TransformRuleSet$trRuleForRhsChoice$lambda_0($subtypeTransforms) {
  return (tr) => {
    var tmp = tr.resolvedType.resolvedDeclaration;
    var tp = isInterface(tmp, DataType) ? tmp : THROW_CCE();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $subtypeTransforms.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp_0 = element.resolvedType.resolvedDeclaration;
      (isInterface(tmp_0, DataType) ? tmp_0 : THROW_CCE()).addSupertype_dep(new QualifiedName(tp.qualifiedName));
      tp.addSubtype_dep(new QualifiedName(element.resolvedType.resolvedDeclaration.qualifiedName));
    }
    return Unit_instance;
  };
}
function Grammar2TransformRuleSet$trRuleForRhsChoice$lambda_1($subtypeTransforms) {
  return (ut) => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = $subtypeTransforms;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item.resolvedType;
      destination.r(tmp$ret$0);
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = destination.s();
    while (_iterator__ex2g4s_0.t()) {
      var element = _iterator__ex2g4s_0.u();
      ut.addAlternative(element);
    }
    return Unit_instance;
  };
}
function Grammar2TransformRuleSet$trRuleForRhsChoice$lambda_2($subtypeTransforms) {
  return (ut) => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = $subtypeTransforms;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item.resolvedType;
      destination.r(tmp$ret$0);
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = destination.s();
    while (_iterator__ex2g4s_0.t()) {
      var element = _iterator__ex2g4s_0.u();
      ut.addAlternative(element);
    }
    return Unit_instance;
  };
}
function Grammar2TransformRuleSet$trRuleForRhsOptional$lambda(it) {
  return transformationRule(it.type(), new CreateObjectExpressionDefault(new QualifiedName(it.qualifiedName), emptyList()));
}
function Grammar2TransformRuleSet$trRuleForRhsOptional$lambda_0(this$0, $optItem) {
  return (tr) => {
    var tmp = tr.resolvedType.resolvedDeclaration;
    var et = isInterface(tmp, StructuredType) ? tmp : THROW_CCE();
    var t = trRuleForRuleItem(this$0, $optItem, true);
    var tmp_0;
    if (equals(t.resolvedType.resolvedDeclaration, StdLibDefault_getInstance().NothingType.resolvedDeclaration)) {
      tmp_0 = null;
    } else {
      var childIndex = 0;
      var pName = propertyNameFor(this$0, $optItem.item, t.resolvedType.resolvedDeclaration);
      var rhs = Companion_getInstance_3().EXPRESSION_CHILD(childIndex);
      tmp_0 = createUniquePropertyDeclarationAndAssignment(this$0, et, pName, t.resolvedType, childIndex, rhs);
    }
    var ass = tmp_0;
    var tmp_1 = tr.q2g_1;
    (tmp_1 instanceof CreateObjectExpressionDefault ? tmp_1 : THROW_CCE()).v2g_1 = filterNotNull(listOf(ass));
    return Unit_instance;
  };
}
function Grammar2TransformRuleSet$trRuleForRhsListSimple$lambda(it) {
  return transformationRule(it.type(), new CreateObjectExpressionDefault(new QualifiedName(it.qualifiedName), emptyList()));
}
function Grammar2TransformRuleSet$trRuleForRhsListSimple$lambda_0(this$0, $listItem) {
  return (tr) => {
    var tmp = tr.resolvedType.resolvedDeclaration;
    var et = isInterface(tmp, StructuredType) ? tmp : THROW_CCE();
    var t = trRuleForRuleItem(this$0, $listItem, true);
    var tmp_0;
    if (equals(t.resolvedType.resolvedDeclaration, StdLibDefault_getInstance().NothingType.resolvedDeclaration)) {
      tmp_0 = null;
    } else {
      var childIndex = 0;
      var pName = propertyNameFor(this$0, $listItem.item, t.resolvedType.resolvedDeclaration);
      var rhs = Companion_getInstance_3().EXPRESSION_CHILDREN;
      tmp_0 = createUniquePropertyDeclarationAndAssignment(this$0, et, pName, t.resolvedType, childIndex, rhs);
    }
    var ass = tmp_0;
    var tmp_1 = tr.q2g_1;
    (tmp_1 instanceof CreateObjectExpressionDefault ? tmp_1 : THROW_CCE()).v2g_1 = filterNotNull(listOf(ass));
    return Unit_instance;
  };
}
function Grammar2TransformRuleSet$trRuleForRhsListSeparated$lambda(it) {
  return transformationRule(it.type(), new CreateObjectExpressionDefault(new QualifiedName(it.qualifiedName), emptyList()));
}
function Grammar2TransformRuleSet$trRuleForRhsListSeparated$lambda_0(this$0, $listItem) {
  return (tr) => {
    var tmp = tr.resolvedType.resolvedDeclaration;
    var et = isInterface(tmp, StructuredType) ? tmp : THROW_CCE();
    var t = trRuleForRuleItem(this$0, $listItem, true);
    var tmp_0;
    if (equals(t.resolvedType.resolvedDeclaration, StdLibDefault_getInstance().NothingType.resolvedDeclaration)) {
      tmp_0 = null;
    } else {
      var childIndex = 0;
      var pName = propertyNameFor(this$0, $listItem.item, t.resolvedType.resolvedDeclaration);
      var rhs = t.expression;
      tmp_0 = createUniquePropertyDeclarationAndAssignment(this$0, et, pName, t.resolvedType, childIndex, rhs);
    }
    var ass = tmp_0;
    var tmp_1 = tr.q2g_1;
    (tmp_1 instanceof CreateObjectExpressionDefault ? tmp_1 : THROW_CCE()).v2g_1 = filterNotNull(listOf(ass));
    return Unit_instance;
  };
}
function Grammar2TransformRuleSet$trRuleForRuleItemChoice$lambda($subtypeTransforms) {
  return (ut) => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = $subtypeTransforms;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item.resolvedType;
      destination.r(tmp$ret$0);
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = destination.s();
    while (_iterator__ex2g4s_0.t()) {
      var element = _iterator__ex2g4s_0.u();
      ut.addAlternative(element);
    }
    return Unit_instance;
  };
}
function Grammar2TransformRuleSet$trRuleForRuleItemChoice$lambda_0($subtypeTransforms) {
  return (ut) => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = $subtypeTransforms;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item.resolvedType;
      destination.r(tmp$ret$0);
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = destination.s();
    while (_iterator__ex2g4s_0.t()) {
      var element = _iterator__ex2g4s_0.u();
      ut.addAlternative(element);
    }
    return Unit_instance;
  };
}
function createGrammar2Namespaces($this, grammar) {
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = grammar.extends.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var tmp0_elvis_lhs = element.resolved;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = "Grammar Reference '" + element.nameOrQName.value + "' is not resolved.";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var exg = tmp;
    var g2n = getOrCreate($this, exg);
    var tmp1 = $this.v2i_1;
    // Inline function 'kotlin.collections.set' call
    var key = new QualifiedName(exg.qualifiedName);
    tmp1.r2(key, g2n);
  }
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s_0 = grammar.allResolvedEmbeddedGrammars.s();
  while (_iterator__ex2g4s_0.t()) {
    var element_0 = _iterator__ex2g4s_0.u();
    var g2n_0 = getOrCreate($this, element_0);
    var tmp0 = $this.v2i_1;
    // Inline function 'kotlin.collections.set' call
    var key_0 = new QualifiedName(element_0.qualifiedName);
    tmp0.r2(key_0, g2n_0);
  }
  return new Grammar2Namespaces($this.t2i_1, $this.q2i_1, $this.u2i_1, grammar, $this.v2i_1, $this.s2i_1);
}
function getOrCreate($this, grammar) {
  var existing = $this.v2i_1.z2(new QualifiedName(grammar.qualifiedName));
  var tmp;
  if (existing == null) {
    var rel = createGrammar2Namespaces($this, grammar);
    rel.fb();
    var tmp0 = $this.v2i_1;
    // Inline function 'kotlin.collections.set' call
    var key = new QualifiedName(grammar.qualifiedName);
    tmp0.r2(key, rel);
    tmp = rel;
  } else {
    tmp = existing;
  }
  return tmp;
}
function findOrCreateGrammarNamespace($this, qualifiedName) {
  // Inline function 'kotlin.also' call
  var this_0 = Companion_instance_21.findOrCreateGrammarNamespace($this.h2g_1, qualifiedName);
  // Inline function 'kotlin.collections.map' call
  var this_1 = $this.j2g_1.allExtends;
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(this_1, 10));
  var _iterator__ex2g4s = this_1.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var tmp0_safe_receiver = item.resolved;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.qualifiedName;
    var tmp;
    var tmp_0 = tmp1_safe_receiver;
    if ((tmp_0 == null ? null : new QualifiedName(tmp_0)) == null) {
      tmp = null;
    } else {
      tmp = _QualifiedName___get_asImport__impl__hufagg(tmp1_safe_receiver);
    }
    var tmp2_elvis_lhs = tmp;
    var tmp_1;
    var tmp_2 = tmp2_elvis_lhs;
    if ((tmp_2 == null ? null : new Import(tmp_2)) == null) {
      var message = 'Should not happen - should already be resolved at this point!';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_1 = tmp2_elvis_lhs;
    }
    var tmp$ret$0 = new Import(tmp_1);
    destination.r(tmp$ret$0);
  }
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s_0 = destination.s();
  while (_iterator__ex2g4s_0.t()) {
    var element = _iterator__ex2g4s_0.u();
    var it = element.p2i_1;
    this_0.addImport(it);
  }
  // Inline function 'kotlin.also' call
  $this.h2g_1.resolveImports();
  return this_0;
}
function findOrCreateTransformNamespace($this) {
  // Inline function 'kotlin.collections.filterNot' call
  var tmp0 = $this.j2g_1.extends;
  // Inline function 'kotlin.collections.filterNotTo' call
  var destination = ArrayList.y();
  var _iterator__ex2g4s = tmp0.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    if (!equals(ensureNotNull(element.resolved).namespace, $this.j2g_1.namespace)) {
      destination.r(element);
    }
  }
  // Inline function 'kotlin.collections.map' call
  // Inline function 'kotlin.collections.mapTo' call
  var destination_0 = ArrayList.w(collectionSizeOrDefault(destination, 10));
  var _iterator__ex2g4s_0 = destination.s();
  while (_iterator__ex2g4s_0.t()) {
    var item = _iterator__ex2g4s_0.u();
    var tmp$ret$3 = new Import(_QualifiedName___get_asImport__impl__hufagg(ensureNotNull(item.resolved).namespace.qualifiedName));
    destination_0.r(tmp$ret$3);
  }
  var nsImports = destination_0;
  return $this.i2g_1.findOrCreateNamespace($this.j2g_1.namespace.qualifiedName, nsImports);
}
function raiseError($this, element, message) {
  $this.e2j_1.error($this.d2j_1.get(element), message);
}
function handleReferenceExpression($this, refExpr, context, self_0) {
  if (refExpr instanceof ReferenceExpressionPropertyDefault) {
    handlePropertyReferenceExpression($this, refExpr, context, self_0);
  } else {
    if (refExpr instanceof ReferenceExpressionCollectionDefault) {
      handleCollectionReferenceExpression($this, refExpr, context, self_0);
    } else {
      // Inline function 'kotlin.error' call
      var message = "subtype of 'ReferenceExpression' not handled: '" + getKClassFromExpression(refExpr).zc() + "'";
      throw IllegalStateException.v4(toString(message));
    }
  }
}
function handlePropertyReferenceExpression($this, refExpr, exprContext, self_0) {
  var tmp;
  if (refExpr.k2j_1 == null) {
    tmp = $this.f2j_1.ok();
  } else {
    var tmp1_safe_receiver = $this.typeModel.findByQualifiedNameOrNull(exprContext.element.qualifiedTypeName);
    var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.type();
    var elType = tmp2_elvis_lhs == null ? StdLibDefault_getInstance().AnyType : tmp2_elvis_lhs;
    var fromEl = $this.h2j_1.evaluateExpression(Companion_instance_14.ofSelf(new TypedObjectAsmValue(elType, exprContext.element)), refExpr.k2j_1).self;
    var tmp_0;
    if (isInterface(fromEl, AsmNothing)) {
      var message = "Cannot get scope for result of '" + toString(exprContext.element) + '.' + toString_0(refExpr.k2j_1) + "' in is " + AsmNothingSimple_getInstance().toString();
      throw IllegalStateException.v4(toString(message));
    } else {
      if (isInterface(fromEl, AsmStructure)) {
        var tmp_1 = $this.identifyingValueInFor(new SimpleName(_QualifiedName___get_last__impl__838y8h(exprContext.scope.forTypeName)), fromEl);
        var tmp4_elvis_lhs = (tmp_1 == null ? true : typeof tmp_1 === 'string') ? tmp_1 : THROW_CCE();
        var tmp_2;
        if (tmp4_elvis_lhs == null) {
          var message_0 = "'" + toString(fromEl) + "' not identifiable, therefore cannot determine it's scope";
          throw IllegalStateException.v4(toString(message_0));
        } else {
          tmp_2 = tmp4_elvis_lhs;
        }
        var fromElId = tmp_2;
        var tmp5_elvis_lhs = exprContext.scope.getChildScopeOrNull(fromElId);
        var tmp_3;
        if (tmp5_elvis_lhs == null) {
          var message_1 = "Scope for '" + fromElId + "' not found";
          throw IllegalStateException.v4(toString(message_1));
        } else {
          tmp_3 = tmp5_elvis_lhs;
        }
        var elScope = tmp_3;
        tmp_0 = elScope;
      } else {
        if (isInterface(fromEl, AsmReference)) {
          var v = fromEl.value;
          var tmp_4;
          if (null == v) {
            raiseError($this, self_0, 'Cannot resolve reference to ' + fromEl.reference);
            tmp_4 = null;
          } else {
            var tmp_5 = $this.identifyingValueInFor(new SimpleName(_QualifiedName___get_last__impl__838y8h(exprContext.scope.forTypeName)), v);
            var tmp6_elvis_lhs = (tmp_5 == null ? true : typeof tmp_5 === 'string') ? tmp_5 : THROW_CCE();
            var tmp_6;
            if (tmp6_elvis_lhs == null) {
              var message_2 = "'" + fromEl.reference + "' not identifiable, therefore cannot determine it's scope";
              throw IllegalStateException.v4(toString(message_2));
            } else {
              tmp_6 = tmp6_elvis_lhs;
            }
            var fromElId_0 = tmp_6;
            var tmp7_elvis_lhs = exprContext.scope.getChildScopeOrNull(fromElId_0);
            var tmp_7;
            if (tmp7_elvis_lhs == null) {
              var message_3 = "Scope for '" + fromElId_0 + "' not found";
              throw IllegalStateException.v4(toString(message_3));
            } else {
              tmp_7 = tmp7_elvis_lhs;
            }
            var elScope_0 = tmp_7;
            tmp_4 = elScope_0;
          }
          tmp_0 = tmp_4;
        } else {
          var message_4 = "Cannot get scope for result of '" + toString(exprContext.element) + '.' + toString_0(refExpr.k2j_1) + "' in is not an AsmStructure, rather it is a '" + getKClassFromExpression(fromEl).zc() + "'";
          throw IllegalStateException.v4(toString(message_4));
        }
      }
    }
    tmp = tmp_0;
  }
  var scope = tmp;
  if (!(null == scope)) {
    var tmp8_safe_receiver = $this.typeModel.findByQualifiedNameOrNull(self_0.qualifiedTypeName);
    var tmp9_elvis_lhs = tmp8_safe_receiver == null ? null : tmp8_safe_receiver.type();
    var elType_0 = tmp9_elvis_lhs == null ? StdLibDefault_getInstance().AnyType : tmp9_elvis_lhs;
    var referringValue = $this.h2j_1.evaluateExpression(Companion_instance_14.ofSelf(new TypedObjectAsmValue(elType_0, self_0)), refExpr.i2j_1).self;
    if (isInterface(referringValue, AsmReference)) {
      referringValue = Companion_instance_9.stdString(referringValue.reference);
    }
    if (isInterface(referringValue, AsmPrimitive)) {
      var tmp_8 = referringValue.value;
      var referringStr = typeof tmp_8 === 'string' ? tmp_8 : THROW_CCE();
      // Inline function 'kotlin.collections.mapNotNull' call
      var tmp0 = refExpr.j2j_1;
      // Inline function 'kotlin.collections.mapNotNullTo' call
      var destination = ArrayList.y();
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s = tmp0.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        var tmp0_safe_receiver = $this.typeModel.findFirstDefinitionByPossiblyQualifiedNameOrNull(element);
        if (tmp0_safe_receiver == null)
          null;
        else {
          // Inline function 'kotlin.let' call
          destination.r(tmp0_safe_receiver);
        }
      }
      var referredToTypes = destination;
      // Inline function 'kotlin.collections.flatMap' call
      // Inline function 'kotlin.collections.flatMapTo' call
      var destination_0 = ArrayList.y();
      var _iterator__ex2g4s_0 = referredToTypes.s();
      while (_iterator__ex2g4s_0.t()) {
        var element_0 = _iterator__ex2g4s_0.u();
        var tmp_9 = plus_0(scope.scopePath, referringStr);
        var list = $this.context.findItemsByQualifiedNameConformingTo(tmp_9, ReferenceResolverSimple$handlePropertyReferenceExpression$lambda($this, element_0));
        addAll(destination_0, list);
      }
      var targets = destination_0;
      if (targets.a1()) {
        var tmp_10;
        if (isInterface(self_0, AsmStructure)) {
          tmp_10 = $this.identifyingValueInFor(new SimpleName(_QualifiedName___get_last__impl__838y8h(scope.forTypeName)), self_0);
        } else {
          tmp_10 = toString(self_0);
        }
        var selfId = tmp_10;
        raiseError($this, self_0, "Reference '" + referringStr + "' not resolved, to type(s) " + toString(refExpr.j2j_1) + " in scope '" + scope.scopeIdentity + "'");
        var referringProperty = propertyFor($this, refExpr.i2j_1, self_0);
        createReference($this, self_0, referringProperty, null);
      } else if (1 < targets.v()) {
        var msg = 'Multiple target of type(s) ' + toString(refExpr.j2j_1) + " found for referring value '" + toString(referringValue.value) + "' in scope of element '" + toString(self_0) + "': " + toString(targets);
        raiseError($this, self_0, msg);
        var referringProperty_0 = propertyFor($this, refExpr.i2j_1, self_0);
        createReference($this, self_0, referringProperty_0, null);
      } else {
        var referred = first(targets).item;
        if (!(null == $this.resolveFunction)) {
          var ref = $this.resolveFunction.invoke(referred);
          if (ref == null) {
            raiseError($this, self_0, "Asm does not contain element '" + toString(referred) + "' as reference for '" + SimpleName__toString_impl_vxsxyc(self_0.typeName) + '.' + toString(refExpr.i2j_1) + "'");
          } else {
            if (!(ref == null) ? isInterface(ref, AsmStructure) : false) {
              var referringProperty_1 = propertyFor($this, refExpr.i2j_1, self_0);
              createReference($this, self_0, referringProperty_1, ref);
            } else {
              raiseError($this, self_0, "Asm element '" + toString(referred) + "' is not a reference to a structured element of the asm");
            }
          }
        } else {
          var referringProperty_2 = propertyFor($this, refExpr.i2j_1, self_0);
          createReference($this, self_0, referringProperty_2, null);
        }
      }
    } else {
      var tmp_11;
      if (isInterface(referringValue, AsmList)) {
        var tmp10 = referringValue.elements;
        var tmp$ret$10;
        $l$block_0: {
          // Inline function 'kotlin.collections.all' call
          var tmp_12;
          if (isInterface(tmp10, Collection)) {
            tmp_12 = tmp10.a1();
          } else {
            tmp_12 = false;
          }
          if (tmp_12) {
            tmp$ret$10 = true;
            break $l$block_0;
          }
          var _iterator__ex2g4s_1 = tmp10.s();
          while (_iterator__ex2g4s_1.t()) {
            var element_1 = _iterator__ex2g4s_1.u();
            var tmp_13;
            if (isInterface(element_1, AsmPrimitive)) {
              tmp_13 = get_isStdString(element_1);
            } else {
              tmp_13 = false;
            }
            if (!tmp_13) {
              tmp$ret$10 = false;
              break $l$block_0;
            }
          }
          tmp$ret$10 = true;
        }
        tmp_11 = tmp$ret$10;
      } else {
        tmp_11 = false;
      }
      if (tmp_11) {
        // Inline function 'kotlin.collections.map' call
        var this_0 = referringValue.elements;
        // Inline function 'kotlin.collections.mapTo' call
        var destination_1 = ArrayList.w(collectionSizeOrDefault(this_0, 10));
        var _iterator__ex2g4s_2 = this_0.s();
        while (_iterator__ex2g4s_2.t()) {
          var item = _iterator__ex2g4s_2.u();
          var tmp_14 = (isInterface(item, AsmPrimitive) ? item : THROW_CCE()).value;
          var tmp$ret$12 = typeof tmp_14 === 'string' ? tmp_14 : THROW_CCE();
          destination_1.r(tmp$ret$12);
        }
        var qname = destination_1;
        // Inline function 'kotlin.collections.mapNotNull' call
        var tmp0_0 = refExpr.j2j_1;
        // Inline function 'kotlin.collections.mapNotNullTo' call
        var destination_2 = ArrayList.y();
        // Inline function 'kotlin.collections.forEach' call
        var _iterator__ex2g4s_3 = tmp0_0.s();
        while (_iterator__ex2g4s_3.t()) {
          var element_2 = _iterator__ex2g4s_3.u();
          var tmp0_safe_receiver_0 = $this.typeModel.findFirstDefinitionByPossiblyQualifiedNameOrNull(element_2);
          if (tmp0_safe_receiver_0 == null)
            null;
          else {
            // Inline function 'kotlin.let' call
            destination_2.r(tmp0_safe_receiver_0);
          }
        }
        var referredToTypes_0 = destination_2;
        // Inline function 'kotlin.collections.flatMap' call
        // Inline function 'kotlin.collections.flatMapTo' call
        var destination_3 = ArrayList.y();
        var _iterator__ex2g4s_4 = referredToTypes_0.s();
        while (_iterator__ex2g4s_4.t()) {
          var element_3 = _iterator__ex2g4s_4.u();
          var list_0 = $this.context.findItemsByQualifiedNameConformingTo(qname, ReferenceResolverSimple$handlePropertyReferenceExpression$lambda_0($this, element_3));
          addAll(destination_3, list_0);
        }
        var targets_0 = destination_3;
        if (targets_0.a1()) {
          var tmp_15;
          if (isInterface(self_0, AsmStructure)) {
            tmp_15 = $this.identifyingValueInFor(new SimpleName(_QualifiedName___get_last__impl__838y8h(scope.forTypeName)), self_0);
          } else {
            tmp_15 = toString(self_0);
          }
          var selfId_0 = tmp_15;
          raiseError($this, self_0, "Reference '" + toString(qname) + "' not resolved, to type(s) " + toString(refExpr.j2j_1) + " in scope '" + scope.scopeIdentity + "'");
          var referringProperty_3 = propertyFor($this, refExpr.i2j_1, self_0);
          createReference($this, self_0, referringProperty_3, null);
        } else if (1 < targets_0.v()) {
          var msg_0 = 'Multiple target of type(s) ' + toString(refExpr.j2j_1) + " found for referring value '" + toString(qname) + "' in scope of element '" + toString(self_0) + "': " + toString(targets_0);
          raiseError($this, self_0, msg_0);
          var referringProperty_4 = propertyFor($this, refExpr.i2j_1, self_0);
          createReference($this, self_0, referringProperty_4, null);
        } else {
          var referred_0 = first(targets_0).item;
          if (!(null == $this.resolveFunction)) {
            var ref_0 = $this.resolveFunction.invoke(referred_0);
            if (ref_0 == null) {
              raiseError($this, self_0, "Asm does not contain element '" + toString(referred_0) + "' as reference for '" + SimpleName__toString_impl_vxsxyc(self_0.typeName) + '.' + toString(refExpr.i2j_1) + "'");
            } else {
              if (!(ref_0 == null) ? isInterface(ref_0, AsmStructure) : false) {
                var referringProperty_5 = propertyFor($this, refExpr.i2j_1, self_0);
                createReference($this, self_0, referringProperty_5, ref_0);
              } else {
                raiseError($this, self_0, "Asm element '" + toString(referred_0) + "' is not a reference to a structured element of the asm");
              }
            }
          } else {
            var referringProperty_6 = propertyFor($this, refExpr.i2j_1, self_0);
            createReference($this, self_0, referringProperty_6, null);
          }
        }
      } else {
        raiseError($this, self_0, "Referring value '" + SimpleName__toString_impl_vxsxyc(self_0.typeName) + '.' + toString(refExpr.i2j_1) + '=' + toString(referringValue) + "' on element " + toString(self_0) + ' is not a String or List<String>');
      }
    }
  }
}
function handleCollectionReferenceExpression($this, refExpr, context, self_0) {
  var tmp0_safe_receiver = $this.typeModel.findByQualifiedNameOrNull(self_0.qualifiedTypeName);
  var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.type();
  var elType = tmp1_elvis_lhs == null ? StdLibDefault_getInstance().AnyType : tmp1_elvis_lhs;
  var coll = $this.h2j_1.evaluateExpression(Companion_instance_14.ofSelf(new TypedObjectAsmValue(elType, self_0)), refExpr.l2j_1);
  var _iterator__ex2g4s = refExpr.n2j_1.s();
  while (_iterator__ex2g4s.t()) {
    var re = _iterator__ex2g4s.u();
    var tmp2_subject = coll.self;
    if (!isInterface(tmp2_subject, AsmNothing)) {
      if (isInterface(tmp2_subject, AsmList)) {
        var tmp = coll.self;
        var _iterator__ex2g4s_0 = (isInterface(tmp, AsmList) ? tmp : THROW_CCE()).elements.s();
        while (_iterator__ex2g4s_0.t()) {
          var el = _iterator__ex2g4s_0.u();
          if (!isInterface(el, AsmNothing)) {
            if (null == refExpr.m2j_1) {
              handleReferenceExpression($this, re, context, el);
            } else {
              if (conformsToType($this, el, refExpr.m2j_1)) {
                handleReferenceExpression($this, re, context, el);
              }
            }
          }
        }
      } else {
        // Inline function 'kotlin.error' call
        var message = "result of navigation should be a List<AsmElementSimple>, got '" + getKClassFromExpression(coll).zc() + "'";
        throw IllegalStateException.v4(toString(message));
      }
    }
  }
}
function createReference($this, source, referringProperty, refersTo) {
  referringProperty.convertToReferenceTo(refersTo);
  if (!(null == refersTo)) {
    var srcLocation = $this.d2j_1.get(source);
    var tgtLocation = $this.d2j_1.get(refersTo);
    $this.resolvedReferences.r(new ResolvedReference(source, srcLocation, refersTo, tgtLocation));
  }
}
function conformsToType($this, _this__u8e3s4, typeName) {
  var tmp0_elvis_lhs = $this.typeModel.findFirstDefinitionByPossiblyQualifiedNameOrNull(typeName);
  var type = tmp0_elvis_lhs == null ? StdLibDefault_getInstance().NothingType.resolvedDeclaration : tmp0_elvis_lhs;
  var selfType = typeOf($this, $this.typeModel, _this__u8e3s4);
  return selfType.conformsTo(type);
}
function typeOf($this, _this__u8e3s4, self_0) {
  var tmp0_elvis_lhs = $this.typeModel.findByQualifiedNameOrNull(self_0.qualifiedTypeName);
  var tmp;
  if (tmp0_elvis_lhs == null) {
    var message = "Type '" + QualifiedName__toString_impl_z3wem2(self_0.qualifiedTypeName) + "' not found in type model '" + SimpleName__toString_impl_vxsxyc(_this__u8e3s4.name) + "'";
    throw IllegalStateException.v4(toString(message));
  } else {
    tmp = tmp0_elvis_lhs;
  }
  return tmp;
}
function propertyFor($this, _this__u8e3s4, root) {
  var tmp;
  if (isInterface(root, AsmNothing)) {
    var message = "Cannot navigate '" + toString(_this__u8e3s4) + "' from '" + toString(root) + "' value";
    throw IllegalStateException.v4(toString(message));
  } else {
    if (_this__u8e3s4.parts.a1()) {
      var tmp_0;
      if (isInterface(root, AsmStructure)) {
        var exp = _this__u8e3s4.start;
        var tmp_1;
        if (isInterface(exp, RootExpression)) {
          tmp_1 = _PropertyValueName___init__impl__cmfy0i(exp.name);
        } else {
          if (isInterface(exp, PropertyCall)) {
            tmp_1 = _PropertyValueName___init__impl__cmfy0i(exp.propertyName);
          } else {
            var message_0 = 'Unsupoorted';
            throw IllegalStateException.v4(toString(message_0));
          }
        }
        var pn = tmp_1;
        var tmp2_elvis_lhs = root.property.z2(new PropertyValueName(pn));
        var tmp_2;
        if (tmp2_elvis_lhs == null) {
          var message_1 = "Cannot navigate '" + toString(_this__u8e3s4) + "' from null value";
          throw IllegalStateException.v4(toString(message_1));
        } else {
          tmp_2 = tmp2_elvis_lhs;
        }
        tmp_0 = tmp_2;
      } else {
        var message_2 = "Cannot navigate '" + toString(_this__u8e3s4) + "' from null value";
        throw IllegalStateException.v4(toString(message_2));
      }
      tmp = tmp_0;
    } else {
      var selfType = typeOf($this, $this.typeModel, root).type();
      var front = new NavigationExpressionDefault(_this__u8e3s4.start, dropLast(_this__u8e3s4.parts, 1));
      var evc = new EvaluationContext(null, mapOf(to(Companion_getInstance_15().SELF.o2j_1, new TypedObjectAsmValue(selfType, root))));
      var v = $this.h2j_1.evaluateExpression(evc, front).self;
      var tmp_3 = last(_this__u8e3s4.parts);
      var lastProp = (isInterface(tmp_3, PropertyCall) ? tmp_3 : THROW_CCE()).propertyName;
      var tmp_4;
      if (isInterface(v, AsmStructure)) {
        var tmp4_elvis_lhs = v.property.z2(new PropertyValueName(_PropertyValueName___init__impl__cmfy0i(lastProp)));
        var tmp_5;
        if (tmp4_elvis_lhs == null) {
          var message_3 = "Cannot navigate '" + toString(_this__u8e3s4) + "' from null value";
          throw IllegalStateException.v4(toString(message_3));
        } else {
          tmp_5 = tmp4_elvis_lhs;
        }
        tmp_4 = tmp_5;
      } else {
        var message_4 = "Cannot navigate '" + toString(_this__u8e3s4) + "' from null value";
        throw IllegalStateException.v4(toString(message_4));
      }
      tmp = tmp_4;
    }
  }
  return tmp;
}
function ReferenceResolverSimple$handlePropertyReferenceExpression$lambda(this$0, $td) {
  return (it) => {
    var tmp0_elvis_lhs = this$0.typeModel.findFirstDefinitionByPossiblyQualifiedNameOrNull(it);
    var itemType = tmp0_elvis_lhs == null ? StdLibDefault_getInstance().NothingType.resolvedDeclaration : tmp0_elvis_lhs;
    return itemType.conformsTo($td);
  };
}
function ReferenceResolverSimple$handlePropertyReferenceExpression$lambda_0(this$0, $td) {
  return (it) => {
    var tmp0_elvis_lhs = this$0.typeModel.findFirstDefinitionByPossiblyQualifiedNameOrNull(it);
    var itemType = tmp0_elvis_lhs == null ? StdLibDefault_getInstance().NothingType.resolvedDeclaration : tmp0_elvis_lhs;
    return itemType.conformsTo($td);
  };
}
function createScope($this, parentScope, el) {
  var tmp;
  if ($this.crossReferenceModel.isScopeDefinedFor(new QualifiedName(el.qualifiedTypeName))) {
    var inTypeName = _QualifiedName___get_last__impl__838y8h(parentScope.forTypeName);
    var refInParent = $this.identifyingValueInFor(new SimpleName(inTypeName), el);
    var tmp_0;
    if (null == refInParent) {
      tmp_0 = parentScope;
    } else {
      if (!(refInParent == null) ? typeof refInParent === 'string' : false) {
        tmp_0 = parentScope.createOrGetChildScope(refInParent, el.qualifiedTypeName);
      } else {
        var tmp_1;
        var tmp_2;
        if (!(refInParent == null) ? isInterface(refInParent, KtList) : false) {
          // Inline function 'kotlin.collections.isNotEmpty' call
          tmp_2 = !refInParent.a1();
        } else {
          tmp_2 = false;
        }
        if (tmp_2) {
          var tmp$ret$1;
          $l$block_0: {
            // Inline function 'kotlin.collections.all' call
            var tmp_3;
            if (isInterface(refInParent, Collection)) {
              tmp_3 = refInParent.a1();
            } else {
              tmp_3 = false;
            }
            if (tmp_3) {
              tmp$ret$1 = true;
              break $l$block_0;
            }
            var _iterator__ex2g4s = refInParent.s();
            while (_iterator__ex2g4s.t()) {
              var element = _iterator__ex2g4s.u();
              if (!(!(element == null) ? typeof element === 'string' : false)) {
                tmp$ret$1 = false;
                break $l$block_0;
              }
            }
            tmp$ret$1 = true;
          }
          tmp_1 = tmp$ret$1;
        } else {
          tmp_1 = false;
        }
        if (tmp_1) {
          var exp = $this.crossReferenceModel.identifyingExpressionFor(inTypeName, new QualifiedName(el.qualifiedTypeName));
          var scopeDefined = $this.crossReferenceModel.isScopeDefinedFor(new QualifiedName(el.qualifiedTypeName));
          var idExprDefinedInScope = $this.crossReferenceModel.identifyingExpressionFor(_QualifiedName___get_last__impl__838y8h(el.qualifiedTypeName), new QualifiedName(el.qualifiedTypeName));
          var tmp_4;
          if (scopeDefined && equals(exp, idExprDefinedInScope)) {
            // Inline function 'kotlin.collections.map' call
            // Inline function 'kotlin.collections.mapTo' call
            var destination = ArrayList.w(collectionSizeOrDefault(refInParent, 10));
            var _iterator__ex2g4s_0 = refInParent.s();
            while (_iterator__ex2g4s_0.t()) {
              var item = _iterator__ex2g4s_0.u();
              var tmp$ret$3 = (!(item == null) ? typeof item === 'string' : false) ? item : THROW_CCE();
              destination.r(tmp$ret$3);
            }
            var refList = destination;
            var childScope = parentScope;
            var _iterator__ex2g4s_1 = refList.s();
            while (_iterator__ex2g4s_1.t()) {
              var ref = _iterator__ex2g4s_1.u();
              var tmp0_elvis_lhs = childScope.getChildScopeOrNull(ref);
              var tmp_5;
              if (tmp0_elvis_lhs == null) {
                var message = 'Internal error: should never be null as already created these scopes in addToScope';
                throw IllegalStateException.v4(toString(message));
              } else {
                tmp_5 = tmp0_elvis_lhs;
              }
              childScope = tmp_5;
            }
            tmp_4 = childScope;
          } else {
            tmp_4 = parentScope;
          }
          tmp_0 = tmp_4;
        } else {
          $this.issues.error($this.locationMap.get(el), "Cannot create a child scope in '" + toString(parentScope) + "' for '" + toString(el) + "' because its identifying expression evaluates to " + toString_0(refInParent));
          tmp_0 = parentScope;
        }
      }
    }
    tmp = tmp_0;
  } else {
    tmp = parentScope;
  }
  return tmp;
}
function addToScope($this, scope, el) {
  var inTypeName = _QualifiedName___get_last__impl__838y8h(scope.forTypeName);
  var scopeLocalReference = $this.identifyingValueInFor(new SimpleName(inTypeName), el);
  if (null != scopeLocalReference) {
    if (!(scopeLocalReference == null) ? typeof scopeLocalReference === 'string' : false) {
      var ref = scopeLocalReference;
      addToScopeAs($this, scope, el, ref);
    } else {
      var tmp;
      var tmp_0;
      if (!(scopeLocalReference == null) ? isInterface(scopeLocalReference, KtList) : false) {
        // Inline function 'kotlin.collections.isNotEmpty' call
        tmp_0 = !scopeLocalReference.a1();
      } else {
        tmp_0 = false;
      }
      if (tmp_0) {
        var tmp$ret$1;
        $l$block_0: {
          // Inline function 'kotlin.collections.all' call
          var tmp_1;
          if (isInterface(scopeLocalReference, Collection)) {
            tmp_1 = scopeLocalReference.a1();
          } else {
            tmp_1 = false;
          }
          if (tmp_1) {
            tmp$ret$1 = true;
            break $l$block_0;
          }
          var _iterator__ex2g4s = scopeLocalReference.s();
          while (_iterator__ex2g4s.t()) {
            var element = _iterator__ex2g4s.u();
            if (!(!(element == null) ? typeof element === 'string' : false)) {
              tmp$ret$1 = false;
              break $l$block_0;
            }
          }
          tmp$ret$1 = true;
        }
        tmp = tmp$ret$1;
      } else {
        tmp = false;
      }
      if (tmp) {
        var exp = $this.crossReferenceModel.identifyingExpressionFor(inTypeName, new QualifiedName(el.qualifiedTypeName));
        var scopeDefined = $this.crossReferenceModel.isScopeDefinedFor(new QualifiedName(el.qualifiedTypeName));
        var idExprDefinedInScope = $this.crossReferenceModel.identifyingExpressionFor(el.typeName, new QualifiedName(el.qualifiedTypeName));
        if (!scopeDefined) {
          $this.issues.error($this.locationMap.get(el), "Cannot create a local reference in '" + toString(scope) + "' for item with type '" + QualifiedName__toString_impl_z3wem2(el.qualifiedTypeName) + "' because there is no scope defined for the type, although its identifying expression evaluates to a List<String>");
        } else if (scopeDefined && null == idExprDefinedInScope) {
          $this.issues.error($this.locationMap.get(el), "Cannot create a local reference in '" + toString(scope) + "' for item with type '" + QualifiedName__toString_impl_z3wem2(el.qualifiedTypeName) + "' because the type has no identifying expression in the scope (which should evaluate to a List<String>)");
        } else if (scopeDefined && !equals(exp, idExprDefinedInScope)) {
          $this.issues.error($this.locationMap.get(el), "Cannot create a local reference in '" + toString(scope) + "' for item with type '" + QualifiedName__toString_impl_z3wem2(el.qualifiedTypeName) + "' because the identifying expression is different in the scope and the parent scope");
        } else {
          // Inline function 'kotlin.collections.map' call
          // Inline function 'kotlin.collections.mapTo' call
          var destination = ArrayList.w(collectionSizeOrDefault(scopeLocalReference, 10));
          var _iterator__ex2g4s_0 = scopeLocalReference.s();
          while (_iterator__ex2g4s_0.t()) {
            var item = _iterator__ex2g4s_0.u();
            var tmp$ret$3 = (!(item == null) ? typeof item === 'string' : false) ? item : THROW_CCE();
            destination.r(tmp$ret$3);
          }
          var refList = destination;
          var nextScope = scope;
          var _iterator__ex2g4s_1 = refList.s();
          while (_iterator__ex2g4s_1.t()) {
            var ref_0 = _iterator__ex2g4s_1.u();
            addToScopeAs($this, nextScope, el, ref_0);
            nextScope = nextScope.createOrGetChildScope(ref_0, el.qualifiedTypeName);
          }
        }
      } else {
        $this.issues.error($this.locationMap.get(el), "Cannot create a local reference in '" + toString(scope) + "' for '" + toString(el) + "' because its identifying expression evaluates to a " + toString_0(scopeLocalReference));
      }
    }
  }
}
function addToScopeAs($this, scope, el, referableName) {
  var scopeItem = $this.context.createScopedItem.invoke(plus_0(scope.scopePath, referableName), el, $this.locationMap.get(el));
  var existingItems = $this.context.findItemsNamedConformingTo(referableName, ScopeCreator$addToScopeAs$lambda($this, el));
  // Inline function 'kotlin.collections.filter' call
  // Inline function 'kotlin.collections.filterTo' call
  var destination = ArrayList.y();
  var _iterator__ex2g4s = existingItems.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var tmp0_safe_receiver = $this.locationMap.get(el);
    if (!equals(element.location, tmp0_safe_receiver == null ? null : tmp0_safe_receiver.sentenceIdentity)) {
      destination.r(element);
    }
  }
  var notSameLocation = destination;
  if (notSameLocation.a1()) {
    var tmp = el.qualifiedTypeName;
    var tmp0_safe_receiver_0 = $this.locationMap.get(el);
    scope.addToScope(referableName, tmp, tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.sentenceIdentity, scopeItem, $this.replaceIfItemAlreadyExistsInScope);
  } else {
    var tmp1_safe_receiver = $this.ifItemAlreadyExistsInScopeIssueKind;
    if (tmp1_safe_receiver == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      $this.issues.raise(tmp1_safe_receiver, LanguageProcessorPhase_SEMANTIC_ANALYSIS_getInstance(), $this.locationMap.get(el), "'" + referableName + "' with type '" + QualifiedName__toString_impl_z3wem2(el.qualifiedTypeName) + "' already exists in scope " + toString(scope));
    }
  }
}
function ScopeCreator$addToScopeAs$lambda(this$0, $el) {
  return (itemTypeName) => {
    var tmp0_elvis_lhs = this$0.typeModel.findByQualifiedNameOrNull(itemTypeName.f27_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var message = "Type not found '" + _QualifiedName___get_value__impl__nkc4gq(itemTypeName.f27_1) + "'";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var itemType = tmp;
    var tmp1_elvis_lhs = this$0.typeModel.findByQualifiedNameOrNull($el.qualifiedTypeName);
    var tmp_0;
    if (tmp1_elvis_lhs == null) {
      var message_0 = "Type not found '" + _QualifiedName___get_value__impl__nkc4gq($el.qualifiedTypeName) + "'";
      throw IllegalStateException.v4(toString(message_0));
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    var requireType = tmp_0;
    return itemType.conformsTo(requireType);
  };
}
var Companion_instance_2;
function Companion_getInstance_4() {
  return Companion_instance_2;
}
function _get__locationMap__uz16lf($this) {
  var tmp = $this.u2j_1;
  if (!(tmp == null))
    return tmp;
  else {
    throwUninitializedPropertyAccessException('_locationMap');
  }
}
function checkAndResolveReferences($this, options, sentenceIdentity, asm, locationMap, context) {
  if (!options.checkReferences) {
    $this.s2j_1.info(null, "Semantic Analysis option 'checkReferences' is off, references not checked.");
  } else if ($this.crossReferenceModel.isEmpty) {
    $this.s2j_1.warn(null, 'Empty CrossReferenceModel');
  } else {
    var tmp;
    if (options.resolveReferences) {
      tmp = true;
    } else {
      $this.s2j_1.info(null, "Semantic Analysis option 'resolveReferences' is off, references checked but not resolved.");
      tmp = false;
    }
    var resolve = tmp;
    walkReferences($this, sentenceIdentity, asm, _get__locationMap__uz16lf($this), context, resolve);
  }
}
function walkReferences($this, sentenceId, asm, locationMap, context, resolve) {
  var tmp;
  if (resolve) {
    tmp = SemanticAnalyserSimple$walkReferences$lambda(context);
  } else {
    tmp = null;
  }
  var resFunc = tmp;
  var sentenceScope = context.getScopeForSentenceOrNull(sentenceId);
  if (!(null == sentenceScope)) {
    var tmp_0 = SemanticAnalyserSimple$identifyingValueInFor$ref($this);
    var resolver = new ReferenceResolverSimple($this.typeModel, $this.crossReferenceModel, context, sentenceId, tmp_0, resFunc == null ? null : new sam$net_akehurst_language_agl_simple_ResolveScopedItem$0(resFunc), locationMap, $this.s2j_1);
    asm.traverseDepthFirst(resolver);
    $this.t2j_1 = resolver.resolvedReferences;
  } else {
    $this.s2j_1.info(null, "Scope for sentence with Identity '" + toString_0(sentenceId) + "' not found, so cannot resolve references.");
  }
}
function buildScope($this, options, sentenceIdentity, asm, context) {
  if (!options.buildScope) {
    $this.s2j_1.info(null, "Semantic Analysis option 'buildScope' is off, scope is not built.");
  } else {
    var tmp = $this.crossReferenceModel;
    var tmp_0 = tmp instanceof CrossReferenceModelDefault ? tmp : THROW_CCE();
    var tmp_1 = options.replaceIfItemAlreadyExistsInScope;
    var tmp_2 = options.ifItemAlreadyExistsInScopeIssueKind;
    var scopeCreator = new ScopeCreator($this.typeModel, tmp_0, context, sentenceIdentity, tmp_1, tmp_2, SemanticAnalyserSimple$identifyingValueInFor$ref_0($this), _get__locationMap__uz16lf($this), $this.s2j_1);
    asm.traverseDepthFirst(scopeCreator);
  }
}
function identifyingValueInFor($this, inScopeNamed, self_0) {
  return Companion_instance_2.identifyingValueInFor($this.v2j_1, $this.crossReferenceModel, inScopeNamed, self_0);
}
function SemanticAnalyserSimple$walkReferences$lambda($context) {
  return (ref) => {
    var tmp = $context.resolveScopedItem.invoke(ref);
    return (!(tmp == null) ? isInterface(tmp, AsmStructure) : false) ? tmp : THROW_CCE();
  };
}
function SemanticAnalyserSimple$identifyingValueInFor$ref($boundThis) {
  var l = (p0, p1) => identifyingValueInFor($boundThis, p0.a1u_1, p1);
  l.callableName = 'identifyingValueInFor';
  return l;
}
function SemanticAnalyserSimple$identifyingValueInFor$ref_0($boundThis) {
  var l = (p0, p1) => identifyingValueInFor($boundThis, p0.a1u_1, p1);
  l.callableName = 'identifyingValueInFor';
  return l;
}
function SyntaxAnalyserSimple$embeddedSyntaxAnalyser$lambda($typeModel, $asmTransformModel) {
  return (embGramQName) => {
    var ruleSetQname = embGramQName.f27_1;
    return new SyntaxAnalyserSimple($typeModel, $asmTransformModel, ruleSetQname);
  };
}
function lower(_this__u8e3s4) {
  var tmp;
  // Inline function 'kotlin.text.uppercase' call
  // Inline function 'kotlin.js.asDynamic' call
  if (_this__u8e3s4.toUpperCase() === _this__u8e3s4) {
    // Inline function 'kotlin.text.lowercase' call
    // Inline function 'kotlin.js.asDynamic' call
    tmp = _this__u8e3s4.toLowerCase();
  } else {
    // Inline function 'kotlin.text.replaceFirstChar' call
    var tmp_0;
    // Inline function 'kotlin.text.isNotEmpty' call
    if (charSequenceLength(_this__u8e3s4) > 0) {
      // Inline function 'kotlin.text.lowercase' call
      var this_0 = charSequenceGet(_this__u8e3s4, 0);
      // Inline function 'kotlin.js.asDynamic' call
      // Inline function 'kotlin.js.unsafeCast' call
      var tmp$ret$8 = toString_1(this_0).toLowerCase();
      var tmp_1 = toString(tmp$ret$8);
      // Inline function 'kotlin.text.substring' call
      // Inline function 'kotlin.js.asDynamic' call
      tmp_0 = tmp_1 + _this__u8e3s4.substring(1);
    } else {
      tmp_0 = _this__u8e3s4;
    }
    tmp = tmp_0;
  }
  return tmp;
}
function baseNameFor($this, ruleItem, ruleItemType) {
  var tmp;
  if (isInterface(ruleItem, Terminal)) {
    var tmp_0;
    if (isInterface(ruleItemType, PrimitiveType)) {
      tmp_0 = _PropertyName___get_value__impl__p219lh(Companion_getInstance_3().UNNAMED_PRIMITIVE_PROPERTY_NAME);
    } else {
      if (isInterface(ruleItemType, CollectionType)) {
        tmp_0 = _PropertyName___get_value__impl__p219lh(Companion_getInstance_3().UNNAMED_LIST_PROPERTY_NAME);
      } else {
        if (isInterface(ruleItemType, TupleType)) {
          tmp_0 = _PropertyName___get_value__impl__p219lh(Companion_getInstance_3().UNNAMED_TUPLE_PROPERTY_NAME);
        } else {
          tmp_0 = _PropertyName___get_value__impl__p219lh(Companion_getInstance_3().UNNAMED_PRIMITIVE_PROPERTY_NAME);
        }
      }
    }
    tmp = tmp_0;
  } else {
    if (isInterface(ruleItem, Embedded)) {
      tmp = lower(_GrammarRuleName___get_value__impl__470s0v(ruleItem.embeddedGoalName));
    } else {
      if (isInterface(ruleItem, NonTerminal)) {
        tmp = lower(_GrammarRuleName___get_value__impl__470s0v(ruleItem.ruleReference));
      } else {
        if (isInterface(ruleItem, Group)) {
          tmp = _PropertyName___get_value__impl__p219lh(Companion_getInstance_3().UNNAMED_GROUP_PROPERTY_NAME);
        } else {
          if (isInterface(ruleItem, Choice)) {
            tmp = _PropertyName___get_value__impl__p219lh(Companion_getInstance_3().UNNAMED_CHOICE_PROPERTY_NAME);
          } else {
            if (isInterface(ruleItem, OptionalItem)) {
              tmp = baseNameFor($this, ruleItem.item, ruleItemType);
            } else {
              if (isInterface(ruleItem, ListOfItems)) {
                tmp = baseNameFor($this, ruleItem.item, ruleItemType);
              } else {
                var message = 'Internal error, unhandled subtype of RuleItem';
                throw IllegalStateException.v4(toString(message));
              }
            }
          }
        }
      }
    }
  }
  // Inline function 'kotlin.text.replaceFirstChar' call
  var this_0 = tmp;
  var tmp_1;
  // Inline function 'kotlin.text.isNotEmpty' call
  if (charSequenceLength(this_0) > 0) {
    // Inline function 'kotlin.text.lowercase' call
    var this_1 = charSequenceGet(this_0, 0);
    // Inline function 'kotlin.js.asDynamic' call
    // Inline function 'kotlin.js.unsafeCast' call
    var tmp$ret$4 = toString_1(this_1).toLowerCase();
    var tmp_2 = toString(tmp$ret$4);
    // Inline function 'kotlin.text.substring' call
    // Inline function 'kotlin.js.asDynamic' call
    tmp_1 = tmp_2 + this_0.substring(1);
  } else {
    tmp_1 = this_0;
  }
  return tmp_1;
}
function contextAsmSimple(createScopedItem, resolveScopedItem, init) {
  createScopedItem = createScopedItem === VOID ? new CreateScopedItemDefault() : createScopedItem;
  resolveScopedItem = resolveScopedItem === VOID ? new ResolveScopedItemDefault() : resolveScopedItem;
  var tmp;
  if (init === VOID) {
    tmp = contextAsmSimple$lambda;
  } else {
    tmp = init;
  }
  init = tmp;
  var b = new ContextBuilder(createScopedItem, resolveScopedItem);
  init(b);
  return b.build();
}
function contextAsmSimpleWithAsmPath(map, init) {
  var tmp;
  if (map === VOID) {
    // Inline function 'kotlin.collections.mutableMapOf' call
    tmp = LinkedHashMap.l4();
  } else {
    tmp = map;
  }
  map = tmp;
  var tmp_0;
  if (init === VOID) {
    tmp_0 = contextAsmSimpleWithAsmPath$lambda;
  } else {
    tmp_0 = init;
  }
  init = tmp_0;
  var tmp_1 = contextAsmSimpleWithAsmPath$lambda_0(map);
  var createScopedItem = new sam$net_akehurst_language_agl_simple_CreateScopedItem$0(tmp_1);
  var tmp_2 = contextAsmSimpleWithAsmPath$lambda_1(map);
  var resolveScopedItem = new sam$net_akehurst_language_agl_simple_ResolveScopedItem$0_0(tmp_2);
  var b = new ContextBuilder(createScopedItem, resolveScopedItem);
  init(b);
  return b.build();
}
function ContextBuilder$forSentence$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function ScopeBuilder$scope$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function ScopeBuilder$scopedItem$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function contextAsmSimple$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function contextAsmSimpleWithAsmPath$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function contextAsmSimpleWithAsmPath$lambda_0($map) {
  return (referableName, item, location) => {
    var path = '/' + joinToString(referableName, '/');
    // Inline function 'kotlin.collections.set' call
    $map.r2(path, item);
    return path;
  };
}
function contextAsmSimpleWithAsmPath$lambda_1($map) {
  return (itemInScope) => {
    // Inline function 'kotlin.collections.get' call
    var this_0 = $map;
    return (isInterface(this_0, KtMap) ? this_0 : THROW_CCE()).z2(itemInScope);
  };
}
var Companion_instance_3;
function Companion_getInstance_5() {
  if (Companion_instance_3 === VOID)
    new Companion_2();
  return Companion_instance_3;
}
function findBranchHandler($this, branchName, begin) {
  if ($this.n2l_1.a1()) {
    $this.registerHandlers();
  }
  var tmp;
  if (begin) {
    var tmp_0 = $this.o2l_1.z2(branchName);
    tmp = (tmp_0 == null ? true : typeof tmp_0 === 'function') ? tmp_0 : THROW_CCE();
  } else {
    var tmp_1 = $this.n2l_1.z2(branchName);
    tmp = (tmp_1 == null ? true : typeof tmp_1 === 'function') ? tmp_1 : THROW_CCE();
  }
  var selfHandler = tmp;
  var tmp_2;
  if (selfHandler == null) {
    var tmp0 = $this.extendsSyntaxAnalyser;
    var tmp$ret$2;
    $l$block: {
      // Inline function 'kotlin.collections.firstNotNullOfOrNull' call
      // Inline function 'kotlin.collections.iterator' call
      var _iterator__ex2g4s = tmp0.w2().s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        var tmp_3 = element.b3();
        var result = findBranchHandler(tmp_3 instanceof SyntaxAnalyserByMethodRegistrationAbstract ? tmp_3 : THROW_CCE(), branchName, begin);
        if (!(result == null)) {
          tmp$ret$2 = result;
          break $l$block;
        }
      }
      tmp$ret$2 = null;
    }
    tmp_2 = tmp$ret$2;
  } else {
    tmp_2 = selfHandler;
  }
  var handler = tmp_2;
  return handler;
}
var Companion_instance_4;
function Companion_getInstance_6() {
  return Companion_instance_4;
}
function findTrRuleForGrammarRuleNamedOrNull($this, grmRuleName) {
  return $this.relevantRuleSet.findAllTrRuleForGrammarRuleNamedOrNull(_GrammarRuleName___init__impl__yqiut(grmRuleName));
}
function setAsm($this, value) {
  $this.i2k_1 = value;
}
function addAsmRoot($this, rootValue) {
  $this.asmFactory.addRoot(ensureNotNull($this.i2k_1), rootValue);
}
function removeAsmRoot($this, rootValue) {
  $this.asmFactory.removeRoot(ensureNotNull($this.i2k_1), rootValue);
}
function trRuleForNode($this, parentTrRule, nodeInfo) {
  var tmp1_safe_receiver = parentTrRule == null ? null : parentTrRule.resolvedType;
  var parentTypeDecl = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.resolvedDeclaration;
  var nodeRule = nodeInfo.node.rule;
  var tmp;
  if (null == parentTypeDecl) {
    tmp = transformationRule(StdLibDefault_getInstance().NothingType, Companion_getInstance_15().NOTHING);
  } else {
    var tmp_0;
    if (nodeRule.isPseudo) {
      tmp_0 = transformationRule(StdLibDefault_getInstance().AnyType, Companion_getInstance_15().SELF);
    } else {
      var tmp2_elvis_lhs = findTrRuleForGrammarRuleNamedOrNull($this, nodeInfo.node.rule.tag);
      var tmp_1;
      if (tmp2_elvis_lhs == null) {
        var message = "Transform Rule for '" + nodeInfo.node.rule.tag + "' not found";
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp_1 = tmp2_elvis_lhs;
      }
      tmp_0 = tmp_1;
    }
    tmp = tmp_0;
  }
  return tmp;
}
function resolveCompressed($this, p, trRule, nodeInfo) {
  var typeDecl = trRule.resolvedType.resolvedDeclaration;
  var tmp;
  var tmp_0;
  var tmp_1;
  var tmp_2;
  if (isInterface(typeDecl, StructuredType)) {
    tmp_2 = nodeInfo.node.rule.isOptional;
  } else {
    tmp_2 = false;
  }
  if (tmp_2) {
    tmp_1 = Companion_instance_4.hasOnyOneRhsItem;
  } else {
    tmp_1 = false;
  }
  if (tmp_1) {
    tmp_0 = nodeInfo.node.rule.rhsItems.z(0).z(0).isTerminal;
  } else {
    tmp_0 = false;
  }
  if (tmp_0) {
    tmp = new DownData2(p, NodeTrRules.u2l(trRule, Companion_getInstance_3().toLeafAsStringTrRule(StdLibDefault_getInstance().String)));
  } else {
    var tmp_3;
    if (isInterface(typeDecl, DataType)) {
      tmp_3 = typeDecl.property.v() === 1;
    } else {
      tmp_3 = false;
    }
    if (tmp_3) {
      var tmp_4;
      if (first(typeDecl.property).typeInstance.isNullable) {
        var fProp = first(typeDecl.property);
        var pp = p.plus(_PropertyName___get_value__impl__p219lh(fProp.name));
        tmp_4 = new DownData2(p, NodeTrRules.new_net_akehurst_language_agl_syntaxAnalyser_NodeTrRules(trRule));
      } else if (nodeInfo.node.rule.isOptional) {
        tmp_4 = new DownData2(p, NodeTrRules.new_net_akehurst_language_agl_syntaxAnalyser_NodeTrRules(trRule));
      } else if (nodeInfo.node.rule.isList) {
        var fProp_0 = first(typeDecl.property);
        var pp_0 = p.plus(_PropertyName___get_value__impl__p219lh(fProp_0.name));
        tmp_4 = new DownData2(p, NodeTrRules.new_net_akehurst_language_agl_syntaxAnalyser_NodeTrRules(trRule));
      } else {
        tmp_4 = new DownData2(p, NodeTrRules.new_net_akehurst_language_agl_syntaxAnalyser_NodeTrRules(trRule));
      }
      tmp = tmp_4;
    } else {
      if (isInterface(typeDecl, UnionType)) {
        var tmp_5;
        if (nodeInfo.node.rule.isChoice) {
          var tmp_6;
          var tmp_7 = typeDecl.alternatives.z(_OptionNum___get_asIndex__impl__fdwc2b(nodeInfo.alt.option)).resolvedDeclaration;
          if (isInterface(tmp_7, TupleType)) {
            tmp_6 = new DownData2(p, NodeTrRules.u2l(trRule, Companion_getInstance_3().toSubtypeTrRule(typeDecl.alternatives.z(_OptionNum___get_asIndex__impl__fdwc2b(nodeInfo.alt.option)))));
          } else {
            tmp_6 = new DownData2(p, NodeTrRules.new_net_akehurst_language_agl_syntaxAnalyser_NodeTrRules(trRule));
          }
          tmp_5 = tmp_6;
        } else {
          tmp_5 = new DownData2(p, NodeTrRules.new_net_akehurst_language_agl_syntaxAnalyser_NodeTrRules(trRule));
        }
        tmp = tmp_5;
      } else {
        tmp = new DownData2(p, NodeTrRules.new_net_akehurst_language_agl_syntaxAnalyser_NodeTrRules(trRule));
      }
    }
  }
  return tmp;
}
function createValueFromLeaf($this, sentence, target) {
  var tmp;
  if (target.node.rule.isEmptyTerminal) {
    tmp = $this.asmFactory.nothing();
  } else if (target.node.rule.isEmptyListTerminal) {
    tmp = null;
  } else {
    var v = matchedTextNoSkip(sentence, target.node);
    tmp = $this.asmFactory.createPrimitiveValue(StdLibDefault_getInstance().String.qualifiedTypeName, v);
  }
  return tmp;
}
function createValueFromBranch($this, sentence, downData, target, children) {
  return createValueFromBranch2($this, sentence, downData, target, children);
}
function createValueFromBranch2($this, sentence, downData, target, children) {
  // Inline function 'kotlin.collections.mapNotNull' call
  // Inline function 'kotlin.collections.mapNotNullTo' call
  var destination = ArrayList.y();
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = children.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var tmp0_safe_receiver = element.value;
    if (tmp0_safe_receiver == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      destination.r(tmp0_safe_receiver);
    }
  }
  var asmChildren = destination;
  var childrenAsmList = target.node.rule.isListSeparated ? $this.asmFactory.createCollection(StdLibDefault_getInstance().ListSeparated.qualifiedName, asmChildren) : $this.asmFactory.createCollection(StdLibDefault_getInstance().List.qualifiedName, asmChildren);
  var asmMatchedText = $this.asmFactory.createPrimitiveValue(StdLibDefault_getInstance().String.qualifiedTypeName, matchedTextNoSkip(sentence, target.node));
  var parsePath = $this.asmFactory.any(downData.path);
  var alternative = $this.asmFactory.createPrimitiveValue(StdLibDefault_getInstance().Integer.qualifiedTypeName, toLong(_OptionNum___get_value__impl__ebz44c(target.alt.option)));
  var selfType = target.node.rule.isListSeparated ? Companion_getInstance_29().PARSE_NODE_TYPE_BRANCH_SEPARATED : Companion_getInstance_29().PARSE_NODE_TYPE_BRANCH_SIMPLE;
  var self_0 = $this.asmFactory.createTupleValue(listOf_0([new TypeArgumentNamedSimple(Companion_getInstance_29().PATH, parsePath.type), new TypeArgumentNamedSimple(Companion_getInstance_29().ALTERNATIVE, alternative.type), new TypeArgumentNamedSimple(Companion_getInstance_29().CHILDREN, childrenAsmList.type), new TypeArgumentNamedSimple(Companion_getInstance_29().CHILD, childrenAsmList.type), new TypeArgumentNamedSimple(Companion_getInstance_29().MATCHED_TEXT, asmMatchedText.type)]));
  $this.asmFactory.setProperty(self_0, _PropertyName___get_value__impl__p219lh(Companion_getInstance_29().PATH), parsePath);
  $this.asmFactory.setProperty(self_0, _PropertyName___get_value__impl__p219lh(Companion_getInstance_29().ALTERNATIVE), alternative);
  $this.asmFactory.setProperty(self_0, _PropertyName___get_value__impl__p219lh(Companion_getInstance_29().CHILDREN), childrenAsmList);
  $this.asmFactory.setProperty(self_0, _PropertyName___get_value__impl__p219lh(Companion_getInstance_29().CHILD), childrenAsmList);
  $this.asmFactory.setProperty(self_0, _PropertyName___get_value__impl__p219lh(Companion_getInstance_29().MATCHED_TEXT), asmMatchedText);
  var typedSelf = self_0;
  var evc = Companion_instance_14.of(mapOf(to('$self', typedSelf)));
  var tr = downData.trRule.forNode;
  $this._trf.clear();
  var asm = $this._trf.evaluate(evc, tr);
  var tmp = asm.self;
  if (tmp instanceof AsmStructureSimple) {
    var tmp_0 = asm.self;
    (tmp_0 instanceof AsmStructureSimple ? tmp_0 : THROW_CCE()).i2m_1 = downData.path.toString();
  }
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s_0 = $this._trf.issues.s();
  while (_iterator__ex2g4s_0.t()) {
    var element_0 = _iterator__ex2g4s_0.u();
    $this.issues.error(null, "Error evaluating transformation rule '" + element_0.message + "':\n" + tr.asString());
  }
  return asm;
}
function functionNameFor($this, rule) {
  return replace(_GrammarRuleName___get_value__impl__470s0v(rule.name), '[^a-zA-Z0-9_]', '_');
}
function SyntaxAnalyserGeneratorKotlin$generateFor$lambda(this$0) {
  return (it) => {
    var fName = functionNameFor(this$0, it);
    return fName === _GrammarRuleName___get_value__impl__470s0v(it.name) ? 'super.register(this::' + functionNameFor(this$0, it) + ')' : 'super.registerFor("' + GrammarRuleName__toString_impl_przz03(it.name) + '", this::' + functionNameFor(this$0, it) + ')';
  };
}
function SyntaxAnalyserGeneratorKotlin$generateFor$lambda_0(this$0, $indent) {
  return (it) => {
    var fName = functionNameFor(this$0, it);
    var type = 'Any';
    return trimIndent('\n            ' + $indent + '// ' + toString(it) + '\n            ' + $indent + 'private fun ' + fName + '(nodeInfo: SpptDataNodeInfo, children: List<Any?>, sentence: Sentence): ' + type + ' = TODO()\n            ');
  };
}
var Companion_instance_5;
function Companion_getInstance_7() {
  return Companion_instance_5;
}
function findTypeUsageForRule($this, ruleName) {
  var tmp = $this.typeModel.findNamespaceOrNull($this.grammarNamespaceQualifiedName);
  var ns = (tmp == null ? true : isInterface(tmp, GrammarTypeNamespace)) ? tmp : THROW_CCE();
  return ns == null ? null : ns.findTypeForRule(_GrammarRuleName___init__impl__yqiut(ruleName));
}
function pathFor($this, parentPath, parentType, nodeInfo) {
  var tmp;
  if (isInterface(parentType, PrimitiveType)) {
    tmp = parentPath;
  } else {
    if (isInterface(parentType, UnionType)) {
      tmp = parentPath;
    } else {
      if (isInterface(parentType, CollectionType)) {
        tmp = parentPath.plus(nodeInfo.child.index.toString());
      } else {
        if (isInterface(parentType, TupleType)) {
          var prop = parentType.getOwnedPropertyByIndexOrNull(nodeInfo.child.propertyIndex);
          var tmp_0;
          if (prop == null) {
            tmp_0 = null;
          } else {
            // Inline function 'kotlin.let' call
            tmp_0 = parentPath.plus(_PropertyName___get_value__impl__p219lh(prop.name));
          }
          var tmp2_elvis_lhs = tmp_0;
          tmp = tmp2_elvis_lhs == null ? parentPath.plus('<error>') : tmp2_elvis_lhs;
        } else {
          if (isInterface(parentType, DataType)) {
            var tmp_1;
            // Inline function 'kotlin.collections.isNotEmpty' call
            if (!parentType.subtypes.a1()) {
              tmp_1 = parentPath;
            } else {
              var prop_0 = parentType.getOwnedPropertyByIndexOrNull(nodeInfo.child.propertyIndex);
              var tmp_2;
              if (prop_0 == null) {
                tmp_2 = null;
              } else {
                // Inline function 'kotlin.let' call
                tmp_2 = parentPath.plus(_PropertyName___get_value__impl__p219lh(prop_0.name));
              }
              var tmp4_elvis_lhs = tmp_2;
              tmp_1 = tmp4_elvis_lhs == null ? parentPath.plus('<error>') : tmp4_elvis_lhs;
            }
            tmp = tmp_1;
          } else {
            var tmp_3;
            if (equals(parentType, $this.typeModel.NothingType)) {
              tmp_3 = parentPath.plus('<error>');
            } else if (equals(parentType, $this.typeModel.AnyType)) {
              throw NotImplementedError.uj();
            } else {
              var message = 'Shold not happen';
              throw IllegalStateException.v4(toString(message));
            }
            tmp = tmp_3;
          }
        }
      }
    }
  }
  return tmp;
}
function typeForNode($this, parentTypeUsage, nodeInfo) {
  var tmp;
  if (null == parentTypeUsage) {
    tmp = $this.typeModel.NothingType.type();
  } else if (parentTypeUsage.isNullable) {
    tmp = typeForParentOptional($this, parentTypeUsage, nodeInfo);
  } else if (nodeInfo.node.rule.isEmbedded) {
    tmp = typeForEmbedded($this, parentTypeUsage, nodeInfo);
  } else {
    var parentType = parentTypeUsage.resolvedDeclaration;
    var tmp_0;
    if (isInterface(parentType, PrimitiveType)) {
      tmp_0 = parentTypeUsage;
    } else {
      if (isInterface(parentType, UnionType)) {
        tmp_0 = typeForParentUnnamedSuperType($this, parentTypeUsage, nodeInfo);
      } else {
        if (isInterface(parentType, CollectionType)) {
          var tmp_1;
          if (equals(parentType, StdLibDefault_getInstance().List)) {
            tmp_1 = typeForParentListSimple($this, parentTypeUsage, nodeInfo);
          } else if (equals(parentType, StdLibDefault_getInstance().ListSeparated)) {
            tmp_1 = typeForParentListSeparated($this, parentTypeUsage, nodeInfo);
          } else {
            var message = 'Should not happen';
            throw IllegalStateException.v4(toString(message));
          }
          tmp_0 = tmp_1;
        } else {
          if (isInterface(parentType, TupleType)) {
            tmp_0 = typeForParentTuple($this, parentType, nodeInfo);
          } else {
            if (isInterface(parentType, DataType)) {
              tmp_0 = typeForParentElement($this, parentType, nodeInfo);
            } else {
              var tmp_2;
              if (equals(parentType, $this.typeModel.NothingType)) {
                tmp_2 = $this.typeModel.NothingType.type();
              } else if (equals(parentType, $this.typeModel.AnyType)) {
                throw NotImplementedError.uj();
              } else {
                var message_0 = 'Shold not happen';
                throw IllegalStateException.v4(toString(message_0));
              }
              tmp_0 = tmp_2;
            }
          }
        }
      }
    }
    tmp = tmp_0;
  }
  return tmp;
}
function typeForParentOptional($this, parentTypeUsage, nodeInfo) {
  if (false) {
    // Inline function 'kotlin.check' call
    if (!parentTypeUsage.isNullable) {
      throw IllegalStateException.v4('Check failed.');
    }
  }
  return parentTypeUsage.notNullable();
}
function typeForEmbedded($this, parentTypeUsage, nodeInfo) {
  if (false) {
    // Inline function 'kotlin.check' call
    if (!nodeInfo.node.rule.isEmbedded) {
      throw IllegalStateException.v4('Check failed.');
    }
  }
  var type = parentTypeUsage.resolvedDeclaration;
  var tmp;
  if (isInterface(type, DataType)) {
    var prop = type.getOwnedPropertyByIndexOrNull(nodeInfo.child.propertyIndex);
    var tmp2_elvis_lhs = prop == null ? null : prop.typeInstance;
    tmp = tmp2_elvis_lhs == null ? $this.typeModel.NothingType.type() : tmp2_elvis_lhs;
  } else {
    tmp = parentTypeUsage;
  }
  return tmp;
}
function typeForParentListSimple($this, parentTypeUsage, nodeInfo) {
  if (false) {
    // Inline function 'kotlin.check' call
    if (!equals(parentTypeUsage.resolvedDeclaration, StdLibDefault_getInstance().List)) {
      throw IllegalStateException.v4('Check failed.');
    }
  }
  var itemTypeUse = parentTypeUsage.typeArguments.z(0);
  return isInterface(itemTypeUse, TypeInstance) ? itemTypeUse : THROW_CCE();
}
function typeForParentListSeparated($this, parentTypeUsage, nodeInfo) {
  if (false) {
    // Inline function 'kotlin.check' call
    if (!equals(parentTypeUsage.resolvedDeclaration, StdLibDefault_getInstance().ListSeparated)) {
      throw IllegalStateException.v4('Check failed.');
    }
  }
  var index = nodeInfo.child.index % 2 | 0;
  var childTypeUse = parentTypeUsage.typeArguments.z(index);
  return isInterface(childTypeUse, TypeInstance) ? childTypeUse : THROW_CCE();
}
function typeForParentUnnamedSuperType($this, parentTypeUsage, nodeInfo) {
  if (false) {
    // Inline function 'kotlin.check' call
    if (!parentTypeUsage.isNullable) {
      throw IllegalStateException.v4('Check failed.');
    }
  }
  var tmp = parentTypeUsage.resolvedDeclaration;
  var tu = (isInterface(tmp, UnionType) ? tmp : THROW_CCE()).alternatives.z(_OptionNum___get_asIndex__impl__fdwc2b(nodeInfo.parentAlt.option));
  return tu;
}
function typeForParentTuple($this, parentType, nodeInfo) {
  var prop = parentType.getOwnedPropertyByIndexOrNull(nodeInfo.child.propertyIndex);
  return typeForProperty($this, prop, nodeInfo);
}
function typeForParentElement($this, parentType, nodeInfo) {
  var tmp;
  // Inline function 'kotlin.collections.isNotEmpty' call
  if (!parentType.subtypes.a1()) {
    var t = parentType.subtypes.z(_OptionNum___get_asIndex__impl__fdwc2b(nodeInfo.parentAlt.option));
    return t;
  } else {
    var prop = parentType.getOwnedPropertyByIndexOrNull(nodeInfo.child.propertyIndex);
    tmp = typeForProperty($this, prop, nodeInfo);
  }
  return tmp;
}
function typeForProperty($this, prop, nodeInfo) {
  var tmp;
  if (null == prop) {
    tmp = $this.typeModel.NothingType.type();
  } else if (prop.typeInstance.isNullable) {
    tmp = prop.typeInstance;
  } else {
    var propType = prop.typeInstance.resolvedDeclaration;
    var tmp_0;
    if (isInterface(propType, PrimitiveType)) {
      tmp_0 = prop.typeInstance;
    } else {
      if (isInterface(propType, UnionType)) {
        var tu = resolveUnnamedSuperTypeSubtype($this, prop.typeInstance, nodeInfo);
        var tmp1_subject = tu.resolvedDeclaration;
        var tmp_1;
        if (isInterface(tmp1_subject, TupleType)) {
          tmp_1 = tu;
        } else {
          tmp_1 = prop.typeInstance;
        }
        tmp_0 = tmp_1;
      } else {
        if (isInterface(propType, CollectionType)) {
          tmp_0 = prop.typeInstance;
        } else {
          if (isInterface(propType, TupleType)) {
            tmp_0 = prop.typeInstance;
          } else {
            if (isInterface(propType, DataType)) {
              tmp_0 = prop.typeInstance;
            } else {
              var tmp_2;
              if (equals(propType, $this.typeModel.NothingType)) {
                tmp_2 = $this.typeModel.NothingType.type();
              } else if (equals(propType, $this.typeModel.AnyType)) {
                throw NotImplementedError.uj();
              } else {
                var message = 'Shold not happen';
                throw IllegalStateException.v4(toString(message));
              }
              tmp_0 = tmp_2;
            }
          }
        }
      }
    }
    tmp = tmp_0;
  }
  return tmp;
}
function resolveCompressed_0($this, typeUsage, nodeInfo) {
  var type = typeUsage.resolvedDeclaration;
  var tmp;
  var tmp_0;
  var tmp_1;
  var tmp_2;
  if (isInterface(type, StructuredType)) {
    tmp_2 = nodeInfo.node.rule.isOptional;
  } else {
    tmp_2 = false;
  }
  if (tmp_2) {
    tmp_1 = Companion_instance_5.hasOnyOneRhsItem;
  } else {
    tmp_1 = false;
  }
  if (tmp_1) {
    tmp_0 = nodeInfo.node.rule.rhsItems.z(0).z(0).isTerminal;
  } else {
    tmp_0 = false;
  }
  if (tmp_0) {
    tmp = NodeTypes.t2m(typeUsage, StdLibDefault_getInstance().String);
  } else {
    var tmp_3;
    if (isInterface(type, DataType)) {
      tmp_3 = type.property.v() === 1;
    } else {
      tmp_3 = false;
    }
    if (tmp_3) {
      tmp = first(type.property).typeInstance.isNullable ? NodeTypes.t2m(typeUsage, first(type.property).typeInstance) : nodeInfo.node.rule.isOptional ? NodeTypes.new_net_akehurst_language_agl_syntaxAnalyser_NodeTypes(typeUsage) : nodeInfo.node.rule.isList ? NodeTypes.t2m(typeUsage, first(type.property).typeInstance) : NodeTypes.new_net_akehurst_language_agl_syntaxAnalyser_NodeTypes(typeUsage);
    } else {
      if (isInterface(type, UnionType)) {
        var tmp_4;
        if (nodeInfo.node.rule.isChoice) {
          var tmp_5;
          var tmp_6 = type.alternatives.z(_OptionNum___get_asIndex__impl__fdwc2b(nodeInfo.alt.option)).resolvedDeclaration;
          if (isInterface(tmp_6, TupleType)) {
            tmp_5 = NodeTypes.t2m(typeUsage, type.alternatives.z(_OptionNum___get_asIndex__impl__fdwc2b(nodeInfo.alt.option)));
          } else {
            tmp_5 = NodeTypes.new_net_akehurst_language_agl_syntaxAnalyser_NodeTypes(typeUsage);
          }
          tmp_4 = tmp_5;
        } else {
          tmp_4 = NodeTypes.new_net_akehurst_language_agl_syntaxAnalyser_NodeTypes(typeUsage);
        }
        tmp = tmp_4;
      } else {
        tmp = NodeTypes.new_net_akehurst_language_agl_syntaxAnalyser_NodeTypes(typeUsage);
      }
    }
  }
  return tmp;
}
function resolveUnnamedSuperTypeSubtype($this, typeUse, nodeInfo) {
  var type = typeUse.resolvedDeclaration;
  var tmp;
  if (isInterface(type, UnionType)) {
    var tmp_0;
    var tmp_1;
    if (nodeInfo.node.rule.isChoice) {
      // Inline function 'kotlin.collections.isNotEmpty' call
      tmp_1 = !type.alternatives.a1();
    } else {
      tmp_1 = false;
    }
    if (tmp_1) {
      var t = type.alternatives.z(_OptionNum___get_asIndex__impl__fdwc2b(nodeInfo.alt.option));
      tmp_0 = t;
    } else {
      tmp_0 = typeUse;
    }
    tmp = tmp_0;
  } else {
    tmp = typeUse;
  }
  return tmp;
}
function createValueFromBranch_0($this, sentence, downData, target, children) {
  var targetType = findTypeUsageForRule($this, target.node.rule.tag);
  if (downData.typeUse.forNode.isNullable && target.node.rule.isOptional) {
    var child = children.z(0);
    if (null == child.value)
      null;
    else {
      var nonOptChildren = listOf(new ChildDataAny(child.nodeInfo, child.value));
    }
  } else if (target.node.rule.isEmbedded)
    children.z(0).value;
  else {
    var type = downData.typeUse.forNode.resolvedDeclaration;
    if (isInterface(type, PrimitiveType)) {
      var tmp = StdLibDefault_getInstance().String.resolvedDeclaration;
      createPrimitiveValue($this, sentence, isInterface(tmp, PrimitiveType) ? tmp : THROW_CCE(), target);
    } else {
      if (isInterface(type, UnionType)) {
        var actualType = type.alternatives.z(_OptionNum___get_asIndex__impl__fdwc2b(target.alt.option)).resolvedDeclaration;
        if (isInterface(actualType, TupleType)) {
          createTupleFrom($this, sentence, actualType, downData.path, children);
        } else {
          children.z(0).value;
        }
      } else {
        if (isInterface(type, CollectionType)) {
          if (equals(type, StdLibDefault_getInstance().List)) {
            var tmp_0;
            if (!(null == targetType) && !equals(targetType.resolvedDeclaration, StdLibDefault_getInstance().List)) {
              var tmp_1 = targetType.resolvedDeclaration;
              tmp_0 = isInterface(tmp_1, DataType);
            } else {
              tmp_0 = false;
            }
            if (tmp_0) {
              $this.finishList();
              var tmp_2 = targetType.resolvedDeclaration;
              var elType = isInterface(tmp_2, DataType) ? tmp_2 : THROW_CCE();
              var propDecl = first(elType.property);
              setPropertyOrReferenceFromDeclaration($this, elType, propDecl);
              $this.finishAsmElement(downData.path, elType);
            } else {
              $this.finishList();
            }
          } else if (equals(type, StdLibDefault_getInstance().ListSeparated)) {
            var tmp_3;
            if (!(null == targetType) && !equals(targetType.resolvedDeclaration, StdLibDefault_getInstance().ListSeparated)) {
              var tmp_4 = targetType.resolvedDeclaration;
              tmp_3 = isInterface(tmp_4, DataType);
            } else {
              tmp_3 = false;
            }
            if (tmp_3) {
              $this.finishListSeparated();
              var tmp_5 = targetType.resolvedDeclaration;
              var elType_0 = isInterface(tmp_5, DataType) ? tmp_5 : THROW_CCE();
              var propDecl_0 = first(elType_0.property);
              setPropertyOrReferenceFromDeclaration($this, elType_0, propDecl_0);
              $this.finishAsmElement(downData.path, elType_0);
            } else {
              $this.finishListSeparated();
            }
          } else {
            // Inline function 'kotlin.error' call
            var message = 'Should not happen';
            throw IllegalStateException.v4(toString(message));
          }
        } else {
          if (isInterface(type, TupleType)) {
            createTupleFrom($this, sentence, type, downData.path, children);
          } else {
            if (isInterface(type, DataType)) {
              // Inline function 'kotlin.collections.isNotEmpty' call
              if (!!type.subtypes.a1()) {
                var _iterator__ex2g4s = type.property.s();
                while (_iterator__ex2g4s.t()) {
                  var propDecl_1 = _iterator__ex2g4s.u();
                  var propType = propDecl_1.typeInstance.resolvedDeclaration;
                  if (isInterface(propType, PrimitiveType)) {
                    var childData = children.z(propDecl_1.index);
                    var tmp_6 = StdLibDefault_getInstance().String.resolvedDeclaration;
                    createPrimitiveValue($this, sentence, isInterface(tmp_6, PrimitiveType) ? tmp_6 : THROW_CCE(), childData.nodeInfo);
                  } else {
                    if (isInterface(propType, CollectionType)) {
                      if (equals(propType, StdLibDefault_getInstance().List)) {
                        if (target.node.rule.isListSimple && target.node.option === Companion_getInstance_0().OPTION_MULTI_EMPTY)
                          emptyList();
                        else if (target.node.rule.isList) {
                          // Inline function 'kotlin.collections.map' call
                          // Inline function 'kotlin.collections.mapTo' call
                          var destination = ArrayList.w(collectionSizeOrDefault(children, 10));
                          var _iterator__ex2g4s_0 = children.s();
                          while (_iterator__ex2g4s_0.t()) {
                            var item = _iterator__ex2g4s_0.u();
                            var tmp$ret$1 = item.value;
                            destination.r(tmp$ret$1);
                          }
                          createList($this, target, destination);
                        } else {
                          var childData_0 = children.z(propDecl_1.index);
                          if (childData_0.nodeInfo.node.rule.isList) {
                            if (null == childData_0.value)
                              emptyList();
                            else {
                              var tmp_7 = childData_0.value;
                              if (!(tmp_7 == null) ? isInterface(tmp_7, KtList) : false) {
                                var tmp_8 = childData_0.value;
                                createList($this, childData_0.nodeInfo, isInterface(tmp_8, KtList) ? tmp_8 : THROW_CCE());
                              } else {
                                var tmp_9 = childData_0.value;
                                if (!(tmp_9 == null) ? isInterface(tmp_9, AsmStructure) : false) {
                                  var tmp_10 = first_0(childData_0.value.property.v2()).value;
                                  if (!isInterface(tmp_10, KtList))
                                    THROW_CCE();
                                } else {
                                  listOf(childData_0.value);
                                }
                              }
                            }
                          } else {
                            // Inline function 'kotlin.error' call
                            var message_0 = "Internal Error: cannot create a ListSimple from '" + childData_0.toString() + "'";
                            throw IllegalStateException.v4(toString(message_0));
                          }
                        }
                      } else if (equals(propType, StdLibDefault_getInstance().ListSeparated)) {
                        var childData_1 = children.z(propDecl_1.index);
                        if (childData_1.nodeInfo.node.rule.isEmptyTerminal)
                          emptyList();
                        else if (childData_1.nodeInfo.node.rule.isEmptyListTerminal)
                          emptyList();
                        else if (target.node.rule.isList) {
                          // Inline function 'kotlin.collections.map' call
                          // Inline function 'kotlin.collections.mapTo' call
                          var destination_0 = ArrayList.w(collectionSizeOrDefault(children, 10));
                          var _iterator__ex2g4s_1 = children.s();
                          while (_iterator__ex2g4s_1.t()) {
                            var item_0 = _iterator__ex2g4s_1.u();
                            var tmp$ret$4 = item_0.value;
                            destination_0.r(tmp$ret$4);
                          }
                          // Inline function 'net.akehurst.language.collections.toSeparatedList' call
                          ListSeparatedArrayList.gk(destination_0);
                        } else if (childData_1.nodeInfo.node.rule.isList) {
                          var tmp_11 = childData_1.value;
                          if (!(tmp_11 == null) ? isInterface(tmp_11, KtList) : false)
                            childData_1.value;
                          else {
                            var tmp_12 = childData_1.value;
                            if (!(tmp_12 == null) ? isInterface(tmp_12, AsmStructure) : false) {
                              var tmp_13 = first_0(childData_1.value.property.v2()).value;
                              if (!isInterface(tmp_13, KtList))
                                THROW_CCE();
                            } else {
                              throw NotImplementedError.uj();
                            }
                          }
                        } else {
                          // Inline function 'kotlin.error' call
                          var message_1 = "Internal Error: cannot create a ListSeparated from '" + childData_1.toString() + "'";
                          throw IllegalStateException.v4(toString(message_1));
                        }
                      } else {
                        // Inline function 'kotlin.error' call
                        var message_2 = 'Should not happen';
                        throw IllegalStateException.v4(toString(message_2));
                      }
                    }
                  }
                  setPropertyOrReferenceFromDeclaration($this, type, propDecl_1);
                }
                $this.finishAsmElement(downData.path, type);
              }
            } else {
              if (equals(type, $this.typeModel.NothingType)) {
                // Inline function 'kotlin.error' call
                var message_3 = "Internal Error: items should not have type 'NothingType'";
                throw IllegalStateException.v4(toString(message_3));
              } else if (equals(type, $this.typeModel.AnyType)) {
                // Inline function 'kotlin.TODO' call
                throw NotImplementedError.uj();
              } else {
                // Inline function 'kotlin.error' call
                var message_4 = 'Shold not happen';
                throw IllegalStateException.v4(toString(message_4));
              }
            }
          }
        }
      }
    }
  }
}
function createPrimitiveValue($this, sentence, type, nodeInfo) {
  var text = nodeInfo.node.rule.isEmptyTerminal ? null : nodeInfo.node.rule.isEmptyListTerminal ? null : matchedTextNoSkip(sentence, nodeInfo.node);
  $this.primitive(type, text);
}
function createList($this, nodeData, list) {
  var tmp;
  if (nodeData.node.rule.isListSimple) {
    tmp = list;
  } else if (nodeData.node.rule.isListSeparated) {
    var tmp_0 = nodeData.node.rule;
    var tmp_1 = (tmp_0 instanceof RuntimeRule ? tmp_0 : THROW_CCE()).rhs;
    var rhs = tmp_1 instanceof RuntimeRuleRhsListSeparated ? tmp_1 : THROW_CCE();
    var tmp_2;
    if (rhs.separatorRhsItem.isTerminal) {
      // Inline function 'net.akehurst.language.collections.toSeparatedList' call
      tmp_2 = ListSeparatedArrayList.gk(list).ck();
    } else {
      // Inline function 'net.akehurst.language.collections.toSeparatedList' call
      tmp_2 = ListSeparatedArrayList.gk(list).dk();
    }
    tmp = tmp_2;
  } else {
    var message = 'Internal error: List kind not handled';
    throw IllegalStateException.v4(toString(message));
  }
  return tmp;
}
function createTupleFrom($this, sentence, type, path, children) {
  var _iterator__ex2g4s = type.property.s();
  while (_iterator__ex2g4s.t()) {
    var propDecl = _iterator__ex2g4s.u();
    // Inline function 'kotlin.TODO' call
    throw NotImplementedError.uj();
  }
  $this.finishTuple(path);
}
function setPropertyOrReferenceFromDeclaration($this, elType, declaration) {
  var isRef = false;
  $this.finishProperty(declaration, isRef);
}
var CompletionItemKind_PATTERN_instance;
var CompletionItemKind_LITERAL_instance;
var CompletionItemKind_SEGMENT_instance;
var CompletionItemKind_REFERRED_instance;
function values() {
  return [CompletionItemKind_PATTERN_getInstance(), CompletionItemKind_LITERAL_getInstance(), CompletionItemKind_SEGMENT_getInstance(), CompletionItemKind_REFERRED_getInstance()];
}
function valueOf(value) {
  switch (value) {
    case 'PATTERN':
      return CompletionItemKind_PATTERN_getInstance();
    case 'LITERAL':
      return CompletionItemKind_LITERAL_getInstance();
    case 'SEGMENT':
      return CompletionItemKind_SEGMENT_getInstance();
    case 'REFERRED':
      return CompletionItemKind_REFERRED_getInstance();
    default:
      CompletionItemKind_initEntries();
      THROW_IAE('No enum constant value.');
      break;
  }
}
var CompletionItemKind_entriesInitialized;
function CompletionItemKind_initEntries() {
  if (CompletionItemKind_entriesInitialized)
    return Unit_instance;
  CompletionItemKind_entriesInitialized = true;
  CompletionItemKind_PATTERN_instance = new CompletionItemKind('PATTERN', 0);
  CompletionItemKind_LITERAL_instance = new CompletionItemKind('LITERAL', 1);
  CompletionItemKind_SEGMENT_instance = new CompletionItemKind('SEGMENT', 2);
  CompletionItemKind_REFERRED_instance = new CompletionItemKind('REFERRED', 3);
}
function CompletionItemKind_PATTERN_getInstance() {
  CompletionItemKind_initEntries();
  return CompletionItemKind_PATTERN_instance;
}
function CompletionItemKind_LITERAL_getInstance() {
  CompletionItemKind_initEntries();
  return CompletionItemKind_LITERAL_instance;
}
function CompletionItemKind_SEGMENT_getInstance() {
  CompletionItemKind_initEntries();
  return CompletionItemKind_SEGMENT_instance;
}
function CompletionItemKind_REFERRED_getInstance() {
  CompletionItemKind_initEntries();
  return CompletionItemKind_REFERRED_instance;
}
function _LanguageIdentity___init__impl__3hnnkb(value) {
  return value;
}
function _LanguageIdentity___get_value__impl__kqfjz3($this) {
  return $this;
}
function _LanguageIdentity___get_last__impl__k9n7m0($this) {
  return last(split(_LanguageIdentity___get_value__impl__kqfjz3($this), ['.']));
}
function LanguageIdentity__toString_impl_sekfl7($this) {
  return 'LanguageIdentity(value=' + $this + ')';
}
function LanguageIdentity__hashCode_impl_6neisc($this) {
  return getStringHashCode($this);
}
function LanguageIdentity__equals_impl_65o6bc($this, other) {
  if (!(other instanceof LanguageIdentity))
    return false;
  if (!($this === (other instanceof LanguageIdentity ? other.r2n_1 : THROW_CCE())))
    return false;
  return true;
}
function _GrammarString___init__impl__7iaxk1(value) {
  return value;
}
function _GrammarString___get_value__impl__5bomff($this) {
  return $this;
}
function GrammarString__toString_impl_8b7lo7($this) {
  return 'GrammarString(value=' + $this + ')';
}
function GrammarString__hashCode_impl_u2dih2($this) {
  return getStringHashCode($this);
}
function GrammarString__equals_impl_ykqk2e($this, other) {
  if (!(other instanceof GrammarString))
    return false;
  if (!($this === (other instanceof GrammarString ? other.u1v_1 : THROW_CCE())))
    return false;
  return true;
}
function _TypesString___init__impl__keabg1(value) {
  return value;
}
function _TypesString___get_value__impl__8slfz1($this) {
  return $this;
}
function TypesString__toString_impl_m29nnb($this) {
  return 'TypesString(value=' + $this + ')';
}
function TypesString__hashCode_impl_b3qug($this) {
  return getStringHashCode($this);
}
function TypesString__equals_impl_x7bh1g($this, other) {
  if (!(other instanceof TypesString))
    return false;
  if (!($this === (other instanceof TypesString ? other.e1s_1 : THROW_CCE())))
    return false;
  return true;
}
function _TransformString___init__impl__9dqy3g(value) {
  return value;
}
function _TransformString___get_value__impl__kxu2ls($this) {
  return $this;
}
function TransformString__toString_impl_aulel8($this) {
  return 'TransformString(value=' + $this + ')';
}
function TransformString__hashCode_impl_wlrbe3($this) {
  return getStringHashCode($this);
}
function TransformString__equals_impl_ejjinl($this, other) {
  if (!(other instanceof TransformString))
    return false;
  if (!($this === (other instanceof TransformString ? other.f1s_1 : THROW_CCE())))
    return false;
  return true;
}
function _CrossReferenceString___init__impl__2ehjbv(value) {
  return value;
}
function _CrossReferenceString___get_value__impl__vi2q2h($this) {
  return $this;
}
function CrossReferenceString__toString_impl_p6g1h7($this) {
  return 'CrossReferenceString(value=' + $this + ')';
}
function CrossReferenceString__hashCode_impl_o3i3p2($this) {
  return getStringHashCode($this);
}
function CrossReferenceString__equals_impl_x2ltda($this, other) {
  if (!(other instanceof CrossReferenceString))
    return false;
  if (!($this === (other instanceof CrossReferenceString ? other.g1s_1 : THROW_CCE())))
    return false;
  return true;
}
function _StyleString___init__impl__vpzm3t(value) {
  return value;
}
function _StyleString___get_value__impl__2hufp($this) {
  return $this;
}
function StyleString__toString_impl_hzhk8v($this) {
  return 'StyleString(value=' + $this + ')';
}
function StyleString__hashCode_impl_3rock0($this) {
  return getStringHashCode($this);
}
function StyleString__equals_impl_v9zdu4($this, other) {
  if (!(other instanceof StyleString))
    return false;
  if (!($this === (other instanceof StyleString ? other.h1s_1 : THROW_CCE())))
    return false;
  return true;
}
function _FormatString___init__impl__5jzgt5(value) {
  return value;
}
function _FormatString___get_value__impl__b4w1sj($this) {
  return $this;
}
function FormatString__toString_impl_1nt62v($this) {
  return 'FormatString(value=' + $this + ')';
}
function FormatString__hashCode_impl_nez2vq($this) {
  return getStringHashCode($this);
}
function FormatString__equals_impl_kwq0li($this, other) {
  if (!(other instanceof FormatString))
    return false;
  if (!($this === (other instanceof FormatString ? other.i1s_1 : THROW_CCE())))
    return false;
  return true;
}
var ParserKind_GLC_instance;
function values_0() {
  return [ParserKind_GLC_getInstance()];
}
function valueOf_0(value) {
  if (value === 'GLC')
    return ParserKind_GLC_getInstance();
  else {
    ParserKind_initEntries();
    THROW_IAE('No enum constant value.');
  }
}
var ParserKind_entriesInitialized;
function ParserKind_initEntries() {
  if (ParserKind_entriesInitialized)
    return Unit_instance;
  ParserKind_entriesInitialized = true;
  ParserKind_GLC_instance = new ParserKind('GLC', 0);
}
function ParserKind_GLC_getInstance() {
  ParserKind_initEntries();
  return ParserKind_GLC_instance;
}
var Companion_instance_6;
function Companion_getInstance_8() {
  if (Companion_instance_6 === VOID)
    new Companion_5();
  return Companion_instance_6;
}
function LanguageObjectAbstract$grammarString$delegate$lambda(this$0) {
  return () => this$0.grammarModel.asString();
}
function LanguageObjectAbstract$typesString$delegate$lambda(this$0) {
  return () => this$0.typesModel.asString();
}
function LanguageObjectAbstract$kompositeString$delegate$lambda(this$0) {
  return () => this$0.kompositeModel.asString();
}
function LanguageObjectAbstract$asmTransformString$delegate$lambda(this$0) {
  return () => this$0.asmTransformModel.asString();
}
function LanguageObjectAbstract$crossReferenceString$delegate$lambda(this$0) {
  return () => this$0.crossReferenceModel.asString();
}
function LanguageObjectAbstract$styleString$delegate$lambda(this$0) {
  return () => this$0.styleModel.asString();
}
function LanguageObjectAbstract$formatString$delegate$lambda(this$0) {
  return () => this$0.formatModel.asString();
}
function grammarString$factory() {
  return getPropertyCallableRef('grammarString', 1, KProperty1, (receiver) => receiver.grammarString, null);
}
function typesString$factory() {
  return getPropertyCallableRef('typesString', 1, KProperty1, (receiver) => receiver.typesString, null);
}
function kompositeString$factory() {
  return getPropertyCallableRef('kompositeString', 1, KProperty1, (receiver) => receiver.kompositeString, null);
}
function asmTransformString$factory() {
  return getPropertyCallableRef('asmTransformString', 1, KProperty1, (receiver) => receiver.asmTransformString, null);
}
function crossReferenceString$factory() {
  return getPropertyCallableRef('crossReferenceString', 1, KProperty1, (receiver) => receiver.crossReferenceString, null);
}
function styleString$factory() {
  return getPropertyCallableRef('styleString', 1, KProperty1, (receiver) => receiver.styleString, null);
}
function formatString$factory() {
  return getPropertyCallableRef('formatString', 1, KProperty1, (receiver) => receiver.formatString, null);
}
function _PropertyValueName___init__impl__cmfy0i(value) {
  return value;
}
function _PropertyValueName___get_value__impl__k5tzza($this) {
  return $this;
}
function PropertyValueName__toString_impl_bg83d2($this) {
  return _PropertyValueName___get_value__impl__k5tzza($this);
}
function PropertyValueName__hashCode_impl_x7e05x($this) {
  return getStringHashCode($this);
}
function PropertyValueName__equals_impl_h3c8qh($this, other) {
  if (!(other instanceof PropertyValueName))
    return false;
  if (!($this === (other instanceof PropertyValueName ? other.i2p_1 : THROW_CCE())))
    return false;
  return true;
}
function AglAsm$typeModel$delegate$lambda() {
  var tmp = AglBase_getInstance().typesModel.namespace;
  return typeModel('Asm', true, tmp, AglAsm$typeModel$delegate$lambda$lambda);
}
function AglAsm$typeModel$delegate$lambda$lambda($this$typeModel) {
  var tmp = listOf_0(['net.akehurst.language.base.api', 'std', 'net.akehurst.language.collections']);
  $this$typeModel.namespace('net.akehurst.language.asm.api', tmp, AglAsm$typeModel$delegate$lambda$lambda$lambda);
  var tmp_0 = listOf_0(['net.akehurst.language.asm.api', 'std', 'net.akehurst.language.base.api', 'net.akehurst.language.collections']);
  $this$typeModel.namespace('net.akehurst.language.asm.simple', tmp_0, AglAsm$typeModel$delegate$lambda$lambda$lambda_0);
  var tmp_1 = listOf('std');
  $this$typeModel.namespace('net.akehurst.language.collections', tmp_1, AglAsm$typeModel$delegate$lambda$lambda$lambda_1);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.value('PropertyValueName', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda);
  $this$namespace.interface_('AsmValue', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_0);
  $this$namespace.interface_('AsmTreeWalker', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_1);
  $this$namespace.interface_('AsmStructureProperty', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_2);
  $this$namespace.interface_('AsmStructure', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_3);
  $this$namespace.interface_('AsmReference', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_4);
  $this$namespace.interface_('AsmPrimitive', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_5);
  $this$namespace.interface_('AsmPath', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_6);
  $this$namespace.interface_('AsmNothing', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_7);
  $this$namespace.interface_('AsmListSeparated', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_8);
  $this$namespace.interface_('AsmList', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_9);
  $this$namespace.interface_('AsmLambda', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_10);
  $this$namespace.interface_('AsmAny', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_11);
  $this$namespace.interface_('Asm', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_12);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda($this$value) {
  $this$value.supertype('PublicValueType');
  $this$value.constructor_(AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda);
  $this$value.propertyOf(setOf_0([$this$value.VAL, $this$value.REF, $this$value.STR]), 'value', 'String', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda($this$constructor_) {
  $this$constructor_.parameter('value', 'String', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_0($this$interface_) {
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_1($this$interface_) {
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_2($this$interface_) {
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'value', 'AsmValue', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_3($this$interface_) {
  $this$interface_.supertype('AsmValue');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'property', 'Map', false, AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$propertyOf) {
  $this$propertyOf.typeArgument('PropertyValueName');
  $this$propertyOf.typeArgument('AsmStructureProperty');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_4($this$interface_) {
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_5($this$interface_) {
  $this$interface_.supertype('AsmValue');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_6($this$interface_) {
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_7($this$interface_) {
  $this$interface_.supertype('AsmValue');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_8($this$interface_) {
  $this$interface_.supertype('AsmList');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'elements', 'ListSeparated', false, AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$propertyOf) {
  $this$propertyOf.typeArgument('AsmValue');
  $this$propertyOf.typeArgument('AsmValue');
  $this$propertyOf.typeArgument('AsmValue');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_9($this$interface_) {
  $this$interface_.supertype('AsmValue');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'elements', 'List', false, AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$propertyOf) {
  $this$propertyOf.typeArgument('AsmValue');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_10($this$interface_) {
  $this$interface_.supertype('AsmValue');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_11($this$interface_) {
  $this$interface_.supertype('AsmValue');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_12($this$interface_) {
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'root', 'List', false, AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$propertyOf) {
  $this$propertyOf.typeArgument('AsmValue');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda_0($this$namespace) {
  $this$namespace.singleton('AsmNothingSimple');
  $this$namespace.singleton('AglAsm');
  $this$namespace.data('AsmValueAbstract', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_13);
  $this$namespace.data('AsmStructureSimple', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_14);
  $this$namespace.data('AsmStructurePropertySimple', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_15);
  $this$namespace.data('AsmSimpleKt', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_16);
  $this$namespace.data('AsmSimple', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_17);
  $this$namespace.data('AsmReferenceSimple', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_18);
  $this$namespace.data('AsmPrimitiveSimple', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_19);
  $this$namespace.data('AsmPathSimple', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_20);
  $this$namespace.data('AsmListSimple', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_21);
  $this$namespace.data('AsmListSeparatedSimple', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_22);
  $this$namespace.data('AsmLambdaSimple', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_23);
  $this$namespace.data('AsmAnySimple', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_24);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_13($this$data) {
  $this$data.supertype('AsmValue');
  $this$data.constructor_(AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$constructor_) {
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_14($this$data) {
  $this$data.supertype('AsmValueAbstract');
  $this$data.supertype('AsmStructure');
  $this$data.constructor_(AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  $this$data.propertyOf(setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]), 'parsePath', 'String', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'property', 'Map', false, AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'qualifiedTypeName', 'QualifiedName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]), 'semanticPath', 'AsmPath', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$constructor_) {
  $this$constructor_.parameter('qualifiedTypeName', 'QualifiedName', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$propertyOf) {
  $this$propertyOf.typeArgument('PropertyValueName');
  $this$propertyOf.typeArgument('AsmStructureProperty');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_15($this$data) {
  $this$data.supertype('AsmStructureProperty');
  $this$data.constructor_(AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'index', 'Integer', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'PropertyValueName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]), 'value', 'AsmValue', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$constructor_) {
  $this$constructor_.parameter('name', 'PropertyValueName', false);
  $this$constructor_.parameter('index', 'Integer', false);
  $this$constructor_.parameter('value', 'AsmValue', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_16($this$data) {
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_17($this$data) {
  $this$data.supertype('Asm');
  $this$data.constructor_(AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_8);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'elementIndex', 'Map', false, AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_9);
  var tmp_0 = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp_0, 'root', 'List', false, AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_10);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_8($this$constructor_) {
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_9($this$propertyOf) {
  $this$propertyOf.typeArgument('AsmPath');
  $this$propertyOf.typeArgument('AsmStructure');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_10($this$propertyOf) {
  $this$propertyOf.typeArgument('AsmValue');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_18($this$data) {
  $this$data.supertype('AsmValueAbstract');
  $this$data.supertype('AsmReference');
  $this$data.constructor_(AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_11);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'reference', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]), 'value', 'AsmStructure', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_11($this$constructor_) {
  $this$constructor_.parameter('reference', 'String', false);
  $this$constructor_.parameter('value', 'AsmStructure', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_19($this$data) {
  $this$data.supertype('AsmValueAbstract');
  $this$data.supertype('AsmPrimitive');
  $this$data.constructor_(AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_12);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'qualifiedTypeName', 'QualifiedName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'value', 'Any', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_12($this$constructor_) {
  $this$constructor_.parameter('qualifiedTypeName', 'QualifiedName', false);
  $this$constructor_.parameter('value', 'Any', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_20($this$data) {
  $this$data.supertype('AsmPath');
  $this$data.constructor_(AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_13);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'value', 'String', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_13($this$constructor_) {
  $this$constructor_.parameter('value', 'String', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_21($this$data) {
  $this$data.supertype('AsmValueAbstract');
  $this$data.supertype('AsmList');
  $this$data.constructor_(AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_14);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'elements', 'List', false, AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_15);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_14($this$constructor_) {
  $this$constructor_.parameter('elements', 'List', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_15($this$propertyOf) {
  $this$propertyOf.typeArgument('AsmValue');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_22($this$data) {
  $this$data.supertype('AsmValueAbstract');
  $this$data.supertype('AsmListSeparated');
  $this$data.constructor_(AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_16);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'elements', 'ListSeparated', false, AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_17);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_16($this$constructor_) {
  $this$constructor_.parameter('elements', 'ListSeparated', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_17($this$propertyOf) {
  $this$propertyOf.typeArgument('AsmValue');
  $this$propertyOf.typeArgument('AsmValue');
  $this$propertyOf.typeArgument('AsmValue');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_23($this$data) {
  $this$data.supertype('AsmValueAbstract');
  $this$data.supertype('AsmLambda');
  $this$data.constructor_(AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_18);
  var tmp = setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'lambda', 'LambdaType', false, AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_19);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'qualifiedTypeName', 'QualifiedName', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_18($this$constructor_) {
  $this$constructor_.parameter('lambda', 'LambdaType', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_19($this$propertyOf) {
  $this$propertyOf.typeArgument('AsmValue');
  $this$propertyOf.typeArgument('AsmValue');
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_24($this$data) {
  $this$data.supertype('AsmValueAbstract');
  $this$data.supertype('AsmAny');
  $this$data.constructor_(AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_20);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'value', 'Any', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_20($this$constructor_) {
  $this$constructor_.parameter('value', 'Any', false);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda_1($this$namespace) {
  $this$namespace.interface_('ListSeparated', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_25);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda_25($this$interface_) {
  $this$interface_.typeParameters(['E', 'I', 'S']);
  $this$interface_.supertype('List', AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_21);
  return Unit_instance;
}
function AglAsm$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_21($this$supertype) {
  $this$supertype.ref('E');
  return Unit_instance;
}
var AglAsm_instance;
function AglAsm_getInstance() {
  if (AglAsm_instance === VOID)
    new AglAsm_0();
  return AglAsm_instance;
}
function typeModel$factory() {
  return getPropertyCallableRef('typeModel', 1, KProperty1, (receiver) => receiver.typeModel, null);
}
function get_asValueName(_this__u8e3s4) {
  return _PropertyValueName___init__impl__cmfy0i(_PropertyName___get_value__impl__p219lh(_this__u8e3s4));
}
var Companion_instance_7;
function Companion_getInstance_9() {
  if (Companion_instance_7 === VOID)
    new Companion_6();
  return Companion_instance_7;
}
function traverseDepthFirst$traverse($callback, owningProperty, value) {
  if (isInterface(value, AsmNothing)) {
    $callback.onNothing(owningProperty, value);
  } else {
    if (isInterface(value, AsmPrimitive)) {
      $callback.onPrimitive(owningProperty, value);
    } else {
      if (isInterface(value, AsmStructure)) {
        $callback.beforeStructure(owningProperty, value);
        var _iterator__ex2g4s = value.propertyOrdered.s();
        while (_iterator__ex2g4s.t()) {
          var prop = _iterator__ex2g4s.u();
          $callback.onProperty(value, prop);
          var pv = prop.value;
          traverseDepthFirst$traverse($callback, prop, pv);
        }
        $callback.afterStructure(owningProperty, value);
      } else {
        if (isInterface(value, AsmList)) {
          $callback.beforeList(owningProperty, value);
          // Inline function 'kotlin.collections.forEach' call
          var _iterator__ex2g4s_0 = value.elements.s();
          while (_iterator__ex2g4s_0.t()) {
            var element = _iterator__ex2g4s_0.u();
            traverseDepthFirst$traverse($callback, owningProperty, element);
          }
          $callback.afterList(owningProperty, value);
        } else {
          if (isInterface(value, AsmListSeparated)) {
            $callback.beforeList(owningProperty, value);
            // Inline function 'kotlin.collections.forEach' call
            var _iterator__ex2g4s_1 = value.elements.s();
            while (_iterator__ex2g4s_1.t()) {
              var element_0 = _iterator__ex2g4s_1.u();
              traverseDepthFirst$traverse($callback, owningProperty, element_0);
            }
            $callback.afterList(owningProperty, value);
          }
        }
      }
    }
  }
}
function AsmSimple$asString$lambda($indentIncrement, $currentIndent) {
  return (it) => it.asString($indentIncrement, $currentIndent);
}
var AsmNothingSimple_instance;
function AsmNothingSimple_getInstance() {
  if (AsmNothingSimple_instance === VOID)
    new AsmNothingSimple_0();
  return AsmNothingSimple_instance;
}
var Companion_instance_8;
function Companion_getInstance_10() {
  return Companion_instance_8;
}
var Companion_instance_9;
function Companion_getInstance_11() {
  return Companion_instance_9;
}
function get_isStdString(_this__u8e3s4) {
  var tmp;
  if (isInterface(_this__u8e3s4, AsmPrimitive)) {
    tmp = _this__u8e3s4.qualifiedTypeName === StdLibDefault_getInstance().String.qualifiedTypeName;
  } else {
    tmp = false;
  }
  return tmp;
}
function get_isStdInteger(_this__u8e3s4) {
  var tmp;
  if (isInterface(_this__u8e3s4, AsmPrimitive)) {
    tmp = _this__u8e3s4.qualifiedTypeName === StdLibDefault_getInstance().Integer.qualifiedTypeName;
  } else {
    tmp = false;
  }
  return tmp;
}
function get_isNothing(_this__u8e3s4) {
  return isInterface(_this__u8e3s4, AsmNothing);
}
function get_raw(_this__u8e3s4) {
  var tmp;
  if (isInterface(_this__u8e3s4, AsmNothing)) {
    tmp = Unit_instance;
  } else {
    if (isInterface(_this__u8e3s4, AsmAny)) {
      tmp = _this__u8e3s4.value;
    } else {
      if (isInterface(_this__u8e3s4, AsmPrimitive)) {
        tmp = _this__u8e3s4.value;
      } else {
        if (isInterface(_this__u8e3s4, AsmList)) {
          // Inline function 'kotlin.collections.map' call
          var this_0 = _this__u8e3s4.elements;
          // Inline function 'kotlin.collections.mapTo' call
          var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
          var _iterator__ex2g4s = this_0.s();
          while (_iterator__ex2g4s.t()) {
            var item = _iterator__ex2g4s.u();
            var tmp$ret$0 = get_raw(item);
            destination.r(tmp$ret$0);
          }
          tmp = destination;
        } else {
          // Inline function 'kotlin.TODO' call
          throw NotImplementedError.uj();
        }
      }
    }
  }
  return tmp;
}
function AsmStructureSimple$_get_propertyOrdered_$lambda_a95tmc(a, b) {
  var aIdx = a.index;
  var bIdx = b.index;
  return aIdx > bIdx ? 1 : aIdx < bIdx ? -1 : 0;
}
function AsmStructureSimple$asString$lambda($indentIncrement, $newIndent) {
  return (it) => {
    var tmp;
    if (it.isReference) {
      var tmp_0 = it.value;
      var ref = tmp_0 instanceof AsmReferenceSimple ? tmp_0 : THROW_CCE();
      tmp = PropertyValueName__toString_impl_bg83d2(it.name) + ' = ' + ref.toString();
    } else {
      tmp = PropertyValueName__toString_impl_bg83d2(it.name) + ' = ' + it.value.asString($indentIncrement, $newIndent);
    }
    return tmp;
  };
}
var Companion_instance_10;
function Companion_getInstance_12() {
  return Companion_instance_10;
}
function AsmStructurePropertySimple$convertToReferenceTo$lambda(it) {
  var tmp = (isInterface(it, AsmPrimitive) ? it : THROW_CCE()).value;
  return typeof tmp === 'string' ? tmp : THROW_CCE();
}
function AsmListSimple$asString$lambda($currentIndent, $indentIncrement) {
  return (it) => it.asString($currentIndent, $indentIncrement);
}
function AsmListSeparatedSimple$asString$lambda($currentIndent, $indentIncrement) {
  return (it) => it.asString($currentIndent, $indentIncrement);
}
function asmSimple(typeModel_0, defaultNamespace, crossReferenceModel, sentenceId, context, resolveReferences, failIfIssues, resolvedReferences, init) {
  var tmp;
  if (typeModel_0 === VOID) {
    tmp = typeModel('StdLib', false, VOID, asmSimple$lambda);
  } else {
    tmp = typeModel_0;
  }
  typeModel_0 = tmp;
  defaultNamespace = defaultNamespace === VOID ? StdLibDefault_getInstance().t2e_1 : defaultNamespace;
  crossReferenceModel = crossReferenceModel === VOID ? new CrossReferenceModelDefault(_SimpleName___init__impl__6s45d0('CrossReference')) : crossReferenceModel;
  sentenceId = sentenceId === VOID ? null : sentenceId;
  context = context === VOID ? null : context;
  resolveReferences = resolveReferences === VOID ? true : resolveReferences;
  failIfIssues = failIfIssues === VOID ? true : failIfIssues;
  var tmp_0;
  if (resolvedReferences === VOID) {
    // Inline function 'kotlin.collections.mutableListOf' call
    tmp_0 = ArrayList.y();
  } else {
    tmp_0 = resolvedReferences;
  }
  resolvedReferences = tmp_0;
  var tmp0_elvis_lhs = typeModel_0.findNamespaceOrNull(defaultNamespace);
  var defNs = tmp0_elvis_lhs == null ? StdLibDefault_getInstance() : tmp0_elvis_lhs;
  var b = new AsmSimpleBuilder(typeModel_0, defNs, crossReferenceModel, sentenceId, context, resolveReferences, failIfIssues, resolvedReferences);
  init(b);
  return b.build();
}
function AsmSimpleBuilder$_identifyingValueInFor$lambda(this$0) {
  return (inTypeName, item) => Companion_instance_2.identifyingValueInFor(this$0.r2q_1, this$0.j2q_1, inTypeName.a1u_1, item);
}
function AsmSimpleBuilder$build$lambda(it) {
  return it.toString();
}
function _get__elementScope__jy0q92($this) {
  var tmp0 = $this.e2r_1;
  // Inline function 'kotlin.getValue' call
  _elementScope$factory();
  return tmp0.b3();
}
function _property($this, name, value) {
  $this.d2r_1.setProperty(_PropertyValueName___init__impl__cmfy0i(name), value, 0);
}
function AsmElementSimpleBuilder$_elementScope$delegate$lambda($_parentScope, this$0, $_asmPath) {
  return () => {
    var tmp;
    if ($_parentScope == null) {
      tmp = null;
    } else {
      // Inline function 'kotlin.let' call
      var tmp_0;
      if (!(null == this$0.y2q_1) && this$0.x2q_1.isScopeDefinedFor(new SimpleName(this$0.d2r_1.typeName))) {
        var tmp_1 = this$0.b2r_1(new SimpleName(_QualifiedName___get_last__impl__838y8h($_parentScope.f2r_1)), this$0.d2r_1);
        var tmp0_elvis_lhs = (tmp_1 == null ? true : typeof tmp_1 === 'string') ? tmp_1 : THROW_CCE();
        var refInParent = tmp0_elvis_lhs == null ? _SimpleName___get_value__impl__rl2r3c(this$0.d2r_1.typeName) : tmp0_elvis_lhs;
        var newScope = $_parentScope.createOrGetChildScope(refInParent, this$0.d2r_1.g2m_1);
        var tmp0 = this$0.z2q_1;
        // Inline function 'kotlin.collections.set' call
        var key = $_asmPath;
        tmp0.r2(key, newScope);
        tmp_0 = newScope;
      } else {
        tmp_0 = $_parentScope;
      }
      tmp = tmp_0;
    }
    return tmp;
  };
}
function asmSimple$lambda($this$typeModel) {
  return Unit_instance;
}
function _elementScope$factory() {
  return getPropertyCallableRef('_elementScope', 1, KProperty1, (receiver) => _get__elementScope__jy0q92(receiver), null);
}
function OptionHolderDefault$toString$lambda(_destruct__k2r9zo) {
  // Inline function 'kotlin.collections.component1' call
  var k = _destruct__k2r9zo.a3();
  // Inline function 'kotlin.collections.component2' call
  var v = _destruct__k2r9zo.b3();
  return k + ': ' + v;
}
function ModelAbstract$asString$lambda($indent) {
  return (it) => $indent.toString() + it.asString($indent);
}
function NamespaceAbstract$asString$lambda($newIndent) {
  return (it) => $newIndent.toString() + 'import ' + _Import___get_value__impl__o1bac0(it.p2i_1);
}
function NamespaceAbstract$asString$lambda_0(a, b) {
  // Inline function 'kotlin.comparisons.compareValuesBy' call
  var tmp = _SimpleName___get_value__impl__rl2r3c(a.name);
  var tmp$ret$1 = _SimpleName___get_value__impl__rl2r3c(b.name);
  return compareValues(tmp, tmp$ret$1);
}
function NamespaceAbstract$asString$lambda_1($newIndent) {
  return (it) => $newIndent.toString() + it.asString($newIndent);
}
function get_asPossiblyQualifiedName(_this__u8e3s4) {
  return get_isQualifiedName(_this__u8e3s4) ? new QualifiedName(_QualifiedName___init__impl__8ed982(_this__u8e3s4)) : new SimpleName(_SimpleName___init__impl__6s45d0(_this__u8e3s4));
}
function get_isQualifiedName(_this__u8e3s4) {
  return contains(_this__u8e3s4, '.');
}
function get_asQualifiedName(_this__u8e3s4) {
  return _QualifiedName___init__impl__8ed982(_this__u8e3s4);
}
var Companion_instance_11;
function Companion_getInstance_13() {
  return Companion_instance_11;
}
function get_isSimpleName(_this__u8e3s4) {
  return !contains(_this__u8e3s4, '.');
}
function get_asSimpleName(_this__u8e3s4) {
  return _SimpleName___init__impl__6s45d0(_this__u8e3s4);
}
function _SimpleName___init__impl__6s45d0(value) {
  return value;
}
function _SimpleName___get_value__impl__rl2r3c($this) {
  return $this;
}
var Companion_instance_12;
function Companion_getInstance_14() {
  return Companion_instance_12;
}
function _SimpleName___get_simpleName__impl__j6kwzs($this) {
  return $this;
}
function SimpleName__asQualifiedName_impl_w29pat($this, namespace) {
  var tmp;
  var tmp_0 = namespace;
  if ((tmp_0 == null ? null : new QualifiedName(tmp_0)) == null) {
    tmp = _QualifiedName___init__impl__8ed982(_SimpleName___get_value__impl__rl2r3c($this));
  } else {
    tmp = QualifiedName__append_impl_hhmte4(namespace, $this);
  }
  return tmp;
}
function SimpleName__toString_impl_vxsxyc($this) {
  var tmp;
  var tmp0 = _SimpleName___get_value__impl__rl2r3c($this);
  // Inline function 'kotlin.text.contains' call
  if (Regex.pe('\\s').re(tmp0)) {
    tmp = "'" + _SimpleName___get_value__impl__rl2r3c($this) + "'";
  } else {
    tmp = _SimpleName___get_value__impl__rl2r3c($this);
  }
  return tmp;
}
function SimpleName__hashCode_impl_a6n15h($this) {
  return getStringHashCode($this);
}
function SimpleName__equals_impl_cgqmkv($this, other) {
  if (!(other instanceof SimpleName))
    return false;
  if (!($this === (other instanceof SimpleName ? other.a1u_1 : THROW_CCE())))
    return false;
  return true;
}
function _QualifiedName___init__impl__8ed982(value) {
  return value;
}
function _QualifiedName___get_value__impl__nkc4gq($this) {
  return $this;
}
function _QualifiedName___init__impl__8ed982_0(namespace, name) {
  return _QualifiedName___init__impl__8ed982(_QualifiedName___get_value__impl__nkc4gq(namespace) + '.' + SimpleName__toString_impl_vxsxyc(name));
}
function _QualifiedName___get_parts__impl__mdubdj($this) {
  // Inline function 'kotlin.collections.map' call
  var this_0 = split(_QualifiedName___get_value__impl__nkc4gq($this), ['.']);
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
  var _iterator__ex2g4s = this_0.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var tmp$ret$0 = new SimpleName(get_asSimpleName(item));
    destination.r(tmp$ret$0);
  }
  return destination;
}
function _QualifiedName___get_last__impl__838y8h($this) {
  return last(_QualifiedName___get_parts__impl__mdubdj($this)).a1u_1;
}
function _QualifiedName___get_front__impl__24j8eq($this) {
  return _QualifiedName___init__impl__8ed982(joinToString(dropLast(_QualifiedName___get_parts__impl__mdubdj($this), 1), '.'));
}
function _QualifiedName___get_asPossiblyQualified__impl__bty3hq($this) {
  return get_asPossiblyQualifiedName(_QualifiedName___get_value__impl__nkc4gq($this));
}
function QualifiedName__append_impl_hhmte4($this, lastPart) {
  return _QualifiedName___init__impl__8ed982_0($this, lastPart);
}
function _QualifiedName___get_simpleName__impl__hgm016($this) {
  return _QualifiedName___get_last__impl__838y8h($this);
}
function _QualifiedName___get_asImport__impl__hufagg($this) {
  return _Import___init__impl__786z8c(_QualifiedName___get_value__impl__nkc4gq($this));
}
function QualifiedName__asQualifiedName_impl_3a4znl($this, namespace) {
  return $this;
}
function QualifiedName__toString_impl_z3wem2($this) {
  return _QualifiedName___get_value__impl__nkc4gq($this);
}
function QualifiedName__hashCode_impl_dcqht7($this) {
  return getStringHashCode($this);
}
function QualifiedName__equals_impl_yjpbk7($this, other) {
  if (!(other instanceof QualifiedName))
    return false;
  if (!($this === (other instanceof QualifiedName ? other.f27_1 : THROW_CCE())))
    return false;
  return true;
}
function _Import___init__impl__786z8c(value) {
  return value;
}
function _Import___get_value__impl__o1bac0($this) {
  return $this;
}
function _Import___get_asQualifiedName__impl__htdpak($this) {
  return _QualifiedName___init__impl__8ed982(_Import___get_value__impl__o1bac0($this));
}
function Import__toString_impl_bbkios($this) {
  return _Import___get_value__impl__o1bac0($this);
}
function Import__hashCode_impl_afle43($this) {
  return getStringHashCode($this);
}
function Import__equals_impl_38wftj($this, other) {
  if (!(other instanceof Import))
    return false;
  if (!($this === (other instanceof Import ? other.p2i_1 : THROW_CCE())))
    return false;
  return true;
}
function AglBase$grammarModel$delegate$lambda() {
  return grammarModel('Base', VOID, VOID, AglBase$grammarModel$delegate$lambda$lambda);
}
function AglBase$grammarModel$delegate$lambda$lambda($this$grammarModel) {
  $this$grammarModel.namespace('net.akehurst.language', AglBase$grammarModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.grammar('Base', AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda($this$grammar) {
  $this$grammar.concatenation('WHITESPACE', VOID, true, true, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda);
  $this$grammar.concatenation('MULTI_LINE_COMMENT', VOID, true, true, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  $this$grammar.concatenation('SINGLE_LINE_COMMENT', VOID, true, true, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  $this$grammar.concatenation('unit', VOID, VOID, VOID, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  $this$grammar.concatenation('namespace', VOID, VOID, VOID, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  $this$grammar.concatenation('import', VOID, VOID, VOID, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  $this$grammar.concatenation('definition', VOID, VOID, VOID, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  $this$grammar.separatedList('possiblyQualifiedName', 1, -1, VOID, VOID, VOID, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  $this$grammar.concatenation('option', VOID, VOID, VOID, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  $this$grammar.concatenation('IDENTIFIER', VOID, VOID, true, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_8);
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda($this$concatenation) {
  $this$concatenation.l2t('\\s+');
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$concatenation) {
  $this$concatenation.l2t('/\\*[^*]*\\*+([^*/][^*]*\\*+)*/');
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$concatenation) {
  $this$concatenation.l2t('//[^\\n\\r]*');
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$concatenation) {
  $this$concatenation.p2t(0, -1, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda);
  $this$concatenation.p2t(0, -1, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda($this$lst) {
  $this$lst.q2t('option');
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0($this$lst) {
  $this$lst.q2t('namespace');
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$concatenation) {
  $this$concatenation.r2t('namespace');
  $this$concatenation.q2t('possiblyQualifiedName');
  $this$concatenation.p2t(0, -1, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_1);
  $this$concatenation.p2t(0, -1, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_2);
  $this$concatenation.p2t(0, -1, AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_3);
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_1($this$lst) {
  $this$lst.q2t('option');
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_2($this$lst) {
  $this$lst.q2t('import');
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_3($this$lst) {
  $this$lst.q2t('definition');
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$concatenation) {
  $this$concatenation.r2t('import');
  $this$concatenation.q2t('possiblyQualifiedName');
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$concatenation) {
  $this$concatenation.r2t('definition');
  $this$concatenation.q2t('IDENTIFIER');
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$separatedList) {
  $this$separatedList.q2t('IDENTIFIER');
  $this$separatedList.r2t('.');
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$concatenation) {
  $this$concatenation.r2t('#');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.s2t(AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_4);
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_4($this$opt) {
  $this$opt.t2t(AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda$lambda($this$grp) {
  $this$grp.r2t(':');
  $this$grp.q2t('IDENTIFIER');
  return Unit_instance;
}
function AglBase$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_8($this$concatenation) {
  $this$concatenation.l2t('[a-zA-Z_][a-zA-Z_0-9-]*');
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda() {
  var tmp = listOf(StdLibDefault_getInstance());
  return typeModel('Base', true, tmp, AglBase$typesModel$delegate$lambda$lambda);
}
function AglBase$typesModel$delegate$lambda$lambda($this$typeModel) {
  var tmp = listOf('std');
  grammarTypeNamespace($this$typeModel, 'net.akehurst.language.base.api', tmp, VOID, AglBase$typesModel$delegate$lambda$lambda$lambda);
  var tmp_0 = listOf_0(['net.akehurst.language.base.api', 'std']);
  $this$typeModel.namespace('net.akehurst.language.base.asm', tmp_0, AglBase$typesModel$delegate$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda($this$grammarTypeNamespace) {
  $this$grammarTypeNamespace.value('SimpleName', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda);
  $this$grammarTypeNamespace.value('QualifiedName', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_0);
  $this$grammarTypeNamespace.value('Import', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_1);
  $this$grammarTypeNamespace.interface_('PublicValueType', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_2);
  $this$grammarTypeNamespace.interface_('PossiblyQualifiedName', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_3);
  $this$grammarTypeNamespace.interface_('OptionHolder', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_4);
  $this$grammarTypeNamespace.interface_('Namespace', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_5);
  $this$grammarTypeNamespace.interface_('Model', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_6);
  $this$grammarTypeNamespace.interface_('Formatable', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_7);
  $this$grammarTypeNamespace.interface_('DefinitionReference', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_8);
  $this$grammarTypeNamespace.interface_('Definition', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_9);
  $this$grammarTypeNamespace.data('Indent', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_10);
  $this$grammarTypeNamespace.data('Asm_apiKt', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_11);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda($this$value) {
  $this$value.supertype('PossiblyQualifiedName');
  $this$value.supertype('PublicValueType');
  $this$value.constructor_(AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda);
  $this$value.propertyOf(setOf_0([$this$value.VAL, $this$value.REF, $this$value.STR]), 'value', 'String', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda($this$constructor_) {
  $this$constructor_.parameter('value', 'String', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_0($this$value) {
  $this$value.supertype('PossiblyQualifiedName');
  $this$value.supertype('PublicValueType');
  $this$value.constructor_(AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  $this$value.propertyOf(setOf_0([$this$value.VAL, $this$value.REF, $this$value.STR]), 'value', 'String', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$constructor_) {
  $this$constructor_.parameter('value', 'String', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_1($this$value) {
  $this$value.supertype('PublicValueType');
  $this$value.constructor_(AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  $this$value.propertyOf(setOf_0([$this$value.VAL, $this$value.REF, $this$value.STR]), 'value', 'String', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$constructor_) {
  $this$constructor_.parameter('value', 'String', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_2($this$interface_) {
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_3($this$interface_) {
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_4($this$interface_) {
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_5($this$interface_) {
  $this$interface_.typeParameters(['DT']);
  $this$interface_.supertype('Formatable');
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'options', 'OptionHolder', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_6($this$interface_) {
  $this$interface_.typeParameters(['NT', 'DT']);
  $this$interface_.supertype('Formatable');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'namespace', 'List', false, AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'options', 'OptionHolder', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$propertyOf) {
  $this$propertyOf.typeArgument('NT');
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_7($this$interface_) {
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_8($this$interface_) {
  $this$interface_.typeParameters(['DT']);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_9($this$interface_) {
  $this$interface_.typeParameters(['DT']);
  $this$interface_.supertype('Formatable');
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'options', 'OptionHolder', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_10($this$data) {
  $this$data.constructor_(AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'increment', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'value', 'String', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$constructor_) {
  $this$constructor_.parameter('value', 'String', false);
  $this$constructor_.parameter('increment', 'String', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_11($this$data) {
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda_0($this$namespace) {
  $this$namespace.data('OptionHolderDefault', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_12);
  $this$namespace.data('NamespaceDefault', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_13);
  $this$namespace.data('NamespaceAbstract', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_14);
  $this$namespace.data('ModelDefault', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_15);
  $this$namespace.data('ModelAbstract', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_16);
  $this$namespace.data('DefinitionDefault', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_17);
  $this$namespace.data('DefinitionAbstract', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_18);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_12($this$data) {
  $this$data.supertype('OptionHolder');
  $this$data.constructor_(AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'options', 'Map', false, AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  $this$data.propertyOf(setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]), 'parent', 'OptionHolder', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$constructor_) {
  $this$constructor_.parameter('parent', 'OptionHolder', false);
  $this$constructor_.parameter('options', 'Map', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$propertyOf) {
  $this$propertyOf.typeArgument('String');
  $this$propertyOf.typeArgument('String');
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_13($this$data) {
  $this$data.supertype('NamespaceAbstract', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  $this$data.constructor_(AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'qualifiedName', 'QualifiedName', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$supertype) {
  $this$supertype.ref('DefinitionDefault');
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$constructor_) {
  $this$constructor_.parameter('qualifiedName', 'QualifiedName', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  $this$constructor_.parameter('import', 'List', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_14($this$data) {
  $this$data.typeParameters(['DT']);
  $this$data.supertype('Namespace', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_8);
  $this$data.constructor_(AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_9);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, '_definition', 'Map', false, AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_10);
  var tmp_0 = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp_0, 'import', 'List', false, AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_11);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'options', 'OptionHolder', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_8($this$supertype) {
  $this$supertype.ref('DT');
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_9($this$constructor_) {
  $this$constructor_.parameter('options', 'OptionHolder', false);
  $this$constructor_.parameter('argImport', 'List', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_10($this$propertyOf) {
  $this$propertyOf.typeArgument('SimpleName');
  $this$propertyOf.typeArgument('DT');
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_11($this$propertyOf) {
  $this$propertyOf.typeArgument('Import');
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_15($this$data) {
  $this$data.supertype('ModelAbstract', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_12);
  $this$data.constructor_(AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_13);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_12($this$supertype) {
  $this$supertype.ref('NamespaceDefault');
  $this$supertype.ref('DefinitionDefault');
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_13($this$constructor_) {
  $this$constructor_.parameter('name', 'SimpleName', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  $this$constructor_.parameter('namespace', 'List', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_16($this$data) {
  $this$data.typeParameters(['NT', 'DT']);
  $this$data.supertype('Model', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_14);
  $this$data.constructor_(AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_15);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'namespace', 'List', false, AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_16);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'options', 'OptionHolder', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_14($this$supertype) {
  $this$supertype.ref('NT');
  $this$supertype.ref('DT');
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_15($this$constructor_) {
  $this$constructor_.parameter('namespace', 'List', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_16($this$propertyOf) {
  $this$propertyOf.typeArgument('NT');
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_17($this$data) {
  $this$data.supertype('DefinitionAbstract', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_17);
  $this$data.constructor_(AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_18);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  var tmp = setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'namespace', 'Namespace', false, AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_19);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'options', 'OptionHolder', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_17($this$supertype) {
  $this$supertype.ref('DefinitionDefault');
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_18($this$constructor_) {
  $this$constructor_.parameter('namespace', 'Namespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_19($this$propertyOf) {
  $this$propertyOf.typeArgument('DefinitionDefault');
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda_18($this$data) {
  $this$data.typeParameters(['DT']);
  $this$data.supertype('Definition', AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_20);
  $this$data.constructor_(AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_21);
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_20($this$supertype) {
  $this$supertype.ref('DT');
  return Unit_instance;
}
function AglBase$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_21($this$constructor_) {
  return Unit_instance;
}
function AglBase$asmTransformModel$delegate$lambda() {
  var tmp = AglBase_getInstance().typesModel;
  return asmTransform('Base', tmp, false, AglBase$asmTransformModel$delegate$lambda$lambda);
}
function AglBase$asmTransformModel$delegate$lambda$lambda($this$asmTransform) {
  $this$asmTransform.namespace('net.akehurst.language', AglBase$asmTransformModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglBase$asmTransformModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.transform('Base', AglBase$asmTransformModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglBase$asmTransformModel$delegate$lambda$lambda$lambda$lambda($this$transform) {
  return Unit_instance;
}
function AglBase$crossReferenceModel$delegate$lambda() {
  return crossReferenceModel('Base', AglBase$crossReferenceModel$delegate$lambda$lambda);
}
function AglBase$crossReferenceModel$delegate$lambda$lambda($this$crossReferenceModel) {
  return Unit_instance;
}
function AglBase$formatModel$delegate$lambda() {
  return formatModel('Base', AglBase$formatModel$delegate$lambda$lambda);
}
function AglBase$formatModel$delegate$lambda$lambda($this$formatModel) {
  return Unit_instance;
}
function AglBase$styleModel$delegate$lambda() {
  return styleModel('Base', AglBase$styleModel$delegate$lambda$lambda);
}
function AglBase$styleModel$delegate$lambda$lambda($this$styleModel) {
  $this$styleModel.namespace('net.akehurst.language', AglBase$styleModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglBase$styleModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.styles('Base', AglBase$styleModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglBase$styleModel$delegate$lambda$lambda$lambda$lambda($this$styles) {
  $this$styles.metaRule("'([^']+)'", AglBase$styleModel$delegate$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglBase$styleModel$delegate$lambda$lambda$lambda$lambda$lambda($this$metaRule) {
  $this$metaRule.declaration('foreground', 'darkgreen');
  $this$metaRule.declaration('font-weight', 'bold');
  return Unit_instance;
}
function AglBase$defaultTargetGrammar$delegate$lambda() {
  return ensureNotNull(AglBase_getInstance().grammarModel.findDefinitionByQualifiedNameOrNull(_QualifiedName___init__impl__8ed982('net.akehurst.language.Base')));
}
function AglBase$syntaxAnalyser$delegate$lambda() {
  return new BaseSyntaxAnalyser();
}
function AglBase$semanticAnalyser$delegate$lambda() {
  return new BaseSemanticAnalyser();
}
function AglBase$completionProvider$delegate$lambda() {
  return new BaseCompletionProvider();
}
var AglBase_instance;
function AglBase_getInstance() {
  if (AglBase_instance === VOID)
    new AglBase_0();
  return AglBase_instance;
}
function grammarModel$factory_1() {
  return getPropertyCallableRef('grammarModel', 1, KProperty1, (receiver) => receiver.grammarModel, null);
}
function typesModel$factory() {
  return getPropertyCallableRef('typesModel', 1, KProperty1, (receiver) => receiver.typesModel, null);
}
function asmTransformModel$factory() {
  return getPropertyCallableRef('asmTransformModel', 1, KProperty1, (receiver) => receiver.asmTransformModel, null);
}
function crossReferenceModel$factory_0() {
  return getPropertyCallableRef('crossReferenceModel', 1, KProperty1, (receiver) => receiver.crossReferenceModel, null);
}
function formatModel$factory_0() {
  return getPropertyCallableRef('formatModel', 1, KProperty1, (receiver) => receiver.formatModel, null);
}
function styleModel$factory() {
  return getPropertyCallableRef('styleModel', 1, KProperty1, (receiver) => receiver.styleModel, null);
}
function defaultTargetGrammar$factory() {
  return getPropertyCallableRef('defaultTargetGrammar', 1, KProperty1, (receiver) => receiver.defaultTargetGrammar, null);
}
function syntaxAnalyser$factory_0() {
  return getPropertyCallableRef('syntaxAnalyser', 1, KProperty1, (receiver) => receiver.syntaxAnalyser, null);
}
function semanticAnalyser$factory_0() {
  return getPropertyCallableRef('semanticAnalyser', 1, KProperty1, (receiver) => receiver.semanticAnalyser, null);
}
function completionProvider$factory_0() {
  return getPropertyCallableRef('completionProvider', 1, KProperty1, (receiver) => receiver.completionProvider, null);
}
function unit($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var options = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var namespace = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  // Inline function 'kotlin.collections.associate' call
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(options, 10)), 16);
  // Inline function 'kotlin.collections.associateTo' call
  var destination = LinkedHashMap.kb(capacity);
  var _iterator__ex2g4s = options.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.plusAssign' call
    destination.r2(element.zg_1, element.ah_1);
  }
  var optHolder = new OptionHolderDefault(null, destination);
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s_0 = namespace.s();
  while (_iterator__ex2g4s_0.t()) {
    var element_0 = _iterator__ex2g4s_0.u();
    var tmp_1 = element_0.options;
    (tmp_1 instanceof OptionHolderDefault ? tmp_1 : THROW_CCE()).g2s_1 = optHolder;
  }
  var result = new ModelDefault(_SimpleName___init__impl__6s45d0('Unit'), optHolder, namespace);
  return result;
}
function namespace($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var pqn = (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(2);
  var options = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(3);
  var import_0 = (!(tmp_1 == null) ? isInterface(tmp_1, KtList) : false) ? tmp_1 : THROW_CCE();
  var tmp_2 = children.z(4);
  var definition = (!(tmp_2 == null) ? isInterface(tmp_2, KtList) : false) ? tmp_2 : THROW_CCE();
  // Inline function 'kotlin.collections.associate' call
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(options, 10)), 16);
  // Inline function 'kotlin.collections.associateTo' call
  var destination = LinkedHashMap.kb(capacity);
  var _iterator__ex2g4s = options.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.plusAssign' call
    destination.r2(element.zg_1, element.ah_1);
  }
  var optHolder = new OptionHolderDefault(null, destination);
  var ns = new NamespaceDefault(pqn.asQualifiedName(null), optHolder, import_0);
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s_0 = definition.s();
  while (_iterator__ex2g4s_0.t()) {
    var element_0 = _iterator__ex2g4s_0.u();
    var def = element_0(ns);
    ns.addDefinition(def);
  }
  return ns;
}
function import_0($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  return _Import___init__impl__786z8c(((!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE()).value);
}
function definition($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var id = _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
  return BaseSyntaxAnalyser$definition$lambda(id, $this, nodeInfo, sentence);
}
function option($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var name = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(2);
  var tmp0_safe_receiver = (tmp_0 == null ? true : isInterface(tmp_0, KtList)) ? tmp_0 : THROW_CCE();
  var tmp_1;
  if (tmp0_safe_receiver == null) {
    tmp_1 = null;
  } else {
    // Inline function 'kotlin.let' call
    tmp_1 = tmp0_safe_receiver.z(1);
  }
  var tmp1_elvis_lhs = tmp_1;
  var value = tmp1_elvis_lhs == null ? 'true' : tmp1_elvis_lhs;
  return new Pair(name, value);
}
function possiblyQualifiedName($this, nodeInfo, children, sentence) {
  return get_asPossiblyQualifiedName(joinToString(isInterface(children, KtList) ? children : THROW_CCE(), ''));
}
function BaseSyntaxAnalyser$unit$ref($boundThis) {
  var l = (p0, p1, p2) => unit($boundThis, p0, p1, p2);
  l.callableName = 'unit';
  return l;
}
function BaseSyntaxAnalyser$namespace$ref($boundThis) {
  var l = (p0, p1, p2) => namespace($boundThis, p0, p1, p2);
  l.callableName = 'namespace';
  return l;
}
function BaseSyntaxAnalyser$import$ref($boundThis) {
  var l = (p0, p1, p2) => new Import(import_0($boundThis, p0, p1, p2));
  l.callableName = 'import';
  return l;
}
function BaseSyntaxAnalyser$definition$ref($boundThis) {
  var l = (p0, p1, p2) => definition($boundThis, p0, p1, p2);
  l.callableName = 'definition';
  return l;
}
function BaseSyntaxAnalyser$option$ref($boundThis) {
  var l = (p0, p1, p2) => option($boundThis, p0, p1, p2);
  l.callableName = 'option';
  return l;
}
function BaseSyntaxAnalyser$possiblyQualifiedName$ref($boundThis) {
  var l = (p0, p1, p2) => possiblyQualifiedName($boundThis, p0, p1, p2);
  l.callableName = 'possiblyQualifiedName';
  return l;
}
function BaseSyntaxAnalyser$definition$lambda($id, this$0, $nodeInfo, $sentence) {
  return (ns) => {
    // Inline function 'kotlin.also' call
    var this_0 = new DefinitionDefault(ns, $id);
    this$0.setLocationFor(this_0, $nodeInfo, $sentence);
    return this_0;
  };
}
function CreateTupleExpressionDefault$asString$lambda($ni, $imports) {
  return (it) => $ni.toString() + it.asString($ni, $imports);
}
function CreateObjectExpressionDefault$asString$lambda($imports) {
  return (it) => it.asString(new Indent(), $imports);
}
function CreateObjectExpressionDefault$asString$lambda_0($ni, $imports) {
  return (it) => $ni.toString() + it.asString($ni, $imports);
}
function WhenExpressionDefault$asString$lambda($ni, $imports) {
  return (it) => it.condition.asString($ni, $imports) + ' -> ' + it.expression.asString($ni.inc, $imports);
}
function WhenExpressionDefault$toString$lambda(it) {
  return toString(it);
}
var Companion_instance_13;
function Companion_getInstance_15() {
  if (Companion_instance_13 === VOID)
    new Companion_12();
  return Companion_instance_13;
}
function IndexOperationDefault$toString$lambda(it) {
  return toString(it);
}
function InfixExpressionDefault$toString$lambda(this$0) {
  return (it) => this$0.a2w_1.z(it) + ' ' + toString(this$0.z2v_1.z(it + 1 | 0));
}
function TypeReferenceDefault$asString$lambda($indent, $imports) {
  return (it) => it.asString($indent, $imports);
}
function AglExpressions$grammarModel$delegate$lambda() {
  return grammarModel('Expressions', VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda);
}
function AglExpressions$grammarModel$delegate$lambda$lambda($this$grammarModel) {
  $this$grammarModel.namespace('net.akehurst.language', AglExpressions$grammarModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.grammar('Expressions', AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda($this$grammar) {
  $this$grammar.extendsGrammar(AglBase_getInstance().defaultTargetGrammar.selfReference);
  $this$grammar.choice('expression', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda);
  $this$grammar.concatenation('rootExpression', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  $this$grammar.concatenation('literalExpression', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  $this$grammar.concatenation('navigationExpression', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  $this$grammar.choice('navigationRoot', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  $this$grammar.choice('navigationPart', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  $this$grammar.separatedList('infixExpression', 2, -1, VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  $this$grammar.choice('INFIX_OPERATOR', VOID, VOID, true, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  $this$grammar.concatenation('object', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  $this$grammar.concatenation('constructorArguments', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_8);
  $this$grammar.concatenation('tuple', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_9);
  $this$grammar.concatenation('assignmentBlock', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_10);
  $this$grammar.list('assignmentList', 0, -1, VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_11);
  $this$grammar.concatenation('assignment', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_12);
  $this$grammar.choice('propertyName', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_13);
  $this$grammar.concatenation('grammarRuleIndex', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_14);
  $this$grammar.concatenation('with', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_15);
  $this$grammar.concatenation('when', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_16);
  $this$grammar.concatenation('whenOption', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_17);
  $this$grammar.concatenation('whenOptionElse', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_18);
  $this$grammar.concatenation('cast', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_19);
  $this$grammar.concatenation('typeTest', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_20);
  $this$grammar.concatenation('group', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_21);
  $this$grammar.concatenation('propertyCall', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_22);
  $this$grammar.concatenation('methodCall', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_23);
  $this$grammar.separatedList('argumentList', 0, -1, VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_24);
  $this$grammar.concatenation('lambda', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_25);
  $this$grammar.choice('propertyReference', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_26);
  $this$grammar.concatenation('methodReference', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_27);
  $this$grammar.concatenation('indexOperation', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_28);
  $this$grammar.separatedList('indexList', 1, -1, VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_29);
  $this$grammar.concatenation('typeReference', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_30);
  $this$grammar.concatenation('typeArgumentList', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_31);
  $this$grammar.choice('literal', VOID, VOID, VOID, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_32);
  $this$grammar.concatenation('SPECIAL', VOID, VOID, true, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_33);
  $this$grammar.concatenation('BOOLEAN', VOID, VOID, true, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_34);
  $this$grammar.concatenation('INTEGER', VOID, VOID, true, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_35);
  $this$grammar.concatenation('REAL', VOID, VOID, true, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_36);
  $this$grammar.concatenation('STRING', VOID, VOID, true, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_37);
  $this$grammar.concatenation('POSITIVE_INTEGER', VOID, VOID, true, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_38);
  $this$grammar.preference('expression', AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_39);
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda($this$choice) {
  $this$choice.q2t('rootExpression');
  $this$choice.q2t('literalExpression');
  $this$choice.q2t('navigationExpression');
  $this$choice.q2t('infixExpression');
  $this$choice.q2t('tuple');
  $this$choice.q2t('object');
  $this$choice.q2t('with');
  $this$choice.q2t('when');
  $this$choice.q2t('cast');
  $this$choice.q2t('typeTest');
  $this$choice.q2t('group');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$concatenation) {
  $this$concatenation.q2t('propertyReference');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$concatenation) {
  $this$concatenation.q2t('literal');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$concatenation) {
  $this$concatenation.q2t('navigationRoot');
  $this$concatenation.p2t(1, -1, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda($this$lst) {
  $this$lst.q2t('navigationPart');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$choice) {
  $this$choice.q2t('rootExpression');
  $this$choice.q2t('literalExpression');
  $this$choice.q2t('group');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$choice) {
  $this$choice.q2t('propertyCall');
  $this$choice.q2t('methodCall');
  $this$choice.q2t('indexOperation');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$separatedList) {
  $this$separatedList.q2t('expression');
  $this$separatedList.q2t('INFIX_OPERATOR');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$choice) {
  $this$choice.r2t('or');
  $this$choice.r2t('and');
  $this$choice.r2t('xor');
  $this$choice.r2t('==');
  $this$choice.r2t('!=');
  $this$choice.r2t('<=');
  $this$choice.r2t('>=');
  $this$choice.r2t('<');
  $this$choice.r2t('>');
  $this$choice.r2t('/');
  $this$choice.r2t('*');
  $this$choice.r2t('%');
  $this$choice.r2t('+');
  $this$choice.r2t('-');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$concatenation) {
  $this$concatenation.q2t('possiblyQualifiedName');
  $this$concatenation.q2t('constructorArguments');
  $this$concatenation.s2t(AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0($this$opt) {
  $this$opt.q2t('assignmentBlock');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_8($this$concatenation) {
  $this$concatenation.r2t('(');
  $this$concatenation.q2t('assignmentList');
  $this$concatenation.r2t(')');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_9($this$concatenation) {
  $this$concatenation.r2t('tuple');
  $this$concatenation.q2t('assignmentBlock');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_10($this$concatenation) {
  $this$concatenation.r2t('{');
  $this$concatenation.q2t('assignmentList');
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_11($this$list) {
  $this$list.q2t('assignment');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_12($this$concatenation) {
  $this$concatenation.q2t('propertyName');
  $this$concatenation.s2t(AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_1);
  $this$concatenation.r2t(':=');
  $this$concatenation.q2t('expression');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_1($this$opt) {
  $this$opt.q2t('grammarRuleIndex');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_13($this$choice) {
  $this$choice.q2t('SPECIAL');
  $this$choice.q2t('IDENTIFIER');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_14($this$concatenation) {
  $this$concatenation.r2t('$');
  $this$concatenation.q2t('POSITIVE_INTEGER');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_15($this$concatenation) {
  $this$concatenation.r2t('with');
  $this$concatenation.r2t('(');
  $this$concatenation.q2t('expression');
  $this$concatenation.r2t(')');
  $this$concatenation.q2t('expression');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_16($this$concatenation) {
  $this$concatenation.r2t('when');
  $this$concatenation.r2t('{');
  $this$concatenation.p2t(1, -1, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_2);
  $this$concatenation.q2t('whenOptionElse');
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_2($this$lst) {
  $this$lst.q2t('whenOption');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_17($this$concatenation) {
  $this$concatenation.q2t('expression');
  $this$concatenation.r2t('->');
  $this$concatenation.q2t('expression');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_18($this$concatenation) {
  $this$concatenation.r2t('else');
  $this$concatenation.r2t('->');
  $this$concatenation.q2t('expression');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_19($this$concatenation) {
  $this$concatenation.q2t('expression');
  $this$concatenation.r2t('as');
  $this$concatenation.q2t('typeReference');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_20($this$concatenation) {
  $this$concatenation.q2t('expression');
  $this$concatenation.r2t('is');
  $this$concatenation.q2t('typeReference');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_21($this$concatenation) {
  $this$concatenation.r2t('(');
  $this$concatenation.q2t('expression');
  $this$concatenation.r2t(')');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_22($this$concatenation) {
  $this$concatenation.r2t('.');
  $this$concatenation.q2t('propertyReference');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_23($this$concatenation) {
  $this$concatenation.r2t('.');
  $this$concatenation.q2t('methodReference');
  $this$concatenation.r2t('(');
  $this$concatenation.q2t('argumentList');
  $this$concatenation.r2t(')');
  $this$concatenation.s2t(AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_3);
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_3($this$opt) {
  $this$opt.q2t('lambda');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_24($this$separatedList) {
  $this$separatedList.q2t('expression');
  $this$separatedList.r2t(',');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_25($this$concatenation) {
  $this$concatenation.r2t('{');
  $this$concatenation.q2t('expression');
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_26($this$choice) {
  $this$choice.q2t('SPECIAL');
  $this$choice.q2t('IDENTIFIER');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_27($this$concatenation) {
  $this$concatenation.q2t('IDENTIFIER');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_28($this$concatenation) {
  $this$concatenation.r2t('[');
  $this$concatenation.q2t('indexList');
  $this$concatenation.r2t(']');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_29($this$separatedList) {
  $this$separatedList.q2t('expression');
  $this$separatedList.r2t(',');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_30($this$concatenation) {
  $this$concatenation.q2t('possiblyQualifiedName');
  $this$concatenation.s2t(AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_4);
  $this$concatenation.s2t(AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_5);
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_4($this$opt) {
  $this$opt.q2t('typeArgumentList');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_5($this$opt) {
  $this$opt.r2t('?');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_31($this$concatenation) {
  $this$concatenation.r2t('<');
  $this$concatenation.k2w(1, -1, AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_6);
  $this$concatenation.r2t('>');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_6($this$spLst) {
  $this$spLst.q2t('typeReference');
  $this$spLst.r2t(',');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_32($this$choice) {
  $this$choice.q2t('BOOLEAN');
  $this$choice.q2t('INTEGER');
  $this$choice.q2t('REAL');
  $this$choice.q2t('STRING');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_33($this$concatenation) {
  $this$concatenation.r2t('$');
  $this$concatenation.q2t('IDENTIFIER');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_34($this$concatenation) {
  $this$concatenation.l2t('true|false');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_35($this$concatenation) {
  $this$concatenation.l2t('[0-9]+');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_36($this$concatenation) {
  $this$concatenation.l2t('[0-9]+[.][0-9]+');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_37($this$concatenation) {
  $this$concatenation.l2t("'([^'\\\\]|\\\\.)*'");
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_38($this$concatenation) {
  $this$concatenation.l2t('[0-9]+');
  return Unit_instance;
}
function AglExpressions$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_39($this$preference) {
  $this$preference.optionRight(listOf('infixExpression'), ChoiceIndicator_ITEM_getInstance(), -1, listOf('INFIX_OPERATOR'));
  $this$preference.optionRight(listOf('infixExpression'), ChoiceIndicator_ITEM_getInstance(), -1, listOf('->'));
  $this$preference.optionRight(listOf('whenOption'), ChoiceIndicator_NONE_getInstance(), -1, listOf('->'));
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda() {
  var tmp = AglBase_getInstance().typesModel.namespace;
  return typeModel('Expressions', true, tmp, AglExpressions$typesModel$delegate$lambda$lambda);
}
function AglExpressions$typesModel$delegate$lambda$lambda($this$typeModel) {
  var tmp = listOf_0(['std', 'net.akehurst.language.base.api']);
  grammarTypeNamespace($this$typeModel, 'net.akehurst.language.expressions.api', tmp, VOID, AglExpressions$typesModel$delegate$lambda$lambda$lambda);
  var tmp_0 = listOf_0(['net.akehurst.language.expressions.api', 'std', 'net.akehurst.language.base.api']);
  $this$typeModel.namespace('net.akehurst.language.expressions.asm', tmp_0, AglExpressions$typesModel$delegate$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda($this$grammarTypeNamespace) {
  $this$grammarTypeNamespace.interface_('WithExpression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda);
  $this$grammarTypeNamespace.interface_('WhenOptionElse', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_0);
  $this$grammarTypeNamespace.interface_('WhenOption', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_1);
  $this$grammarTypeNamespace.interface_('WhenExpression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_2);
  $this$grammarTypeNamespace.interface_('TypeTestExpression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_3);
  $this$grammarTypeNamespace.interface_('TypeReference', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_4);
  $this$grammarTypeNamespace.interface_('RootExpression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_5);
  $this$grammarTypeNamespace.interface_('PropertyCall', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_6);
  $this$grammarTypeNamespace.interface_('OnExpression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_7);
  $this$grammarTypeNamespace.interface_('NavigationPart', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_8);
  $this$grammarTypeNamespace.interface_('NavigationExpression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_9);
  $this$grammarTypeNamespace.interface_('MethodCall', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_10);
  $this$grammarTypeNamespace.interface_('LiteralExpression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_11);
  $this$grammarTypeNamespace.interface_('LambdaExpression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_12);
  $this$grammarTypeNamespace.interface_('InfixExpression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_13);
  $this$grammarTypeNamespace.interface_('IndexOperation', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_14);
  $this$grammarTypeNamespace.interface_('GroupExpression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_15);
  $this$grammarTypeNamespace.interface_('Expression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_16);
  $this$grammarTypeNamespace.interface_('CreateTupleExpression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_17);
  $this$grammarTypeNamespace.interface_('CreateObjectExpression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_18);
  $this$grammarTypeNamespace.interface_('CastExpression', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_19);
  $this$grammarTypeNamespace.interface_('AssignmentStatement', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_20);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda($this$interface_) {
  $this$interface_.supertype('Expression');
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'expression', 'Expression', false);
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'withContext', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_0($this$interface_) {
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_1($this$interface_) {
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'condition', 'Expression', false);
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'expression', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_2($this$interface_) {
  $this$interface_.supertype('Expression');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'options', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda($this$propertyOf) {
  $this$propertyOf.typeArgument('WhenOption');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_3($this$interface_) {
  $this$interface_.supertype('Expression');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_4($this$interface_) {
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_5($this$interface_) {
  $this$interface_.supertype('Expression');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_6($this$interface_) {
  $this$interface_.supertype('NavigationPart');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_7($this$interface_) {
  $this$interface_.supertype('Expression');
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'expression', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_8($this$interface_) {
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_9($this$interface_) {
  $this$interface_.supertype('Expression');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'parts', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'start', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$propertyOf) {
  $this$propertyOf.typeArgument('NavigationPart');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_10($this$interface_) {
  $this$interface_.supertype('NavigationPart');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'arguments', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$propertyOf) {
  $this$propertyOf.typeArgument('Expression');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_11($this$interface_) {
  $this$interface_.supertype('Expression');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_12($this$interface_) {
  $this$interface_.supertype('Expression');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_13($this$interface_) {
  $this$interface_.supertype('Expression');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'expressions', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$propertyOf) {
  $this$propertyOf.typeArgument('Expression');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_14($this$interface_) {
  $this$interface_.supertype('NavigationPart');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'indices', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$propertyOf) {
  $this$propertyOf.typeArgument('Expression');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_15($this$interface_) {
  $this$interface_.supertype('Expression');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_16($this$interface_) {
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_17($this$interface_) {
  $this$interface_.supertype('Expression');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'propertyAssignments', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$propertyOf) {
  $this$propertyOf.typeArgument('AssignmentStatement');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_18($this$interface_) {
  $this$interface_.supertype('Expression');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_19($this$interface_) {
  $this$interface_.supertype('Expression');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_20($this$interface_) {
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'rhs', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda_0($this$namespace) {
  $this$namespace.data('WithExpressionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_21);
  $this$namespace.data('WhenOptionElseDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_22);
  $this$namespace.data('WhenOptionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_23);
  $this$namespace.data('WhenExpressionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_24);
  $this$namespace.data('TypeTestExpressionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_25);
  $this$namespace.data('TypeReferenceDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_26);
  $this$namespace.data('RootExpressionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_27);
  $this$namespace.data('PropertyCallDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_28);
  $this$namespace.data('OnExpressionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_29);
  $this$namespace.data('NavigationExpressionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_30);
  $this$namespace.data('MethodCallDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_31);
  $this$namespace.data('LiteralExpressionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_32);
  $this$namespace.data('LambdaExpressionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_33);
  $this$namespace.data('InfixExpressionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_34);
  $this$namespace.data('IndexOperationDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_35);
  $this$namespace.data('GroupExpressionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_36);
  $this$namespace.data('ExpressionAbstract', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_37);
  $this$namespace.data('CreateTupleExpressionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_38);
  $this$namespace.data('CreateObjectExpressionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_39);
  $this$namespace.data('CastExpressionDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_40);
  $this$namespace.data('AssignmentStatementDefault', AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_41);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_21($this$data) {
  $this$data.supertype('ExpressionAbstract');
  $this$data.supertype('WithExpression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'expression', 'Expression', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'withContext', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$constructor_) {
  $this$constructor_.parameter('withContext', 'Expression', false);
  $this$constructor_.parameter('expression', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_22($this$data) {
  $this$data.supertype('WhenOptionElse');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'expression', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$constructor_) {
  $this$constructor_.parameter('expression', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_23($this$data) {
  $this$data.supertype('WhenOption');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'condition', 'Expression', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'expression', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$constructor_) {
  $this$constructor_.parameter('condition', 'Expression', false);
  $this$constructor_.parameter('expression', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_24($this$data) {
  $this$data.supertype('ExpressionAbstract');
  $this$data.supertype('WhenExpression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_8);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'elseOption', 'WhenOptionElse', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'options', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_9);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_8($this$constructor_) {
  $this$constructor_.parameter('options', 'List', false);
  $this$constructor_.parameter('elseOption', 'WhenOptionElse', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_9($this$propertyOf) {
  $this$propertyOf.typeArgument('WhenOption');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_25($this$data) {
  $this$data.supertype('TypeTestExpression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_10);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'expression', 'Expression', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'targetType', 'TypeReference', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_10($this$constructor_) {
  $this$constructor_.parameter('expression', 'Expression', false);
  $this$constructor_.parameter('targetType', 'TypeReference', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_26($this$data) {
  $this$data.supertype('TypeReference');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_11);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'isNullable', 'Boolean', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'possiblyQualifiedName', 'PossiblyQualifiedName', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'typeArguments', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_12);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_11($this$constructor_) {
  $this$constructor_.parameter('possiblyQualifiedName', 'PossiblyQualifiedName', false);
  $this$constructor_.parameter('typeArguments', 'List', false);
  $this$constructor_.parameter('isNullable', 'Boolean', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_12($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeReference');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_27($this$data) {
  $this$data.supertype('ExpressionAbstract');
  $this$data.supertype('RootExpression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_13);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'name', 'String', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_13($this$constructor_) {
  $this$constructor_.parameter('name', 'String', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_28($this$data) {
  $this$data.supertype('PropertyCall');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_14);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'propertyName', 'String', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_14($this$constructor_) {
  $this$constructor_.parameter('propertyName', 'String', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_29($this$data) {
  $this$data.supertype('ExpressionAbstract');
  $this$data.supertype('OnExpression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_15);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'expression', 'Expression', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'propertyAssignments', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_16);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_15($this$constructor_) {
  $this$constructor_.parameter('expression', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_16($this$propertyOf) {
  $this$propertyOf.typeArgument('AssignmentStatement');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_30($this$data) {
  $this$data.supertype('ExpressionAbstract');
  $this$data.supertype('NavigationExpression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_17);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'parts', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_18);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'start', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_17($this$constructor_) {
  $this$constructor_.parameter('start', 'Expression', false);
  $this$constructor_.parameter('parts', 'List', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_18($this$propertyOf) {
  $this$propertyOf.typeArgument('NavigationPart');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_31($this$data) {
  $this$data.supertype('MethodCall');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_19);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'arguments', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_20);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'methodName', 'String', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_19($this$constructor_) {
  $this$constructor_.parameter('methodName', 'String', false);
  $this$constructor_.parameter('arguments', 'List', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_20($this$propertyOf) {
  $this$propertyOf.typeArgument('Expression');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_32($this$data) {
  $this$data.supertype('ExpressionAbstract');
  $this$data.supertype('LiteralExpression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_21);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'qualifiedTypeName', 'QualifiedName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'value', 'Any', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_21($this$constructor_) {
  $this$constructor_.parameter('qualifiedTypeName', 'QualifiedName', false);
  $this$constructor_.parameter('value', 'Any', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_33($this$data) {
  $this$data.supertype('LambdaExpression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_22);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'expression', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_22($this$constructor_) {
  $this$constructor_.parameter('expression', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_34($this$data) {
  $this$data.supertype('InfixExpression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_23);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'expressions', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_24);
  var tmp_0 = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp_0, 'operators', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_25);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_23($this$constructor_) {
  $this$constructor_.parameter('expressions', 'List', false);
  $this$constructor_.parameter('operators', 'List', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_24($this$propertyOf) {
  $this$propertyOf.typeArgument('Expression');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_25($this$propertyOf) {
  $this$propertyOf.typeArgument('String');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_35($this$data) {
  $this$data.supertype('IndexOperation');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_26);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'indices', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_27);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_26($this$constructor_) {
  $this$constructor_.parameter('indices', 'List', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_27($this$propertyOf) {
  $this$propertyOf.typeArgument('Expression');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_36($this$data) {
  $this$data.supertype('GroupExpression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_28);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'expression', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_28($this$constructor_) {
  $this$constructor_.parameter('expression', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_37($this$data) {
  $this$data.supertype('Expression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_29);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_29($this$constructor_) {
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_38($this$data) {
  $this$data.supertype('ExpressionAbstract');
  $this$data.supertype('CreateTupleExpression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_30);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'propertyAssignments', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_31);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_30($this$constructor_) {
  $this$constructor_.parameter('propertyAssignments', 'List', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_31($this$propertyOf) {
  $this$propertyOf.typeArgument('AssignmentStatement');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_39($this$data) {
  $this$data.supertype('ExpressionAbstract');
  $this$data.supertype('CreateObjectExpression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_32);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'constructorArguments', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_33);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'possiblyQualifiedTypeName', 'PossiblyQualifiedName', false);
  var tmp_0 = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp_0, 'propertyAssignments', 'List', false, AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_34);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_32($this$constructor_) {
  $this$constructor_.parameter('possiblyQualifiedTypeName', 'PossiblyQualifiedName', false);
  $this$constructor_.parameter('constructorArguments', 'List', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_33($this$propertyOf) {
  $this$propertyOf.typeArgument('AssignmentStatement');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_34($this$propertyOf) {
  $this$propertyOf.typeArgument('AssignmentStatement');
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_40($this$data) {
  $this$data.supertype('CastExpression');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_35);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'expression', 'Expression', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'targetType', 'TypeReference', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_35($this$constructor_) {
  $this$constructor_.parameter('expression', 'Expression', false);
  $this$constructor_.parameter('targetType', 'TypeReference', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda_41($this$data) {
  $this$data.supertype('AssignmentStatement');
  $this$data.constructor_(AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_36);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'lhsGrammarRuleIndex', 'Integer', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'lhsPropertyName', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'rhs', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_36($this$constructor_) {
  $this$constructor_.parameter('lhsPropertyName', 'String', false);
  $this$constructor_.parameter('lhsGrammarRuleIndex', 'Integer', false);
  $this$constructor_.parameter('rhs', 'Expression', false);
  return Unit_instance;
}
function AglExpressions$asmTransformModel$delegate$lambda() {
  var tmp = AglExpressions_getInstance().typesModel;
  return asmTransform('Expressions', tmp, false, AglExpressions$asmTransformModel$delegate$lambda$lambda);
}
function AglExpressions$asmTransformModel$delegate$lambda$lambda($this$asmTransform) {
  $this$asmTransform.namespace('net.akehurst.language', AglExpressions$asmTransformModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglExpressions$asmTransformModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.transform('Expressions', AglExpressions$asmTransformModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglExpressions$asmTransformModel$delegate$lambda$lambda$lambda$lambda($this$transform) {
  $this$transform.importTypes(['net.akehurst.language.expressions.api']);
  $this$transform.createObject('expression', 'Expression', AglExpressions$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda);
  $this$transform.createObject('rootExpression', 'RootExpression', AglExpressions$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglExpressions$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda($this$createObject) {
  return Unit_instance;
}
function AglExpressions$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$createObject) {
  return Unit_instance;
}
function AglExpressions$crossReferenceModel$delegate$lambda() {
  return crossReferenceModel('Expressions', AglExpressions$crossReferenceModel$delegate$lambda$lambda);
}
function AglExpressions$crossReferenceModel$delegate$lambda$lambda($this$crossReferenceModel) {
  return Unit_instance;
}
function AglExpressions$formatModel$delegate$lambda() {
  return formatModel('Expressions', AglExpressions$formatModel$delegate$lambda$lambda);
}
function AglExpressions$formatModel$delegate$lambda$lambda($this$formatModel) {
  return Unit_instance;
}
function AglExpressions$styleModel$delegate$lambda() {
  return styleModel('Expressions', AglExpressions$styleModel$delegate$lambda$lambda);
}
function AglExpressions$styleModel$delegate$lambda$lambda($this$styleModel) {
  $this$styleModel.namespace('net.akehurst.language', AglExpressions$styleModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglExpressions$styleModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.styles('Expressions', AglExpressions$styleModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglExpressions$styleModel$delegate$lambda$lambda$lambda$lambda($this$styles) {
  $this$styles.metaRule("'[^']+'", AglExpressions$styleModel$delegate$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglExpressions$styleModel$delegate$lambda$lambda$lambda$lambda$lambda($this$metaRule) {
  $this$metaRule.declaration('foreground', 'darkgreen');
  $this$metaRule.declaration('font-weight', 'bold');
  return Unit_instance;
}
function AglExpressions$defaultTargetGrammar$delegate$lambda() {
  return ensureNotNull(AglExpressions_getInstance().grammarModel.findDefinitionByQualifiedNameOrNull(_QualifiedName___init__impl__8ed982('net.akehurst.language.Expressions')));
}
function AglExpressions$syntaxAnalyser$delegate$lambda() {
  return new ExpressionsSyntaxAnalyser();
}
function AglExpressions$semanticAnalyser$delegate$lambda() {
  return new ExpressionsSemanticAnalyser();
}
function AglExpressions$completionProvider$delegate$lambda() {
  return new ExpressionsCompletionProvider();
}
var AglExpressions_instance;
function AglExpressions_getInstance() {
  if (AglExpressions_instance === VOID)
    new AglExpressions_0();
  return AglExpressions_instance;
}
function grammarModel$factory_2() {
  return getPropertyCallableRef('grammarModel', 1, KProperty1, (receiver) => receiver.grammarModel, null);
}
function typesModel$factory_0() {
  return getPropertyCallableRef('typesModel', 1, KProperty1, (receiver) => receiver.typesModel, null);
}
function asmTransformModel$factory_0() {
  return getPropertyCallableRef('asmTransformModel', 1, KProperty1, (receiver) => receiver.asmTransformModel, null);
}
function crossReferenceModel$factory_1() {
  return getPropertyCallableRef('crossReferenceModel', 1, KProperty1, (receiver) => receiver.crossReferenceModel, null);
}
function formatModel$factory_1() {
  return getPropertyCallableRef('formatModel', 1, KProperty1, (receiver) => receiver.formatModel, null);
}
function styleModel$factory_0() {
  return getPropertyCallableRef('styleModel', 1, KProperty1, (receiver) => receiver.styleModel, null);
}
function defaultTargetGrammar$factory_0() {
  return getPropertyCallableRef('defaultTargetGrammar', 1, KProperty1, (receiver) => receiver.defaultTargetGrammar, null);
}
function syntaxAnalyser$factory_1() {
  return getPropertyCallableRef('syntaxAnalyser', 1, KProperty1, (receiver) => receiver.syntaxAnalyser, null);
}
function semanticAnalyser$factory_1() {
  return getPropertyCallableRef('semanticAnalyser', 1, KProperty1, (receiver) => receiver.semanticAnalyser, null);
}
function completionProvider$factory_1() {
  return getPropertyCallableRef('completionProvider', 1, KProperty1, (receiver) => receiver.completionProvider, null);
}
function get_clazz(_this__u8e3s4) {
  return KotlinxReflectForModule_instance.w1r(_QualifiedName___get_value__impl__nkc4gq(_this__u8e3s4.qualifiedName));
}
function objectInstance(_this__u8e3s4) {
  try {
    var obj = KotlinxReflect_getInstance().rp(_QualifiedName___get_value__impl__nkc4gq(_this__u8e3s4.qualifiedName));
    return !(obj == null) ? obj : THROW_CCE();
  } catch ($p) {
    if ($p instanceof Error) {
      var t = $p;
      printStackTrace(t);
      var tmp = SimpleName__toString_impl_vxsxyc(_this__u8e3s4.name);
      var tmp0_elvis_lhs = t.message;
      // Inline function 'kotlin.error' call
      var message = 'Unable to fetch objectInstance ' + tmp + ' due to ' + (tmp0_elvis_lhs == null ? 'Unknown' : tmp0_elvis_lhs);
      throw IllegalStateException.v4(toString(message));
    } else {
      throw $p;
    }
  }
}
function constructDataType(_this__u8e3s4, constructorArgs) {
  try {
    var cls = get_clazz(_this__u8e3s4);
    var obj = reflect(cls).construct(constructorArgs.slice());
    return obj;
  } catch ($p) {
    if ($p instanceof Error) {
      var t = $p;
      printStackTrace(t);
      var tmp = SimpleName__toString_impl_vxsxyc(_this__u8e3s4.name);
      var tmp_0 = toString(toList_0(constructorArgs));
      var tmp0_elvis_lhs = t.message;
      // Inline function 'kotlin.error' call
      var message = 'Unable to construct ' + tmp + ' from ' + tmp_0 + ' due to ' + (tmp0_elvis_lhs == null ? 'Unknown' : tmp0_elvis_lhs);
      throw IllegalStateException.v4(toString(message));
    } else {
      throw $p;
    }
  }
}
function constructValueType(_this__u8e3s4, value) {
  try {
    var cls = get_clazz(_this__u8e3s4);
    var obj = reflect(cls).construct([value]);
    return obj;
  } catch ($p) {
    if ($p instanceof Error) {
      var t = $p;
      printStackTrace(t);
      var tmp = SimpleName__toString_impl_vxsxyc(_this__u8e3s4.name);
      var tmp_0 = toString(value);
      var tmp0_elvis_lhs = t.message;
      // Inline function 'kotlin.error' call
      var message = 'Unable to construct ' + tmp + ' from ' + tmp_0 + ' due to ' + (tmp0_elvis_lhs == null ? 'Unknown' : tmp0_elvis_lhs);
      throw IllegalStateException.v4(toString(message));
    } else {
      throw $p;
    }
  }
}
function get(_this__u8e3s4, obj) {
  var reflect = reflect_0(obj);
  return reflect.fq(_PropertyName___get_value__impl__p219lh(_this__u8e3s4.name));
}
function set(_this__u8e3s4, obj, value) {
  try {
    var reflect = reflect_0(obj);
    if (_this__u8e3s4.isReadWrite) {
      try {
        reflect.gq(_PropertyName___get_value__impl__p219lh(_this__u8e3s4.name), value);
      } catch ($p) {
        if ($p instanceof Error) {
          var t = $p;
          var existingValue = reflect.fq(_PropertyName___get_value__impl__p219lh(_this__u8e3s4.name));
          var tmp;
          if (!(existingValue == null) ? isInterface(existingValue, MutableCollection) : false) {
            tmp = !(value == null) ? isInterface(value, Collection) : false;
          } else {
            tmp = false;
          }
          if (tmp) {
            existingValue.n2();
            var tmp_0 = isInterface(existingValue, MutableCollection) ? existingValue : THROW_CCE();
            tmp_0.x(isInterface(value, Collection) ? value : THROW_CCE());
          } else {
            var tmp_1;
            if (!(existingValue == null) ? isInterface(existingValue, MutableCollection) : false) {
              tmp_1 = !(value == null) ? isInterface(value, Iterable) : false;
            } else {
              tmp_1 = false;
            }
            if (tmp_1) {
              existingValue.n2();
              var tmp_2 = isInterface(existingValue, MutableCollection) ? existingValue : THROW_CCE();
              addAll(tmp_2, isInterface(value, Iterable) ? value : THROW_CCE());
            } else {
              var tmp_3;
              if (!(existingValue == null) ? isInterface(existingValue, MutableCollection) : false) {
                tmp_3 = !(value == null) ? isArray(value) : false;
              } else {
                tmp_3 = false;
              }
              if (tmp_3) {
                existingValue.n2();
                var tmp_4 = isInterface(existingValue, MutableCollection) ? existingValue : THROW_CCE();
                addAll_0(tmp_4, isArray(value) ? value : THROW_CCE());
              } else {
                var tmp_5;
                if (!(existingValue == null) ? isInterface(existingValue, KtMutableMap) : false) {
                  tmp_5 = !(value == null) ? isInterface(value, KtMap) : false;
                } else {
                  tmp_5 = false;
                }
                if (tmp_5) {
                  existingValue.n2();
                  var tmp_6 = isInterface(existingValue, KtMutableMap) ? existingValue : THROW_CCE();
                  tmp_6.t2(isInterface(value, KtMap) ? value : THROW_CCE());
                } else {
                  // Inline function 'kotlin.error' call
                  var message = 'Cannot set property ' + SimpleName__toString_impl_vxsxyc(_this__u8e3s4.owner.name) + '.' + PropertyName__toString_impl_hcnfa7(_this__u8e3s4.name) + ' to ' + toString_0(value) + ' because it is not a mutable property and not a Mutable Collection/Map';
                  throw IllegalStateException.v4(toString(message));
                }
              }
            }
          }
        } else {
          throw $p;
        }
      }
    } else {
      // Inline function 'kotlin.error' call
      var message_0 = 'Cannot set property ' + SimpleName__toString_impl_vxsxyc(_this__u8e3s4.owner.name) + '.' + PropertyName__toString_impl_hcnfa7(_this__u8e3s4.name) + ' to ' + toString_0(value) + ' because it is not a mutable property or Mutable Collection/Map';
      throw IllegalStateException.v4(toString(message_0));
    }
  } catch ($p) {
    if ($p instanceof Error) {
      var t_0 = $p;
      printStackTrace(t_0);
      var tmp_7 = SimpleName__toString_impl_vxsxyc(_this__u8e3s4.owner.name);
      var tmp_8 = PropertyName__toString_impl_hcnfa7(_this__u8e3s4.name);
      var tmp_9 = toString_0(value);
      var tmp0_elvis_lhs = t_0.message;
      // Inline function 'kotlin.error' call
      var message_1 = 'Unable to set property ' + tmp_7 + '.' + tmp_8 + ' to ' + tmp_9 + ' due to ' + (tmp0_elvis_lhs == null ? 'Unknown' : tmp0_elvis_lhs);
      throw IllegalStateException.v4(toString(message_1));
    } else {
      throw $p;
    }
  }
}
function valueOf_1(_this__u8e3s4, name) {
  return reflect(get_clazz(_this__u8e3s4)).enumValueOf(name);
}
function typeOfInfixOperator($this, lhs, op, rhs) {
  var tmp;
  switch (op) {
    case '==':
      tmp = StdLibDefault_getInstance().Boolean;
      break;
    case '+':
      tmp = lhs;
      break;
    default:
      var message = "Unsupported Operator '" + op + "'";
      throw IllegalStateException.v4(toString(message));
  }
  return tmp;
}
var Companion_instance_14;
function Companion_getInstance_16() {
  return Companion_instance_14;
}
function evaluateRootExpression($this, evc, expression) {
  var tmp;
  if (expression.isNothing) {
    tmp = $this.objectGraph.nothing();
  } else if (expression.isSelf) {
    var tmp0_elvis_lhs = evc.self;
    var tmp_0;
    if (tmp0_elvis_lhs == null) {
      var message = "No '$self' value defined in Evaluation Context: " + evc.toString();
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_0 = tmp0_elvis_lhs;
    }
    tmp = tmp_0;
  } else if (startsWith(expression.name, '$')) {
    tmp = evaluateSpecial($this, evc, expression.name);
  } else {
    var tmp1_elvis_lhs = evc.getOrInParent(expression.name);
    var tmp_1;
    if (tmp1_elvis_lhs == null) {
      var tmp2_safe_receiver = evc.self;
      var tmp_2;
      if (tmp2_safe_receiver == null) {
        tmp_2 = null;
      } else {
        // Inline function 'kotlin.let' call
        tmp_2 = evaluatePropertyName($this, tmp2_safe_receiver, _PropertyName___init__impl__sz2wu9(expression.name));
      }
      tmp_1 = tmp_2;
    } else {
      tmp_1 = tmp1_elvis_lhs;
    }
    var tmp3_elvis_lhs = tmp_1;
    var tmp_3;
    if (tmp3_elvis_lhs == null) {
      var message_0 = "Evaluation Context does not contain '" + expression.name + "' and there is no 'self' object with that property name";
      throw IllegalStateException.v4(toString(message_0));
    } else {
      tmp_3 = tmp3_elvis_lhs;
    }
    tmp = tmp_3;
  }
  return tmp;
}
function evaluateSpecial($this, evc, name) {
  var tmp0_elvis_lhs = evc.getOrInParent(name);
  var tmp;
  if (tmp0_elvis_lhs == null) {
    var tmp1_safe_receiver = evc.self;
    var tmp_0;
    if (tmp1_safe_receiver == null) {
      tmp_0 = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp_0 = evaluatePropertyName($this, tmp1_safe_receiver, _PropertyName___init__impl__sz2wu9(name));
    }
    tmp = tmp_0;
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var tmp2_elvis_lhs = tmp;
  var tmp_1;
  if (tmp2_elvis_lhs == null) {
    var message = "Evaluation Context does not contain '" + name + "' and there is no 'self' object with that property name";
    throw IllegalStateException.v4(toString(message));
  } else {
    tmp_1 = tmp2_elvis_lhs;
  }
  return tmp_1;
}
function evaluateLiteralExpression($this, expression) {
  return $this.objectGraph.createPrimitiveValue(expression.qualifiedTypeName, expression.value);
}
function evaluateNavigation($this, evc, expression) {
  var st = expression.start;
  var start = $this.evaluateExpression(evc, st);
  // Inline function 'kotlin.collections.fold' call
  var accumulator = start;
  var _iterator__ex2g4s = expression.parts.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var acc = accumulator;
    var tmp;
    if (isInterface(element, PropertyCall)) {
      tmp = evaluatePropertyName($this, acc, _PropertyName___init__impl__sz2wu9(element.propertyName));
    } else {
      if (isInterface(element, MethodCall)) {
        tmp = evaluateMethodCall($this, evc, acc, _MethodName___init__impl__2ggy8b(element.methodName), element.arguments);
      } else {
        if (isInterface(element, IndexOperation)) {
          tmp = evaluateIndexOperation($this, evc, acc, element.indices);
        } else {
          var message = 'should not happen';
          throw IllegalStateException.v4(toString(message));
        }
      }
    }
    accumulator = tmp;
  }
  var result = accumulator;
  return result;
}
function evaluatePropertyName($this, obj, propertyName) {
  var type = obj.type;
  return $this.objectGraph.getProperty(obj, _PropertyName___get_value__impl__p219lh(propertyName));
}
function evaluateMethodCall($this, evc, obj, methodName, args) {
  var type = obj.type;
  var md = type.resolvedDeclaration.findAllMethodOrNull(methodName);
  var tmp;
  if (md == null) {
    $this.issues.error(null, "Method '" + MethodName__toString_impl_y7ited(methodName) + "' not found on type '" + SimpleName__toString_impl_vxsxyc(obj.type.typeName) + "'");
    tmp = $this.objectGraph.nothing();
  } else {
    // Inline function 'kotlin.collections.map' call
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(args, 10));
    var _iterator__ex2g4s = args.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = $this.evaluateExpression(evc, item);
      destination.r(tmp$ret$0);
    }
    var argValues = destination;
    tmp = $this.objectGraph.executeMethod(obj, _MethodName___get_value__impl__37ln07(methodName), argValues);
  }
  return tmp;
}
function evaluateIndexOperation($this, evc, obj, indices) {
  var tmp;
  if (obj.type.resolvedDeclaration.conformsTo(StdLibDefault_getInstance().List)) {
    var tmp_0;
    if (indices.v() === 1) {
      var idx = $this.evaluateExpression(evc, indices.z(0));
      var tmp_1;
      if (idx.type.conformsTo(StdLibDefault_getInstance().Integer)) {
        var tmp1_safe_receiver = getOrNull(obj.type.typeArguments, 0);
        var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.type;
        var listElementType = tmp2_elvis_lhs == null ? StdLibDefault_getInstance().AnyType : tmp2_elvis_lhs;
        var tmp_2 = $this.objectGraph.valueOf(idx);
        var i = tmp_2 instanceof Long ? tmp_2 : THROW_CCE();
        var elem = $this.objectGraph.getIndex(obj, i.u3());
        var tmp_3;
        if (equals($this.objectGraph.nothing(), elem)) {
          tmp_3 = $this.objectGraph.nothing();
        } else {
          var tmp3_safe_receiver = $this.typeModel.findByQualifiedNameOrNull(elem.type.qualifiedTypeName);
          var elemType = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.type();
          var tmp_4;
          if (null == elemType) {
            $this.issues.error(null, "Cannot find type '" + QualifiedName__toString_impl_z3wem2(elem.type.qualifiedTypeName) + "' of List element '" + toString(elem) + "'");
            tmp_4 = $this.objectGraph.cast(elem, listElementType);
          } else {
            var tmp_5 = elemType.resolvedDeclaration;
            if (isInterface(tmp_5, TupleType)) {
              tmp_4 = $this.objectGraph.cast(elem, elemType);
            } else {
              if (elemType.conformsTo(listElementType)) {
                tmp_4 = $this.objectGraph.cast(elem, elemType);
              } else {
                $this.issues.error(null, "List element '" + toString(elem) + "' of type '" + QualifiedName__toString_impl_z3wem2(elem.type.qualifiedTypeName) + "' does not conform to the expected List element type of '" + toString(listElementType) + "'");
                tmp_4 = $this.objectGraph.cast(elem, elemType);
              }
            }
          }
          tmp_3 = tmp_4;
        }
        tmp_1 = tmp_3;
      } else {
        $this.issues.error(null, 'Index value must evaluate to an Integer for Lists');
        tmp_1 = $this.objectGraph.nothing();
      }
      tmp_0 = tmp_1;
    } else {
      $this.issues.error(null, 'Only one index value should be used for Lists');
      tmp_0 = $this.objectGraph.nothing();
    }
    tmp = tmp_0;
  } else {
    $this.issues.error(null, 'Index operation on non List value is not possible: ' + obj.asString());
    tmp = $this.objectGraph.nothing();
  }
  return tmp;
}
function evaluateInfix($this, evc, expression) {
  var result = $this.evaluateExpression(evc, first(expression.expressions));
  var inductionVariable = 0;
  var last = expression.operators.v() - 1 | 0;
  if (inductionVariable <= last)
    do {
      var i = inductionVariable;
      inductionVariable = inductionVariable + 1 | 0;
      var op = expression.operators.z(i);
      var rhsExpr = expression.expressions.z(i + 1 | 0);
      var rhs = $this.evaluateExpression(evc, rhsExpr);
      result = evaluateInfixOperator($this, result, op, rhs);
    }
     while (inductionVariable <= last);
  return result;
}
function evaluateInfixOperator($this, lhs, op, rhs) {
  var tmp;
  switch (op) {
    case '==':
      var tmp_0;
      if (equals(lhs.type, rhs.type)) {
        var lhsv = $this.objectGraph.valueOf(lhs);
        var rhsv = $this.objectGraph.valueOf(rhs);
        var tmp_1;
        if (equals(lhsv, rhsv)) {
          tmp_1 = $this.objectGraph.createPrimitiveValue(StdLibDefault_getInstance().Boolean.qualifiedTypeName, true);
        } else {
          tmp_1 = $this.objectGraph.createPrimitiveValue(StdLibDefault_getInstance().Boolean.qualifiedTypeName, false);
        }
        tmp_0 = tmp_1;
      } else {
        var message = "'" + op + "' must have same type for lhs and rhs";
        throw IllegalStateException.v4(toString(message));
      }

      tmp = tmp_0;
      break;
    case '+':
      var tmp_2;
      if (lhs.type.conformsTo(StdLibDefault_getInstance().String) && rhs.type.conformsTo(StdLibDefault_getInstance().String)) {
        var tmp_3 = $this.objectGraph.valueOf(lhs);
        var lhsv_0 = typeof tmp_3 === 'string' ? tmp_3 : THROW_CCE();
        var tmp_4 = $this.objectGraph.valueOf(rhs);
        var rhsv_0 = typeof tmp_4 === 'string' ? tmp_4 : THROW_CCE();
        tmp_2 = $this.objectGraph.createPrimitiveValue(StdLibDefault_getInstance().String.qualifiedTypeName, lhsv_0 + rhsv_0);
      } else {
        var message_0 = "'" + op + "' not supported for '" + QualifiedName__toString_impl_z3wem2(lhs.type.qualifiedTypeName) + "' && '" + QualifiedName__toString_impl_z3wem2(rhs.type.qualifiedTypeName) + "'";
        throw IllegalStateException.v4(toString(message_0));
      }

      tmp = tmp_2;
      break;
    default:
      var message_1 = "Unsupported Operator '" + op + "'";
      throw IllegalStateException.v4(toString(message_1));
  }
  return tmp;
}
function evaluateWith($this, evc, expression) {
  var newSelf = $this.evaluateExpression(evc, expression.withContext);
  var tmp;
  if (equals($this.objectGraph.nothing(), newSelf)) {
    tmp = newSelf;
  } else {
    var newEvc = evc.child(mapOf(to(Companion_getInstance_15().SELF.o2j_1, newSelf)));
    var result = $this.evaluateExpression(newEvc, expression.expression);
    tmp = result;
  }
  return tmp;
}
function evaluateWhen($this, evc, expression) {
  var _iterator__ex2g4s = expression.options.s();
  while (_iterator__ex2g4s.t()) {
    var opt = _iterator__ex2g4s.u();
    var condValue = $this.evaluateExpression(evc, opt.condition);
    var tmp0_subject = condValue.type;
    if (equals(tmp0_subject, StdLibDefault_getInstance().Boolean)) {
      var tmp = $this.objectGraph.valueOf(condValue);
      if (typeof tmp === 'boolean' ? tmp : THROW_CCE()) {
        var result = $this.evaluateExpression(evc, opt.expression);
        return result;
      }
    } else {
      // Inline function 'kotlin.error' call
      var message = 'Conditions/Options in a when expression must result in a Boolean value';
      throw IllegalStateException.v4(toString(message));
    }
  }
  return $this.evaluateExpression(evc, expression.elseOption.expression);
}
function evaluateCreateTuple($this, evc, expression) {
  // Inline function 'kotlin.collections.mutableListOf' call
  var typeArgs = ArrayList.y();
  var tuple = $this.objectGraph.createTupleValue(typeArgs);
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = expression.propertyAssignments.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var value = $this.evaluateExpression(evc, element.rhs);
    $this.objectGraph.setProperty(tuple, element.lhsPropertyName, value);
    typeArgs.r(new TypeArgumentNamedSimple(_PropertyName___init__impl__sz2wu9(element.lhsPropertyName), value.type));
  }
  return tuple;
}
function evaluateCreateObject($this, evc, expression) {
  var tmp0_elvis_lhs = $this.typeModel.findFirstDefinitionByPossiblyQualifiedNameOrNull(expression.possiblyQualifiedTypeName);
  var tmp;
  if (tmp0_elvis_lhs == null) {
    var message = 'Type not found ' + toString(expression.possiblyQualifiedTypeName);
    throw IllegalStateException.v4(toString(message));
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var typeDecl = tmp;
  var tmp_0;
  var tmp_1;
  if (isInterface(typeDecl, DataType)) {
    tmp_1 = true;
  } else {
    tmp_1 = isInterface(typeDecl, ValueType);
  }
  if (tmp_1) {
    // Inline function 'kotlin.collections.map' call
    var this_0 = expression.constructorArguments;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = $this.evaluateExpression(evc, item.rhs);
      destination.r(tmp$ret$0);
    }
    var args = destination;
    var tmp_2;
    // Inline function 'kotlin.collections.isNotEmpty' call
    if (!args.a1()) {
      var tmp_3;
      if (isInterface(typeDecl, DataType)) {
        tmp_3 = typeDecl.constructors;
      } else {
        if (isInterface(typeDecl, ValueType)) {
          tmp_3 = typeDecl.constructors;
        } else {
          var message_0 = "Type '" + _QualifiedName___get_value__impl__nkc4gq(typeDecl.qualifiedName) + "' has no constructors";
          throw IllegalStateException.v4(toString(message_0));
        }
      }
      var constructors = tmp_3;
      var tmp$ret$7;
      $l$block_1: {
        // Inline function 'kotlin.collections.firstOrNull' call
        var _iterator__ex2g4s_0 = constructors.s();
        while (_iterator__ex2g4s_0.t()) {
          var element = _iterator__ex2g4s_0.u();
          var tmp_4;
          if (element.parameters.v() === args.v()) {
            var tmp0 = zip(element.parameters, args);
            var tmp$ret$4;
            $l$block_0: {
              // Inline function 'kotlin.collections.all' call
              var tmp_5;
              if (isInterface(tmp0, Collection)) {
                tmp_5 = tmp0.a1();
              } else {
                tmp_5 = false;
              }
              if (tmp_5) {
                tmp$ret$4 = true;
                break $l$block_0;
              }
              var _iterator__ex2g4s_1 = tmp0.s();
              while (_iterator__ex2g4s_1.t()) {
                var element_0 = _iterator__ex2g4s_1.u();
                var p = element_0.bh();
                var a = element_0.ch();
                if (!a.type.conformsTo(p.typeInstance)) {
                  tmp$ret$4 = false;
                  break $l$block_0;
                }
              }
              tmp$ret$4 = true;
            }
            tmp_4 = tmp$ret$4;
          } else {
            tmp_4 = false;
          }
          if (tmp_4) {
            tmp$ret$7 = element;
            break $l$block_1;
          }
        }
        tmp$ret$7 = null;
      }
      var tmp3_elvis_lhs = tmp$ret$7;
      var tmp_6;
      if (tmp3_elvis_lhs == null) {
        var tmp_7 = _QualifiedName___get_value__impl__nkc4gq(typeDecl.qualifiedName);
        var message_1 = "Constructor not found for '" + tmp_7 + "' with arguments " + joinToString(args, VOID, VOID, VOID, VOID, VOID, ExpressionsInterpreterOverTypedObject$evaluateCreateObject$lambda);
        throw IllegalStateException.v4(toString(message_1));
      } else {
        tmp_6 = tmp3_elvis_lhs;
      }
      var constructor = tmp_6;
      // Inline function 'kotlin.collections.mapIndexed' call
      var this_1 = constructor.parameters;
      // Inline function 'kotlin.collections.mapIndexedTo' call
      var destination_0 = ArrayList.w(collectionSizeOrDefault(this_1, 10));
      var index = 0;
      var _iterator__ex2g4s_2 = this_1.s();
      while (_iterator__ex2g4s_2.t()) {
        var item_0 = _iterator__ex2g4s_2.u();
        var _unary__edvuaz = index;
        index = _unary__edvuaz + 1 | 0;
        var idx = checkIndexOverflow(_unary__edvuaz);
        var tmp$ret$8 = new Pair(_ParameterName___get_value__impl__c8iwft(item_0.name), args.z(idx));
        destination_0.r(tmp$ret$8);
      }
      // Inline function 'kotlin.collections.associate' call
      var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(destination_0, 10)), 16);
      // Inline function 'kotlin.collections.associateTo' call
      var destination_1 = LinkedHashMap.kb(capacity);
      var _iterator__ex2g4s_3 = destination_0.s();
      while (_iterator__ex2g4s_3.t()) {
        var element_1 = _iterator__ex2g4s_3.u();
        // Inline function 'kotlin.collections.plusAssign' call
        destination_1.r2(element_1.zg_1, element_1.ah_1);
      }
      tmp_2 = destination_1;
    } else {
      tmp_2 = emptyMap();
    }
    var constructorArgs = tmp_2;
    var obj = $this.objectGraph.createStructureValue(expression.possiblyQualifiedTypeName, constructorArgs);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_4 = expression.propertyAssignments.s();
    while (_iterator__ex2g4s_4.t()) {
      var element_2 = _iterator__ex2g4s_4.u();
      var value = $this.evaluateExpression(evc, element_2.rhs);
      $this.objectGraph.setProperty(obj, element_2.lhsPropertyName, value);
    }
    return obj;
  } else {
    var message_2 = "Cannot create an object of type '" + _QualifiedName___get_value__impl__nkc4gq(typeDecl.qualifiedName) + "'";
    throw IllegalStateException.v4(toString(message_2));
  }
}
function evaluateLambda($this, evc, expression) {
  var lambda = $this.objectGraph.createLambdaValue(ExpressionsInterpreterOverTypedObject$evaluateLambda$lambda(evc, $this, expression));
  return lambda;
}
function evaluateCast($this, evc, expression) {
  var exprResult = $this.evaluateExpression(evc, expression.expression);
  var tgtType = $this.evaluateTypeReference(expression.targetType);
  return $this.objectGraph.cast(exprResult, tgtType);
}
function evaluateTypeTest($this, evc, expression) {
  var exprResult = $this.evaluateExpression(evc, expression.expression);
  var tgtType = $this.evaluateTypeReference(expression.targetType);
  var res = exprResult.type.conformsTo(tgtType);
  return $this.objectGraph.toTypedObject(!(res == null) ? res : THROW_CCE());
}
function evaluateGroup($this, evc, expression) {
  return $this.evaluateExpression(evc, expression.expression);
}
function ExpressionsInterpreterOverTypedObject$evaluateCreateObject$lambda(it) {
  return _QualifiedName___get_value__impl__nkc4gq(it.type.qualifiedTypeName);
}
function ExpressionsInterpreterOverTypedObject$evaluateLambda$lambda($evc, this$0, $expression) {
  return (it) => {
    var newEvc = $evc.child(mapOf(to('it', it)));
    return this$0.evaluateExpression(newEvc, $expression.expression);
  };
}
function expression($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
}
function rootExpression($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var v = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
  var tmp_0;
  if (startsWith(v, '$')) {
    tmp_0 = v === Companion_getInstance_15().NOTHING.o2j_1 ? Companion_getInstance_15().NOTHING : v === Companion_getInstance_15().SELF.o2j_1 ? Companion_getInstance_15().SELF : new RootExpressionDefault(v);
  } else {
    tmp_0 = new RootExpressionDefault(v);
  }
  return tmp_0;
}
function literalExpression($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? isInterface(tmp, LiteralExpression) : false) ? tmp : THROW_CCE();
}
function literal($this, nodeInfo, children, sentence) {
  var tmp;
  switch (_OptionNum___get_asIndex__impl__fdwc2b(nodeInfo.alt.option)) {
    case 0:
      var tmp_0 = StdLibDefault_getInstance().Boolean.qualifiedTypeName;
      var tmp_1 = children.z(0);
      tmp = new LiteralExpressionDefault(tmp_0, toBoolean((!(tmp_1 == null) ? typeof tmp_1 === 'string' : false) ? tmp_1 : THROW_CCE()));
      break;
    case 1:
      var tmp_2 = StdLibDefault_getInstance().Integer.qualifiedTypeName;
      var tmp_3 = children.z(0);
      tmp = new LiteralExpressionDefault(tmp_2, toLong_0((!(tmp_3 == null) ? typeof tmp_3 === 'string' : false) ? tmp_3 : THROW_CCE()));
      break;
    case 2:
      var tmp_4 = StdLibDefault_getInstance().Real.qualifiedTypeName;
      var tmp_5 = children.z(0);
      tmp = new LiteralExpressionDefault(tmp_4, toDouble((!(tmp_5 == null) ? typeof tmp_5 === 'string' : false) ? tmp_5 : THROW_CCE()));
      break;
    case 3:
      var tmp_6 = StdLibDefault_getInstance().String.qualifiedTypeName;
      var tmp_7 = children.z(0);
      tmp = new LiteralExpressionDefault(tmp_6, trim((!(tmp_7 == null) ? typeof tmp_7 === 'string' : false) ? tmp_7 : THROW_CCE(), charArrayOf([_Char___init__impl__6a9atx(39)])));
      break;
    default:
      var message = 'Internal error: alternative ' + OptionNum__toString_impl_vefk5s(nodeInfo.alt.option) + " not handled for 'literal'";
      throw IllegalStateException.v4(toString(message));
  }
  return tmp;
}
function navigationExpression($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var navigationRoot = (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var parts = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  return new NavigationExpressionDefault(navigationRoot, parts);
}
function navigationRoot($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
}
function navigationPartList($this, nodeInfo, children, sentence) {
  return isInterface(children, KtList) ? children : THROW_CCE();
}
function navigationPart($this, nodeInfo, children, sentence) {
  return children.z(0);
}
function infixExpression($this, nodeInfo, children, sentence) {
  // Inline function 'kotlin.collections.filterIsInstance' call
  // Inline function 'kotlin.collections.filterIsInstanceTo' call
  var destination = ArrayList.y();
  var _iterator__ex2g4s = children.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    if (!(element == null) ? isInterface(element, Expression) : false) {
      destination.r(element);
    }
  }
  var expressions = destination;
  // Inline function 'kotlin.collections.filterIsInstance' call
  // Inline function 'kotlin.collections.filterIsInstanceTo' call
  var destination_0 = ArrayList.y();
  var _iterator__ex2g4s_0 = children.s();
  while (_iterator__ex2g4s_0.t()) {
    var element_0 = _iterator__ex2g4s_0.u();
    if (!(element_0 == null) ? typeof element_0 === 'string' : false) {
      destination_0.r(element_0);
    }
  }
  var operators = destination_0;
  return new InfixExpressionDefault(expressions, operators);
}
function object_($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var pqn = (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var args = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(2);
  var propertyAssignments = (tmp_1 == null ? true : isInterface(tmp_1, KtList)) ? tmp_1 : THROW_CCE();
  var exp = new CreateObjectExpressionDefault(pqn, args);
  var tmp_2 = exp;
  tmp_2.v2g_1 = propertyAssignments == null ? emptyList() : propertyAssignments;
  return exp;
}
function constructorArguments($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  return (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
}
function tuple($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var propertyAssignments = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  return new CreateTupleExpressionDefault(propertyAssignments);
}
function assignmentBlock($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  return (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
}
function assignmentList($this, nodeInfo, children, sentence) {
  return isInterface(children, KtList) ? children : THROW_CCE();
}
function assignment($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var lhsPropertyName = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var lhsGrammarRuleIndex = (tmp_0 == null ? true : typeof tmp_0 === 'number') ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(3);
  var rhs = (!(tmp_1 == null) ? isInterface(tmp_1, Expression) : false) ? tmp_1 : THROW_CCE();
  return new AssignmentStatementDefault(lhsPropertyName, lhsGrammarRuleIndex, rhs);
}
function propertyName($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
}
function grammarRuleIndex($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  return toInt((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
}
function with_0($this, nodeInfo, children, sentence) {
  var tmp = children.z(2);
  var withContext = (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(4);
  var expression = (!(tmp_0 == null) ? isInterface(tmp_0, Expression) : false) ? tmp_0 : THROW_CCE();
  return new WithExpressionDefault(withContext, expression);
}
function when_($this, nodeInfo, children, sentence) {
  var tmp = children.z(2);
  var optionList = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(3);
  var whenOptionElse = (!(tmp_0 == null) ? isInterface(tmp_0, WhenOptionElse) : false) ? tmp_0 : THROW_CCE();
  return new WhenExpressionDefault(optionList, whenOptionElse);
}
function whenOption($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var condition = (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(2);
  var expression = (!(tmp_0 == null) ? isInterface(tmp_0, Expression) : false) ? tmp_0 : THROW_CCE();
  return new WhenOptionDefault(condition, expression);
}
function whenOptionElse($this, nodeInfo, children, sentence) {
  var tmp = children.z(2);
  var expression = (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
  return new WhenOptionElseDefault(expression);
}
function cast($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var expression = (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(2);
  var pqn = (!(tmp_0 == null) ? isInterface(tmp_0, TypeReference) : false) ? tmp_0 : THROW_CCE();
  return new CastExpressionDefault(expression, pqn);
}
function typeTest($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var expression = (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(2);
  var pqn = (!(tmp_0 == null) ? isInterface(tmp_0, TypeReference) : false) ? tmp_0 : THROW_CCE();
  return new TypeTestExpressionDefault(expression, pqn);
}
function group($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var expression = (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
  return new GroupExpressionDefault(expression);
}
function propertyCall($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var id = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
  return new PropertyCallDefault(id);
}
function methodCall($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var methodReference = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(3);
  var argumentList = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(5);
  var lambda = (tmp_1 == null ? true : isInterface(tmp_1, LambdaExpression)) ? tmp_1 : THROW_CCE();
  var tmp_2;
  if (lambda == null) {
    tmp_2 = null;
  } else {
    // Inline function 'kotlin.let' call
    tmp_2 = listOf(lambda);
  }
  var tmp1_elvis_lhs = tmp_2;
  var args = plus(argumentList, tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs);
  return new MethodCallDefault(methodReference, args);
}
function argumentList($this, nodeInfo, children, sentence) {
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var this_0 = isInterface(children, KtList) ? children : THROW_CCE();
  return ListSeparatedArrayList.gk(this_0).ck();
}
function lambda($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var expression = (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
  return new LambdaExpressionDefault(expression);
}
function indexOperation($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var expr = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  return new IndexOperationDefault(expr);
}
function indexList($this, nodeInfo, children, sentence) {
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  return ListSeparatedArrayList.gk(children).ck();
}
function propertyReference($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
}
function methodReference($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
}
function typeReference($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var pqn = (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var tmp0_elvis_lhs = (tmp_0 == null ? true : isInterface(tmp_0, KtList)) ? tmp_0 : THROW_CCE();
  var targs = tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs;
  var isNullable = !(children.z(2) == null);
  return new TypeReferenceDefault(pqn, targs, isNullable);
}
function typeArgumentList($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var list = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var slist = ListSeparatedArrayList.gk(list);
  return slist.ck();
}
function ExpressionsSyntaxAnalyser$expression$ref($boundThis) {
  var l = (p0, p1, p2) => expression($boundThis, p0, p1, p2);
  l.callableName = 'expression';
  return l;
}
function ExpressionsSyntaxAnalyser$rootExpression$ref($boundThis) {
  var l = (p0, p1, p2) => rootExpression($boundThis, p0, p1, p2);
  l.callableName = 'rootExpression';
  return l;
}
function ExpressionsSyntaxAnalyser$literalExpression$ref($boundThis) {
  var l = (p0, p1, p2) => literalExpression($boundThis, p0, p1, p2);
  l.callableName = 'literalExpression';
  return l;
}
function ExpressionsSyntaxAnalyser$navigationExpression$ref($boundThis) {
  var l = (p0, p1, p2) => navigationExpression($boundThis, p0, p1, p2);
  l.callableName = 'navigationExpression';
  return l;
}
function ExpressionsSyntaxAnalyser$navigationRoot$ref($boundThis) {
  var l = (p0, p1, p2) => navigationRoot($boundThis, p0, p1, p2);
  l.callableName = 'navigationRoot';
  return l;
}
function ExpressionsSyntaxAnalyser$navigationPartList$ref($boundThis) {
  var l = (p0, p1, p2) => navigationPartList($boundThis, p0, p1, p2);
  l.callableName = 'navigationPartList';
  return l;
}
function ExpressionsSyntaxAnalyser$navigationPart$ref($boundThis) {
  var l = (p0, p1, p2) => navigationPart($boundThis, p0, p1, p2);
  l.callableName = 'navigationPart';
  return l;
}
function ExpressionsSyntaxAnalyser$infixExpression$ref($boundThis) {
  var l = (p0, p1, p2) => infixExpression($boundThis, p0, p1, p2);
  l.callableName = 'infixExpression';
  return l;
}
function ExpressionsSyntaxAnalyser$object_$ref($boundThis) {
  var l = (p0, p1, p2) => object_($boundThis, p0, p1, p2);
  l.callableName = 'object_';
  return l;
}
function ExpressionsSyntaxAnalyser$constructorArguments$ref($boundThis) {
  var l = (p0, p1, p2) => constructorArguments($boundThis, p0, p1, p2);
  l.callableName = 'constructorArguments';
  return l;
}
function ExpressionsSyntaxAnalyser$tuple$ref($boundThis) {
  var l = (p0, p1, p2) => tuple($boundThis, p0, p1, p2);
  l.callableName = 'tuple';
  return l;
}
function ExpressionsSyntaxAnalyser$assignmentBlock$ref($boundThis) {
  var l = (p0, p1, p2) => assignmentBlock($boundThis, p0, p1, p2);
  l.callableName = 'assignmentBlock';
  return l;
}
function ExpressionsSyntaxAnalyser$assignmentList$ref($boundThis) {
  var l = (p0, p1, p2) => assignmentList($boundThis, p0, p1, p2);
  l.callableName = 'assignmentList';
  return l;
}
function ExpressionsSyntaxAnalyser$assignment$ref($boundThis) {
  var l = (p0, p1, p2) => assignment($boundThis, p0, p1, p2);
  l.callableName = 'assignment';
  return l;
}
function ExpressionsSyntaxAnalyser$propertyName$ref($boundThis) {
  var l = (p0, p1, p2) => propertyName($boundThis, p0, p1, p2);
  l.callableName = 'propertyName';
  return l;
}
function ExpressionsSyntaxAnalyser$grammarRuleIndex$ref($boundThis) {
  var l = (p0, p1, p2) => grammarRuleIndex($boundThis, p0, p1, p2);
  l.callableName = 'grammarRuleIndex';
  return l;
}
function ExpressionsSyntaxAnalyser$with$ref($boundThis) {
  var l = (p0, p1, p2) => with_0($boundThis, p0, p1, p2);
  l.callableName = 'with';
  return l;
}
function ExpressionsSyntaxAnalyser$when_$ref($boundThis) {
  var l = (p0, p1, p2) => when_($boundThis, p0, p1, p2);
  l.callableName = 'when_';
  return l;
}
function ExpressionsSyntaxAnalyser$whenOption$ref($boundThis) {
  var l = (p0, p1, p2) => whenOption($boundThis, p0, p1, p2);
  l.callableName = 'whenOption';
  return l;
}
function ExpressionsSyntaxAnalyser$whenOptionElse$ref($boundThis) {
  var l = (p0, p1, p2) => whenOptionElse($boundThis, p0, p1, p2);
  l.callableName = 'whenOptionElse';
  return l;
}
function ExpressionsSyntaxAnalyser$cast$ref($boundThis) {
  var l = (p0, p1, p2) => cast($boundThis, p0, p1, p2);
  l.callableName = 'cast';
  return l;
}
function ExpressionsSyntaxAnalyser$typeTest$ref($boundThis) {
  var l = (p0, p1, p2) => typeTest($boundThis, p0, p1, p2);
  l.callableName = 'typeTest';
  return l;
}
function ExpressionsSyntaxAnalyser$group$ref($boundThis) {
  var l = (p0, p1, p2) => group($boundThis, p0, p1, p2);
  l.callableName = 'group';
  return l;
}
function ExpressionsSyntaxAnalyser$propertyCall$ref($boundThis) {
  var l = (p0, p1, p2) => propertyCall($boundThis, p0, p1, p2);
  l.callableName = 'propertyCall';
  return l;
}
function ExpressionsSyntaxAnalyser$methodCall$ref($boundThis) {
  var l = (p0, p1, p2) => methodCall($boundThis, p0, p1, p2);
  l.callableName = 'methodCall';
  return l;
}
function ExpressionsSyntaxAnalyser$argumentList$ref($boundThis) {
  var l = (p0, p1, p2) => argumentList($boundThis, p0, p1, p2);
  l.callableName = 'argumentList';
  return l;
}
function ExpressionsSyntaxAnalyser$lambda$ref($boundThis) {
  var l = (p0, p1, p2) => lambda($boundThis, p0, p1, p2);
  l.callableName = 'lambda';
  return l;
}
function ExpressionsSyntaxAnalyser$propertyReference$ref($boundThis) {
  var l = (p0, p1, p2) => propertyReference($boundThis, p0, p1, p2);
  l.callableName = 'propertyReference';
  return l;
}
function ExpressionsSyntaxAnalyser$methodReference$ref($boundThis) {
  var l = (p0, p1, p2) => methodReference($boundThis, p0, p1, p2);
  l.callableName = 'methodReference';
  return l;
}
function ExpressionsSyntaxAnalyser$indexOperation$ref($boundThis) {
  var l = (p0, p1, p2) => indexOperation($boundThis, p0, p1, p2);
  l.callableName = 'indexOperation';
  return l;
}
function ExpressionsSyntaxAnalyser$indexList$ref($boundThis) {
  var l = (p0, p1, p2) => indexList($boundThis, p0, p1, p2);
  l.callableName = 'indexList';
  return l;
}
function ExpressionsSyntaxAnalyser$typeReference$ref($boundThis) {
  var l = (p0, p1, p2) => typeReference($boundThis, p0, p1, p2);
  l.callableName = 'typeReference';
  return l;
}
function ExpressionsSyntaxAnalyser$typeArgumentList$ref($boundThis) {
  var l = (p0, p1, p2) => typeArgumentList($boundThis, p0, p1, p2);
  l.callableName = 'typeArgumentList';
  return l;
}
function ExpressionsSyntaxAnalyser$literal$ref($boundThis) {
  var l = (p0, p1, p2) => literal($boundThis, p0, p1, p2);
  l.callableName = 'literal';
  return l;
}
function StdLibPrimitiveExecutions$property$lambda(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, AsmList)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  return Companion_instance_9.stdInteger(toLong(self_0.elements.v()));
}
function StdLibPrimitiveExecutions$property$lambda_0(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, AsmList)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  return first(self_0.elements);
}
function StdLibPrimitiveExecutions$property$lambda_1(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, AsmList)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  return last(self_0.elements);
}
function StdLibPrimitiveExecutions$property$lambda_2(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, AsmList)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  return new AsmListSimple(drop(self_0.elements, 1));
}
function StdLibPrimitiveExecutions$property$lambda_3(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, AsmList)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  return new AsmListSimple(dropLast(self_0.elements, 1));
}
function StdLibPrimitiveExecutions$property$lambda_4(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, AsmList)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  var tmp = Companion_instance_9;
  var tmp_0 = self_0.elements;
  return tmp.stdString(joinToString(tmp_0, '', VOID, VOID, VOID, VOID, StdLibPrimitiveExecutions$property$lambda$lambda));
}
function StdLibPrimitiveExecutions$property$lambda$lambda(it) {
  return it.asString();
}
function StdLibPrimitiveExecutions$property$lambda_5(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, AsmList)) {
    var message = "Method '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  // Inline function 'kotlin.collections.associate' call
  var this_0 = self_0.elements;
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_0, 10)), 16);
  // Inline function 'kotlin.collections.associateTo' call
  var destination = LinkedHashMap.kb(capacity);
  var _iterator__ex2g4s = this_0.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var tmp = get_raw(element);
    // Inline function 'kotlin.check' call
    if (!(tmp instanceof Pair)) {
      var message_0 = Unit_instance;
      throw IllegalStateException.v4(toString(message_0));
    }
    var tmp_0 = get_raw(element);
    // Inline function 'kotlin.collections.plusAssign' call
    var pair = tmp_0 instanceof Pair ? tmp_0 : THROW_CCE();
    destination.r2(pair.zg_1, pair.ah_1);
  }
  var map = destination;
  // Inline function 'kotlin.TODO' call
  var reason = 'No AsmMap object ? maybe use tuple !';
  throw NotImplementedError.uj('An operation is not implemented: ' + reason);
}
function StdLibPrimitiveExecutions$property$lambda_6(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, AsmListSeparated)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  return new AsmListSimple(self_0.elements.ck());
}
function StdLibPrimitiveExecutions$property$lambda_7(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, AsmListSeparated)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  return new AsmListSimple(self_0.elements.dk());
}
function StdLibPrimitiveExecutions$method$lambda(self_0, meth, args) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, AsmList)) {
    var message = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  // Inline function 'kotlin.check' call
  if (!(1 === args.v())) {
    var message_0 = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' has wrong number of argument, expecting 1, received " + args.v();
    throw IllegalStateException.v4(toString(message_0));
  }
  var tmp = args.z(0).self;
  // Inline function 'kotlin.check' call
  if (!isInterface(tmp, AsmPrimitive)) {
    var message_1 = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' takes an " + QualifiedName__toString_impl_z3wem2(StdLibDefault_getInstance().Integer.qualifiedTypeName) + ' as its argument, received ' + QualifiedName__toString_impl_z3wem2(args.z(0).type.qualifiedTypeName);
    throw IllegalStateException.v4(toString(message_1));
  }
  // Inline function 'kotlin.check' call
  if (!(StdLibDefault_getInstance().Integer.qualifiedTypeName === args.z(0).type.qualifiedTypeName)) {
    var message_2 = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' takes an " + QualifiedName__toString_impl_z3wem2(StdLibDefault_getInstance().Integer.qualifiedTypeName) + ' as its argument, received ' + QualifiedName__toString_impl_z3wem2(args.z(0).type.qualifiedTypeName);
    throw IllegalStateException.v4(toString(message_2));
  }
  var tmp_0 = args.z(0).self;
  var arg1 = isInterface(tmp_0, AsmPrimitive) ? tmp_0 : THROW_CCE();
  var tmp_1 = arg1.value;
  var idx = tmp_1 instanceof Long ? tmp_1 : THROW_CCE();
  return self_0.elements.z(idx.u3());
}
function StdLibPrimitiveExecutions$method$lambda_0(self_0, meth, args) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, AsmList)) {
    var message = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  // Inline function 'kotlin.check' call
  if (!(1 === args.v())) {
    var message_0 = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' takes 1 lambda argument got " + args.v() + ' arguments.';
    throw IllegalStateException.v4(toString(message_0));
  }
  var tmp = args.z(0).self;
  // Inline function 'kotlin.check' call
  if (!isInterface(tmp, AsmLambda)) {
    var message_1 = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' first argument must be a lambda, got '" + getKClassFromExpression(args.z(0).self).zc() + "'.";
    throw IllegalStateException.v4(toString(message_1));
  }
  var tmp_0 = args.z(0).self;
  var lambda = isInterface(tmp_0, AsmLambda) ? tmp_0 : THROW_CCE();
  // Inline function 'kotlin.collections.map' call
  var this_0 = self_0.elements;
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
  var _iterator__ex2g4s = this_0.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var args_0 = mapOf(to('it', item));
    var tmp$ret$6 = lambda.invoke(args_0);
    destination.r(tmp$ret$6);
  }
  var mapped = destination;
  return new AsmListSimple(mapped);
}
var StdLibPrimitiveExecutions_instance;
function StdLibPrimitiveExecutions_getInstance() {
  if (StdLibPrimitiveExecutions_instance === VOID)
    new StdLibPrimitiveExecutions_0();
  return StdLibPrimitiveExecutions_instance;
}
function ObjectGraphAsmSimple$createLambdaValue$lambda($lambda, this$0) {
  return (it) => $lambda(this$0.w2k(it)).self;
}
function StdLibPrimitiveExecutionsForReflection$property$lambda(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, KtList)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  return Companion_instance_9.stdInteger(toLong(self_0.v()));
}
function StdLibPrimitiveExecutionsForReflection$property$lambda_0(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, KtList)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  var tmp = first(self_0);
  return !(tmp == null) ? tmp : THROW_CCE();
}
function StdLibPrimitiveExecutionsForReflection$property$lambda_1(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, KtList)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  var tmp = last(self_0);
  return !(tmp == null) ? tmp : THROW_CCE();
}
function StdLibPrimitiveExecutionsForReflection$property$lambda_2(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, KtList)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  return drop(self_0, 1);
}
function StdLibPrimitiveExecutionsForReflection$property$lambda_3(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, KtList)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  return dropLast(self_0, 1);
}
function StdLibPrimitiveExecutionsForReflection$property$lambda_4(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, KtList)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  return joinToString(self_0, '', VOID, VOID, VOID, VOID, StdLibPrimitiveExecutionsForReflection$property$lambda$lambda);
}
function StdLibPrimitiveExecutionsForReflection$property$lambda$lambda(it) {
  var tmp;
  if (!(it == null) ? isInterface(it, TypedObject) : false) {
    tmp = toString(it.self);
  } else {
    tmp = toString_0(it);
  }
  return tmp;
}
function StdLibPrimitiveExecutionsForReflection$property$lambda_5(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, KtList)) {
    var message = "Method '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  // Inline function 'kotlin.collections.associate' call
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(self_0, 10)), 16);
  // Inline function 'kotlin.collections.associateTo' call
  var destination = LinkedHashMap.kb(capacity);
  var _iterator__ex2g4s = self_0.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var tmp;
    if (!(element == null) ? isInterface(element, TypedObject) : false) {
      tmp = element.self;
    } else {
      tmp = element;
    }
    var el = tmp;
    var tmp_0;
    if (el instanceof Pair) {
      tmp_0 = el;
    } else {
      if (!(el == null) ? isInterface(el, KtMap) : false) {
        var tmp_1;
        var tmp_2;
        // Inline function 'kotlin.collections.containsKey' call
        if ((isInterface(el, KtMap) ? el : THROW_CCE()).x2('key')) {
          // Inline function 'kotlin.collections.containsKey' call
          tmp_2 = (isInterface(el, KtMap) ? el : THROW_CCE()).x2('value');
        } else {
          tmp_2 = false;
        }
        if (tmp_2) {
          // Inline function 'kotlin.collections.get' call
          var tmp_3 = (isInterface(el, KtMap) ? el : THROW_CCE()).z2('key');
          // Inline function 'kotlin.collections.get' call
          var tmp$ret$5 = (isInterface(el, KtMap) ? el : THROW_CCE()).z2('value');
          tmp_1 = new Pair(tmp_3, tmp$ret$5);
        } else {
          var message_0 = "To convert a List<Map> via 'asMap' there must be a 'key' and a 'value' entry";
          throw IllegalStateException.v4(toString(message_0));
        }
        tmp_0 = tmp_1;
      } else {
        var message_1 = "To convert a List via 'asMap' the elements must be either Pairs or Maps with key and value entries";
        throw IllegalStateException.v4(toString(message_1));
      }
    }
    // Inline function 'kotlin.collections.plusAssign' call
    var pair = tmp_0;
    destination.r2(pair.zg_1, pair.ah_1);
  }
  return destination;
}
function StdLibPrimitiveExecutionsForReflection$property$lambda_6(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, ListSeparated)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  return self_0.ck();
}
function StdLibPrimitiveExecutionsForReflection$property$lambda_7(self_0, prop) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, ListSeparated)) {
    var message = "Property '" + PropertyName__toString_impl_hcnfa7(prop.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  return self_0.dk();
}
function StdLibPrimitiveExecutionsForReflection$method$lambda(self_0, meth, args) {
  // Inline function 'kotlin.check' call
  if (!(typeof self_0 === 'string')) {
    var message = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  var tmp0_elvis_lhs = toBooleanStrictOrNull(self_0);
  return tmp0_elvis_lhs == null ? Unit_instance : tmp0_elvis_lhs;
}
function StdLibPrimitiveExecutionsForReflection$method$lambda_0(self_0, meth, args) {
  // Inline function 'kotlin.check' call
  if (!(typeof self_0 === 'string')) {
    var message = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  var tmp0_elvis_lhs = toLongOrNull(self_0);
  return tmp0_elvis_lhs == null ? Unit_instance : tmp0_elvis_lhs;
}
function StdLibPrimitiveExecutionsForReflection$method$lambda_1(self_0, meth, args) {
  // Inline function 'kotlin.check' call
  if (!(typeof self_0 === 'string')) {
    var message = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  var tmp0_elvis_lhs = toDoubleOrNull(self_0);
  return tmp0_elvis_lhs == null ? Unit_instance : tmp0_elvis_lhs;
}
function StdLibPrimitiveExecutionsForReflection$method$lambda_2(self_0, meth, args) {
  // Inline function 'kotlin.check' call
  if (!(typeof self_0 === 'string')) {
    var message = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  var tmp = args.z(0).self;
  var arg1 = typeof tmp === 'string' ? tmp : THROW_CCE();
  return removeSurrounding(self_0, arg1);
}
function StdLibPrimitiveExecutionsForReflection$method$lambda_3(self_0, meth, args) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, KtList)) {
    var message = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  // Inline function 'kotlin.check' call
  if (!(1 === args.v())) {
    var message_0 = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' takes 1 lambda argument got " + args.v() + ' arguments.';
    throw IllegalStateException.v4(toString(message_0));
  }
  var tmp = args.z(0).self;
  // Inline function 'kotlin.check' call
  if (!(typeof tmp === 'function')) {
    var message_1 = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' first argument must be a lambda, got '" + getKClassFromExpression(args.z(0).self).zc() + "'.";
    throw IllegalStateException.v4(toString(message_1));
  }
  var tmp_0 = args.z(0).self;
  var lambda = typeof tmp_0 === 'function' ? tmp_0 : THROW_CCE();
  // Inline function 'kotlin.collections.map' call
  var this_0 = isInterface(self_0, KtList) ? self_0 : THROW_CCE();
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
  var _iterator__ex2g4s = this_0.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var tmp$ret$6 = lambda(item);
    destination.r(tmp$ret$6);
  }
  return destination;
}
function StdLibPrimitiveExecutionsForReflection$method$lambda_4(self_0, meth, args) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, KtList)) {
    var message = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  // Inline function 'kotlin.check' call
  if (!(1 === args.v())) {
    var message_0 = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' takes 1 lambda argument got " + args.v() + ' arguments.';
    throw IllegalStateException.v4(toString(message_0));
  }
  var tmp = args.z(0).self;
  // Inline function 'kotlin.check' call
  if (!(typeof tmp === 'function')) {
    var message_1 = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' first argument must be a lambda, got '" + getKClassFromExpression(args.z(0).self).zc() + "'.";
    throw IllegalStateException.v4(toString(message_1));
  }
  var tmp_0 = args.z(0).self;
  var lambda = typeof tmp_0 === 'function' ? tmp_0 : THROW_CCE();
  // Inline function 'kotlin.collections.map' call
  var this_0 = isInterface(self_0, KtList) ? self_0 : THROW_CCE();
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
  var _iterator__ex2g4s = this_0.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var tmp$ret$6 = lambda(item);
    destination.r(tmp$ret$6);
  }
  return destination;
}
function StdLibPrimitiveExecutionsForReflection$method$lambda_5(self_0, meth, args) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, KtList)) {
    var message = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  // Inline function 'kotlin.check' call
  if (!(1 === args.v())) {
    var message_0 = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' has wrong number of argument, expecting 1, received " + args.v();
    throw IllegalStateException.v4(toString(message_0));
  }
  var tmp = args.z(0).self;
  // Inline function 'kotlin.check' call
  if (!(tmp instanceof Long)) {
    var message_1 = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' takes an " + QualifiedName__toString_impl_z3wem2(StdLibDefault_getInstance().Integer.qualifiedTypeName) + ' as its argument, received ' + QualifiedName__toString_impl_z3wem2(args.z(0).type.qualifiedTypeName);
    throw IllegalStateException.v4(toString(message_1));
  }
  // Inline function 'kotlin.check' call
  if (!(StdLibDefault_getInstance().Integer.qualifiedTypeName === args.z(0).type.qualifiedTypeName)) {
    var message_2 = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' takes an " + QualifiedName__toString_impl_z3wem2(StdLibDefault_getInstance().Integer.qualifiedTypeName) + ' as its argument, received ' + QualifiedName__toString_impl_z3wem2(args.z(0).type.qualifiedTypeName);
    throw IllegalStateException.v4(toString(message_2));
  }
  var tmp_0 = args.z(0).self;
  var idx = tmp_0 instanceof Long ? tmp_0 : THROW_CCE();
  var tmp_1 = self_0.z(idx.u3());
  return !(tmp_1 == null) ? tmp_1 : THROW_CCE();
}
function StdLibPrimitiveExecutionsForReflection$method$lambda_6(self_0, meth, args) {
  // Inline function 'kotlin.check' call
  if (!isInterface(self_0, KtList)) {
    var message = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' is not applicable to '" + getKClassFromExpression(self_0).zc() + "' objects.";
    throw IllegalStateException.v4(toString(message));
  }
  // Inline function 'kotlin.check' call
  if (!(0 === args.v())) {
    var message_0 = "Method '" + MethodName__toString_impl_y7ited(meth.name) + "' has wrong number of argument, expecting 0, received " + args.v();
    throw IllegalStateException.v4(toString(message_0));
  }
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  return ListSeparatedArrayList.gk(self_0);
}
var StdLibPrimitiveExecutionsForReflection_instance;
function StdLibPrimitiveExecutionsForReflection_getInstance() {
  if (StdLibPrimitiveExecutionsForReflection_instance === VOID)
    new StdLibPrimitiveExecutionsForReflection_0();
  return StdLibPrimitiveExecutionsForReflection_instance;
}
function ObjectGraphByReflection$createLambdaValue$lambda(this$0, $lambda) {
  return (it) => this$0.untyped($lambda(this$0.toTypedObject(!(it == null) ? it : THROW_CCE())));
}
function formatModel(name, init) {
  var b = new FormatModelBuilder(_SimpleName___init__impl__6s45d0(name));
  init(b);
  return b.build();
}
function _get__exp__d2m08d($this) {
  var tmp = $this.s2x_1;
  if (!(tmp == null))
    return tmp;
  else {
    throwUninitializedPropertyAccessException('_exp');
  }
}
function fromRuleItem($this, grammar, ruleItem) {
  var tmp;
  if (isInterface(ruleItem, Terminal)) {
    var tmp_0;
    if (ruleItem.isPattern) {
      throw NotImplementedError.uj();
    } else {
      tmp_0 = new TemplateElementTextDefault(ruleItem.value);
    }
    tmp = tmp_0;
  } else {
    if (isInterface(ruleItem, EmptyRule)) {
      tmp = new TemplateElementTextDefault('');
    } else {
      if (isInterface(ruleItem, NonTerminal)) {
        tmp = fromRuleItem($this, grammar, ruleItem.referencedRule(grammar).rhs);
      } else {
        if (isInterface(ruleItem, Embedded)) {
          throw NotImplementedError.uj();
        } else {
          if (isInterface(ruleItem, Choice)) {
            throw NotImplementedError.uj();
          } else {
            if (isInterface(ruleItem, Concatenation)) {
              throw NotImplementedError.uj();
            } else {
              if (isInterface(ruleItem, Group)) {
                throw NotImplementedError.uj();
              } else {
                if (isInterface(ruleItem, OptionalItem)) {
                  throw NotImplementedError.uj();
                } else {
                  if (isInterface(ruleItem, SimpleList)) {
                    throw NotImplementedError.uj();
                  } else {
                    if (isInterface(ruleItem, SeparatedList)) {
                      throw NotImplementedError.uj();
                    } else {
                      var message = "Internal error: subtype of RuleItem not handled: '" + getKClassFromExpression(ruleItem).zc() + "'";
                      throw IllegalStateException.v4(toString(message));
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  return tmp;
}
function AglFormatModelDefault$Companion$fromString$lambda$lambda($context) {
  return ($this$semanticAnalysis) => {
    $this$semanticAnalysis.context($context);
    return Unit_instance;
  };
}
function AglFormatModelDefault$Companion$fromString$lambda($context) {
  return ($this$options) => {
    $this$options.semanticAnalysis(AglFormatModelDefault$Companion$fromString$lambda$lambda($context));
    return Unit_instance;
  };
}
var Companion_instance_15;
function Companion_getInstance_17() {
  return Companion_instance_15;
}
function AglFormat$grammarModel$delegate$lambda() {
  var tmp = Agl_getInstance().registry;
  return grammarModel('Format', VOID, tmp, AglFormat$grammarModel$delegate$lambda$lambda);
}
function AglFormat$grammarModel$delegate$lambda$lambda($this$grammarModel) {
  $this$grammarModel.namespace('net.akehurst.language', AglFormat$grammarModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.grammar('Template', AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda);
  $this$namespace.grammar('Format', AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda($this$grammar) {
  $this$grammar.concatenation('templateString', VOID, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda);
  $this$grammar.choice('templateContent', VOID, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  $this$grammar.concatenation('text', VOID, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  $this$grammar.choice('templateExpression', VOID, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  $this$grammar.concatenation('templateExpressionProperty', VOID, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  $this$grammar.concatenation('templateExpressionList', VOID, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  $this$grammar.concatenation('templateExpressionEmbedded', VOID, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  $this$grammar.concatenation('DOLLAR_IDENTIFIER', VOID, VOID, true, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  $this$grammar.concatenation('RAW_TEXT', VOID, VOID, true, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda($this$concatenation) {
  $this$concatenation.r2t('"');
  $this$concatenation.p2t(0, -1, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda);
  $this$concatenation.r2t('"');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda($this$lst) {
  $this$lst.q2t('templateContent');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$choice) {
  $this$choice.q2t('text');
  $this$choice.q2t('templateExpression');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$concatenation) {
  $this$concatenation.q2t('RAW_TEXT');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$choice) {
  $this$choice.q2t('templateExpressionProperty');
  $this$choice.q2t('templateExpressionList');
  $this$choice.q2t('templateExpressionEmbedded');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$concatenation) {
  $this$concatenation.q2t('DOLLAR_IDENTIFIER');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$concatenation) {
  $this$concatenation.r2t('$[');
  $this$concatenation.g2z('Expressions', 'propertyName');
  $this$concatenation.r2t('/');
  $this$concatenation.g2z('Expressions', 'STRING');
  $this$concatenation.r2t(']');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$concatenation) {
  $this$concatenation.r2t('${');
  $this$concatenation.g2z('Format', 'formatExpression');
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$concatenation) {
  $this$concatenation.l2t('[$][a-zA-Z_][a-zA-Z_0-9-]*');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$concatenation) {
  $this$concatenation.l2t('([^$"\\\\]|\\\\.)+');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda_0($this$grammar) {
  $this$grammar.extendsGrammar(AglExpressions_getInstance().defaultTargetGrammar.selfReference);
  var tmp = OverrideKind_REPLACE_getInstance();
  $this$grammar.concatenation('definition', tmp, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_8);
  $this$grammar.concatenation('format', VOID, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_9);
  $this$grammar.concatenation('extends', VOID, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_10);
  $this$grammar.concatenation('formatRule', VOID, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_11);
  $this$grammar.choice('formatExpression', VOID, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_12);
  var tmp_0 = OverrideKind_REPLACE_getInstance();
  $this$grammar.concatenation('whenOption', tmp_0, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_13);
  var tmp_1 = OverrideKind_REPLACE_getInstance();
  $this$grammar.concatenation('whenOptionElse', tmp_1, VOID, VOID, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_14);
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_8($this$concatenation) {
  $this$concatenation.q2t('format');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_9($this$concatenation) {
  $this$concatenation.r2t('format');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.s2t(AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0);
  $this$concatenation.r2t('{');
  $this$concatenation.p2t(0, -1, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_1);
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0($this$opt) {
  $this$opt.q2t('extends');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_1($this$lst) {
  $this$lst.q2t('formatRule');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_10($this$concatenation) {
  $this$concatenation.r2t(':');
  $this$concatenation.k2w(1, -1, AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_2);
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_2($this$spLst) {
  $this$spLst.q2t('possiblyQualifiedName');
  $this$spLst.r2t(',');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_11($this$concatenation) {
  $this$concatenation.q2t('typeReference');
  $this$concatenation.r2t('->');
  $this$concatenation.q2t('formatExpression');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_12($this$choice) {
  $this$choice.q2t('expression');
  $this$choice.g2z('Template', 'templateString');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_13($this$concatenation) {
  $this$concatenation.q2t('expression');
  $this$concatenation.r2t('->');
  $this$concatenation.q2t('formatExpression');
  return Unit_instance;
}
function AglFormat$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_14($this$concatenation) {
  $this$concatenation.r2t('else');
  $this$concatenation.r2t('->');
  $this$concatenation.q2t('formatExpression');
  return Unit_instance;
}
function AglFormat$typesModel$delegate$lambda() {
  var tmp = AglBase_getInstance().typesModel.namespace;
  return typeModel('Format', true, tmp, AglFormat$typesModel$delegate$lambda$lambda);
}
function AglFormat$typesModel$delegate$lambda$lambda($this$typeModel) {
  return Unit_instance;
}
function AglFormat$asmTransformModel$delegate$lambda() {
  var tmp = AglFormat_getInstance().typesModel;
  return asmTransform('Format', tmp, false, AglFormat$asmTransformModel$delegate$lambda$lambda);
}
function AglFormat$asmTransformModel$delegate$lambda$lambda($this$asmTransform) {
  $this$asmTransform.namespace('net.akehurst.language', AglFormat$asmTransformModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglFormat$asmTransformModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.transform('Format', AglFormat$asmTransformModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglFormat$asmTransformModel$delegate$lambda$lambda$lambda$lambda($this$transform) {
  return Unit_instance;
}
function AglFormat$crossReferenceModel$delegate$lambda() {
  return crossReferenceModel('Style', AglFormat$crossReferenceModel$delegate$lambda$lambda);
}
function AglFormat$crossReferenceModel$delegate$lambda$lambda($this$crossReferenceModel) {
  return Unit_instance;
}
function AglFormat$styleModel$delegate$lambda() {
  return styleModel('Style', AglFormat$styleModel$delegate$lambda$lambda);
}
function AglFormat$styleModel$delegate$lambda$lambda($this$styleModel) {
  $this$styleModel.namespace('net.akehurst.language', AglFormat$styleModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglFormat$styleModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.styles('Style', AglFormat$styleModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglFormat$styleModel$delegate$lambda$lambda$lambda$lambda($this$styles) {
  $this$styles.metaRule("'[^']+'", AglFormat$styleModel$delegate$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglFormat$styleModel$delegate$lambda$lambda$lambda$lambda$lambda($this$metaRule) {
  $this$metaRule.declaration('foreground', 'darkgreen');
  $this$metaRule.declaration('font-weight', 'bold');
  return Unit_instance;
}
function AglFormat$formatModel$delegate$lambda() {
  return formatModel('Style', AglFormat$formatModel$delegate$lambda$lambda);
}
function AglFormat$formatModel$delegate$lambda$lambda($this$formatModel) {
  return Unit_instance;
}
function AglFormat$defaultTargetGrammar$delegate$lambda() {
  return ensureNotNull(AglFormat_getInstance().grammarModel.findDefinitionByQualifiedNameOrNull(_QualifiedName___init__impl__8ed982('net.akehurst.language.Format')));
}
function AglFormat$syntaxAnalyser$delegate$lambda() {
  return new AglFormatSyntaxAnalyser();
}
function AglFormat$semanticAnalyser$delegate$lambda() {
  return new AglFormatSemanticAnalyser();
}
function AglFormat$completionProvider$delegate$lambda() {
  return new AglFormatCompletionProvider();
}
var AglFormat_instance;
function AglFormat_getInstance() {
  if (AglFormat_instance === VOID)
    new AglFormat_0();
  return AglFormat_instance;
}
function grammarModel$factory_3() {
  return getPropertyCallableRef('grammarModel', 1, KProperty1, (receiver) => receiver.grammarModel, null);
}
function typesModel$factory_1() {
  return getPropertyCallableRef('typesModel', 1, KProperty1, (receiver) => receiver.typesModel, null);
}
function asmTransformModel$factory_1() {
  return getPropertyCallableRef('asmTransformModel', 1, KProperty1, (receiver) => receiver.asmTransformModel, null);
}
function crossReferenceModel$factory_2() {
  return getPropertyCallableRef('crossReferenceModel', 1, KProperty1, (receiver) => receiver.crossReferenceModel, null);
}
function styleModel$factory_1() {
  return getPropertyCallableRef('styleModel', 1, KProperty1, (receiver) => receiver.styleModel, null);
}
function formatModel$factory_2() {
  return getPropertyCallableRef('formatModel', 1, KProperty1, (receiver) => receiver.formatModel, null);
}
function defaultTargetGrammar$factory_1() {
  return getPropertyCallableRef('defaultTargetGrammar', 1, KProperty1, (receiver) => receiver.defaultTargetGrammar, null);
}
function syntaxAnalyser$factory_2() {
  return getPropertyCallableRef('syntaxAnalyser', 1, KProperty1, (receiver) => receiver.syntaxAnalyser, null);
}
function semanticAnalyser$factory_2() {
  return getPropertyCallableRef('semanticAnalyser', 1, KProperty1, (receiver) => receiver.semanticAnalyser, null);
}
function completionProvider$factory_2() {
  return getPropertyCallableRef('completionProvider', 1, KProperty1, (receiver) => receiver.completionProvider, null);
}
function whenExpression($this, nodeInfo, children, sentence) {
  var tmp = children.z(2);
  var optionList = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  return new FormatExpressionWhenDefault(optionList);
}
function whenOption_0($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var condition = (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(2);
  var expression = (!(tmp_0 == null) ? isInterface(tmp_0, FormatExpression) : false) ? tmp_0 : THROW_CCE();
  return new FormatWhenOptionDefault(condition, expression);
}
function whenOptionElse_0($this, nodeInfo, children, sentence) {
  var tmp = children.z(2);
  var expression = (!(tmp == null) ? isInterface(tmp, FormatExpression) : false) ? tmp : THROW_CCE();
  return new FormatWhenOptionElseDefault(expression);
}
function AglFormatSyntaxAnalyser$unit$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.r2z(p0, p1, p2);
  l.callableName = 'unit';
  return l;
}
function AglFormatSyntaxAnalyser$namespace$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.s2z(p0, p1, p2);
  l.callableName = 'namespace';
  return l;
}
function AglFormatSyntaxAnalyser$definition$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.t2z(p0, p1, p2);
  l.callableName = 'definition';
  return l;
}
function AglFormatSyntaxAnalyser$format$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.u2z(p0, p1, p2);
  l.callableName = 'format';
  return l;
}
function AglFormatSyntaxAnalyser$formatRule$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.v2z(p0, p1, p2);
  l.callableName = 'formatRule';
  return l;
}
function AglFormatSyntaxAnalyser$formatExpression$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.w2z(p0, p1, p2);
  l.callableName = 'formatExpression';
  return l;
}
function AglFormatSyntaxAnalyser$whenExpression$ref($boundThis) {
  var l = (p0, p1, p2) => whenExpression($boundThis, p0, p1, p2);
  l.callableName = 'whenExpression';
  return l;
}
function AglFormatSyntaxAnalyser$whenOption$ref($boundThis) {
  var l = (p0, p1, p2) => whenOption_0($boundThis, p0, p1, p2);
  l.callableName = 'whenOption';
  return l;
}
function AglFormatSyntaxAnalyser$whenOptionElse$ref($boundThis) {
  var l = (p0, p1, p2) => whenOptionElse_0($boundThis, p0, p1, p2);
  l.callableName = 'whenOptionElse';
  return l;
}
function AglFormatSyntaxAnalyser$format$lambda($extendsFunc, $name, $options, $rules) {
  return (ns) => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = $extendsFunc;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item(ns);
      destination.r(tmp$ret$0);
    }
    var extends_0 = destination;
    return new FormatSetDefault(ns, $name, extends_0, $options, $rules);
  };
}
function AglTemplateSyntaxAnalyser$templateString$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.f30(p0, p1, p2);
  l.callableName = 'templateString';
  return l;
}
function AglTemplateSyntaxAnalyser$templateContent$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.g30(p0, p1, p2);
  l.callableName = 'templateContent';
  return l;
}
function AglTemplateSyntaxAnalyser$text$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.h30(p0, p1, p2);
  l.callableName = 'text';
  return l;
}
function AglTemplateSyntaxAnalyser$templateExpression$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.i30(p0, p1, p2);
  l.callableName = 'templateExpression';
  return l;
}
function AglTemplateSyntaxAnalyser$templateExpressionProperty$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.j30(p0, p1, p2);
  l.callableName = 'templateExpressionProperty';
  return l;
}
function AglTemplateSyntaxAnalyser$templateExpressionList$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.k30(p0, p1, p2);
  l.callableName = 'templateExpressionList';
  return l;
}
function AglTemplateSyntaxAnalyser$templateExpressionEmbedded$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.l30(p0, p1, p2);
  l.callableName = 'templateExpressionEmbedded';
  return l;
}
var Companion_instance_16;
function Companion_getInstance_18() {
  if (Companion_instance_16 === VOID)
    new Companion_15();
  return Companion_instance_16;
}
function _get__formatSet__7uc2g1($this) {
  var tmp = $this.q30_1;
  if (!(tmp == null))
    return tmp;
  else {
    throwUninitializedPropertyAccessException('_formatSet');
  }
}
function _get__rules__3nlhbh($this) {
  var tmp0 = $this.r30_1;
  // Inline function 'kotlin.getValue' call
  _rules$factory();
  return tmp0.b3();
}
function formatSelf($this, evc) {
  var self_0 = evc.self;
  var tmp;
  if (self_0 == null) {
    tmp = '';
  } else {
    var formatRule = $this.findRuleFor(self_0.type);
    tmp = formatRule == null ? formatWhenNoRule($this, evc) : formatExpression($this, evc, formatRule.formatExpression);
  }
  return tmp;
}
function formatWhenNoRule($this, evc) {
  var self_0 = evc.self;
  var tmp;
  if (self_0 == null) {
    tmp = '';
  } else {
    var selfType = self_0.type.resolvedDeclaration;
    var tmp_0;
    if (isInterface(selfType, SpecialType)) {
      var tmp_1;
      if (equals(StdLibDefault_getInstance().NothingType.resolvedDeclaration, selfType)) {
        tmp_1 = '';
      } else if (equals(StdLibDefault_getInstance().AnyType.resolvedDeclaration, selfType)) {
        tmp_1 = toString(self_0.self);
      } else {
        var message = "SpecialType not handled '" + getKClassFromExpression(self_0.type.resolvedDeclaration).zc() + "'";
        throw IllegalStateException.v4(toString(message));
      }
      tmp_0 = tmp_1;
    } else {
      if (isInterface(selfType, SingletonType)) {
        tmp_0 = toString($this.objectGraph.valueOf(self_0));
      } else {
        if (isInterface(selfType, PrimitiveType)) {
          tmp_0 = toString($this.objectGraph.valueOf(self_0));
        } else {
          if (isInterface(selfType, ValueType)) {
            tmp_0 = toString($this.objectGraph.valueOf(self_0));
          } else {
            if (isInterface(selfType, EnumType)) {
              tmp_0 = toString($this.objectGraph.valueOf(self_0));
            } else {
              if (isInterface(selfType, CollectionType)) {
                var tmp_2;
                if (selfType.isStdList) {
                  var tmp_3 = $this.objectGraph.valueOf(self_0);
                  var coll = isInterface(tmp_3, KtList) ? tmp_3 : THROW_CCE();
                  tmp_2 = joinToString(coll, '', VOID, VOID, VOID, VOID, FormatterOverTypedObject$formatWhenNoRule$lambda($this));
                } else if (selfType.isStdSet) {
                  throw NotImplementedError.uj();
                } else if (selfType.isStdMap) {
                  var tmp_4 = $this.objectGraph.valueOf(self_0);
                  var coll_0 = isInterface(tmp_4, KtMap) ? tmp_4 : THROW_CCE();
                  var tmp_5 = coll_0.v2();
                  tmp_2 = joinToString(tmp_5, '', VOID, VOID, VOID, VOID, FormatterOverTypedObject$formatWhenNoRule$lambda_0($this));
                } else {
                  throw NotImplementedError.uj();
                }
                tmp_0 = tmp_2;
              } else {
                if (isInterface(selfType, StructuredType)) {
                  // Inline function 'kotlin.collections.filter' call
                  var tmp0 = self_0.type.resolvedDeclaration.allProperty;
                  // Inline function 'kotlin.collections.filterTo' call
                  var destination = LinkedHashMap.l4();
                  // Inline function 'kotlin.collections.iterator' call
                  var _iterator__ex2g4s = tmp0.w2().s();
                  while (_iterator__ex2g4s.t()) {
                    var element = _iterator__ex2g4s.u();
                    // Inline function 'kotlin.collections.component1' call
                    var pname = element.a3().s30_1;
                    // Inline function 'kotlin.collections.component2' call
                    var pdecl = element.b3();
                    if (pdecl.isComposite || pdecl.isPrimitive) {
                      destination.r2(element.a3(), element.b3());
                    }
                  }
                  var containedProps = destination;
                  // Inline function 'kotlin.collections.map' call
                  // Inline function 'kotlin.collections.mapTo' call
                  var destination_0 = ArrayList.w(containedProps.v());
                  // Inline function 'kotlin.collections.iterator' call
                  var _iterator__ex2g4s_0 = containedProps.w2().s();
                  while (_iterator__ex2g4s_0.t()) {
                    var item = _iterator__ex2g4s_0.u();
                    // Inline function 'kotlin.collections.component1' call
                    var pname_0 = item.a3().s30_1;
                    // Inline function 'kotlin.collections.component2' call
                    var pdecl_0 = item.b3();
                    var propValue = $this.objectGraph.getProperty(self_0, _PropertyName___get_value__impl__p219lh(pname_0));
                    var tmp$ret$9 = formatSelf($this, Companion_instance_14.ofSelf(propValue));
                    destination_0.r(tmp$ret$9);
                  }
                  var tmp_6 = destination_0;
                  tmp_0 = joinToString(tmp_6, '', VOID, VOID, VOID, VOID, FormatterOverTypedObject$formatWhenNoRule$lambda_1);
                } else {
                  var message_0 = "Subtype of TypeDeclaration not handled '" + getKClassFromExpression(self_0.type.resolvedDeclaration).zc() + "'";
                  throw IllegalStateException.v4(toString(message_0));
                }
              }
            }
          }
        }
      }
    }
    tmp = tmp_0;
  }
  return tmp;
}
function formatExpression($this, evc, formatExpr) {
  var tmp;
  if (isInterface(formatExpr, FormatExpressionExpression)) {
    tmp = formatFromExpression($this, evc, formatExpr);
  } else {
    if (isInterface(formatExpr, FormatExpressionTemplate)) {
      tmp = formatFromTemplate($this, evc, formatExpr);
    } else {
      if (isInterface(formatExpr, FormatExpressionWhen)) {
        tmp = formatFromWhen($this, evc, formatExpr);
      } else {
        var message = "Internal error: subtype of AglFormatExpression not handled: '" + getKClassFromExpression(formatExpr).zc() + "'";
        throw IllegalStateException.v4(toString(message));
      }
    }
  }
  return tmp;
}
function formatFromExpression($this, evc, formatExpr) {
  var res = protoOf(ExpressionsInterpreterOverTypedObject).evaluateExpression.call($this, evc, formatExpr.expression);
  var value = res.self;
  var tmp;
  if (value == null) {
    $this.issues.error(null, "Expression should result in a value, got 'null'");
    tmp = '';
  } else {
    if (typeof value === 'string') {
      tmp = typeof value === 'string' ? value : THROW_CCE();
    } else {
      tmp = formatSelf($this, Companion_instance_14.ofSelf(res));
    }
  }
  return tmp;
}
function formatFromTemplate($this, evc, formatExpr) {
  var sb = StringBuilder.j();
  switch (formatExpr.content.v()) {
    case 0:
      break;
    case 1:
      var text = formatTemplateContent($this, evc, last(formatExpr.content));
      sb.cb(text);
      break;
    default:
      // Inline function 'kotlin.collections.filter' call

      var tmp0 = formatExpr.content;
      // Inline function 'kotlin.collections.filterTo' call

      var destination = ArrayList.y();
      var _iterator__ex2g4s = tmp0.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        if (isInterface(element, TemplateElementText)) {
          destination.r(element);
        }
      }

      // Inline function 'kotlin.collections.associateWith' call

      var result = LinkedHashMap.kb(coerceAtLeast(mapCapacity(collectionSizeOrDefault(destination, 10)), 16));
      // Inline function 'kotlin.collections.associateWithTo' call

      var _iterator__ex2g4s_0 = destination.s();
      while (_iterator__ex2g4s_0.t()) {
        var element_0 = _iterator__ex2g4s_0.u();
        var tmp$ret$3 = formatTemplateContent($this, evc, element_0);
        result.r2(element_0, tmp$ret$3);
      }

      var textContent = result;
      var prefix = computePrefix($this, textContent.v2());
      var firstContent = formatTemplateContent($this, evc, formatExpr.content.z(0));
      var withPrefixRemoved1 = drop_0(substringAfter(firstContent, '\n'), prefix.length);
      sb.cb(withPrefixRemoved1);
      var contentMid = dropLast(drop(formatExpr.content, 1), 1);
      var indent = '';
      var previousWasEmpty = false;
      var _iterator__ex2g4s_1 = contentMid.s();
      while (_iterator__ex2g4s_1.t()) {
        var elem = _iterator__ex2g4s_1.u();
        var res = formatTemplateContent($this, evc, elem);
        // Inline function 'kotlin.text.isEmpty' call
        if (charSequenceLength(res) === 0) {
          previousWasEmpty = true;
        } else {
          var tmp;
          if (previousWasEmpty === true) {
            // Inline function 'kotlin.text.trimStart' call
            var this_0 = trimStart(res, charArrayOf([_Char___init__impl__6a9atx(10)]));
            tmp = toString(trimStart_0(isCharSequence(this_0) ? this_0 : THROW_CCE()));
          } else {
            tmp = res;
          }
          var res2 = tmp;
          var withPrefixRemoved = removePrefixAddIndent($this, res2, prefix, indent);
          if (isInterface(elem, TemplateElementText)) {
            indent = computeIndent($this, removePrefixAddIndent($this, res, prefix, ''));
          }
          sb.cb(withPrefixRemoved);
          previousWasEmpty = false;
        }
      }

      var tmp_0 = last(formatExpr.content);
      if (isInterface(tmp_0, TemplateElementText)) {
        var lastContent = formatTemplateContent($this, evc, last(formatExpr.content));
        var lc = removePrefixAddIndent($this, lastContent, prefix, indent);
        var txt = substringAfter(lc, '\n');
        if (isBlank(txt)) {
          sb.cb(substringBefore(lc, '\n'));
        } else {
          sb.cb(lc);
        }
      } else {
        var lastContent_0 = formatTemplateContent($this, evc, last(formatExpr.content));
        var lc_0 = removePrefixAddIndent($this, lastContent_0, prefix, indent);
        sb.cb(lc_0);
      }

      break;
  }
  return sb.toString();
}
function computePrefix($this, texts) {
  // Inline function 'kotlin.collections.flatMap' call
  // Inline function 'kotlin.collections.flatMapTo' call
  var destination = ArrayList.y();
  var _iterator__ex2g4s = texts.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var list = drop_1(splitToSequence(element, ['\n']), 1);
    addAll_1(destination, list);
  }
  var lines = dropLast(destination, 1);
  // Inline function 'kotlin.collections.filter' call
  // Inline function 'kotlin.collections.filterTo' call
  var destination_0 = ArrayList.y();
  var _iterator__ex2g4s_0 = lines.s();
  while (_iterator__ex2g4s_0.t()) {
    var element_0 = _iterator__ex2g4s_0.u();
    // Inline function 'kotlin.text.isNotEmpty' call
    if (charSequenceLength(element_0) > 0) {
      destination_0.r(element_0);
    }
  }
  // Inline function 'kotlin.collections.map' call
  // Inline function 'kotlin.collections.mapTo' call
  var destination_1 = ArrayList.w(collectionSizeOrDefault(destination_0, 10));
  var _iterator__ex2g4s_1 = destination_0.s();
  while (_iterator__ex2g4s_1.t()) {
    var item = _iterator__ex2g4s_1.u();
    var tmp0_safe_receiver = Companion_getInstance_18().prefixMatchPattern.we(item, 0);
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.b3();
    var tmp$ret$7 = tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs;
    destination_1.r(tmp$ret$7);
  }
  var prefixes = destination_1;
  var tmp$ret$10;
  $l$block_0: {
    // Inline function 'kotlin.collections.minByOrNull' call
    var iterator = prefixes.s();
    if (!iterator.t()) {
      tmp$ret$10 = null;
      break $l$block_0;
    }
    var minElem = iterator.u();
    if (!iterator.t()) {
      tmp$ret$10 = minElem;
      break $l$block_0;
    }
    var minValue = minElem.length;
    do {
      var e = iterator.u();
      var v = e.length;
      if (compareTo(minValue, v) > 0) {
        minElem = e;
        minValue = v;
      }
    }
     while (iterator.t());
    tmp$ret$10 = minElem;
  }
  var tmp0_elvis_lhs = tmp$ret$10;
  return tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
}
function computeIndent($this, txt) {
  var tmp;
  if (contains(txt, '\n')) {
    var txt_0 = substringAfterLast(txt, '\n');
    var tmp_0 = txt_0.length;
    // Inline function 'kotlin.text.trimStart' call
    var len = tmp_0 - toString(trimStart_0(isCharSequence(txt_0) ? txt_0 : THROW_CCE())).length | 0;
    // Inline function 'kotlin.text.substring' call
    // Inline function 'kotlin.js.asDynamic' call
    tmp = txt_0.substring(0, len);
  } else {
    tmp = '';
  }
  return tmp;
}
function removePrefixAddIndent($this, txt, prefix, indent) {
  var tmp;
  if (contains(txt, '\n')) {
    var lines = split(txt, ['\n']);
    var first = lines.z(0);
    // Inline function 'kotlin.collections.map' call
    var this_0 = drop(lines, 1);
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = startsWith(item, prefix) ? indent + substringAfter(item, prefix) : indent + item;
      destination.r(tmp$ret$0);
    }
    var adjusted = destination;
    tmp = indent + first + '\n' + joinToString(adjusted, '\n');
  } else {
    tmp = txt;
  }
  return tmp;
}
function formatTemplateContent($this, evc, content) {
  var tmp;
  if (isInterface(content, TemplateElementText)) {
    tmp = formatTemplateElementText($this, evc, content);
  } else {
    if (isInterface(content, TemplateElementExpressionProperty)) {
      tmp = formatTemplateElementExpressionSimple($this, evc, content);
    } else {
      if (isInterface(content, TemplateElementExpressionList)) {
        tmp = formatTemplateElementExpressionList($this, evc, content);
      } else {
        if (isInterface(content, TemplateElementExpressionEmbedded)) {
          tmp = formatTemplateElementExpressionEmbedded($this, evc, content);
        } else {
          var message = "Internal error: subtype of TemplateElement not handled: '" + getKClassFromExpression(content).zc() + "'";
          throw IllegalStateException.v4(toString(message));
        }
      }
    }
  }
  return tmp;
}
function formatTemplateElementText($this, evc, templateElement) {
  return templateElement.text;
}
function formatTemplateElementExpressionSimple($this, evc, templateElement) {
  var self_0 = evc.self;
  var tmp;
  if (self_0 == null) {
    tmp = '';
  } else {
    var value = $this.objectGraph.getProperty(self_0, templateElement.propertyName);
    tmp = formatSelf($this, Companion_instance_14.ofSelf(value));
  }
  return tmp;
}
function formatTemplateElementExpressionList($this, evc, templateElement) {
  var self_0 = evc.self;
  var tmp;
  if (self_0 == null) {
    tmp = '';
  } else {
    var typedlist = $this.objectGraph.getProperty(self_0, templateElement.listPropertyName);
    var list = $this.objectGraph.valueOf(typedlist);
    var tmp_0;
    if (isInterface(list, KtList)) {
      var tmp_1 = isInterface(list, KtList) ? list : THROW_CCE();
      var tmp_2 = templateElement.separator;
      tmp_0 = joinToString(tmp_1, tmp_2, VOID, VOID, VOID, VOID, FormatterOverTypedObject$formatTemplateElementExpressionList$lambda($this));
    } else {
      $this.issues.error(null, "Expected a list object but got a '" + getKClassFromExpression(list).zc() + "'");
      tmp_0 = '';
    }
    tmp = tmp_0;
  }
  return tmp;
}
function formatTemplateElementExpressionEmbedded($this, evc, templateElement) {
  var v = $this.evaluateExpression(evc, templateElement.expression);
  var tmp = $this.objectGraph.valueOf(v);
  return typeof tmp === 'string' ? tmp : THROW_CCE();
}
function formatFromWhen($this, evc, formatExpr) {
  var _iterator__ex2g4s = formatExpr.options.s();
  while (_iterator__ex2g4s.t()) {
    var opt = _iterator__ex2g4s.u();
    var condValue = protoOf(ExpressionsInterpreterOverTypedObject).evaluateExpression.call($this, evc, opt.condition);
    var tmp0_subject = condValue.type;
    if (equals(tmp0_subject, StdLibDefault_getInstance().Boolean)) {
      var tmp = $this.objectGraph.valueOf(condValue);
      if (typeof tmp === 'boolean' ? tmp : THROW_CCE()) {
        var result = formatExpression($this, evc, opt.format);
        return result;
      }
    } else {
      // Inline function 'kotlin.error' call
      var message = 'Conditions/Options in a when expression must result in a Boolean value';
      throw IllegalStateException.v4(toString(message));
    }
  }
  return '';
}
function FormatterOverTypedObject$_rules$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.associateBy' call
    var this_0 = _get__formatSet__7uc2g1(this$0).rules;
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_0, 10)), 16);
    // Inline function 'kotlin.collections.associateByTo' call
    var destination = LinkedHashMap.kb(capacity);
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp$ret$0 = protoOf(ExpressionsInterpreterOverTypedObject).evaluateTypeReference.call(this$0, element.forTypeName);
      destination.r2(tmp$ret$0, element);
    }
    return destination;
  };
}
function FormatterOverTypedObject$formatWhenNoRule$lambda(this$0) {
  return (it) => {
    var tobj = this$0.objectGraph.toTypedObject(it);
    return formatSelf(this$0, Companion_instance_14.ofSelf(tobj));
  };
}
function FormatterOverTypedObject$formatWhenNoRule$lambda_0(this$0) {
  return (it) => {
    var tobj = this$0.objectGraph.toTypedObject(it);
    return formatSelf(this$0, Companion_instance_14.ofSelf(tobj));
  };
}
function FormatterOverTypedObject$formatWhenNoRule$lambda_1(it) {
  return it;
}
function FormatterOverTypedObject$formatTemplateElementExpressionList$lambda(this$0) {
  return (it) => {
    var typedElement = this$0.objectGraph.toTypedObject(!(it == null) ? it : THROW_CCE());
    return formatSelf(this$0, Companion_instance_14.ofSelf(typedElement));
  };
}
function _rules$factory() {
  return getPropertyCallableRef('_rules', 1, KProperty1, (receiver) => _get__rules__3nlhbh(receiver), null);
}
function asGrammarModel(_this__u8e3s4) {
  var tmp = _this__u8e3s4.name;
  var tmp_0 = new OptionHolderDefault(null, emptyMap());
  var tmp_1 = _this__u8e3s4.namespace;
  return new GrammarModelDefault(tmp, tmp_0, listOf(isInterface(tmp_1, GrammarNamespace) ? tmp_1 : THROW_CCE()));
}
var Companion_instance_17;
function Companion_getInstance_19() {
  return Companion_instance_17;
}
var Companion_instance_18;
function Companion_getInstance_20() {
  return Companion_instance_18;
}
function GrammarAbstract$selfReference$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.also' call
    var this_0 = new GrammarReferenceDefault(this$0.namespace, new SimpleName(this$0.name));
    this_0.resolveAs(this$0);
    return this_0;
  };
}
function GrammarAbstract$allGrammarReferencesInRules$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.allGrammarRule;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp;
      if (isInterface(element, OverrideRule)) {
        var tmp_0;
        var tmp_1 = element.overriddenRhs;
        if (isInterface(tmp_1, NonTerminal)) {
          var tmp_2 = element.overriddenRhs;
          var tmp0_safe_receiver = (isInterface(tmp_2, NonTerminal) ? tmp_2 : THROW_CCE()).targetGrammar;
          var tmp_3;
          if (tmp0_safe_receiver == null) {
            tmp_3 = null;
          } else {
            // Inline function 'kotlin.let' call
            tmp_3 = listOf(tmp0_safe_receiver);
          }
          var tmp1_elvis_lhs = tmp_3;
          tmp_0 = tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs;
        } else {
          tmp_0 = emptyList();
        }
        tmp = tmp_0;
      } else {
        // Inline function 'kotlin.collections.map' call
        var this_0 = element.rhs.allEmbedded;
        // Inline function 'kotlin.collections.mapTo' call
        var destination_0 = ArrayList.w(collectionSizeOrDefault(this_0, 10));
        var _iterator__ex2g4s_0 = this_0.s();
        while (_iterator__ex2g4s_0.t()) {
          var item = _iterator__ex2g4s_0.u();
          var tmp$ret$2 = item.embeddedGrammarReference;
          destination_0.r(tmp$ret$2);
        }
        tmp = destination_0;
      }
      var list = tmp;
      addAll(destination, list);
    }
    var refs = destination;
    return plus(this$0.extends, refs);
  };
}
function GrammarAbstract$allExtends$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.extends;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0_safe_receiver = element.resolved;
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.allExtends;
      var list = tmp1_elvis_lhs == null ? orderedSetOf([]) : tmp1_elvis_lhs;
      addAll(destination, list);
    }
    var inherited = toOrderedSet(destination);
    return plus_5(inherited, this$0.extends);
  };
}
function GrammarAbstract$directInheritedGrammarRule$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.extends;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0_safe_receiver = element.resolved;
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.grammarRule;
      var list = tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs;
      addAll(destination, list);
    }
    var inheritedRules = destination;
    return inheritedRules;
  };
}
function GrammarAbstract$allGrammarRule$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.extends;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0_safe_receiver = element.resolved;
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.allGrammarRule;
      var list = tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs;
      addAll(destination, list);
    }
    var inheritedRules = destination;
    return plus(inheritedRules, this$0.grammarRule);
  };
}
function GrammarAbstract$directInheritedResolvedGrammarRule$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.linkedMapOf' call
    var resolvedRules = LinkedHashMap.l4();
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.extends;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0_safe_receiver = element.resolved;
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.resolvedGrammarRule;
      var list = tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs;
      addAll(destination, list);
    }
    var inheritedRules = destination;
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = inheritedRules.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      var tmp0_elvis_lhs = Companion_instance_18.m33(element_0, inheritedRules);
      var r = tmp0_elvis_lhs == null ? element_0 : tmp0_elvis_lhs;
      // Inline function 'kotlin.collections.set' call
      var key = new GrammarRuleName(r.name);
      resolvedRules.r2(key, r);
    }
    return toOrderedSet(resolvedRules.v2());
  };
}
function GrammarAbstract$allInheritedResolvedGrammarRule$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.extends;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0_safe_receiver = element.resolved;
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.allResolvedGrammarRule;
      var list = tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs;
      addAll(destination, list);
    }
    return toOrderedSet(destination);
  };
}
function GrammarAbstract$resolvedGrammarRule$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.linkedMapOf' call
    var resolvedRules = LinkedHashMap.l4();
    var inheritedRules = this$0.allInheritedResolvedGrammarRule;
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = this$0.grammarRule.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0_elvis_lhs = Companion_instance_18.m33(element, toList(inheritedRules));
      var r = tmp0_elvis_lhs == null ? element : tmp0_elvis_lhs;
      // Inline function 'kotlin.collections.set' call
      var key = new GrammarRuleName(r.name);
      resolvedRules.r2(key, r);
    }
    return toOrderedSet(resolvedRules.v2());
  };
}
function GrammarAbstract$allResolvedGrammarRule$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.linkedMapOf' call
    var resolvedRules = LinkedHashMap.l4();
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.extends;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0_safe_receiver = element.resolved;
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.allResolvedGrammarRule;
      var list = tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs;
      addAll(destination, list);
    }
    var inheritedRules = destination;
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = inheritedRules.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      var tmp0_elvis_lhs = Companion_instance_18.m33(element_0, inheritedRules);
      var r = tmp0_elvis_lhs == null ? element_0 : tmp0_elvis_lhs;
      // Inline function 'kotlin.collections.set' call
      var key = new GrammarRuleName(r.name);
      resolvedRules.r2(key, r);
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_1 = this$0.grammarRule.s();
    while (_iterator__ex2g4s_1.t()) {
      var element_1 = _iterator__ex2g4s_1.u();
      var tmp0_elvis_lhs_0 = Companion_instance_18.m33(element_1, inheritedRules);
      var r_0 = tmp0_elvis_lhs_0 == null ? element_1 : tmp0_elvis_lhs_0;
      // Inline function 'kotlin.collections.set' call
      var key_0 = new GrammarRuleName(r_0.name);
      resolvedRules.r2(key_0, r_0);
    }
    return toOrderedSet(resolvedRules.v2());
  };
}
function GrammarAbstract$allResolvedTerminal$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = toSet(this$0.allResolvedGrammarRule);
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp;
      switch (element.isLeaf) {
        case true:
          tmp = setOf(element.compressedLeaf);
          break;
        case false:
          tmp = element.rhs.allTerminal;
          break;
        default:
          noWhenBranchMatchedException();
          break;
      }
      var list = tmp;
      addAll(destination, list);
    }
    return toSet(destination);
  };
}
function GrammarAbstract$allResolvedSkipTerminal$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.filter' call
    var tmp0 = this$0.allResolvedGrammarRule;
    // Inline function 'kotlin.collections.filterTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (element.isSkip) {
        destination.r(element);
      }
    }
    // Inline function 'kotlin.collections.flatMap' call
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination_0 = ArrayList.y();
    var _iterator__ex2g4s_0 = destination.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      var list = element_0.rhs.allTerminal;
      addAll(destination_0, list);
    }
    return toSet(destination_0);
  };
}
function GrammarAbstract$allResolvedNonTerminalRule$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.filter' call
    var tmp0 = this$0.allResolvedGrammarRule;
    // Inline function 'kotlin.collections.filterTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!element.isLeaf) {
        destination.r(element);
      }
    }
    return toSet(destination);
  };
}
function GrammarAbstract$allResolvedPreferenceRuleRule$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.extends;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0_safe_receiver = element.resolved;
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.allResolvedPreferenceRuleRule;
      var list = tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs;
      addAll(destination, list);
    }
    var rules = toMutableOrderedSet(destination);
    return plus_5(rules, this$0.preferenceRule);
  };
}
function GrammarAbstract$allResolvedEmbeddedRules$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.allResolvedGrammarRule;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.rhs.allEmbedded;
      addAll(destination, list);
    }
    return toSet(destination);
  };
}
function GrammarAbstract$allResolvedEmbeddedGrammars$delegate$lambda(this$0) {
  return () => this$0.findAllResolvedEmbeddedGrammars();
}
function GrammarAbstract$asString$lambda(it) {
  return toString(it.nameOrQName);
}
function GrammarAbstract$asString$lambda_0($ni) {
  return (it) => $ni.toString() + it.asString($ni);
}
function selfReference$factory() {
  return getPropertyCallableRef('selfReference', 1, KProperty1, (receiver) => receiver.selfReference, null);
}
function allGrammarReferencesInRules$factory() {
  return getPropertyCallableRef('allGrammarReferencesInRules', 1, KProperty1, (receiver) => receiver.allGrammarReferencesInRules, null);
}
function allExtends$factory() {
  return getPropertyCallableRef('allExtends', 1, KProperty1, (receiver) => receiver.allExtends, null);
}
function directInheritedGrammarRule$factory() {
  return getPropertyCallableRef('directInheritedGrammarRule', 1, KProperty1, (receiver) => receiver.directInheritedGrammarRule, null);
}
function allGrammarRule$factory() {
  return getPropertyCallableRef('allGrammarRule', 1, KProperty1, (receiver) => receiver.allGrammarRule, null);
}
function directInheritedResolvedGrammarRule$factory() {
  return getPropertyCallableRef('directInheritedResolvedGrammarRule', 1, KProperty1, (receiver) => receiver.directInheritedResolvedGrammarRule, null);
}
function allInheritedResolvedGrammarRule$factory() {
  return getPropertyCallableRef('allInheritedResolvedGrammarRule', 1, KProperty1, (receiver) => receiver.allInheritedResolvedGrammarRule, null);
}
function resolvedGrammarRule$factory() {
  return getPropertyCallableRef('resolvedGrammarRule', 1, KProperty1, (receiver) => receiver.resolvedGrammarRule, null);
}
function allResolvedGrammarRule$factory() {
  return getPropertyCallableRef('allResolvedGrammarRule', 1, KProperty1, (receiver) => receiver.allResolvedGrammarRule, null);
}
function allResolvedTerminal$factory() {
  return getPropertyCallableRef('allResolvedTerminal', 1, KProperty1, (receiver) => receiver.allResolvedTerminal, null);
}
function allResolvedSkipTerminal$factory() {
  return getPropertyCallableRef('allResolvedSkipTerminal', 1, KProperty1, (receiver) => receiver.allResolvedSkipTerminal, null);
}
function allResolvedNonTerminalRule$factory() {
  return getPropertyCallableRef('allResolvedNonTerminalRule', 1, KProperty1, (receiver) => receiver.allResolvedNonTerminalRule, null);
}
function allResolvedPreferenceRuleRule$factory() {
  return getPropertyCallableRef('allResolvedPreferenceRuleRule', 1, KProperty1, (receiver) => receiver.allResolvedPreferenceRuleRule, null);
}
function allResolvedEmbeddedRules$factory() {
  return getPropertyCallableRef('allResolvedEmbeddedRules', 1, KProperty1, (receiver) => receiver.allResolvedEmbeddedRules, null);
}
function allResolvedEmbeddedGrammars$factory() {
  return getPropertyCallableRef('allResolvedEmbeddedGrammars', 1, KProperty1, (receiver) => receiver.allResolvedEmbeddedGrammars, null);
}
function toRegEx($this, value) {
  return Companion_getInstance().le(value);
}
function GrammarRuleAbstract$Companion$compressRuleItem$lambda(it) {
  return '(' + it.o33_1 + ')';
}
function GrammarRuleAbstract$Companion$compressRuleItem$lambda_0(it) {
  return '(' + it.o33_1 + ')';
}
var Companion_instance_19;
function Companion_getInstance_21() {
  return Companion_instance_19;
}
function GrammarRuleAbstract$compressedLeaf$delegate$lambda(this$0) {
  return () => Companion_instance_19.compressRuleItem(_GrammarRuleName___get_value__impl__470s0v(this$0.name), this$0.rhs);
}
function compressedLeaf$factory() {
  return getPropertyCallableRef('compressedLeaf', 1, KProperty1, (receiver) => receiver.compressedLeaf, null);
}
function PreferenceRuleDefault$asString$lambda($ni) {
  return (it) => it.asString($ni);
}
function ConcatenationDefault$allTerminal$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.u35_1;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.allTerminal;
      addAll(destination, list);
    }
    return toSet(destination);
  };
}
function ConcatenationDefault$allNonTerminal$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.u35_1;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.allNonTerminal;
      addAll(destination, list);
    }
    return toSet(destination);
  };
}
function ConcatenationDefault$allEmbedded$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.u35_1;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.allEmbedded;
      addAll(destination, list);
    }
    return toSet(destination);
  };
}
function ChoiceAbstract$allTerminal$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.alternative;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.allTerminal;
      addAll(destination, list);
    }
    return toSet(destination);
  };
}
function ChoiceAbstract$allNonTerminal$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.alternative;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.allNonTerminal;
      addAll(destination, list);
    }
    return toSet(destination);
  };
}
function ChoiceAbstract$allEmbedded$delegate$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.flatMap' call
    var tmp0 = this$0.alternative;
    // Inline function 'kotlin.collections.flatMapTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var list = element.allEmbedded;
      addAll(destination, list);
    }
    return toSet(destination);
  };
}
function allTerminal$factory() {
  return getPropertyCallableRef('allTerminal', 1, KProperty1, (receiver) => receiver.allTerminal, null);
}
function allNonTerminal$factory() {
  return getPropertyCallableRef('allNonTerminal', 1, KProperty1, (receiver) => receiver.allNonTerminal, null);
}
function allEmbedded$factory() {
  return getPropertyCallableRef('allEmbedded', 1, KProperty1, (receiver) => receiver.allEmbedded, null);
}
function allTerminal$factory_0() {
  return getPropertyCallableRef('allTerminal', 1, KProperty1, (receiver) => receiver.allTerminal, null);
}
function allNonTerminal$factory_0() {
  return getPropertyCallableRef('allNonTerminal', 1, KProperty1, (receiver) => receiver.allNonTerminal, null);
}
function allEmbedded$factory_0() {
  return getPropertyCallableRef('allEmbedded', 1, KProperty1, (receiver) => receiver.allEmbedded, null);
}
var Associativity_LEFT_instance;
var Associativity_RIGHT_instance;
function values_1() {
  return [Associativity_LEFT_getInstance(), Associativity_RIGHT_getInstance()];
}
function valueOf_2(value) {
  switch (value) {
    case 'LEFT':
      return Associativity_LEFT_getInstance();
    case 'RIGHT':
      return Associativity_RIGHT_getInstance();
    default:
      Associativity_initEntries();
      THROW_IAE('No enum constant value.');
      break;
  }
}
var Associativity_entriesInitialized;
function Associativity_initEntries() {
  if (Associativity_entriesInitialized)
    return Unit_instance;
  Associativity_entriesInitialized = true;
  Associativity_LEFT_instance = new Associativity('LEFT', 0);
  Associativity_RIGHT_instance = new Associativity('RIGHT', 1);
}
var ChoiceIndicator_NONE_instance;
var ChoiceIndicator_EMPTY_instance;
var ChoiceIndicator_ITEM_instance;
var ChoiceIndicator_NUMBER_instance;
function values_2() {
  return [ChoiceIndicator_NONE_getInstance(), ChoiceIndicator_EMPTY_getInstance(), ChoiceIndicator_ITEM_getInstance(), ChoiceIndicator_NUMBER_getInstance()];
}
function valueOf_3(value) {
  switch (value) {
    case 'NONE':
      return ChoiceIndicator_NONE_getInstance();
    case 'EMPTY':
      return ChoiceIndicator_EMPTY_getInstance();
    case 'ITEM':
      return ChoiceIndicator_ITEM_getInstance();
    case 'NUMBER':
      return ChoiceIndicator_NUMBER_getInstance();
    default:
      ChoiceIndicator_initEntries();
      THROW_IAE('No enum constant value.');
      break;
  }
}
var ChoiceIndicator_entriesInitialized;
function ChoiceIndicator_initEntries() {
  if (ChoiceIndicator_entriesInitialized)
    return Unit_instance;
  ChoiceIndicator_entriesInitialized = true;
  ChoiceIndicator_NONE_instance = new ChoiceIndicator('NONE', 0);
  ChoiceIndicator_EMPTY_instance = new ChoiceIndicator('EMPTY', 1);
  ChoiceIndicator_ITEM_instance = new ChoiceIndicator('ITEM', 2);
  ChoiceIndicator_NUMBER_instance = new ChoiceIndicator('NUMBER', 3);
}
var OverrideKind_REPLACE_instance;
var OverrideKind_APPEND_ALTERNATIVE_instance;
var OverrideKind_SUBSTITUTION_instance;
function values_3() {
  return [OverrideKind_REPLACE_getInstance(), OverrideKind_APPEND_ALTERNATIVE_getInstance(), OverrideKind_SUBSTITUTION_getInstance()];
}
function valueOf_4(value) {
  switch (value) {
    case 'REPLACE':
      return OverrideKind_REPLACE_getInstance();
    case 'APPEND_ALTERNATIVE':
      return OverrideKind_APPEND_ALTERNATIVE_getInstance();
    case 'SUBSTITUTION':
      return OverrideKind_SUBSTITUTION_getInstance();
    default:
      OverrideKind_initEntries();
      THROW_IAE('No enum constant value.');
      break;
  }
}
var OverrideKind_entriesInitialized;
function OverrideKind_initEntries() {
  if (OverrideKind_entriesInitialized)
    return Unit_instance;
  OverrideKind_entriesInitialized = true;
  OverrideKind_REPLACE_instance = new OverrideKind('REPLACE', 0);
  OverrideKind_APPEND_ALTERNATIVE_instance = new OverrideKind('APPEND_ALTERNATIVE', 1);
  OverrideKind_SUBSTITUTION_instance = new OverrideKind('SUBSTITUTION', 2);
}
var SeparatedListKind_Flat_instance;
var SeparatedListKind_Left_instance;
var SeparatedListKind_Right_instance;
function values_4() {
  return [SeparatedListKind_Flat_getInstance(), SeparatedListKind_Left_getInstance(), SeparatedListKind_Right_getInstance()];
}
function valueOf_5(value) {
  switch (value) {
    case 'Flat':
      return SeparatedListKind_Flat_getInstance();
    case 'Left':
      return SeparatedListKind_Left_getInstance();
    case 'Right':
      return SeparatedListKind_Right_getInstance();
    default:
      SeparatedListKind_initEntries();
      THROW_IAE('No enum constant value.');
      break;
  }
}
var SeparatedListKind_entriesInitialized;
function SeparatedListKind_initEntries() {
  if (SeparatedListKind_entriesInitialized)
    return Unit_instance;
  SeparatedListKind_entriesInitialized = true;
  SeparatedListKind_Flat_instance = new SeparatedListKind('Flat', 0);
  SeparatedListKind_Left_instance = new SeparatedListKind('Left', 1);
  SeparatedListKind_Right_instance = new SeparatedListKind('Right', 2);
}
function _GrammarRuleName___init__impl__yqiut(value) {
  return value;
}
function _GrammarRuleName___get_value__impl__470s0v($this) {
  return $this;
}
function GrammarRuleName__toString_impl_przz03($this) {
  return _GrammarRuleName___get_value__impl__470s0v($this);
}
function GrammarRuleName__hashCode_impl_40u278($this) {
  return getStringHashCode($this);
}
function GrammarRuleName__equals_impl_smhds0($this, other) {
  if (!(other instanceof GrammarRuleName))
    return false;
  if (!($this === (other instanceof GrammarRuleName ? other.d1u_1 : THROW_CCE())))
    return false;
  return true;
}
function Associativity_LEFT_getInstance() {
  Associativity_initEntries();
  return Associativity_LEFT_instance;
}
function Associativity_RIGHT_getInstance() {
  Associativity_initEntries();
  return Associativity_RIGHT_instance;
}
function ChoiceIndicator_NONE_getInstance() {
  ChoiceIndicator_initEntries();
  return ChoiceIndicator_NONE_instance;
}
function ChoiceIndicator_EMPTY_getInstance() {
  ChoiceIndicator_initEntries();
  return ChoiceIndicator_EMPTY_instance;
}
function ChoiceIndicator_ITEM_getInstance() {
  ChoiceIndicator_initEntries();
  return ChoiceIndicator_ITEM_instance;
}
function ChoiceIndicator_NUMBER_getInstance() {
  ChoiceIndicator_initEntries();
  return ChoiceIndicator_NUMBER_instance;
}
function OverrideKind_REPLACE_getInstance() {
  OverrideKind_initEntries();
  return OverrideKind_REPLACE_instance;
}
function OverrideKind_APPEND_ALTERNATIVE_getInstance() {
  OverrideKind_initEntries();
  return OverrideKind_APPEND_ALTERNATIVE_instance;
}
function OverrideKind_SUBSTITUTION_getInstance() {
  OverrideKind_initEntries();
  return OverrideKind_SUBSTITUTION_instance;
}
function SeparatedListKind_Flat_getInstance() {
  SeparatedListKind_initEntries();
  return SeparatedListKind_Flat_instance;
}
function SeparatedListKind_Left_getInstance() {
  SeparatedListKind_initEntries();
  return SeparatedListKind_Left_instance;
}
function SeparatedListKind_Right_getInstance() {
  SeparatedListKind_initEntries();
  return SeparatedListKind_Right_instance;
}
function grammarModel(name, namespaces, grammarRegistry, init) {
  namespaces = namespaces === VOID ? emptyList() : namespaces;
  grammarRegistry = grammarRegistry === VOID ? null : grammarRegistry;
  var b = new GrammarModelBuilder(_SimpleName___init__impl__6s45d0(name), namespaces);
  init(b);
  var gm = b.build();
  if (grammarRegistry == null)
    null;
  else {
    // Inline function 'kotlin.let' call
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = gm.allDefinitions.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      grammarRegistry.registerGrammar(element);
    }
    var sa = new AglGrammarSemanticAnalyser();
    var opts = new SemanticAnalysisOptionsDefault(VOID, VOID, ContextFromGrammarRegistry(grammarRegistry));
    sa.analyse(null, gm, new LocationMapDefault(), opts);
  }
  return gm;
}
function grammar(namespace, name, init) {
  var ns = new GrammarNamespaceDefault(_QualifiedName___init__impl__8ed982(namespace));
  var b = new GrammarBuilder(ns, _SimpleName___init__impl__6s45d0(name));
  init(b);
  return b.build();
}
function terminal($this, value, isPattern) {
  var t = $this.b38_1.z2(value);
  var tmp;
  if (null == t) {
    var tt = new TerminalDefault(value, isPattern);
    // Inline function 'kotlin.collections.set' call
    $this.b38_1.r2(value, tt);
    tmp = tt;
  } else {
    var tmp_0;
    if (isPattern === t.isPattern) {
      tmp_0 = t;
    } else {
      // Inline function 'kotlin.error' call
      var message = 'Error terminal defined as both pattern and literal!';
      throw IllegalStateException.v4(toString(message));
    }
    tmp = tmp_0;
  }
  return tmp;
}
function createRule($this, grammarRuleName, overrideKind, isSkip, isLeaf, rhs) {
  var tmp;
  if ((overrideKind == null ? -1 : overrideKind.d3_1) === -1) {
    var gr = new NormalRuleDefault($this.a38_1, grammarRuleName, isSkip, isLeaf);
    gr.rhs = rhs;
    tmp = gr;
  } else {
    var gr_0 = new OverrideRuleDefault($this.a38_1, grammarRuleName, isSkip, isLeaf, overrideKind);
    gr_0.overriddenRhs = rhs;
    tmp = gr_0;
  }
  return tmp;
}
function AglGrammar$grammarModel$delegate$lambda() {
  return grammarModel('Grammar', VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda);
}
function AglGrammar$grammarModel$delegate$lambda$lambda($this$grammarModel) {
  $this$grammarModel.namespace('net.akehurst.language', AglGrammar$grammarModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.grammar('Grammar', AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda($this$grammar) {
  $this$grammar.extendsGrammar(AglBase_getInstance().defaultTargetGrammar.selfReference);
  var tmp = OverrideKind_REPLACE_getInstance();
  $this$grammar.concatenation('namespace', tmp, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda);
  $this$grammar.concatenation('grammar', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  $this$grammar.concatenation('extends', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  $this$grammar.choice('rule', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  $this$grammar.concatenation('grammarRule', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  $this$grammar.concatenation('overrideRule', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  $this$grammar.choice('overrideOperator', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  $this$grammar.concatenation('ruleTypeLabels', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  $this$grammar.choice('rhs', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  $this$grammar.empty('empty');
  $this$grammar.choice('choice', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_8);
  $this$grammar.separatedList('ambiguousChoice', 2, -1, VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_9);
  $this$grammar.separatedList('priorityChoice', 2, -1, VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_10);
  $this$grammar.separatedList('simpleChoice', 2, -1, VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_11);
  $this$grammar.list('concatenation', 1, -1, VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_12);
  $this$grammar.choice('concatenationItem', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_13);
  $this$grammar.choice('simpleItemOrGroup', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_14);
  $this$grammar.choice('simpleItem', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_15);
  $this$grammar.choice('listOfItems', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_16);
  $this$grammar.choice('multiplicity', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_17);
  $this$grammar.choice('range', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_18);
  $this$grammar.concatenation('rangeUnBraced', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_19);
  $this$grammar.concatenation('rangeBraced', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_20);
  $this$grammar.choice('rangeMax', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_21);
  $this$grammar.concatenation('rangeMaxUnbounded', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_22);
  $this$grammar.concatenation('rangeMaxBounded', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_23);
  $this$grammar.concatenation('simpleList', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_24);
  $this$grammar.concatenation('separatedList', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_25);
  $this$grammar.concatenation('group', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_26);
  $this$grammar.choice('groupedContent', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_27);
  $this$grammar.concatenation('nonTerminal', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_28);
  $this$grammar.concatenation('embedded', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_29);
  $this$grammar.choice('terminal', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_30);
  $this$grammar.concatenation('LITERAL', VOID, VOID, true, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_31);
  $this$grammar.concatenation('PATTERN', VOID, VOID, true, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_32);
  $this$grammar.concatenation('POSITIVE_INTEGER', VOID, VOID, true, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_33);
  $this$grammar.concatenation('POSITIVE_INTEGER_GT_ZERO', VOID, VOID, true, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_34);
  $this$grammar.concatenation('preferenceRule', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_35);
  $this$grammar.concatenation('preferenceOption', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_36);
  $this$grammar.choice('choiceNumber', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_37);
  $this$grammar.separatedList('terminalList', 1, -1, VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_38);
  $this$grammar.separatedList('spine', 1, -1, VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_39);
  $this$grammar.choice('associativity', VOID, VOID, VOID, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_40);
  $this$grammar.concatenation('CHOICE_INDICATOR', VOID, VOID, true, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_41);
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda($this$concatenation) {
  $this$concatenation.r2t('namespace');
  $this$concatenation.q2t('possiblyQualifiedName');
  $this$concatenation.p2t(0, -1, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda);
  $this$concatenation.p2t(0, -1, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0);
  $this$concatenation.p2t(0, -1, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_1);
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda($this$lst) {
  $this$lst.q2t('option');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0($this$lst) {
  $this$lst.q2t('import');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_1($this$lst) {
  $this$lst.q2t('grammar');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$concatenation) {
  $this$concatenation.r2t('grammar');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.s2t(AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_2);
  $this$concatenation.r2t('{');
  $this$concatenation.p2t(0, -1, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_3);
  $this$concatenation.p2t(1, -1, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_4);
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_2($this$opt) {
  $this$opt.q2t('extends');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_3($this$lst) {
  $this$lst.q2t('option');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_4($this$lst) {
  $this$lst.q2t('rule');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$concatenation) {
  $this$concatenation.r2t(':');
  $this$concatenation.k2w(1, -1, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_5);
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_5($this$spLst) {
  $this$spLst.q2t('possiblyQualifiedName');
  $this$spLst.r2t(',');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$choice) {
  $this$choice.q2t('grammarRule');
  $this$choice.q2t('overrideRule');
  $this$choice.q2t('preferenceRule');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$concatenation) {
  $this$concatenation.q2t('ruleTypeLabels');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.r2t('=');
  $this$concatenation.q2t('rhs');
  $this$concatenation.r2t(';');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$concatenation) {
  $this$concatenation.r2t('override');
  $this$concatenation.q2t('ruleTypeLabels');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.q2t('overrideOperator');
  $this$concatenation.q2t('rhs');
  $this$concatenation.r2t(';');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$choice) {
  $this$choice.r2t('==');
  $this$choice.r2t('=');
  $this$choice.r2t('+=|');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$concatenation) {
  $this$concatenation.s2t(AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_6);
  $this$concatenation.s2t(AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_7);
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_6($this$opt) {
  $this$opt.r2t('skip');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_7($this$opt) {
  $this$opt.r2t('leaf');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$choice) {
  $this$choice.q2t('empty');
  $this$choice.q2t('concatenation');
  $this$choice.q2t('choice');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_8($this$choice) {
  $this$choice.q2t('ambiguousChoice');
  $this$choice.q2t('priorityChoice');
  $this$choice.q2t('simpleChoice');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_9($this$separatedList) {
  $this$separatedList.q2t('concatenation');
  $this$separatedList.r2t('||');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_10($this$separatedList) {
  $this$separatedList.q2t('concatenation');
  $this$separatedList.r2t('<');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_11($this$separatedList) {
  $this$separatedList.q2t('concatenation');
  $this$separatedList.r2t('|');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_12($this$list) {
  $this$list.q2t('concatenationItem');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_13($this$choice) {
  $this$choice.q2t('simpleItemOrGroup');
  $this$choice.q2t('listOfItems');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_14($this$choice) {
  $this$choice.q2t('simpleItem');
  $this$choice.q2t('group');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_15($this$choice) {
  $this$choice.q2t('terminal');
  $this$choice.q2t('nonTerminal');
  $this$choice.q2t('embedded');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_16($this$choice) {
  $this$choice.q2t('simpleList');
  $this$choice.q2t('separatedList');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_17($this$choice) {
  $this$choice.r2t('*');
  $this$choice.r2t('+');
  $this$choice.r2t('?');
  $this$choice.q2t('range');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_18($this$choice) {
  $this$choice.q2t('rangeUnBraced');
  $this$choice.q2t('rangeBraced');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_19($this$concatenation) {
  $this$concatenation.q2t('POSITIVE_INTEGER');
  $this$concatenation.s2t(AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_8);
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_8($this$opt) {
  $this$opt.q2t('rangeMax');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_20($this$concatenation) {
  $this$concatenation.r2t('{');
  $this$concatenation.q2t('POSITIVE_INTEGER');
  $this$concatenation.s2t(AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_9);
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_9($this$opt) {
  $this$opt.q2t('rangeMax');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_21($this$choice) {
  $this$choice.q2t('rangeMaxUnbounded');
  $this$choice.q2t('rangeMaxBounded');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_22($this$concatenation) {
  $this$concatenation.r2t('+');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_23($this$concatenation) {
  $this$concatenation.r2t('..');
  $this$concatenation.q2t('POSITIVE_INTEGER_GT_ZERO');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_24($this$concatenation) {
  $this$concatenation.q2t('simpleItemOrGroup');
  $this$concatenation.q2t('multiplicity');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_25($this$concatenation) {
  $this$concatenation.r2t('[');
  $this$concatenation.q2t('simpleItemOrGroup');
  $this$concatenation.r2t('/');
  $this$concatenation.q2t('simpleItemOrGroup');
  $this$concatenation.r2t(']');
  $this$concatenation.q2t('multiplicity');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_26($this$concatenation) {
  $this$concatenation.r2t('(');
  $this$concatenation.q2t('groupedContent');
  $this$concatenation.r2t(')');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_27($this$choice) {
  $this$choice.q2t('concatenation');
  $this$choice.q2t('choice');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_28($this$concatenation) {
  $this$concatenation.q2t('possiblyQualifiedName');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_29($this$concatenation) {
  $this$concatenation.q2t('possiblyQualifiedName');
  $this$concatenation.r2t('::');
  $this$concatenation.q2t('nonTerminal');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_30($this$choice) {
  $this$choice.q2t('LITERAL');
  $this$choice.q2t('PATTERN');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_31($this$concatenation) {
  $this$concatenation.l2t("'([^'\\\\]|\\\\.)+'");
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_32($this$concatenation) {
  $this$concatenation.l2t('"([^"\\\\]|\\\\.)+"');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_33($this$concatenation) {
  $this$concatenation.l2t('[0-9]+');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_34($this$concatenation) {
  $this$concatenation.l2t('[1-9][0-9]*');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_35($this$concatenation) {
  $this$concatenation.r2t('preference');
  $this$concatenation.q2t('simpleItem');
  $this$concatenation.r2t('{');
  $this$concatenation.p2t(1, -1, AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_10);
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_10($this$lst) {
  $this$lst.q2t('preferenceOption');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_36($this$concatenation) {
  $this$concatenation.q2t('spine');
  $this$concatenation.s2t(AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_11);
  $this$concatenation.r2t('on');
  $this$concatenation.q2t('terminalList');
  $this$concatenation.q2t('associativity');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_11($this$opt) {
  $this$opt.q2t('choiceNumber');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_37($this$choice) {
  $this$choice.o38(AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_12);
  $this$choice.o38(AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_13);
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_12($this$concat) {
  $this$concat.q2t('POSITIVE_INTEGER');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_13($this$concat) {
  $this$concat.q2t('CHOICE_INDICATOR');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_38($this$separatedList) {
  $this$separatedList.q2t('simpleItem');
  $this$separatedList.r2t(',');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_39($this$separatedList) {
  $this$separatedList.q2t('nonTerminal');
  $this$separatedList.r2t('<-');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_40($this$choice) {
  $this$choice.r2t('left');
  $this$choice.r2t('right');
  return Unit_instance;
}
function AglGrammar$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_41($this$concatenation) {
  $this$concatenation.l2t('EMPTY|ITEM');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda() {
  var tmp = AglBase_getInstance().typesModel.namespace;
  return typeModel('Grammar', true, tmp, AglGrammar$typesModel$delegate$lambda$lambda);
}
function AglGrammar$typesModel$delegate$lambda$lambda($this$typeModel) {
  var tmp = listOf_0(['std', 'net.akehurst.language.base.api']);
  grammarTypeNamespace($this$typeModel, 'net.akehurst.language.grammar.api', tmp, VOID, AglGrammar$typesModel$delegate$lambda$lambda$lambda);
  var tmp_0 = listOf_0(['net.akehurst.language.grammar.api', 'std', 'net.akehurst.language.base.api', 'net.akehurst.language.base.asm']);
  $this$typeModel.namespace('net.akehurst.language.grammar.asm', tmp_0, AglGrammar$typesModel$delegate$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda($this$grammarTypeNamespace) {
  $this$grammarTypeNamespace.enum('SeparatedListKind', listOf_0(['Flat', 'Left', 'Right']));
  $this$grammarTypeNamespace.enum('OverrideKind', listOf_0(['REPLACE', 'APPEND_ALTERNATIVE', 'SUBSTITUTION']));
  $this$grammarTypeNamespace.enum('Associativity', listOf_0(['LEFT', 'RIGHT']));
  $this$grammarTypeNamespace.enum('ChoiceIndicator', listOf_0(['NONE', 'EMPTY', 'ITEM', 'NUMBER']));
  $this$grammarTypeNamespace.value('GrammarRuleName', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda);
  $this$grammarTypeNamespace.interface_('Terminal', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_0);
  $this$grammarTypeNamespace.interface_('TangibleItem', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_1);
  $this$grammarTypeNamespace.interface_('Spine', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_2);
  $this$grammarTypeNamespace.interface_('SimpleList', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_3);
  $this$grammarTypeNamespace.interface_('SimpleItem', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_4);
  $this$grammarTypeNamespace.interface_('SeparatedList', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_5);
  $this$grammarTypeNamespace.interface_('RuleItem', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_6);
  $this$grammarTypeNamespace.interface_('PreferenceRule', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_7);
  $this$grammarTypeNamespace.interface_('PreferenceOption', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_8);
  $this$grammarTypeNamespace.interface_('OverrideRule', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_9);
  $this$grammarTypeNamespace.interface_('OptionalItem', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_10);
  $this$grammarTypeNamespace.interface_('NormalRule', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_11);
  $this$grammarTypeNamespace.interface_('NonTerminal', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_12);
  $this$grammarTypeNamespace.interface_('ListOfItems', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_13);
  $this$grammarTypeNamespace.interface_('Group', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_14);
  $this$grammarTypeNamespace.t38('grammarRule', 'GrammarRule', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_15);
  $this$grammarTypeNamespace.interface_('GrammarReference', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_16);
  $this$grammarTypeNamespace.interface_('GrammarNamespace', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_17);
  $this$grammarTypeNamespace.interface_('GrammarModel', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_18);
  $this$grammarTypeNamespace.interface_('GrammarItem', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_19);
  $this$grammarTypeNamespace.interface_('Grammar', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_20);
  $this$grammarTypeNamespace.interface_('EmptyRule', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_21);
  $this$grammarTypeNamespace.interface_('Embedded', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_22);
  $this$grammarTypeNamespace.interface_('ConcatenationItem', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_23);
  $this$grammarTypeNamespace.interface_('Concatenation', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_24);
  $this$grammarTypeNamespace.interface_('ChoicePriority', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_25);
  $this$grammarTypeNamespace.interface_('ChoiceLongest', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_26);
  $this$grammarTypeNamespace.interface_('ChoiceAmbiguous', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_27);
  $this$grammarTypeNamespace.interface_('Choice', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_28);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda($this$value) {
  $this$value.supertype('PublicValueType');
  $this$value.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda);
  $this$value.propertyOf(setOf_0([$this$value.VAL, $this$value.REF, $this$value.STR]), 'value', 'String', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda($this$constructor_) {
  $this$constructor_.parameter('value', 'String', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_0($this$interface_) {
  $this$interface_.supertype('TangibleItem');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_1($this$interface_) {
  $this$interface_.supertype('SimpleItem');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_2($this$interface_) {
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_3($this$interface_) {
  $this$interface_.supertype('ListOfItems');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_4($this$interface_) {
  $this$interface_.supertype('ConcatenationItem');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_5($this$interface_) {
  $this$interface_.supertype('ListOfItems');
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'separator', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_6($this$interface_) {
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_7($this$interface_) {
  $this$interface_.supertype('GrammarItem');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'optionList', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$propertyOf) {
  $this$propertyOf.typeArgument('PreferenceOption');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_8($this$interface_) {
  $this$interface_.supertype('Formatable');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_9($this$interface_) {
  $this$interface_.supertype('GrammarRule');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_10($this$interface_) {
  $this$interface_.supertype('ConcatenationItem');
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'item', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_11($this$interface_) {
  $this$interface_.supertype('GrammarRule');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_12($this$interface_) {
  $this$interface_.supertype('TangibleItem');
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'targetGrammar', 'GrammarReference', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_13($this$interface_) {
  $this$interface_.supertype('ConcatenationItem');
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'item', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_14($this$interface_) {
  $this$interface_.supertype('SimpleItem');
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'groupedContent', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_15($this$interfaceFor) {
  $this$interfaceFor.supertype('GrammarItem');
  $this$interfaceFor.propertyOf(setOf_0([$this$interfaceFor.VAL, $this$interfaceFor.CMP, $this$interfaceFor.STR]), 'rhs', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_16($this$interface_) {
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_17($this$interface_) {
  $this$interface_.supertype('Namespace', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$supertype) {
  $this$supertype.ref('Grammar');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_18($this$interface_) {
  $this$interface_.supertype('Model', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$supertype) {
  $this$supertype.ref('GrammarNamespace');
  $this$supertype.ref('Grammar');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_19($this$interface_) {
  $this$interface_.supertype('Formatable');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_20($this$interface_) {
  $this$interface_.supertype('Definition', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'extends', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  var tmp_0 = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp_0, 'grammarRule', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  var tmp_1 = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp_1, 'preferenceRule', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$supertype) {
  $this$supertype.ref('Grammar');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$propertyOf) {
  $this$propertyOf.typeArgument('GrammarReference');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$propertyOf) {
  $this$propertyOf.typeArgument('GrammarRule');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$propertyOf) {
  $this$propertyOf.typeArgument('PreferenceRule');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_21($this$interface_) {
  $this$interface_.supertype('TangibleItem');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_22($this$interface_) {
  $this$interface_.supertype('TangibleItem');
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'embeddedGrammarReference', 'GrammarReference', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_23($this$interface_) {
  $this$interface_.supertype('RuleItem');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_24($this$interface_) {
  $this$interface_.supertype('RuleItem');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'items', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$propertyOf) {
  $this$propertyOf.typeArgument('RuleItem');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_25($this$interface_) {
  $this$interface_.supertype('Choice');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_26($this$interface_) {
  $this$interface_.supertype('Choice');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_27($this$interface_) {
  $this$interface_.supertype('Choice');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_28($this$interface_) {
  $this$interface_.supertype('RuleItem');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'alternative', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_8);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_8($this$propertyOf) {
  $this$propertyOf.typeArgument('RuleItem');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda_0($this$namespace) {
  $this$namespace.data('TerminalDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_29);
  $this$namespace.data('TangibleItemAbstract', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_30);
  $this$namespace.data('SpineDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_31);
  $this$namespace.data('SimpleListDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_32);
  $this$namespace.data('SimpleItemAbstract', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_33);
  $this$namespace.data('SeparatedListDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_34);
  $this$namespace.data('RuleItemAbstract', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_35);
  $this$namespace.data('PreferenceRuleDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_36);
  $this$namespace.data('PreferenceOptionDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_37);
  $this$namespace.data('OverrideRuleDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_38);
  $this$namespace.data('OptionalItemDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_39);
  $this$namespace.data('NormalRuleDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_40);
  $this$namespace.data('NonTerminalDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_41);
  $this$namespace.data('ListOfItemsAbstract', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_42);
  $this$namespace.data('GroupDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_43);
  $this$namespace.data('GrammarRuleAbstract', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_44);
  $this$namespace.data('GrammarReferenceDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_45);
  $this$namespace.data('GrammarNamespaceDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_46);
  $this$namespace.data('GrammarModelDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_47);
  $this$namespace.data('GrammarItemAbstract', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_48);
  $this$namespace.data('GrammarDefaultKt', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_49);
  $this$namespace.data('GrammarDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_50);
  $this$namespace.data('GrammarAbstract', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_51);
  $this$namespace.data('EmptyRuleDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_52);
  $this$namespace.data('EmbeddedDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_53);
  $this$namespace.data('ConcatenationItemAbstract', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_54);
  $this$namespace.data('ConcatenationDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_55);
  $this$namespace.data('ChoicePriorityDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_56);
  $this$namespace.data('ChoiceLongestDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_57);
  $this$namespace.data('ChoiceAmbiguousDefault', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_58);
  $this$namespace.data('ChoiceAbstract', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_59);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_29($this$data) {
  $this$data.supertype('TangibleItemAbstract');
  $this$data.supertype('Terminal');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_9);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'id', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'isPattern', 'Boolean', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'value', 'String', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_9($this$constructor_) {
  $this$constructor_.parameter('value', 'String', false);
  $this$constructor_.parameter('isPattern', 'Boolean', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_30($this$data) {
  $this$data.supertype('SimpleItemAbstract');
  $this$data.supertype('TangibleItem');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_10);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_10($this$constructor_) {
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_31($this$data) {
  $this$data.supertype('Spine');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_11);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'parts', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_12);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_11($this$constructor_) {
  $this$constructor_.parameter('parts', 'List', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_12($this$propertyOf) {
  $this$propertyOf.typeArgument('NonTerminal');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_32($this$data) {
  $this$data.supertype('ListOfItemsAbstract');
  $this$data.supertype('SimpleList');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_13);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'item', 'RuleItem', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'max', 'Integer', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'min', 'Integer', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_13($this$constructor_) {
  $this$constructor_.parameter('min', 'Integer', false);
  $this$constructor_.parameter('max', 'Integer', false);
  $this$constructor_.parameter('item', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_33($this$data) {
  $this$data.supertype('ConcatenationItemAbstract');
  $this$data.supertype('SimpleItem');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_14);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_14($this$constructor_) {
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_34($this$data) {
  $this$data.supertype('ListOfItemsAbstract');
  $this$data.supertype('SeparatedList');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_15);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'item', 'RuleItem', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'max', 'Integer', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'min', 'Integer', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'separator', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_15($this$constructor_) {
  $this$constructor_.parameter('min', 'Integer', false);
  $this$constructor_.parameter('max', 'Integer', false);
  $this$constructor_.parameter('item', 'RuleItem', false);
  $this$constructor_.parameter('separator', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_35($this$data) {
  $this$data.supertype('RuleItem');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_16);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'index', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_17);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_16($this$constructor_) {
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_17($this$propertyOf) {
  $this$propertyOf.typeArgument('Integer');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_36($this$data) {
  $this$data.supertype('GrammarItemAbstract');
  $this$data.supertype('PreferenceRule');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_18);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'forItem', 'SimpleItem', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'grammar', 'Grammar', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'optionList', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_19);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_18($this$constructor_) {
  $this$constructor_.parameter('grammar', 'Grammar', false);
  $this$constructor_.parameter('forItem', 'SimpleItem', false);
  $this$constructor_.parameter('optionList', 'List', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_19($this$propertyOf) {
  $this$propertyOf.typeArgument('PreferenceOption');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_37($this$data) {
  $this$data.supertype('PreferenceOption');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_20);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'associativity', 'Associativity', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'choiceIndicator', 'ChoiceIndicator', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'choiceNumber', 'Integer', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'onTerminals', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_21);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'spine', 'Spine', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_20($this$constructor_) {
  $this$constructor_.parameter('spine', 'Spine', false);
  $this$constructor_.parameter('choiceIndicator', 'ChoiceIndicator', false);
  $this$constructor_.parameter('choiceNumber', 'Integer', false);
  $this$constructor_.parameter('onTerminals', 'List', false);
  $this$constructor_.parameter('associativity', 'Associativity', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_21($this$propertyOf) {
  $this$propertyOf.typeArgument('SimpleItem');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_38($this$data) {
  $this$data.supertype('GrammarRuleAbstract');
  $this$data.supertype('OverrideRule');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_22);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'grammar', 'Grammar', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'isLeaf', 'Boolean', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'isOverride', 'Boolean', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'isSkip', 'Boolean', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'GrammarRuleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'overrideKind', 'OverrideKind', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'rhs', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_22($this$constructor_) {
  $this$constructor_.parameter('grammar', 'Grammar', false);
  $this$constructor_.parameter('name', 'GrammarRuleName', false);
  $this$constructor_.parameter('isSkip', 'Boolean', false);
  $this$constructor_.parameter('isLeaf', 'Boolean', false);
  $this$constructor_.parameter('overrideKind', 'OverrideKind', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_39($this$data) {
  $this$data.supertype('ConcatenationItemAbstract');
  $this$data.supertype('OptionalItem');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_23);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'item', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_23($this$constructor_) {
  $this$constructor_.parameter('item', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_40($this$data) {
  $this$data.supertype('GrammarRuleAbstract');
  $this$data.supertype('NormalRule');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_24);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'grammar', 'Grammar', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'isLeaf', 'Boolean', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'isOverride', 'Boolean', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'isSkip', 'Boolean', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'GrammarRuleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]), 'rhs', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_24($this$constructor_) {
  $this$constructor_.parameter('grammar', 'Grammar', false);
  $this$constructor_.parameter('name', 'GrammarRuleName', false);
  $this$constructor_.parameter('isSkip', 'Boolean', false);
  $this$constructor_.parameter('isLeaf', 'Boolean', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_41($this$data) {
  $this$data.supertype('TangibleItemAbstract');
  $this$data.supertype('NonTerminal');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_25);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'ruleReference', 'GrammarRuleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'targetGrammar', 'GrammarReference', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_25($this$constructor_) {
  $this$constructor_.parameter('targetGrammar', 'GrammarReference', false);
  $this$constructor_.parameter('ruleReference', 'GrammarRuleName', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_42($this$data) {
  $this$data.supertype('ConcatenationItemAbstract');
  $this$data.supertype('ListOfItems');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_26);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_26($this$constructor_) {
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_43($this$data) {
  $this$data.supertype('SimpleItemAbstract');
  $this$data.supertype('Group');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_27);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'groupedContent', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_27($this$constructor_) {
  $this$constructor_.parameter('groupedContent', 'RuleItem', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_44($this$data) {
  $this$data.supertype('GrammarItemAbstract');
  $this$data.supertype('GrammarRule');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_28);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_28($this$constructor_) {
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_45($this$data) {
  $this$data.supertype('GrammarReference');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_29);
  var tmp = setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'localNamespace', 'Namespace', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_30);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'nameOrQName', 'PossiblyQualifiedName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]), 'resolved', 'Grammar', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_29($this$constructor_) {
  $this$constructor_.parameter('localNamespace', 'Namespace', false);
  $this$constructor_.parameter('nameOrQName', 'PossiblyQualifiedName', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_30($this$propertyOf) {
  $this$propertyOf.typeArgument('Grammar');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_46($this$data) {
  $this$data.supertype('GrammarNamespace');
  $this$data.supertype('NamespaceAbstract', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_31);
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_32);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'qualifiedName', 'QualifiedName', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_31($this$supertype) {
  $this$supertype.ref('net.akehurst.language.grammar.api.Grammar');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_32($this$constructor_) {
  $this$constructor_.parameter('qualifiedName', 'QualifiedName', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  $this$constructor_.parameter('import', 'List', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_47($this$data) {
  $this$data.supertype('GrammarModel');
  $this$data.supertype('ModelAbstract', AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_33);
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_34);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_33($this$supertype) {
  $this$supertype.ref('net.akehurst.language.grammar.api.GrammarNamespace');
  $this$supertype.ref('net.akehurst.language.grammar.api.Grammar');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_34($this$constructor_) {
  $this$constructor_.parameter('name', 'SimpleName', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  $this$constructor_.parameter('namespace', 'List', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_48($this$data) {
  $this$data.supertype('GrammarItem');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_35);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_35($this$constructor_) {
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_49($this$data) {
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_50($this$data) {
  $this$data.supertype('GrammarAbstract');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_36);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_36($this$constructor_) {
  $this$constructor_.parameter('namespace', 'GrammarNamespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_51($this$data) {
  $this$data.supertype('Grammar');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_37);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'extends', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_38);
  var tmp_0 = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp_0, 'grammarRule', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_39);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'GrammarNamespace', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'options', 'OptionHolder', false);
  var tmp_1 = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp_1, 'preferenceRule', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_40);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_37($this$constructor_) {
  $this$constructor_.parameter('namespace', 'GrammarNamespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_38($this$propertyOf) {
  $this$propertyOf.typeArgument('GrammarReference');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_39($this$propertyOf) {
  $this$propertyOf.typeArgument('GrammarRule');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_40($this$propertyOf) {
  $this$propertyOf.typeArgument('PreferenceRule');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_52($this$data) {
  $this$data.supertype('TangibleItemAbstract');
  $this$data.supertype('EmptyRule');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_41);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_41($this$constructor_) {
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_53($this$data) {
  $this$data.supertype('TangibleItemAbstract');
  $this$data.supertype('Embedded');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_42);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'embeddedGoalName', 'GrammarRuleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'embeddedGrammarReference', 'GrammarReference', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_42($this$constructor_) {
  $this$constructor_.parameter('embeddedGoalName', 'GrammarRuleName', false);
  $this$constructor_.parameter('embeddedGrammarReference', 'GrammarReference', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_54($this$data) {
  $this$data.supertype('RuleItemAbstract');
  $this$data.supertype('ConcatenationItem');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_43);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_43($this$constructor_) {
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_55($this$data) {
  $this$data.supertype('RuleItemAbstract');
  $this$data.supertype('Concatenation');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_44);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'items', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_45);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_44($this$constructor_) {
  $this$constructor_.parameter('items', 'List', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_45($this$propertyOf) {
  $this$propertyOf.typeArgument('RuleItem');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_56($this$data) {
  $this$data.supertype('ChoiceAbstract');
  $this$data.supertype('ChoicePriority');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_46);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'alternative', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_47);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_46($this$constructor_) {
  $this$constructor_.parameter('alternative', 'List', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_47($this$propertyOf) {
  $this$propertyOf.typeArgument('RuleItem');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_57($this$data) {
  $this$data.supertype('ChoiceAbstract');
  $this$data.supertype('ChoiceLongest');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_48);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'alternative', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_49);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_48($this$constructor_) {
  $this$constructor_.parameter('alternative', 'List', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_49($this$propertyOf) {
  $this$propertyOf.typeArgument('RuleItem');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_58($this$data) {
  $this$data.supertype('ChoiceAbstract');
  $this$data.supertype('ChoiceAmbiguous');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_50);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'alternative', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_51);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_50($this$constructor_) {
  $this$constructor_.parameter('alternative', 'List', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_51($this$propertyOf) {
  $this$propertyOf.typeArgument('RuleItem');
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda_59($this$data) {
  $this$data.supertype('RuleItemAbstract');
  $this$data.supertype('Choice');
  $this$data.constructor_(AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_52);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'alternative', 'List', false, AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_53);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_52($this$constructor_) {
  $this$constructor_.parameter('alternative', 'List', false);
  return Unit_instance;
}
function AglGrammar$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_53($this$propertyOf) {
  $this$propertyOf.typeArgument('RuleItem');
  return Unit_instance;
}
function AglGrammar$asmTransformModel$delegate$lambda() {
  var tmp = AglGrammar_getInstance().typesModel;
  return asmTransform('Grammar', tmp, false, AglGrammar$asmTransformModel$delegate$lambda$lambda);
}
function AglGrammar$asmTransformModel$delegate$lambda$lambda($this$asmTransform) {
  $this$asmTransform.namespace('net.akehurst.language', AglGrammar$asmTransformModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglGrammar$asmTransformModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.transform('Grammar', AglGrammar$asmTransformModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglGrammar$asmTransformModel$delegate$lambda$lambda$lambda$lambda($this$transform) {
  $this$transform.importTypes(['net.akehurst.language.grammar.api', 'net.akehurst.language.grammar.asm']);
  $this$transform.createObject('unit', 'GrammarModel', AglGrammar$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglGrammar$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda($this$createObject) {
  return Unit_instance;
}
function AglGrammar$crossReferenceModel$delegate$lambda() {
  return crossReferenceModel('Grammar', AglGrammar$crossReferenceModel$delegate$lambda$lambda);
}
function AglGrammar$crossReferenceModel$delegate$lambda$lambda($this$crossReferenceModel) {
  return Unit_instance;
}
function AglGrammar$formatModel$delegate$lambda() {
  return formatModel('Base', AglGrammar$formatModel$delegate$lambda$lambda);
}
function AglGrammar$formatModel$delegate$lambda$lambda($this$formatModel) {
  return Unit_instance;
}
function AglGrammar$styleModel$delegate$lambda() {
  return styleModel('Grammar', AglGrammar$styleModel$delegate$lambda$lambda);
}
function AglGrammar$styleModel$delegate$lambda$lambda($this$styleModel) {
  $this$styleModel.namespace('net.akehurst.language', AglGrammar$styleModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglGrammar$styleModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.styles('Grammar', AglGrammar$styleModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglGrammar$styleModel$delegate$lambda$lambda$lambda$lambda($this$styles) {
  $this$styles.metaRule("'[^']+'", AglGrammar$styleModel$delegate$lambda$lambda$lambda$lambda$lambda);
  $this$styles.tagRule(['LITERAL'], AglGrammar$styleModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  $this$styles.tagRule(['PATTERN'], AglGrammar$styleModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  $this$styles.tagRule(['IDENTIFIER'], AglGrammar$styleModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  $this$styles.tagRule(['SINGLE_LINE_COMMENT', 'MULTI_LINE_COMMENT'], AglGrammar$styleModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  return Unit_instance;
}
function AglGrammar$styleModel$delegate$lambda$lambda$lambda$lambda$lambda($this$metaRule) {
  $this$metaRule.declaration('foreground', 'darkgreen');
  $this$metaRule.declaration('font-weight', 'bold');
  return Unit_instance;
}
function AglGrammar$styleModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$tagRule) {
  $this$tagRule.declaration('foreground', 'blue');
  return Unit_instance;
}
function AglGrammar$styleModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$tagRule) {
  $this$tagRule.declaration('foreground', 'darkblue');
  return Unit_instance;
}
function AglGrammar$styleModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$tagRule) {
  $this$tagRule.declaration('foreground', 'darkred');
  $this$tagRule.declaration('font-style', 'italic');
  return Unit_instance;
}
function AglGrammar$styleModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$tagRule) {
  $this$tagRule.declaration('foreground', 'LightSlateGrey');
  return Unit_instance;
}
function AglGrammar$defaultTargetGrammar$delegate$lambda() {
  return ensureNotNull(AglGrammar_getInstance().grammarModel.findDefinitionByQualifiedNameOrNull(_QualifiedName___init__impl__8ed982('net.akehurst.language.Grammar')));
}
function AglGrammar$syntaxAnalyser$delegate$lambda() {
  return new AglGrammarSyntaxAnalyser();
}
function AglGrammar$semanticAnalyser$delegate$lambda() {
  return new AglGrammarSemanticAnalyser();
}
function AglGrammar$completionProvider$delegate$lambda() {
  return new AglGrammarCompletionProvider();
}
var AglGrammar_instance;
function AglGrammar_getInstance() {
  if (AglGrammar_instance === VOID)
    new AglGrammar_0();
  return AglGrammar_instance;
}
function grammarModel$factory_4() {
  return getPropertyCallableRef('grammarModel', 1, KProperty1, (receiver) => receiver.grammarModel, null);
}
function typesModel$factory_2() {
  return getPropertyCallableRef('typesModel', 1, KProperty1, (receiver) => receiver.typesModel, null);
}
function asmTransformModel$factory_2() {
  return getPropertyCallableRef('asmTransformModel', 1, KProperty1, (receiver) => receiver.asmTransformModel, null);
}
function crossReferenceModel$factory_3() {
  return getPropertyCallableRef('crossReferenceModel', 1, KProperty1, (receiver) => receiver.crossReferenceModel, null);
}
function formatModel$factory_3() {
  return getPropertyCallableRef('formatModel', 1, KProperty1, (receiver) => receiver.formatModel, null);
}
function styleModel$factory_2() {
  return getPropertyCallableRef('styleModel', 1, KProperty1, (receiver) => receiver.styleModel, null);
}
function defaultTargetGrammar$factory_2() {
  return getPropertyCallableRef('defaultTargetGrammar', 1, KProperty1, (receiver) => receiver.defaultTargetGrammar, null);
}
function syntaxAnalyser$factory_3() {
  return getPropertyCallableRef('syntaxAnalyser', 1, KProperty1, (receiver) => receiver.syntaxAnalyser, null);
}
function semanticAnalyser$factory_3() {
  return getPropertyCallableRef('semanticAnalyser', 1, KProperty1, (receiver) => receiver.semanticAnalyser, null);
}
function completionProvider$factory_3() {
  return getPropertyCallableRef('completionProvider', 1, KProperty1, (receiver) => receiver.completionProvider, null);
}
function AglGrammarSemanticAnalyser$Companion$findGrammarOrNull$lambda(itemTypeName) {
  return true;
}
var Companion_instance_20;
function Companion_getInstance_22() {
  return Companion_instance_20;
}
function issueWarn($this, item, message, data) {
  var tmp0_safe_receiver = $this.a39_1;
  var location = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.get(item);
  $this.y38_1.warn(location, message, data);
}
function issueError($this, item, message, data) {
  var tmp0_safe_receiver = $this.a39_1;
  var location = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.get(item);
  $this.y38_1.error(location, message, data);
}
function checkGrammar($this, context, grammarList, automatonKind) {
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = grammarList.namespace.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = element.definition.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      resolveGrammarRefs($this, context, element_0);
      analyseGrammar($this, context, element_0);
      checkRuleUsage($this, element_0);
      checkForDuplicates($this, element_0);
      checkPreferenceRules($this, element_0);
      if ($this.y38_1.errors.a1() && $this.b39_1) {
        checkForAmbiguities($this, element_0, automatonKind);
      }
    }
  }
}
function resolveGrammarRefs($this, context, grammar) {
  checkGrammarExistsAndResolve($this, context, grammar.extends);
  checkGrammarExistsAndResolve($this, context, grammar.allGrammarReferencesInRules);
}
function checkGrammarExistsAndResolve($this, context, refs) {
  var _iterator__ex2g4s = refs.s();
  while (_iterator__ex2g4s.t()) {
    var it = _iterator__ex2g4s.u();
    checkGrammarExistsAndResolve_0($this, context, it);
  }
}
function checkGrammarExistsAndResolve_0($this, context, ref) {
  var tmp;
  if (context == null) {
    tmp = null;
  } else {
    // Inline function 'kotlin.let' call
    tmp = Companion_instance_20.findGrammarOrNull(context, ref.localNamespace.qualifiedName, ref.nameOrQName);
  }
  var g = tmp;
  if (null == g) {
    issueError($this, ref, "Grammar '" + toString(ref.nameOrQName) + "' not found", null);
  } else {
    ref.resolveAs(g);
  }
}
function checkRuleUsage($this, grammar) {
  var tmp0_safe_receiver = $this.c39_1.z2(grammar);
  if (tmp0_safe_receiver == null)
    null;
  else {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = tmp0_safe_receiver.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (!isInterface(element, OverrideRule)) {
        issueWarn($this, element, "Rule '" + GrammarRuleName__toString_impl_przz03(element.name) + "' is not used in grammar " + SimpleName__toString_impl_vxsxyc(grammar.name) + '.', null);
      }
    }
  }
}
function recordUnusedRule($this, grammar, rule) {
  var set = $this.c39_1.z2(grammar);
  if (set == null)
    null;
  else
    set.r(rule);
}
function analyseGrammar($this, context, grammar) {
  var tmp0 = $this.c39_1;
  // Inline function 'kotlin.collections.mutableSetOf' call
  // Inline function 'kotlin.collections.set' call
  var value = LinkedHashSet.b1();
  tmp0.r2(grammar, value);
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = grammar.grammarRule.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    if (!element.isSkip) {
      recordUnusedRule($this, grammar, element);
    }
  }
  var tmp0_safe_receiver = $this.c39_1.z2(grammar);
  if (tmp0_safe_receiver == null)
    null;
  else {
    var tmp5 = grammar.grammarRule;
    var tmp$ret$5;
    $l$block: {
      // Inline function 'kotlin.collections.first' call
      var _iterator__ex2g4s_0 = tmp5.s();
      while (_iterator__ex2g4s_0.t()) {
        var element_0 = _iterator__ex2g4s_0.u();
        if (!element_0.isSkip) {
          tmp$ret$5 = element_0;
          break $l$block;
        }
      }
      throw NoSuchElementException.h('Collection contains no element matching the predicate.');
    }
    tmp0_safe_receiver.k2(tmp$ret$5);
  }
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s_1 = grammar.grammarRule.s();
  while (_iterator__ex2g4s_1.t()) {
    var element_1 = _iterator__ex2g4s_1.u();
    if (isInterface(element_1, NormalRule)) {
      analyseRuleItem($this, context, grammar, element_1.rhs);
    } else {
      if (isInterface(element_1, OverrideRule)) {
        var overridden = grammar.findAllSuperGrammarRule(element_1.name);
        if (overridden.a1()) {
          issueError($this, element_1, "Rule '" + GrammarRuleName__toString_impl_przz03(element_1.name) + "' is defined as override, but no rule with same name is found in extended grammars of '" + SimpleName__toString_impl_vxsxyc(grammar.name) + "'", null);
        } else {
          analyseRuleItem($this, context, grammar, element_1.rhs);
        }
      }
    }
  }
}
function checkForDuplicates($this, grammar) {
  // Inline function 'kotlin.collections.mutableMapOf' call
  var rules1 = LinkedHashMap.l4();
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = grammar.grammarRule.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var list = rules1.z2(new GrammarRuleName(element.name));
    if (null == list) {
      var tmp1 = new GrammarRuleName(element.name);
      // Inline function 'kotlin.collections.set' call
      var value = mutableListOf([element]);
      rules1.r2(tmp1, value);
    } else {
      list.r(element);
    }
  }
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s_0 = rules1.v2().s();
  while (_iterator__ex2g4s_0.t()) {
    var element_0 = _iterator__ex2g4s_0.u();
    if (1 < element_0.v()) {
      var r = last(element_0);
      issueError($this, r, "More than one rule named '" + GrammarRuleName__toString_impl_przz03(r.name) + "' found in grammar '" + SimpleName__toString_impl_vxsxyc(grammar.name) + "'", null);
    }
  }
  // Inline function 'kotlin.collections.mutableMapOf' call
  var rules2 = LinkedHashMap.l4();
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s_1 = grammar.allInheritedResolvedGrammarRule.s();
  while (_iterator__ex2g4s_1.t()) {
    var element_1 = _iterator__ex2g4s_1.u();
    var set = rules2.z2(new GrammarRuleName(element_1.name));
    if (null == set) {
      var tmp1_0 = new GrammarRuleName(element_1.name);
      // Inline function 'kotlin.collections.set' call
      var value_0 = mutableSetOf([element_1]);
      rules2.r2(tmp1_0, value_0);
    } else {
      set.r(element_1);
    }
  }
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s_2 = grammar.grammarRule.s();
  while (_iterator__ex2g4s_2.t()) {
    var element_2 = _iterator__ex2g4s_2.u();
    var set_0 = rules2.z2(new GrammarRuleName(element_2.name));
    if (null == set_0) {
      var tmp1_1 = new GrammarRuleName(element_2.name);
      // Inline function 'kotlin.collections.set' call
      var value_1 = mutableSetOf([element_2]);
      rules2.r2(tmp1_1, value_1);
    } else {
      set_0.r(element_2);
    }
  }
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s_3 = rules2.v2().s();
  while (_iterator__ex2g4s_3.t()) {
    var element_3 = _iterator__ex2g4s_3.u();
    if (1 < element_3.v()) {
      var tmp$ret$14;
      $l$block: {
        // Inline function 'kotlin.collections.firstOrNull' call
        var _iterator__ex2g4s_4 = element_3.s();
        while (_iterator__ex2g4s_4.t()) {
          var element_4 = _iterator__ex2g4s_4.u();
          var tmp;
          if (isInterface(element_4, OverrideRule)) {
            tmp = grammar === element_4.grammar;
          } else {
            tmp = false;
          }
          if (tmp) {
            tmp$ret$14 = element_4;
            break $l$block;
          }
        }
        tmp$ret$14 = null;
      }
      var or = tmp$ret$14;
      if (or == null) {
        // Inline function 'kotlin.collections.forEach' call
        var _iterator__ex2g4s_5 = element_3.s();
        while (_iterator__ex2g4s_5.t()) {
          var element_5 = _iterator__ex2g4s_5.u();
          issueError($this, element_5, "More than one rule named '" + GrammarRuleName__toString_impl_przz03(element_5.name) + "' found in grammar '" + SimpleName__toString_impl_vxsxyc(grammar.name) + "'", null);
        }
      }
    }
  }
}
function analyseRuleItem($this, context, grammar, rhs) {
  if (!isInterface(rhs, EmptyRule)) {
    if (!isInterface(rhs, Terminal)) {
      if (isInterface(rhs, Embedded)) {
        checkGrammarExistsAndResolve_0($this, context, rhs.embeddedGrammarReference);
      } else {
        if (isInterface(rhs, Concatenation)) {
          // Inline function 'kotlin.collections.forEach' call
          var _iterator__ex2g4s = rhs.items.s();
          while (_iterator__ex2g4s.t()) {
            var element = _iterator__ex2g4s.u();
            analyseRuleItem($this, context, grammar, element);
          }
        } else {
          if (isInterface(rhs, Choice)) {
            // Inline function 'kotlin.collections.forEach' call
            var _iterator__ex2g4s_0 = rhs.alternative.s();
            while (_iterator__ex2g4s_0.t()) {
              var element_0 = _iterator__ex2g4s_0.u();
              analyseRuleItem($this, context, grammar, element_0);
            }
          } else {
            if (isInterface(rhs, Group)) {
              analyseRuleItem($this, context, grammar, rhs.groupedContent);
            } else {
              if (isInterface(rhs, OptionalItem)) {
                analyseRuleItem($this, context, grammar, rhs.item);
              } else {
                if (isInterface(rhs, SimpleList)) {
                  analyseRuleItem($this, context, grammar, rhs.item);
                } else {
                  if (isInterface(rhs, SeparatedList)) {
                    analyseRuleItem($this, context, grammar, rhs.item);
                    analyseRuleItem($this, context, grammar, rhs.separator);
                  } else {
                    if (isInterface(rhs, NonTerminal)) {
                      var tmp1_safe_receiver = rhs.targetGrammar;
                      if (tmp1_safe_receiver == null)
                        null;
                      else {
                        // Inline function 'kotlin.let' call
                        checkGrammarExistsAndResolve_0($this, context, tmp1_safe_receiver);
                      }
                      var tmp;
                      if (null == rhs.targetGrammar) {
                        tmp = grammar.findAllResolvedGrammarRule(rhs.ruleReference);
                      } else {
                        var tmp2_safe_receiver = rhs.targetGrammar;
                        var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.resolved;
                        tmp = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.findAllResolvedGrammarRule(rhs.ruleReference);
                      }
                      var rule = tmp;
                      if (null == rule) {
                        issueError($this, rhs, "GrammarRule '" + GrammarRuleName__toString_impl_przz03(rhs.ruleReference) + "' not found in grammar '" + SimpleName__toString_impl_vxsxyc(grammar.name) + "'", null);
                      } else {
                        var tmp4_safe_receiver = $this.c39_1.z2(grammar);
                        if (tmp4_safe_receiver == null)
                          null;
                        else
                          tmp4_safe_receiver.k2(rule);
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
function checkPreferenceRules($this, grammar) {
  var _iterator__ex2g4s = grammar.preferenceRule.s();
  while (_iterator__ex2g4s.t()) {
    var pr = _iterator__ex2g4s.u();
    var _iterator__ex2g4s_0 = pr.optionList.s();
    while (_iterator__ex2g4s_0.t()) {
      var po = _iterator__ex2g4s_0.u();
      var _iterator__ex2g4s_1 = po.spine.parts.s();
      while (_iterator__ex2g4s_1.t()) {
        var part = _iterator__ex2g4s_1.u();
        var refRuleRhs = part.referencedRule(grammar).rhs;
        if (isInterface(refRuleRhs, Choice)) {
          if (!po.choiceIndicator.equals(ChoiceIndicator_NUMBER_getInstance()))
            if (po.choiceNumber < 0) {
              issueError($this, po, "Preference option for Choice Rule '" + _GrammarRuleName___get_value__impl__470s0v(part.ruleReference) + "' must have a valid choice number {NUMBER}", null);
            }
        } else {
          if (isInterface(refRuleRhs, SimpleList)) {
            if (!po.choiceIndicator.equals(ChoiceIndicator_NUMBER_getInstance()))
              if (!po.choiceIndicator.equals(ChoiceIndicator_ITEM_getInstance())) {
                issueError($this, po, "Preference option for List(Simple) Rule '" + _GrammarRuleName___get_value__impl__470s0v(part.ruleReference) + "' must have a valid option indicator {EMPTY,ITEM}", null);
              }
          } else {
            if (isInterface(refRuleRhs, SeparatedList)) {
              if (!po.choiceIndicator.equals(ChoiceIndicator_NUMBER_getInstance()))
                if (!po.choiceIndicator.equals(ChoiceIndicator_ITEM_getInstance())) {
                  issueError($this, po, "Preference option for List(Separated) Rule '" + _GrammarRuleName___get_value__impl__470s0v(part.ruleReference) + "' must have a valid option indicator {EMPTY,ITEM}", null);
                }
            } else {
              if (!po.choiceIndicator.equals(ChoiceIndicator_NONE_getInstance()))
                if (po.choiceNumber >= 0) {
                  issueError($this, po, "Preference option for Rule '" + _GrammarRuleName___get_value__impl__470s0v(part.ruleReference) + "' must have no option indicator {NONE}", null);
                }
            }
          }
        }
      }
    }
  }
}
function checkForAmbiguities($this, grammar, automatonKind) {
  var conv = new ConverterToRuntimeRules(grammar);
  var rrs = conv.jr();
  var goalRuleName = _GrammarRuleName___get_value__impl__470s0v(grammar.defaultGoalRule.name);
  var automaton = rrs.automatonFor(goalRuleName, automatonKind);
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = (automaton instanceof ParserStateSet ? automaton : THROW_CCE()).allBuiltStates.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var trans = element.outTransitions.allBuiltTransitions;
    if (trans.v() > 1) {
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s_0 = trans.s();
      while (_iterator__ex2g4s_0.t()) {
        var element_0 = _iterator__ex2g4s_0.u();
        // Inline function 'kotlin.collections.filter' call
        // Inline function 'kotlin.collections.filterTo' call
        var destination = ArrayList.y();
        var _iterator__ex2g4s_1 = trans.s();
        while (_iterator__ex2g4s_1.t()) {
          var element_1 = _iterator__ex2g4s_1.u();
          var tmp;
          switch (element_1.action.d3_1) {
            case 2:
            case 4:
              var tmp_0;
              if (equals(element_0.lookahead, element_1.lookahead) && element_0.to.equals(element_1.to)) {
                // Inline function 'kotlin.collections.isNotEmpty' call
                tmp_0 = !intersect(element_0.context, element_1.context).a1();
              } else {
                tmp_0 = false;
              }

              tmp = tmp_0;
              break;
            case 3:
            case 0:
            case 1:
              var tmp_1;
              if (equals(element_0.lookahead, element_1.lookahead)) {
                // Inline function 'kotlin.collections.isNotEmpty' call
                tmp_1 = !intersect(element_0.context, element_1.context).a1();
              } else {
                tmp_1 = false;
              }

              tmp = tmp_1;
              break;
            default:
              noWhenBranchMatchedException();
              break;
          }
          if (tmp) {
            destination.r(element_1);
          }
        }
        var same = destination;
        // Inline function 'kotlin.collections.forEach' call
        var _iterator__ex2g4s_2 = same.s();
        while (_iterator__ex2g4s_2.t()) {
          var element_2 = _iterator__ex2g4s_2.u();
          if (!(element_0 === element_2)) {
            // Inline function 'kotlin.collections.map' call
            var this_0 = element_0.lookahead;
            // Inline function 'kotlin.collections.mapTo' call
            var destination_0 = ArrayList.w(collectionSizeOrDefault(this_0, 10));
            var _iterator__ex2g4s_3 = this_0.s();
            while (_iterator__ex2g4s_3.t()) {
              var item = _iterator__ex2g4s_3.u();
              var tmp$ret$5 = item.guard.k10();
              destination_0.r(tmp$ret$5);
            }
            // Inline function 'kotlin.collections.reduce' call
            var iterator = destination_0.s();
            if (!iterator.t())
              throw UnsupportedOperationException.j9("Empty collection can't be reduced.");
            var accumulator = iterator.u();
            while (iterator.t()) {
              var tmp3 = accumulator;
              var it = iterator.u();
              accumulator = tmp3.intersect(it);
            }
            var lhg1 = accumulator;
            // Inline function 'kotlin.collections.map' call
            var this_1 = element_2.lookahead;
            // Inline function 'kotlin.collections.mapTo' call
            var destination_1 = ArrayList.w(collectionSizeOrDefault(this_1, 10));
            var _iterator__ex2g4s_4 = this_1.s();
            while (_iterator__ex2g4s_4.t()) {
              var item_0 = _iterator__ex2g4s_4.u();
              var tmp$ret$10 = item_0.guard.k10();
              destination_1.r(tmp$ret$10);
            }
            // Inline function 'kotlin.collections.reduce' call
            var iterator_0 = destination_1.s();
            if (!iterator_0.t())
              throw UnsupportedOperationException.j9("Empty collection can't be reduced.");
            var accumulator_0 = iterator_0.u();
            while (iterator_0.t()) {
              var tmp8 = accumulator_0;
              var it_0 = iterator_0.u();
              accumulator_0 = tmp8.intersect(it_0);
            }
            var lhg2 = accumulator_0;
            var lhi = lhg1.intersect(lhg2);
            if (lhi.isNotEmpty) {
              var frOr = conv.d39(first(element_0.from.runtimeRules).runtimeRuleSetNumber, first(element_0.from.runtimeRules).ruleNumber);
              var ori1 = conv.d39(first(element_0.to.runtimeRules).runtimeRuleSetNumber, first(element_0.to.runtimeRules).ruleNumber);
              var ori2 = conv.d39(first(element_2.to.runtimeRules).runtimeRuleSetNumber, first(element_2.to.runtimeRules).ruleNumber);
              var orF = frOr == null ? null : frOr.owningRule;
              var or1 = ori1 == null ? null : ori1.owningRule;
              var or2 = ori2 == null ? null : ori2.owningRule;
              // Inline function 'kotlin.collections.map' call
              var this_2 = lhi.fullContent;
              // Inline function 'kotlin.collections.mapTo' call
              var destination_2 = ArrayList.w(collectionSizeOrDefault(this_2, 10));
              var _iterator__ex2g4s_5 = this_2.s();
              while (_iterator__ex2g4s_5.t()) {
                var item_1 = _iterator__ex2g4s_5.u();
                var tmp$ret$15 = item_1.tag;
                destination_2.r(tmp$ret$15);
              }
              var lhStr = destination_2;
              var tmp_2 = element_0.action.toString();
              var tmp_3 = element_2.action.toString();
              var tmp_4 = orF == null ? null : orF.name;
              var tmp_5 = toString_0(tmp_4 == null ? null : new GrammarRuleName(tmp_4));
              var tmp_6 = or1 == null ? null : or1.name;
              var tmp_7 = toString_0(tmp_6 == null ? null : new GrammarRuleName(tmp_6));
              var tmp_8 = or2 == null ? null : or2.name;
              var msg = 'Ambiguity: [' + tmp_2 + '/' + tmp_3 + "] conflict from '" + tmp_5 + "' into '" + tmp_7 + '/' + toString_0(tmp_8 == null ? null : new GrammarRuleName(tmp_8)) + "' on " + toString(lhStr);
              issueWarn($this, ori1, msg, null);
            }
          }
        }
      }
    }
  }
}
function unit_0($this, target, children, sentence) {
  var tmp = children.z(0);
  var options = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var namespaces = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  // Inline function 'kotlin.collections.associate' call
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(options, 10)), 16);
  // Inline function 'kotlin.collections.associateTo' call
  var destination = LinkedHashMap.kb(capacity);
  var _iterator__ex2g4s = options.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.plusAssign' call
    destination.r2(element.zg_1, element.ah_1);
  }
  var optHolder = new OptionHolderDefault(null, destination);
  var tmp0_name = _SimpleName___init__impl__6s45d0('ParsedGrammarUnit');
  var unit = new GrammarModelDefault(tmp0_name, optHolder, namespaces);
  return unit;
}
function namespace_0($this, target, children, sentence) {
  var tmp = children.z(1);
  var pqn = (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
  var nsName = pqn.asQualifiedName(null);
  var tmp_0 = children.z(2);
  var options = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(3);
  var imports = (!(tmp_1 == null) ? isInterface(tmp_1, KtList) : false) ? tmp_1 : THROW_CCE();
  var tmp_2 = children.z(4);
  var grammarBuilders = (!(tmp_2 == null) ? isInterface(tmp_2, KtList) : false) ? tmp_2 : THROW_CCE();
  // Inline function 'kotlin.collections.associate' call
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(options, 10)), 16);
  // Inline function 'kotlin.collections.associateTo' call
  var destination = LinkedHashMap.kb(capacity);
  var _iterator__ex2g4s = options.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.plusAssign' call
    destination.r2(element.zg_1, element.ah_1);
  }
  var optHolder = new OptionHolderDefault(null, destination);
  var namespace = new GrammarNamespaceDefault(nsName, optHolder, imports);
  // Inline function 'kotlin.collections.map' call
  // Inline function 'kotlin.collections.mapTo' call
  var destination_0 = ArrayList.w(collectionSizeOrDefault(grammarBuilders, 10));
  var _iterator__ex2g4s_0 = grammarBuilders.s();
  while (_iterator__ex2g4s_0.t()) {
    var item = _iterator__ex2g4s_0.u();
    var tmp$ret$4 = item(namespace);
    destination_0.r(tmp$ret$4);
  }
  return namespace;
}
function grammar_0($this, target, children, sentence) {
  var tmp = children.z(1);
  var name = _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
  var tmp_0 = children.z(2);
  var tmp0_elvis_lhs = (tmp_0 == null ? true : typeof tmp_0 === 'function') ? tmp_0 : THROW_CCE();
  var tmp_1;
  if (tmp0_elvis_lhs == null) {
    tmp_1 = AglGrammarSyntaxAnalyser$grammar$lambda;
  } else {
    tmp_1 = tmp0_elvis_lhs;
  }
  var extends_0 = tmp_1;
  var tmp_2 = children.z(4);
  var options = (!(tmp_2 == null) ? isInterface(tmp_2, KtList) : false) ? tmp_2 : THROW_CCE();
  var tmp_3 = children.z(5);
  var rules = (!(tmp_3 == null) ? isInterface(tmp_3, KtList) : false) ? tmp_3 : THROW_CCE();
  // Inline function 'kotlin.collections.associate' call
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(options, 10)), 16);
  // Inline function 'kotlin.collections.associateTo' call
  var destination = LinkedHashMap.kb(capacity);
  var _iterator__ex2g4s = options.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.plusAssign' call
    destination.r2(element.zg_1, element.ah_1);
  }
  var optHolder = new OptionHolderDefault(null, destination);
  // Inline function 'kotlin.collections.filter' call
  // Inline function 'kotlin.collections.filterTo' call
  var destination_0 = ArrayList.y();
  var _iterator__ex2g4s_0 = rules.s();
  while (_iterator__ex2g4s_0.t()) {
    var element_0 = _iterator__ex2g4s_0.u();
    if (element_0.zg_1) {
      destination_0.r(element_0);
    }
  }
  // Inline function 'kotlin.collections.map' call
  // Inline function 'kotlin.collections.mapTo' call
  var destination_1 = ArrayList.w(collectionSizeOrDefault(destination_0, 10));
  var _iterator__ex2g4s_1 = destination_0.s();
  while (_iterator__ex2g4s_1.t()) {
    var item = _iterator__ex2g4s_1.u();
    var tmp$ret$7 = item.ah_1;
    destination_1.r(tmp$ret$7);
  }
  var grmRules = destination_1;
  // Inline function 'kotlin.collections.filter' call
  // Inline function 'kotlin.collections.filterTo' call
  var destination_2 = ArrayList.y();
  var _iterator__ex2g4s_2 = rules.s();
  while (_iterator__ex2g4s_2.t()) {
    var element_1 = _iterator__ex2g4s_2.u();
    if (!element_1.zg_1) {
      destination_2.r(element_1);
    }
  }
  // Inline function 'kotlin.collections.map' call
  // Inline function 'kotlin.collections.mapTo' call
  var destination_3 = ArrayList.w(collectionSizeOrDefault(destination_2, 10));
  var _iterator__ex2g4s_3 = destination_2.s();
  while (_iterator__ex2g4s_3.t()) {
    var item_0 = _iterator__ex2g4s_3.u();
    var tmp$ret$13 = item_0.ah_1;
    destination_3.r(tmp$ret$13);
  }
  var precRules = destination_3;
  return AglGrammarSyntaxAnalyser$grammar$lambda_0(name, optHolder, extends_0, grmRules, precRules, $this, target, sentence);
}
function extends_0($this, target, children, sentence) {
  var tmp = children.z(1);
  var extendNameList = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var sl = ListSeparatedArrayList.gk(extendNameList);
  return AglGrammarSyntaxAnalyser$extends$lambda(sl, $this, target, sentence);
}
function rules($this, target, children, sentence) {
  return isInterface(children, KtList) ? children : THROW_CCE();
}
function rule($this, target, children, sentence) {
  var tmp = children.z(0);
  return tmp instanceof Pair ? tmp : THROW_CCE();
}
function grammarRule($this, target, children, sentence) {
  var tmp = children.z(0);
  var type = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  var isSkip = type.e1('skip');
  var isLeaf = type.e1('leaf');
  var tmp_0 = children.z(1);
  var name = _GrammarRuleName___init__impl__yqiut((!(tmp_0 == null) ? typeof tmp_0 === 'string' : false) ? tmp_0 : THROW_CCE());
  var tmp_1 = children.z(3);
  var rhs = (!(tmp_1 == null) ? typeof tmp_1 === 'function' : false) ? tmp_1 : THROW_CCE();
  return new Pair(true, AglGrammarSyntaxAnalyser$grammarRule$lambda(name, isSkip, isLeaf, rhs, $this, target, sentence));
}
function overrideRule($this, target, children, sentence) {
  var tmp = children.z(1);
  var type = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  var isSkip = type.e1('skip');
  var isLeaf = type.e1('leaf');
  var tmp_0 = children.z(2);
  var identifier = _GrammarRuleName___init__impl__yqiut((!(tmp_0 == null) ? typeof tmp_0 === 'string' : false) ? tmp_0 : THROW_CCE());
  var tmp_1 = children.z(3);
  var overrideOperator = (!(tmp_1 == null) ? typeof tmp_1 === 'string' : false) ? tmp_1 : THROW_CCE();
  var tmp_2;
  switch (overrideOperator) {
    case '==':
      tmp_2 = OverrideKind_SUBSTITUTION_getInstance();
      break;
    case '=':
      tmp_2 = OverrideKind_REPLACE_getInstance();
      break;
    case '+=|':
      tmp_2 = OverrideKind_APPEND_ALTERNATIVE_getInstance();
      break;
    default:
      var message = 'overrideOperator ' + overrideOperator + ' not handled';
      throw IllegalStateException.v4(toString(message));
  }
  var overrideKind = tmp_2;
  var tmp_3 = children.z(4);
  var rhs = (!(tmp_3 == null) ? typeof tmp_3 === 'function' : false) ? tmp_3 : THROW_CCE();
  return new Pair(true, AglGrammarSyntaxAnalyser$overrideRule$lambda(identifier, isSkip, isLeaf, overrideKind, rhs, $this, target, sentence));
}
function overrideOperator($this, target, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
}
function ruleTypeLabels($this, target, children, sentence) {
  return filterNotNull(isInterface(children, KtList) ? children : THROW_CCE());
}
function rhs($this, target, children, sentence) {
  var tmp = children.z(0);
  var rhsFunc = (!(tmp == null) ? typeof tmp === 'function' : false) ? tmp : THROW_CCE();
  return AglGrammarSyntaxAnalyser$rhs$lambda(rhsFunc, $this, target, sentence);
}
function empty($this, target, children, sentence) {
  return AglGrammarSyntaxAnalyser$empty$lambda($this, target, sentence);
}
function choice($this, target, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'function' : false) ? tmp : THROW_CCE();
}
function simpleChoice($this, target, children, sentence) {
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var this_0 = isInterface(children, KtList) ? children : THROW_CCE();
  var simpleChoice = ListSeparatedArrayList.gk(this_0);
  return AglGrammarSyntaxAnalyser$simpleChoice$lambda(simpleChoice, $this, target, sentence);
}
function priorityChoice($this, target, children, sentence) {
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var this_0 = isInterface(children, KtList) ? children : THROW_CCE();
  var priorityChoice = ListSeparatedArrayList.gk(this_0);
  return AglGrammarSyntaxAnalyser$priorityChoice$lambda(priorityChoice, $this, target, sentence);
}
function ambiguousChoice($this, target, children, sentence) {
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var this_0 = isInterface(children, KtList) ? children : THROW_CCE();
  var ambiguousChoice = ListSeparatedArrayList.gk(this_0);
  return AglGrammarSyntaxAnalyser$ambiguousChoice$lambda(ambiguousChoice, $this, target, sentence);
}
function concatenation($this, target, children, sentence) {
  var items = isInterface(children, KtList) ? children : THROW_CCE();
  return AglGrammarSyntaxAnalyser$concatenation$lambda(items, $this, target, sentence);
}
function concatenationItem($this, target, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'function' : false) ? tmp : THROW_CCE();
}
function simpleItemOrGroup($this, target, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'function' : false) ? tmp : THROW_CCE();
}
function simpleItem($this, target, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'function' : false) ? tmp : THROW_CCE();
}
function listOfItems($this, target, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'function' : false) ? tmp : THROW_CCE();
}
function multiplicity($this, target, children, sentence) {
  var m = children.z(0);
  var tmp;
  if (!(m == null) ? typeof m === 'string' : false) {
    var tmp_0;
    switch (m) {
      case '*':
        tmp_0 = new Pair(0, -1);
        break;
      case '+':
        tmp_0 = new Pair(1, -1);
        break;
      case '?':
        tmp_0 = new Pair(0, 1);
        break;
      default:
        var message = 'should not happen';
        throw IllegalStateException.v4(toString(message));
    }
    tmp = tmp_0;
  } else {
    if (m instanceof Pair) {
      tmp = m instanceof Pair ? m : THROW_CCE();
    } else {
      var message_0 = 'should not happen';
      throw IllegalStateException.v4(toString(message_0));
    }
  }
  return tmp;
}
function range($this, target, children, sentence) {
  var tmp = children.z(0);
  return tmp instanceof Pair ? tmp : THROW_CCE();
}
function rangeUnBraced($this, target, children, sentence) {
  var tmp = children.z(0);
  var min = toInt((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
  var tmp_0;
  if (children.z(1) == null) {
    tmp_0 = min;
  } else {
    var tmp_1 = children.z(1);
    tmp_0 = (!(tmp_1 == null) ? typeof tmp_1 === 'number' : false) ? tmp_1 : THROW_CCE();
  }
  var max = tmp_0;
  return new Pair(min, max);
}
function rangeBraced($this, target, children, sentence) {
  var tmp = children.z(1);
  var min = toInt((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
  var tmp_0;
  if (null == children.z(2)) {
    tmp_0 = min;
  } else {
    var tmp_1 = children.z(2);
    tmp_0 = (!(tmp_1 == null) ? typeof tmp_1 === 'number' : false) ? tmp_1 : THROW_CCE();
  }
  var max = tmp_0;
  return new Pair(min, max);
}
function rangeMaxOpt($this, target, children, sentence) {
  var tmp = children.z(0);
  return (tmp == null ? true : typeof tmp === 'number') ? tmp : THROW_CCE();
}
function rangeMax($this, target, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'number' : false) ? tmp : THROW_CCE();
}
function rangeMaxUnbounded($this, target, children, sentence) {
  return -1;
}
function rangeMaxBounded($this, target, children, sentence) {
  var tmp = children.z(1);
  return toInt((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
}
function simpleList($this, target, children, sentence) {
  var tmp = children.z(1);
  var _destruct__k2r9zo = tmp instanceof Pair ? tmp : THROW_CCE();
  var min = _destruct__k2r9zo.bh();
  var max = _destruct__k2r9zo.ch();
  var tmp_0 = children.z(0);
  var item = (!(tmp_0 == null) ? typeof tmp_0 === 'function' : false) ? tmp_0 : THROW_CCE();
  return AglGrammarSyntaxAnalyser$simpleList$lambda(min, max, item, $this, target, sentence);
}
function separatedList($this, target, children, sentence) {
  var tmp = children.z(5);
  var _destruct__k2r9zo = tmp instanceof Pair ? tmp : THROW_CCE();
  var min = _destruct__k2r9zo.bh();
  var max = _destruct__k2r9zo.ch();
  var tmp_0 = children.z(3);
  var separator = (!(tmp_0 == null) ? typeof tmp_0 === 'function' : false) ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(1);
  var item = (!(tmp_1 == null) ? typeof tmp_1 === 'function' : false) ? tmp_1 : THROW_CCE();
  return AglGrammarSyntaxAnalyser$separatedList$lambda(min, max, item, separator, $this, target, sentence);
}
function group_0($this, target, children, sentence) {
  var tmp = children.z(1);
  var groupContentFunc = (!(tmp == null) ? typeof tmp === 'function' : false) ? tmp : THROW_CCE();
  return AglGrammarSyntaxAnalyser$group$lambda(groupContentFunc, $this, target, sentence);
}
function groupedContent($this, target, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'function' : false) ? tmp : THROW_CCE();
}
function nonTerminal($this, target, children, sentence) {
  var tmp = children.z(0);
  var pqn = (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
  return AglGrammarSyntaxAnalyser$nonTerminal$lambda(pqn, $this, target, sentence);
}
function embedded($this, target, children, sentence) {
  var tmp = children.z(0);
  var embeddedGrammarStr = (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(2);
  var embeddedStartRuleRef = (!(tmp_0 == null) ? typeof tmp_0 === 'function' : false) ? tmp_0 : THROW_CCE();
  return AglGrammarSyntaxAnalyser$embedded$lambda(embeddedGrammarStr, embeddedStartRuleRef, $this, target, sentence);
}
function terminal_0($this, target, children, sentence) {
  var isPattern = _OptionNum___get_asIndex__impl__fdwc2b(target.alt.option) === 0 ? false : true;
  var tmp = children.z(0);
  var mt = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
  // Inline function 'kotlin.text.substring' call
  var endIndex = mt.length - 1 | 0;
  // Inline function 'kotlin.js.asDynamic' call
  var value = mt.substring(1, endIndex);
  var tmp_0;
  switch (isPattern) {
    case false:
      tmp_0 = replace(replace(value, "\\'", "'"), '\\\\', '\\');
      break;
    case true:
      tmp_0 = replace(replace(value, '\\"', '"'), '\\\\', '\\');
      break;
    default:
      noWhenBranchMatchedException();
      break;
  }
  var unescaped = tmp_0;
  return AglGrammarSyntaxAnalyser$terminal$lambda(unescaped, isPattern, $this, target, sentence);
}
function preferenceRule($this, target, children, sentence) {
  var tmp = children.z(1);
  var forItem = (!(tmp == null) ? typeof tmp === 'function' : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(3);
  var optionListFunc = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  return new Pair(false, AglGrammarSyntaxAnalyser$preferenceRule$lambda(optionListFunc, forItem, $this, target, sentence));
}
function preferenceOption($this, target, children, sentence) {
  var tmp = children.z(0);
  var spine = (!(tmp == null) ? typeof tmp === 'function' : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var ci = (tmp_0 == null ? true : tmp_0 instanceof Pair) ? tmp_0 : THROW_CCE();
  var choiceIndicator = null == ci ? ChoiceIndicator_NONE_getInstance() : ci.zg_1;
  var tmp1_elvis_lhs = ci == null ? null : ci.ah_1;
  var choiceNumber = tmp1_elvis_lhs == null ? -1 : tmp1_elvis_lhs;
  var tmp_1 = children.z(3);
  var terminalList = (!(tmp_1 == null) ? isInterface(tmp_1, KtList) : false) ? tmp_1 : THROW_CCE();
  var tmp_2 = children.z(4);
  var assStr = (!(tmp_2 == null) ? typeof tmp_2 === 'string' : false) ? tmp_2 : THROW_CCE();
  var tmp_3;
  switch (assStr) {
    case 'left':
      tmp_3 = Associativity_LEFT_getInstance();
      break;
    case 'right':
      tmp_3 = Associativity_RIGHT_getInstance();
      break;
    default:
      var message = "Internal Error: associativity value '" + assStr + "' not supported";
      throw IllegalStateException.v4(toString(message));
  }
  var associativity = tmp_3;
  return AglGrammarSyntaxAnalyser$preferenceOption$lambda(spine, choiceIndicator, choiceNumber, terminalList, associativity, $this, target, sentence);
}
function spine($this, target, children, sentence) {
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var this_0 = isInterface(children, KtList) ? children : THROW_CCE();
  var slist = ListSeparatedArrayList.gk(this_0);
  var parts = slist.ck();
  return AglGrammarSyntaxAnalyser$spine$lambda(parts);
}
function choiceNumber($this, target, children, sentence) {
  var tmp;
  switch (_OptionNum___get_asIndex__impl__fdwc2b(target.alt.option)) {
    case 0:
      var tmp_0 = ChoiceIndicator_NUMBER_getInstance();
      var tmp_1 = children.z(0);
      tmp = new Pair(tmp_0, toInt((!(tmp_1 == null) ? typeof tmp_1 === 'string' : false) ? tmp_1 : THROW_CCE()));
      break;
    case 1:
      var tmp_2 = children.z(0);
      tmp = new Pair(valueOf_3((!(tmp_2 == null) ? typeof tmp_2 === 'string' : false) ? tmp_2 : THROW_CCE()), -1);
      break;
    default:
      var message = 'Internal Error: choiceNumber not supported';
      throw IllegalStateException.v4(toString(message));
  }
  return tmp;
}
function terminalList($this, target, children, sentence) {
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var this_0 = isInterface(children, KtList) ? children : THROW_CCE();
  var slist = ListSeparatedArrayList.gk(this_0);
  return slist.ck();
}
function associativity($this, target, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
}
function reduceConcatenation($this, concat) {
  var tmp;
  if (concat.items.v() === 1) {
    var tmp1_subject = concat.items.z(0);
    var tmp_0;
    if (isInterface(tmp1_subject, TangibleItem)) {
      tmp_0 = concat.items.z(0);
    } else {
      if (isInterface(tmp1_subject, OptionalItem)) {
        tmp_0 = concat.items.z(0);
      } else {
        if (isInterface(tmp1_subject, ListOfItems)) {
          tmp_0 = concat.items.z(0);
        } else {
          if (isInterface(tmp1_subject, Choice)) {
            tmp_0 = concat.items.z(0);
          } else {
            if (isInterface(tmp1_subject, Group)) {
              var tmp_1 = concat.items.z(0);
              var content = (isInterface(tmp_1, Group) ? tmp_1 : THROW_CCE()).groupedContent;
              var tmp_2;
              if (isInterface(content, Choice)) {
                tmp_2 = content;
              } else {
                tmp_2 = concat;
              }
              tmp_0 = tmp_2;
            } else {
              var message = 'Internal Error: subtype of ConcatenationItem not handled - ' + getKClassFromExpression(concat.items.z(0)).zc();
              throw IllegalStateException.v4(toString(message));
            }
          }
        }
      }
    }
    tmp = tmp_0;
  } else {
    tmp = concat;
  }
  return tmp;
}
function AglGrammarSyntaxAnalyser$unit$ref($boundThis) {
  var l = (p0, p1, p2) => unit_0($boundThis, p0, p1, p2);
  l.callableName = 'unit';
  return l;
}
function AglGrammarSyntaxAnalyser$namespace$ref($boundThis) {
  var l = (p0, p1, p2) => namespace_0($boundThis, p0, p1, p2);
  l.callableName = 'namespace';
  return l;
}
function AglGrammarSyntaxAnalyser$grammar$ref($boundThis) {
  var l = (p0, p1, p2) => grammar_0($boundThis, p0, p1, p2);
  l.callableName = 'grammar';
  return l;
}
function AglGrammarSyntaxAnalyser$extends$ref($boundThis) {
  var l = (p0, p1, p2) => extends_0($boundThis, p0, p1, p2);
  l.callableName = 'extends';
  return l;
}
function AglGrammarSyntaxAnalyser$rules$ref($boundThis) {
  var l = (p0, p1, p2) => rules($boundThis, p0, p1, p2);
  l.callableName = 'rules';
  return l;
}
function AglGrammarSyntaxAnalyser$rule$ref($boundThis) {
  var l = (p0, p1, p2) => rule($boundThis, p0, p1, p2);
  l.callableName = 'rule';
  return l;
}
function AglGrammarSyntaxAnalyser$grammarRule$ref($boundThis) {
  var l = (p0, p1, p2) => grammarRule($boundThis, p0, p1, p2);
  l.callableName = 'grammarRule';
  return l;
}
function AglGrammarSyntaxAnalyser$overrideRule$ref($boundThis) {
  var l = (p0, p1, p2) => overrideRule($boundThis, p0, p1, p2);
  l.callableName = 'overrideRule';
  return l;
}
function AglGrammarSyntaxAnalyser$overrideOperator$ref($boundThis) {
  var l = (p0, p1, p2) => overrideOperator($boundThis, p0, p1, p2);
  l.callableName = 'overrideOperator';
  return l;
}
function AglGrammarSyntaxAnalyser$preferenceRule$ref($boundThis) {
  var l = (p0, p1, p2) => preferenceRule($boundThis, p0, p1, p2);
  l.callableName = 'preferenceRule';
  return l;
}
function AglGrammarSyntaxAnalyser$ruleTypeLabels$ref($boundThis) {
  var l = (p0, p1, p2) => ruleTypeLabels($boundThis, p0, p1, p2);
  l.callableName = 'ruleTypeLabels';
  return l;
}
function AglGrammarSyntaxAnalyser$rhs$ref($boundThis) {
  var l = (p0, p1, p2) => rhs($boundThis, p0, p1, p2);
  l.callableName = 'rhs';
  return l;
}
function AglGrammarSyntaxAnalyser$empty$ref($boundThis) {
  var l = (p0, p1, p2) => empty($boundThis, p0, p1, p2);
  l.callableName = 'empty';
  return l;
}
function AglGrammarSyntaxAnalyser$choice$ref($boundThis) {
  var l = (p0, p1, p2) => choice($boundThis, p0, p1, p2);
  l.callableName = 'choice';
  return l;
}
function AglGrammarSyntaxAnalyser$simpleChoice$ref($boundThis) {
  var l = (p0, p1, p2) => simpleChoice($boundThis, p0, p1, p2);
  l.callableName = 'simpleChoice';
  return l;
}
function AglGrammarSyntaxAnalyser$priorityChoice$ref($boundThis) {
  var l = (p0, p1, p2) => priorityChoice($boundThis, p0, p1, p2);
  l.callableName = 'priorityChoice';
  return l;
}
function AglGrammarSyntaxAnalyser$ambiguousChoice$ref($boundThis) {
  var l = (p0, p1, p2) => ambiguousChoice($boundThis, p0, p1, p2);
  l.callableName = 'ambiguousChoice';
  return l;
}
function AglGrammarSyntaxAnalyser$concatenation$ref($boundThis) {
  var l = (p0, p1, p2) => concatenation($boundThis, p0, p1, p2);
  l.callableName = 'concatenation';
  return l;
}
function AglGrammarSyntaxAnalyser$concatenationItem$ref($boundThis) {
  var l = (p0, p1, p2) => concatenationItem($boundThis, p0, p1, p2);
  l.callableName = 'concatenationItem';
  return l;
}
function AglGrammarSyntaxAnalyser$simpleItemOrGroup$ref($boundThis) {
  var l = (p0, p1, p2) => simpleItemOrGroup($boundThis, p0, p1, p2);
  l.callableName = 'simpleItemOrGroup';
  return l;
}
function AglGrammarSyntaxAnalyser$simpleItem$ref($boundThis) {
  var l = (p0, p1, p2) => simpleItem($boundThis, p0, p1, p2);
  l.callableName = 'simpleItem';
  return l;
}
function AglGrammarSyntaxAnalyser$listOfItems$ref($boundThis) {
  var l = (p0, p1, p2) => listOfItems($boundThis, p0, p1, p2);
  l.callableName = 'listOfItems';
  return l;
}
function AglGrammarSyntaxAnalyser$multiplicity$ref($boundThis) {
  var l = (p0, p1, p2) => multiplicity($boundThis, p0, p1, p2);
  l.callableName = 'multiplicity';
  return l;
}
function AglGrammarSyntaxAnalyser$range$ref($boundThis) {
  var l = (p0, p1, p2) => range($boundThis, p0, p1, p2);
  l.callableName = 'range';
  return l;
}
function AglGrammarSyntaxAnalyser$rangeUnBraced$ref($boundThis) {
  var l = (p0, p1, p2) => rangeUnBraced($boundThis, p0, p1, p2);
  l.callableName = 'rangeUnBraced';
  return l;
}
function AglGrammarSyntaxAnalyser$rangeBraced$ref($boundThis) {
  var l = (p0, p1, p2) => rangeBraced($boundThis, p0, p1, p2);
  l.callableName = 'rangeBraced';
  return l;
}
function AglGrammarSyntaxAnalyser$rangeMaxOpt$ref($boundThis) {
  var l = (p0, p1, p2) => rangeMaxOpt($boundThis, p0, p1, p2);
  l.callableName = 'rangeMaxOpt';
  return l;
}
function AglGrammarSyntaxAnalyser$rangeMax$ref($boundThis) {
  var l = (p0, p1, p2) => rangeMax($boundThis, p0, p1, p2);
  l.callableName = 'rangeMax';
  return l;
}
function AglGrammarSyntaxAnalyser$rangeMaxBounded$ref($boundThis) {
  var l = (p0, p1, p2) => rangeMaxBounded($boundThis, p0, p1, p2);
  l.callableName = 'rangeMaxBounded';
  return l;
}
function AglGrammarSyntaxAnalyser$rangeMaxUnbounded$ref($boundThis) {
  var l = (p0, p1, p2) => rangeMaxUnbounded($boundThis, p0, p1, p2);
  l.callableName = 'rangeMaxUnbounded';
  return l;
}
function AglGrammarSyntaxAnalyser$simpleList$ref($boundThis) {
  var l = (p0, p1, p2) => simpleList($boundThis, p0, p1, p2);
  l.callableName = 'simpleList';
  return l;
}
function AglGrammarSyntaxAnalyser$group$ref($boundThis) {
  var l = (p0, p1, p2) => group_0($boundThis, p0, p1, p2);
  l.callableName = 'group';
  return l;
}
function AglGrammarSyntaxAnalyser$groupedContent$ref($boundThis) {
  var l = (p0, p1, p2) => groupedContent($boundThis, p0, p1, p2);
  l.callableName = 'groupedContent';
  return l;
}
function AglGrammarSyntaxAnalyser$separatedList$ref($boundThis) {
  var l = (p0, p1, p2) => separatedList($boundThis, p0, p1, p2);
  l.callableName = 'separatedList';
  return l;
}
function AglGrammarSyntaxAnalyser$nonTerminal$ref($boundThis) {
  var l = (p0, p1, p2) => nonTerminal($boundThis, p0, p1, p2);
  l.callableName = 'nonTerminal';
  return l;
}
function AglGrammarSyntaxAnalyser$embedded$ref($boundThis) {
  var l = (p0, p1, p2) => embedded($boundThis, p0, p1, p2);
  l.callableName = 'embedded';
  return l;
}
function AglGrammarSyntaxAnalyser$terminal$ref($boundThis) {
  var l = (p0, p1, p2) => terminal_0($boundThis, p0, p1, p2);
  l.callableName = 'terminal';
  return l;
}
function AglGrammarSyntaxAnalyser$preferenceOption$ref($boundThis) {
  var l = (p0, p1, p2) => preferenceOption($boundThis, p0, p1, p2);
  l.callableName = 'preferenceOption';
  return l;
}
function AglGrammarSyntaxAnalyser$spine$ref($boundThis) {
  var l = (p0, p1, p2) => spine($boundThis, p0, p1, p2);
  l.callableName = 'spine';
  return l;
}
function AglGrammarSyntaxAnalyser$choiceNumber$ref($boundThis) {
  var l = (p0, p1, p2) => choiceNumber($boundThis, p0, p1, p2);
  l.callableName = 'choiceNumber';
  return l;
}
function AglGrammarSyntaxAnalyser$terminalList$ref($boundThis) {
  var l = (p0, p1, p2) => terminalList($boundThis, p0, p1, p2);
  l.callableName = 'terminalList';
  return l;
}
function AglGrammarSyntaxAnalyser$associativity$ref($boundThis) {
  var l = (p0, p1, p2) => associativity($boundThis, p0, p1, p2);
  l.callableName = 'associativity';
  return l;
}
function AglGrammarSyntaxAnalyser$grammar$lambda(it) {
  return emptyList();
}
function AglGrammarSyntaxAnalyser$grammar$lambda_0($name, $optHolder, $extends, $grmRules, $precRules, this$0, $target, $sentence) {
  return (namespace) => {
    var grmr = new GrammarDefault(namespace, $name, $optHolder);
    grmr.extends.x($extends(namespace));
    // Inline function 'kotlin.collections.map' call
    var this_0 = $grmRules;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp = item(grmr);
      var tmp$ret$0 = isInterface(tmp, GrammarRule) ? tmp : THROW_CCE();
      destination.r(tmp$ret$0);
    }
    var grmrRules = destination;
    grmr.grammarRule.x(grmrRules);
    // Inline function 'kotlin.collections.map' call
    var this_1 = $precRules;
    // Inline function 'kotlin.collections.mapTo' call
    var destination_0 = ArrayList.w(collectionSizeOrDefault(this_1, 10));
    var _iterator__ex2g4s_0 = this_1.s();
    while (_iterator__ex2g4s_0.t()) {
      var item_0 = _iterator__ex2g4s_0.u();
      var tmp_0 = item_0(grmr);
      var tmp$ret$3 = isInterface(tmp_0, PreferenceRule) ? tmp_0 : THROW_CCE();
      destination_0.r(tmp$ret$3);
    }
    var prfRules = destination_0;
    grmr.preferenceRule.x(prfRules);
    // Inline function 'kotlin.also' call
    this$0.setLocationFor(grmr, $target, $sentence);
    return grmr;
  };
}
function AglGrammarSyntaxAnalyser$extends$lambda($sl, this$0, $target, $sentence) {
  return (localNamespace) => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = $sl.ck();
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      // Inline function 'kotlin.also' call
      var this_1 = new GrammarReferenceDefault(localNamespace, item);
      this$0.setLocationFor(this_1, $target, $sentence);
      destination.r(this_1);
    }
    return destination;
  };
}
function AglGrammarSyntaxAnalyser$grammarRule$lambda($name, $isSkip, $isLeaf, $rhs, this$0, $target, $sentence) {
  return (grammar) => {
    var result = new NormalRuleDefault(grammar, $name, $isSkip, $isLeaf);
    result.rhs = $rhs(grammar);
    // Inline function 'kotlin.also' call
    this$0.setLocationFor(result, $target, $sentence);
    return result;
  };
}
function AglGrammarSyntaxAnalyser$overrideRule$lambda($identifier, $isSkip, $isLeaf, $overrideKind, $rhs, this$0, $target, $sentence) {
  return (grammar) => {
    var result = new OverrideRuleDefault(grammar, $identifier, $isSkip, $isLeaf, $overrideKind);
    result.overriddenRhs = $rhs(grammar);
    // Inline function 'kotlin.also' call
    this$0.setLocationFor(result, $target, $sentence);
    return result;
  };
}
function AglGrammarSyntaxAnalyser$rhs$lambda($rhsFunc, this$0, $target, $sentence) {
  return (grm) => {
    var rhs = $rhsFunc(grm);
    var tmp;
    if (isInterface(rhs, Concatenation)) {
      tmp = reduceConcatenation(this$0, rhs);
    } else {
      tmp = rhs;
    }
    // Inline function 'kotlin.also' call
    var this_0 = tmp;
    this$0.setLocationFor(this_0, $target, $sentence);
    return this_0;
  };
}
function AglGrammarSyntaxAnalyser$empty$lambda(this$0, $target, $sentence) {
  return (it) => {
    // Inline function 'kotlin.also' call
    var this_0 = new EmptyRuleDefault();
    this$0.setLocationFor(this_0, $target, $sentence);
    return this_0;
  };
}
function AglGrammarSyntaxAnalyser$simpleChoice$lambda($simpleChoice, this$0, $target, $sentence) {
  return (grm) => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = $simpleChoice.ck();
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = reduceConcatenation(this$0, item(grm));
      destination.r(tmp$ret$0);
    }
    var alternative = destination;
    // Inline function 'kotlin.also' call
    var this_1 = new ChoiceLongestDefault(alternative);
    this$0.setLocationFor(this_1, $target, $sentence);
    return this_1;
  };
}
function AglGrammarSyntaxAnalyser$priorityChoice$lambda($priorityChoice, this$0, $target, $sentence) {
  return (grm) => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = $priorityChoice.ck();
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = reduceConcatenation(this$0, item(grm));
      destination.r(tmp$ret$0);
    }
    var alternative = destination;
    // Inline function 'kotlin.also' call
    var this_1 = new ChoicePriorityDefault(alternative);
    this$0.setLocationFor(this_1, $target, $sentence);
    return this_1;
  };
}
function AglGrammarSyntaxAnalyser$ambiguousChoice$lambda($ambiguousChoice, this$0, $target, $sentence) {
  return (grm) => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = $ambiguousChoice.ck();
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = reduceConcatenation(this$0, item(grm));
      destination.r(tmp$ret$0);
    }
    var alternative = destination;
    // Inline function 'kotlin.also' call
    var this_1 = new ChoiceAmbiguousDefault(alternative);
    this$0.setLocationFor(this_1, $target, $sentence);
    return this_1;
  };
}
function AglGrammarSyntaxAnalyser$concatenation$lambda($items, this$0, $target, $sentence) {
  return (grm) => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = $items;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item(grm);
      destination.r(tmp$ret$0);
    }
    // Inline function 'kotlin.also' call
    var this_1 = new ConcatenationDefault(destination);
    this$0.setLocationFor(this_1, $target, $sentence);
    return this_1;
  };
}
function AglGrammarSyntaxAnalyser$simpleList$lambda($min, $max, $item, this$0, $target, $sentence) {
  return (grm) => {
    // Inline function 'kotlin.also' call
    var this_0 = $min === 0 && $max === 1 ? new OptionalItemDefault($item(grm)) : new SimpleListDefault($min, $max, $item(grm));
    this$0.setLocationFor(this_0, $target, $sentence);
    return this_0;
  };
}
function AglGrammarSyntaxAnalyser$separatedList$lambda($min, $max, $item, $separator, this$0, $target, $sentence) {
  return (grm) => {
    // Inline function 'kotlin.also' call
    var this_0 = new SeparatedListDefault($min, $max, $item(grm), $separator(grm));
    this$0.setLocationFor(this_0, $target, $sentence);
    return this_0;
  };
}
function AglGrammarSyntaxAnalyser$group$lambda($groupContentFunc, this$0, $target, $sentence) {
  return (grm) => {
    var groupContent = $groupContentFunc(grm);
    var tmp;
    if (isInterface(groupContent, Choice)) {
      tmp = groupContent;
    } else {
      if (isInterface(groupContent, Concatenation)) {
        var reduced = reduceConcatenation(this$0, groupContent);
        tmp = new GroupDefault(reduced);
      } else {
        var message = 'Internal Error: subtype of RuleItem not handled - ' + getKClassFromExpression(groupContent).zc();
        throw IllegalStateException.v4(toString(message));
      }
    }
    // Inline function 'kotlin.also' call
    var this_0 = tmp;
    this$0.setLocationFor(this_0, $target, $sentence);
    return this_0;
  };
}
function AglGrammarSyntaxAnalyser$nonTerminal$lambda($pqn, this$0, $target, $sentence) {
  return (grm) => {
    var tmp0_subject = $pqn;
    var tmp;
    if (tmp0_subject instanceof QualifiedName) {
      var localNamespace = grm.namespace;
      var nonTerminalRef = _GrammarRuleName___init__impl__yqiut(_SimpleName___get_value__impl__rl2r3c(_QualifiedName___get_last__impl__838y8h($pqn.f27_1)));
      var grammarRef = _QualifiedName___get_asPossiblyQualified__impl__bty3hq(_QualifiedName___get_front__impl__24j8eq($pqn.f27_1));
      // Inline function 'kotlin.also' call
      var this_0 = new GrammarReferenceDefault(localNamespace, grammarRef);
      this$0.setLocationFor(this_0, $target, $sentence);
      var gr = this_0;
      var nt = new NonTerminalDefault(gr, nonTerminalRef);
      tmp = nt;
    } else {
      if (tmp0_subject instanceof SimpleName) {
        tmp = new NonTerminalDefault(null, _GrammarRuleName___init__impl__yqiut(_SimpleName___get_value__impl__rl2r3c($pqn.a1u_1)));
      } else {
        noWhenBranchMatchedException();
      }
    }
    // Inline function 'kotlin.also' call
    var this_1 = tmp;
    this$0.setLocationFor(this_1, $target, $sentence);
    return this_1;
  };
}
function AglGrammarSyntaxAnalyser$embedded$lambda($embeddedGrammarStr, $embeddedStartRuleRef, this$0, $target, $sentence) {
  return (grm) => {
    var namespace = grm.namespace;
    var embeddedGrammarRef = new GrammarReferenceDefault(namespace, $embeddedGrammarStr);
    // Inline function 'kotlin.also' call
    var this_0 = new EmbeddedDefault($embeddedStartRuleRef(grm).ruleReference, embeddedGrammarRef);
    this$0.setLocationFor(this_0, $target, $sentence);
    return this_0;
  };
}
function AglGrammarSyntaxAnalyser$terminal$lambda($unescaped, $isPattern, this$0, $target, $sentence) {
  return (it) => {
    // Inline function 'kotlin.also' call
    var this_0 = new TerminalDefault($unescaped, $isPattern);
    this$0.setLocationFor(this_0, $target, $sentence);
    return this_0;
  };
}
function AglGrammarSyntaxAnalyser$preferenceRule$lambda($optionListFunc, $forItem, this$0, $target, $sentence) {
  return (grammar) => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = $optionListFunc;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item(grammar);
      destination.r(tmp$ret$0);
    }
    var optionList = destination;
    // Inline function 'kotlin.also' call
    var this_1 = new PreferenceRuleDefault(grammar, $forItem(grammar), optionList);
    this$0.setLocationFor(this_1, $target, $sentence);
    return this_1;
  };
}
function AglGrammarSyntaxAnalyser$preferenceOption$lambda($spine, $choiceIndicator, $choiceNumber, $terminalList, $associativity, this$0, $target, $sentence) {
  return (grm) => {
    var tmp = $spine(grm);
    // Inline function 'kotlin.collections.map' call
    var this_0 = $terminalList;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item(grm);
      destination.r(tmp$ret$0);
    }
    // Inline function 'kotlin.also' call
    var this_1 = new PreferenceOptionDefault(tmp, $choiceIndicator, $choiceNumber, destination, $associativity);
    this$0.setLocationFor(this_1, $target, $sentence);
    return this_1;
  };
}
function AglGrammarSyntaxAnalyser$spine$lambda($parts) {
  return (grm) => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = $parts;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = item(grm);
      destination.r(tmp$ret$0);
    }
    return new SpineDefault_0(destination);
  };
}
function findTypeForRule(_this__u8e3s4, ruleName) {
  var tmp0 = _this__u8e3s4.namespace;
  var tmp$ret$1;
  $l$block: {
    // Inline function 'kotlin.collections.firstNotNullOfOrNull' call
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp;
      if (isInterface(element, GrammarTypeNamespace)) {
        tmp = element.findTypeForRule(ruleName);
      } else {
        tmp = null;
      }
      var result = tmp;
      if (!(result == null)) {
        tmp$ret$1 = result;
        break $l$block;
      }
    }
    tmp$ret$1 = null;
  }
  return tmp$ret$1;
}
function contextFromGrammar(grammars) {
  var proc = ensureNotNull(Agl_getInstance().registry.agl.grammar.processor);
  var aglGrammarTypeModel = proc.typesModel;
  var context = new ContextWithScope();
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = grammars.allDefinitions.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var scope = context.newScopeForSentence(QualifiedName__toString_impl_z3wem2(element.qualifiedName));
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = element.allResolvedGrammarRule.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      var tmp0_elvis_lhs = findTypeForRule(aglGrammarTypeModel, _GrammarRuleName___init__impl__yqiut('grammarRule'));
      var tmp;
      if (tmp0_elvis_lhs == null) {
        var message = "Type not found for rule '" + GrammarRuleName__toString_impl_przz03(element_0.name) + "'";
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp = tmp0_elvis_lhs;
      }
      var rType = tmp;
      scope.addToScope(_GrammarRuleName___get_value__impl__470s0v(element_0.name), rType.resolvedDeclaration.qualifiedName, null, _GrammarRuleName___get_value__impl__470s0v(element_0.name), false);
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_1 = element.allResolvedTerminal.s();
    while (_iterator__ex2g4s_1.t()) {
      var element_1 = _iterator__ex2g4s_1.u();
      var rTypeName = element_1.isPattern ? 'PATTERN' : 'LITERAL';
      scope.addToScope(element_1.id, _QualifiedName___init__impl__8ed982(rTypeName), null, element_1.value, false);
    }
  }
  return context;
}
function ContextFromGrammarRegistry(registry) {
  return contextFromGrammarRegistry(registry);
}
function _get__ruleSetNumber__ss0daz($this) {
  var tmp0 = $this.m1x_1;
  // Inline function 'kotlin.getValue' call
  _ruleSetNumber$factory();
  return tmp0.b3();
}
function _get__pseudoRuleNameGenerator__sdgpi4($this) {
  var tmp0 = $this.s1x_1;
  // Inline function 'kotlin.getValue' call
  _pseudoRuleNameGenerator$factory();
  return tmp0.b3();
}
function recordOriginalRuleItem($this, runtimeRule, originalRuleItem) {
  var tmp0 = $this.r1x_1;
  // Inline function 'kotlin.collections.set' call
  var key = new Pair(runtimeRule.runtimeRuleSetNumber, runtimeRule.ruleNumber);
  tmp0.r2(key, originalRuleItem);
}
function nextRule($this, name, isSkip, isPseudo) {
  if (false) {
    // Inline function 'kotlin.check' call
    if (!!$this.n1x_1.x2(name)) {
      throw IllegalStateException.v4('Check failed.');
    }
  }
  var newRule = new RuntimeRule(_get__ruleSetNumber__ss0daz($this), $this.n1x_1.v(), name, isSkip, isPseudo);
  // Inline function 'kotlin.collections.set' call
  $this.n1x_1.r2(name, newRule);
  return newRule;
}
function terminalRule($this, name, value, kind, isPattern, isSkip) {
  // Inline function 'kotlin.also' call
  var this_0 = new RuntimeRule(_get__ruleSetNumber__ss0daz($this), $this.n1x_1.v(), name, isSkip, false);
  if (isPattern) {
    var unescaped = value;
    this_0.setRhs(new RuntimeRuleRhsPattern(this_0, unescaped));
  } else {
    var unescaped_0 = Companion_instance.unescape(value);
    this_0.setRhs(new RuntimeRuleRhsLiteral(this_0, unescaped_0));
  }
  var newRule = this_0;
  if (false) {
    // Inline function 'kotlin.check' call
    if (!!$this.n1x_1.x2(newRule.tag)) {
      var message = "Already got rule with tag '" + name + "'";
      throw IllegalStateException.v4(toString(message));
    }
  }
  var tmp3 = $this.n1x_1;
  // Inline function 'kotlin.collections.set' call
  var key = newRule.tag;
  tmp3.r2(key, newRule);
  // Inline function 'kotlin.collections.set' call
  $this.p1x_1.r2(value, newRule);
  if (name == null)
    null;
  else {
    // Inline function 'kotlin.let' call
    // Inline function 'kotlin.collections.set' call
    $this.p1x_1.r2(name, newRule);
  }
  return newRule;
}
function embeddedRule($this, embeddedRuleName, item, isSkip) {
  var embeddedRuleName_0 = embeddedRuleName == null ? _get__pseudoRuleNameGenerator__sdgpi4($this).y39(item) : embeddedRuleName;
  if (false) {
    // Inline function 'kotlin.check' call
    if (!!$this.n1x_1.x2(embeddedRuleName_0)) {
      throw IllegalStateException.v4('Check failed.');
    }
  }
  var newRule = new RuntimeRule(_get__ruleSetNumber__ss0daz($this), $this.n1x_1.v(), embeddedRuleName_0, isSkip, false);
  var tmp1 = $this.n1x_1;
  // Inline function 'kotlin.collections.set' call
  var key = newRule.tag;
  tmp1.r2(key, newRule);
  // Inline function 'kotlin.collections.set' call
  $this.q1x_1.r2(item, newRule);
  return newRule;
}
function findNamedRule($this, name) {
  return $this.n1x_1.z2(name);
}
function findTerminal($this, value) {
  return $this.p1x_1.z2(value);
}
function findEmbedded($this, item) {
  return $this.q1x_1.z2(item);
}
function buildCompressedRule($this, target, isSkip) {
  var ci = target.compressedLeaf;
  var tmp;
  if (ci.isPattern) {
    tmp = terminalRule($this, _GrammarRuleName___get_value__impl__470s0v(target.name), ci.value, RuntimeRuleKind_TERMINAL_getInstance(), true, isSkip);
  } else {
    tmp = terminalRule($this, _GrammarRuleName___get_value__impl__470s0v(target.name), ci.value, RuntimeRuleKind_TERMINAL_getInstance(), false, isSkip);
  }
  var rule = tmp;
  return rule;
}
function convertGrammar($this, target, arg) {
  // Inline function 'kotlin.collections.map' call
  var this_0 = target.allResolvedGrammarRule;
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
  var _iterator__ex2g4s = this_0.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var tmp$ret$0 = convertGrammarRule($this, item, arg);
    destination.r(tmp$ret$0);
  }
  var rules = toSet(destination);
  var tmp = $this;
  // Inline function 'kotlin.collections.map' call
  var this_1 = target.allResolvedPreferenceRuleRule;
  // Inline function 'kotlin.collections.mapTo' call
  var destination_0 = ArrayList.w(collectionSizeOrDefault(this_1, 10));
  var _iterator__ex2g4s_0 = this_1.s();
  while (_iterator__ex2g4s_0.t()) {
    var item_0 = _iterator__ex2g4s_0.u();
    var tmp$ret$3 = convertPreferenceRule($this, item_0, arg);
    destination_0.r(tmp$ret$3);
  }
  tmp.o1x_1 = destination_0;
  return rules;
}
function convertPreferenceRule($this, target, arg) {
  var forItem = target.forItem;
  var tmp;
  if (isInterface(forItem, NonTerminal)) {
    tmp = ensureNotNull(findNamedRule($this, _GrammarRuleName___get_value__impl__470s0v(forItem.ruleReference)));
  } else {
    if (isInterface(forItem, Embedded)) {
      throw NotImplementedError.uj();
    } else {
      if (isInterface(forItem, Terminal)) {
        tmp = ensureNotNull(findTerminal($this, forItem.value));
      } else {
        var message = "Internal Error: subtype '" + getKClassFromExpression(forItem).zc() + "' of SimpleItem not handled";
        throw IllegalStateException.v4(toString(message));
      }
    }
  }
  var contextRule = tmp;
  // Inline function 'kotlin.collections.mapIndexed' call
  var this_0 = target.optionList;
  // Inline function 'kotlin.collections.mapIndexedTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
  var index = 0;
  var _iterator__ex2g4s = this_0.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var _unary__edvuaz = index;
    index = _unary__edvuaz + 1 | 0;
    var prec = checkIndexOverflow(_unary__edvuaz);
    // Inline function 'kotlin.collections.map' call
    var this_1 = item.spine.parts;
    // Inline function 'kotlin.collections.mapTo' call
    var destination_0 = ArrayList.w(collectionSizeOrDefault(this_1, 10));
    var _iterator__ex2g4s_0 = this_1.s();
    while (_iterator__ex2g4s_0.t()) {
      var item_0 = _iterator__ex2g4s_0.u();
      var tmp$ret$0 = ensureNotNull(findNamedRule($this, _GrammarRuleName___get_value__impl__470s0v(item_0.ruleReference)));
      destination_0.r(tmp$ret$0);
    }
    var tgtSpine = destination_0;
    var refRhs = last(item.spine.parts).referencedRule($this.j1x_1).rhs;
    var tmp_0;
    switch (item.choiceIndicator.d3_1) {
      case 0:
        tmp_0 = Companion_getInstance_0().OPTION_NONE;
        break;
      case 1:
        var tmp_1;
        if (isInterface(refRhs, OptionalItem)) {
          tmp_1 = Companion_getInstance_0().OPTION_OPTIONAL_EMPTY;
        } else {
          if (isInterface(refRhs, SimpleList)) {
            tmp_1 = Companion_getInstance_0().OPTION_MULTI_EMPTY;
          } else {
            if (isInterface(refRhs, SeparatedList)) {
              tmp_1 = Companion_getInstance_0().OPTION_SLIST_EMPTY;
            } else {
              var message_0 = 'Only Optional and List items can be EMPTY';
              throw IllegalStateException.v4(toString(message_0));
            }
          }
        }

        tmp_0 = tmp_1;
        break;
      case 2:
        var tmp_2;
        if (isInterface(refRhs, OptionalItem)) {
          tmp_2 = Companion_getInstance_0().OPTION_OPTIONAL_ITEM;
        } else {
          if (isInterface(refRhs, SimpleList)) {
            tmp_2 = Companion_getInstance_0().OPTION_MULTI_ITEM;
          } else {
            if (isInterface(refRhs, SeparatedList)) {
              tmp_2 = Companion_getInstance_0().OPTION_SLIST_ITEM_OR_SEPERATOR;
            } else {
              var message_1 = 'Only Optional and List items can be ITEM';
              throw IllegalStateException.v4(toString(message_1));
            }
          }
        }

        tmp_0 = tmp_2;
        break;
      case 3:
        var tmp_3;
        if (isInterface(refRhs, Choice)) {
          tmp_3 = _OptionNum___init__impl__jxeviw(item.choiceNumber);
        } else {
          var message_2 = 'Only Choice items can be NUMBER';
          throw IllegalStateException.v4(toString(message_2));
        }

        tmp_0 = tmp_3;
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
    var optionNum = tmp_0;
    // Inline function 'kotlin.collections.map' call
    var this_2 = item.onTerminals;
    // Inline function 'kotlin.collections.mapTo' call
    var destination_1 = ArrayList.w(collectionSizeOrDefault(this_2, 10));
    var _iterator__ex2g4s_1 = this_2.s();
    while (_iterator__ex2g4s_1.t()) {
      var item_1 = _iterator__ex2g4s_1.u();
      var tmp_4;
      if (isInterface(item_1, Terminal)) {
        var tmp1_elvis_lhs = findTerminal($this, item_1.value);
        var tmp_5;
        if (tmp1_elvis_lhs == null) {
          var message_3 = "Terminal '" + item_1.value + "' not found";
          throw IllegalStateException.v4(toString(message_3));
        } else {
          tmp_5 = tmp1_elvis_lhs;
        }
        tmp_4 = tmp_5;
      } else {
        if (isInterface(item_1, NonTerminal)) {
          var r = findNamedRule($this, _GrammarRuleName___get_value__impl__470s0v(item_1.ruleReference));
          var tmp_6;
          if (null == r) {
            var message_4 = "Rule named '" + GrammarRuleName__toString_impl_przz03(item_1.ruleReference) + "' not found";
            throw IllegalStateException.v4(toString(message_4));
          } else if (!r.isTerminal) {
            var message_5 = "Rule named '" + GrammarRuleName__toString_impl_przz03(item_1.ruleReference) + "' is not a terminal";
            throw IllegalStateException.v4(toString(message_5));
          } else {
            tmp_6 = r;
          }
          tmp_4 = tmp_6;
        } else {
          if (isInterface(item_1, Embedded)) {
            throw NotImplementedError.uj();
          } else {
            var message_6 = "Internal Error: subtype '" + getKClassFromExpression(forItem).zc() + "' of SimpleItem not handled";
            throw IllegalStateException.v4(toString(message_6));
          }
        }
      }
      var tmp$ret$3 = tmp_4;
      destination_1.r(tmp$ret$3);
    }
    var terminals = toSet(destination_1);
    var tmp_7;
    switch (item.associativity.d3_1) {
      case 0:
        tmp_7 = Assoc_LEFT_getInstance();
        break;
      case 1:
        tmp_7 = Assoc_RIGHT_getInstance();
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
    var assoc = tmp_7;
    var tmp$ret$6 = new RuntimePreferenceOption(prec, tgtSpine, optionNum, terminals, assoc);
    destination.r(tmp$ret$6);
  }
  var options = destination;
  return new RuntimePreferenceRule(contextRule, options);
}
function convertGrammarRule($this, target, arg) {
  var rule = findNamedRule($this, _GrammarRuleName___get_value__impl__470s0v(target.name));
  var rhs = target.rhs;
  var tmp;
  if (null == rule) {
    var tmp_0;
    if (target.isLeaf) {
      var tmp_1;
      if (isInterface(rhs, Terminal)) {
        var rrule = terminalRule($this, _GrammarRuleName___get_value__impl__470s0v(target.name), rhs.value, RuntimeRuleKind_TERMINAL_getInstance(), rhs.isPattern, target.isSkip);
        tmp_1 = new Pair(rrule, rhs);
      } else {
        var tmp_2;
        var tmp_3;
        if (isInterface(rhs, Concatenation)) {
          tmp_3 = rhs.items.v() === 1;
        } else {
          tmp_3 = false;
        }
        if (tmp_3) {
          var tmp_4 = rhs.items.z(0);
          tmp_2 = isInterface(tmp_4, Terminal);
        } else {
          tmp_2 = false;
        }
        if (tmp_2) {
          var tmp_5 = rhs.items.z(0);
          var t = isInterface(tmp_5, Terminal) ? tmp_5 : THROW_CCE();
          var rrule_0 = terminalRule($this, _GrammarRuleName___get_value__impl__470s0v(target.name), t.value, RuntimeRuleKind_TERMINAL_getInstance(), t.isPattern, target.isSkip);
          tmp_1 = new Pair(rrule_0, t);
        } else {
          var tmp_6;
          var tmp_7;
          if (isInterface(rhs, Choice)) {
            tmp_7 = rhs.alternative.v() === 1;
          } else {
            tmp_7 = false;
          }
          if (tmp_7) {
            var tmp_8 = rhs.alternative.z(0);
            tmp_6 = isInterface(tmp_8, Terminal);
          } else {
            tmp_6 = false;
          }
          if (tmp_6) {
            var tmp_9 = rhs.alternative.z(0);
            var t_0 = isInterface(tmp_9, Terminal) ? tmp_9 : THROW_CCE();
            var rrule_1 = terminalRule($this, _GrammarRuleName___get_value__impl__470s0v(target.name), t_0.value, RuntimeRuleKind_TERMINAL_getInstance(), t_0.isPattern, target.isSkip);
            tmp_1 = new Pair(rrule_1, t_0);
          } else {
            var rrule_2 = buildCompressedRule($this, target, target.isSkip);
            tmp_1 = new Pair(rrule_2, rhs);
          }
        }
      }
      tmp_0 = tmp_1;
    } else if (target.isOneEmbedded) {
      var embeddedRuleName = _GrammarRuleName___get_value__impl__470s0v(target.name);
      var tmp_10;
      var tmp_11 = target.rhs;
      if (isInterface(tmp_11, Embedded)) {
        var tmp_12 = target.rhs;
        tmp_10 = isInterface(tmp_12, Embedded) ? tmp_12 : THROW_CCE();
      } else {
        var tmp_13 = target.rhs;
        var tmp_14 = (isInterface(tmp_13, Concatenation) ? tmp_13 : THROW_CCE()).items.z(0);
        tmp_10 = isInterface(tmp_14, Embedded) ? tmp_14 : THROW_CCE();
      }
      var e = tmp_10;
      var embeddedRule_0 = embeddedRule($this, embeddedRuleName, e, false);
      recordOriginalRuleItem($this, embeddedRule_0, e);
      tmp_0 = new Pair(embeddedRule_0, e);
    } else {
      var nrule = nextRule($this, _GrammarRuleName___get_value__impl__470s0v(target.name), target.isSkip, false);
      var rrhs = createRhs($this, nrule, target.rhs, _GrammarRuleName___get_value__impl__470s0v(target.name));
      nrule.setRhs(rrhs);
      tmp_0 = new Pair(nrule, target.rhs);
    }
    var _destruct__k2r9zo = tmp_0;
    var rrule_3 = _destruct__k2r9zo.bh();
    var ruleItem = _destruct__k2r9zo.ch();
    recordOriginalRuleItem($this, rrule_3, ruleItem);
    tmp = rrule_3;
  } else {
    tmp = rule;
  }
  return tmp;
}
function createRhs($this, rule, target, arg) {
  var tmp;
  if (isInterface(target, EmptyRule)) {
    tmp = createRhsForEmpty($this, target, rule);
  } else {
    if (isInterface(target, Terminal)) {
      tmp = createRhsForTerminal($this, target, rule, arg);
    } else {
      if (isInterface(target, NonTerminal)) {
        tmp = createRhsForNonTerminal($this, target, rule, arg);
      } else {
        if (isInterface(target, Embedded)) {
          tmp = createRhsForEmbedded($this, target, rule, arg);
        } else {
          if (isInterface(target, Concatenation)) {
            tmp = createRhsForConcatenation($this, target, rule, arg);
          } else {
            if (isInterface(target, Choice)) {
              tmp = createRhsForChoice($this, target, rule, arg);
            } else {
              if (isInterface(target, OptionalItem)) {
                tmp = createRhsForOptional($this, target, rule, arg);
              } else {
                if (isInterface(target, SimpleList)) {
                  tmp = createRhsForListSimple($this, target, rule, arg);
                } else {
                  if (isInterface(target, SeparatedList)) {
                    tmp = createRhsForListSeparated($this, target, rule, arg);
                  } else {
                    if (isInterface(target, Group)) {
                      tmp = createRhsForGroup($this, target, rule, arg);
                    } else {
                      var message = 'Unsupported';
                      throw IllegalStateException.v4(toString(message));
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  return tmp;
}
function createRhsForEmpty($this, grammarRuleItem, rule) {
  return new RuntimeRuleRhsConcatenation(rule, listOf(Companion_getInstance_1().EMPTY));
}
function createRhsForTerminal($this, grammarRuleItem, rule, arg) {
  return new RuntimeRuleRhsConcatenation(rule, listOf(createRuleForRuleItemTerminal($this, grammarRuleItem, arg)));
}
function createRhsForNonTerminal($this, grammarRuleItem, rule, arg) {
  var item = createRuleForRuleItemNonTerminal($this, grammarRuleItem, arg);
  return new RuntimeRuleRhsConcatenation(rule, listOf(item));
}
function createRhsForEmbedded($this, grammarRuleItem, rule, arg) {
  // Inline function 'kotlin.TODO' call
  throw NotImplementedError.uj();
}
function createRhsForConcatenation($this, grammarRuleItem, rule, arg) {
  if (false) {
    // Inline function 'kotlin.check' call
    if (!(grammarRuleItem.items.v() > 1)) {
      throw IllegalStateException.v4('Check failed.');
    }
  }
  // Inline function 'kotlin.collections.map' call
  var this_0 = grammarRuleItem.items;
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
  var _iterator__ex2g4s = this_0.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var tmp$ret$1 = runtimeRuleForRuleItem($this, item, arg);
    destination.r(tmp$ret$1);
  }
  var items = destination;
  return new RuntimeRuleRhsConcatenation(rule, items);
}
function createRhsForChoice($this, grammarRuleItem, rule, arg) {
  var tmp;
  if (grammarRuleItem.alternative.v() === 1) {
    var message = 'Internal Error: choice should have more than one alternative';
    throw IllegalStateException.v4(toString(message));
  } else {
    // Inline function 'kotlin.collections.map' call
    var this_0 = grammarRuleItem.alternative;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = createRhsForChoiceAlternative($this, rule, item, arg);
      destination.r(tmp$ret$0);
    }
    var items = destination;
    var tmp_0;
    if (isInterface(grammarRuleItem, ChoiceLongest)) {
      tmp_0 = RuntimeRuleChoiceKind_LONGEST_PRIORITY_getInstance();
    } else {
      if (isInterface(grammarRuleItem, ChoicePriority)) {
        tmp_0 = RuntimeRuleChoiceKind_PRIORITY_LONGEST_getInstance();
      } else {
        if (isInterface(grammarRuleItem, ChoiceAmbiguous)) {
          tmp_0 = RuntimeRuleChoiceKind_AMBIGUOUS_getInstance();
        } else {
          throw RuntimeException.aa('unsupported');
        }
      }
    }
    var choiceKind = tmp_0;
    tmp = new RuntimeRuleRhsChoice(rule, choiceKind, items);
  }
  return tmp;
}
function createRhsForChoiceAlternative($this, rule, target, arg) {
  var tmp;
  if (isInterface(target, Concatenation)) {
    // Inline function 'kotlin.collections.map' call
    var this_0 = target.items;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = runtimeRuleForRuleItem($this, item, arg);
      destination.r(tmp$ret$0);
    }
    tmp = destination;
  } else {
    if (isInterface(target, ConcatenationItem)) {
      tmp = listOf(runtimeRuleForRuleItem($this, target, arg));
    } else {
      var message = 'Should not happen';
      throw IllegalStateException.v4(toString(message));
    }
  }
  var items = tmp;
  return new RuntimeRuleRhsConcatenation(rule, items);
}
function createRhsForOptional($this, grammarRuleItem, rule, arg) {
  var item = runtimeRuleForRuleItem($this, grammarRuleItem.item, arg);
  return new RuntimeRuleRhsOptional(rule, item);
}
function createRhsForListSimple($this, grammarRuleItem, rule, arg) {
  var item = runtimeRuleForRuleItem($this, grammarRuleItem.item, arg);
  return new RuntimeRuleRhsListSimple(rule, grammarRuleItem.min, grammarRuleItem.max, item);
}
function createRhsForListSeparated($this, grammarRuleItem, rule, arg) {
  var item = runtimeRuleForRuleItem($this, grammarRuleItem.item, arg);
  var separator = runtimeRuleForRuleItem($this, grammarRuleItem.separator, arg);
  return new RuntimeRuleRhsListSeparated(rule, grammarRuleItem.min, grammarRuleItem.max, item, separator);
}
function createRhsForGroup($this, grammarRuleItem, rule, arg) {
  var content = grammarRuleItem.groupedContent;
  var tmp;
  if (isInterface(content, Choice)) {
    tmp = createRhsForChoice($this, content, rule, arg);
  } else {
    var groupRuleName = _get__pseudoRuleNameGenerator__sdgpi4($this).y39(grammarRuleItem);
    tmp = createRhs($this, rule, grammarRuleItem.groupedContent, groupRuleName);
  }
  return tmp;
}
function runtimeRuleForRuleItem($this, target, arg) {
  var tmp;
  if (isInterface(target, EmptyRule)) {
    tmp = Companion_getInstance_1().EMPTY;
  } else {
    if (isInterface(target, Terminal)) {
      tmp = createRuleForRuleItemTerminal($this, target, arg);
    } else {
      if (isInterface(target, NonTerminal)) {
        tmp = createRuleForRuleItemNonTerminal($this, target, arg);
      } else {
        if (isInterface(target, Embedded)) {
          tmp = createRuleForRuleItemEmbedded($this, target, arg);
        } else {
          if (isInterface(target, Choice)) {
            tmp = createPseudoRuleForRuleItemChoice($this, target, arg);
          } else {
            if (isInterface(target, OptionalItem)) {
              tmp = createPseudoRuleForRuleItemOptional($this, target, arg);
            } else {
              if (isInterface(target, SimpleList)) {
                tmp = createPseudoRuleForRuleItemListSimple($this, target, arg);
              } else {
                if (isInterface(target, SeparatedList)) {
                  tmp = createPseudoRuleForRuleItemListSeparated($this, target, arg);
                } else {
                  if (isInterface(target, Group)) {
                    tmp = createPseudoRuleForRuleItemGroup($this, target, arg);
                  } else {
                    var message = toString(getKClassFromExpression(target)) + ' is not a supported subtype of RuleItem';
                    throw IllegalStateException.v4(toString(message));
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  return tmp;
}
function createRuleForRuleItemTerminal($this, target, arg) {
  var existing = findTerminal($this, target.value);
  var tmp;
  if (null == existing) {
    var terminalRule_0 = terminalRule($this, null, target.value, RuntimeRuleKind_TERMINAL_getInstance(), target.isPattern, false);
    recordOriginalRuleItem($this, terminalRule_0, target);
    tmp = terminalRule_0;
  } else {
    tmp = existing;
  }
  return tmp;
}
function createRuleForRuleItemNonTerminal($this, target, arg) {
  var refName = target.ruleReference;
  var tmp0_elvis_lhs = findNamedRule($this, _GrammarRuleName___get_value__impl__470s0v(refName));
  return tmp0_elvis_lhs == null ? convertGrammarRule($this, target.referencedRule(ensureNotNull($this.j1x_1)), arg) : tmp0_elvis_lhs;
}
function createRuleForRuleItemEmbedded($this, target, arg) {
  var existing = findEmbedded($this, target);
  var tmp;
  if (null == existing) {
    var embeddedRule_0 = embeddedRule($this, null, target, false);
    recordOriginalRuleItem($this, embeddedRule_0, target);
    tmp = embeddedRule_0;
  } else {
    tmp = existing;
  }
  return tmp;
}
function createPseudoRuleForRuleItemChoice($this, target, arg) {
  var chRuleName = _get__pseudoRuleNameGenerator__sdgpi4($this).y39(target);
  var nrule = createPseudoRule($this, target, chRuleName);
  var rhs = createRhsForChoice($this, target, nrule, chRuleName);
  nrule.setRhs(rhs);
  return nrule;
}
function createPseudoRuleForRuleItemOptional($this, target, arg) {
  var optRuleName = _get__pseudoRuleNameGenerator__sdgpi4($this).y39(target);
  var nrule = nextRule($this, optRuleName, false, true);
  nrule.setRhs(createRhsForOptional($this, target, nrule, optRuleName));
  recordOriginalRuleItem($this, nrule, target);
  return nrule;
}
function createPseudoRuleForRuleItemListSimple($this, target, arg) {
  var multiRuleName = _get__pseudoRuleNameGenerator__sdgpi4($this).y39(target);
  var nrule = nextRule($this, multiRuleName, false, true);
  nrule.setRhs(createRhsForListSimple($this, target, nrule, multiRuleName));
  recordOriginalRuleItem($this, nrule, target);
  return nrule;
}
function createPseudoRuleForRuleItemListSeparated($this, target, arg) {
  var sListRuleName = _get__pseudoRuleNameGenerator__sdgpi4($this).y39(target);
  var nrule = nextRule($this, sListRuleName, false, true);
  nrule.setRhs(createRhsForListSeparated($this, target, nrule, sListRuleName));
  recordOriginalRuleItem($this, nrule, target);
  return nrule;
}
function createPseudoRuleForRuleItemGroup($this, target, arg) {
  var content = target.groupedContent;
  var tmp;
  if (isInterface(content, Choice)) {
    tmp = createPseudoRuleForRuleItemChoice($this, content, arg);
  } else {
    var grRuleName = _get__pseudoRuleNameGenerator__sdgpi4($this).y39(target);
    var nrule = createPseudoRule($this, target.groupedContent, grRuleName);
    var rhs = createRhs($this, nrule, target.groupedContent, grRuleName);
    nrule.setRhs(rhs);
    tmp = nrule;
  }
  return tmp;
}
function createPseudoRule($this, target, psudeoRuleName) {
  var nrule = nextRule($this, psudeoRuleName, false, true);
  recordOriginalRuleItem($this, nrule, target);
  return nrule;
}
function ConverterToRuntimeRules$runtimeRuleSet$delegate$lambda(this$0) {
  return () => {
    convertGrammar(this$0, this$0.j1x_1, '');
    var rules = toList(this$0.n1x_1.v2());
    return new RuntimeRuleSet(_get__ruleSetNumber__ss0daz(this$0), _QualifiedName___get_value__impl__nkc4gq(this$0.j1x_1.qualifiedName), rules, this$0.o1x_1);
  };
}
function ConverterToRuntimeRules$_ruleSetNumber$delegate$lambda(this$0) {
  return () => Companion_getInstance_1().numberForGrammar.z2(_QualifiedName___get_value__impl__nkc4gq(this$0.j1x_1.qualifiedName));
}
function ConverterToRuntimeRules$_pseudoRuleNameGenerator$delegate$lambda(this$0) {
  return () => new PseudoRuleNames(this$0.j1x_1);
}
function runtimeRuleSet$factory() {
  return getPropertyCallableRef('runtimeRuleSet', 1, KProperty1, (receiver) => receiver.jr(), null);
}
function _ruleSetNumber$factory() {
  return getPropertyCallableRef('_ruleSetNumber', 1, KProperty1, (receiver) => _get__ruleSetNumber__ss0daz(receiver), null);
}
function _pseudoRuleNameGenerator$factory() {
  return getPropertyCallableRef('_pseudoRuleNameGenerator', 1, KProperty1, (receiver) => _get__pseudoRuleNameGenerator__sdgpi4(receiver), null);
}
function pseudoRulesFor($this, item) {
  var tmp;
  if (isInterface(item, Embedded)) {
    tmp = setOf(new Pair(item, createEmbeddedRuleName($this, item.embeddedGrammarReference.nameOrQName.value, _GrammarRuleName___get_value__impl__470s0v(item.embeddedGoalName))));
  } else {
    if (isInterface(item, Terminal)) {
      tmp = emptySet();
    } else {
      if (isInterface(item, NonTerminal)) {
        tmp = emptySet();
      } else {
        if (isInterface(item, EmptyRule)) {
          tmp = emptySet();
        } else {
          if (isInterface(item, Choice)) {
            // Inline function 'kotlin.collections.flatMap' call
            var tmp0 = item.alternative;
            // Inline function 'kotlin.collections.flatMapTo' call
            var destination = ArrayList.y();
            var _iterator__ex2g4s = tmp0.s();
            while (_iterator__ex2g4s.t()) {
              var element = _iterator__ex2g4s.u();
              var list = pseudoRulesFor($this, element);
              addAll(destination, list);
            }
            tmp = plus_1(toSet(destination), new Pair(item, createChoiceRuleName($this, _GrammarRuleName___get_value__impl__470s0v(item.owningRule.name))));
          } else {
            if (isInterface(item, Concatenation)) {
              // Inline function 'kotlin.collections.flatMap' call
              var tmp0_0 = item.items;
              // Inline function 'kotlin.collections.flatMapTo' call
              var destination_0 = ArrayList.y();
              var _iterator__ex2g4s_0 = tmp0_0.s();
              while (_iterator__ex2g4s_0.t()) {
                var element_0 = _iterator__ex2g4s_0.u();
                var list_0 = pseudoRulesFor($this, element_0);
                addAll(destination_0, list_0);
              }
              tmp = toSet(destination_0);
            } else {
              if (isInterface(item, OptionalItem)) {
                tmp = plus_1(pseudoRulesFor($this, item.item), new Pair(item, createOptionalItemRuleName($this, _GrammarRuleName___get_value__impl__470s0v(item.owningRule.name))));
              } else {
                if (isInterface(item, SimpleList)) {
                  tmp = plus_1(pseudoRulesFor($this, item.item), new Pair(item, createSimpleListRuleName($this, _GrammarRuleName___get_value__impl__470s0v(item.owningRule.name))));
                } else {
                  if (isInterface(item, SeparatedList)) {
                    tmp = plus_1(plus_2(pseudoRulesFor($this, item.item), pseudoRulesFor($this, item.separator)), new Pair(item, createSeparatedListRuleName($this, _GrammarRuleName___get_value__impl__470s0v(item.owningRule.name))));
                  } else {
                    if (isInterface(item, Group)) {
                      var tmp1_subject = item.groupedContent;
                      var tmp_0;
                      if (isInterface(tmp1_subject, Choice)) {
                        tmp_0 = plus_1(pseudoRulesFor($this, item.groupedContent), new Pair(item, createChoiceRuleName($this, _GrammarRuleName___get_value__impl__470s0v(item.owningRule.name))));
                      } else {
                        tmp_0 = plus_1(pseudoRulesFor($this, item.groupedContent), new Pair(item, createGroupRuleName($this, _GrammarRuleName___get_value__impl__470s0v(item.owningRule.name))));
                      }
                      tmp = tmp_0;
                    } else {
                      var message = 'Internal Error: subtype of ' + getKClass(RuleItem).zc() + ' ' + getKClassFromExpression(item).zc() + ' not handled';
                      throw IllegalStateException.v4(toString(message));
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  return tmp;
}
function createEmbeddedRuleName($this, grammarName, goalName) {
  var baseName = grammarName + '\xA7' + goalName;
  var tmp0_elvis_lhs = $this.q39_1.z2(baseName);
  var n = tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs;
  n = n + 1 | 0;
  var tmp0 = $this.q39_1;
  // Inline function 'kotlin.collections.set' call
  var value = n;
  tmp0.r2(baseName, value);
  return '\xA7' + removePrefix(baseName, '\xA7') + '\xA7embedded' + n;
}
function createGroupRuleName($this, parentRuleName) {
  var tmp0_elvis_lhs = $this.r39_1.z2(parentRuleName);
  var n = tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs;
  n = n + 1 | 0;
  var tmp0 = $this.r39_1;
  // Inline function 'kotlin.collections.set' call
  var value = n;
  tmp0.r2(parentRuleName, value);
  return '\xA7' + removePrefix(parentRuleName, '\xA7') + '\xA7group' + n;
}
function createChoiceRuleName($this, parentRuleName) {
  var tmp0_elvis_lhs = $this.s39_1.z2(parentRuleName);
  var n = tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs;
  n = n + 1 | 0;
  var tmp0 = $this.s39_1;
  // Inline function 'kotlin.collections.set' call
  var value = n;
  tmp0.r2(parentRuleName, value);
  return '\xA7' + removePrefix(parentRuleName, '\xA7') + '\xA7choice' + n;
}
function createOptionalItemRuleName($this, parentRuleName) {
  var tmp0_elvis_lhs = $this.t39_1.z2(parentRuleName);
  var n = tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs;
  n = n + 1 | 0;
  var tmp0 = $this.t39_1;
  // Inline function 'kotlin.collections.set' call
  var value = n;
  tmp0.r2(parentRuleName, value);
  return '\xA7' + removePrefix(parentRuleName, '\xA7') + '\xA7opt' + n;
}
function createSimpleListRuleName($this, parentRuleName) {
  var tmp0_elvis_lhs = $this.u39_1.z2(parentRuleName);
  var n = tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs;
  n = n + 1 | 0;
  var tmp0 = $this.u39_1;
  // Inline function 'kotlin.collections.set' call
  var value = n;
  tmp0.r2(parentRuleName, value);
  return '\xA7' + removePrefix(parentRuleName, '\xA7') + '\xA7multi' + n;
}
function createSeparatedListRuleName($this, parentRuleName) {
  var tmp0_elvis_lhs = $this.v39_1.z2(parentRuleName);
  var n = tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs;
  n = n + 1 | 0;
  var tmp0 = $this.v39_1;
  // Inline function 'kotlin.collections.set' call
  var value = n;
  tmp0.r2(parentRuleName, value);
  return '\xA7' + removePrefix(parentRuleName, '\xA7') + '\xA7sepList' + n;
}
var Companion_instance_21;
function Companion_getInstance_23() {
  return Companion_instance_21;
}
function grammarTypeNamespace(_this__u8e3s4, namespaceQualifiedName, imports, resolveImports, init) {
  imports = imports === VOID ? listOf(_QualifiedName___get_value__impl__nkc4gq(StdLibDefault_getInstance().t2e_1)) : imports;
  resolveImports = resolveImports === VOID ? false : resolveImports;
  var tmp = _QualifiedName___init__impl__8ed982(namespaceQualifiedName);
  // Inline function 'kotlin.collections.map' call
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(imports, 10));
  var _iterator__ex2g4s = imports.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var tmp$ret$0 = new Import(_Import___init__impl__786z8c(item));
    destination.r(tmp$ret$0);
  }
  var b = new GrammarTypeNamespaceBuilder(_this__u8e3s4._model, tmp, toMutableList(destination), resolveImports);
  init(b);
  var ns = b.build();
  _this__u8e3s4._model.addNamespace(ns);
}
function grammarTypeModel(namespaceQualifiedName, modelName, imports, init) {
  imports = imports === VOID ? listOf(StdLibDefault_getInstance()) : imports;
  var model = new TypeModelSimple(_SimpleName___init__impl__6s45d0(modelName));
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = imports.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    model.addNamespace(element);
  }
  var tmp = _QualifiedName___init__impl__8ed982(namespaceQualifiedName);
  // Inline function 'kotlin.collections.map' call
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(imports, 10));
  var _iterator__ex2g4s_0 = imports.s();
  while (_iterator__ex2g4s_0.t()) {
    var item = _iterator__ex2g4s_0.u();
    var tmp$ret$2 = new Import(_Import___init__impl__786z8c(_QualifiedName___get_value__impl__nkc4gq(item.qualifiedName)));
    destination.r(tmp$ret$2);
  }
  var b = new GrammarTypeNamespaceBuilder(model, tmp, toMutableList(destination), true);
  init(b);
  var ns = b.build();
  model.addNamespace(ns);
  model.resolveImports();
  return model;
}
function _get__grammarNamespace__4jqlgi($this) {
  var tmp = $this.r38_1;
  return isInterface(tmp, GrammarTypeNamespace) ? tmp : THROW_CCE();
}
function AglCrossReference$grammar$lambda($this$grammar) {
  $this$grammar.extendsGrammar(AglExpressions_getInstance().defaultTargetGrammar.selfReference);
  var tmp = OverrideKind_REPLACE_getInstance();
  $this$grammar.concatenation('namespace', tmp, VOID, VOID, AglCrossReference$grammar$lambda$lambda);
  $this$grammar.concatenation('declarations', VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_0);
  $this$grammar.list('rootIdentifiables', 0, -1, VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_1);
  $this$grammar.list('scopes', 0, -1, VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_2);
  $this$grammar.concatenation('scope', VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_3);
  $this$grammar.list('identifiables', 0, -1, VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_4);
  $this$grammar.concatenation('identifiable', VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_5);
  $this$grammar.concatenation('references', VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_6);
  $this$grammar.list('referenceDefinitions', 0, -1, VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_7);
  $this$grammar.concatenation('referenceDefinition', VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_8);
  $this$grammar.list('referenceExpressionList', 0, -1, VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_9);
  $this$grammar.choice('referenceExpression', VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_10);
  $this$grammar.concatenation('propertyReferenceExpression', VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_11);
  $this$grammar.concatenation('from', VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_12);
  $this$grammar.concatenation('collectionReferenceExpression', VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_13);
  $this$grammar.concatenation('ofType', VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_14);
  $this$grammar.choice('rootOrNavigation', VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_15);
  $this$grammar.separatedList('typeReferences', 1, -1, VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_16);
  $this$grammar.concatenation('possiblyQualifiedTypeReference', VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_17);
  $this$grammar.concatenation('simpleTypeName', VOID, VOID, VOID, AglCrossReference$grammar$lambda$lambda_18);
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda($this$concatenation) {
  $this$concatenation.r2t('namespace');
  $this$concatenation.q2t('possiblyQualifiedName');
  $this$concatenation.p2t(0, -1, AglCrossReference$grammar$lambda$lambda$lambda);
  $this$concatenation.q2t('declarations');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda$lambda($this$lst) {
  $this$lst.q2t('import');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_0($this$concatenation) {
  $this$concatenation.q2t('rootIdentifiables');
  $this$concatenation.q2t('scopes');
  $this$concatenation.s2t(AglCrossReference$grammar$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda$lambda_0($this$opt) {
  $this$opt.q2t('references');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_1($this$list) {
  $this$list.q2t('identifiable');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_2($this$list) {
  $this$list.q2t('scope');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_3($this$concatenation) {
  $this$concatenation.r2t('scope');
  $this$concatenation.q2t('simpleTypeName');
  $this$concatenation.r2t('{');
  $this$concatenation.q2t('identifiables');
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_4($this$list) {
  $this$list.q2t('identifiable');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_5($this$concatenation) {
  $this$concatenation.r2t('identify');
  $this$concatenation.q2t('simpleTypeName');
  $this$concatenation.r2t('by');
  $this$concatenation.q2t('expression');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_6($this$concatenation) {
  $this$concatenation.r2t('references');
  $this$concatenation.r2t('{');
  $this$concatenation.q2t('referenceDefinitions');
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_7($this$list) {
  $this$list.q2t('referenceDefinition');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_8($this$concatenation) {
  $this$concatenation.r2t('in');
  $this$concatenation.q2t('simpleTypeName');
  $this$concatenation.r2t('{');
  $this$concatenation.q2t('referenceExpressionList');
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_9($this$list) {
  $this$list.q2t('referenceExpression');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_10($this$choice) {
  $this$choice.q2t('propertyReferenceExpression');
  $this$choice.q2t('collectionReferenceExpression');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_11($this$concatenation) {
  $this$concatenation.r2t('property');
  $this$concatenation.q2t('rootOrNavigation');
  $this$concatenation.r2t('refers-to');
  $this$concatenation.q2t('typeReferences');
  $this$concatenation.s2t(AglCrossReference$grammar$lambda$lambda$lambda_1);
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda$lambda_1($this$opt) {
  $this$opt.q2t('from');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_12($this$concatenation) {
  $this$concatenation.r2t('from');
  $this$concatenation.q2t('navigationExpression');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_13($this$concatenation) {
  $this$concatenation.r2t('forall');
  $this$concatenation.q2t('rootOrNavigation');
  $this$concatenation.s2t(AglCrossReference$grammar$lambda$lambda$lambda_2);
  $this$concatenation.r2t('{');
  $this$concatenation.q2t('referenceExpressionList');
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda$lambda_2($this$opt) {
  $this$opt.q2t('ofType');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_14($this$concatenation) {
  $this$concatenation.r2t('of-type');
  $this$concatenation.q2t('possiblyQualifiedTypeReference');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_15($this$choice) {
  $this$choice.q2t('rootExpression');
  $this$choice.q2t('navigationExpression');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_16($this$separatedList) {
  $this$separatedList.q2t('possiblyQualifiedTypeReference');
  $this$separatedList.r2t('|');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_17($this$concatenation) {
  $this$concatenation.q2t('possiblyQualifiedName');
  return Unit_instance;
}
function AglCrossReference$grammar$lambda$lambda_18($this$concatenation) {
  $this$concatenation.q2t('IDENTIFIER');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda() {
  var tmp = AglExpressions_getInstance().typesModel.namespace;
  return typeModel('CrossReferences', true, tmp, AglCrossReference$typeModel$delegate$lambda$lambda);
}
function AglCrossReference$typeModel$delegate$lambda$lambda($this$typeModel) {
  var tmp = listOf_0(['net.akehurst.language.base.api', 'std', 'net.akehurst.language.expressions.api']);
  $this$typeModel.namespace('net.akehurst.language.reference.api', tmp, AglCrossReference$typeModel$delegate$lambda$lambda$lambda);
  var tmp_0 = listOf_0(['net.akehurst.language.reference.api', 'std', 'net.akehurst.language.base.api', 'net.akehurst.language.expressions.api', 'net.akehurst.language.base.asm']);
  $this$typeModel.namespace('net.akehurst.language.reference.asm', tmp_0, AglCrossReference$typeModel$delegate$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.interface_('ScopeDefinition', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda);
  $this$namespace.interface_('ReferenceExpressionProperty', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_0);
  $this$namespace.interface_('ReferenceExpressionCollection', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_1);
  $this$namespace.interface_('ReferenceExpression', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_2);
  $this$namespace.interface_('ReferenceDefinition', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_3);
  $this$namespace.interface_('Identifiable', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_4);
  $this$namespace.interface_('DeclarationsForNamespace', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_5);
  $this$namespace.interface_('CrossReferenceNamespace', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_6);
  $this$namespace.interface_('CrossReferenceModel', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_7);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda($this$interface_) {
  $this$interface_.supertype('Formatable');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'identifiables', 'List', false, AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda($this$propertyOf) {
  $this$propertyOf.typeArgument('Identifiable');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_0($this$interface_) {
  $this$interface_.supertype('ReferenceExpression');
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'fromNavigation', 'NavigationExpression', false);
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'referringPropertyNavigation', 'NavigationExpression', false);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_1($this$interface_) {
  $this$interface_.supertype('ReferenceExpression');
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'expression', 'Expression', false);
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'referenceExpressionList', 'List', false, AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$propertyOf) {
  $this$propertyOf.typeArgument('ReferenceExpression');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_2($this$interface_) {
  $this$interface_.supertype('Formatable');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_3($this$interface_) {
  $this$interface_.supertype('Formatable');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'referenceExpressionList', 'List', false, AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$propertyOf) {
  $this$propertyOf.typeArgument('ReferenceExpression');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_4($this$interface_) {
  $this$interface_.supertype('Formatable');
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'identifiedBy', 'Expression', false);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_5($this$interface_) {
  $this$interface_.supertype('Definition', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'references', 'List', false, AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  var tmp_0 = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp_0, 'scopeDefinition', 'Map', false, AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$supertype) {
  $this$supertype.ref('DeclarationsForNamespace');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$propertyOf) {
  $this$propertyOf.typeArgument('ReferenceDefinition');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$propertyOf) {
  $this$propertyOf.typeArgument('SimpleName');
  $this$propertyOf.typeArgument('ScopeDefinition');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_6($this$interface_) {
  $this$interface_.supertype('Namespace', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$supertype) {
  $this$supertype.ref('DeclarationsForNamespace');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_7($this$interface_) {
  $this$interface_.supertype('Model', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$supertype) {
  $this$supertype.ref('CrossReferenceNamespace');
  $this$supertype.ref('DeclarationsForNamespace');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda_0($this$namespace) {
  $this$namespace.data('ScopeDefinitionDefault', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_8);
  $this$namespace.data('ReferenceExpressionPropertyDefault', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_9);
  $this$namespace.data('ReferenceExpressionCollectionDefault', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_10);
  $this$namespace.data('ReferenceExpressionAbstract', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_11);
  $this$namespace.data('ReferenceDefinitionDefault', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_12);
  $this$namespace.data('IdentifiableDefault', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_13);
  $this$namespace.data('DeclarationsForNamespaceDefault', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_14);
  $this$namespace.data('CrossReferenceNamespaceDefault', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_15);
  $this$namespace.data('CrossReferenceModelDefault', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_16);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_8($this$data) {
  $this$data.supertype('ScopeDefinition');
  $this$data.constructor_(AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'identifiables', 'List', false, AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_8);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'scopeForTypeName', 'SimpleName', false);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$constructor_) {
  $this$constructor_.parameter('scopeForTypeName', 'SimpleName', false);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_8($this$propertyOf) {
  $this$propertyOf.typeArgument('Identifiable');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_9($this$data) {
  $this$data.supertype('ReferenceExpressionAbstract');
  $this$data.supertype('ReferenceExpressionProperty');
  $this$data.constructor_(AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_9);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'fromNavigation', 'NavigationExpression', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'referringPropertyNavigation', 'NavigationExpression', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'refersToTypeName', 'List', false, AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_10);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_9($this$constructor_) {
  $this$constructor_.parameter('referringPropertyNavigation', 'NavigationExpression', false);
  $this$constructor_.parameter('refersToTypeName', 'List', false);
  $this$constructor_.parameter('fromNavigation', 'NavigationExpression', false);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_10($this$propertyOf) {
  $this$propertyOf.typeArgument('PossiblyQualifiedName');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_10($this$data) {
  $this$data.supertype('ReferenceExpressionAbstract');
  $this$data.supertype('ReferenceExpressionCollection');
  $this$data.constructor_(AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_11);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'expression', 'Expression', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'ofType', 'PossiblyQualifiedName', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'referenceExpressionList', 'List', false, AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_12);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_11($this$constructor_) {
  $this$constructor_.parameter('expression', 'Expression', false);
  $this$constructor_.parameter('ofType', 'PossiblyQualifiedName', false);
  $this$constructor_.parameter('referenceExpressionList', 'List', false);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_12($this$propertyOf) {
  $this$propertyOf.typeArgument('ReferenceExpressionAbstract');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_11($this$data) {
  $this$data.supertype('ReferenceExpression');
  $this$data.constructor_(AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_13);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_13($this$constructor_) {
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_12($this$data) {
  $this$data.supertype('ReferenceDefinition');
  $this$data.constructor_(AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_14);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'inTypeName', 'SimpleName', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'referenceExpressionList', 'List', false, AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_15);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_14($this$constructor_) {
  $this$constructor_.parameter('inTypeName', 'SimpleName', false);
  $this$constructor_.parameter('referenceExpressionList', 'List', false);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_15($this$propertyOf) {
  $this$propertyOf.typeArgument('ReferenceExpression');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_13($this$data) {
  $this$data.supertype('Identifiable');
  $this$data.constructor_(AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_16);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'identifiedBy', 'Expression', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'typeName', 'SimpleName', false);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_16($this$constructor_) {
  $this$constructor_.parameter('typeName', 'SimpleName', false);
  $this$constructor_.parameter('identifiedBy', 'Expression', false);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_14($this$data) {
  $this$data.supertype('DeclarationsForNamespace');
  $this$data.supertype('DefinitionAbstract', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_17);
  $this$data.constructor_(AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_18);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'CrossReferenceNamespace', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'options', 'OptionHolder', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'references', 'List', false, AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_19);
  var tmp_0 = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp_0, 'scopeDefinition', 'Map', false, AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_20);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_17($this$supertype) {
  $this$supertype.ref('net.akehurst.language.reference.api.DeclarationsForNamespace');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_18($this$constructor_) {
  $this$constructor_.parameter('namespace', 'CrossReferenceNamespace', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_19($this$propertyOf) {
  $this$propertyOf.typeArgument('ReferenceDefinition');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_20($this$propertyOf) {
  $this$propertyOf.typeArgument('SimpleName');
  $this$propertyOf.typeArgument('ScopeDefinition');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_15($this$data) {
  $this$data.supertype('NamespaceAbstract', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_21);
  $this$data.supertype('CrossReferenceNamespace');
  $this$data.constructor_(AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_22);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'qualifiedName', 'QualifiedName', false);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_21($this$supertype) {
  $this$supertype.ref('net.akehurst.language.reference.api.DeclarationsForNamespace');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_22($this$constructor_) {
  $this$constructor_.parameter('qualifiedName', 'QualifiedName', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  $this$constructor_.parameter('import', 'List', false);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda_16($this$data) {
  $this$data.supertype('ModelAbstract', AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_23);
  $this$data.supertype('CrossReferenceModel');
  $this$data.constructor_(AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_24);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_23($this$supertype) {
  $this$supertype.ref('net.akehurst.language.reference.api.CrossReferenceNamespace');
  $this$supertype.ref('net.akehurst.language.reference.api.DeclarationsForNamespace');
  return Unit_instance;
}
function AglCrossReference$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_24($this$constructor_) {
  $this$constructor_.parameter('name', 'SimpleName', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  $this$constructor_.parameter('namespace', 'List', false);
  return Unit_instance;
}
var AglCrossReference_instance;
function AglCrossReference_getInstance() {
  if (AglCrossReference_instance === VOID)
    new AglCrossReference_0();
  return AglCrossReference_instance;
}
function typeModel$factory_0() {
  return getPropertyCallableRef('typeModel', 1, KProperty1, (receiver) => receiver.typeModel, null);
}
function raiseError_0($this, obj, message) {
  var loc = $this.v3b_1.get(obj);
  $this.t3b_1.error(loc, message);
}
function checkScopeDefinition($this, scopeDef) {
  var tmp;
  if (_QualifiedName___get_last__impl__838y8h(Companion_getInstance_24().ROOT_SCOPE_TYPE_NAME) === scopeDef.z3b_1) {
    tmp = 'In root scope';
  } else {
    var tmp0_safe_receiver = $this.w3b_1;
    var scopedType = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.findTypeNamed(new SimpleName(scopeDef.z3b_1));
    if (null == scopedType) {
      raiseError_0($this, new PropertyValue_0(scopeDef, 'typeReference'), "Scope type '" + SimpleName__toString_impl_vxsxyc(scopeDef.z3b_1) + "' not found");
    }
    tmp = "In scope for type '" + SimpleName__toString_impl_vxsxyc(scopeDef.z3b_1) + "'";
  }
  var msgStart = tmp;
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = scopeDef.a3c_1.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var tmp0_safe_receiver_0 = $this.w3b_1;
    var identifiedType = tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.findTypeNamed(new SimpleName(element.typeName));
    var identifiedBy = element.identifiedBy;
    if (null == identifiedType) {
      raiseError_0($this, new PropertyValue_0(element, 'simpleTypeName'), "Type to identify '" + SimpleName__toString_impl_vxsxyc(element.typeName) + "' not found");
    } else {
      var identifyingProperty = ensureNotNull($this.y3b_1).typeFor(identifiedBy, identifiedType.type());
      if (equals(identifyingProperty, StdLibDefault_getInstance().NothingType)) {
        raiseError_0($this, new PropertyValue_0(element, 'expression'), msgStart + ", '" + toString(element.identifiedBy) + "' not found for identifying property of '" + SimpleName__toString_impl_vxsxyc(element.typeName) + "'");
      }
    }
  }
}
function checkReferenceDefinition($this, crossReferenceModel, ref, importedNamespaces) {
  var tmp0_safe_receiver = $this.w3b_1;
  var contextType = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.findOwnedTypeNamed(ref.b3c_1);
  if (null == contextType) {
    raiseError_0($this, new PropertyValue_0(ref, 'in'), "Referring type '" + SimpleName__toString_impl_vxsxyc(ref.b3c_1) + "' not found");
  } else {
    var _iterator__ex2g4s = ref.c3c_1.s();
    while (_iterator__ex2g4s.t()) {
      var refExpr = _iterator__ex2g4s.u();
      checkReferenceExpression($this, crossReferenceModel, contextType, ref, refExpr, importedNamespaces);
    }
  }
}
function checkReferenceExpression($this, crossReferenceModel, contextType, ref, refExpr, importedNamespaces) {
  var tmp;
  if (refExpr instanceof ReferenceExpressionPropertyDefault) {
    checkPropertyReferenceExpression($this, crossReferenceModel, contextType, ref, refExpr, importedNamespaces);
    tmp = Unit_instance;
  } else {
    if (refExpr instanceof ReferenceExpressionCollectionDefault) {
      checkCollectionReferenceExpression($this, crossReferenceModel, contextType, ref, refExpr, importedNamespaces);
      tmp = Unit_instance;
    } else {
      var message = "subtype of 'ReferenceExpression' not handled: '" + getKClassFromExpression(refExpr).zc() + "'";
      throw IllegalStateException.v4(toString(message));
    }
  }
  return tmp;
}
function checkCollectionReferenceExpression($this, crossReferenceModel, contextType, ref, refExpr, importedNamespaces) {
  var tmp0_safe_receiver = refExpr.m2j_1;
  if (tmp0_safe_receiver == null)
    null;
  else {
    // Inline function 'kotlin.let' call
    var tmp0_safe_receiver_0 = $this.w3b_1;
    var type = tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.findTypeNamed(tmp0_safe_receiver);
    if (type == null) {
      raiseError_0($this, tmp0_safe_receiver, "For references in '" + SimpleName__toString_impl_vxsxyc(ref.b3c_1) + "', forall '" + toString(refExpr.l2j_1) + "', the of-type '" + toString(tmp0_safe_receiver) + "' is not found");
    }
  }
  var collTypeInstance = ensureNotNull($this.y3b_1).typeFor(refExpr.l2j_1, contextType.type());
  var tmp1_subject = collTypeInstance.resolvedDeclaration;
  if (isInterface(tmp1_subject, SpecialType)) {
    if (!equals(StdLibDefault_getInstance().NothingType, collTypeInstance.resolvedDeclaration)) {
      // Inline function 'kotlin.TODO' call
      throw NotImplementedError.uj();
    }
  } else {
    if (isInterface(tmp1_subject, CollectionType)) {
      var loopVarType = collTypeInstance.typeArguments.z(0).type.resolvedDeclaration;
      var tmp2_safe_receiver = refExpr.m2j_1;
      var tmp;
      if (tmp2_safe_receiver == null) {
        tmp = null;
      } else {
        // Inline function 'kotlin.let' call
        var tmp0_safe_receiver_1 = $this.w3b_1;
        var ofType = tmp0_safe_receiver_1 == null ? null : tmp0_safe_receiver_1.findTypeNamed(tmp2_safe_receiver);
        var tmp_0;
        if (null == ofType) {
          var message = 'Should not happen, checked above.';
          throw IllegalStateException.v4(toString(message));
        } else {
          var tmp_1;
          var tmp_2;
          if (isInterface(loopVarType, DataType)) {
            tmp_2 = !(ofType == null) ? isInterface(ofType, DataType) : false;
          } else {
            tmp_2 = false;
          }
          if (tmp_2) {
            var tmp1 = ofType.allSuperTypes;
            var tmp$ret$2;
            $l$block_0: {
              // Inline function 'kotlin.collections.any' call
              var tmp_3;
              if (isInterface(tmp1, Collection)) {
                tmp_3 = tmp1.a1();
              } else {
                tmp_3 = false;
              }
              if (tmp_3) {
                tmp$ret$2 = false;
                break $l$block_0;
              }
              var _iterator__ex2g4s = tmp1.s();
              while (_iterator__ex2g4s.t()) {
                var element = _iterator__ex2g4s.u();
                if (equals(element.resolvedDeclaration, loopVarType)) {
                  tmp$ret$2 = true;
                  break $l$block_0;
                }
              }
              tmp$ret$2 = false;
            }
            tmp_1 = tmp$ret$2;
          } else {
            tmp_1 = false;
          }
          if (tmp_1) {
            tmp_0 = ofType;
          } else {
            var tmp_4;
            if (isInterface(loopVarType, UnionType)) {
              var tmp3 = loopVarType.alternatives;
              var tmp$ret$4;
              $l$block_2: {
                // Inline function 'kotlin.collections.any' call
                var tmp_5;
                if (isInterface(tmp3, Collection)) {
                  tmp_5 = tmp3.a1();
                } else {
                  tmp_5 = false;
                }
                if (tmp_5) {
                  tmp$ret$4 = false;
                  break $l$block_2;
                }
                var _iterator__ex2g4s_0 = tmp3.s();
                while (_iterator__ex2g4s_0.t()) {
                  var element_0 = _iterator__ex2g4s_0.u();
                  if (equals(element_0.resolvedDeclaration, ofType)) {
                    tmp$ret$4 = true;
                    break $l$block_2;
                  }
                }
                tmp$ret$4 = false;
              }
              tmp_4 = tmp$ret$4;
            } else {
              tmp_4 = false;
            }
            if (tmp_4) {
              tmp_0 = ofType;
            } else {
              raiseError_0($this, ref, "The of-type '" + SimpleName__toString_impl_vxsxyc(ofType.name) + "' is not a subtype of the loop variable type '" + SimpleName__toString_impl_vxsxyc(loopVarType.name) + "'");
              tmp_0 = null;
            }
          }
        }
        tmp = tmp_0;
      }
      var tmp3_elvis_lhs = tmp;
      var filteredLoopVarType = tmp3_elvis_lhs == null ? loopVarType : tmp3_elvis_lhs;
      var _iterator__ex2g4s_1 = refExpr.n2j_1.s();
      while (_iterator__ex2g4s_1.t()) {
        var re = _iterator__ex2g4s_1.u();
        checkReferenceExpression($this, crossReferenceModel, filteredLoopVarType, ref, re, importedNamespaces);
      }
    } else {
      throw NotImplementedError.uj();
    }
  }
}
function checkPropertyReferenceExpression($this, crossReferenceModel, contextType, ref, refExpr, importedNamespaces) {
  // Inline function 'kotlin.collections.forEachIndexed' call
  var index = 0;
  var _iterator__ex2g4s = refExpr.j2j_1.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var _unary__edvuaz = index;
    index = _unary__edvuaz + 1 | 0;
    var i = checkIndexOverflow(_unary__edvuaz);
    if (null == findReferredToType($this, item, importedNamespaces)) {
      raiseError_0($this, new PropertyValue_0(ref, 'typeReferences[' + i + ']'), "For references in '" + SimpleName__toString_impl_vxsxyc(ref.b3c_1) + "', referred to type '" + toString(item) + "' not found");
    }
  }
  var prop = ensureNotNull($this.y3b_1).lastPropertyDeclarationFor(refExpr.i2j_1, contextType.type());
  if (prop == null) {
    raiseError_0($this, new PropertyValue_0(refExpr, 'propertyReference'), "For references in '" + SimpleName__toString_impl_vxsxyc(ref.b3c_1) + "' referring property '" + toString(refExpr.i2j_1) + "' not found");
  } else {
    // Inline function 'kotlin.collections.mapNotNull' call
    var tmp0 = refExpr.j2j_1;
    // Inline function 'kotlin.collections.mapNotNullTo' call
    var destination = ArrayList.y();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = tmp0.s();
    while (_iterator__ex2g4s_0.t()) {
      var element = _iterator__ex2g4s_0.u();
      var tmp0_safe_receiver = findReferredToType($this, element, importedNamespaces);
      var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.qualifiedName;
      var tmp0_safe_receiver_0 = tmp == null ? null : new QualifiedName(tmp);
      if (tmp0_safe_receiver_0 == null)
        null;
      else {
        // Inline function 'kotlin.let' call
        destination.r(tmp0_safe_receiver_0);
      }
    }
    var qualifiedTypeNames = destination;
    (crossReferenceModel instanceof CrossReferenceModelDefault ? crossReferenceModel : THROW_CCE()).addRecordReferenceForProperty(prop.owner.qualifiedName, _PropertyName___get_value__impl__p219lh(prop.name), qualifiedTypeNames);
  }
}
function findReferredToType($this, name, importedNamespaces) {
  var tmp0_safe_receiver = $this.w3b_1;
  var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.findTypeNamed(name);
  var tmp;
  if (tmp1_elvis_lhs == null) {
    var tmp$ret$1;
    $l$block: {
      // Inline function 'kotlin.collections.firstNotNullOfOrNull' call
      var _iterator__ex2g4s = importedNamespaces.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        var result = element.findOwnedTypeNamed(name instanceof SimpleName ? name.a1u_1 : THROW_CCE());
        if (!(result == null)) {
          tmp$ret$1 = result;
          break $l$block;
        }
      }
      tmp$ret$1 = null;
    }
    tmp = tmp$ret$1;
  } else {
    tmp = tmp1_elvis_lhs;
  }
  return tmp;
}
function unit_1($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var options = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var namespace = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  // Inline function 'kotlin.collections.associate' call
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(options, 10)), 16);
  // Inline function 'kotlin.collections.associateTo' call
  var destination = LinkedHashMap.kb(capacity);
  var _iterator__ex2g4s = options.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.plusAssign' call
    var pair = to(element.zg_1, element.ah_1);
    destination.r2(pair.zg_1, pair.ah_1);
  }
  var optHolder = new OptionHolderDefault(null, destination);
  var result = new CrossReferenceModelDefault(_SimpleName___init__impl__6s45d0('Unit'), optHolder, namespace);
  return result;
}
function namespace_1($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var qualifiedName = (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(2);
  var imports = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(3);
  var declarations = (!(tmp_1 == null) ? typeof tmp_1 === 'function' : false) ? tmp_1 : THROW_CCE();
  var ns = new CrossReferenceNamespaceDefault(qualifiedName.asQualifiedName(null), VOID, imports);
  var def = declarations(ns);
  return ns;
}
function declarations($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var rootIdentifiables = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var scopes = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(2);
  var referencesOpt = (tmp_1 == null ? true : isInterface(tmp_1, KtList)) ? tmp_1 : THROW_CCE();
  return ReferencesSyntaxAnalyser$declarations$lambda(rootIdentifiables, scopes, referencesOpt, $this, nodeInfo, sentence);
}
function rootIdentifiables($this, nodeInfo, children, sentence) {
  return isInterface(children, KtList) ? children : THROW_CCE();
}
function scopes($this, nodeInfo, children, sentence) {
  return isInterface(children, KtList) ? children : THROW_CCE();
}
function scope($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var simpleTypeName = tmp instanceof SimpleName ? tmp.a1u_1 : THROW_CCE();
  var tmp_0 = children.z(3);
  var identifiables = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var scope = new ScopeDefinitionDefault(simpleTypeName);
  scope.a3c_1.x(identifiables);
  $this.locationMap.add(new ParsePath(), new PropertyValue_0(scope, 'typeReference'), ensureNotNull($this.locationMap.get(new SimpleName(simpleTypeName))));
  return scope;
}
function identifiables($this, nodeInfo, children, sentence) {
  var tmp0_elvis_lhs = isInterface(children, KtList) ? children : THROW_CCE();
  return tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs;
}
function identifiable($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var simpleTypeName = tmp instanceof SimpleName ? tmp.a1u_1 : THROW_CCE();
  var tmp_0 = children.z(3);
  var expression = (!(tmp_0 == null) ? isInterface(tmp_0, Expression) : false) ? tmp_0 : THROW_CCE();
  var identifiable = new IdentifiableDefault(simpleTypeName, expression);
  $this.locationMap.add(new ParsePath(), new PropertyValue_0(identifiable, 'simpleTypeName'), ensureNotNull($this.locationMap.get(new SimpleName(simpleTypeName))));
  $this.locationMap.add(new ParsePath(), new PropertyValue_0(identifiable, 'expression'), ensureNotNull($this.locationMap.get(expression)));
  return identifiable;
}
function referencesOpt($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (tmp == null ? true : isInterface(tmp, KtList)) ? tmp : THROW_CCE();
}
function references($this, nodeInfo, children, sentence) {
  var tmp = children.z(2);
  return (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
}
function referenceDefinitions($this, nodeInfo, children, sentence) {
  return isInterface(children, KtList) ? children : THROW_CCE();
}
function referenceDefinition($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var inTypeName = tmp instanceof SimpleName ? tmp.a1u_1 : THROW_CCE();
  var tmp_0 = children.z(3);
  var referenceExpressionList = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var def = new ReferenceDefinitionDefault(inTypeName, referenceExpressionList);
  $this.locationMap.add(new ParsePath(), new PropertyValue_0(def, 'in'), ensureNotNull($this.locationMap.get(new SimpleName(inTypeName))));
  return def;
}
function referenceExpressionList($this, nodeInfo, children, sentence) {
  return isInterface(children, KtList) ? children : THROW_CCE();
}
function referenceExpression($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return tmp instanceof ReferenceExpressionAbstract ? tmp : THROW_CCE();
}
function propertyReferenceExpression($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var expr = (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(3);
  var typeReferences = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(4);
  var from = (tmp_1 == null ? true : isInterface(tmp_1, NavigationExpression)) ? tmp_1 : THROW_CCE();
  var tmp_2;
  if (isInterface(expr, NavigationExpression)) {
    tmp_2 = expr;
  } else {
    if (isInterface(expr, RootExpression)) {
      tmp_2 = new NavigationExpressionDefault(new RootExpressionDefault(expr.name), emptyList());
    } else {
      $this.issues.error($this.locationMap.get(expr), '', null);
      tmp_2 = new NavigationExpressionDefault(Companion_getInstance_15().ERROR, emptyList());
    }
  }
  var navigation = tmp_2;
  // Inline function 'kotlin.also' call
  var this_0 = new ReferenceExpressionPropertyDefault(navigation, typeReferences, from);
  // Inline function 'kotlin.collections.forEachIndexed' call
  var index = 0;
  var _iterator__ex2g4s = typeReferences.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var _unary__edvuaz = index;
    index = _unary__edvuaz + 1 | 0;
    var i = checkIndexOverflow(_unary__edvuaz);
    $this.locationMap.add(new ParsePath(), new PropertyValue_0(this_0, 'typeReferences[' + i + ']'), ensureNotNull($this.locationMap.get(item)));
  }
  return this_0;
}
function from($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  return (!(tmp == null) ? isInterface(tmp, NavigationExpression) : false) ? tmp : THROW_CCE();
}
function collectionReferenceExpression($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var rootOrNavigation = (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(4);
  var referenceExpression = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(2);
  var ofType = (tmp_1 == null ? true : isInterface(tmp_1, PossiblyQualifiedName_0)) ? tmp_1 : THROW_CCE();
  return new ReferenceExpressionCollectionDefault(rootOrNavigation, ofType, referenceExpression);
}
function ofType($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  return (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
}
function rootOrNavigation($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
}
function typeReferences($this, nodeInfo, children, sentence) {
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var this_0 = isInterface(children, KtList) ? children : THROW_CCE();
  return ListSeparatedArrayList.gk(this_0).ck();
}
function possiblyQualifiedTypeReference($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
}
function simpleTypeName($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
}
function ReferencesSyntaxAnalyser$unit$ref($boundThis) {
  var l = (p0, p1, p2) => unit_1($boundThis, p0, p1, p2);
  l.callableName = 'unit';
  return l;
}
function ReferencesSyntaxAnalyser$namespace$ref($boundThis) {
  var l = (p0, p1, p2) => namespace_1($boundThis, p0, p1, p2);
  l.callableName = 'namespace';
  return l;
}
function ReferencesSyntaxAnalyser$declarations$ref($boundThis) {
  var l = (p0, p1, p2) => declarations($boundThis, p0, p1, p2);
  l.callableName = 'declarations';
  return l;
}
function ReferencesSyntaxAnalyser$rootIdentifiables$ref($boundThis) {
  var l = (p0, p1, p2) => rootIdentifiables($boundThis, p0, p1, p2);
  l.callableName = 'rootIdentifiables';
  return l;
}
function ReferencesSyntaxAnalyser$scopes$ref($boundThis) {
  var l = (p0, p1, p2) => scopes($boundThis, p0, p1, p2);
  l.callableName = 'scopes';
  return l;
}
function ReferencesSyntaxAnalyser$scope$ref($boundThis) {
  var l = (p0, p1, p2) => scope($boundThis, p0, p1, p2);
  l.callableName = 'scope';
  return l;
}
function ReferencesSyntaxAnalyser$identifiables$ref($boundThis) {
  var l = (p0, p1, p2) => identifiables($boundThis, p0, p1, p2);
  l.callableName = 'identifiables';
  return l;
}
function ReferencesSyntaxAnalyser$identifiable$ref($boundThis) {
  var l = (p0, p1, p2) => identifiable($boundThis, p0, p1, p2);
  l.callableName = 'identifiable';
  return l;
}
function ReferencesSyntaxAnalyser$referencesOpt$ref($boundThis) {
  var l = (p0, p1, p2) => referencesOpt($boundThis, p0, p1, p2);
  l.callableName = 'referencesOpt';
  return l;
}
function ReferencesSyntaxAnalyser$references$ref($boundThis) {
  var l = (p0, p1, p2) => references($boundThis, p0, p1, p2);
  l.callableName = 'references';
  return l;
}
function ReferencesSyntaxAnalyser$referenceDefinitions$ref($boundThis) {
  var l = (p0, p1, p2) => referenceDefinitions($boundThis, p0, p1, p2);
  l.callableName = 'referenceDefinitions';
  return l;
}
function ReferencesSyntaxAnalyser$referenceDefinition$ref($boundThis) {
  var l = (p0, p1, p2) => referenceDefinition($boundThis, p0, p1, p2);
  l.callableName = 'referenceDefinition';
  return l;
}
function ReferencesSyntaxAnalyser$referenceExpressionList$ref($boundThis) {
  var l = (p0, p1, p2) => referenceExpressionList($boundThis, p0, p1, p2);
  l.callableName = 'referenceExpressionList';
  return l;
}
function ReferencesSyntaxAnalyser$referenceExpression$ref($boundThis) {
  var l = (p0, p1, p2) => referenceExpression($boundThis, p0, p1, p2);
  l.callableName = 'referenceExpression';
  return l;
}
function ReferencesSyntaxAnalyser$propertyReferenceExpression$ref($boundThis) {
  var l = (p0, p1, p2) => propertyReferenceExpression($boundThis, p0, p1, p2);
  l.callableName = 'propertyReferenceExpression';
  return l;
}
function ReferencesSyntaxAnalyser$from$ref($boundThis) {
  var l = (p0, p1, p2) => from($boundThis, p0, p1, p2);
  l.callableName = 'from';
  return l;
}
function ReferencesSyntaxAnalyser$collectionReferenceExpression$ref($boundThis) {
  var l = (p0, p1, p2) => collectionReferenceExpression($boundThis, p0, p1, p2);
  l.callableName = 'collectionReferenceExpression';
  return l;
}
function ReferencesSyntaxAnalyser$rootOrNavigation$ref($boundThis) {
  var l = (p0, p1, p2) => rootOrNavigation($boundThis, p0, p1, p2);
  l.callableName = 'rootOrNavigation';
  return l;
}
function ReferencesSyntaxAnalyser$ofType$ref($boundThis) {
  var l = (p0, p1, p2) => ofType($boundThis, p0, p1, p2);
  l.callableName = 'ofType';
  return l;
}
function ReferencesSyntaxAnalyser$typeReferences$ref($boundThis) {
  var l = (p0, p1, p2) => typeReferences($boundThis, p0, p1, p2);
  l.callableName = 'typeReferences';
  return l;
}
function ReferencesSyntaxAnalyser$possiblyQualifiedTypeReference$ref($boundThis) {
  var l = (p0, p1, p2) => possiblyQualifiedTypeReference($boundThis, p0, p1, p2);
  l.callableName = 'possiblyQualifiedTypeReference';
  return l;
}
function ReferencesSyntaxAnalyser$simpleTypeName$ref($boundThis) {
  var l = (p0, p1, p2) => new SimpleName(simpleTypeName($boundThis, p0, p1, p2));
  l.callableName = 'simpleTypeName';
  return l;
}
function ReferencesSyntaxAnalyser$declarations$lambda($rootIdentifiables, $scopes, $referencesOpt, this$0, $nodeInfo, $sentence) {
  return (ns) => {
    var decl = new DeclarationsForNamespaceDefault(ns);
    var tmp0_safe_receiver = decl.h3c_1.z2(new SimpleName(_QualifiedName___get_last__impl__838y8h(Companion_getInstance_24().ROOT_SCOPE_TYPE_NAME)));
    var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.identifiables;
    var tmp1_safe_receiver = (tmp == null ? true : isInterface(tmp, KtMutableList)) ? tmp : THROW_CCE();
    if (tmp1_safe_receiver == null)
      null;
    else
      tmp1_safe_receiver.x($rootIdentifiables);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $scopes.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp0 = decl.h3c_1;
      // Inline function 'kotlin.collections.set' call
      var key = new SimpleName(element.z3b_1);
      tmp0.r2(key, element);
    }
    if ($referencesOpt == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      decl.i3c_1.x($referencesOpt);
    }
    // Inline function 'kotlin.also' call
    this$0.setLocationFor(decl, $nodeInfo, $sentence);
    return decl;
  };
}
function CrossReferenceModelDefault$Companion$fromString$lambda$lambda($context) {
  return ($this$semanticAnalysis) => {
    $this$semanticAnalysis.context($context);
    return Unit_instance;
  };
}
function CrossReferenceModelDefault$Companion$fromString$lambda($context) {
  return ($this$options) => {
    $this$options.semanticAnalysis(CrossReferenceModelDefault$Companion$fromString$lambda$lambda($context));
    return Unit_instance;
  };
}
var Companion_instance_22;
function Companion_getInstance_24() {
  if (Companion_instance_22 === VOID)
    new Companion_21();
  return Companion_instance_22;
}
function DeclarationsForNamespaceDefault$asString$lambda($indent) {
  return (it) => $indent.toString() + it.asString($indent);
}
function ReferenceExpressionPropertyDefault$asString$lambda(it) {
  return it.value;
}
function crossReferenceModel(name, init) {
  var b = new CrossReferenceModelBuilder(name);
  init(b);
  return b.build();
}
function AglScope$typeModel$delegate$lambda() {
  var tmp = AglBase_getInstance().typesModel.namespace;
  return typeModel('Scope', true, tmp, AglScope$typeModel$delegate$lambda$lambda);
}
function AglScope$typeModel$delegate$lambda$lambda($this$typeModel) {
  var tmp = listOf_0(['std', 'net.akehurst.language.base.api']);
  $this$typeModel.namespace('net.akehurst.language.scope.api', tmp, AglScope$typeModel$delegate$lambda$lambda$lambda);
  var tmp_0 = listOf_0(['net.akehurst.language.scope.api', 'std', 'net.akehurst.language.base.api']);
  $this$typeModel.namespace('net.akehurst.language.scope.asm', tmp_0, AglScope$typeModel$delegate$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.interface_('Scope', AglScope$typeModel$delegate$lambda$lambda$lambda$lambda);
  $this$namespace.data('ItemInScope', AglScope$typeModel$delegate$lambda$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda($this$interface_) {
  $this$interface_.typeParameters(['ItemInScopeType']);
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'childScopes', 'Map', false, AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda);
  var tmp_0 = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp_0, 'items', 'Map', false, AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda($this$propertyOf) {
  $this$propertyOf.typeArgument('String');
  $this$propertyOf.typeArgument('Scope');
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$propertyOf) {
  $this$propertyOf.typeArgument('String');
  $this$propertyOf.typeArgument('Map', VOID, AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda($this$typeArgument) {
  $this$typeArgument.typeArgument('QualifiedName');
  $this$typeArgument.typeArgument('Pair', VOID, AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda$lambda($this$typeArgument) {
  $this$typeArgument.typeArgument('Any', true);
  $this$typeArgument.typeArgument('ItemInScopeType');
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda_0($this$data) {
  $this$data.typeParameters(['ItemInScopeType']);
  $this$data.constructor_(AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'item', 'ItemInScopeType', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'location', 'Any', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'qualifiedTypeName', 'QualifiedName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'referableName', 'String', false);
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$constructor_) {
  $this$constructor_.parameter('referableName', 'String', false);
  $this$constructor_.parameter('qualifiedTypeName', 'QualifiedName', false);
  $this$constructor_.parameter('location', 'Any', false);
  $this$constructor_.parameter('item', 'ItemInScopeType', false);
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda_0($this$namespace) {
  $this$namespace.data('ScopeSimple', AglScope$typeModel$delegate$lambda$lambda$lambda$lambda_1);
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda_1($this$data) {
  $this$data.typeParameters(['ItemInScopeType']);
  $this$data.supertype('Scope', AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  $this$data.constructor_(AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'childScopes', 'Map', false, AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'forTypeName', 'QualifiedName', false);
  var tmp_0 = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp_0, 'items', 'Map', false, AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  var tmp_1 = setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp_1, 'parent', 'ScopeSimple', false, AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'scopeIdentityInParent', 'String', false);
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$supertype) {
  $this$supertype.ref('ItemInScopeType');
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$constructor_) {
  $this$constructor_.parameter('parent', 'ScopeSimple', false);
  $this$constructor_.parameter('scopeIdentityInParent', 'String', false);
  $this$constructor_.parameter('forTypeName', 'QualifiedName', false);
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$propertyOf) {
  $this$propertyOf.typeArgument('String');
  $this$propertyOf.typeArgument('ScopeSimple');
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$propertyOf) {
  $this$propertyOf.typeArgument('String');
  $this$propertyOf.typeArgument('Map', VOID, AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0($this$typeArgument) {
  $this$typeArgument.typeArgument('QualifiedName');
  $this$typeArgument.typeArgument('Pair', VOID, AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda$lambda_0($this$typeArgument) {
  $this$typeArgument.typeArgument('Any', true);
  $this$typeArgument.typeArgument('ItemInScopeType');
  return Unit_instance;
}
function AglScope$typeModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$propertyOf) {
  $this$propertyOf.typeArgument('ItemInScopeType');
  return Unit_instance;
}
var AglScope_instance;
function AglScope_getInstance() {
  if (AglScope_instance === VOID)
    new AglScope_0();
  return AglScope_instance;
}
function typeModel$factory_1() {
  return getPropertyCallableRef('typeModel', 1, KProperty1, (receiver) => receiver.typeModel, null);
}
var Companion_instance_23;
function Companion_getInstance_25() {
  return Companion_instance_23;
}
function ScopeSimple$scopeIdentity$delegate$lambda(this$0) {
  return () => null == this$0.parent ? '/' + this$0.scopeIdentityInParent : '/' === this$0.parent.scopeIdentity ? '/' + this$0.scopeIdentityInParent : this$0.parent.scopeIdentity + '/' + this$0.scopeIdentityInParent;
}
function ScopeSimple$scopePath$delegate$lambda(this$0) {
  return () => null == this$0.parent ? emptyList() : plus_0(this$0.parent.scopePath, this$0.scopeIdentityInParent);
}
function ScopeSimple$rootScope$delegate$lambda(this$0) {
  return () => {
    var s = this$0;
    while (!(null == s.parent))
      s = s.parent;
    return s;
  };
}
function ScopeSimple$asString$lambda$lambda(this$0, $itemName, $itemTypeIndent) {
  return (it) => {
    var item = it.b3();
    var itemType = it.a3().f27_1;
    var tmp;
    if (this$0.l2r_1.x2($itemName)) {
      var chScope = this$0.l2r_1.z2($itemName);
      tmp = ' ' + (chScope == null ? null : chScope.asString($itemTypeIndent));
    } else {
      tmp = '';
    }
    var scope = tmp;
    return $itemTypeIndent.toString() + "'" + $itemName + "': " + QualifiedName__toString_impl_z3wem2(itemType) + ' -> ' + item.toString() + scope;
  };
}
function ScopeSimple$asString$lambda($scopeIndent, this$0) {
  return (me) => {
    var itemName = me.a3();
    var itemTypeMap = me.b3();
    var itemTypeIndent = $scopeIndent.inc;
    var tmp = itemTypeMap.w2();
    var itemContent = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, ScopeSimple$asString$lambda$lambda(this$0, itemName, itemTypeIndent));
    return $scopeIndent.toString() + "item '" + itemName + "' {\n" + itemContent + '\n' + $scopeIndent.toString() + '}';
  };
}
function ScopeSimple$asString$lambda_0($scopeIndent) {
  return (_destruct__k2r9zo) => {
    // Inline function 'kotlin.collections.component1' call
    var k = _destruct__k2r9zo.a3();
    // Inline function 'kotlin.collections.component2' call
    var v = _destruct__k2r9zo.b3();
    var cs = v.asString($scopeIndent);
    return $scopeIndent.toString() + "scope '" + k + "' " + cs;
  };
}
function scopeIdentity$factory() {
  return getPropertyCallableRef('scopeIdentity', 1, KProperty1, (receiver) => receiver.scopeIdentity, null);
}
function scopePath$factory() {
  return getPropertyCallableRef('scopePath', 1, KProperty1, (receiver) => receiver.scopePath, null);
}
function rootScope$factory() {
  return getPropertyCallableRef('rootScope', 1, KProperty1, (receiver) => receiver.rootScope, null);
}
function AglStyle$grammarModel$delegate$lambda() {
  return grammarModel('Style', VOID, VOID, AglStyle$grammarModel$delegate$lambda$lambda);
}
function AglStyle$grammarModel$delegate$lambda$lambda($this$grammarModel) {
  $this$grammarModel.namespace('net.akehurst.language', AglStyle$grammarModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.grammar('Style', AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda($this$grammar) {
  $this$grammar.extendsGrammar(AglBase_getInstance().defaultTargetGrammar.selfReference);
  var tmp = OverrideKind_REPLACE_getInstance();
  $this$grammar.concatenation('unit', tmp, VOID, VOID, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda);
  $this$grammar.concatenation('styleSet', VOID, VOID, VOID, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  $this$grammar.concatenation('extends', VOID, VOID, VOID, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  $this$grammar.choice('rule', VOID, VOID, VOID, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  $this$grammar.concatenation('metaRule', VOID, VOID, VOID, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  $this$grammar.concatenation('tagRule', VOID, VOID, VOID, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  $this$grammar.choice('selectorExpression', VOID, VOID, VOID, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  $this$grammar.separatedList('selectorAndComposition', 2, -1, VOID, VOID, VOID, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  $this$grammar.choice('selectorSingle', VOID, VOID, VOID, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  $this$grammar.concatenation('LITERAL', VOID, VOID, true, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_8);
  $this$grammar.concatenation('PATTERN', VOID, VOID, true, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_9);
  $this$grammar.concatenation('SPECIAL_IDENTIFIER', VOID, VOID, true, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_10);
  $this$grammar.concatenation('style', VOID, VOID, VOID, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_11);
  $this$grammar.choice('styleValue', VOID, VOID, VOID, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_12);
  $this$grammar.concatenation('STYLE_ID', VOID, VOID, true, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_13);
  $this$grammar.concatenation('STYLE_VALUE', VOID, VOID, true, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_14);
  $this$grammar.concatenation('STRING', VOID, VOID, true, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_15);
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda($this$concatenation) {
  $this$concatenation.q2t('namespace');
  $this$concatenation.p2t(0, -1, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda($this$lst) {
  $this$lst.q2t('styleSet');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$concatenation) {
  $this$concatenation.r2t('styles');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.s2t(AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0);
  $this$concatenation.r2t('{');
  $this$concatenation.p2t(0, -1, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_1);
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0($this$opt) {
  $this$opt.q2t('extends');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_1($this$lst) {
  $this$lst.q2t('rule');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$concatenation) {
  $this$concatenation.r2t(':');
  $this$concatenation.k2w(1, -1, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_2);
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_2($this$spLst) {
  $this$spLst.q2t('possiblyQualifiedName');
  $this$spLst.r2t(',');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$choice) {
  $this$choice.q2t('metaRule');
  $this$choice.q2t('tagRule');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$concatenation) {
  $this$concatenation.r2t('$$');
  $this$concatenation.q2t('PATTERN');
  $this$concatenation.r2t('{');
  $this$concatenation.p2t(0, -1, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_3);
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_3($this$lst) {
  $this$lst.q2t('style');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$concatenation) {
  $this$concatenation.q2t('selectorExpression');
  $this$concatenation.r2t('{');
  $this$concatenation.p2t(0, -1, AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_4);
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_4($this$lst) {
  $this$lst.q2t('style');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$choice) {
  $this$choice.q2t('selectorAndComposition');
  $this$choice.q2t('selectorSingle');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$separatedList) {
  $this$separatedList.q2t('selectorSingle');
  $this$separatedList.r2t(',');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$choice) {
  $this$choice.q2t('LITERAL');
  $this$choice.q2t('PATTERN');
  $this$choice.q2t('IDENTIFIER');
  $this$choice.q2t('SPECIAL_IDENTIFIER');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_8($this$concatenation) {
  $this$concatenation.l2t("'([^'\\\\]|\\\\.)*'");
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_9($this$concatenation) {
  $this$concatenation.l2t('"([^"\\\\]|\\\\.)*"');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_10($this$concatenation) {
  $this$concatenation.l2t('[\\$][a-zA-Z_][a-zA-Z_0-9-]*');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_11($this$concatenation) {
  $this$concatenation.q2t('STYLE_ID');
  $this$concatenation.r2t(':');
  $this$concatenation.q2t('styleValue');
  $this$concatenation.r2t(';');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_12($this$choice) {
  $this$choice.q2t('STYLE_ID');
  $this$choice.q2t('STRING');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_13($this$concatenation) {
  $this$concatenation.l2t('[-a-zA-Z_][-a-zA-Z_0-9]*');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_14($this$concatenation) {
  $this$concatenation.l2t('[^;: \\t\\n\\x0B\\f\\r]+');
  return Unit_instance;
}
function AglStyle$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_15($this$concatenation) {
  $this$concatenation.l2t("'([^'\\\\]|\\\\'|\\\\\\\\)*'");
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda() {
  var tmp = AglBase_getInstance().typesModel.namespace;
  return typeModel('Style', true, tmp, AglStyle$typesModel$delegate$lambda$lambda);
}
function AglStyle$typesModel$delegate$lambda$lambda($this$typeModel) {
  var tmp = listOf_0(['std', 'net.akehurst.language.base.api']);
  grammarTypeNamespace($this$typeModel, 'net.akehurst.language.style.api', tmp, VOID, AglStyle$typesModel$delegate$lambda$lambda$lambda);
  var tmp_0 = listOf_0(['net.akehurst.language.style.api', 'std', 'net.akehurst.language.base.api', 'net.akehurst.language.base.asm']);
  $this$typeModel.namespace('net.akehurst.language.style.asm', tmp_0, AglStyle$typesModel$delegate$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda($this$grammarTypeNamespace) {
  $this$grammarTypeNamespace.enum('AglStyleSelectorKind', listOf_0(['LITERAL', 'PATTERN', 'RULE_NAME', 'META']));
  $this$grammarTypeNamespace.interface_('AglStyleModel', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda);
  $this$grammarTypeNamespace.interface_('StyleNamespace', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_0);
  $this$grammarTypeNamespace.interface_('StyleSetReference', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_1);
  $this$grammarTypeNamespace.interface_('StyleSet', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_2);
  $this$grammarTypeNamespace.interface_('AglStyleRule', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_3);
  $this$grammarTypeNamespace.interface_('AglStyleMetaRule', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_4);
  $this$grammarTypeNamespace.interface_('AglStyleTagRule', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_5);
  $this$grammarTypeNamespace.data('AglStyleSelector', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_6);
  $this$grammarTypeNamespace.data('AglStyleDeclaration', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_7);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda($this$interface_) {
  $this$interface_.supertype('Model', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda($this$supertype) {
  $this$supertype.ref('StyleNamespace');
  $this$supertype.ref('StyleSet');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_0($this$interface_) {
  $this$interface_.supertype('Namespace', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$supertype) {
  $this$supertype.ref('StyleSet');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_1($this$interface_) {
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_2($this$interface_) {
  $this$interface_.supertype('Definition', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'extends', 'List', false, AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  var tmp_0 = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp_0, 'rules', 'List', false, AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$supertype) {
  $this$supertype.ref('StyleSet');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$propertyOf) {
  $this$propertyOf.typeArgument('StyleSetReference');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$propertyOf) {
  $this$propertyOf.typeArgument('AglStyleRule');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_3($this$interface_) {
  $this$interface_.supertype('Formatable');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'declaration', 'Map', false, AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  var tmp_0 = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp_0, 'selector', 'List', false, AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$propertyOf) {
  $this$propertyOf.typeArgument('String');
  $this$propertyOf.typeArgument('AglStyleDeclaration');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$propertyOf) {
  $this$propertyOf.typeArgument('AglStyleSelector');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_4($this$interface_) {
  $this$interface_.supertype('AglStyleRule');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_5($this$interface_) {
  $this$interface_.supertype('AglStyleRule');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_6($this$data) {
  $this$data.constructor_(AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'kind', 'AglStyleSelectorKind', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'value', 'String', false);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$constructor_) {
  $this$constructor_.parameter('value', 'String', false);
  $this$constructor_.parameter('kind', 'AglStyleSelectorKind', false);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_7($this$data) {
  $this$data.constructor_(AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'name', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'value', 'String', false);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$constructor_) {
  $this$constructor_.parameter('name', 'String', false);
  $this$constructor_.parameter('value', 'String', false);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda_0($this$namespace) {
  $this$namespace.data('StyleSetReferenceDefault', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_8);
  $this$namespace.data('StyleNamespaceDefault', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_9);
  $this$namespace.data('AglStyleSetDefault', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_10);
  $this$namespace.data('AglStyleRuleDefault', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_11);
  $this$namespace.data('AglStyleModelDefault', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_12);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_8($this$data) {
  $this$data.supertype('StyleSetReference');
  $this$data.constructor_(AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_8);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'localNamespace', 'StyleNamespace', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'nameOrQName', 'PossiblyQualifiedName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]), 'resolved', 'StyleSet', false);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_8($this$constructor_) {
  $this$constructor_.parameter('localNamespace', 'StyleNamespace', false);
  $this$constructor_.parameter('nameOrQName', 'PossiblyQualifiedName', false);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_9($this$data) {
  $this$data.supertype('StyleNamespace');
  $this$data.supertype('NamespaceAbstract', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_9);
  $this$data.constructor_(AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_10);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'import', 'List', false, AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_11);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'qualifiedName', 'QualifiedName', false);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_9($this$supertype) {
  $this$supertype.ref('net.akehurst.language.style.api.StyleSet');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_10($this$constructor_) {
  $this$constructor_.parameter('qualifiedName', 'QualifiedName', false);
  $this$constructor_.parameter('import', 'List', false);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_11($this$propertyOf) {
  $this$propertyOf.typeArgument('Import');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_10($this$data) {
  $this$data.supertype('StyleSet');
  $this$data.constructor_(AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_12);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'extends', 'List', false, AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_13);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'StyleNamespace', false);
  var tmp_0 = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp_0, 'rules', 'List', false, AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_14);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_12($this$constructor_) {
  $this$constructor_.parameter('namespace', 'StyleNamespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  $this$constructor_.parameter('extends', 'List', false);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_13($this$propertyOf) {
  $this$propertyOf.typeArgument('StyleSetReference');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_14($this$propertyOf) {
  $this$propertyOf.typeArgument('AglStyleRule');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_11($this$data) {
  $this$data.supertype('AglStyleRule');
  $this$data.constructor_(AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_15);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'declaration', 'Map', false, AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_16);
  var tmp_0 = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp_0, 'selector', 'List', false, AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_17);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_15($this$constructor_) {
  $this$constructor_.parameter('selector', 'List', false);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_16($this$propertyOf) {
  $this$propertyOf.typeArgument('String');
  $this$propertyOf.typeArgument('AglStyleDeclaration');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_17($this$propertyOf) {
  $this$propertyOf.typeArgument('AglStyleSelector');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda_12($this$data) {
  $this$data.supertype('AglStyleModel');
  $this$data.supertype('ModelAbstract', AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_18);
  $this$data.constructor_(AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_19);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'namespace', 'List', false, AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_20);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_18($this$supertype) {
  $this$supertype.ref('net.akehurst.language.style.api.StyleNamespace');
  $this$supertype.ref('net.akehurst.language.style.api.StyleSet');
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_19($this$constructor_) {
  $this$constructor_.parameter('name', 'SimpleName', false);
  $this$constructor_.parameter('namespace', 'List', false);
  return Unit_instance;
}
function AglStyle$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_20($this$propertyOf) {
  $this$propertyOf.typeArgument('StyleNamespace');
  return Unit_instance;
}
function AglStyle$asmTransformModel$delegate$lambda() {
  var tmp = AglStyle_getInstance().typesModel;
  return asmTransform('Style', tmp, false, AglStyle$asmTransformModel$delegate$lambda$lambda);
}
function AglStyle$asmTransformModel$delegate$lambda$lambda($this$asmTransform) {
  $this$asmTransform.namespace('net.akehurst.language', AglStyle$asmTransformModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglStyle$asmTransformModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.transform('Style', AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda($this$transform) {
  $this$transform.importTypes(['net.akehurst.language.style.api', 'net.akehurst.language.base.api']);
  $this$transform.createObject('unit', 'AglStyleModel', AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda);
  $this$transform.createObject('namespace', 'StyleNamespace', AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  $this$transform.createObject('styleSet', 'StyleSet', AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  $this$transform.transToListOf('extends', 'StyleSetReference', '/* custom SyntaxAnalyser */ $nothing');
  $this$transform.createObject('rule', 'AglStyleRule', AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  $this$transform.createObject('metaRule', 'AglStyleMetaRule', AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  $this$transform.createObject('tagRule', 'AglStyleTagRule', AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  $this$transform.transToListOf('selectorExpression', 'AglStyleSelector', '/* custom SyntaxAnalyser */ $nothing');
  $this$transform.transToListOf('selectorAndComposition', 'AglStyleSelector', '/* custom SyntaxAnalyser */ $nothing');
  $this$transform.createObject('selectorSingle', 'AglStyleSelector', AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  $this$transform.transToListOf('styleList', 'AglStyleDeclaration', '/* custom SyntaxAnalyser */ $nothing');
  $this$transform.createObject('style', 'AglStyleDeclaration', AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  $this$transform.child0StringRule('styleValue');
  $this$transform.leafStringRule('LITERAL');
  $this$transform.leafStringRule('PATTERN');
  $this$transform.leafStringRule('SPECIAL_IDENTIFIER');
  $this$transform.leafStringRule('STYLE_ID');
  $this$transform.leafStringRule('STYLE_VALUE');
  $this$transform.leafStringRule('STRING');
  $this$transform.leafStringRule('IDENTIFIER');
  $this$transform.createObject('possiblyQualifiedName', 'PossiblyQualifiedName', AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  return Unit_instance;
}
function AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda($this$createObject) {
  return Unit_instance;
}
function AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$createObject) {
  return Unit_instance;
}
function AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$createObject) {
  return Unit_instance;
}
function AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$createObject) {
  return Unit_instance;
}
function AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$createObject) {
  return Unit_instance;
}
function AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$createObject) {
  return Unit_instance;
}
function AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$createObject) {
  return Unit_instance;
}
function AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$createObject) {
  return Unit_instance;
}
function AglStyle$asmTransformModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$createObject) {
  return Unit_instance;
}
function AglStyle$crossReferenceModel$delegate$lambda() {
  return crossReferenceModel('Style', AglStyle$crossReferenceModel$delegate$lambda$lambda);
}
function AglStyle$crossReferenceModel$delegate$lambda$lambda($this$crossReferenceModel) {
  return Unit_instance;
}
function AglStyle$styleModel$delegate$lambda() {
  return styleModel('Style', AglStyle$styleModel$delegate$lambda$lambda);
}
function AglStyle$styleModel$delegate$lambda$lambda($this$styleModel) {
  $this$styleModel.namespace('net.akehurst.language', AglStyle$styleModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglStyle$styleModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.styles('Style', AglStyle$styleModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglStyle$styleModel$delegate$lambda$lambda$lambda$lambda($this$styles) {
  $this$styles.metaRule("'[^']+'", AglStyle$styleModel$delegate$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglStyle$styleModel$delegate$lambda$lambda$lambda$lambda$lambda($this$metaRule) {
  $this$metaRule.declaration('foreground', 'darkgreen');
  $this$metaRule.declaration('font-weight', 'bold');
  return Unit_instance;
}
function AglStyle$formatModel$delegate$lambda() {
  return formatModel('Style', AglStyle$formatModel$delegate$lambda$lambda);
}
function AglStyle$formatModel$delegate$lambda$lambda($this$formatModel) {
  return Unit_instance;
}
function AglStyle$defaultTargetGrammar$delegate$lambda() {
  return ensureNotNull(AglStyle_getInstance().grammarModel.findDefinitionByQualifiedNameOrNull(_QualifiedName___init__impl__8ed982('net.akehurst.language.Style')));
}
function AglStyle$syntaxAnalyser$delegate$lambda() {
  return new AglStyleSyntaxAnalyser();
}
function AglStyle$semanticAnalyser$delegate$lambda() {
  return new AglStyleSemanticAnalyser();
}
function AglStyle$completionProvider$delegate$lambda() {
  return new AglStyleCompletionProvider();
}
var AglStyle_instance;
function AglStyle_getInstance() {
  if (AglStyle_instance === VOID)
    new AglStyle_0();
  return AglStyle_instance;
}
function grammarModel$factory_5() {
  return getPropertyCallableRef('grammarModel', 1, KProperty1, (receiver) => receiver.grammarModel, null);
}
function typesModel$factory_3() {
  return getPropertyCallableRef('typesModel', 1, KProperty1, (receiver) => receiver.typesModel, null);
}
function asmTransformModel$factory_3() {
  return getPropertyCallableRef('asmTransformModel', 1, KProperty1, (receiver) => receiver.asmTransformModel, null);
}
function crossReferenceModel$factory_4() {
  return getPropertyCallableRef('crossReferenceModel', 1, KProperty1, (receiver) => receiver.crossReferenceModel, null);
}
function styleModel$factory_3() {
  return getPropertyCallableRef('styleModel', 1, KProperty1, (receiver) => receiver.styleModel, null);
}
function formatModel$factory_4() {
  return getPropertyCallableRef('formatModel', 1, KProperty1, (receiver) => receiver.formatModel, null);
}
function defaultTargetGrammar$factory_3() {
  return getPropertyCallableRef('defaultTargetGrammar', 1, KProperty1, (receiver) => receiver.defaultTargetGrammar, null);
}
function syntaxAnalyser$factory_4() {
  return getPropertyCallableRef('syntaxAnalyser', 1, KProperty1, (receiver) => receiver.syntaxAnalyser, null);
}
function semanticAnalyser$factory_4() {
  return getPropertyCallableRef('semanticAnalyser', 1, KProperty1, (receiver) => receiver.semanticAnalyser, null);
}
function completionProvider$factory_4() {
  return getPropertyCallableRef('completionProvider', 1, KProperty1, (receiver) => receiver.completionProvider, null);
}
var Companion_instance_24;
function Companion_getInstance_26() {
  if (Companion_instance_24 === VOID)
    new Companion_23();
  return Companion_instance_24;
}
function provideForTerminalItem($this, spine, nextExpected, options) {
  var tmp0_safe_receiver = Companion_getInstance_26().q3e_1.findAllTrRuleForGrammarRuleNamedOrNull(nextExpected.owningRule.name);
  var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.resolvedType;
  var tmp;
  if (tmp1_elvis_lhs == null) {
    var message = 'Should not be null';
    throw IllegalStateException.v4(toString(message));
  } else {
    tmp = tmp1_elvis_lhs;
  }
  var itemType = tmp;
  var tmp2_subject = nextExpected.owningRule.name;
  return tmp2_subject === _GrammarRuleName___init__impl__yqiut('LITERAL') ? LITERAL($this, nextExpected, itemType, ensureNotNull(options.context)) : tmp2_subject === _GrammarRuleName___init__impl__yqiut('PATTERN') ? PATTERN($this, nextExpected, itemType, ensureNotNull(options.context)) : tmp2_subject === _GrammarRuleName___init__impl__yqiut('IDENTIFIER') ? IDENTIFIER($this, nextExpected, itemType, ensureNotNull(options.context)) : tmp2_subject === _GrammarRuleName___init__impl__yqiut('META_IDENTIFIER') ? META_IDENTIFIER($this, nextExpected, itemType, ensureNotNull(options.context)) : tmp2_subject === _GrammarRuleName___init__impl__yqiut('STYLE_ID') ? STYLE_ID($this, nextExpected, itemType, ensureNotNull(options.context)) : tmp2_subject === _GrammarRuleName___init__impl__yqiut('STYLE_VALUE') ? STYLE_VALUE($this, nextExpected, itemType, ensureNotNull(options.context)) : tmp2_subject === _GrammarRuleName___init__impl__yqiut('selectorAndComposition') ? selectorAndComposition($this, nextExpected, itemType, ensureNotNull(options.context)) : tmp2_subject === _GrammarRuleName___init__impl__yqiut('rule') ? rule_0($this, nextExpected, itemType, ensureNotNull(options.context)) : tmp2_subject === _GrammarRuleName___init__impl__yqiut('style') ? style($this, nextExpected, itemType, ensureNotNull(options.context)) : Companion_instance_0.provideDefaultForSpine(spine, options);
}
function LITERAL($this, nextExpected, ti, context) {
  var scopeItems = context.findItemsConformingTo(AglStyleCompletionProvider$LITERAL$lambda);
  // Inline function 'kotlin.collections.map' call
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(scopeItems, 10));
  var _iterator__ex2g4s = scopeItems.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    // Inline function 'kotlin.also' call
    var this_0 = new CompletionItem(CompletionItemKind_REFERRED_getInstance(), 'LITERAL', item.referableName);
    this_0.description = 'Reference to a literal value used in the grammar. Literals are enclosed in single quotes or leaf rules.';
    destination.r(this_0);
  }
  return destination;
}
function PATTERN($this, nextExpected, ti, context) {
  var scopeItems = context.findItemsConformingTo(AglStyleCompletionProvider$PATTERN$lambda);
  // Inline function 'kotlin.collections.map' call
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(scopeItems, 10));
  var _iterator__ex2g4s = scopeItems.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    // Inline function 'kotlin.also' call
    var this_0 = new CompletionItem(CompletionItemKind_REFERRED_getInstance(), 'PATTERN', item.referableName);
    this_0.description = 'Reference to a pattern value (regular expression) used in the grammar. Patterns are enclosed in double quotes or leaf rules.';
    destination.r(this_0);
  }
  return destination;
}
function IDENTIFIER($this, nextExpected, ti, context) {
  var scopeItems = context.findItemsConformingTo(AglStyleCompletionProvider$IDENTIFIER$lambda);
  // Inline function 'kotlin.collections.map' call
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(scopeItems, 10));
  var _iterator__ex2g4s = scopeItems.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var tmp$ret$0 = new CompletionItem(CompletionItemKind_REFERRED_getInstance(), _SimpleName___get_value__impl__rl2r3c(Companion_getInstance_26().r3e_1.name), item.referableName);
    destination.r(tmp$ret$0);
  }
  return destination;
}
function META_IDENTIFIER($this, nextExpected, ti, context) {
  return listOf_0([new CompletionItem(CompletionItemKind_LITERAL_getInstance(), 'META_IDENTIFIER', Companion_getInstance_28().KEYWORD_STYLE_ID.value), new CompletionItem(CompletionItemKind_LITERAL_getInstance(), 'META_IDENTIFIER', Companion_getInstance_28().NO_STYLE_ID.value)]);
}
function STYLE_ID($this, nextExpected, ti, context) {
  return listOf_0([new CompletionItem(CompletionItemKind_LITERAL_getInstance(), 'STYLE_ID', 'foreground'), new CompletionItem(CompletionItemKind_LITERAL_getInstance(), 'STYLE_ID', 'background'), new CompletionItem(CompletionItemKind_LITERAL_getInstance(), 'STYLE_ID', 'font-style'), new CompletionItem(CompletionItemKind_SEGMENT_getInstance(), 'style', '<STYLE_ID>: <STYLE_VALUE>;')]);
}
function STYLE_VALUE($this, nextExpected, ti, context) {
  return listOf_0([new CompletionItem(CompletionItemKind_LITERAL_getInstance(), 'STYLE_VALUE', '<colour>'), new CompletionItem(CompletionItemKind_LITERAL_getInstance(), 'STYLE_VALUE', 'bold'), new CompletionItem(CompletionItemKind_LITERAL_getInstance(), 'STYLE_VALUE', 'italic')]);
}
function selectorAndComposition($this, nextExpected, ti, context) {
  return listOf(new CompletionItem(CompletionItemKind_LITERAL_getInstance(), 'selectorAndComposition', ','));
}
function rule_0($this, nextExpected, ti, context) {
  var tmp;
  if (isInterface(nextExpected, Terminal)) {
    var tmp_0;
    switch (nextExpected.value) {
      case "'{'":
        tmp_0 = listOf_0([new CompletionItem(CompletionItemKind_LITERAL_getInstance(), 'rule', '{'), new CompletionItem(CompletionItemKind_SEGMENT_getInstance(), 'rule', '{\n  <STYLE_ID>: <STYLE_VALUE>;\n}')]);
        break;
      case "'}'":
        tmp_0 = listOf(new CompletionItem(CompletionItemKind_LITERAL_getInstance(), 'rule', '}'));
        break;
      default:
        var message = 'Internal error: RuleItem ' + toString(nextExpected) + ' not handled';
        throw IllegalStateException.v4(toString(message));
    }
    tmp = tmp_0;
  } else {
    var message_0 = 'Internal error: RuleItem ' + toString(nextExpected) + ' not handled';
    throw IllegalStateException.v4(toString(message_0));
  }
  return tmp;
}
function style($this, nextExpected, ti, context) {
  var tmp;
  if (isInterface(nextExpected, Terminal)) {
    var tmp_0;
    switch (nextExpected.value) {
      case "':'":
        tmp_0 = listOf(new CompletionItem(CompletionItemKind_LITERAL_getInstance(), 'style', ':'));
        break;
      case "';'":
        tmp_0 = listOf(new CompletionItem(CompletionItemKind_LITERAL_getInstance(), 'style', ';'));
        break;
      default:
        var message = 'Internal error: RuleItem ' + toString(nextExpected) + ' not handled';
        throw IllegalStateException.v4(toString(message));
    }
    tmp = tmp_0;
  } else {
    var message_0 = 'Internal error: RuleItem ' + toString(nextExpected) + ' not handled';
    throw IllegalStateException.v4(toString(message_0));
  }
  return tmp;
}
function AglStyleCompletionProvider$LITERAL$lambda(it) {
  return _QualifiedName___get_value__impl__nkc4gq(it.f27_1) === 'LITERAL';
}
function AglStyleCompletionProvider$PATTERN$lambda(it) {
  return _QualifiedName___get_value__impl__nkc4gq(it.f27_1) === 'PATTERN';
}
function AglStyleCompletionProvider$IDENTIFIER$lambda(it) {
  return equals(it, new QualifiedName(Companion_getInstance_26().r3e_1.qualifiedName));
}
var Companion_instance_25;
function Companion_getInstance_27() {
  if (Companion_instance_25 === VOID)
    new Companion_24();
  return Companion_instance_25;
}
function analyseMetaRule($this, rule, locMap, context) {
}
function analyseTagRule($this, rule, locMap, context) {
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = rule.selector.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var loc = locMap.get(element);
    switch (element.kind.d3_1) {
      case 1:
        if (context.findItemsNamedConformingTo(element.value, AglStyleSemanticAnalyser$analyseTagRule$lambda).a1()) {
          $this._issues.error(loc, 'Terminal Literal ' + element.value + ' not found for style rule');
        }

        break;
      case 2:
        if (context.findItemsNamedConformingTo(element.value, AglStyleSemanticAnalyser$analyseTagRule$lambda_0).a1()) {
          $this._issues.error(loc, 'Terminal Pattern ' + element.value + ' not found for style rule');
        }

        break;
      case 3:
        if (context.findItemsNamedConformingTo(element.value, AglStyleSemanticAnalyser$analyseTagRule$lambda_1).a1()) {
          $this._issues.error(loc, "Grammar Rule '" + element.value + "' not found for style rule");
        }

        break;
      case 0:
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
  }
}
function AglStyleSemanticAnalyser$analyseTagRule$lambda(it) {
  return _QualifiedName___get_value__impl__nkc4gq(it.f27_1) === 'LITERAL';
}
function AglStyleSemanticAnalyser$analyseTagRule$lambda_0(it) {
  return _QualifiedName___get_value__impl__nkc4gq(it.f27_1) === 'PATTERN';
}
function AglStyleSemanticAnalyser$analyseTagRule$lambda_1(it) {
  return equals(it, new QualifiedName(Companion_getInstance_27().s3e_1));
}
function AglStyleSyntaxAnalyser$unit$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.r2z(p0, p1, p2);
  l.callableName = 'unit';
  return l;
}
function AglStyleSyntaxAnalyser$namespace$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.s2z(p0, p1, p2);
  l.callableName = 'namespace';
  return l;
}
function AglStyleSyntaxAnalyser$styleSet$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.e3f(p0, p1, p2);
  l.callableName = 'styleSet';
  return l;
}
function AglStyleSyntaxAnalyser$rule$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.f3f(p0, p1, p2);
  l.callableName = 'rule';
  return l;
}
function AglStyleSyntaxAnalyser$metaRule$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.g3f(p0, p1, p2);
  l.callableName = 'metaRule';
  return l;
}
function AglStyleSyntaxAnalyser$tagRule$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.h3f(p0, p1, p2);
  l.callableName = 'tagRule';
  return l;
}
function AglStyleSyntaxAnalyser$selectorExpression$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.i3f(p0, p1, p2);
  l.callableName = 'selectorExpression';
  return l;
}
function AglStyleSyntaxAnalyser$selectorAndComposition$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.j3f(p0, p1, p2);
  l.callableName = 'selectorAndComposition';
  return l;
}
function AglStyleSyntaxAnalyser$selectorSingle$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.k3f(p0, p1, p2);
  l.callableName = 'selectorSingle';
  return l;
}
function AglStyleSyntaxAnalyser$styleList$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.l3f(p0, p1, p2);
  l.callableName = 'styleList';
  return l;
}
function AglStyleSyntaxAnalyser$style$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.m3f(p0, p1, p2);
  l.callableName = 'style';
  return l;
}
function AglStyleSyntaxAnalyser$styleValue$ref($boundThis) {
  var l = (p0, p1, p2) => $boundThis.n3f(p0, p1, p2);
  l.callableName = 'styleValue';
  return l;
}
function AglStyleSyntaxAnalyser$styleSet$lambda($name, $extends, this$0, $nodeInfo, $sentence, $rules) {
  return (ns) => {
    // Inline function 'kotlin.also' call
    var this_0 = new AglStyleSetDefault(ns, $name, $extends);
    this$0.setLocationFor(this_0, $nodeInfo, $sentence);
    var ss = this_0;
    var tmp = ss.s3f_1;
    (isInterface(tmp, KtMutableList) ? tmp : THROW_CCE()).x($rules);
    return Unit_instance;
  };
}
function AglStyleModelDefault$Companion$fromString$lambda$lambda($context) {
  return ($this$semanticAnalysis) => {
    $this$semanticAnalysis.context($context);
    return Unit_instance;
  };
}
function AglStyleModelDefault$Companion$fromString$lambda($context) {
  return ($this$options) => {
    $this$options.semanticAnalysis(AglStyleModelDefault$Companion$fromString$lambda$lambda($context));
    return Unit_instance;
  };
}
var Companion_instance_26;
function Companion_getInstance_28() {
  if (Companion_instance_26 === VOID)
    new Companion_25();
  return Companion_instance_26;
}
function AglStyleSetDefault$asString$lambda($newIndent) {
  return (it) => $newIndent.toString() + it.asString($newIndent);
}
function AglStyleMetaRuleDefault$asString$lambda($newIndent) {
  return (it) => $newIndent.toString() + it.name + ': ' + it.value + ';';
}
function AglStyleTagRuleDefault$asString$lambda(it) {
  return it.value;
}
function AglStyleTagRuleDefault$asString$lambda_0($newIndent) {
  return (it) => $newIndent.toString() + it.name + ': ' + it.value + ';';
}
var AglStyleSelectorKind_SPECIAL_instance;
var AglStyleSelectorKind_LITERAL_instance;
var AglStyleSelectorKind_PATTERN_instance;
var AglStyleSelectorKind_RULE_NAME_instance;
function values_5() {
  return [AglStyleSelectorKind_SPECIAL_getInstance(), AglStyleSelectorKind_LITERAL_getInstance(), AglStyleSelectorKind_PATTERN_getInstance(), AglStyleSelectorKind_RULE_NAME_getInstance()];
}
function valueOf_6(value) {
  switch (value) {
    case 'SPECIAL':
      return AglStyleSelectorKind_SPECIAL_getInstance();
    case 'LITERAL':
      return AglStyleSelectorKind_LITERAL_getInstance();
    case 'PATTERN':
      return AglStyleSelectorKind_PATTERN_getInstance();
    case 'RULE_NAME':
      return AglStyleSelectorKind_RULE_NAME_getInstance();
    default:
      AglStyleSelectorKind_initEntries();
      THROW_IAE('No enum constant value.');
      break;
  }
}
var AglStyleSelectorKind_entriesInitialized;
function AglStyleSelectorKind_initEntries() {
  if (AglStyleSelectorKind_entriesInitialized)
    return Unit_instance;
  AglStyleSelectorKind_entriesInitialized = true;
  AglStyleSelectorKind_SPECIAL_instance = new AglStyleSelectorKind('SPECIAL', 0);
  AglStyleSelectorKind_LITERAL_instance = new AglStyleSelectorKind('LITERAL', 1);
  AglStyleSelectorKind_PATTERN_instance = new AglStyleSelectorKind('PATTERN', 2);
  AglStyleSelectorKind_RULE_NAME_instance = new AglStyleSelectorKind('RULE_NAME', 3);
}
function AglStyleSelectorKind_SPECIAL_getInstance() {
  AglStyleSelectorKind_initEntries();
  return AglStyleSelectorKind_SPECIAL_instance;
}
function AglStyleSelectorKind_LITERAL_getInstance() {
  AglStyleSelectorKind_initEntries();
  return AglStyleSelectorKind_LITERAL_instance;
}
function AglStyleSelectorKind_PATTERN_getInstance() {
  AglStyleSelectorKind_initEntries();
  return AglStyleSelectorKind_PATTERN_instance;
}
function AglStyleSelectorKind_RULE_NAME_getInstance() {
  AglStyleSelectorKind_initEntries();
  return AglStyleSelectorKind_RULE_NAME_instance;
}
function styleModel(name, init) {
  var b = new StyleModelBuilder(_SimpleName___init__impl__6s45d0(name));
  init(b);
  return b.build();
}
function AsmTransform$grammar$lambda($this$grammar) {
  $this$grammar.extendsGrammar(AglBase_getInstance().defaultTargetGrammar.selfReference);
  var tmp = OverrideKind_REPLACE_getInstance();
  $this$grammar.concatenation('namespace', tmp, VOID, VOID, AsmTransform$grammar$lambda$lambda);
  $this$grammar.concatenation('transform', VOID, VOID, VOID, AsmTransform$grammar$lambda$lambda_0);
  $this$grammar.concatenation('extends', VOID, VOID, VOID, AsmTransform$grammar$lambda$lambda_1);
  $this$grammar.concatenation('typeImport', VOID, VOID, VOID, AsmTransform$grammar$lambda$lambda_2);
  $this$grammar.concatenation('transformRule', VOID, VOID, VOID, AsmTransform$grammar$lambda$lambda_3);
  $this$grammar.choice('transformRuleRhs', VOID, VOID, VOID, AsmTransform$grammar$lambda$lambda_4);
  $this$grammar.concatenation('expressionRule', VOID, VOID, VOID, AsmTransform$grammar$lambda$lambda_5);
  $this$grammar.concatenation('modifyRule', VOID, VOID, VOID, AsmTransform$grammar$lambda$lambda_6);
  $this$grammar.concatenation('assignmentStatement', VOID, VOID, VOID, AsmTransform$grammar$lambda$lambda_7);
  $this$grammar.concatenation('propertyName', VOID, VOID, VOID, AsmTransform$grammar$lambda$lambda_8);
  $this$grammar.concatenation('grammarRuleName', VOID, VOID, VOID, AsmTransform$grammar$lambda$lambda_9);
  $this$grammar.concatenation('possiblyQualifiedTypeName', VOID, VOID, VOID, AsmTransform$grammar$lambda$lambda_10);
  $this$grammar.concatenation('expression', VOID, VOID, VOID, AsmTransform$grammar$lambda$lambda_11);
  $this$grammar.concatenation('grammarRuleIndex', VOID, VOID, VOID, AsmTransform$grammar$lambda$lambda_12);
  $this$grammar.concatenation('POSITIVE_INTEGER', VOID, VOID, true, AsmTransform$grammar$lambda$lambda_13);
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda($this$concatenation) {
  $this$concatenation.r2t('namespace');
  $this$concatenation.q2t('possiblyQualifiedName');
  $this$concatenation.p2t(0, -1, AsmTransform$grammar$lambda$lambda$lambda);
  $this$concatenation.p2t(0, -1, AsmTransform$grammar$lambda$lambda$lambda_0);
  $this$concatenation.p2t(0, -1, AsmTransform$grammar$lambda$lambda$lambda_1);
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda$lambda($this$lst) {
  $this$lst.q2t('option');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda$lambda_0($this$lst) {
  $this$lst.q2t('import');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda$lambda_1($this$lst) {
  $this$lst.q2t('transform');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_0($this$concatenation) {
  $this$concatenation.r2t('transform');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.s2t(AsmTransform$grammar$lambda$lambda$lambda_2);
  $this$concatenation.r2t('{');
  $this$concatenation.p2t(0, -1, AsmTransform$grammar$lambda$lambda$lambda_3);
  $this$concatenation.p2t(0, -1, AsmTransform$grammar$lambda$lambda$lambda_4);
  $this$concatenation.p2t(0, -1, AsmTransform$grammar$lambda$lambda$lambda_5);
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda$lambda_2($this$opt) {
  $this$opt.q2t('extends');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda$lambda_3($this$lst) {
  $this$lst.q2t('option');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda$lambda_4($this$lst) {
  $this$lst.q2t('typeImport');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda$lambda_5($this$lst) {
  $this$lst.q2t('transformRule');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_1($this$concatenation) {
  $this$concatenation.r2t(':');
  $this$concatenation.k2w(1, -1, AsmTransform$grammar$lambda$lambda$lambda_6);
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda$lambda_6($this$spLst) {
  $this$spLst.q2t('possiblyQualifiedName');
  $this$spLst.r2t(',');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_2($this$concatenation) {
  $this$concatenation.r2t('import-types');
  $this$concatenation.q2t('possiblyQualifiedName');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_3($this$concatenation) {
  $this$concatenation.q2t('grammarRuleName');
  $this$concatenation.r2t(':');
  $this$concatenation.q2t('transformRuleRhs');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_4($this$choice) {
  $this$choice.q2t('expressionRule');
  $this$choice.q2t('modifyRule');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_5($this$concatenation) {
  $this$concatenation.q2t('expression');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_6($this$concatenation) {
  $this$concatenation.r2t('{');
  $this$concatenation.q2t('possiblyQualifiedTypeName');
  $this$concatenation.r2t('->');
  $this$concatenation.p2t(1, -1, AsmTransform$grammar$lambda$lambda$lambda_7);
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda$lambda_7($this$lst) {
  $this$lst.q2t('assignmentStatement');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_7($this$concatenation) {
  $this$concatenation.q2t('propertyName');
  $this$concatenation.s2t(AsmTransform$grammar$lambda$lambda$lambda_8);
  $this$concatenation.r2t(':=');
  $this$concatenation.q2t('expression');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda$lambda_8($this$opt) {
  $this$opt.q2t('grammarRuleIndex');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_8($this$concatenation) {
  $this$concatenation.q2t('IDENTIFIER');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_9($this$concatenation) {
  $this$concatenation.q2t('IDENTIFIER');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_10($this$concatenation) {
  $this$concatenation.q2t('possiblyQualifiedName');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_11($this$concatenation) {
  $this$concatenation.n38(AglExpressions_getInstance().defaultTargetGrammar.selfReference, 'expression');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_12($this$concatenation) {
  $this$concatenation.r2t('$');
  $this$concatenation.q2t('POSITIVE_INTEGER');
  return Unit_instance;
}
function AsmTransform$grammar$lambda$lambda_13($this$concatenation) {
  $this$concatenation.l2t('[0-9]+');
  return Unit_instance;
}
var AsmTransform_instance;
function AsmTransform_getInstance() {
  if (AsmTransform_instance === VOID)
    new AsmTransform_0();
  return AsmTransform_instance;
}
function AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda($this$typeModel) {
  $this$typeModel.namespace('parse', VOID, AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda);
  return Unit_instance;
}
function AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda($this$namespace) {
  $this$namespace.data('Node', AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda$lambda);
  $this$namespace.data('Leaf', AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda$lambda_0);
  $this$namespace.data('Branch', AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda$lambda_1);
  $this$namespace.data('BranchSeparated', AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda$lambda_2);
  return Unit_instance;
}
function AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda$lambda($this$data) {
  $this$data.subtypes(['BranchSeparated', 'Branch', 'Leaf']);
  $this$data.property(_PropertyName___get_value__impl__p219lh(Companion_getInstance_29().PATH), StdLibDefault_getInstance().AnyType, 0);
  $this$data.property(_PropertyName___get_value__impl__p219lh(Companion_getInstance_29().ALTERNATIVE), StdLibDefault_getInstance().Integer, 1);
  $this$data.property(_PropertyName___get_value__impl__p219lh(Companion_getInstance_29().MATCHED_TEXT), StdLibDefault_getInstance().String, 2);
  return Unit_instance;
}
function AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda$lambda_0($this$data) {
  $this$data.subtypes(['Node']);
  $this$data.property('value', StdLibDefault_getInstance().String, 0);
  return Unit_instance;
}
function AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda$lambda_1($this$data) {
  $this$data.supertypes(['Node']);
  $this$data.propertyListTypeOf(_PropertyName___get_value__impl__p219lh(Companion_getInstance_29().CHILDREN), _QualifiedName___get_value__impl__nkc4gq(StdLibDefault_getInstance().AnyType.qualifiedTypeName), false, 0);
  $this$data.propertyListTypeOf(_PropertyName___get_value__impl__p219lh(Companion_getInstance_29().CHILD), _QualifiedName___get_value__impl__nkc4gq(StdLibDefault_getInstance().AnyType.qualifiedTypeName), false, 1);
  return Unit_instance;
}
function AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda$lambda_2($this$data) {
  $this$data.supertypes(['Node']);
  var tmp = _PropertyName___get_value__impl__p219lh(Companion_getInstance_29().CHILDREN);
  $this$data.propertyListSeparatedType(tmp, false, 0, AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda$lambda$lambda);
  var tmp_0 = _PropertyName___get_value__impl__p219lh(Companion_getInstance_29().CHILD);
  $this$data.propertyListSeparatedType(tmp_0, false, 1, AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda$lambda$lambda_0);
  return Unit_instance;
}
function AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda$lambda$lambda($this$propertyListSeparatedType) {
  $this$propertyListSeparatedType.ref(_QualifiedName___get_value__impl__nkc4gq(StdLibDefault_getInstance().AnyType.qualifiedTypeName));
  $this$propertyListSeparatedType.ref(_QualifiedName___get_value__impl__nkc4gq(StdLibDefault_getInstance().AnyType.qualifiedTypeName));
  return Unit_instance;
}
function AsmTransformInterpreter$Companion$parseNodeTypeModel$lambda$lambda$lambda$lambda_0($this$propertyListSeparatedType) {
  $this$propertyListSeparatedType.ref(_QualifiedName___get_value__impl__nkc4gq(StdLibDefault_getInstance().AnyType.qualifiedTypeName));
  $this$propertyListSeparatedType.ref(_QualifiedName___get_value__impl__nkc4gq(StdLibDefault_getInstance().AnyType.qualifiedTypeName));
  return Unit_instance;
}
var Companion_instance_27;
function Companion_getInstance_29() {
  if (Companion_instance_27 === VOID)
    new Companion_26();
  return Companion_instance_27;
}
function evaluateSelfStatement($this, evc, expression) {
  return $this.exprInterpreter.evaluateExpression(evc, expression);
}
function _get_createTypes__hq4u5o($this, _this__u8e3s4) {
  return _this__u8e3s4.get('create-missing-types') === 'true';
}
function _get_overrideDefault__nipkis($this, _this__u8e3s4) {
  return _this__u8e3s4.get('override-default-transform') === 'true';
}
var Companion_instance_28;
function Companion_getInstance_30() {
  return Companion_instance_28;
}
function _get__typeModel__vdou7v($this) {
  return ensureNotNull($this.z3h_1).typeModel;
}
function _get__grammarModel__ofdtu8($this) {
  return ensureNotNull($this.z3h_1).grammarModel;
}
function convertRulesThatSimplyRedefineDefaultType($this, trs) {
  // Inline function 'kotlin.collections.filter' call
  var tmp0 = trs.rules.v2();
  // Inline function 'kotlin.collections.filterTo' call
  var destination = ArrayList.y();
  var _iterator__ex2g4s = tmp0.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    var tmp;
    var tmp_0 = element.expression;
    if (isInterface(tmp_0, RootExpression)) {
      var tmp_1 = element.expression;
      tmp = !(isInterface(tmp_1, RootExpression) ? tmp_1 : THROW_CCE()).isSelf;
    } else {
      tmp = false;
    }
    if (tmp) {
      destination.r(element);
    }
  }
  var rulesToConvert = destination;
  if (_get_overrideDefault__nipkis(Companion_instance_28, trs.options)) {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = rulesToConvert.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      var tmp_2 = element_0.expression;
      var expr = isInterface(tmp_2, RootExpression) ? tmp_2 : THROW_CCE();
      var pqn = get_asPossiblyQualifiedName(expr.name);
      var tmp0_safe_receiver = _get__typeModel__vdou7v($this).findFirstDefinitionByPossiblyQualifiedNameOrNull(pqn);
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.type();
      var exprType = tmp1_elvis_lhs == null ? StdLibDefault_getInstance().NothingType : tmp1_elvis_lhs;
      var tmp2_elvis_lhs = $this.b3i_1.value.findDefinitionByQualifiedNameOrNull(trs.qualifiedName);
      var tmp_3;
      if (tmp2_elvis_lhs == null) {
        var message = 'Should exist!';
        throw IllegalStateException.v4(toString(message));
      } else {
        tmp_3 = tmp2_elvis_lhs;
      }
      var defRs = tmp_3;
      var tmp3_elvis_lhs = defRs.findOwnedTrRuleForGrammarRuleNamedOrNull(element_0.grammarRuleName);
      var tmp_4;
      if (tmp3_elvis_lhs == null) {
        var message_0 = 'Should exist!';
        throw IllegalStateException.v4(toString(message_0));
      } else {
        tmp_4 = tmp3_elvis_lhs;
      }
      var defRule = tmp_4;
      var clonedTypeDeclOrCreated = findOrCloneFromDefaultTypeForTransformRule($this, pqn, trs, element_0);
      var defExpr = defRule.expression;
      var tmp_5;
      if (isInterface(defExpr, CreateObjectExpression)) {
        // Inline function 'kotlin.also' call
        var this_0 = new CreateObjectExpressionDefault(pqn, defExpr.constructorArguments);
        this_0.v2g_1 = defExpr.propertyAssignments;
        tmp_5 = this_0;
      } else {
        var message_1 = 'Unsupported ' + getKClassFromExpression(defExpr).zc();
        throw IllegalStateException.v4(toString(message_1));
      }
      var newExpr = tmp_5;
      var newRule = transformationRule(clonedTypeDeclOrCreated.type(), newExpr);
      newRule.r2g_1 = element_0.grammarRuleName;
      trs.setRule(newRule);
      var defDecl = defRule.resolvedType.resolvedDeclaration;
      if (isInterface(clonedTypeDeclOrCreated, StructuredType)) {
        // Inline function 'kotlin.collections.filter' call
        var tmp0_0 = defDecl.property;
        // Inline function 'kotlin.collections.filterTo' call
        var destination_0 = ArrayList.y();
        var _iterator__ex2g4s_1 = tmp0_0.s();
        while (_iterator__ex2g4s_1.t()) {
          var element_1 = _iterator__ex2g4s_1.u();
          var tmp_6;
          if (element_1 instanceof PropertyDeclarationStored) {
            tmp_6 = null == exprType.resolvedDeclaration.findOwnedPropertyOrNull(element_1.e3i_1);
          } else {
            tmp_6 = false;
          }
          if (tmp_6) {
            destination_0.r(element_1);
          }
        }
        var tocopy = destination_0;
        // Inline function 'kotlin.collections.forEach' call
        var _iterator__ex2g4s_2 = tocopy.s();
        while (_iterator__ex2g4s_2.t()) {
          var element_2 = _iterator__ex2g4s_2.u();
          clonedTypeDeclOrCreated.appendPropertyStored(element_2.name, element_2.typeInstance, element_2.characteristics, element_2.index);
        }
      }
    }
  } else {
    // Inline function 'kotlin.collections.isNotEmpty' call
    if (!rulesToConvert.a1()) {
      $this.x3h_1.error(null, "Transformation rules in '" + QualifiedName__toString_impl_z3wem2(trs.qualifiedName) + "' rewrite their type, but 'override-default-transform' is not specified");
    }
  }
}
function typeFor($this, trs, trr) {
  var expr = trr.expression;
  var tmp = _get__typeModel__vdou7v($this).findNamespaceOrNull(trs.qualifiedName);
  var tmp0_elvis_lhs = (tmp == null ? true : isInterface(tmp, GrammarTypeNamespace)) ? tmp : THROW_CCE();
  var tmp_0;
  if (tmp0_elvis_lhs == null) {
    var message = 'Should exist!';
    throw IllegalStateException.v4(toString(message));
  } else {
    tmp_0 = tmp0_elvis_lhs;
  }
  var gtns = tmp_0;
  var exprTypeResolver = new ExpressionTypeResolver(_get__typeModel__vdou7v($this), gtns, $this.x3h_1);
  var tmp_1;
  if (trr.isResolved) {
    tmp_1 = trr.resolvedType;
  } else {
    if (isInterface(expr, CreateObjectExpression)) {
      tmp_1 = exprTypeResolver.typeFor(expr, StdLibDefault_getInstance().AnyType);
    } else {
      if (isInterface(expr, CreateTupleExpression)) {
        tmp_1 = exprTypeResolver.typeFor(expr, StdLibDefault_getInstance().AnyType);
      } else {
        if (isInterface(expr, CastExpression)) {
          tmp_1 = exprTypeResolver.typeFor(expr, StdLibDefault_getInstance().AnyType);
        } else {
          var message_0 = 'Unsupported expression type: ' + toString(expr);
          throw IllegalStateException.v4(toString(message_0));
        }
      }
    }
  }
  var exprType = tmp_1;
  return exprType;
}
function findOrCloneFromDefaultTypeForTransformRule($this, typePqn, trs, trr) {
  var tmp0_safe_receiver = $this.b3i_1.value.typeModel;
  var grmDecl = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.findFirstDefinitionByPossiblyQualifiedNameOrNull(typePqn);
  var tmp2_elvis_lhs = grmDecl == null ? null : grmDecl.findInOrCloneTo(_get__typeModel__vdou7v($this));
  var tmp;
  if (tmp2_elvis_lhs == null) {
    // Inline function 'kotlin.let' call
    var tmp_0 = _get__typeModel__vdou7v($this).findNamespaceOrNull(trs.qualifiedName);
    var tmp0_elvis_lhs = (tmp_0 == null ? true : isInterface(tmp_0, GrammarTypeNamespace)) ? tmp_0 : THROW_CCE();
    var tmp_1;
    if (tmp0_elvis_lhs == null) {
      var message = 'Should exist!';
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_1 = tmp0_elvis_lhs;
    }
    var gtns = tmp_1;
    var t = gtns.findOwnedOrCreateDataTypeNamed(typePqn.simpleName);
    tmp = t;
  } else {
    tmp = tmp2_elvis_lhs;
  }
  var clonedTypeDeclOrCreated = tmp;
  var tmp3_subject = clonedTypeDeclOrCreated.namespace;
  if (isInterface(tmp3_subject, GrammarTypeNamespace)) {
    var tmp_2 = clonedTypeDeclOrCreated.namespace;
    (isInterface(tmp_2, GrammarTypeNamespace) ? tmp_2 : THROW_CCE()).setTypeForGrammarRule(trr.grammarRuleName, clonedTypeDeclOrCreated.type());
  }
  return clonedTypeDeclOrCreated;
}
function overrideDefaultNamespace($this, ns) {
  if (_get_overrideDefault__nipkis(Companion_instance_28, ns.options)) {
    var grmNs = $this.b3i_1.value.findNamespaceOrNull(ns.qualifiedName);
    if (grmNs == null) {
      $this.x3h_1.error(null, "No default namespace with name '" + QualifiedName__toString_impl_z3wem2(ns.qualifiedName) + "' found, can't override it");
    } else {
      var _iterator__ex2g4s = grmNs.definition.s();
      while (_iterator__ex2g4s.t()) {
        var grmTrs = _iterator__ex2g4s.u();
        if (!ns.definitionByName.x2(new SimpleName(grmTrs.name))) {
          var tmp = grmTrs.name;
          // Inline function 'kotlin.collections.map' call
          var this_0 = grmTrs.extends;
          // Inline function 'kotlin.collections.mapTo' call
          var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
          var _iterator__ex2g4s_0 = this_0.s();
          while (_iterator__ex2g4s_0.t()) {
            var item = _iterator__ex2g4s_0.u();
            var tmp$ret$0 = item.cloneTo(ns);
            destination.r(tmp$ret$0);
          }
          ns.createOwnedTransformRuleSet(tmp, destination, new OptionHolderDefault());
        }
      }
    }
  }
}
function findOrCreateGrammarTypeNamespace($this, qn) {
  var tmp = _get__typeModel__vdou7v($this).findNamespaceOrNull(qn);
  if (((tmp == null ? true : isInterface(tmp, GrammarTypeNamespace)) ? tmp : THROW_CCE()) == null) {
    // Inline function 'kotlin.also' call
    var this_0 = Companion_instance_21.findOrCreateGrammarNamespace(_get__typeModel__vdou7v($this), qn);
    var tmp0_safe_receiver = $this.b3i_1.value.typeModel;
    var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.findNamespaceOrNull(this_0.g3a_1);
    if (tmp1_safe_receiver == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      // Inline function 'kotlin.collections.forEach' call
      var _iterator__ex2g4s = tmp1_safe_receiver.import.s();
      while (_iterator__ex2g4s.t()) {
        var element = _iterator__ex2g4s.u();
        var it = element.p2i_1;
        this_0.addImport(it);
      }
    }
    _get__typeModel__vdou7v($this).addNamespace(this_0);
  }
}
function createMissingTypeNamespaces($this, trs) {
  if (_get_createTypes__hq4u5o(Companion_instance_28, trs.options)) {
    findOrCreateGrammarTypeNamespace($this, trs.qualifiedName);
  }
}
function overrideDefaultRuleSet($this, trs) {
  if (_get_overrideDefault__nipkis(Companion_instance_28, trs.options)) {
    var tmp0_safe_receiver = $this.b3i_1.value.findNamespaceOrNull(trs.namespace.qualifiedName);
    var grmRs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.findDefinitionOrNull(trs.name);
    if (grmRs == null) {
      $this.x3h_1.error(null, "No default ruleset with name '" + QualifiedName__toString_impl_z3wem2(trs.qualifiedName) + "' found");
    } else {
      var _iterator__ex2g4s = grmRs.rules.v2().s();
      while (_iterator__ex2g4s.t()) {
        var grmRl = _iterator__ex2g4s.u();
        if (!trs.rules.x2(new GrammarRuleName(grmRl.grammarRuleName))) {
          trs.setRule(grmRl);
        }
      }
    }
  }
}
function createMissingTypes($this, trs) {
  if (_get_createTypes__hq4u5o(Companion_instance_28, trs.options)) {
    var _iterator__ex2g4s = trs.rules.v2().s();
    while (_iterator__ex2g4s.t()) {
      var trr = _iterator__ex2g4s.u();
      var expr = trr.expression;
      var tmp;
      if (trr.isResolved) {
        tmp = new QualifiedName(trr.resolvedType.qualifiedTypeName);
      } else {
        if (isInterface(expr, CreateObjectExpression)) {
          var tmp_0 = _get__typeModel__vdou7v($this).findNamespaceOrNull(trs.qualifiedName);
          var tmp0_elvis_lhs = (tmp_0 == null ? true : isInterface(tmp_0, GrammarTypeNamespace)) ? tmp_0 : THROW_CCE();
          var tmp_1;
          if (tmp0_elvis_lhs == null) {
            var message = 'Should exist!';
            throw IllegalStateException.v4(toString(message));
          } else {
            tmp_1 = tmp0_elvis_lhs;
          }
          var gtns = tmp_1;
          var exprTypeResolver = new ExpressionTypeResolver(_get__typeModel__vdou7v($this), gtns, $this.x3h_1);
          var t = gtns.findOwnedOrCreateDataTypeNamed(expr.possiblyQualifiedTypeName.simpleName);
          // Inline function 'kotlin.collections.map' call
          var this_0 = expr.constructorArguments;
          // Inline function 'kotlin.collections.mapTo' call
          var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
          var _iterator__ex2g4s_0 = this_0.s();
          while (_iterator__ex2g4s_0.t()) {
            var item = _iterator__ex2g4s_0.u();
            var pName = _ParameterName___init__impl__84hwrp(item.lhsPropertyName);
            var pType = exprTypeResolver.typeFor(item.rhs, Companion_getInstance_29().PARSE_NODE_TYPE_BRANCH_SIMPLE);
            if (equals(pType, StdLibDefault_getInstance().NothingType)) {
              pType = StdLibDefault_getInstance().AnyType;
            }
            var tmp$ret$0 = new ParameterDefinitionSimple(pName, pType, null);
            destination.r(tmp$ret$0);
          }
          var params = destination;
          t.addConstructor(params);
          // Inline function 'kotlin.collections.forEach' call
          var _iterator__ex2g4s_1 = expr.propertyAssignments.s();
          while (_iterator__ex2g4s_1.t()) {
            var element = _iterator__ex2g4s_1.u();
            var propName = _PropertyName___init__impl__sz2wu9(element.lhsPropertyName);
            var propType = exprTypeResolver.typeFor(element.rhs, Companion_getInstance_29().PARSE_NODE_TYPE_BRANCH_SIMPLE);
            if (equals(propType, StdLibDefault_getInstance().NothingType)) {
              propType = StdLibDefault_getInstance().AnyType;
            }
            var existingProp = t.findOwnedPropertyOrNull(propName);
            if (null == existingProp) {
              var characteristics = setOf(PropertyCharacteristic_COMPOSITE_getInstance());
              var tmp_2 = propType;
              var tmp0_elvis_lhs_0 = element.lhsGrammarRuleIndex;
              t.appendPropertyStored(propName, tmp_2, characteristics, tmp0_elvis_lhs_0 == null ? -1 : tmp0_elvis_lhs_0);
            } else {
              if (!equals(existingProp.typeInstance, propType))
                if (!propType.conformsTo(existingProp.typeInstance)) {
                  $this.x3h_1.error(null, "Trying to create missing property '" + PropertyName__toString_impl_hcnfa7(propName) + ': ' + QualifiedName__toString_impl_z3wem2(propType.qualifiedTypeName) + "', '" + QualifiedName__toString_impl_z3wem2(t.qualifiedName) + "' already contains incompatible property '" + PropertyName__toString_impl_hcnfa7(existingProp.name) + ': ' + QualifiedName__toString_impl_z3wem2(existingProp.typeInstance.qualifiedTypeName) + "'.");
                }
            }
          }
          tmp = expr.possiblyQualifiedTypeName;
        } else {
          if (isInterface(expr, CreateTupleExpression)) {
            tmp = new QualifiedName(StdLibDefault_getInstance().TupleType.qualifiedName);
          } else {
            if (isInterface(expr, CastExpression)) {
              tmp = expr.targetType.possiblyQualifiedName;
            } else {
              var message_0 = 'Unsupported expression type: ' + toString(expr);
              throw IllegalStateException.v4(toString(message_0));
            }
          }
        }
      }
      var exprPqn = tmp;
      findOrCloneFromDefaultTypeForTransformRule($this, exprPqn, trs, trr);
    }
  }
}
function AsmTransformSemanticAnalyser$transformFromGrammar$lambda(this$0) {
  return () => {
    var res = Companion_instance_29.fromGrammarModel(_get__grammarModel__ofdtu8(this$0));
    this$0.x3h_1.addAllFrom(res.allIssues);
    return ensureNotNull(res.asm);
  };
}
function unit_2($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var options = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var namespaces = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var name = _SimpleName___init__impl__6s45d0('ParsedTransformUnit');
  // Inline function 'kotlin.collections.associate' call
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(options, 10)), 16);
  // Inline function 'kotlin.collections.associateTo' call
  var destination = LinkedHashMap.kb(capacity);
  var _iterator__ex2g4s = options.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.plusAssign' call
    destination.r2(element.zg_1, element.ah_1);
  }
  var optHolder = new OptionHolderDefault(null, destination);
  return new TransformDomainDefault(name, optHolder, namespaces);
}
function namespace_2($this, target, children, sentence) {
  var tmp = children.z(1);
  var pqn = (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
  var nsName = pqn.asQualifiedName(null);
  var tmp_0 = children.z(2);
  var options = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(3);
  var imports = (!(tmp_1 == null) ? isInterface(tmp_1, KtList) : false) ? tmp_1 : THROW_CCE();
  var tmp_2 = children.z(4);
  var transformBuilders = (!(tmp_2 == null) ? isInterface(tmp_2, KtList) : false) ? tmp_2 : THROW_CCE();
  // Inline function 'kotlin.collections.associate' call
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(options, 10)), 16);
  // Inline function 'kotlin.collections.associateTo' call
  var destination = LinkedHashMap.kb(capacity);
  var _iterator__ex2g4s = options.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.plusAssign' call
    destination.r2(element.zg_1, element.ah_1);
  }
  var optHolder = new OptionHolderDefault(null, destination);
  var namespace = new TransformNamespaceDefault(nsName, optHolder, imports);
  // Inline function 'kotlin.collections.map' call
  // Inline function 'kotlin.collections.mapTo' call
  var destination_0 = ArrayList.w(collectionSizeOrDefault(transformBuilders, 10));
  var _iterator__ex2g4s_0 = transformBuilders.s();
  while (_iterator__ex2g4s_0.t()) {
    var item = _iterator__ex2g4s_0.u();
    var tmp$ret$4 = item(namespace);
    destination_0.r(tmp$ret$4);
  }
  return namespace;
}
function transform($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var name = _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
  var tmp_0 = children.z(2);
  var tmp0_elvis_lhs = (tmp_0 == null ? true : isInterface(tmp_0, KtList)) ? tmp_0 : THROW_CCE();
  var extends_0 = tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs;
  var tmp_1 = children.z(4);
  var options = (!(tmp_1 == null) ? isInterface(tmp_1, KtList) : false) ? tmp_1 : THROW_CCE();
  var tmp_2 = children.z(5);
  var typeImports = (!(tmp_2 == null) ? isInterface(tmp_2, KtList) : false) ? tmp_2 : THROW_CCE();
  var tmp_3 = children.z(6);
  var rules = (!(tmp_3 == null) ? isInterface(tmp_3, KtList) : false) ? tmp_3 : THROW_CCE();
  // Inline function 'kotlin.collections.associate' call
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(options, 10)), 16);
  // Inline function 'kotlin.collections.associateTo' call
  var destination = LinkedHashMap.kb(capacity);
  var _iterator__ex2g4s = options.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.plusAssign' call
    destination.r2(element.zg_1, element.ah_1);
  }
  var optHolder = new OptionHolderDefault(null, destination);
  return AsmTransformSyntaxAnalyser$transform$lambda(extends_0, name, optHolder, rules, typeImports, $this, nodeInfo, sentence);
}
function extends_1($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var this_0 = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  return ListSeparatedArrayList.gk(this_0).ck();
}
function typeImport($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  return _Import___init__impl__786z8c(((!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE()).value);
}
function transformRule($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var grammarRuleName = tmp instanceof GrammarRuleName ? tmp.d1u_1 : THROW_CCE();
  var tmp_0 = children.z(2);
  var trRule = (!(tmp_0 == null) ? isInterface(tmp_0, TransformationRule) : false) ? tmp_0 : THROW_CCE();
  trRule.grammarRuleName = grammarRuleName;
  return trRule;
}
function transformRuleRhs($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? isInterface(tmp, TransformationRule) : false) ? tmp : THROW_CCE();
}
function expressionRule($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var expression = (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
  var tr = new TransformationRuleDefault(expression);
  return tr;
}
function modifyRule($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var possiblyQualifiedTypeName = (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(3);
  var statements = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var expr = new OnExpressionDefault(new RootExpressionDefault('$it'));
  expr.d2v_1 = statements;
  var tr = new TransformationRuleDefault(expr);
  return tr;
}
function assignmentStatement($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var propName = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var grIndex = (tmp_0 == null ? true : typeof tmp_0 === 'number') ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(3);
  var expr = (!(tmp_1 == null) ? isInterface(tmp_1, Expression) : false) ? tmp_1 : THROW_CCE();
  return new AssignmentStatementDefault(propName, grIndex, expr);
}
function propertyName_0($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
}
function expression_0($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? isInterface(tmp, Expression) : false) ? tmp : THROW_CCE();
}
function grammarRuleName($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return _GrammarRuleName___init__impl__yqiut((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
}
function grammarRuleIndex_0($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  return toInt((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
}
function possiblyQualifiedTypeName($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
}
function AsmTransformSyntaxAnalyser$unit$ref($boundThis) {
  var l = (p0, p1, p2) => unit_2($boundThis, p0, p1, p2);
  l.callableName = 'unit';
  return l;
}
function AsmTransformSyntaxAnalyser$namespace$ref($boundThis) {
  var l = (p0, p1, p2) => namespace_2($boundThis, p0, p1, p2);
  l.callableName = 'namespace';
  return l;
}
function AsmTransformSyntaxAnalyser$transform$ref($boundThis) {
  var l = (p0, p1, p2) => transform($boundThis, p0, p1, p2);
  l.callableName = 'transform';
  return l;
}
function AsmTransformSyntaxAnalyser$extends$ref($boundThis) {
  var l = (p0, p1, p2) => extends_1($boundThis, p0, p1, p2);
  l.callableName = 'extends';
  return l;
}
function AsmTransformSyntaxAnalyser$typeImport$ref($boundThis) {
  var l = (p0, p1, p2) => new Import(typeImport($boundThis, p0, p1, p2));
  l.callableName = 'typeImport';
  return l;
}
function AsmTransformSyntaxAnalyser$transformRule$ref($boundThis) {
  var l = (p0, p1, p2) => transformRule($boundThis, p0, p1, p2);
  l.callableName = 'transformRule';
  return l;
}
function AsmTransformSyntaxAnalyser$transformRuleRhs$ref($boundThis) {
  var l = (p0, p1, p2) => transformRuleRhs($boundThis, p0, p1, p2);
  l.callableName = 'transformRuleRhs';
  return l;
}
function AsmTransformSyntaxAnalyser$expressionRule$ref($boundThis) {
  var l = (p0, p1, p2) => expressionRule($boundThis, p0, p1, p2);
  l.callableName = 'expressionRule';
  return l;
}
function AsmTransformSyntaxAnalyser$modifyRule$ref($boundThis) {
  var l = (p0, p1, p2) => modifyRule($boundThis, p0, p1, p2);
  l.callableName = 'modifyRule';
  return l;
}
function AsmTransformSyntaxAnalyser$assignmentStatement$ref($boundThis) {
  var l = (p0, p1, p2) => assignmentStatement($boundThis, p0, p1, p2);
  l.callableName = 'assignmentStatement';
  return l;
}
function AsmTransformSyntaxAnalyser$propertyName$ref($boundThis) {
  var l = (p0, p1, p2) => propertyName_0($boundThis, p0, p1, p2);
  l.callableName = 'propertyName';
  return l;
}
function AsmTransformSyntaxAnalyser$grammarRuleIndex$ref($boundThis) {
  var l = (p0, p1, p2) => grammarRuleIndex_0($boundThis, p0, p1, p2);
  l.callableName = 'grammarRuleIndex';
  return l;
}
function AsmTransformSyntaxAnalyser$grammarRuleName$ref($boundThis) {
  var l = (p0, p1, p2) => new GrammarRuleName(grammarRuleName($boundThis, p0, p1, p2));
  l.callableName = 'grammarRuleName';
  return l;
}
function AsmTransformSyntaxAnalyser$possiblyQualifiedTypeName$ref($boundThis) {
  var l = (p0, p1, p2) => possiblyQualifiedTypeName($boundThis, p0, p1, p2);
  l.callableName = 'possiblyQualifiedTypeName';
  return l;
}
function AsmTransformSyntaxAnalyser$expression$ref($boundThis) {
  var l = (p0, p1, p2) => expression_0($boundThis, p0, p1, p2);
  l.callableName = 'expression';
  return l;
}
function AsmTransformSyntaxAnalyser$transform$lambda($extends, $name, $optHolder, $rules, $typeImports, this$0, $nodeInfo, $sentence) {
  return (namespace) => {
    // Inline function 'kotlin.collections.map' call
    var this_0 = $extends;
    // Inline function 'kotlin.collections.mapTo' call
    var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var item = _iterator__ex2g4s.u();
      var tmp$ret$0 = new TransformRuleSetReferenceDefault(namespace, item);
      destination.r(tmp$ret$0);
    }
    var extendRefs = destination;
    var asm = new TransformRuleSetDefault(namespace, $name, extendRefs, $optHolder, $rules);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = $typeImports.s();
    while (_iterator__ex2g4s_0.t()) {
      var element = _iterator__ex2g4s_0.u();
      var it = element.p2i_1;
      asm.addImportType(it);
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_1 = $rules.s();
    while (_iterator__ex2g4s_1.t()) {
      var element_0 = _iterator__ex2g4s_1.u();
      asm.setRule(element_0);
    }
    // Inline function 'kotlin.also' call
    this$0.setLocationFor(asm, $nodeInfo, $sentence);
    return asm;
  };
}
function TransformDomainDefault$Companion$fromString$lambda$lambda($context) {
  return ($this$semanticAnalysis) => {
    $this$semanticAnalysis.context($context);
    return Unit_instance;
  };
}
function TransformDomainDefault$Companion$fromString$lambda($context) {
  return ($this$options) => {
    $this$options.semanticAnalysis(TransformDomainDefault$Companion$fromString$lambda$lambda($context));
    return Unit_instance;
  };
}
var Companion_instance_29;
function Companion_getInstance_31() {
  return Companion_instance_29;
}
function TransformNamespaceDefault$asString$lambda(a, b) {
  // Inline function 'kotlin.comparisons.compareValuesBy' call
  var it = a.p2i_1;
  var tmp = _Import___get_value__impl__o1bac0(it);
  var it_0 = b.p2i_1;
  var tmp$ret$1 = _Import___get_value__impl__o1bac0(it_0);
  return compareValues(tmp, tmp$ret$1);
}
function TransformNamespaceDefault$asString$lambda_0($newIndent) {
  return (it) => $newIndent.toString() + 'import ' + _Import___get_value__impl__o1bac0(it.p2i_1);
}
function TransformNamespaceDefault$asString$lambda_1(a, b) {
  // Inline function 'kotlin.comparisons.compareValuesBy' call
  var tmp = _SimpleName___get_value__impl__rl2r3c(a.name);
  var tmp$ret$1 = _SimpleName___get_value__impl__rl2r3c(b.name);
  return compareValues(tmp, tmp$ret$1);
}
function TransformNamespaceDefault$asString$lambda_2($newIndent) {
  return (it) => $newIndent.toString() + it.asString($newIndent);
}
protoOf(TransformRuleSetReferenceDefault)['<set-resolved>'] = protoOf(TransformRuleSetReferenceDefault).h2t;
function TransformRuleSetDefault$asString$lambda(it) {
  return it;
}
function TransformRuleSetDefault$asString$lambda_0(a, b) {
  // Inline function 'kotlin.comparisons.compareValuesBy' call
  var it = a.p2i_1;
  var tmp = _Import___get_value__impl__o1bac0(it);
  var it_0 = b.p2i_1;
  var tmp$ret$1 = _Import___get_value__impl__o1bac0(it_0);
  return compareValues(tmp, tmp$ret$1);
}
function TransformRuleSetDefault$asString$lambda_1($newIndent) {
  return (it) => $newIndent.toString() + 'import-types ' + _Import___get_value__impl__o1bac0(it.p2i_1);
}
function TransformRuleSetDefault$asString$lambda_2(a, b) {
  // Inline function 'kotlin.comparisons.compareValuesBy' call
  var tmp = _GrammarRuleName___get_value__impl__470s0v(a.a3().d1u_1);
  var tmp$ret$1 = _GrammarRuleName___get_value__impl__470s0v(b.a3().d1u_1);
  return compareValues(tmp, tmp$ret$1);
}
function transformationRule(type, expression) {
  // Inline function 'kotlin.also' call
  var this_0 = new TransformationRuleDefault(expression);
  this_0.resolveTypeAs(type);
  return this_0;
}
function asmTransform(name, typeModel, createTypes, init) {
  var b = new AsmTransformModelBuilder(_SimpleName___init__impl__6s45d0(name), typeModel, createTypes);
  init(b);
  var m = b.build();
  return m;
}
function resolveType($this, grName, typeName) {
  var pqt = get_asPossiblyQualifiedName(typeName);
  var tmp;
  if ($this.c3k_1) {
    var tmp_0;
    if (pqt instanceof SimpleName) {
      var tns = $this.b3k_1.findOrCreateNamespace($this.g3k_1, listOf(new Import(_QualifiedName___get_asImport__impl__hufagg(StdLibDefault_getInstance().t2e_1))));
      var td = tns.findOwnedOrCreateDataTypeNamed(pqt.a1u_1);
      if (tns instanceof GrammarTypeNamespaceSimple) {
        tns.setTypeForGrammarRule(grName, td.type());
      }
      tmp_0 = td;
    } else {
      if (pqt instanceof QualifiedName) {
        var nsqn = _QualifiedName___get_front__impl__24j8eq(pqt.f27_1);
        var tn = _QualifiedName___get_last__impl__838y8h(pqt.f27_1);
        var tns_0 = $this.b3k_1.findOrCreateNamespace(nsqn, listOf(new Import(_QualifiedName___get_asImport__impl__hufagg(StdLibDefault_getInstance().t2e_1))));
        var td_0 = tns_0.findOwnedOrCreateDataTypeNamed(tn);
        if (tns_0 instanceof GrammarTypeNamespaceSimple) {
          tns_0.setTypeForGrammarRule(grName, td_0.type());
        }
        tmp_0 = td_0;
      } else {
        noWhenBranchMatchedException();
      }
    }
    tmp = tmp_0;
  } else {
    var tmp1_elvis_lhs = $this.b3k_1.findNamespaceOrNull($this.g3k_1);
    var defaultNs = tmp1_elvis_lhs == null ? null : tmp1_elvis_lhs;
    // Inline function 'kotlin.collections.mapNotNull' call
    var tmp0 = $this.d3k_1;
    // Inline function 'kotlin.collections.mapNotNullTo' call
    var destination = ArrayList.y();
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var it = element.p2i_1;
      var tmp0_safe_receiver = $this.b3k_1.findNamespaceOrNull(_Import___get_asQualifiedName__impl__htdpak(it));
      if (tmp0_safe_receiver == null)
        null;
      else {
        // Inline function 'kotlin.let' call
        destination.r(tmp0_safe_receiver);
      }
    }
    var importedNs = destination;
    var tmp_1;
    if (defaultNs == null) {
      tmp_1 = null;
    } else {
      // Inline function 'kotlin.let' call
      tmp_1 = listOf(defaultNs);
    }
    var tmp3_elvis_lhs = tmp_1;
    var nss = plus(tmp3_elvis_lhs == null ? emptyList() : tmp3_elvis_lhs, importedNs);
    var tmp$ret$10;
    $l$block: {
      // Inline function 'kotlin.collections.firstNotNullOfOrNull' call
      var _iterator__ex2g4s_0 = nss.s();
      while (_iterator__ex2g4s_0.t()) {
        var element_0 = _iterator__ex2g4s_0.u();
        var result = element_0.findTypeNamed(pqt);
        if (!(result == null)) {
          tmp$ret$10 = result;
          break $l$block;
        }
      }
      tmp$ret$10 = null;
    }
    var tmp4_elvis_lhs = tmp$ret$10;
    var tmp_2;
    if (tmp4_elvis_lhs == null) {
      var message = "Type '" + toString(pqt) + "' not found";
      throw IllegalStateException.v4(toString(message));
    } else {
      tmp_2 = tmp4_elvis_lhs;
    }
    var qt = tmp_2;
    return qt;
  }
  return tmp;
}
function trRule($this, grammarRuleName, typeName, expression) {
  var qt = resolveType($this, _GrammarRuleName___init__impl__yqiut(grammarRuleName), typeName);
  var tr = new TransformationRuleDefault(expression);
  tr.r2g_1 = _GrammarRuleName___init__impl__yqiut(grammarRuleName);
  $this.f3k_1.r(tr);
  tr.resolveTypeAs(qt.type());
}
function AsmTransformRuleSetBuilder$unionRule$lambda($subtypes) {
  return (ut) => {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $subtypes.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      ut.addAlternative(element);
    }
    return Unit_instance;
  };
}
function AsmTransformRuleSetBuilder$createObject$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function createProperties($this) {
  createPropertiesForList($this);
  createPropertiesForListSeparated($this);
}
function createMethods($this) {
  createMethodsForString($this);
  createMethodsForList($this);
}
function createMethodsForString($this) {
  var typeDecl = $this.String.resolvedDeclaration;
  typeDecl.appendMethodPrimitive(_MethodName___init__impl__2ggy8b('toBoolean'), emptyList(), $this.Boolean, "Convert this String to a Boolean value. 'true' is true, 'false' is false, other values are $nothing.");
  typeDecl.appendMethodPrimitive(_MethodName___init__impl__2ggy8b('toInteger'), emptyList(), $this.Integer, 'Convert this String to an Integer value.');
  typeDecl.appendMethodPrimitive(_MethodName___init__impl__2ggy8b('toReal'), emptyList(), $this.Real, 'Convert this String to a Real value.');
  typeDecl.appendMethodPrimitive(_MethodName___init__impl__2ggy8b('removeSurrounding'), listOf(new ParameterDefinitionSimple(_ParameterName___init__impl__84hwrp('delimiter'), $this.Integer, null)), $this.String, 'Remove the given string value from the start and end of this string, if present.');
}
function createPropertiesForList($this) {
  var typeDecl = $this.List;
  typeDecl.appendPropertyPrimitive(_PropertyName___init__impl__sz2wu9('size'), $this.createTypeInstance(typeDecl.qualifiedName, new SimpleName($this.Integer.typeName)), 'Number of elements in the List.');
  typeDecl.appendPropertyPrimitive(_PropertyName___init__impl__sz2wu9('first'), new TypeParameterReference(typeDecl, _SimpleName___init__impl__6s45d0('E')), 'First element in the List.');
  typeDecl.appendPropertyPrimitive(_PropertyName___init__impl__sz2wu9('last'), new TypeParameterReference(typeDecl, _SimpleName___init__impl__6s45d0('E')), 'Last element in the list.');
  typeDecl.appendPropertyPrimitive(_PropertyName___init__impl__sz2wu9('back'), $this.createTypeInstance(typeDecl.qualifiedName, new SimpleName($this.x2e_1), listOf((new TypeParameterReference(typeDecl, _SimpleName___init__impl__6s45d0('E'))).asTypeArgument)), 'All elements in the List except the first one.');
  typeDecl.appendPropertyPrimitive(_PropertyName___init__impl__sz2wu9('front'), $this.createTypeInstance(typeDecl.qualifiedName, new SimpleName($this.x2e_1), listOf((new TypeParameterReference(typeDecl, _SimpleName___init__impl__6s45d0('E'))).asTypeArgument)), 'All elements in the List except the last one.');
  typeDecl.appendPropertyPrimitive(_PropertyName___init__impl__sz2wu9('join'), $this.createTypeInstance(typeDecl.qualifiedName, new SimpleName($this.String.typeName)), 'The String value of all elements concatenated.');
}
function createMethodsForList($this) {
  var typeDecl = $this.List;
  typeDecl.appendMethodPrimitive(_MethodName___init__impl__2ggy8b('get'), listOf(new ParameterDefinitionSimple(_ParameterName___init__impl__84hwrp('index'), $this.createTypeInstance(typeDecl.qualifiedName, new SimpleName($this.Integer.typeName)), null)), new TypeParameterReference(typeDecl, _SimpleName___init__impl__6s45d0('E')), 'The element at the given index.');
  typeDecl.appendMethodPrimitive(_MethodName___init__impl__2ggy8b('separate'), emptyList(), $this.createTypeInstance(typeDecl.qualifiedName, new SimpleName($this.y2e_1), listOf_0([StdLibDefault_getInstance().AnyType.asTypeArgument, StdLibDefault_getInstance().AnyType.asTypeArgument])), '');
}
function createPropertiesForListSeparated($this) {
  var typeDecl = $this.ListSeparated;
  typeDecl.appendPropertyPrimitive(_PropertyName___init__impl__sz2wu9('elements'), $this.createTypeInstance(typeDecl.qualifiedName, new SimpleName($this.x2e_1), listOf(StdLibDefault_getInstance().AnyType.asTypeArgument)), 'All elements in the List.');
  typeDecl.appendPropertyPrimitive(_PropertyName___init__impl__sz2wu9('items'), $this.createTypeInstance(typeDecl.qualifiedName, new SimpleName(_SimpleName___init__impl__6s45d0('I'))), 'Items in the List.');
  typeDecl.appendPropertyPrimitive(_PropertyName___init__impl__sz2wu9('separators'), $this.createTypeInstance(typeDecl.qualifiedName, new SimpleName(_SimpleName___init__impl__6s45d0('S'))), 'Separators in the List.');
}
var StdLibDefault_instance;
function StdLibDefault_getInstance() {
  if (StdLibDefault_instance === VOID)
    new StdLibDefault_0();
  return StdLibDefault_instance;
}
function TypeModelSimple$Companion$fromString$lambda($this$typeModel) {
  return Unit_instance;
}
function TypeModelSimple$Companion$fromString$lambda$lambda($context) {
  return ($this$semanticAnalysis) => {
    $this$semanticAnalysis.context($context);
    return Unit_instance;
  };
}
function TypeModelSimple$Companion$fromString$lambda_0($context) {
  return ($this$options) => {
    $this$options.semanticAnalysis(TypeModelSimple$Companion$fromString$lambda$lambda($context));
    return Unit_instance;
  };
}
var Companion_instance_30;
function Companion_getInstance_32() {
  return Companion_instance_30;
}
function TypeModelSimpleAbstract$_namespace$lambda(this$0) {
  return () => {
    // Inline function 'kotlin.collections.associateBy' call
    var this_0 = this$0.namespace;
    var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(this_0, 10)), 16);
    // Inline function 'kotlin.collections.associateByTo' call
    var destination = LinkedHashMap.kb(capacity);
    var _iterator__ex2g4s = this_0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var tmp$ret$0 = new QualifiedName(element.qualifiedName);
      destination.r2(tmp$ret$0, element);
    }
    return destination;
  };
}
function TypeModelSimpleAbstract$asString$lambda(a, b) {
  // Inline function 'kotlin.comparisons.compareValuesBy' call
  var tmp = _QualifiedName___get_value__impl__nkc4gq(a.qualifiedName);
  var tmp$ret$1 = _QualifiedName___get_value__impl__nkc4gq(b.qualifiedName);
  return compareValues(tmp, tmp$ret$1);
}
function TypeModelSimpleAbstract$asString$lambda_0(it) {
  return it.asString();
}
function TypeInstanceAbstract$signature$lambda($context, $currentDepth) {
  return (it) => it.signature($context, $currentDepth + 1 | 0);
}
function TypeInstanceAbstract$toString$lambda(it) {
  return toString(it);
}
var Companion_instance_31;
function Companion_getInstance_33() {
  return Companion_instance_31;
}
function TupleTypeInstanceSimple$toString$lambda(it) {
  return PropertyName__toString_impl_hcnfa7(it.name) + ': ' + it.type.signature(null, 0);
}
function TypeNamespaceAbstract$asString$lambda(a, b) {
  // Inline function 'kotlin.comparisons.compareValuesBy' call
  var tmp = getKClassFromExpression(a.b3()).zc();
  var tmp$ret$1 = getKClassFromExpression(b.b3()).zc();
  return compareValues(tmp, tmp$ret$1);
}
function TypeNamespaceAbstract$asString$lambda_0($this) {
  return (a, b) => {
    var previousCompare = $this.compare(a, b);
    var tmp;
    if (!(previousCompare === 0)) {
      tmp = previousCompare;
    } else {
      // Inline function 'kotlin.comparisons.compareValuesBy' call
      var tmp_0 = _SimpleName___get_value__impl__rl2r3c(a.b3().name);
      var tmp$ret$1 = _SimpleName___get_value__impl__rl2r3c(b.b3().name);
      tmp = compareValues(tmp_0, tmp$ret$1);
    }
    return tmp;
  };
}
function TypeNamespaceAbstract$asString$lambda_1(this$0) {
  return (it) => it.b3().asStringInContext(this$0);
}
function TypeNamespaceAbstract$asString$lambda_2(it) {
  return 'import ' + Import__toString_impl_bbkios(it.p2i_1);
}
var TypeParameterMultiple_instance;
function TypeParameterMultiple_getInstance() {
  if (TypeParameterMultiple_instance === VOID)
    new TypeParameterMultiple_0();
  return TypeParameterMultiple_instance;
}
var Companion_instance_32;
function Companion_getInstance_34() {
  return Companion_instance_32;
}
function UnionTypeSimple$findInOrCloneTo$lambda($$this$run, $other) {
  return (ut) => {
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $$this$run.c3o_1.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      ut.addAlternative(element.findInOrCloneTo($other));
    }
    return Unit_instance;
  };
}
function UnionTypeSimple$asStringInContext$lambda($context) {
  return (it) => it.signature($context, 0);
}
function UnionTypeSimple$asStringInContext$lambda_0($context) {
  return (it) => it.signature($context, 0);
}
function TupleTypeSimple$signature$lambda($context, $currentDepth) {
  return (it) => _PropertyName___get_value__impl__p219lh(it.name) + ':' + it.typeInstance.signature($context, $currentDepth + 1 | 0);
}
function ValueTypeSimple$asStringInContext$lambda($context) {
  return (a, b) => {
    // Inline function 'kotlin.comparisons.compareValuesBy' call
    var tmp = a.signature($context, 0);
    var tmp$ret$1 = b.signature($context, 0);
    return compareValues(tmp, tmp$ret$1);
  };
}
function ValueTypeSimple$asStringInContext$lambda_0($context) {
  return (it) => it.signature($context, 0);
}
function ValueTypeSimple$asStringInContext$lambda$lambda(ch) {
  return ch.asString();
}
function ValueTypeSimple$asStringInContext$lambda$lambda_0(ch) {
  return ch.asString();
}
function ValueTypeSimple$asStringInContext$lambda_1($context) {
  return (it) => {
    var psig = it.typeInstance.signature($context, 0);
    // Inline function 'kotlin.collections.filter' call
    var tmp0 = it.characteristics;
    // Inline function 'kotlin.collections.filterTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (setOf_0([PropertyCharacteristic_COMPOSITE_getInstance(), PropertyCharacteristic_REFERENCE_getInstance()]).e1(element)) {
        destination.r(element);
      }
    }
    var tmp = destination;
    var cmp_ref = joinToString(tmp, ' ', VOID, VOID, VOID, VOID, ValueTypeSimple$asStringInContext$lambda$lambda);
    // Inline function 'kotlin.collections.filter' call
    var tmp0_0 = it.characteristics;
    // Inline function 'kotlin.collections.filterTo' call
    var destination_0 = ArrayList.y();
    var _iterator__ex2g4s_0 = tmp0_0.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      if (setOf_0([PropertyCharacteristic_READ_WRITE_getInstance(), PropertyCharacteristic_READ_ONLY_getInstance()]).e1(element_0)) {
        destination_0.r(element_0);
      }
    }
    var tmp_0 = destination_0;
    var val_var = joinToString(tmp_0, ' ', VOID, VOID, VOID, VOID, ValueTypeSimple$asStringInContext$lambda$lambda_0);
    var chrs = isBlank(cmp_ref) ? val_var : cmp_ref + ' ' + val_var;
    return chrs + ' ' + PropertyName__toString_impl_hcnfa7(it.name) + ':' + psig;
  };
}
function ValueTypeSimple$asStringInContext$lambda$lambda_1(ch) {
  return ch.asString();
}
function ValueTypeSimple$asStringInContext$lambda$lambda_2(ch) {
  return ch.asString();
}
function ValueTypeSimple$asStringInContext$lambda_2($context) {
  return (it) => {
    var psig = it.typeInstance.signature($context, 0);
    // Inline function 'kotlin.collections.filter' call
    var tmp0 = it.characteristics;
    // Inline function 'kotlin.collections.filterTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (setOf_0([PropertyCharacteristic_COMPOSITE_getInstance(), PropertyCharacteristic_REFERENCE_getInstance()]).e1(element)) {
        destination.r(element);
      }
    }
    var tmp = destination;
    var cmp_ref = joinToString(tmp, ' ', VOID, VOID, VOID, VOID, ValueTypeSimple$asStringInContext$lambda$lambda_1);
    // Inline function 'kotlin.collections.filter' call
    var tmp0_0 = it.characteristics;
    // Inline function 'kotlin.collections.filterTo' call
    var destination_0 = ArrayList.y();
    var _iterator__ex2g4s_0 = tmp0_0.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      if (setOf_0([PropertyCharacteristic_READ_WRITE_getInstance(), PropertyCharacteristic_READ_ONLY_getInstance()]).e1(element_0)) {
        destination_0.r(element_0);
      }
    }
    var tmp_0 = destination_0;
    var val_var = joinToString(tmp_0, ' ', VOID, VOID, VOID, VOID, ValueTypeSimple$asStringInContext$lambda$lambda_2);
    var chrs = isBlank(cmp_ref) ? val_var : cmp_ref + ' ' + val_var;
    return chrs + ' ' + PropertyName__toString_impl_hcnfa7(it.name) + ':' + psig;
  };
}
function InterfaceTypeSimple$asStringInContext$lambda(it) {
  return _SimpleName___get_value__impl__rl2r3c(it.name);
}
function InterfaceTypeSimple$asStringInContext$lambda_0($context) {
  return (a, b) => {
    // Inline function 'kotlin.comparisons.compareValuesBy' call
    var tmp = a.signature($context, 0);
    var tmp$ret$1 = b.signature($context, 0);
    return compareValues(tmp, tmp$ret$1);
  };
}
function InterfaceTypeSimple$asStringInContext$lambda_1($context) {
  return (it) => it.signature($context, 0);
}
function InterfaceTypeSimple$asStringInContext$lambda$lambda(ch) {
  return ch.asString();
}
function InterfaceTypeSimple$asStringInContext$lambda$lambda_0(ch) {
  return ch.asString();
}
function InterfaceTypeSimple$asStringInContext$lambda_2($context) {
  return (it) => {
    var psig = it.typeInstance.signature($context, 0);
    // Inline function 'kotlin.collections.filter' call
    var tmp0 = it.characteristics;
    // Inline function 'kotlin.collections.filterTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (setOf_0([PropertyCharacteristic_COMPOSITE_getInstance(), PropertyCharacteristic_REFERENCE_getInstance()]).e1(element)) {
        destination.r(element);
      }
    }
    var tmp = destination;
    var cmp_ref = joinToString(tmp, ' ', VOID, VOID, VOID, VOID, InterfaceTypeSimple$asStringInContext$lambda$lambda);
    // Inline function 'kotlin.collections.filter' call
    var tmp0_0 = it.characteristics;
    // Inline function 'kotlin.collections.filterTo' call
    var destination_0 = ArrayList.y();
    var _iterator__ex2g4s_0 = tmp0_0.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      if (setOf_0([PropertyCharacteristic_READ_WRITE_getInstance(), PropertyCharacteristic_READ_ONLY_getInstance()]).e1(element_0)) {
        destination_0.r(element_0);
      }
    }
    var tmp_0 = destination_0;
    var val_var = joinToString(tmp_0, ' ', VOID, VOID, VOID, VOID, InterfaceTypeSimple$asStringInContext$lambda$lambda_0);
    var chrs = isBlank(cmp_ref) ? val_var : cmp_ref + ' ' + val_var;
    return chrs + ' ' + PropertyName__toString_impl_hcnfa7(it.name) + ':' + psig;
  };
}
function DataTypeSimple$asStringInContext$lambda(it) {
  return _SimpleName___get_value__impl__rl2r3c(it.name);
}
function DataTypeSimple$asStringInContext$lambda_0($context) {
  return (a, b) => {
    // Inline function 'kotlin.comparisons.compareValuesBy' call
    var tmp = a.signature($context, 0);
    var tmp$ret$1 = b.signature($context, 0);
    return compareValues(tmp, tmp$ret$1);
  };
}
function DataTypeSimple$asStringInContext$lambda_1($context) {
  return (it) => it.signature($context, 0);
}
function DataTypeSimple$asStringInContext$lambda$lambda(ch) {
  return ch.asString();
}
function DataTypeSimple$asStringInContext$lambda$lambda_0(ch) {
  return ch.asString();
}
function DataTypeSimple$asStringInContext$lambda_2($context) {
  return (it) => {
    var psig = it.typeInstance.signature($context, 0);
    // Inline function 'kotlin.collections.filter' call
    var tmp0 = it.characteristics;
    // Inline function 'kotlin.collections.filterTo' call
    var destination = ArrayList.y();
    var _iterator__ex2g4s = tmp0.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      if (setOf_0([PropertyCharacteristic_COMPOSITE_getInstance(), PropertyCharacteristic_REFERENCE_getInstance()]).e1(element)) {
        destination.r(element);
      }
    }
    var tmp = destination;
    var cmp_ref = joinToString(tmp, ' ', VOID, VOID, VOID, VOID, DataTypeSimple$asStringInContext$lambda$lambda);
    // Inline function 'kotlin.collections.filter' call
    var tmp0_0 = it.characteristics;
    // Inline function 'kotlin.collections.filterTo' call
    var destination_0 = ArrayList.y();
    var _iterator__ex2g4s_0 = tmp0_0.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      if (setOf_0([PropertyCharacteristic_READ_WRITE_getInstance(), PropertyCharacteristic_READ_ONLY_getInstance()]).e1(element_0)) {
        destination_0.r(element_0);
      }
    }
    var tmp_0 = destination_0;
    var val_var = joinToString(tmp_0, ' ', VOID, VOID, VOID, VOID, DataTypeSimple$asStringInContext$lambda$lambda_0);
    var chrs = isBlank(cmp_ref) ? val_var : cmp_ref + ' ' + val_var;
    return chrs + ' ' + PropertyName__toString_impl_hcnfa7(it.name) + ': ' + psig;
  };
}
function CollectionTypeSimple$asStringInContext$lambda(it) {
  return _SimpleName___get_value__impl__rl2r3c(it.name);
}
function AglTypes$grammarModel$delegate$lambda() {
  return grammarModel('Types', VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda);
}
function AglTypes$grammarModel$delegate$lambda$lambda($this$grammarModel) {
  $this$grammarModel.namespace('net.akehurst.language', AglTypes$grammarModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.grammar('Types', AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda($this$grammar) {
  $this$grammar.extendsGrammar(AglBase_getInstance().defaultTargetGrammar.selfReference);
  var tmp = OverrideKind_REPLACE_getInstance();
  $this$grammar.choice('definition', tmp, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda);
  $this$grammar.concatenation('singletonDefinition', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  $this$grammar.concatenation('primitiveDefinition', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  $this$grammar.concatenation('enumDefinition', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  $this$grammar.concatenation('enumLiterals', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  $this$grammar.concatenation('valueDefinition', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  $this$grammar.concatenation('collectionDefinition', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  $this$grammar.concatenation('dataDefinition', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  $this$grammar.concatenation('interfaceDefinition', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  $this$grammar.concatenation('interfaceBody', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_8);
  $this$grammar.concatenation('unionDefinition', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_9);
  $this$grammar.separatedList('alternatives', 1, -1, VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_10);
  $this$grammar.concatenation('typeParameterList', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_11);
  $this$grammar.concatenation('supertypes', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_12);
  $this$grammar.concatenation('constructor', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_13);
  $this$grammar.concatenation('constructorParameter', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_14);
  $this$grammar.concatenation('property', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_15);
  $this$grammar.concatenation('typeReference', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_16);
  $this$grammar.concatenation('typeArgumentList', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_17);
  $this$grammar.choice('cmp_ref', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_18);
  $this$grammar.choice('val_var', VOID, VOID, VOID, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_19);
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda($this$choice) {
  $this$choice.q2t('singletonDefinition');
  $this$choice.q2t('primitiveDefinition');
  $this$choice.q2t('enumDefinition');
  $this$choice.q2t('valueDefinition');
  $this$choice.q2t('collectionDefinition');
  $this$choice.q2t('dataDefinition');
  $this$choice.q2t('interfaceDefinition');
  $this$choice.q2t('unionDefinition');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$concatenation) {
  $this$concatenation.r2t('singleton');
  $this$concatenation.q2t('IDENTIFIER');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$concatenation) {
  $this$concatenation.r2t('primitive');
  $this$concatenation.q2t('IDENTIFIER');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$concatenation) {
  $this$concatenation.r2t('enum');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.s2t(AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda($this$opt) {
  $this$opt.q2t('enumLiterals');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$concatenation) {
  $this$concatenation.r2t('{');
  $this$concatenation.k2w(1, -1, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0);
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_0($this$spLst) {
  $this$spLst.q2t('IDENTIFIER');
  $this$spLst.r2t(',');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$concatenation) {
  $this$concatenation.r2t('value');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.s2t(AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_1);
  $this$concatenation.r2t('(');
  $this$concatenation.q2t('constructorParameter');
  $this$concatenation.r2t(')');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_1($this$opt) {
  $this$opt.q2t('supertypes');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$concatenation) {
  $this$concatenation.r2t('collection');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.q2t('typeParameterList');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$concatenation) {
  $this$concatenation.r2t('data');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.s2t(AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_2);
  $this$concatenation.s2t(AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_3);
  $this$concatenation.r2t('{');
  $this$concatenation.p2t(0, -1, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_4);
  $this$concatenation.p2t(0, -1, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_5);
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_2($this$opt) {
  $this$opt.q2t('typeParameterList');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_3($this$opt) {
  $this$opt.q2t('supertypes');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_4($this$lst) {
  $this$lst.q2t('constructor');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_5($this$lst) {
  $this$lst.q2t('property');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$concatenation) {
  $this$concatenation.r2t('interface');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.s2t(AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_6);
  $this$concatenation.s2t(AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_7);
  $this$concatenation.s2t(AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_8);
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_6($this$opt) {
  $this$opt.q2t('typeParameterList');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_7($this$opt) {
  $this$opt.q2t('supertypes');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_8($this$opt) {
  $this$opt.q2t('interfaceBody');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_8($this$concatenation) {
  $this$concatenation.r2t('{');
  $this$concatenation.p2t(0, -1, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_9);
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_9($this$lst) {
  $this$lst.q2t('property');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_9($this$concatenation) {
  $this$concatenation.r2t('union');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.r2t('{');
  $this$concatenation.q2t('alternatives');
  $this$concatenation.r2t('}');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_10($this$separatedList) {
  $this$separatedList.q2t('typeReference');
  $this$separatedList.r2t('|');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_11($this$concatenation) {
  $this$concatenation.r2t('<');
  $this$concatenation.k2w(1, -1, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_10);
  $this$concatenation.r2t('>');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_10($this$spLst) {
  $this$spLst.q2t('IDENTIFIER');
  $this$spLst.r2t(',');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_12($this$concatenation) {
  $this$concatenation.r2t(':');
  $this$concatenation.k2w(1, -1, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_11);
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_11($this$spLst) {
  $this$spLst.q2t('typeReference');
  $this$spLst.r2t(',');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_13($this$concatenation) {
  $this$concatenation.r2t('constructor');
  $this$concatenation.r2t('(');
  $this$concatenation.p2t(0, -1, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_12);
  $this$concatenation.r2t(')');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_12($this$lst) {
  $this$lst.q2t('constructorParameter');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_14($this$concatenation) {
  $this$concatenation.s2t(AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_13);
  $this$concatenation.s2t(AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_14);
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.r2t(':');
  $this$concatenation.q2t('typeReference');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_13($this$opt) {
  $this$opt.q2t('cmp_ref');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_14($this$opt) {
  $this$opt.q2t('val_var');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_15($this$concatenation) {
  $this$concatenation.s2t(AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_15);
  $this$concatenation.q2t('val_var');
  $this$concatenation.q2t('IDENTIFIER');
  $this$concatenation.r2t(':');
  $this$concatenation.q2t('typeReference');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_15($this$opt) {
  $this$opt.q2t('cmp_ref');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_16($this$concatenation) {
  $this$concatenation.q2t('possiblyQualifiedName');
  $this$concatenation.s2t(AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_16);
  $this$concatenation.s2t(AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_17);
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_16($this$opt) {
  $this$opt.q2t('typeArgumentList');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_17($this$opt) {
  $this$opt.r2t('?');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_17($this$concatenation) {
  $this$concatenation.r2t('<');
  $this$concatenation.k2w(1, -1, AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_18);
  $this$concatenation.r2t('>');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda$lambda_18($this$spLst) {
  $this$spLst.q2t('typeReference');
  $this$spLst.r2t(',');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_18($this$choice) {
  $this$choice.r2t('cmp');
  $this$choice.r2t('ref');
  return Unit_instance;
}
function AglTypes$grammarModel$delegate$lambda$lambda$lambda$lambda$lambda_19($this$choice) {
  $this$choice.r2t('val');
  $this$choice.r2t('var');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda() {
  var tmp = AglGrammar_getInstance().typesModel.namespace;
  return typeModel('Types', true, tmp, AglTypes$typesModel$delegate$lambda$lambda);
}
function AglTypes$typesModel$delegate$lambda$lambda($this$typeModel) {
  var tmp = listOf_0(['std', 'net.akehurst.language.base.api']);
  $this$typeModel.namespace('net.akehurst.language.typemodel.api', tmp, AglTypes$typesModel$delegate$lambda$lambda$lambda);
  var tmp_0 = listOf_0(['net.akehurst.language.typemodel.api', 'net.akehurst.language.base.api', 'std', 'net.akehurst.language.base.asm']);
  $this$typeModel.namespace('net.akehurst.language.typemodel.asm', tmp_0, AglTypes$typesModel$delegate$lambda$lambda$lambda_0);
  var tmp_1 = listOf_0(['net.akehurst.language.typemodel.api', 'std', 'net.akehurst.language.grammar.api']);
  $this$typeModel.namespace('net.akehurst.language.grammarTypemodel.api', tmp_1, AglTypes$typesModel$delegate$lambda$lambda$lambda_1);
  var tmp_2 = listOf_0(['net.akehurst.language.base.api', 'std', 'net.akehurst.language.typemodel.asm', 'net.akehurst.language.grammarTypemodel.api', 'net.akehurst.language.grammar.api', 'net.akehurst.language.typemodel.api']);
  $this$typeModel.namespace('net.akehurst.language.grammarTypemodel.asm', tmp_2, AglTypes$typesModel$delegate$lambda$lambda$lambda_2);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.enum('PropertyCharacteristic', listOf_0(['REFERENCE', 'COMPOSITE', 'READ_ONLY', 'READ_WRITE', 'STORED', 'DERIVED', 'PRIMITIVE', 'CONSTRUCTOR', 'IDENTITY']));
  $this$namespace.value('PropertyName', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda);
  $this$namespace.value('ParameterName', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_0);
  $this$namespace.value('MethodName', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_1);
  $this$namespace.interface_('ValueType', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_2);
  $this$namespace.interface_('UnionType', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_3);
  $this$namespace.interface_('TypeParameter', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_4);
  $this$namespace.interface_('TypeNamespace', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_5);
  $this$namespace.interface_('TypeModel', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_6);
  $this$namespace.interface_('TypeInstance', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_7);
  $this$namespace.interface_('TypeDefinition', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_8);
  $this$namespace.interface_('TypeArgumentNamed', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_9);
  $this$namespace.interface_('TypeArgument', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_10);
  $this$namespace.interface_('TupleTypeInstance', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_11);
  $this$namespace.interface_('TupleType', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_12);
  $this$namespace.interface_('StructuredType', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_13);
  $this$namespace.interface_('SpecialType', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_14);
  $this$namespace.interface_('SingletonType', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_15);
  $this$namespace.interface_('PropertyDeclarationResolved', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_16);
  $this$namespace.interface_('PropertyDeclaration', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_17);
  $this$namespace.interface_('PrimitiveType', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_18);
  $this$namespace.interface_('ParameterDeclaration', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_19);
  $this$namespace.interface_('MethodDeclarationResolved', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_20);
  $this$namespace.interface_('MethodDeclarationPrimitive', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_21);
  $this$namespace.interface_('MethodDeclarationDerived', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_22);
  $this$namespace.interface_('MethodDeclaration', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_23);
  $this$namespace.interface_('InterfaceType', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_24);
  $this$namespace.interface_('EnumType', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_25);
  $this$namespace.interface_('DataType', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_26);
  $this$namespace.interface_('ConstructorDeclaration', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_27);
  $this$namespace.interface_('CollectionType', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_28);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda($this$value) {
  $this$value.supertype('PublicValueType');
  $this$value.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda);
  $this$value.propertyOf(setOf_0([$this$value.VAL, $this$value.REF, $this$value.STR]), 'value', 'String', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda($this$constructor_) {
  $this$constructor_.parameter('value', 'String', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_0($this$value) {
  $this$value.supertype('PublicValueType');
  $this$value.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_0);
  $this$value.propertyOf(setOf_0([$this$value.VAL, $this$value.REF, $this$value.STR]), 'value', 'String', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_0($this$constructor_) {
  $this$constructor_.parameter('value', 'String', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_1($this$value) {
  $this$value.supertype('PublicValueType');
  $this$value.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_1);
  $this$value.propertyOf(setOf_0([$this$value.VAL, $this$value.REF, $this$value.STR]), 'value', 'String', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_1($this$constructor_) {
  $this$constructor_.parameter('value', 'String', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_2($this$interface_) {
  $this$interface_.supertype('StructuredType');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'constructors', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_2);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_2($this$propertyOf) {
  $this$propertyOf.typeArgument('ConstructorDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_3($this$interface_) {
  $this$interface_.supertype('TypeDefinition');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_4($this$interface_) {
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_5($this$interface_) {
  $this$interface_.supertype('Namespace', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_3);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_3($this$supertype) {
  $this$supertype.ref('TypeDefinition');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_6($this$interface_) {
  $this$interface_.supertype('Model', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_4);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_4($this$supertype) {
  $this$supertype.ref('TypeNamespace');
  $this$supertype.ref('TypeDefinition');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_7($this$interface_) {
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'typeArguments', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_5);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_5($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeArgument');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_8($this$interface_) {
  $this$interface_.supertype('Definition', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_6);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_6($this$supertype) {
  $this$supertype.ref('TypeDefinition');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_9($this$interface_) {
  $this$interface_.supertype('TypeArgument');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_10($this$interface_) {
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_11($this$interface_) {
  $this$interface_.supertype('TypeInstance');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'typeArguments', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_7);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_7($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeArgumentNamed');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_12($this$interface_) {
  $this$interface_.supertype('TypeDefinition');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_13($this$interface_) {
  $this$interface_.supertype('TypeDefinition');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_14($this$interface_) {
  $this$interface_.supertype('TypeDefinition');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_15($this$interface_) {
  $this$interface_.supertype('TypeDefinition');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_16($this$interface_) {
  $this$interface_.supertype('PropertyDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_17($this$interface_) {
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'typeInstance', 'TypeInstance', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_18($this$interface_) {
  $this$interface_.supertype('TypeDefinition');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_19($this$interface_) {
  $this$interface_.propertyOf(setOf_0([$this$interface_.VAL, $this$interface_.CMP, $this$interface_.STR]), 'typeInstance', 'TypeInstance', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_20($this$interface_) {
  $this$interface_.supertype('MethodDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_21($this$interface_) {
  $this$interface_.supertype('MethodDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_22($this$interface_) {
  $this$interface_.supertype('MethodDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_23($this$interface_) {
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'parameters', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_8);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_8($this$propertyOf) {
  $this$propertyOf.typeArgument('ParameterDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_24($this$interface_) {
  $this$interface_.supertype('StructuredType');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_25($this$interface_) {
  $this$interface_.supertype('TypeDefinition');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_26($this$interface_) {
  $this$interface_.supertype('StructuredType');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'constructors', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_9);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_9($this$propertyOf) {
  $this$propertyOf.typeArgument('ConstructorDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_27($this$interface_) {
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'parameters', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_10);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_10($this$propertyOf) {
  $this$propertyOf.typeArgument('ParameterDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_28($this$interface_) {
  $this$interface_.supertype('StructuredType');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda_0($this$namespace) {
  $this$namespace.singleton('TypeParameterMultiple');
  $this$namespace.singleton('StdLibDefault');
  $this$namespace.data('ValueTypeSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_29);
  $this$namespace.data('UnionTypeSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_30);
  $this$namespace.data('TypeParameterSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_31);
  $this$namespace.data('TypeParameterReference', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_32);
  $this$namespace.data('TypeNamespaceSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_33);
  $this$namespace.data('TypeNamespaceAbstract', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_34);
  $this$namespace.data('TypeModelSimpleAbstract', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_35);
  $this$namespace.data('TypeModelSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_36);
  $this$namespace.data('TypeInstanceSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_37);
  $this$namespace.data('TypeInstanceAbstract', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_38);
  $this$namespace.data('TypeDefinitionSimpleAbstract', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_39);
  $this$namespace.data('TypeArgumentSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_40);
  $this$namespace.data('TypeArgumentNamedSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_41);
  $this$namespace.data('TupleTypeSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_42);
  $this$namespace.data('TupleTypeInstanceSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_43);
  $this$namespace.data('StructuredTypeSimpleAbstract', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_44);
  $this$namespace.data('SpecialTypeSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_45);
  $this$namespace.data('SingletonTypeSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_46);
  $this$namespace.data('PropertyDeclarationStored', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_47);
  $this$namespace.data('PropertyDeclarationResolvedSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_48);
  $this$namespace.data('PropertyDeclarationPrimitive', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_49);
  $this$namespace.data('PropertyDeclarationDerived', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_50);
  $this$namespace.data('PropertyDeclarationAbstract', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_51);
  $this$namespace.data('PrimitiveTypeSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_52);
  $this$namespace.data('ParameterDefinitionSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_53);
  $this$namespace.data('MethodDeclarationResolvedSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_54);
  $this$namespace.data('MethodDeclarationDerivedSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_55);
  $this$namespace.data('MethodDeclarationAbstract', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_56);
  $this$namespace.data('InterfaceTypeSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_57);
  $this$namespace.data('EnumTypeSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_58);
  $this$namespace.data('DataTypeSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_59);
  $this$namespace.data('ConstructorDeclarationSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_60);
  $this$namespace.data('CollectionTypeSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_61);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_29($this$data) {
  $this$data.supertype('StructuredTypeSimpleAbstract');
  $this$data.supertype('ValueType');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_11);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'constructors', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_12);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'TypeNamespace', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_11($this$constructor_) {
  $this$constructor_.parameter('namespace', 'TypeNamespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_12($this$propertyOf) {
  $this$propertyOf.typeArgument('ConstructorDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_30($this$data) {
  $this$data.supertype('TypeDefinitionSimpleAbstract');
  $this$data.supertype('UnionType');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_13);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'alternatives', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_14);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'TypeNamespace', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_13($this$constructor_) {
  $this$constructor_.parameter('namespace', 'TypeNamespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_14($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeInstance');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_31($this$data) {
  $this$data.supertype('TypeParameter');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_15);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_15($this$constructor_) {
  $this$constructor_.parameter('name', 'SimpleName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_32($this$data) {
  $this$data.supertype('TypeInstanceAbstract');
  $this$data.supertype('TypeInstance');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_16);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'context', 'TypeDefinition', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'isNullable', 'Boolean', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'resolvedDeclarationOrNull', 'TypeDefinition', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'typeArguments', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_17);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'typeParameterName', 'SimpleName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_16($this$constructor_) {
  $this$constructor_.parameter('context', 'TypeDefinition', false);
  $this$constructor_.parameter('typeParameterName', 'SimpleName', false);
  $this$constructor_.parameter('isNullable', 'Boolean', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_17($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeArgument');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_33($this$data) {
  $this$data.supertype('TypeNamespaceAbstract');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_18);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'qualifiedName', 'QualifiedName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_18($this$constructor_) {
  $this$constructor_.parameter('qualifiedName', 'QualifiedName', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  $this$constructor_.parameter('import', 'List', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_34($this$data) {
  $this$data.supertype('TypeNamespace');
  $this$data.supertype('NamespaceAbstract', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_19);
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_20);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'import', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_21);
  var tmp_0 = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp_0, 'ownedTupleTypes', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_22);
  var tmp_1 = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp_1, 'ownedUnnamedSupertypeType', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_23);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_19($this$supertype) {
  $this$supertype.ref('net.akehurst.language.typemodel.api.TypeDefinition');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_20($this$constructor_) {
  $this$constructor_.parameter('options', 'OptionHolder', false);
  $this$constructor_.parameter('import', 'List', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_21($this$propertyOf) {
  $this$propertyOf.typeArgument('Import');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_22($this$propertyOf) {
  $this$propertyOf.typeArgument('TupleType');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_23($this$propertyOf) {
  $this$propertyOf.typeArgument('UnionType');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_35($this$data) {
  $this$data.supertype('TypeModel');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_24);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'namespace', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_25);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_24($this$constructor_) {
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_25($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeNamespace');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_36($this$data) {
  $this$data.supertype('TypeModelSimpleAbstract');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_26);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'options', 'OptionHolder', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_26($this$constructor_) {
  $this$constructor_.parameter('name', 'SimpleName', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_37($this$data) {
  $this$data.supertype('TypeInstanceAbstract');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_27);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'contextQualifiedTypeName', 'QualifiedName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'isNullable', 'Boolean', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'TypeNamespace', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'qualifiedOrImportedTypeName', 'PossiblyQualifiedName', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'typeArguments', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_28);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_27($this$constructor_) {
  $this$constructor_.parameter('contextQualifiedTypeName', 'QualifiedName', false);
  $this$constructor_.parameter('namespace', 'TypeNamespace', false);
  $this$constructor_.parameter('qualifiedOrImportedTypeName', 'PossiblyQualifiedName', false);
  $this$constructor_.parameter('typeArguments', 'List', false);
  $this$constructor_.parameter('isNullable', 'Boolean', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_28($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeArgument');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_38($this$data) {
  $this$data.supertype('TypeInstance');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_29);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_29($this$constructor_) {
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_39($this$data) {
  $this$data.supertype('TypeDefinition');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_30);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'metaInfo', 'Map', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_31);
  var tmp_0 = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp_0, 'method', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_32);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'options', 'OptionHolder', false);
  var tmp_1 = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp_1, 'propertyByIndex', 'Map', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_33);
  var tmp_2 = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp_2, 'subtypes', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_34);
  var tmp_3 = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp_3, 'supertypes', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_35);
  var tmp_4 = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp_4, 'typeParameters', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_36);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_30($this$constructor_) {
  $this$constructor_.parameter('options', 'OptionHolder', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_31($this$propertyOf) {
  $this$propertyOf.typeArgument('String');
  $this$propertyOf.typeArgument('String');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_32($this$propertyOf) {
  $this$propertyOf.typeArgument('MethodDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_33($this$propertyOf) {
  $this$propertyOf.typeArgument('Integer');
  $this$propertyOf.typeArgument('PropertyDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_34($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeInstance');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_35($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeInstance');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_36($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeParameter');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_40($this$data) {
  $this$data.supertype('TypeArgument');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_37);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'type', 'TypeInstance', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_37($this$constructor_) {
  $this$constructor_.parameter('type', 'TypeInstance', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_41($this$data) {
  $this$data.supertype('TypeArgumentNamed');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_38);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'PropertyName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'type', 'TypeInstance', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_38($this$constructor_) {
  $this$constructor_.parameter('name', 'PropertyName', false);
  $this$constructor_.parameter('type', 'TypeInstance', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_42($this$data) {
  $this$data.supertype('TypeDefinitionSimpleAbstract');
  $this$data.supertype('TupleType');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_39);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'TypeNamespace', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'typeParameters', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_40);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_39($this$constructor_) {
  $this$constructor_.parameter('namespace', 'TypeNamespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_40($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeParameterMultiple');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_43($this$data) {
  $this$data.supertype('TypeInstanceAbstract');
  $this$data.supertype('TupleTypeInstance');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_41);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'isNullable', 'Boolean', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'TypeNamespace', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'resolvedDeclaration', 'TypeDefinition', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'typeArguments', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_42);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_41($this$constructor_) {
  $this$constructor_.parameter('namespace', 'TypeNamespace', false);
  $this$constructor_.parameter('typeArguments', 'List', false);
  $this$constructor_.parameter('isNullable', 'Boolean', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_42($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeArgumentNamed');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_44($this$data) {
  $this$data.supertype('TypeDefinitionSimpleAbstract');
  $this$data.supertype('StructuredType');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_43);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_43($this$constructor_) {
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_45($this$data) {
  $this$data.supertype('TypeDefinitionSimpleAbstract');
  $this$data.supertype('SpecialType');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_44);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'TypeNamespace', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_44($this$constructor_) {
  $this$constructor_.parameter('namespace', 'TypeNamespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_46($this$data) {
  $this$data.supertype('TypeDefinitionSimpleAbstract');
  $this$data.supertype('SingletonType');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_45);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'TypeNamespace', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_45($this$constructor_) {
  $this$constructor_.parameter('namespace', 'TypeNamespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_47($this$data) {
  $this$data.supertype('PropertyDeclarationAbstract');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_46);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'characteristics', 'Set', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_47);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'description', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'index', 'Integer', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'PropertyName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'owner', 'StructuredType', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'typeInstance', 'TypeInstance', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_46($this$constructor_) {
  $this$constructor_.parameter('owner', 'StructuredType', false);
  $this$constructor_.parameter('name', 'PropertyName', false);
  $this$constructor_.parameter('typeInstance', 'TypeInstance', false);
  $this$constructor_.parameter('characteristics', 'Set', false);
  $this$constructor_.parameter('index', 'Integer', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_47($this$propertyOf) {
  $this$propertyOf.typeArgument('PropertyCharacteristic');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_48($this$data) {
  $this$data.supertype('PropertyDeclarationAbstract');
  $this$data.supertype('PropertyDeclarationResolved');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_48);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'characteristics', 'Set', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_49);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'description', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'PropertyName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'original', 'PropertyDeclaration', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'owner', 'TypeDefinition', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'typeInstance', 'TypeInstance', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_48($this$constructor_) {
  $this$constructor_.parameter('original', 'PropertyDeclaration', false);
  $this$constructor_.parameter('owner', 'TypeDefinition', false);
  $this$constructor_.parameter('name', 'PropertyName', false);
  $this$constructor_.parameter('typeInstance', 'TypeInstance', false);
  $this$constructor_.parameter('characteristics', 'Set', false);
  $this$constructor_.parameter('description', 'String', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_49($this$propertyOf) {
  $this$propertyOf.typeArgument('PropertyCharacteristic');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_49($this$data) {
  $this$data.supertype('PropertyDeclarationAbstract');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_50);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'description', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'index', 'Integer', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'PropertyName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'owner', 'TypeDefinition', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'typeInstance', 'TypeInstance', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_50($this$constructor_) {
  $this$constructor_.parameter('owner', 'TypeDefinition', false);
  $this$constructor_.parameter('name', 'PropertyName', false);
  $this$constructor_.parameter('typeInstance', 'TypeInstance', false);
  $this$constructor_.parameter('description', 'String', false);
  $this$constructor_.parameter('index', 'Integer', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_50($this$data) {
  $this$data.supertype('PropertyDeclarationAbstract');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_51);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'description', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'expression', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'index', 'Integer', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'PropertyName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'owner', 'TypeDefinition', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'typeInstance', 'TypeInstance', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_51($this$constructor_) {
  $this$constructor_.parameter('owner', 'TypeDefinition', false);
  $this$constructor_.parameter('name', 'PropertyName', false);
  $this$constructor_.parameter('typeInstance', 'TypeInstance', false);
  $this$constructor_.parameter('description', 'String', false);
  $this$constructor_.parameter('expression', 'String', false);
  $this$constructor_.parameter('index', 'Integer', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_51($this$data) {
  $this$data.supertype('PropertyDeclaration');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_52);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'metaInfo', 'Map', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_53);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_52($this$constructor_) {
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_53($this$propertyOf) {
  $this$propertyOf.typeArgument('String');
  $this$propertyOf.typeArgument('String');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_52($this$data) {
  $this$data.supertype('TypeDefinitionSimpleAbstract');
  $this$data.supertype('PrimitiveType');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_54);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'TypeNamespace', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_54($this$constructor_) {
  $this$constructor_.parameter('namespace', 'TypeNamespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_53($this$data) {
  $this$data.supertype('ParameterDeclaration');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_55);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'defaultValue', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'ParameterName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'typeInstance', 'TypeInstance', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_55($this$constructor_) {
  $this$constructor_.parameter('name', 'ParameterName', false);
  $this$constructor_.parameter('typeInstance', 'TypeInstance', false);
  $this$constructor_.parameter('defaultValue', 'String', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_54($this$data) {
  $this$data.supertype('MethodDeclarationAbstract');
  $this$data.supertype('MethodDeclarationResolved');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_56);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'description', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'MethodName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'original', 'MethodDeclaration', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'owner', 'TypeDefinition', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'parameters', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_57);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'returnType', 'TypeInstance', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_56($this$constructor_) {
  $this$constructor_.parameter('original', 'MethodDeclaration', false);
  $this$constructor_.parameter('owner', 'TypeDefinition', false);
  $this$constructor_.parameter('name', 'MethodName', false);
  $this$constructor_.parameter('parameters', 'List', false);
  $this$constructor_.parameter('returnType', 'TypeInstance', false);
  $this$constructor_.parameter('description', 'String', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_57($this$propertyOf) {
  $this$propertyOf.typeArgument('ParameterDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_55($this$data) {
  $this$data.supertype('MethodDeclarationAbstract');
  $this$data.supertype('MethodDeclarationDerived');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_58);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'body', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'description', 'String', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'MethodName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'owner', 'TypeDefinition', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'parameters', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_59);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'returnType', 'TypeInstance', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_58($this$constructor_) {
  $this$constructor_.parameter('owner', 'TypeDefinition', false);
  $this$constructor_.parameter('name', 'MethodName', false);
  $this$constructor_.parameter('parameters', 'List', false);
  $this$constructor_.parameter('returnType', 'TypeInstance', false);
  $this$constructor_.parameter('description', 'String', false);
  $this$constructor_.parameter('body', 'String', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_59($this$propertyOf) {
  $this$propertyOf.typeArgument('ParameterDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_56($this$data) {
  $this$data.supertype('MethodDeclaration');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_60);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_60($this$constructor_) {
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_57($this$data) {
  $this$data.supertype('StructuredTypeSimpleAbstract');
  $this$data.supertype('InterfaceType');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_61);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'TypeNamespace', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'subtypes', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_62);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_61($this$constructor_) {
  $this$constructor_.parameter('namespace', 'TypeNamespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_62($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeInstance');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_58($this$data) {
  $this$data.supertype('TypeDefinitionSimpleAbstract');
  $this$data.supertype('EnumType');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_63);
  var tmp = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp, 'literals', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_64);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'TypeNamespace', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_63($this$constructor_) {
  $this$constructor_.parameter('namespace', 'TypeNamespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  $this$constructor_.parameter('literals', 'List', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_64($this$propertyOf) {
  $this$propertyOf.typeArgument('String');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_59($this$data) {
  $this$data.supertype('StructuredTypeSimpleAbstract');
  $this$data.supertype('DataType');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_65);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'constructors', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_66);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'TypeNamespace', false);
  var tmp_0 = setOf_0([$this$data.VAR, $this$data.REF, $this$data.STR]);
  $this$data.propertyOf(tmp_0, 'subtypes', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_67);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_65($this$constructor_) {
  $this$constructor_.parameter('namespace', 'TypeNamespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_66($this$propertyOf) {
  $this$propertyOf.typeArgument('ConstructorDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_67($this$propertyOf) {
  $this$propertyOf.typeArgument('TypeInstance');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_60($this$data) {
  $this$data.supertype('ConstructorDeclaration');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_68);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'owner', 'TypeDefinition', false);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'parameters', 'List', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_69);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_68($this$constructor_) {
  $this$constructor_.parameter('owner', 'TypeDefinition', false);
  $this$constructor_.parameter('parameters', 'List', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_69($this$propertyOf) {
  $this$propertyOf.typeArgument('ParameterDeclaration');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_61($this$data) {
  $this$data.supertype('StructuredTypeSimpleAbstract');
  $this$data.supertype('CollectionType');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_70);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'name', 'SimpleName', false);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.REF, $this$data.STR]), 'namespace', 'TypeNamespace', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_70($this$constructor_) {
  $this$constructor_.parameter('namespace', 'TypeNamespace', false);
  $this$constructor_.parameter('name', 'SimpleName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda_1($this$namespace) {
  $this$namespace.interface_('GrammarTypeNamespace', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_62);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_62($this$interface_) {
  $this$interface_.supertype('TypeNamespace');
  var tmp = setOf_0([$this$interface_.VAR, $this$interface_.CMP, $this$interface_.STR]);
  $this$interface_.propertyOf(tmp, 'allRuleNameToType', 'Map', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_71);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_71($this$propertyOf) {
  $this$propertyOf.typeArgument('GrammarRuleName');
  $this$propertyOf.typeArgument('TypeInstance');
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda_2($this$namespace) {
  $this$namespace.data('GrammarTypeNamespaceSimple', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_63);
  $this$namespace.data('GrammarTypeNamespaceAbstract', AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_64);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_63($this$data) {
  $this$data.supertype('GrammarTypeNamespaceAbstract');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_72);
  $this$data.propertyOf(setOf_0([$this$data.VAL, $this$data.CMP, $this$data.STR]), 'qualifiedName', 'QualifiedName', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_72($this$constructor_) {
  $this$constructor_.parameter('qualifiedName', 'QualifiedName', false);
  $this$constructor_.parameter('options', 'OptionHolder', false);
  $this$constructor_.parameter('import', 'List', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda_64($this$data) {
  $this$data.supertype('TypeNamespaceAbstract');
  $this$data.supertype('GrammarTypeNamespace');
  $this$data.constructor_(AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_73);
  var tmp = setOf_0([$this$data.VAR, $this$data.CMP, $this$data.STR]);
  $this$data.propertyOf(tmp, 'allRuleNameToType', 'Map', false, AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_74);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_73($this$constructor_) {
  $this$constructor_.parameter('options', 'OptionHolder', false);
  $this$constructor_.parameter('import', 'List', false);
  return Unit_instance;
}
function AglTypes$typesModel$delegate$lambda$lambda$lambda$lambda$lambda_74($this$propertyOf) {
  $this$propertyOf.typeArgument('GrammarRuleName');
  $this$propertyOf.typeArgument('TypeInstance');
  return Unit_instance;
}
function AglTypes$asmTransformModel$delegate$lambda() {
  var tmp = AglTypes_getInstance().typesModel;
  return asmTransform('Types', tmp, false, AglTypes$asmTransformModel$delegate$lambda$lambda);
}
function AglTypes$asmTransformModel$delegate$lambda$lambda($this$asmTransform) {
  $this$asmTransform.namespace('net.akehurst.language', AglTypes$asmTransformModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglTypes$asmTransformModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.transform('Types', AglTypes$asmTransformModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglTypes$asmTransformModel$delegate$lambda$lambda$lambda$lambda($this$transform) {
  return Unit_instance;
}
function AglTypes$crossReferenceModel$delegate$lambda() {
  return crossReferenceModel('Types', AglTypes$crossReferenceModel$delegate$lambda$lambda);
}
function AglTypes$crossReferenceModel$delegate$lambda$lambda($this$crossReferenceModel) {
  return Unit_instance;
}
function AglTypes$styleModel$delegate$lambda() {
  return styleModel('Types', AglTypes$styleModel$delegate$lambda$lambda);
}
function AglTypes$styleModel$delegate$lambda$lambda($this$styleModel) {
  $this$styleModel.namespace('net.akehurst.language', AglTypes$styleModel$delegate$lambda$lambda$lambda);
  return Unit_instance;
}
function AglTypes$styleModel$delegate$lambda$lambda$lambda($this$namespace) {
  $this$namespace.styles('Types', AglTypes$styleModel$delegate$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglTypes$styleModel$delegate$lambda$lambda$lambda$lambda($this$styles) {
  $this$styles.metaRule("'[^']+'", AglTypes$styleModel$delegate$lambda$lambda$lambda$lambda$lambda);
  return Unit_instance;
}
function AglTypes$styleModel$delegate$lambda$lambda$lambda$lambda$lambda($this$metaRule) {
  $this$metaRule.declaration('foreground', 'darkgreen');
  $this$metaRule.declaration('font-weight', 'bold');
  return Unit_instance;
}
function AglTypes$formatModel$delegate$lambda() {
  return formatModel('Types', AglTypes$formatModel$delegate$lambda$lambda);
}
function AglTypes$formatModel$delegate$lambda$lambda($this$formatModel) {
  return Unit_instance;
}
function AglTypes$defaultTargetGrammar$delegate$lambda() {
  return ensureNotNull(AglTypes_getInstance().grammarModel.findDefinitionByQualifiedNameOrNull(_QualifiedName___init__impl__8ed982('net.akehurst.language.Types')));
}
function AglTypes$syntaxAnalyser$delegate$lambda() {
  return new TypesSyntaxAnalyser();
}
function AglTypes$semanticAnalyser$delegate$lambda() {
  return new TypemodelSemanticAnalyser();
}
function AglTypes$completionProvider$delegate$lambda() {
  return new TypemodelCompletionProvider();
}
var AglTypes_instance;
function AglTypes_getInstance() {
  if (AglTypes_instance === VOID)
    new AglTypes_0();
  return AglTypes_instance;
}
function grammarModel$factory_6() {
  return getPropertyCallableRef('grammarModel', 1, KProperty1, (receiver) => receiver.grammarModel, null);
}
function typesModel$factory_4() {
  return getPropertyCallableRef('typesModel', 1, KProperty1, (receiver) => receiver.typesModel, null);
}
function asmTransformModel$factory_4() {
  return getPropertyCallableRef('asmTransformModel', 1, KProperty1, (receiver) => receiver.asmTransformModel, null);
}
function crossReferenceModel$factory_5() {
  return getPropertyCallableRef('crossReferenceModel', 1, KProperty1, (receiver) => receiver.crossReferenceModel, null);
}
function styleModel$factory_4() {
  return getPropertyCallableRef('styleModel', 1, KProperty1, (receiver) => receiver.styleModel, null);
}
function formatModel$factory_5() {
  return getPropertyCallableRef('formatModel', 1, KProperty1, (receiver) => receiver.formatModel, null);
}
function defaultTargetGrammar$factory_4() {
  return getPropertyCallableRef('defaultTargetGrammar', 1, KProperty1, (receiver) => receiver.defaultTargetGrammar, null);
}
function syntaxAnalyser$factory_5() {
  return getPropertyCallableRef('syntaxAnalyser', 1, KProperty1, (receiver) => receiver.syntaxAnalyser, null);
}
function semanticAnalyser$factory_5() {
  return getPropertyCallableRef('semanticAnalyser', 1, KProperty1, (receiver) => receiver.semanticAnalyser, null);
}
function completionProvider$factory_5() {
  return getPropertyCallableRef('completionProvider', 1, KProperty1, (receiver) => receiver.completionProvider, null);
}
function _get_includeStd__qn8wa8($this, _this__u8e3s4) {
  return _this__u8e3s4.get('include-std') === 'true';
}
var Companion_instance_33;
function Companion_getInstance_35() {
  return Companion_instance_33;
}
function unit_3($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var options = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var namespaces = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var name = _SimpleName___init__impl__6s45d0('ParsedTypesUnit');
  // Inline function 'kotlin.collections.associate' call
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(options, 10)), 16);
  // Inline function 'kotlin.collections.associateTo' call
  var destination = LinkedHashMap.kb(capacity);
  var _iterator__ex2g4s = options.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.plusAssign' call
    destination.r2(element.zg_1, element.ah_1);
  }
  var optHolder = new OptionHolderDefault(null, destination);
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s_0 = namespaces.s();
  while (_iterator__ex2g4s_0.t()) {
    var element_0 = _iterator__ex2g4s_0.u();
    var tmp_1 = element_0.options;
    (tmp_1 instanceof OptionHolderDefault ? tmp_1 : THROW_CCE()).g2s_1 = optHolder;
  }
  // Inline function 'kotlin.also' call
  var this_0 = new TypeModelSimple(name, optHolder);
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s_1 = namespaces.s();
  while (_iterator__ex2g4s_1.t()) {
    var element_1 = _iterator__ex2g4s_1.u();
    this_0.addNamespace(element_1);
  }
  return this_0;
}
function namespace_3($this, target, children, sentence) {
  var tmp = children.z(1);
  var pqn = (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(2);
  var options = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(3);
  var imports = (!(tmp_1 == null) ? isInterface(tmp_1, KtList) : false) ? tmp_1 : THROW_CCE();
  var tmp_2 = children.z(4);
  var defs = (!(tmp_2 == null) ? isInterface(tmp_2, KtList) : false) ? tmp_2 : THROW_CCE();
  // Inline function 'kotlin.collections.associate' call
  var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(options, 10)), 16);
  // Inline function 'kotlin.collections.associateTo' call
  var destination = LinkedHashMap.kb(capacity);
  var _iterator__ex2g4s = options.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    // Inline function 'kotlin.collections.plusAssign' call
    destination.r2(element.zg_1, element.ah_1);
  }
  var optHolder = new OptionHolderDefault(null, destination);
  var nsName = pqn.asQualifiedName(null);
  var namespace = new TypeNamespaceSimple(nsName, optHolder, imports);
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s_0 = defs.s();
  while (_iterator__ex2g4s_0.t()) {
    var element_0 = _iterator__ex2g4s_0.u();
    element_0(namespace);
  }
  return namespace;
}
function definition_0($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  return (!(tmp == null) ? typeof tmp === 'function' : false) ? tmp : THROW_CCE();
}
function singletonDefinition($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var name = _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
  return TypesSyntaxAnalyser$singletonDefinition$lambda(name, $this, nodeInfo, sentence);
}
function primitiveDefinition($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var name = _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
  return TypesSyntaxAnalyser$primitiveDefinition$lambda(name, $this, nodeInfo, sentence);
}
function enumDefinition($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var name = _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
  var tmp_0 = children.z(2);
  var tmp0_elvis_lhs = (tmp_0 == null ? true : isInterface(tmp_0, KtList)) ? tmp_0 : THROW_CCE();
  var literals = tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs;
  return TypesSyntaxAnalyser$enumDefinition$lambda(name, literals, $this, nodeInfo, sentence);
}
function enumLiterals($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var list = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  return ListSeparatedArrayList.gk(list).ck();
}
function valueDefinition($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var name = _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
  var tmp_0 = children.z(2);
  var tmp0_elvis_lhs = (tmp_0 == null ? true : isInterface(tmp_0, KtList)) ? tmp_0 : THROW_CCE();
  var supertypes = tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs;
  var tmp_1 = children.z(4);
  var cParam = (!(tmp_1 == null) ? typeof tmp_1 === 'function' : false) ? tmp_1 : THROW_CCE();
  return TypesSyntaxAnalyser$valueDefinition$lambda(name, $this, nodeInfo, sentence, supertypes, cParam);
}
function collectionDefinition($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var name = _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
  var tmp_0 = children.z(2);
  // Inline function 'kotlin.collections.map' call
  var this_0 = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
  var _iterator__ex2g4s = this_0.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var tmp$ret$0 = new TypeParameterSimple(_SimpleName___init__impl__6s45d0(item));
    destination.r(tmp$ret$0);
  }
  var tParams = destination;
  return TypesSyntaxAnalyser$collectionDefinition$lambda(name, tParams, $this, nodeInfo, sentence);
}
function unionDefinition($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var name = _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
  var tmp_0 = children.z(3);
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var this_0 = (!(tmp_0 == null) ? isInterface(tmp_0, KtList) : false) ? tmp_0 : THROW_CCE();
  var alternatives = ListSeparatedArrayList.gk(this_0).ck();
  return TypesSyntaxAnalyser$unionDefinition$lambda(name, alternatives, $this, nodeInfo, sentence);
}
function interfaceDefinition($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var name = _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
  var tmp_0 = children.z(2);
  var tmp0_elvis_lhs = (tmp_0 == null ? true : isInterface(tmp_0, KtList)) ? tmp_0 : THROW_CCE();
  var tParams = tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs;
  var tmp_1 = children.z(3);
  var tmp1_elvis_lhs = (tmp_1 == null ? true : isInterface(tmp_1, KtList)) ? tmp_1 : THROW_CCE();
  var supertypes = tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs;
  var tmp_2 = children.z(4);
  var tmp2_elvis_lhs = (tmp_2 == null ? true : isInterface(tmp_2, KtList)) ? tmp_2 : THROW_CCE();
  var property = tmp2_elvis_lhs == null ? emptyList() : tmp2_elvis_lhs;
  return TypesSyntaxAnalyser$interfaceDefinition$lambda(name, tParams, supertypes, property, $this, nodeInfo, sentence);
}
function interfaceBody($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  return (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
}
function dataDefinition($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  var name = _SimpleName___init__impl__6s45d0((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
  var tmp_0 = children.z(2);
  var tmp0_elvis_lhs = (tmp_0 == null ? true : isInterface(tmp_0, KtList)) ? tmp_0 : THROW_CCE();
  var tParams = tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs;
  var tmp_1 = children.z(3);
  var tmp1_elvis_lhs = (tmp_1 == null ? true : isInterface(tmp_1, KtList)) ? tmp_1 : THROW_CCE();
  var supertypes = tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs;
  var tmp_2 = children.z(5);
  var constructors = (!(tmp_2 == null) ? isInterface(tmp_2, KtList) : false) ? tmp_2 : THROW_CCE();
  var tmp_3 = children.z(6);
  var property = (!(tmp_3 == null) ? isInterface(tmp_3, KtList) : false) ? tmp_3 : THROW_CCE();
  return TypesSyntaxAnalyser$dataDefinition$lambda(name, tParams, supertypes, $this, constructors, property, nodeInfo, sentence);
}
function typeParameterList($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var this_0 = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  return ListSeparatedArrayList.gk(this_0).ck();
}
function setResolvers($this, ti, dt) {
  // Inline function 'kotlin.collections.forEach' call
  var _iterator__ex2g4s = ti.typeArguments.s();
  while (_iterator__ex2g4s.t()) {
    var element = _iterator__ex2g4s.u();
    setResolvers($this, element.type, dt);
  }
}
function supertypes($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var this_0 = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  return ListSeparatedArrayList.gk(this_0).ck();
}
function constructor($this, nodeInfo, children, sentence) {
  var tmp = children.z(2);
  return (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
}
function constructorParameter($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var cmpRef = (tmp == null ? true : tmp instanceof PropertyCharacteristic) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var valVar = (tmp_0 == null ? true : tmp_0 instanceof PropertyCharacteristic) ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(2);
  var name = _ParameterName___init__impl__84hwrp((!(tmp_1 == null) ? typeof tmp_1 === 'string' : false) ? tmp_1 : THROW_CCE());
  var tmp_2 = children.z(4);
  var typeRef = tmp_2 instanceof TypeRefInfo ? tmp_2 : THROW_CCE();
  var tmp_3;
  if (cmpRef == null) {
    tmp_3 = null;
  } else {
    // Inline function 'kotlin.let' call
    tmp_3 = setOf(cmpRef);
  }
  var tmp1_elvis_lhs = tmp_3;
  var tmp_4 = tmp1_elvis_lhs == null ? emptySet() : tmp1_elvis_lhs;
  var tmp_5;
  if (valVar == null) {
    tmp_5 = null;
  } else {
    // Inline function 'kotlin.let' call
    tmp_5 = setOf(valVar);
  }
  var tmp3_elvis_lhs = tmp_5;
  var characteristics = plus_2(tmp_4, tmp3_elvis_lhs == null ? emptySet() : tmp3_elvis_lhs);
  return TypesSyntaxAnalyser$constructorParameter$lambda(typeRef, characteristics, name, $this, nodeInfo, sentence);
}
function property($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var cmpRef = (tmp == null ? true : tmp instanceof PropertyCharacteristic) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var valVar = tmp_0 instanceof PropertyCharacteristic ? tmp_0 : THROW_CCE();
  var tmp_1 = children.z(2);
  var name = _PropertyName___init__impl__sz2wu9((!(tmp_1 == null) ? typeof tmp_1 === 'string' : false) ? tmp_1 : THROW_CCE());
  var tmp_2 = children.z(4);
  var typeRef = tmp_2 instanceof TypeRefInfo ? tmp_2 : THROW_CCE();
  var tmp_3;
  if (cmpRef == null) {
    tmp_3 = null;
  } else {
    // Inline function 'kotlin.let' call
    tmp_3 = setOf(cmpRef);
  }
  var tmp1_elvis_lhs = tmp_3;
  var characteristics = plus_2(tmp1_elvis_lhs == null ? emptySet() : tmp1_elvis_lhs, setOf(valVar));
  return TypesSyntaxAnalyser$property$lambda(typeRef, name, characteristics, $this, nodeInfo, sentence);
}
function cmp_ref($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var tmp_0;
  switch ((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE()) {
    case 'cmp':
      tmp_0 = PropertyCharacteristic_COMPOSITE_getInstance();
      break;
    case 'ref':
      tmp_0 = PropertyCharacteristic_REFERENCE_getInstance();
      break;
    default:
      var message = "Value not allowed '" + toString_0(children.z(0)) + "'";
      throw IllegalStateException.v4(toString(message));
  }
  return tmp_0;
}
function val_var($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var tmp_0;
  switch ((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE()) {
    case 'val':
      tmp_0 = PropertyCharacteristic_READ_ONLY_getInstance();
      break;
    case 'var':
      tmp_0 = PropertyCharacteristic_READ_WRITE_getInstance();
      break;
    default:
      var message = "Value not allowed '" + toString_0(children.z(0)) + "'";
      throw IllegalStateException.v4(toString(message));
  }
  return tmp_0;
}
function typeReference_0($this, nodeInfo, children, sentence) {
  var tmp = children.z(0);
  var pqn = (!(tmp == null) ? isInterface(tmp, PossiblyQualifiedName_0) : false) ? tmp : THROW_CCE();
  var tmp_0 = children.z(1);
  var tmp0_elvis_lhs = (tmp_0 == null ? true : isInterface(tmp_0, KtList)) ? tmp_0 : THROW_CCE();
  var typeArgumentList = tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs;
  var tmp_1 = children.z(2);
  var isNullable = !(((tmp_1 == null ? true : typeof tmp_1 === 'string') ? tmp_1 : THROW_CCE()) == null);
  var tr = new TypeRefInfo(pqn, typeArgumentList, isNullable);
  return tr;
}
function typeArgumentList_0($this, nodeInfo, children, sentence) {
  var tmp = children.z(1);
  // Inline function 'net.akehurst.language.collections.toSeparatedList' call
  var this_0 = (!(tmp == null) ? isInterface(tmp, KtList) : false) ? tmp : THROW_CCE();
  var list = ListSeparatedArrayList.gk(this_0).ck();
  return list;
}
function createTypeInstance_0($this, ns, contextType, tInfo) {
  // Inline function 'kotlin.collections.map' call
  var this_0 = tInfo.l3s_1;
  // Inline function 'kotlin.collections.mapTo' call
  var destination = ArrayList.w(collectionSizeOrDefault(this_0, 10));
  var _iterator__ex2g4s = this_0.s();
  while (_iterator__ex2g4s.t()) {
    var item = _iterator__ex2g4s.u();
    var tmp$ret$0 = createTypeInstance_0($this, ns, contextType, item).asTypeArgument;
    destination.r(tmp$ret$0);
  }
  var targs = destination;
  var ti = ns.createTypeInstance(contextType.qualifiedName, tInfo.k3s_1, targs, false);
  return ti;
}
function TypesSyntaxAnalyser$unit$ref($boundThis) {
  var l = (p0, p1, p2) => unit_3($boundThis, p0, p1, p2);
  l.callableName = 'unit';
  return l;
}
function TypesSyntaxAnalyser$namespace$ref($boundThis) {
  var l = (p0, p1, p2) => namespace_3($boundThis, p0, p1, p2);
  l.callableName = 'namespace';
  return l;
}
function TypesSyntaxAnalyser$definition$ref($boundThis) {
  var l = (p0, p1, p2) => definition_0($boundThis, p0, p1, p2);
  l.callableName = 'definition';
  return l;
}
function TypesSyntaxAnalyser$singletonDefinition$ref($boundThis) {
  var l = (p0, p1, p2) => singletonDefinition($boundThis, p0, p1, p2);
  l.callableName = 'singletonDefinition';
  return l;
}
function TypesSyntaxAnalyser$primitiveDefinition$ref($boundThis) {
  var l = (p0, p1, p2) => primitiveDefinition($boundThis, p0, p1, p2);
  l.callableName = 'primitiveDefinition';
  return l;
}
function TypesSyntaxAnalyser$enumDefinition$ref($boundThis) {
  var l = (p0, p1, p2) => enumDefinition($boundThis, p0, p1, p2);
  l.callableName = 'enumDefinition';
  return l;
}
function TypesSyntaxAnalyser$enumLiterals$ref($boundThis) {
  var l = (p0, p1, p2) => enumLiterals($boundThis, p0, p1, p2);
  l.callableName = 'enumLiterals';
  return l;
}
function TypesSyntaxAnalyser$valueDefinition$ref($boundThis) {
  var l = (p0, p1, p2) => valueDefinition($boundThis, p0, p1, p2);
  l.callableName = 'valueDefinition';
  return l;
}
function TypesSyntaxAnalyser$collectionDefinition$ref($boundThis) {
  var l = (p0, p1, p2) => collectionDefinition($boundThis, p0, p1, p2);
  l.callableName = 'collectionDefinition';
  return l;
}
function TypesSyntaxAnalyser$unionDefinition$ref($boundThis) {
  var l = (p0, p1, p2) => unionDefinition($boundThis, p0, p1, p2);
  l.callableName = 'unionDefinition';
  return l;
}
function TypesSyntaxAnalyser$interfaceDefinition$ref($boundThis) {
  var l = (p0, p1, p2) => interfaceDefinition($boundThis, p0, p1, p2);
  l.callableName = 'interfaceDefinition';
  return l;
}
function TypesSyntaxAnalyser$interfaceBody$ref($boundThis) {
  var l = (p0, p1, p2) => interfaceBody($boundThis, p0, p1, p2);
  l.callableName = 'interfaceBody';
  return l;
}
function TypesSyntaxAnalyser$dataDefinition$ref($boundThis) {
  var l = (p0, p1, p2) => dataDefinition($boundThis, p0, p1, p2);
  l.callableName = 'dataDefinition';
  return l;
}
function TypesSyntaxAnalyser$typeParameterList$ref($boundThis) {
  var l = (p0, p1, p2) => typeParameterList($boundThis, p0, p1, p2);
  l.callableName = 'typeParameterList';
  return l;
}
function TypesSyntaxAnalyser$supertypes$ref($boundThis) {
  var l = (p0, p1, p2) => supertypes($boundThis, p0, p1, p2);
  l.callableName = 'supertypes';
  return l;
}
function TypesSyntaxAnalyser$constructor$ref($boundThis) {
  var l = (p0, p1, p2) => constructor($boundThis, p0, p1, p2);
  l.callableName = 'constructor';
  return l;
}
function TypesSyntaxAnalyser$constructorParameter$ref($boundThis) {
  var l = (p0, p1, p2) => constructorParameter($boundThis, p0, p1, p2);
  l.callableName = 'constructorParameter';
  return l;
}
function TypesSyntaxAnalyser$property$ref($boundThis) {
  var l = (p0, p1, p2) => property($boundThis, p0, p1, p2);
  l.callableName = 'property';
  return l;
}
function TypesSyntaxAnalyser$cmp_ref$ref($boundThis) {
  var l = (p0, p1, p2) => cmp_ref($boundThis, p0, p1, p2);
  l.callableName = 'cmp_ref';
  return l;
}
function TypesSyntaxAnalyser$val_var$ref($boundThis) {
  var l = (p0, p1, p2) => val_var($boundThis, p0, p1, p2);
  l.callableName = 'val_var';
  return l;
}
function TypesSyntaxAnalyser$typeReference$ref($boundThis) {
  var l = (p0, p1, p2) => typeReference_0($boundThis, p0, p1, p2);
  l.callableName = 'typeReference';
  return l;
}
function TypesSyntaxAnalyser$typeArgumentList$ref($boundThis) {
  var l = (p0, p1, p2) => typeArgumentList_0($boundThis, p0, p1, p2);
  l.callableName = 'typeArgumentList';
  return l;
}
function TypesSyntaxAnalyser$singletonDefinition$lambda($name, this$0, $nodeInfo, $sentence) {
  return (namespace) => {
    // Inline function 'kotlin.also' call
    var this_0 = new SingletonTypeSimple(namespace, $name);
    this$0.setLocationFor(this_0, $nodeInfo, $sentence);
    return this_0;
  };
}
function TypesSyntaxAnalyser$primitiveDefinition$lambda($name, this$0, $nodeInfo, $sentence) {
  return (namespace) => {
    // Inline function 'kotlin.also' call
    var this_0 = new PrimitiveTypeSimple(namespace, $name);
    this$0.setLocationFor(this_0, $nodeInfo, $sentence);
    return this_0;
  };
}
function TypesSyntaxAnalyser$enumDefinition$lambda($name, $literals, this$0, $nodeInfo, $sentence) {
  return (namespace) => {
    // Inline function 'kotlin.also' call
    var this_0 = new EnumTypeSimple(namespace, $name, $literals);
    this$0.setLocationFor(this_0, $nodeInfo, $sentence);
    return this_0;
  };
}
function TypesSyntaxAnalyser$valueDefinition$lambda($name, this$0, $nodeInfo, $sentence, $supertypes, $cParam) {
  return (namespace) => {
    // Inline function 'kotlin.also' call
    var this_0 = new ValueTypeSimple(namespace, $name);
    this$0.setLocationFor(this_0, $nodeInfo, $sentence);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $supertypes.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      this_0.addSupertype_dep(element.k3s_1);
    }
    this_0.addConstructor(listOf($cParam(this_0)));
    return this_0;
  };
}
function TypesSyntaxAnalyser$collectionDefinition$lambda($name, $tParams, this$0, $nodeInfo, $sentence) {
  return (namespace) => {
    // Inline function 'kotlin.also' call
    var this_0 = new CollectionTypeSimple(namespace, $name);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $tParams.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      this_0.addTypeParameter(element);
    }
    this$0.setLocationFor(this_0, $nodeInfo, $sentence);
    return this_0;
  };
}
function TypesSyntaxAnalyser$unionDefinition$lambda($name, $alternatives, this$0, $nodeInfo, $sentence) {
  return (namespace) => {
    // Inline function 'kotlin.also' call
    var this_0 = new UnionTypeSimple(namespace, $name);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $alternatives.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      var ti = element.n3s(this_0);
      this_0.addAlternative(ti);
    }
    // Inline function 'kotlin.also' call
    this$0.setLocationFor(this_0, $nodeInfo, $sentence);
    return this_0;
  };
}
function TypesSyntaxAnalyser$interfaceDefinition$lambda($name, $tParams, $supertypes, $property, this$0, $nodeInfo, $sentence) {
  return (namespace) => {
    // Inline function 'kotlin.also' call
    var this_0 = new InterfaceTypeSimple(namespace, $name);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $tParams.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      this_0.addTypeParameter(new TypeParameterSimple(_SimpleName___init__impl__6s45d0(element)));
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = $supertypes.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      this_0.addSupertype_dep(element_0.k3s_1);
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_1 = $property.s();
    while (_iterator__ex2g4s_1.t()) {
      var element_1 = _iterator__ex2g4s_1.u();
      // Inline function 'kotlin.also' call
      var this_1 = element_1(this_0);
      setResolvers(this$0, this_1.typeInstance, this_0);
    }
    // Inline function 'kotlin.also' call
    this$0.setLocationFor(this_0, $nodeInfo, $sentence);
    return this_0;
  };
}
function TypesSyntaxAnalyser$dataDefinition$lambda($name, $tParams, $supertypes, this$0, $constructors, $property, $nodeInfo, $sentence) {
  return (ns) => {
    var dt = new DataTypeSimple(ns, $name);
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s = $tParams.s();
    while (_iterator__ex2g4s.t()) {
      var element = _iterator__ex2g4s.u();
      dt.addTypeParameter(new TypeParameterSimple(_SimpleName___init__impl__6s45d0(element)));
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_0 = $supertypes.s();
    while (_iterator__ex2g4s_0.t()) {
      var element_0 = _iterator__ex2g4s_0.u();
      var ti = createTypeInstance_0(this$0, ns, dt, element_0);
      dt.addSupertype(ti);
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_1 = $constructors.s();
    while (_iterator__ex2g4s_1.t()) {
      var element_1 = _iterator__ex2g4s_1.u();
      // Inline function 'kotlin.collections.map' call
      // Inline function 'kotlin.collections.mapTo' call
      var destination = ArrayList.w(collectionSizeOrDefault(element_1, 10));
      var _iterator__ex2g4s_2 = element_1.s();
      while (_iterator__ex2g4s_2.t()) {
        var item = _iterator__ex2g4s_2.u();
        var tmp$ret$4 = item(dt);
        destination.r(tmp$ret$4);
      }
      var consParams = destination;
      dt.addConstructor(consParams);
    }
    // Inline function 'kotlin.collections.forEach' call
    var _iterator__ex2g4s_3 = $property.s();
    while (_iterator__ex2g4s_3.t()) {
      var element_2 = _iterator__ex2g4s_3.u();
      var p = element_2(dt);
      setResolvers(this$0, p.typeInstance, dt);
    }
    // Inline function 'kotlin.also' call
    this$0.setLocationFor(dt, $nodeInfo, $sentence);
    return dt;
  };
}
function TypesSyntaxAnalyser$constructorParameter$lambda($typeRef, $characteristics, $name, this$0, $nodeInfo, $sentence) {
  return (owner) => {
    var tp = $typeRef.n3s(owner);
    var tmp;
    var tmp_0;
    // Inline function 'kotlin.collections.isNotEmpty' call
    if (!$characteristics.a1()) {
      tmp_0 = isInterface(owner, StructuredType);
    } else {
      tmp_0 = false;
    }
    if (tmp_0) {
      owner.appendPropertyStored(_PropertyName___init__impl__sz2wu9(_ParameterName___get_value__impl__c8iwft($name)), tp, $characteristics);
      tmp = Unit_instance;
    }
    // Inline function 'kotlin.also' call
    var this_0 = new ParameterDefinitionSimple($name, tp, null);
    this$0.setLocationFor(this_0, $nodeInfo, $sentence);
    return this_0;
  };
}
function TypesSyntaxAnalyser$property$lambda($typeRef, $name, $characteristics, this$0, $nodeInfo, $sentence) {
  return (owner) => {
    var typeInstance = $typeRef.n3s(owner);
    // Inline function 'kotlin.also' call
    var this_0 = owner.appendPropertyStored($name, typeInstance, $characteristics);
    this$0.setLocationFor(this_0, $nodeInfo, $sentence);
    return this_0;
  };
}
var PropertyCharacteristic_REFERENCE_instance;
var PropertyCharacteristic_COMPOSITE_instance;
var PropertyCharacteristic_READ_ONLY_instance;
var PropertyCharacteristic_READ_WRITE_instance;
var PropertyCharacteristic_STORED_instance;
var PropertyCharacteristic_DERIVED_instance;
var PropertyCharacteristic_PRIMITIVE_instance;
var PropertyCharacteristic_CONSTRUCTOR_instance;
var PropertyCharacteristic_IDENTITY_instance;
function values_6() {
  return [PropertyCharacteristic_REFERENCE_getInstance(), PropertyCharacteristic_COMPOSITE_getInstance(), PropertyCharacteristic_READ_ONLY_getInstance(), PropertyCharacteristic_READ_WRITE_getInstance(), PropertyCharacteristic_STORED_getInstance(), PropertyCharacteristic_DERIVED_getInstance(), PropertyCharacteristic_PRIMITIVE_getInstance(), PropertyCharacteristic_CONSTRUCTOR_getInstance(), PropertyCharacteristic_IDENTITY_getInstance()];
}
function valueOf_7(value) {
  switch (value) {
    case 'REFERENCE':
      return PropertyCharacteristic_REFERENCE_getInstance();
    case 'COMPOSITE':
      return PropertyCharacteristic_COMPOSITE_getInstance();
    case 'READ_ONLY':
      return PropertyCharacteristic_READ_ONLY_getInstance();
    case 'READ_WRITE':
      return PropertyCharacteristic_READ_WRITE_getInstance();
    case 'STORED':
      return PropertyCharacteristic_STORED_getInstance();
    case 'DERIVED':
      return PropertyCharacteristic_DERIVED_getInstance();
    case 'PRIMITIVE':
      return PropertyCharacteristic_PRIMITIVE_getInstance();
    case 'CONSTRUCTOR':
      return PropertyCharacteristic_CONSTRUCTOR_getInstance();
    case 'IDENTITY':
      return PropertyCharacteristic_IDENTITY_getInstance();
    default:
      PropertyCharacteristic_initEntries();
      THROW_IAE('No enum constant value.');
      break;
  }
}
var PropertyCharacteristic_entriesInitialized;
function PropertyCharacteristic_initEntries() {
  if (PropertyCharacteristic_entriesInitialized)
    return Unit_instance;
  PropertyCharacteristic_entriesInitialized = true;
  PropertyCharacteristic_REFERENCE_instance = new PropertyCharacteristic('REFERENCE', 0);
  PropertyCharacteristic_COMPOSITE_instance = new PropertyCharacteristic('COMPOSITE', 1);
  PropertyCharacteristic_READ_ONLY_instance = new PropertyCharacteristic('READ_ONLY', 2);
  PropertyCharacteristic_READ_WRITE_instance = new PropertyCharacteristic('READ_WRITE', 3);
  PropertyCharacteristic_STORED_instance = new PropertyCharacteristic('STORED', 4);
  PropertyCharacteristic_DERIVED_instance = new PropertyCharacteristic('DERIVED', 5);
  PropertyCharacteristic_PRIMITIVE_instance = new PropertyCharacteristic('PRIMITIVE', 6);
  PropertyCharacteristic_CONSTRUCTOR_instance = new PropertyCharacteristic('CONSTRUCTOR', 7);
  PropertyCharacteristic_IDENTITY_instance = new PropertyCharacteristic('IDENTITY', 8);
}
function _PropertyName___init__impl__sz2wu9(value) {
  return value;
}
function _PropertyName___get_value__impl__p219lh($this) {
  return $this;
}
function PropertyName__toString_impl_hcnfa7($this) {
  return _PropertyName___get_value__impl__p219lh($this);
}
function PropertyName__hashCode_impl_vxapw2($this) {
  return getStringHashCode($this);
}
function PropertyName__equals_impl_oqi1da($this, other) {
  if (!(other instanceof PropertyName))
    return false;
  if (!($this === (other instanceof PropertyName ? other.s30_1 : THROW_CCE())))
    return false;
  return true;
}
function _MethodName___init__impl__2ggy8b(value) {
  return value;
}
function _MethodName___get_value__impl__37ln07($this) {
  return $this;
}
function MethodName__toString_impl_y7ited($this) {
  return 'MethodName(value=' + $this + ')';
}
function MethodName__hashCode_impl_cgcwli($this) {
  return getStringHashCode($this);
}
function MethodName__equals_impl_j1h1r2($this, other) {
  if (!(other instanceof MethodName))
    return false;
  if (!($this === (other instanceof MethodName ? other.x3s_1 : THROW_CCE())))
    return false;
  return true;
}
function _ParameterName___init__impl__84hwrp(value) {
  return value;
}
function _ParameterName___get_value__impl__c8iwft($this) {
  return $this;
}
function ParameterName__toString_impl_rf7x9v($this) {
  return 'ParameterName(value=' + $this + ')';
}
function ParameterName__hashCode_impl_luq7we($this) {
  return getStringHashCode($this);
}
function ParameterName__equals_impl_w9j8ey($this, other) {
  if (!(other instanceof ParameterName))
    return false;
  if (!($this === (other instanceof ParameterName ? other.y3s_1 : THROW_CCE())))
    return false;
  return true;
}
function PropertyCharacteristic_REFERENCE_getInstance() {
  PropertyCharacteristic_initEntries();
  return PropertyCharacteristic_REFERENCE_instance;
}
function PropertyCharacteristic_COMPOSITE_getInstance() {
  PropertyCharacteristic_initEntries();
  return PropertyCharacteristic_COMPOSITE_instance;
}
function PropertyCharacteristic_READ_ONLY_getInstance() {
  PropertyCharacteristic_initEntries();
  return PropertyCharacteristic_READ_ONLY_instance;
}
function PropertyCharacteristic_READ_WRITE_getInstance() {
  PropertyCharacteristic_initEntries();
  return PropertyCharacteristic_READ_WRITE_instance;
}
function PropertyCharacteristic_STORED_getInstance() {
  PropertyCharacteristic_initEntries();
  return PropertyCharacteristic_STORED_instance;
}
function PropertyCharacteristic_DERIVED_getInstance() {
  PropertyCharacteristic_initEntries();
  return PropertyCharacteristic_DERIVED_instance;
}
function PropertyCharacteristic_PRIMITIVE_getInstance() {
  PropertyCharacteristic_initEntries();
  return PropertyCharacteristic_PRIMITIVE_instance;
}
function PropertyCharacteristic_CONSTRUCTOR_getInstance() {
  PropertyCharacteristic_initEntries();
  return PropertyCharacteristic_CONSTRUCTOR_instance;
}
function PropertyCharacteristic_IDENTITY_getInstance() {
  PropertyCharacteristic_initEntries();
  return PropertyCharacteristic_IDENTITY_instance;
}
function typeModel(name, resolveImports, namespaces, init) {
  namespaces = namespaces === VOID ? listOf(StdLibDefault_getInstance()) : namespaces;
  var b = new TypeModelBuilder(_SimpleName___init__impl__6s45d0(name), resolveImports, namespaces);
  init(b);
  var m = b.build();
  return m;
}
function TypeNamespaceBuilder$value$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function TypeNamespaceBuilder$interface_$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function TypeNamespaceBuilder$data$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function TypeNamespaceBuilder$union$lambda(_unused_var__etf5q3) {
  return Unit_instance;
}
function StructuredTypeBuilder$propertyOf$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function StructuredTypeBuilder$propertyListTypeOf$lambda($dataTypeName) {
  return ($this$propertyListType) => {
    $this$propertyListType.ref($dataTypeName);
    return Unit_instance;
  };
}
function StructuredTypeBuilder$propertyListOfTupleType$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function StructuredTypeBuilder$propertyUnionTypeOf$lambda(ut) {
  return Unit_instance;
}
function ValueTypeBuilder$supertype$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function InterfaceTypeBuilder$supertype$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function DataTypeBuilder$supertype$lambda(_this__u8e3s4) {
  return Unit_instance;
}
function TypeArgumentBuilder$typeArgument$lambda(_this__u8e3s4) {
  return Unit_instance;
}
//region block: post-declaration
initMetadataForObject(BuildConfig_0, 'BuildConfig');
initMetadataForObject(KotlinxReflectForModule_0, 'KotlinxReflectForModule');
initMetadataForObject(Agl_0, 'Agl');
initMetadataForClass(Expansion, 'Expansion');
initMetadataForClass(sam$kotlin_Comparator$0, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
initMetadataForCompanion(Companion);
initMetadataForInterface(CompletionProvider, 'CompletionProvider');
initMetadataForClass(CompletionProviderAbstract, 'CompletionProviderAbstract', VOID, VOID, [CompletionProvider]);
initMetadataForInterface(SpineNode, 'SpineNode');
initMetadataForClass(SpineNodeAbstract, 'SpineNodeAbstract', VOID, VOID, [SpineNode]);
initMetadataForClass(SpineNodeRoot, 'SpineNodeRoot', VOID, VOID, [SpineNode]);
initMetadataForClass(SpineNodeDefault, 'SpineNodeDefault');
initMetadataForInterface(Spine, 'Spine');
initMetadataForClass(SpineDefault, 'SpineDefault', VOID, VOID, [Spine]);
initMetadataForClass(AutomatonToKotlin, 'AutomatonToKotlin', AutomatonToKotlin);
initMetadataForInterface(Formatter, 'Formatter');
initMetadataForClass(FormatterAbstract, 'FormatterAbstract', VOID, VOID, [Formatter]);
initMetadataForClass(LanguageDefinitionAbstract$grammarModel$$inlined$observable$1);
initMetadataForClass(LanguageDefinitionAbstract$targetGrammarName$$inlined$observable$1);
initMetadataForClass(LanguageDefinitionAbstract$defaultGoalRule$$inlined$observable$1);
initMetadataForClass(LanguageDefinitionAbstract$_styleResolver$$inlined$observable$1);
initMetadataForInterface(LanguageDefinition, 'LanguageDefinition');
protoOf(LanguageDefinitionAbstract).update = update;
initMetadataForClass(LanguageDefinitionAbstract, 'LanguageDefinitionAbstract', VOID, VOID, [LanguageDefinition]);
initMetadataForClass(LanguageDefinitionDefault, 'LanguageDefinitionDefault');
initMetadataForClass(LanguageDefinitionFromAsm, 'LanguageDefinitionFromAsm');
initMetadataForInterface(LanguageProcessor, 'LanguageProcessor');
protoOf(LanguageProcessorAbstract).buildFor = buildFor;
protoOf(LanguageProcessorAbstract).scan = scan;
protoOf(LanguageProcessorAbstract).parse = parse;
protoOf(LanguageProcessorAbstract).syntaxAnalysis = syntaxAnalysis;
protoOf(LanguageProcessorAbstract).semanticAnalysis = semanticAnalysis;
protoOf(LanguageProcessorAbstract).process = process;
protoOf(LanguageProcessorAbstract).format = format;
protoOf(LanguageProcessorAbstract).formatAsm = formatAsm;
protoOf(LanguageProcessorAbstract).expectedTerminalsAt = expectedTerminalsAt;
protoOf(LanguageProcessorAbstract).expectedItemsAt = expectedItemsAt;
initMetadataForClass(LanguageProcessorAbstract, 'LanguageProcessorAbstract', VOID, VOID, [LanguageProcessor]);
initMetadataForClass(LanguageProcessorDefault, 'LanguageProcessorDefault');
initMetadataForClass(LanguageProcessorFromLanguageObject, 'LanguageProcessorFromLanguageObject');
initMetadataForInterface(AglLanguages, 'AglLanguages');
initMetadataForClass(LanguageRegistryDefault$agl$1, VOID, VOID, VOID, [AglLanguages]);
initMetadataForInterface(GrammarRegistry, 'GrammarRegistry');
initMetadataForInterface(LanguageRegistry, 'LanguageRegistry', VOID, VOID, [GrammarRegistry]);
protoOf(LanguageRegistryDefault).findOrPlaceholder = findOrPlaceholder;
initMetadataForClass(LanguageRegistryDefault, 'LanguageRegistryDefault', LanguageRegistryDefault, VOID, [LanguageRegistry]);
initMetadataForInterface(LanguageProcessorConfiguration, 'LanguageProcessorConfiguration');
initMetadataForClass(LanguageProcessorConfigurationEmpty, 'LanguageProcessorConfigurationEmpty', LanguageProcessorConfigurationEmpty, VOID, [LanguageProcessorConfiguration]);
initMetadataForClass(LanguageProcessorConfigurationBase, 'LanguageProcessorConfigurationBase', LanguageProcessorConfigurationBase, VOID, [LanguageProcessorConfiguration]);
initMetadataForClass(LanguageProcessorConfigurationSimple, 'LanguageProcessorConfigurationSimple', LanguageProcessorConfigurationSimple, VOID, [LanguageProcessorConfiguration]);
initMetadataForClass(LanguageProcessorConfigurationBuilder, 'LanguageProcessorConfigurationBuilder');
initMetadataForClass(LanguageProcessorConfigurationDslMarker, 'LanguageProcessorConfigurationDslMarker');
initMetadataForInterface(ProcessOptions, 'ProcessOptions');
initMetadataForClass(ProcessOptionsDefault, 'ProcessOptionsDefault', ProcessOptionsDefault, VOID, [ProcessOptions]);
initMetadataForInterface(SyntaxAnalysisOptions, 'SyntaxAnalysisOptions');
initMetadataForClass(SyntaxAnalysisOptionsDefault, 'SyntaxAnalysisOptionsDefault', SyntaxAnalysisOptionsDefault, VOID, [SyntaxAnalysisOptions]);
initMetadataForInterface(SemanticAnalysisOptions, 'SemanticAnalysisOptions');
initMetadataForClass(SemanticAnalysisOptionsDefault, 'SemanticAnalysisOptionsDefault', SemanticAnalysisOptionsDefault, VOID, [SemanticAnalysisOptions]);
initMetadataForInterface(CompletionProviderOptions, 'CompletionProviderOptions');
initMetadataForClass(CompletionProviderOptionsDefault, 'CompletionProviderOptionsDefault', CompletionProviderOptionsDefault, VOID, [CompletionProviderOptions]);
initMetadataForClass(ScanOptionsBuilder, 'ScanOptionsBuilder');
initMetadataForClass(ParseOptionsBuilder, 'ParseOptionsBuilder');
initMetadataForClass(ProcessOptionsBuilder, 'ProcessOptionsBuilder');
initMetadataForClass(SyntaxAnalysisOptionsBuilder, 'SyntaxAnalysisOptionsBuilder');
initMetadataForClass(SemanticAnalysisOptionsBuilder, 'SemanticAnalysisOptionsBuilder');
initMetadataForClass(CompletionProviderOptionsBuilder, 'CompletionProviderOptionsBuilder');
initMetadataForClass(ProcessOptionsDslMarker, 'ProcessOptionsDslMarker');
initMetadataForClass(LanguageProcessorResult, 'LanguageProcessorResult');
initMetadataForInterface(SyntaxAnalysisResult, 'SyntaxAnalysisResult');
initMetadataForClass(SyntaxAnalysisResultDefault, 'SyntaxAnalysisResultDefault', VOID, VOID, [SyntaxAnalysisResult]);
initMetadataForInterface(SemanticAnalysisResult, 'SemanticAnalysisResult');
initMetadataForClass(SemanticAnalysisResultDefault, 'SemanticAnalysisResultDefault', VOID, VOID, [SemanticAnalysisResult]);
initMetadataForInterface(ProcessResult, 'ProcessResult');
initMetadataForClass(ProcessResultDefault, 'ProcessResultDefault', VOID, VOID, [ProcessResult]);
initMetadataForInterface(FormatResult, 'FormatResult');
initMetadataForClass(FormatResultDefault, 'FormatResultDefault', VOID, VOID, [FormatResult]);
initMetadataForInterface(ExpectedAtResult, 'ExpectedAtResult');
initMetadataForClass(ExpectedAtResultDefault, 'ExpectedAtResultDefault', VOID, VOID, [ExpectedAtResult]);
initMetadataForInterface(SentenceContext, 'SentenceContext');
initMetadataForClass(ContextFromTypeModelReference, 'ContextFromTypeModelReference', VOID, VOID, [SentenceContext]);
initMetadataForClass(ContextFromTypeModel, 'ContextFromTypeModel', VOID, VOID, [SentenceContext]);
initMetadataForClass(CompletionProviderSimple, 'CompletionProviderSimple');
initMetadataForInterface(CreateScopedItem, 'CreateScopedItem');
initMetadataForInterface(ResolveScopedItem, 'ResolveScopedItem');
initMetadataForClass(CreateScopedItemDefault, 'CreateScopedItemDefault', CreateScopedItemDefault, VOID, [CreateScopedItem]);
initMetadataForClass(ResolveScopedItemDefault, 'ResolveScopedItemDefault', ResolveScopedItemDefault, VOID, [ResolveScopedItem]);
initMetadataForObject(NULL_SENTENCE_IDENTIFIER_0, 'NULL_SENTENCE_IDENTIFIER');
initMetadataForClass(ContextWithScope, 'ContextWithScope', ContextWithScope, VOID, [SentenceContext]);
initMetadataForClass(ContextFromGrammarAndTypeModel, 'ContextFromGrammarAndTypeModel', VOID, VOID, [SentenceContext]);
initMetadataForCompanion(Companion_0);
initMetadataForInterface(Formatable, 'Formatable');
initMetadataForInterface(Definition, 'Definition', VOID, VOID, [Formatable]);
initMetadataForInterface(TypeDefinition, 'TypeDefinition', VOID, VOID, [Definition]);
protoOf(TypeDefinitionSimpleAbstract).type = type;
protoOf(TypeDefinitionSimpleAbstract).asString = asString;
protoOf(TypeDefinitionSimpleAbstract).signature = signature;
initMetadataForClass(TypeDefinitionSimpleAbstract, 'TypeDefinitionSimpleAbstract', VOID, VOID, [TypeDefinition]);
initMetadataForInterface(StructuredType, 'StructuredType', VOID, VOID, [TypeDefinition]);
protoOf(StructuredTypeSimpleAbstract).appendPropertyStored = appendPropertyStored;
initMetadataForClass(StructuredTypeSimpleAbstract, 'StructuredTypeSimpleAbstract', VOID, VOID, [TypeDefinitionSimpleAbstract, StructuredType]);
initMetadataForClass(Grammar2TransformRuleSet$trRuleForRuleItemConcatenation$ttSub$1);
initMetadataForClass(Grammar2TransformRuleSet$trRuleForGroupContentOptional$ttSub$1);
initMetadataForClass(Grammar2TransformRuleSet, 'Grammar2TransformRuleSet');
initMetadataForClass(ConstructAndModify, 'ConstructAndModify');
initMetadataForClass(GrammarModel2TransformModel, 'GrammarModel2TransformModel');
initMetadataForClass(Grammar2Namespaces, 'Grammar2Namespaces');
initMetadataForClass(ReferenceExpressionContext, 'ReferenceExpressionContext');
initMetadataForInterface(AsmTreeWalker, 'AsmTreeWalker');
initMetadataForClass(ReferenceResolverSimple, 'ReferenceResolverSimple', VOID, VOID, [AsmTreeWalker]);
initMetadataForClass(ScopeCreator, 'ScopeCreator', VOID, VOID, [AsmTreeWalker]);
initMetadataForCompanion(Companion_1);
initMetadataForClass(sam$net_akehurst_language_agl_simple_ResolveScopedItem$0, 'sam$net_akehurst_language_agl_simple_ResolveScopedItem$0', VOID, VOID, [ResolveScopedItem, FunctionAdapter]);
initMetadataForInterface(SemanticAnalyser, 'SemanticAnalyser');
protoOf(SemanticAnalyserSimple).analyse = analyse;
initMetadataForClass(SemanticAnalyserSimple, 'SemanticAnalyserSimple', VOID, VOID, [SemanticAnalyser]);
initMetadataForInterface(SyntaxAnalyser, 'SyntaxAnalyser');
protoOf(SyntaxAnalyserFromTreeDataAbstract).clear = clear;
initMetadataForClass(SyntaxAnalyserFromTreeDataAbstract, 'SyntaxAnalyserFromTreeDataAbstract', VOID, VOID, [SyntaxAnalyser]);
initMetadataForClass(SyntaxAnalyserFromAsmTransformAbstract, 'SyntaxAnalyserFromAsmTransformAbstract');
initMetadataForClass(SyntaxAnalyserSimple, 'SyntaxAnalyserSimple');
initMetadataForInterface(ObjectGraph, 'ObjectGraph');
initMetadataForClass(ObjectGraphAsmSimple, 'ObjectGraphAsmSimple', VOID, VOID, [ObjectGraph]);
initMetadataForInterface(AsmFactory, 'AsmFactory', VOID, VOID, [ObjectGraph]);
initMetadataForClass(AsmFactorySimple, 'AsmFactorySimple', VOID, VOID, [ObjectGraphAsmSimple, AsmFactory]);
initMetadataForInterface(Grammar2TypeModelMapping, 'Grammar2TypeModelMapping');
initMetadataForClass(TypeModelFromGrammarConfigurationDefault, 'TypeModelFromGrammarConfigurationDefault', TypeModelFromGrammarConfigurationDefault, VOID, [Grammar2TypeModelMapping]);
initMetadataForClass(ContextBuilder, 'ContextBuilder');
initMetadataForClass(ScopeBuilder, 'ScopeBuilder');
initMetadataForClass(sam$net_akehurst_language_agl_simple_CreateScopedItem$0, 'sam$net_akehurst_language_agl_simple_CreateScopedItem$0', VOID, VOID, [CreateScopedItem, FunctionAdapter]);
initMetadataForClass(sam$net_akehurst_language_agl_simple_ResolveScopedItem$0_0, 'sam$net_akehurst_language_agl_simple_ResolveScopedItem$0', VOID, VOID, [ResolveScopedItem, FunctionAdapter]);
initMetadataForClass(SyntaxAnalyserByMethodRegistrationAbstract$Companion$EMPTY_LIST_VALUE$1);
initMetadataForClass(SyntaxAnalyserByMethodRegistrationAbstract$Companion$EMPTY_TERMINAL_VALUE$1);
initMetadataForCompanion(Companion_2);
initMetadataForClass(SyntaxAnalyserByMethodRegistrationAbstract$walkTree$walker$1, VOID, VOID, VOID, [SpptWalker]);
initMetadataForClass(SyntaxAnalyserByMethodRegistrationAbstract, 'SyntaxAnalyserByMethodRegistrationAbstract');
initMetadataForClass(NodeTrRules, 'NodeTrRules');
initMetadataForClass(DownData2, 'DownData2');
initMetadataForClass(ChildData, 'ChildData');
initMetadataForCompanion(Companion_3);
initMetadataForClass(SyntaxAnalyserFromAsmTransformAbstract$walkTree$walker$1, VOID, VOID, VOID, [SpptWalker]);
initMetadataForInterface(LocationMap, 'LocationMap');
initMetadataForClass(LocationMapDefault, 'LocationMapDefault', LocationMapDefault, VOID, [LocationMap]);
initMetadataForClass(SyntaxAnalyserGeneratorKotlin, 'SyntaxAnalyserGeneratorKotlin', SyntaxAnalyserGeneratorKotlin);
initMetadataForClass(NodeTypes, 'NodeTypes');
initMetadataForClass(DownData, 'DownData');
initMetadataForClass(ChildDataAny, 'ChildDataAny');
initMetadataForCompanion(Companion_4);
initMetadataForClass(SyntaxAnalyserSimpleStreamPushAbstract$walkTree$walker$1, VOID, VOID, VOID, [SpptWalker]);
initMetadataForClass(SyntaxAnalyserSimpleStreamPushAbstract, 'SyntaxAnalyserSimpleStreamPushAbstract');
initMetadataForInterface(AsmWalker, 'AsmWalker');
initMetadataForClass(CompletionItemKind, 'CompletionItemKind');
initMetadataForClass(CompletionItem, 'CompletionItem');
initMetadataForInterface(PublicValueType, 'PublicValueType');
initMetadataForClass(LanguageIdentity, 'LanguageIdentity', VOID, VOID, [PublicValueType]);
initMetadataForClass(GrammarString, 'GrammarString', VOID, VOID, [PublicValueType]);
initMetadataForClass(TypesString, 'TypesString', VOID, VOID, [PublicValueType]);
initMetadataForClass(TransformString, 'TransformString', VOID, VOID, [PublicValueType]);
initMetadataForClass(CrossReferenceString, 'CrossReferenceString', VOID, VOID, [PublicValueType]);
initMetadataForClass(StyleString, 'StyleString', VOID, VOID, [PublicValueType]);
initMetadataForClass(FormatString, 'FormatString', VOID, VOID, [PublicValueType]);
initMetadataForClass(LanguageProcessorException, 'LanguageProcessorException');
initMetadataForClass(ParserKind, 'ParserKind');
initMetadataForInterface(LanguageObject, 'LanguageObject');
initMetadataForCompanion(Companion_5);
initMetadataForClass(LanguageObjectAbstract, 'LanguageObjectAbstract', VOID, VOID, [LanguageObject]);
initMetadataForClass(ResolvedReference, 'ResolvedReference');
initMetadataForInterface(AsmPath, 'AsmPath');
initMetadataForInterface(Asm, 'Asm');
initMetadataForInterface(AsmValue, 'AsmValue');
initMetadataForInterface(AsmNothing, 'AsmNothing', VOID, VOID, [AsmValue]);
initMetadataForInterface(AsmAny, 'AsmAny', VOID, VOID, [AsmValue]);
initMetadataForInterface(AsmPrimitive, 'AsmPrimitive', VOID, VOID, [AsmValue]);
initMetadataForInterface(AsmReference, 'AsmReference');
initMetadataForInterface(AsmStructure, 'AsmStructure', VOID, VOID, [AsmValue]);
initMetadataForInterface(AsmStructureProperty, 'AsmStructureProperty');
initMetadataForInterface(AsmList, 'AsmList', VOID, VOID, [AsmValue]);
initMetadataForInterface(AsmListSeparated, 'AsmListSeparated', VOID, VOID, [AsmList]);
initMetadataForInterface(AsmLambda, 'AsmLambda', VOID, VOID, [AsmValue]);
initMetadataForClass(PropertyValueName, 'PropertyValueName', VOID, VOID, [PublicValueType]);
initMetadataForObject(AglAsm_0, 'AglAsm');
initMetadataForCompanion(Companion_6);
initMetadataForClass(AsmPathSimple, 'AsmPathSimple', VOID, VOID, [AsmPath]);
protoOf(AsmSimple).asString = asString_0;
initMetadataForClass(AsmSimple, 'AsmSimple', AsmSimple, VOID, [Asm]);
protoOf(AsmValueAbstract).asString = asString_1;
initMetadataForClass(AsmValueAbstract, 'AsmValueAbstract', VOID, VOID, [AsmValue]);
initMetadataForObject(AsmNothingSimple_0, 'AsmNothingSimple', VOID, VOID, [AsmValueAbstract, AsmNothing]);
initMetadataForCompanion(Companion_7);
initMetadataForClass(AsmAnySimple, 'AsmAnySimple', VOID, VOID, [AsmValueAbstract, AsmAny]);
initMetadataForCompanion(Companion_8);
initMetadataForClass(AsmPrimitiveSimple, 'AsmPrimitiveSimple', VOID, VOID, [AsmValueAbstract, AsmPrimitive]);
initMetadataForClass(AsmReferenceSimple, 'AsmReferenceSimple', VOID, VOID, [AsmValueAbstract, AsmReference]);
initMetadataForClass(sam$kotlin_Comparator$0_0, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
initMetadataForClass(AsmStructureSimple, 'AsmStructureSimple', VOID, VOID, [AsmValueAbstract, AsmStructure]);
initMetadataForCompanion(Companion_9);
initMetadataForClass(AsmStructurePropertySimple, 'AsmStructurePropertySimple', VOID, VOID, [AsmStructureProperty]);
initMetadataForClass(AsmListSimple, 'AsmListSimple', VOID, VOID, [AsmValueAbstract, AsmList]);
initMetadataForClass(AsmListSeparatedSimple, 'AsmListSeparatedSimple', VOID, VOID, [AsmValueAbstract, AsmListSeparated]);
initMetadataForClass(AsmLambdaSimple, 'AsmLambdaSimple', VOID, VOID, [AsmValueAbstract, AsmLambda]);
initMetadataForClass(AsmSimpleBuilder, 'AsmSimpleBuilder');
initMetadataForClass(AsmElementSimpleBuilder, 'AsmElementSimpleBuilder');
initMetadataForClass(ListAsmElementSimpleBuilder, 'ListAsmElementSimpleBuilder');
initMetadataForClass(AsmSimpleBuilderMarker, 'AsmSimpleBuilderMarker');
initMetadataForInterface(OptionHolder, 'OptionHolder');
initMetadataForClass(OptionHolderDefault, 'OptionHolderDefault', OptionHolderDefault, VOID, [OptionHolder]);
initMetadataForInterface(Model, 'Model', VOID, VOID, [Formatable]);
protoOf(ModelAbstract).asString = asString;
initMetadataForClass(ModelAbstract, 'ModelAbstract', VOID, VOID, [Model]);
initMetadataForClass(sam$kotlin_Comparator$0_1, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
initMetadataForInterface(Namespace, 'Namespace', VOID, VOID, [Formatable]);
protoOf(NamespaceAbstract).asString = asString;
initMetadataForClass(NamespaceAbstract, 'NamespaceAbstract', VOID, VOID, [Namespace]);
protoOf(DefinitionAbstract).asString = asString;
initMetadataForClass(DefinitionAbstract, 'DefinitionAbstract', VOID, VOID, [Definition]);
initMetadataForClass(ModelDefault, 'ModelDefault');
initMetadataForClass(NamespaceDefault, 'NamespaceDefault');
initMetadataForClass(DefinitionDefault, 'DefinitionDefault');
initMetadataForCompanion(Companion_10);
initMetadataForInterface(PossiblyQualifiedName_0, 'PossiblyQualifiedName');
initMetadataForCompanion(Companion_11);
initMetadataForClass(SimpleName, 'SimpleName', VOID, VOID, [PossiblyQualifiedName_0, PublicValueType]);
initMetadataForClass(Indent, 'Indent', Indent);
initMetadataForInterface(DefinitionReference, 'DefinitionReference');
initMetadataForClass(QualifiedName, 'QualifiedName', VOID, VOID, [PossiblyQualifiedName_0, PublicValueType]);
initMetadataForClass(Import, 'Import', VOID, VOID, [PublicValueType]);
initMetadataForObject(AglBase_0, 'AglBase');
protoOf(BaseSemanticAnalyser).analyse = analyse;
initMetadataForClass(BaseSemanticAnalyser, 'BaseSemanticAnalyser', BaseSemanticAnalyser, VOID, [SemanticAnalyser]);
initMetadataForClass(BaseSyntaxAnalyser, 'BaseSyntaxAnalyser', BaseSyntaxAnalyser);
initMetadataForClass(BaseCompletionProvider, 'BaseCompletionProvider', BaseCompletionProvider, VOID, [CompletionProvider]);
initMetadataForInterface(Expression, 'Expression');
initMetadataForInterface(RootExpression, 'RootExpression', VOID, VOID, [Expression]);
initMetadataForInterface(LiteralExpression, 'LiteralExpression', VOID, VOID, [Expression]);
initMetadataForInterface(CreateObjectExpression, 'CreateObjectExpression', VOID, VOID, [Expression]);
initMetadataForInterface(CreateTupleExpression, 'CreateTupleExpression', VOID, VOID, [Expression]);
initMetadataForInterface(OnExpression, 'OnExpression', VOID, VOID, [Expression]);
initMetadataForInterface(NavigationExpression, 'NavigationExpression', VOID, VOID, [Expression]);
initMetadataForInterface(NavigationPart, 'NavigationPart');
initMetadataForInterface(PropertyCall, 'PropertyCall', VOID, VOID, [NavigationPart]);
initMetadataForInterface(MethodCall, 'MethodCall', VOID, VOID, [NavigationPart]);
initMetadataForInterface(LambdaExpression, 'LambdaExpression', VOID, VOID, [Expression]);
initMetadataForInterface(IndexOperation, 'IndexOperation', VOID, VOID, [NavigationPart]);
initMetadataForInterface(AssignmentStatement, 'AssignmentStatement');
initMetadataForInterface(WithExpression, 'WithExpression', VOID, VOID, [Expression]);
initMetadataForInterface(WhenExpression, 'WhenExpression', VOID, VOID, [Expression]);
initMetadataForInterface(WhenOption, 'WhenOption');
initMetadataForInterface(WhenOptionElse, 'WhenOptionElse');
initMetadataForInterface(InfixExpression, 'InfixExpression', VOID, VOID, [Expression]);
initMetadataForInterface(CastExpression, 'CastExpression', VOID, VOID, [Expression]);
initMetadataForInterface(TypeTestExpression, 'TypeTestExpression', VOID, VOID, [Expression]);
initMetadataForInterface(TypeReference, 'TypeReference');
initMetadataForInterface(GroupExpression, 'GroupExpression', VOID, VOID, [Expression]);
protoOf(ExpressionAbstract).asString = asString_2;
initMetadataForClass(ExpressionAbstract, 'ExpressionAbstract', VOID, VOID, [Expression]);
initMetadataForClass(CreateTupleExpressionDefault, 'CreateTupleExpressionDefault', VOID, VOID, [ExpressionAbstract, CreateTupleExpression]);
initMetadataForClass(CreateObjectExpressionDefault, 'CreateObjectExpressionDefault', VOID, VOID, [ExpressionAbstract, CreateObjectExpression]);
initMetadataForClass(WithExpressionDefault, 'WithExpressionDefault', VOID, VOID, [ExpressionAbstract, WithExpression]);
initMetadataForClass(WhenExpressionDefault, 'WhenExpressionDefault', VOID, VOID, [ExpressionAbstract, WhenExpression]);
initMetadataForClass(WhenOptionDefault, 'WhenOptionDefault', VOID, VOID, [WhenOption]);
initMetadataForClass(WhenOptionElseDefault, 'WhenOptionElseDefault', VOID, VOID, [WhenOptionElse]);
initMetadataForClass(OnExpressionDefault, 'OnExpressionDefault', VOID, VOID, [ExpressionAbstract, OnExpression]);
initMetadataForCompanion(Companion_12);
initMetadataForClass(RootExpressionDefault, 'RootExpressionDefault', VOID, VOID, [ExpressionAbstract, RootExpression]);
initMetadataForClass(LiteralExpressionDefault, 'LiteralExpressionDefault', VOID, VOID, [ExpressionAbstract, LiteralExpression]);
initMetadataForClass(NavigationExpressionDefault, 'NavigationExpressionDefault', VOID, VOID, [ExpressionAbstract, NavigationExpression]);
initMetadataForClass(PropertyCallDefault, 'PropertyCallDefault', VOID, VOID, [PropertyCall]);
initMetadataForClass(MethodCallDefault, 'MethodCallDefault', VOID, VOID, [MethodCall]);
protoOf(LambdaExpressionDefault).asString = asString_2;
initMetadataForClass(LambdaExpressionDefault, 'LambdaExpressionDefault', VOID, VOID, [LambdaExpression]);
initMetadataForClass(IndexOperationDefault, 'IndexOperationDefault', VOID, VOID, [IndexOperation]);
protoOf(AssignmentStatementDefault).asString = asString_3;
initMetadataForClass(AssignmentStatementDefault, 'AssignmentStatementDefault', VOID, VOID, [AssignmentStatement]);
protoOf(InfixExpressionDefault).asString = asString_2;
initMetadataForClass(InfixExpressionDefault, 'InfixExpressionDefault', VOID, VOID, [InfixExpression]);
protoOf(CastExpressionDefault).asString = asString_2;
initMetadataForClass(CastExpressionDefault, 'CastExpressionDefault', VOID, VOID, [CastExpression]);
protoOf(TypeTestExpressionDefault).asString = asString_2;
initMetadataForClass(TypeTestExpressionDefault, 'TypeTestExpressionDefault', VOID, VOID, [TypeTestExpression]);
initMetadataForClass(TypeReferenceDefault, 'TypeReferenceDefault', VOID, VOID, [TypeReference]);
protoOf(GroupExpressionDefault).asString = asString_2;
initMetadataForClass(GroupExpressionDefault, 'GroupExpressionDefault', VOID, VOID, [GroupExpression]);
initMetadataForObject(AglExpressions_0, 'AglExpressions');
initMetadataForClass(ExpressionTypeResolver, 'ExpressionTypeResolver');
initMetadataForClass(ExpressionsCompletionProvider, 'ExpressionsCompletionProvider', ExpressionsCompletionProvider);
initMetadataForCompanion(Companion_13);
initMetadataForClass(EvaluationContext, 'EvaluationContext');
initMetadataForInterface(TypedObject, 'TypedObject');
initMetadataForClass(ExpressionsInterpreterOverTypedObject, 'ExpressionsInterpreterOverTypedObject');
protoOf(ExpressionsSemanticAnalyser).analyse = analyse;
initMetadataForClass(ExpressionsSemanticAnalyser, 'ExpressionsSemanticAnalyser', ExpressionsSemanticAnalyser, VOID, [SemanticAnalyser]);
initMetadataForClass(PropertyValue, 'PropertyValue');
initMetadataForClass(ExpressionsSyntaxAnalyser, 'ExpressionsSyntaxAnalyser', ExpressionsSyntaxAnalyser);
initMetadataForObject(StdLibPrimitiveExecutions_0, 'StdLibPrimitiveExecutions');
initMetadataForClass(TypedObjectAsmValue, 'TypedObjectAsmValue', VOID, VOID, [TypedObject]);
initMetadataForObject(StdLibPrimitiveExecutionsForReflection_0, 'StdLibPrimitiveExecutionsForReflection');
initMetadataForClass(TypedObjectAny, 'TypedObjectAny', VOID, VOID, [TypedObject]);
initMetadataForClass(ObjectGraphByReflection, 'ObjectGraphByReflection', VOID, VOID, [ObjectGraph]);
initMetadataForClass(FormatModelBuilder, 'FormatModelBuilder');
initMetadataForClass(FormatExpressionBuilder, 'FormatExpressionBuilder');
initMetadataForInterface(AglFormatModel, 'AglFormatModel', VOID, VOID, [Model]);
initMetadataForInterface(FormatNamespace, 'FormatNamespace', VOID, VOID, [Namespace]);
initMetadataForInterface(FormatSetReference, 'FormatSetReference');
initMetadataForInterface(FormatSet, 'FormatSet', VOID, VOID, [Definition]);
initMetadataForInterface(AglFormatRule, 'AglFormatRule');
initMetadataForInterface(FormatExpression, 'FormatExpression', VOID, VOID, [Expression]);
initMetadataForInterface(FormatExpressionExpression, 'FormatExpressionExpression', VOID, VOID, [FormatExpression]);
initMetadataForInterface(FormatExpressionTemplate, 'FormatExpressionTemplate', VOID, VOID, [FormatExpression]);
initMetadataForInterface(FormatExpressionWhen, 'FormatExpressionWhen', VOID, VOID, [FormatExpression]);
initMetadataForInterface(FormatWhenOption, 'FormatWhenOption', VOID, VOID, [WhenOption]);
initMetadataForInterface(FormatWhenOptionElse, 'FormatWhenOptionElse', VOID, VOID, [WhenOptionElse]);
initMetadataForInterface(TemplateElement, 'TemplateElement');
initMetadataForInterface(TemplateElementText, 'TemplateElementText', VOID, VOID, [TemplateElement]);
initMetadataForInterface(TemplateElementExpressionProperty, 'TemplateElementExpressionProperty', VOID, VOID, [TemplateElement]);
initMetadataForInterface(TemplateElementExpressionList, 'TemplateElementExpressionList', VOID, VOID, [TemplateElement]);
initMetadataForInterface(TemplateElementExpressionEmbedded, 'TemplateElementExpressionEmbedded', VOID, VOID, [TemplateElement]);
initMetadataForCompanion(Companion_14);
initMetadataForClass(AglFormatModelDefault, 'AglFormatModelDefault', VOID, VOID, [AglFormatModel, ModelAbstract]);
initMetadataForClass(AglFormatNamespaceDefault, 'AglFormatNamespaceDefault', VOID, VOID, [FormatNamespace, NamespaceAbstract]);
initMetadataForClass(FormatSetReferenceDefault, 'FormatSetReferenceDefault', VOID, VOID, [FormatSetReference]);
initMetadataForClass(FormatSetDefault, 'FormatSetDefault', VOID, VOID, [FormatSet, DefinitionAbstract]);
initMetadataForClass(AglFormatRuleDefault, 'AglFormatRuleDefault', VOID, VOID, [AglFormatRule]);
protoOf(FormatExpressionWhenDefault).asString = asString_2;
initMetadataForClass(FormatExpressionWhenDefault, 'FormatExpressionWhenDefault', VOID, VOID, [FormatExpressionWhen]);
initMetadataForClass(FormatWhenOptionDefault, 'FormatWhenOptionDefault', VOID, VOID, [FormatWhenOption]);
initMetadataForClass(FormatWhenOptionElseDefault, 'FormatWhenOptionElseDefault', VOID, VOID, [FormatWhenOptionElse]);
protoOf(FormatExpressionExpressionDefault).asString = asString_2;
initMetadataForClass(FormatExpressionExpressionDefault, 'FormatExpressionExpressionDefault', VOID, VOID, [FormatExpressionExpression]);
protoOf(FormatExpressionTemplateDefault).asString = asString_2;
initMetadataForClass(FormatExpressionTemplateDefault, 'FormatExpressionTemplateDefault', VOID, VOID, [FormatExpressionTemplate]);
initMetadataForClass(TemplateElementTextDefault, 'TemplateElementTextDefault', VOID, VOID, [TemplateElementText]);
initMetadataForClass(TemplateElementExpressionPropertyDefault, 'TemplateElementExpressionPropertyDefault', VOID, VOID, [TemplateElementExpressionProperty]);
initMetadataForClass(TemplateElementExpressionListDefault, 'TemplateElementExpressionListDefault', VOID, VOID, [TemplateElementExpressionList]);
initMetadataForClass(TemplateElementExpressionEmbeddedDefault, 'TemplateElementExpressionEmbeddedDefault', VOID, VOID, [TemplateElementExpressionEmbedded]);
initMetadataForObject(AglFormat_0, 'AglFormat');
initMetadataForClass(AglFormatCompletionProvider, 'AglFormatCompletionProvider', AglFormatCompletionProvider);
protoOf(AglFormatSemanticAnalyser).analyse = analyse;
initMetadataForClass(AglFormatSemanticAnalyser, 'AglFormatSemanticAnalyser', AglFormatSemanticAnalyser, VOID, [SemanticAnalyser]);
initMetadataForClass(AglFormatSyntaxAnalyser, 'AglFormatSyntaxAnalyser', AglFormatSyntaxAnalyser);
initMetadataForClass(AglTemplateSyntaxAnalyser, 'AglTemplateSyntaxAnalyser', AglTemplateSyntaxAnalyser);
initMetadataForClass(FormatterOverAsmSimple, 'FormatterOverAsmSimple', VOID, VOID, [Formatter]);
initMetadataForCompanion(Companion_15);
initMetadataForClass(FormatterOverTypedObject, 'FormatterOverTypedObject', VOID, VOID, [ExpressionsInterpreterOverTypedObject, Formatter]);
initMetadataForInterface(GrammarModel, 'GrammarModel', VOID, VOID, [Model]);
protoOf(GrammarModelDefault).w30 = get_primary;
initMetadataForClass(GrammarModelDefault, 'GrammarModelDefault', VOID, VOID, [GrammarModel, ModelAbstract]);
initMetadataForInterface(GrammarNamespace, 'GrammarNamespace', VOID, VOID, [Namespace]);
initMetadataForClass(GrammarNamespaceDefault, 'GrammarNamespaceDefault', VOID, VOID, [GrammarNamespace, NamespaceAbstract]);
initMetadataForCompanion(Companion_16);
initMetadataForInterface(Grammar, 'Grammar', VOID, VOID, [Definition]);
protoOf(GrammarAbstract).findAllResolvedEmbeddedGrammars = findAllResolvedEmbeddedGrammars;
protoOf(GrammarAbstract).asString = asString;
initMetadataForClass(GrammarAbstract, 'GrammarAbstract', VOID, VOID, [Grammar]);
initMetadataForClass(GrammarDefault, 'GrammarDefault');
initMetadataForInterface(GrammarReference, 'GrammarReference');
initMetadataForClass(GrammarReferenceDefault, 'GrammarReferenceDefault', VOID, VOID, [GrammarReference]);
initMetadataForCompanion(Companion_17);
initMetadataForInterface(GrammarItem, 'GrammarItem', VOID, VOID, [Formatable]);
protoOf(GrammarItemAbstract).asString = asString;
initMetadataForClass(GrammarItemAbstract, 'GrammarItemAbstract', VOID, VOID, [GrammarItem]);
initMetadataForInterface(RuleItem, 'RuleItem');
initMetadataForInterface(ConcatenationItem, 'ConcatenationItem', VOID, VOID, [RuleItem]);
initMetadataForInterface(SimpleItem, 'SimpleItem', VOID, VOID, [ConcatenationItem]);
initMetadataForInterface(TangibleItem, 'TangibleItem', VOID, VOID, [SimpleItem]);
initMetadataForInterface(Terminal, 'Terminal', VOID, VOID, [TangibleItem]);
initMetadataForClass(RuleItemAbstract, 'RuleItemAbstract', VOID, VOID, [RuleItem]);
initMetadataForClass(CompressedLeafRule, 'CompressedLeafRule', VOID, VOID, [Terminal, RuleItemAbstract]);
initMetadataForCompanion(Companion_18);
initMetadataForInterface(GrammarRule, 'GrammarRule', VOID, VOID, [GrammarItem]);
initMetadataForClass(GrammarRuleAbstract, 'GrammarRuleAbstract', VOID, VOID, [GrammarItemAbstract, GrammarRule]);
initMetadataForInterface(NormalRule, 'NormalRule', VOID, VOID, [GrammarRule]);
initMetadataForClass(NormalRuleDefault, 'NormalRuleDefault', VOID, VOID, [GrammarRuleAbstract, NormalRule]);
initMetadataForInterface(OverrideRule, 'OverrideRule', VOID, VOID, [GrammarRule]);
initMetadataForClass(OverrideRuleDefault, 'OverrideRuleDefault', VOID, VOID, [GrammarRuleAbstract, OverrideRule]);
initMetadataForInterface(PreferenceRule, 'PreferenceRule', VOID, VOID, [GrammarItem]);
initMetadataForClass(PreferenceRuleDefault, 'PreferenceRuleDefault', VOID, VOID, [GrammarItemAbstract, PreferenceRule]);
initMetadataForInterface(PreferenceOption, 'PreferenceOption', VOID, VOID, [Formatable]);
protoOf(PreferenceOptionDefault).asString = asString;
initMetadataForClass(PreferenceOptionDefault, 'PreferenceOptionDefault', VOID, VOID, [PreferenceOption]);
initMetadataForInterface(Spine_0, 'Spine');
initMetadataForClass(SpineDefault_0, 'SpineDefault', VOID, VOID, [Spine_0]);
initMetadataForInterface(Concatenation, 'Concatenation', VOID, VOID, [RuleItem]);
initMetadataForClass(ConcatenationDefault, 'ConcatenationDefault', VOID, VOID, [RuleItemAbstract, Concatenation]);
initMetadataForInterface(Choice, 'Choice', VOID, VOID, [RuleItem]);
initMetadataForClass(ChoiceAbstract, 'ChoiceAbstract', VOID, VOID, [RuleItemAbstract, Choice]);
initMetadataForInterface(ChoiceLongest, 'ChoiceLongest', VOID, VOID, [Choice]);
initMetadataForClass(ChoiceLongestDefault, 'ChoiceLongestDefault', VOID, VOID, [ChoiceAbstract, ChoiceLongest]);
initMetadataForInterface(ChoicePriority, 'ChoicePriority', VOID, VOID, [Choice]);
initMetadataForClass(ChoicePriorityDefault, 'ChoicePriorityDefault', VOID, VOID, [ChoiceAbstract, ChoicePriority]);
initMetadataForInterface(ChoiceAmbiguous, 'ChoiceAmbiguous', VOID, VOID, [Choice]);
initMetadataForClass(ChoiceAmbiguousDefault, 'ChoiceAmbiguousDefault', VOID, VOID, [ChoiceAbstract, ChoiceAmbiguous]);
initMetadataForClass(ConcatenationItemAbstract, 'ConcatenationItemAbstract', VOID, VOID, [RuleItemAbstract, ConcatenationItem]);
initMetadataForInterface(OptionalItem, 'OptionalItem', VOID, VOID, [ConcatenationItem]);
initMetadataForClass(OptionalItemDefault, 'OptionalItemDefault', VOID, VOID, [ConcatenationItemAbstract, OptionalItem]);
initMetadataForClass(SimpleItemAbstract, 'SimpleItemAbstract', VOID, VOID, [ConcatenationItemAbstract, SimpleItem]);
initMetadataForInterface(Group, 'Group', VOID, VOID, [SimpleItem]);
initMetadataForClass(GroupDefault, 'GroupDefault', VOID, VOID, [SimpleItemAbstract, Group]);
initMetadataForClass(TangibleItemAbstract, 'TangibleItemAbstract', VOID, VOID, [SimpleItemAbstract, TangibleItem]);
initMetadataForInterface(EmptyRule, 'EmptyRule', VOID, VOID, [TangibleItem]);
initMetadataForClass(EmptyRuleDefault, 'EmptyRuleDefault', EmptyRuleDefault, VOID, [TangibleItemAbstract, EmptyRule]);
initMetadataForClass(TerminalDefault, 'TerminalDefault', VOID, VOID, [TangibleItemAbstract, Terminal]);
initMetadataForInterface(NonTerminal, 'NonTerminal', VOID, VOID, [TangibleItem]);
initMetadataForClass(NonTerminalDefault, 'NonTerminalDefault', VOID, VOID, [TangibleItemAbstract, NonTerminal]);
initMetadataForInterface(Embedded, 'Embedded', VOID, VOID, [TangibleItem]);
initMetadataForClass(EmbeddedDefault, 'EmbeddedDefault', VOID, VOID, [TangibleItemAbstract, Embedded]);
initMetadataForInterface(ListOfItems, 'ListOfItems', VOID, VOID, [ConcatenationItem]);
initMetadataForClass(ListOfItemsAbstract, 'ListOfItemsAbstract', VOID, VOID, [ConcatenationItemAbstract, ListOfItems]);
initMetadataForInterface(SimpleList, 'SimpleList', VOID, VOID, [ListOfItems]);
initMetadataForClass(SimpleListDefault, 'SimpleListDefault', VOID, VOID, [ListOfItemsAbstract, SimpleList]);
initMetadataForInterface(SeparatedList, 'SeparatedList', VOID, VOID, [ListOfItems]);
initMetadataForClass(SeparatedListDefault, 'SeparatedListDefault', VOID, VOID, [ListOfItemsAbstract, SeparatedList]);
initMetadataForClass(Associativity, 'Associativity');
initMetadataForClass(ChoiceIndicator, 'ChoiceIndicator');
initMetadataForClass(OverrideKind, 'OverrideKind');
initMetadataForClass(SeparatedListKind, 'SeparatedListKind');
initMetadataForClass(GrammarRuleName, 'GrammarRuleName', VOID, VOID, [PublicValueType]);
initMetadataForClass(GrammarModelBuilder, 'GrammarModelBuilder');
initMetadataForClass(GrammarNamespaceBuilder, 'GrammarNamespaceBuilder');
initMetadataForClass(GrammarBuilder, 'GrammarBuilder');
initMetadataForClass(GroupChoiceBuilder, 'GroupChoiceBuilder');
initMetadataForClass(PreferenceRuleBuilder, 'PreferenceRuleBuilder');
initMetadataForClass(GrammarBuilderMarker, 'GrammarBuilderMarker');
initMetadataForClass(SimpleItemsBuilder, 'SimpleItemsBuilder');
initMetadataForClass(ChoiceItemBuilder, 'ChoiceItemBuilder');
initMetadataForClass(ConcatenationItemBuilder, 'ConcatenationItemBuilder');
initMetadataForObject(AglGrammar_0, 'AglGrammar');
initMetadataForClass(AglGrammarCompletionProvider, 'AglGrammarCompletionProvider', AglGrammarCompletionProvider);
initMetadataForCompanion(Companion_19);
protoOf(AglGrammarSemanticAnalyser).analyse = analyse;
initMetadataForClass(AglGrammarSemanticAnalyser, 'AglGrammarSemanticAnalyser', AglGrammarSemanticAnalyser, VOID, [SemanticAnalyser]);
initMetadataForClass(AglGrammarSyntaxAnalyser, 'AglGrammarSyntaxAnalyser', AglGrammarSyntaxAnalyser);
initMetadataForClass(ConverterToRuntimeRules, 'ConverterToRuntimeRules');
initMetadataForClass(PseudoRuleNames, 'PseudoRuleNames');
initMetadataForCompanion(Companion_20);
initMetadataForInterface(TypeNamespace, 'TypeNamespace', VOID, VOID, [Namespace]);
protoOf(TypeNamespaceAbstract).createTypeInstance = createTypeInstance;
initMetadataForClass(TypeNamespaceAbstract, 'TypeNamespaceAbstract', VOID, VOID, [TypeNamespace, NamespaceAbstract]);
initMetadataForInterface(GrammarTypeNamespace, 'GrammarTypeNamespace', VOID, VOID, [TypeNamespace]);
initMetadataForClass(GrammarTypeNamespaceAbstract, 'GrammarTypeNamespaceAbstract', VOID, VOID, [TypeNamespaceAbstract, GrammarTypeNamespace]);
initMetadataForClass(GrammarTypeNamespaceSimple, 'GrammarTypeNamespaceSimple');
initMetadataForClass(TypeNamespaceBuilder, 'TypeNamespaceBuilder');
initMetadataForClass(GrammarTypeNamespaceBuilder, 'GrammarTypeNamespaceBuilder');
initMetadataForObject(AglCrossReference_0, 'AglCrossReference');
initMetadataForClass(ReferencesCompletionProvider, 'ReferencesCompletionProvider', ReferencesCompletionProvider);
protoOf(ReferencesSemanticAnalyser).analyse = analyse;
initMetadataForClass(ReferencesSemanticAnalyser, 'ReferencesSemanticAnalyser', ReferencesSemanticAnalyser, VOID, [SemanticAnalyser]);
initMetadataForClass(PropertyValue_0, 'PropertyValue');
initMetadataForClass(ReferencesSyntaxAnalyser, 'ReferencesSyntaxAnalyser', ReferencesSyntaxAnalyser);
initMetadataForInterface(CrossReferenceModel, 'CrossReferenceModel', VOID, VOID, [Model]);
initMetadataForInterface(CrossReferenceNamespace, 'CrossReferenceNamespace', VOID, VOID, [Namespace]);
initMetadataForInterface(DeclarationsForNamespace, 'DeclarationsForNamespace', VOID, VOID, [Definition]);
initMetadataForInterface(ReferenceDefinition, 'ReferenceDefinition', VOID, VOID, [Formatable]);
initMetadataForInterface(ScopeDefinition, 'ScopeDefinition', VOID, VOID, [Formatable]);
initMetadataForInterface(Identifiable, 'Identifiable', VOID, VOID, [Formatable]);
initMetadataForInterface(ReferenceExpression, 'ReferenceExpression', VOID, VOID, [Formatable]);
initMetadataForInterface(ReferenceExpressionProperty, 'ReferenceExpressionProperty', VOID, VOID, [ReferenceExpression]);
initMetadataForInterface(ReferenceExpressionCollection, 'ReferenceExpressionCollection', VOID, VOID, [ReferenceExpression]);
initMetadataForCompanion(Companion_21);
initMetadataForClass(CrossReferenceModelDefault, 'CrossReferenceModelDefault', VOID, VOID, [ModelAbstract, CrossReferenceModel]);
initMetadataForClass(CrossReferenceNamespaceDefault, 'CrossReferenceNamespaceDefault', VOID, VOID, [NamespaceAbstract, CrossReferenceNamespace]);
initMetadataForClass(DeclarationsForNamespaceDefault, 'DeclarationsForNamespaceDefault', VOID, VOID, [DeclarationsForNamespace, DefinitionAbstract]);
protoOf(ScopeDefinitionDefault).asString = asString;
initMetadataForClass(ScopeDefinitionDefault, 'ScopeDefinitionDefault', VOID, VOID, [ScopeDefinition]);
protoOf(IdentifiableDefault).asString = asString;
initMetadataForClass(IdentifiableDefault, 'IdentifiableDefault', VOID, VOID, [Identifiable]);
protoOf(ReferenceDefinitionDefault).asString = asString;
initMetadataForClass(ReferenceDefinitionDefault, 'ReferenceDefinitionDefault', VOID, VOID, [ReferenceDefinition]);
protoOf(ReferenceExpressionAbstract).asString = asString;
initMetadataForClass(ReferenceExpressionAbstract, 'ReferenceExpressionAbstract', VOID, VOID, [ReferenceExpression]);
initMetadataForClass(ReferenceExpressionPropertyDefault, 'ReferenceExpressionPropertyDefault', VOID, VOID, [ReferenceExpressionAbstract, ReferenceExpressionProperty]);
initMetadataForClass(ReferenceExpressionCollectionDefault, 'ReferenceExpressionCollectionDefault', VOID, VOID, [ReferenceExpressionAbstract, ReferenceExpressionCollection]);
initMetadataForClass(CrossReferenceModelBuilder, 'CrossReferenceModelBuilder');
initMetadataForClass(DeclarationsForNamespaceBuilder, 'DeclarationsForNamespaceBuilder');
initMetadataForClass(ScopeDefinitionBuilder, 'ScopeDefinitionBuilder');
initMetadataForClass(ReferenceDefinitionBuilder, 'ReferenceDefinitionBuilder');
initMetadataForClass(CrossReferenceModelBuilderMarker, 'CrossReferenceModelBuilderMarker');
initMetadataForObject(AglScope_0, 'AglScope');
initMetadataForClass(ItemInScope, 'ItemInScope');
initMetadataForInterface(Scope, 'Scope');
initMetadataForCompanion(Companion_22);
initMetadataForClass(ScopeSimple, 'ScopeSimple', VOID, VOID, [Scope]);
initMetadataForObject(AglStyle_0, 'AglStyle');
initMetadataForCompanion(Companion_23);
initMetadataForClass(AglStyleCompletionProvider, 'AglStyleCompletionProvider', AglStyleCompletionProvider, VOID, [CompletionProvider]);
initMetadataForCompanion(Companion_24);
protoOf(AglStyleSemanticAnalyser).analyse = analyse;
initMetadataForClass(AglStyleSemanticAnalyser, 'AglStyleSemanticAnalyser', AglStyleSemanticAnalyser, VOID, [SemanticAnalyser]);
initMetadataForClass(AglStyleSyntaxAnalyser, 'AglStyleSyntaxAnalyser', AglStyleSyntaxAnalyser);
initMetadataForCompanion(Companion_25);
initMetadataForInterface(AglStyleModel, 'AglStyleModel', VOID, VOID, [Model]);
initMetadataForClass(AglStyleModelDefault, 'AglStyleModelDefault', VOID, VOID, [AglStyleModel, ModelAbstract]);
initMetadataForInterface(StyleNamespace, 'StyleNamespace', VOID, VOID, [Namespace]);
initMetadataForClass(StyleNamespaceDefault, 'StyleNamespaceDefault', VOID, VOID, [StyleNamespace, NamespaceAbstract]);
initMetadataForInterface(StyleSetReference, 'StyleSetReference');
initMetadataForClass(StyleSetReferenceDefault, 'StyleSetReferenceDefault', VOID, VOID, [StyleSetReference]);
initMetadataForInterface(StyleSet, 'StyleSet', VOID, VOID, [Definition]);
initMetadataForClass(AglStyleSetDefault, 'AglStyleSetDefault', VOID, VOID, [StyleSet, DefinitionAbstract]);
initMetadataForInterface(AglStyleRule, 'AglStyleRule', VOID, VOID, [Formatable]);
initMetadataForInterface(AglStyleMetaRule, 'AglStyleMetaRule', VOID, VOID, [AglStyleRule]);
protoOf(AglStyleMetaRuleDefault).asString = asString;
initMetadataForClass(AglStyleMetaRuleDefault, 'AglStyleMetaRuleDefault', VOID, VOID, [AglStyleMetaRule]);
initMetadataForInterface(AglStyleTagRule, 'AglStyleTagRule', VOID, VOID, [AglStyleRule]);
protoOf(AglStyleTagRuleDefault).asString = asString;
initMetadataForClass(AglStyleTagRuleDefault, 'AglStyleTagRuleDefault', VOID, VOID, [AglStyleTagRule]);
initMetadataForClass(AglStyleSelectorKind, 'AglStyleSelectorKind');
initMetadataForClass(AglStyleSelector, 'AglStyleSelector');
initMetadataForClass(AglStyleDeclaration, 'AglStyleDeclaration');
initMetadataForClass(StyleModelBuilder, 'StyleModelBuilder');
initMetadataForClass(StyleNamespaceBuilder, 'StyleNamespaceBuilder');
initMetadataForClass(StylesBuilder, 'StylesBuilder');
initMetadataForClass(StyleMetaRuleBuilder, 'StyleMetaRuleBuilder');
initMetadataForClass(StyleTagRuleBuilder, 'StyleTagRuleBuilder');
initMetadataForClass(StyleModelDslMarker, 'StyleModelDslMarker');
initMetadataForObject(AsmTransform_0, 'AsmTransform');
initMetadataForClass(AsmTransformCompletionProvider, 'AsmTransformCompletionProvider', AsmTransformCompletionProvider);
initMetadataForCompanion(Companion_26);
initMetadataForClass(AsmTransformInterpreter, 'AsmTransformInterpreter');
initMetadataForCompanion(Companion_27);
protoOf(AsmTransformSemanticAnalyser).analyse = analyse;
initMetadataForClass(AsmTransformSemanticAnalyser, 'AsmTransformSemanticAnalyser', AsmTransformSemanticAnalyser, VOID, [SemanticAnalyser]);
initMetadataForClass(AsmTransformSyntaxAnalyser, 'AsmTransformSyntaxAnalyser', AsmTransformSyntaxAnalyser);
initMetadataForInterface(TransformModel, 'TransformModel', VOID, VOID, [Model]);
initMetadataForInterface(TransformNamespace, 'TransformNamespace', VOID, VOID, [Namespace]);
initMetadataForInterface(TransformRuleSetReference, 'TransformRuleSetReference', VOID, VOID, [DefinitionReference]);
initMetadataForInterface(TransformRuleSet, 'TransformRuleSet', VOID, VOID, [Definition]);
initMetadataForInterface(TransformationRule, 'TransformationRule');
initMetadataForInterface(CreateObjectRule, 'CreateObjectRule', VOID, VOID, [TransformationRule]);
initMetadataForInterface(SelfStatement, 'SelfStatement');
initMetadataForInterface(ModifyObjectRule, 'ModifyObjectRule', VOID, VOID, [TransformationRule]);
initMetadataForCompanion(Companion_28);
initMetadataForClass(TransformDomainDefault, 'TransformDomainDefault', VOID, VOID, [TransformModel, ModelAbstract]);
initMetadataForClass(sam$kotlin_Comparator$0_2, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
initMetadataForClass(TransformNamespaceDefault, 'TransformNamespaceDefault', VOID, VOID, [TransformNamespace, NamespaceAbstract]);
initMetadataForClass(TransformRuleSetReferenceDefault, 'TransformRuleSetReferenceDefault', VOID, VOID, [TransformRuleSetReference]);
initMetadataForClass(sam$kotlin_Comparator$0_3, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
initMetadataForClass(TransformRuleSetDefault, 'TransformRuleSetDefault', VOID, VOID, [TransformRuleSet, DefinitionAbstract]);
protoOf(TransformationRuleDefault).asString = asString_4;
initMetadataForClass(TransformationRuleDefault, 'TransformationRuleDefault', VOID, VOID, [TransformationRule]);
initMetadataForClass(AsmTransformModelBuilder, 'AsmTransformModelBuilder');
initMetadataForClass(AsmTransformNamespaceBuilder, 'AsmTransformNamespaceBuilder');
initMetadataForClass(AsmTransformRuleSetBuilder, 'AsmTransformRuleSetBuilder');
initMetadataForClass(AssignmentBuilder, 'AssignmentBuilder', AssignmentBuilder);
initMetadataForObject(StdLibDefault_0, 'StdLibDefault');
initMetadataForCompanion(Companion_29);
initMetadataForInterface(TypeModel, 'TypeModel', VOID, VOID, [Model]);
protoOf(TypeModelSimpleAbstract).asString = asString;
initMetadataForClass(TypeModelSimpleAbstract, 'TypeModelSimpleAbstract', VOID, VOID, [TypeModel]);
initMetadataForClass(TypeModelSimple, 'TypeModelSimple');
initMetadataForClass(sam$kotlin_Comparator$0_4, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
initMetadataForInterface(TypeInstance, 'TypeInstance');
initMetadataForClass(TypeInstanceAbstract, 'TypeInstanceAbstract', VOID, VOID, [TypeInstance]);
initMetadataForClass(TypeParameterReference, 'TypeParameterReference', VOID, VOID, [TypeInstanceAbstract, TypeInstance]);
initMetadataForInterface(TypeArgument, 'TypeArgument');
initMetadataForClass(TypeArgumentSimple, 'TypeArgumentSimple', VOID, VOID, [TypeArgument]);
initMetadataForCompanion(Companion_30);
initMetadataForClass(TypeInstanceSimple, 'TypeInstanceSimple');
initMetadataForInterface(TupleTypeInstance, 'TupleTypeInstance', VOID, VOID, [TypeInstance]);
initMetadataForClass(TupleTypeInstanceSimple, 'TupleTypeInstanceSimple', VOID, VOID, [TypeInstanceAbstract, TupleTypeInstance]);
initMetadataForClass(TypeNamespaceSimple, 'TypeNamespaceSimple');
initMetadataForClass(sam$kotlin_Comparator$0_5, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
initMetadataForInterface(TypeParameter, 'TypeParameter');
initMetadataForClass(TypeParameterSimple, 'TypeParameterSimple', VOID, VOID, [TypeParameter]);
initMetadataForObject(TypeParameterMultiple_0, 'TypeParameterMultiple', VOID, VOID, [TypeParameter]);
initMetadataForCompanion(Companion_31);
initMetadataForInterface(SpecialType, 'SpecialType', VOID, VOID, [TypeDefinition]);
initMetadataForClass(SpecialTypeSimple, 'SpecialTypeSimple', VOID, VOID, [TypeDefinitionSimpleAbstract, SpecialType]);
initMetadataForInterface(SingletonType, 'SingletonType', VOID, VOID, [TypeDefinition]);
initMetadataForClass(SingletonTypeSimple, 'SingletonTypeSimple', VOID, VOID, [TypeDefinitionSimpleAbstract, SingletonType]);
initMetadataForInterface(PrimitiveType, 'PrimitiveType', VOID, VOID, [TypeDefinition]);
initMetadataForClass(PrimitiveTypeSimple, 'PrimitiveTypeSimple', VOID, VOID, [TypeDefinitionSimpleAbstract, PrimitiveType]);
initMetadataForInterface(EnumType, 'EnumType', VOID, VOID, [TypeDefinition]);
initMetadataForClass(EnumTypeSimple, 'EnumTypeSimple', VOID, VOID, [TypeDefinitionSimpleAbstract, EnumType]);
initMetadataForInterface(UnionType, 'UnionType', VOID, VOID, [TypeDefinition]);
initMetadataForClass(UnionTypeSimple, 'UnionTypeSimple', VOID, VOID, [TypeDefinitionSimpleAbstract, UnionType]);
initMetadataForInterface(TypeArgumentNamed, 'TypeArgumentNamed', VOID, VOID, [TypeArgument]);
initMetadataForClass(TypeArgumentNamedSimple, 'TypeArgumentNamedSimple', VOID, VOID, [TypeArgumentNamed]);
initMetadataForInterface(TupleType, 'TupleType', VOID, VOID, [TypeDefinition]);
protoOf(TupleTypeSimple).typeTuple = typeTuple;
initMetadataForClass(TupleTypeSimple, 'TupleTypeSimple', VOID, VOID, [TypeDefinitionSimpleAbstract, TupleType]);
initMetadataForClass(sam$kotlin_Comparator$0_6, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
initMetadataForInterface(ValueType, 'ValueType', VOID, VOID, [StructuredType]);
initMetadataForClass(ValueTypeSimple, 'ValueTypeSimple', VOID, VOID, [StructuredTypeSimpleAbstract, ValueType]);
initMetadataForClass(sam$kotlin_Comparator$0_7, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
initMetadataForInterface(InterfaceType, 'InterfaceType', VOID, VOID, [StructuredType]);
initMetadataForClass(InterfaceTypeSimple, 'InterfaceTypeSimple', VOID, VOID, [StructuredTypeSimpleAbstract, InterfaceType]);
initMetadataForClass(sam$kotlin_Comparator$0_8, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
initMetadataForInterface(DataType, 'DataType', VOID, VOID, [StructuredType]);
initMetadataForClass(DataTypeSimple, 'DataTypeSimple', VOID, VOID, [StructuredTypeSimpleAbstract, DataType]);
initMetadataForInterface(CollectionType, 'CollectionType', VOID, VOID, [StructuredType]);
initMetadataForClass(CollectionTypeSimple, 'CollectionTypeSimple', VOID, VOID, [StructuredTypeSimpleAbstract, CollectionType]);
initMetadataForInterface(ConstructorDeclaration, 'ConstructorDeclaration');
initMetadataForClass(ConstructorDeclarationSimple, 'ConstructorDeclarationSimple', VOID, VOID, [ConstructorDeclaration]);
initMetadataForInterface(PropertyDeclaration, 'PropertyDeclaration');
initMetadataForClass(PropertyDeclarationAbstract, 'PropertyDeclarationAbstract', VOID, VOID, [PropertyDeclaration]);
initMetadataForClass(PropertyDeclarationStored, 'PropertyDeclarationStored');
initMetadataForClass(PropertyDeclarationPrimitive, 'PropertyDeclarationPrimitive');
initMetadataForClass(PropertyDeclarationDerived, 'PropertyDeclarationDerived');
initMetadataForInterface(PropertyDeclarationResolved, 'PropertyDeclarationResolved', VOID, VOID, [PropertyDeclaration]);
initMetadataForClass(PropertyDeclarationResolvedSimple, 'PropertyDeclarationResolvedSimple', VOID, VOID, [PropertyDeclarationAbstract, PropertyDeclarationResolved]);
initMetadataForInterface(MethodDeclaration, 'MethodDeclaration');
initMetadataForClass(MethodDeclarationAbstract, 'MethodDeclarationAbstract', VOID, VOID, [MethodDeclaration]);
initMetadataForInterface(MethodDeclarationDerived, 'MethodDeclarationDerived', VOID, VOID, [MethodDeclaration]);
initMetadataForClass(MethodDeclarationDerivedSimple, 'MethodDeclarationDerivedSimple', VOID, VOID, [MethodDeclarationAbstract, MethodDeclarationDerived]);
initMetadataForInterface(MethodDeclarationResolved, 'MethodDeclarationResolved', VOID, VOID, [MethodDeclaration]);
initMetadataForClass(MethodDeclarationResolvedSimple, 'MethodDeclarationResolvedSimple', VOID, VOID, [MethodDeclarationAbstract, MethodDeclarationResolved]);
initMetadataForInterface(ParameterDeclaration, 'ParameterDeclaration');
initMetadataForClass(ParameterDefinitionSimple, 'ParameterDefinitionSimple', VOID, VOID, [ParameterDeclaration]);
initMetadataForInterface(MethodDeclarationPrimitive, 'MethodDeclarationPrimitive', VOID, VOID, [MethodDeclaration]);
initMetadataForClass(MethodDeclarationPrimitiveSimple, 'MethodDeclarationPrimitiveSimple', VOID, VOID, [MethodDeclarationAbstract, MethodDeclarationPrimitive]);
initMetadataForObject(AglTypes_0, 'AglTypes');
initMetadataForClass(TypemodelCompletionProvider, 'TypemodelCompletionProvider', TypemodelCompletionProvider);
initMetadataForCompanion(Companion_32);
protoOf(TypemodelSemanticAnalyser).analyse = analyse;
initMetadataForClass(TypemodelSemanticAnalyser, 'TypemodelSemanticAnalyser', TypemodelSemanticAnalyser, VOID, [SemanticAnalyser]);
initMetadataForClass(TypeRefInfo, 'TypeRefInfo');
initMetadataForClass(TypesSyntaxAnalyser, 'TypesSyntaxAnalyser', TypesSyntaxAnalyser);
initMetadataForClass(PropertyCharacteristic, 'PropertyCharacteristic');
initMetadataForClass(PropertyName, 'PropertyName', VOID, VOID, [PublicValueType]);
initMetadataForClass(MethodName, 'MethodName', VOID, VOID, [PublicValueType]);
initMetadataForClass(ParameterName, 'ParameterName', VOID, VOID, [PublicValueType]);
initMetadataForClass(TypeModelBuilder, 'TypeModelBuilder');
initMetadataForClass(StructuredTypeBuilder, 'StructuredTypeBuilder');
initMetadataForClass(ValueTypeBuilder, 'ValueTypeBuilder');
initMetadataForClass(InterfaceTypeBuilder, 'InterfaceTypeBuilder');
initMetadataForClass(DataTypeBuilder, 'DataTypeBuilder');
initMetadataForClass(ConstructorBuilder, 'ConstructorBuilder');
initMetadataForClass(TypeInstanceArgBuilder, 'TypeInstanceArgBuilder');
initMetadataForClass(TypeInstanceArgNamedBuilder, 'TypeInstanceArgNamedBuilder');
initMetadataForClass(TypeArgumentBuilder, 'TypeArgumentBuilder');
initMetadataForClass(SubtypeListBuilder, 'SubtypeListBuilder');
initMetadataForClass(TypeModelDslMarker, 'TypeModelDslMarker');
//endregion
//region block: init
BuildConfig_instance = new BuildConfig_0();
KotlinxReflectForModule_instance = new KotlinxReflectForModule_0();
Companion_instance_0 = new Companion();
NULL_SENTENCE_IDENTIFIER_instance = new NULL_SENTENCE_IDENTIFIER_0();
Companion_instance_2 = new Companion_1();
Companion_instance_4 = new Companion_3();
Companion_instance_5 = new Companion_4();
Companion_instance_8 = new Companion_7();
Companion_instance_9 = new Companion_8();
Companion_instance_10 = new Companion_9();
Companion_instance_11 = new Companion_10();
Companion_instance_12 = new Companion_11();
Companion_instance_14 = new Companion_13();
Companion_instance_15 = new Companion_14();
Companion_instance_17 = new Companion_16();
Companion_instance_18 = new Companion_17();
Companion_instance_19 = new Companion_18();
Companion_instance_20 = new Companion_19();
Companion_instance_21 = new Companion_20();
Companion_instance_23 = new Companion_22();
Companion_instance_28 = new Companion_27();
Companion_instance_29 = new Companion_28();
Companion_instance_30 = new Companion_29();
Companion_instance_31 = new Companion_30();
Companion_instance_32 = new Companion_31();
Companion_instance_33 = new Companion_32();
//endregion
//region block: exports
var BuildConfig = {getInstance: BuildConfig_getInstance};
var KotlinxReflectForModule = {getInstance: KotlinxReflectForModule_getInstance};
var Agl = {getInstance: Agl_getInstance};
defineProp(CompletionProviderAbstract, 'Companion', Companion_getInstance_2);
var NULL_SENTENCE_IDENTIFIER = {getInstance: NULL_SENTENCE_IDENTIFIER_getInstance};
defineProp(SemanticAnalyserSimple, 'Companion', Companion_getInstance_4);
defineProp(SyntaxAnalyserByMethodRegistrationAbstract, 'Companion', Companion_getInstance_5);
defineProp(SyntaxAnalyserFromAsmTransformAbstract, 'Companion', Companion_getInstance_6);
defineProp(SyntaxAnalyserSimpleStreamPushAbstract, 'Companion', Companion_getInstance_7);
CompletionItemKind.values = values;
CompletionItemKind.valueOf = valueOf;
defineProp(CompletionItemKind, 'PATTERN', CompletionItemKind_PATTERN_getInstance);
defineProp(CompletionItemKind, 'LITERAL', CompletionItemKind_LITERAL_getInstance);
defineProp(CompletionItemKind, 'SEGMENT', CompletionItemKind_SEGMENT_getInstance);
defineProp(CompletionItemKind, 'REFERRED', CompletionItemKind_REFERRED_getInstance);
ParserKind.values = values_0;
ParserKind.valueOf = valueOf_0;
defineProp(ParserKind, 'GLC', ParserKind_GLC_getInstance);
defineProp(LanguageObjectAbstract, 'Companion', Companion_getInstance_8);
var AglAsm = {getInstance: AglAsm_getInstance};
defineProp(AsmPathSimple, 'Companion', Companion_getInstance_9);
var AsmNothingSimple = {getInstance: AsmNothingSimple_getInstance};
defineProp(AsmAnySimple, 'Companion', Companion_getInstance_10);
defineProp(AsmPrimitiveSimple, 'Companion', Companion_getInstance_11);
defineProp(AsmStructurePropertySimple, 'Companion', Companion_getInstance_12);
var PossiblyQualifiedName = {getInstance: Companion_getInstance_13};
var AglBase = {getInstance: AglBase_getInstance};
defineProp(RootExpressionDefault, 'Companion', Companion_getInstance_15);
var AglExpressions = {getInstance: AglExpressions_getInstance};
defineProp(EvaluationContext, 'Companion', Companion_getInstance_16);
ExpressionsSyntaxAnalyser.PropertyValue = PropertyValue;
var StdLibPrimitiveExecutions = {getInstance: StdLibPrimitiveExecutions_getInstance};
var StdLibPrimitiveExecutionsForReflection = {getInstance: StdLibPrimitiveExecutionsForReflection_getInstance};
defineProp(AglFormatModelDefault, 'Companion', Companion_getInstance_17);
var AglFormat = {getInstance: AglFormat_getInstance};
defineProp(FormatterOverTypedObject, 'Companion', Companion_getInstance_18);
defineProp(GrammarDefault, 'Companion', Companion_getInstance_19);
defineProp(GrammarRuleAbstract, 'Companion', Companion_getInstance_21);
Companion_18.prototype.CompressedLeafRule = CompressedLeafRule;
Associativity.values = values_1;
Associativity.valueOf = valueOf_2;
defineProp(Associativity, 'LEFT', Associativity_LEFT_getInstance);
defineProp(Associativity, 'RIGHT', Associativity_RIGHT_getInstance);
ChoiceIndicator.values = values_2;
ChoiceIndicator.valueOf = valueOf_3;
defineProp(ChoiceIndicator, 'NONE', ChoiceIndicator_NONE_getInstance);
defineProp(ChoiceIndicator, 'EMPTY', ChoiceIndicator_EMPTY_getInstance);
defineProp(ChoiceIndicator, 'ITEM', ChoiceIndicator_ITEM_getInstance);
defineProp(ChoiceIndicator, 'NUMBER', ChoiceIndicator_NUMBER_getInstance);
OverrideKind.values = values_3;
OverrideKind.valueOf = valueOf_4;
defineProp(OverrideKind, 'REPLACE', OverrideKind_REPLACE_getInstance);
defineProp(OverrideKind, 'APPEND_ALTERNATIVE', OverrideKind_APPEND_ALTERNATIVE_getInstance);
defineProp(OverrideKind, 'SUBSTITUTION', OverrideKind_SUBSTITUTION_getInstance);
SeparatedListKind.values = values_4;
SeparatedListKind.valueOf = valueOf_5;
defineProp(SeparatedListKind, 'Flat', SeparatedListKind_Flat_getInstance);
defineProp(SeparatedListKind, 'Left', SeparatedListKind_Left_getInstance);
defineProp(SeparatedListKind, 'Right', SeparatedListKind_Right_getInstance);
var AglGrammar = {getInstance: AglGrammar_getInstance};
defineProp(AglGrammarSemanticAnalyser, 'Companion', Companion_getInstance_22);
defineProp(GrammarTypeNamespaceSimple, 'Companion', Companion_getInstance_23);
var AglCrossReference = {getInstance: AglCrossReference_getInstance};
ReferencesSyntaxAnalyser.PropertyValue = PropertyValue_0;
defineProp(CrossReferenceModelDefault, 'Companion', Companion_getInstance_24);
var AglScope = {getInstance: AglScope_getInstance};
defineProp(ScopeSimple, 'Companion', Companion_getInstance_25);
var AglStyle = {getInstance: AglStyle_getInstance};
defineProp(AglStyleCompletionProvider, 'Companion', Companion_getInstance_26);
defineProp(AglStyleSemanticAnalyser, 'Companion', Companion_getInstance_27);
defineProp(AglStyleModelDefault, 'Companion', Companion_getInstance_28);
AglStyleSelectorKind.values = values_5;
AglStyleSelectorKind.valueOf = valueOf_6;
defineProp(AglStyleSelectorKind, 'SPECIAL', AglStyleSelectorKind_SPECIAL_getInstance);
defineProp(AglStyleSelectorKind, 'LITERAL', AglStyleSelectorKind_LITERAL_getInstance);
defineProp(AglStyleSelectorKind, 'PATTERN', AglStyleSelectorKind_PATTERN_getInstance);
defineProp(AglStyleSelectorKind, 'RULE_NAME', AglStyleSelectorKind_RULE_NAME_getInstance);
var AsmTransform = {getInstance: AsmTransform_getInstance};
defineProp(AsmTransformInterpreter, 'Companion', Companion_getInstance_29);
defineProp(AsmTransformSemanticAnalyser, 'Companion', Companion_getInstance_30);
defineProp(TransformDomainDefault, 'Companion', Companion_getInstance_31);
var StdLibDefault = {getInstance: StdLibDefault_getInstance};
defineProp(TypeModelSimple, 'Companion', Companion_getInstance_32);
defineProp(TypeInstanceSimple, 'Companion', Companion_getInstance_33);
var TypeParameterMultiple = {getInstance: TypeParameterMultiple_getInstance};
defineProp(TypeDefinitionSimpleAbstract, 'Companion', Companion_getInstance_34);
var AglTypes = {getInstance: AglTypes_getInstance};
PropertyCharacteristic.values = values_6;
PropertyCharacteristic.valueOf = valueOf_7;
defineProp(PropertyCharacteristic, 'REFERENCE', PropertyCharacteristic_REFERENCE_getInstance);
defineProp(PropertyCharacteristic, 'COMPOSITE', PropertyCharacteristic_COMPOSITE_getInstance);
defineProp(PropertyCharacteristic, 'READ_ONLY', PropertyCharacteristic_READ_ONLY_getInstance);
defineProp(PropertyCharacteristic, 'READ_WRITE', PropertyCharacteristic_READ_WRITE_getInstance);
defineProp(PropertyCharacteristic, 'STORED', PropertyCharacteristic_STORED_getInstance);
defineProp(PropertyCharacteristic, 'DERIVED', PropertyCharacteristic_DERIVED_getInstance);
defineProp(PropertyCharacteristic, 'PRIMITIVE', PropertyCharacteristic_PRIMITIVE_getInstance);
defineProp(PropertyCharacteristic, 'CONSTRUCTOR', PropertyCharacteristic_CONSTRUCTOR_getInstance);
defineProp(PropertyCharacteristic, 'IDENTITY', PropertyCharacteristic_IDENTITY_getInstance);
export {
  BuildConfig as BuildConfig,
  KotlinxReflectForModule as KotlinxReflectForModule,
  Agl as Agl,
  Expansion as Expansion,
  CompletionProviderAbstract as CompletionProviderAbstract,
  AutomatonToKotlin as AutomatonToKotlin,
  FormatterAbstract as FormatterAbstract,
  LanguageDefinitionAbstract as LanguageDefinitionAbstract,
  contextFromGrammarRegistry as contextFromGrammarRegistry,
  LanguageRegistryDefault as LanguageRegistryDefault,
  LanguageProcessorConfigurationBuilder as LanguageProcessorConfigurationBuilder,
  ProcessOptionsDefault as ProcessOptionsDefault,
  SyntaxAnalysisOptionsDefault as SyntaxAnalysisOptionsDefault,
  SemanticAnalysisOptionsDefault as SemanticAnalysisOptionsDefault,
  CompletionProviderOptionsDefault as CompletionProviderOptionsDefault,
  ScanOptionsBuilder as ScanOptionsBuilder,
  ParseOptionsBuilder as ParseOptionsBuilder,
  ProcessOptionsBuilder as ProcessOptionsBuilder,
  SyntaxAnalysisOptionsBuilder as SyntaxAnalysisOptionsBuilder,
  SemanticAnalysisOptionsBuilder as SemanticAnalysisOptionsBuilder,
  CompletionProviderOptionsBuilder as CompletionProviderOptionsBuilder,
  LanguageProcessorResult as LanguageProcessorResult,
  SyntaxAnalysisResultDefault as SyntaxAnalysisResultDefault,
  SemanticAnalysisResultDefault as SemanticAnalysisResultDefault,
  ProcessResultDefault as ProcessResultDefault,
  FormatResultDefault as FormatResultDefault,
  ExpectedAtResultDefault as ExpectedAtResultDefault,
  ContextFromTypeModelReference as ContextFromTypeModelReference,
  ContextFromTypeModel as ContextFromTypeModel,
  contextFromTypeModel as contextFromTypeModel,
  CompletionProviderSimple as CompletionProviderSimple,
  CreateScopedItemDefault as CreateScopedItemDefault,
  ResolveScopedItemDefault as ResolveScopedItemDefault,
  NULL_SENTENCE_IDENTIFIER as NULL_SENTENCE_IDENTIFIER,
  ContextWithScope as ContextWithScope,
  ContextFromGrammarAndTypeModel as ContextFromGrammarAndTypeModel,
  ReferenceExpressionContext as ReferenceExpressionContext,
  ReferenceResolverSimple as ReferenceResolverSimple,
  ScopeCreator as ScopeCreator,
  SemanticAnalyserSimple as SemanticAnalyserSimple,
  SyntaxAnalyserSimple as SyntaxAnalyserSimple,
  lower as lower,
  TypeModelFromGrammarConfigurationDefault as TypeModelFromGrammarConfigurationDefault,
  contextAsmSimple as contextAsmSimple,
  contextAsmSimpleWithAsmPath as contextAsmSimpleWithAsmPath,
  ContextBuilder as ContextBuilder,
  ScopeBuilder as ScopeBuilder,
  SyntaxAnalyserByMethodRegistrationAbstract as SyntaxAnalyserByMethodRegistrationAbstract,
  NodeTrRules as NodeTrRules,
  DownData2 as DownData2,
  ChildData as ChildData,
  SyntaxAnalyserFromAsmTransformAbstract as SyntaxAnalyserFromAsmTransformAbstract,
  LocationMapDefault as LocationMapDefault,
  SyntaxAnalyserFromTreeDataAbstract as SyntaxAnalyserFromTreeDataAbstract,
  SyntaxAnalyserGeneratorKotlin as SyntaxAnalyserGeneratorKotlin,
  NodeTypes as NodeTypes,
  DownData as DownData,
  ChildDataAny as ChildDataAny,
  SyntaxAnalyserSimpleStreamPushAbstract as SyntaxAnalyserSimpleStreamPushAbstract,
  CompletionItemKind as CompletionItemKind,
  CompletionItem as CompletionItem,
  ParserKind as ParserKind,
  LanguageObjectAbstract as LanguageObjectAbstract,
  ResolvedReference as ResolvedReference,
  AglAsm as AglAsm,
  AsmPathSimple as AsmPathSimple,
  AsmSimple as AsmSimple,
  AsmValueAbstract as AsmValueAbstract,
  AsmNothingSimple as AsmNothingSimple,
  AsmAnySimple as AsmAnySimple,
  AsmPrimitiveSimple as AsmPrimitiveSimple,
  AsmReferenceSimple as AsmReferenceSimple,
  AsmStructureSimple as AsmStructureSimple,
  AsmStructurePropertySimple as AsmStructurePropertySimple,
  AsmListSimple as AsmListSimple,
  AsmListSeparatedSimple as AsmListSeparatedSimple,
  AsmLambdaSimple as AsmLambdaSimple,
  asmSimple as asmSimple,
  AsmSimpleBuilder as AsmSimpleBuilder,
  AsmElementSimpleBuilder as AsmElementSimpleBuilder,
  ListAsmElementSimpleBuilder as ListAsmElementSimpleBuilder,
  OptionHolderDefault as OptionHolderDefault,
  ModelAbstract as ModelAbstract,
  NamespaceAbstract as NamespaceAbstract,
  DefinitionAbstract as DefinitionAbstract,
  ModelDefault as ModelDefault,
  NamespaceDefault as NamespaceDefault,
  DefinitionDefault as DefinitionDefault,
  PossiblyQualifiedName as PossiblyQualifiedName,
  Indent as Indent,
  AglBase as AglBase,
  BaseSemanticAnalyser as BaseSemanticAnalyser,
  BaseSyntaxAnalyser as BaseSyntaxAnalyser,
  BaseCompletionProvider as BaseCompletionProvider,
  ExpressionAbstract as ExpressionAbstract,
  CreateTupleExpressionDefault as CreateTupleExpressionDefault,
  CreateObjectExpressionDefault as CreateObjectExpressionDefault,
  WithExpressionDefault as WithExpressionDefault,
  WhenExpressionDefault as WhenExpressionDefault,
  WhenOptionDefault as WhenOptionDefault,
  WhenOptionElseDefault as WhenOptionElseDefault,
  OnExpressionDefault as OnExpressionDefault,
  RootExpressionDefault as RootExpressionDefault,
  LiteralExpressionDefault as LiteralExpressionDefault,
  NavigationExpressionDefault as NavigationExpressionDefault,
  PropertyCallDefault as PropertyCallDefault,
  MethodCallDefault as MethodCallDefault,
  LambdaExpressionDefault as LambdaExpressionDefault,
  IndexOperationDefault as IndexOperationDefault,
  AssignmentStatementDefault as AssignmentStatementDefault,
  InfixExpressionDefault as InfixExpressionDefault,
  CastExpressionDefault as CastExpressionDefault,
  TypeTestExpressionDefault as TypeTestExpressionDefault,
  TypeReferenceDefault as TypeReferenceDefault,
  GroupExpressionDefault as GroupExpressionDefault,
  AglExpressions as AglExpressions,
  objectInstance as objectInstance,
  constructDataType as constructDataType,
  constructValueType as constructValueType,
  get as get,
  set as set,
  valueOf_1 as valueOf,
  ExpressionTypeResolver as ExpressionTypeResolver,
  ExpressionsCompletionProvider as ExpressionsCompletionProvider,
  EvaluationContext as EvaluationContext,
  ExpressionsInterpreterOverTypedObject as ExpressionsInterpreterOverTypedObject,
  ExpressionsSemanticAnalyser as ExpressionsSemanticAnalyser,
  ExpressionsSyntaxAnalyser as ExpressionsSyntaxAnalyser,
  StdLibPrimitiveExecutions as StdLibPrimitiveExecutions,
  TypedObjectAsmValue as TypedObjectAsmValue,
  StdLibPrimitiveExecutionsForReflection as StdLibPrimitiveExecutionsForReflection,
  TypedObjectAny as TypedObjectAny,
  ObjectGraphByReflection as ObjectGraphByReflection,
  formatModel as formatModel,
  FormatModelBuilder as FormatModelBuilder,
  FormatExpressionBuilder as FormatExpressionBuilder,
  AglFormatModelDefault as AglFormatModelDefault,
  AglFormatNamespaceDefault as AglFormatNamespaceDefault,
  FormatSetReferenceDefault as FormatSetReferenceDefault,
  FormatSetDefault as FormatSetDefault,
  AglFormatRuleDefault as AglFormatRuleDefault,
  FormatExpressionWhenDefault as FormatExpressionWhenDefault,
  FormatWhenOptionDefault as FormatWhenOptionDefault,
  FormatWhenOptionElseDefault as FormatWhenOptionElseDefault,
  FormatExpressionExpressionDefault as FormatExpressionExpressionDefault,
  FormatExpressionTemplateDefault as FormatExpressionTemplateDefault,
  TemplateElementTextDefault as TemplateElementTextDefault,
  TemplateElementExpressionPropertyDefault as TemplateElementExpressionPropertyDefault,
  TemplateElementExpressionListDefault as TemplateElementExpressionListDefault,
  TemplateElementExpressionEmbeddedDefault as TemplateElementExpressionEmbeddedDefault,
  AglFormat as AglFormat,
  AglFormatCompletionProvider as AglFormatCompletionProvider,
  AglFormatSemanticAnalyser as AglFormatSemanticAnalyser,
  FormatterOverAsmSimple as FormatterOverAsmSimple,
  FormatterOverTypedObject as FormatterOverTypedObject,
  GrammarModelDefault as GrammarModelDefault,
  asGrammarModel as asGrammarModel,
  GrammarNamespaceDefault as GrammarNamespaceDefault,
  GrammarDefault as GrammarDefault,
  GrammarReferenceDefault as GrammarReferenceDefault,
  GrammarAbstract as GrammarAbstract,
  GrammarItemAbstract as GrammarItemAbstract,
  GrammarRuleAbstract as GrammarRuleAbstract,
  NormalRuleDefault as NormalRuleDefault,
  OverrideRuleDefault as OverrideRuleDefault,
  PreferenceRuleDefault as PreferenceRuleDefault,
  PreferenceOptionDefault as PreferenceOptionDefault,
  SpineDefault_0 as SpineDefault,
  RuleItemAbstract as RuleItemAbstract,
  ConcatenationDefault as ConcatenationDefault,
  ChoiceAbstract as ChoiceAbstract,
  ChoiceLongestDefault as ChoiceLongestDefault,
  ChoicePriorityDefault as ChoicePriorityDefault,
  ChoiceAmbiguousDefault as ChoiceAmbiguousDefault,
  ConcatenationItemAbstract as ConcatenationItemAbstract,
  OptionalItemDefault as OptionalItemDefault,
  SimpleItemAbstract as SimpleItemAbstract,
  GroupDefault as GroupDefault,
  TangibleItemAbstract as TangibleItemAbstract,
  EmptyRuleDefault as EmptyRuleDefault,
  TerminalDefault as TerminalDefault,
  NonTerminalDefault as NonTerminalDefault,
  EmbeddedDefault as EmbeddedDefault,
  ListOfItemsAbstract as ListOfItemsAbstract,
  SimpleListDefault as SimpleListDefault,
  SeparatedListDefault as SeparatedListDefault,
  Associativity as Associativity,
  ChoiceIndicator as ChoiceIndicator,
  OverrideKind as OverrideKind,
  SeparatedListKind as SeparatedListKind,
  grammarModel as grammarModel,
  grammar as grammar,
  GrammarModelBuilder as GrammarModelBuilder,
  GrammarNamespaceBuilder as GrammarNamespaceBuilder,
  GrammarBuilder as GrammarBuilder,
  GroupChoiceBuilder as GroupChoiceBuilder,
  PreferenceRuleBuilder as PreferenceRuleBuilder,
  AglGrammar as AglGrammar,
  AglGrammarCompletionProvider as AglGrammarCompletionProvider,
  AglGrammarSemanticAnalyser as AglGrammarSemanticAnalyser,
  findTypeForRule as findTypeForRule,
  contextFromGrammar as contextFromGrammar,
  ContextFromGrammarRegistry as ContextFromGrammarRegistry,
  GrammarTypeNamespaceSimple as GrammarTypeNamespaceSimple,
  GrammarTypeNamespaceAbstract as GrammarTypeNamespaceAbstract,
  grammarTypeNamespace as grammarTypeNamespace,
  grammarTypeModel as grammarTypeModel,
  AglCrossReference as AglCrossReference,
  ReferencesCompletionProvider as ReferencesCompletionProvider,
  ReferencesSemanticAnalyser as ReferencesSemanticAnalyser,
  ReferencesSyntaxAnalyser as ReferencesSyntaxAnalyser,
  CrossReferenceModelDefault as CrossReferenceModelDefault,
  CrossReferenceNamespaceDefault as CrossReferenceNamespaceDefault,
  DeclarationsForNamespaceDefault as DeclarationsForNamespaceDefault,
  ScopeDefinitionDefault as ScopeDefinitionDefault,
  IdentifiableDefault as IdentifiableDefault,
  ReferenceDefinitionDefault as ReferenceDefinitionDefault,
  ReferenceExpressionAbstract as ReferenceExpressionAbstract,
  ReferenceExpressionPropertyDefault as ReferenceExpressionPropertyDefault,
  ReferenceExpressionCollectionDefault as ReferenceExpressionCollectionDefault,
  crossReferenceModel as crossReferenceModel,
  CrossReferenceModelBuilder as CrossReferenceModelBuilder,
  DeclarationsForNamespaceBuilder as DeclarationsForNamespaceBuilder,
  ScopeDefinitionBuilder as ScopeDefinitionBuilder,
  ReferenceDefinitionBuilder as ReferenceDefinitionBuilder,
  AglScope as AglScope,
  ItemInScope as ItemInScope,
  ScopeSimple as ScopeSimple,
  AglStyle as AglStyle,
  AglStyleCompletionProvider as AglStyleCompletionProvider,
  AglStyleSemanticAnalyser as AglStyleSemanticAnalyser,
  AglStyleModelDefault as AglStyleModelDefault,
  StyleNamespaceDefault as StyleNamespaceDefault,
  StyleSetReferenceDefault as StyleSetReferenceDefault,
  AglStyleSetDefault as AglStyleSetDefault,
  AglStyleMetaRuleDefault as AglStyleMetaRuleDefault,
  AglStyleTagRuleDefault as AglStyleTagRuleDefault,
  AglStyleSelectorKind as AglStyleSelectorKind,
  AglStyleSelector as AglStyleSelector,
  AglStyleDeclaration as AglStyleDeclaration,
  styleModel as styleModel,
  StyleModelBuilder as StyleModelBuilder,
  StyleNamespaceBuilder as StyleNamespaceBuilder,
  StylesBuilder as StylesBuilder,
  StyleMetaRuleBuilder as StyleMetaRuleBuilder,
  StyleTagRuleBuilder as StyleTagRuleBuilder,
  AsmTransform as AsmTransform,
  AsmTransformCompletionProvider as AsmTransformCompletionProvider,
  AsmTransformInterpreter as AsmTransformInterpreter,
  AsmTransformSemanticAnalyser as AsmTransformSemanticAnalyser,
  AsmTransformSyntaxAnalyser as AsmTransformSyntaxAnalyser,
  TransformDomainDefault as TransformDomainDefault,
  TransformNamespaceDefault as TransformNamespaceDefault,
  TransformRuleSetReferenceDefault as TransformRuleSetReferenceDefault,
  TransformRuleSetDefault as TransformRuleSetDefault,
  TransformationRuleDefault as TransformationRuleDefault,
  asmTransform as asmTransform,
  AsmTransformModelBuilder as AsmTransformModelBuilder,
  AsmTransformNamespaceBuilder as AsmTransformNamespaceBuilder,
  AsmTransformRuleSetBuilder as AsmTransformRuleSetBuilder,
  AssignmentBuilder as AssignmentBuilder,
  StdLibDefault as StdLibDefault,
  TypeModelSimple as TypeModelSimple,
  TypeModelSimpleAbstract as TypeModelSimpleAbstract,
  TypeInstanceAbstract as TypeInstanceAbstract,
  TypeParameterReference as TypeParameterReference,
  TypeArgumentSimple as TypeArgumentSimple,
  TypeInstanceSimple as TypeInstanceSimple,
  TupleTypeInstanceSimple as TupleTypeInstanceSimple,
  TypeNamespaceSimple as TypeNamespaceSimple,
  TypeNamespaceAbstract as TypeNamespaceAbstract,
  TypeParameterSimple as TypeParameterSimple,
  TypeParameterMultiple as TypeParameterMultiple,
  TypeDefinitionSimpleAbstract as TypeDefinitionSimpleAbstract,
  SpecialTypeSimple as SpecialTypeSimple,
  SingletonTypeSimple as SingletonTypeSimple,
  PrimitiveTypeSimple as PrimitiveTypeSimple,
  EnumTypeSimple as EnumTypeSimple,
  UnionTypeSimple as UnionTypeSimple,
  StructuredTypeSimpleAbstract as StructuredTypeSimpleAbstract,
  TypeArgumentNamedSimple as TypeArgumentNamedSimple,
  TupleTypeSimple as TupleTypeSimple,
  ValueTypeSimple as ValueTypeSimple,
  InterfaceTypeSimple as InterfaceTypeSimple,
  DataTypeSimple as DataTypeSimple,
  CollectionTypeSimple as CollectionTypeSimple,
  ConstructorDeclarationSimple as ConstructorDeclarationSimple,
  PropertyDeclarationAbstract as PropertyDeclarationAbstract,
  PropertyDeclarationStored as PropertyDeclarationStored,
  PropertyDeclarationPrimitive as PropertyDeclarationPrimitive,
  PropertyDeclarationDerived as PropertyDeclarationDerived,
  PropertyDeclarationResolvedSimple as PropertyDeclarationResolvedSimple,
  MethodDeclarationAbstract as MethodDeclarationAbstract,
  MethodDeclarationDerivedSimple as MethodDeclarationDerivedSimple,
  MethodDeclarationResolvedSimple as MethodDeclarationResolvedSimple,
  ParameterDefinitionSimple as ParameterDefinitionSimple,
  AglTypes as AglTypes,
  PropertyCharacteristic as PropertyCharacteristic,
  typeModel as typeModel,
  TypeModelBuilder as TypeModelBuilder,
  TypeNamespaceBuilder as TypeNamespaceBuilder,
  StructuredTypeBuilder as StructuredTypeBuilder,
  ValueTypeBuilder as ValueTypeBuilder,
  InterfaceTypeBuilder as InterfaceTypeBuilder,
  DataTypeBuilder as DataTypeBuilder,
  ConstructorBuilder as ConstructorBuilder,
  TypeInstanceArgBuilder as TypeInstanceArgBuilder,
  TypeInstanceArgNamedBuilder as TypeInstanceArgNamedBuilder,
  TypeArgumentBuilder as TypeArgumentBuilder,
  SubtypeListBuilder as SubtypeListBuilder,
};
//endregion

//# sourceMappingURL=net.akehurst.language-agl-processor.mjs.map