diff --git a/src/tests/JIT/Directed/Directed_d.csproj b/src/tests/JIT/Directed/Directed_d.csproj index 65944a198ae2fc..fc2213d756ad44 100644 --- a/src/tests/JIT/Directed/Directed_d.csproj +++ b/src/tests/JIT/Directed/Directed_d.csproj @@ -3,8 +3,6 @@ Full False true - - true diff --git a/src/tests/JIT/Directed/Directed_do.csproj b/src/tests/JIT/Directed/Directed_do.csproj index 02b48ccea5742e..9ef81e4ada860d 100644 --- a/src/tests/JIT/Directed/Directed_do.csproj +++ b/src/tests/JIT/Directed/Directed_do.csproj @@ -3,8 +3,6 @@ Full True true - - true <_UseOutOfProcessPhysicalPromotionTests Condition="'$(TargetsMobile)' != 'true' or ('$(TargetsBrowser)' == 'true' and '$(RuntimeFlavor)' == 'coreclr')">true diff --git a/src/tests/JIT/Directed/Directed_r.csproj b/src/tests/JIT/Directed/Directed_r.csproj index 3fc2ffd54012c9..ad30659efe933c 100644 --- a/src/tests/JIT/Directed/Directed_r.csproj +++ b/src/tests/JIT/Directed/Directed_r.csproj @@ -3,8 +3,6 @@ None False true - - true diff --git a/src/tests/JIT/Directed/Directed_ro.csproj b/src/tests/JIT/Directed/Directed_ro.csproj index 662ad48e6a69d7..2a45dcf6270529 100644 --- a/src/tests/JIT/Directed/Directed_ro.csproj +++ b/src/tests/JIT/Directed/Directed_ro.csproj @@ -3,8 +3,6 @@ None True true - - true diff --git a/src/tests/JIT/HardwareIntrinsics/HardwareIntrinsics_Arm_r.csproj b/src/tests/JIT/HardwareIntrinsics/HardwareIntrinsics_Arm_r.csproj index 1885d5ef329133..aed29001c5e8e8 100644 --- a/src/tests/JIT/HardwareIntrinsics/HardwareIntrinsics_Arm_r.csproj +++ b/src/tests/JIT/HardwareIntrinsics/HardwareIntrinsics_Arm_r.csproj @@ -4,9 +4,6 @@ true - - true - true diff --git a/src/tests/JIT/HardwareIntrinsics/HardwareIntrinsics_Arm_ro.csproj b/src/tests/JIT/HardwareIntrinsics/HardwareIntrinsics_Arm_ro.csproj index 4aa7b1f941c03a..7e0006c3cec031 100644 --- a/src/tests/JIT/HardwareIntrinsics/HardwareIntrinsics_Arm_ro.csproj +++ b/src/tests/JIT/HardwareIntrinsics/HardwareIntrinsics_Arm_ro.csproj @@ -4,9 +4,6 @@ true - - true - true diff --git a/src/tests/JIT/HardwareIntrinsics/X86_Avx512/Avx512F/Avx512F_r.csproj b/src/tests/JIT/HardwareIntrinsics/X86_Avx512/Avx512F/Avx512F_r.csproj index 7dfd49ab54e66e..f71813ac20c237 100644 --- a/src/tests/JIT/HardwareIntrinsics/X86_Avx512/Avx512F/Avx512F_r.csproj +++ b/src/tests/JIT/HardwareIntrinsics/X86_Avx512/Avx512F/Avx512F_r.csproj @@ -2,8 +2,6 @@ X86_Avx512F_r true - - true Embedded diff --git a/src/tests/JIT/HardwareIntrinsics/X86_Avx512/Avx512F/Avx512F_ro.csproj b/src/tests/JIT/HardwareIntrinsics/X86_Avx512/Avx512F/Avx512F_ro.csproj index 5d4779a30ab13c..93c7658d728a7c 100644 --- a/src/tests/JIT/HardwareIntrinsics/X86_Avx512/Avx512F/Avx512F_ro.csproj +++ b/src/tests/JIT/HardwareIntrinsics/X86_Avx512/Avx512F/Avx512F_ro.csproj @@ -2,8 +2,6 @@ X86_Avx512F_ro true - - true Embedded diff --git a/src/tests/JIT/jit64/opt/cse/HugeArray1.csproj b/src/tests/JIT/jit64/opt/cse/HugeArray1.csproj index 475424b7e8e7d3..1015fcfda8755e 100644 --- a/src/tests/JIT/jit64/opt/cse/HugeArray1.csproj +++ b/src/tests/JIT/jit64/opt/cse/HugeArray1.csproj @@ -2,8 +2,6 @@ Full False - - true true diff --git a/src/tests/JIT/jit64/opt/cse/HugeField1.csproj b/src/tests/JIT/jit64/opt/cse/HugeField1.csproj index 5c1f3f2ea0dfc0..58467b877d729c 100644 --- a/src/tests/JIT/jit64/opt/cse/HugeField1.csproj +++ b/src/tests/JIT/jit64/opt/cse/HugeField1.csproj @@ -2,8 +2,6 @@ Full False - - true diff --git a/src/tests/JIT/jit64/opt/cse/HugeField2.csproj b/src/tests/JIT/jit64/opt/cse/HugeField2.csproj index ce96c76a55ddff..c98953ec035a69 100644 --- a/src/tests/JIT/jit64/opt/cse/HugeField2.csproj +++ b/src/tests/JIT/jit64/opt/cse/HugeField2.csproj @@ -5,8 +5,6 @@ Full False - - true diff --git a/src/tests/JIT/jit64/opt/cse/hugeSimpleExpr1.csproj b/src/tests/JIT/jit64/opt/cse/hugeSimpleExpr1.csproj index 3d532636c72dbc..dae88dfe2ff587 100644 --- a/src/tests/JIT/jit64/opt/cse/hugeSimpleExpr1.csproj +++ b/src/tests/JIT/jit64/opt/cse/hugeSimpleExpr1.csproj @@ -2,8 +2,6 @@ Full True - - true diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.BuildImage.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.BuildImage.cs new file mode 100644 index 00000000000000..ab104268eeeaab --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.BuildImage.cs @@ -0,0 +1,801 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Buffers.Binary; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; +using System.Reflection.PortableExecutable; +using System.Runtime.InteropServices; +using System.Security.Cryptography; +using System.Text; +using Antlr4.Runtime; +using Antlr4.Runtime.Misc; + +namespace ILAssembler +{ + internal sealed partial class GrammarActions + { + public (ImmutableArray Diagnostics, CompilationResult? Image) BuildImage() + { + // Default module name to output filename if no .module directive was provided + if (_entityRegistry.Module.Name is null && _options.OutputFileName is not null) + { + _entityRegistry.Module.Name = _options.OutputFileName; + } + + // Apply DebuggableAttribute AFTER all source declarations have been processed, + // so that GetCoreLibAssemblyReference() can find the correct corelib assembly ref + // declared in the source (e.g., System.Runtime) instead of creating a fallback mscorlib. + if (_entityRegistry.Assembly is not null && (_options.Debug || _options.DebugMode is not null)) + { + ApplyDebuggableAttribute(); + } + + Machine requestedMachine = _options.Machine ?? Machine.I386; + Machine machine = requestedMachine == Machine.Unknown ? Machine.I386 : requestedMachine; + if (!(machine is Machine.I386 or Machine.Amd64 or Machine.Arm64)) + { + throw new NotSupportedException($"Target machine '{machine}' is not supported."); + } + + ImmutableArray validatedVTableFixups = + ValidateVTableFixups(machine); + ImmutableArray validatedVTableAssociations = + ValidateVTableAssociations(validatedVTableFixups); + ImmutableArray validatedDataLabelFixups = + ValidateDataLabelFixups(); + ImmutableArray validatedExports = + ValidateExports(validatedVTableAssociations, machine); + + // Return early if there are structural errors that prevent building valid metadata. + // However, allow errors in method bodies (ILA0016-0019) to pass through so we can + // emit the assembly with the errors reported. + // In error-tolerant mode, continue despite errors. + var structuralErrors = _diagnostics.Where(d => d.Severity == DiagnosticSeverity.Error && !IsRecoverableError(d.Id)); + if (structuralErrors.Any() && !_options.ErrorTolerant) + { + return (_diagnostics.ToImmutable(), null); + } + + BlobBuilder ilStream = new(); + Blob mvidFixup = _entityRegistry.WriteContentTo(_metadataBuilder, ilStream, _mappedFieldDataNames, _options.Deterministic); + // MetadataRootBuilder only supports module-wide validation suppression, which is + // required because wrapped GenericParam numbers intentionally violate table ordering. + bool suppressMetadataValidation = + _options.ErrorTolerant && + _diagnostics.Any(diagnostic => diagnostic.Id == DiagnosticIds.TooManyGenericParameters); + MetadataRootBuilder rootBuilder = new( + _metadataBuilder, + _options.MetadataVersion, + suppressValidation: suppressMetadataValidation); + + // Apply command-line overrides + Subsystem subsystem = _options.Subsystem ?? _subsystem; + int fileAlignment = _options.FileAlignment ?? _alignment; + long imageBase = _options.ImageBase ?? _imageBase; + ushort majorSubsystemVersion = _options.SubsystemVersion?.Major ?? 4; + ushort minorSubsystemVersion = _options.SubsystemVersion?.Minor ?? 0; + + // Build DllCharacteristics from options + DllCharacteristics dllCharacteristics = DllCharacteristics.DynamicBase | DllCharacteristics.NxCompatible | DllCharacteristics.NoSeh | DllCharacteristics.TerminalServerAware; + if (_options.AppContainer) + { + dllCharacteristics |= DllCharacteristics.AppContainer; + } + if (_options.HighEntropyVA) + { + dllCharacteristics |= DllCharacteristics.HighEntropyVirtualAddressSpace; + } + if (_options.StripReloc) + { + dllCharacteristics &= ~DllCharacteristics.DynamicBase; + } + + Characteristics imageCharacteristics = Characteristics.ExecutableImage; + if (_options.Dll) + { + imageCharacteristics |= Characteristics.Dll; + } + if (machine == Machine.I386) + { + imageCharacteristics |= Characteristics.Bit32Machine; + } + else if (machine is Machine.Amd64 or Machine.Arm64) + { + imageCharacteristics |= Characteristics.LargeAddressAware; + } + + // Compute stack reserve: command-line option overrides directive, which overrides default + ulong sizeOfStackReserve = (ulong)(_options.StackReserve ?? (_stackReserve != 0 ? _stackReserve : 0x00100000)); + + PEHeaderBuilder header = new( + machine: machine, + fileAlignment: fileAlignment, + imageBase: (ulong)imageBase, + subsystem: subsystem, + majorSubsystemVersion: majorSubsystemVersion, + minorSubsystemVersion: minorSubsystemVersion, + dllCharacteristics: dllCharacteristics, + imageCharacteristics: imageCharacteristics, + sizeOfStackReserve: sizeOfStackReserve); + + MethodDefinitionHandle entryPoint = default; + if (_entityRegistry.EntryPoint is not null) + { + entryPoint = (MethodDefinitionHandle)_entityRegistry.EntryPoint.Handle; + } + + // Build debug directory if we have any debug info + DebugDirectoryBuilder? debugDirectoryBuilder = BuildDebugDirectory(entryPoint, out _); + + Func, BlobContentId>? deterministicIdProvider = _options.Deterministic + ? GetDeterministicContentId + : null; + + // Use custom PE builder if we have vtable fixups, exports, or data label reference fixups + if (validatedVTableFixups.Length > 0 || + validatedExports.Length > 0 || + validatedDataLabelFixups.Length > 0) + { + ImmutableArray vtableFixupInfos = + BuildVTableFixupInfos( + validatedVTableFixups, + validatedVTableAssociations); + ImmutableArray exports = + BuildExportInfos(validatedExports); + + // Apply CorFlags from options or directive + CorFlags corFlags = _options.CorFlags ?? _corflags; + if (_options.Prefer32Bit) + { + corFlags |= CorFlags.Prefers32Bit; + } + + VTableExportPEBuilder peBuilder = new( + header, + rootBuilder, + ilStream, + _mappedFieldData, + _manifestResources, + debugDirectoryBuilder: debugDirectoryBuilder, + entryPoint: entryPoint, + flags: corFlags, + deterministicIdProvider: deterministicIdProvider, + vtableFixups: vtableFixupInfos, + exports: exports, + dataLabelFixups: validatedDataLabelFixups); + + return (_diagnostics.ToImmutable(), new CompilationResult(peBuilder, mvidFixup)); + } + + // Apply CorFlags from options or directive + CorFlags standardCorFlags = _options.CorFlags ?? _corflags; + if (_options.Prefer32Bit) + { + standardCorFlags |= CorFlags.Prefers32Bit; + } + + ManagedPEBuilder standardBuilder = new( + header, + rootBuilder, + ilStream, + _mappedFieldData, + _manifestResources, + flags: standardCorFlags, + entryPoint: entryPoint, + debugDirectoryBuilder: debugDirectoryBuilder, + deterministicIdProvider: deterministicIdProvider); + + return (_diagnostics.ToImmutable(), new CompilationResult(standardBuilder, mvidFixup)); + } + + private static BlobContentId GetDeterministicContentId(IEnumerable content) + { + using IncrementalHash hash = IncrementalHash.CreateHash(HashAlgorithmName.SHA256); + foreach (Blob blob in content) + { + hash.AppendData(blob.GetBytes()); + } + + return BlobContentId.FromHash(hash.GetHashAndReset()); + } + + private ImmutableArray ValidateVTableFixups(Machine machine) + { + if (_vtableFixups.Count == 0) + { + return ImmutableArray.Empty; + } + + var builder = ImmutableArray.CreateBuilder(_vtableFixups.Count); + + for (int i = 0; i < _vtableFixups.Count; i++) + { + VTableFixupDeclaration declaration = _vtableFixups[i]; + if (!declaration.HasValidSlotCount) + { + continue; + } + + VTableFixupSupport.VTableFixupEntry entry = declaration.Entry; + const ushort WidthMask = + VTableFixupSupport.COR_VTABLE_32BIT | + VTableFixupSupport.COR_VTABLE_64BIT; + ushort width = (ushort)(entry.Flags & WidthMask); + ushort expectedWidth = VTableFixupSupport.GetPointerSize(machine) == sizeof(long) + ? VTableFixupSupport.COR_VTABLE_64BIT + : VTableFixupSupport.COR_VTABLE_32BIT; + if (width != expectedWidth) + { + ReportError( + DiagnosticIds.InvalidVTableWidth, + string.Format( + DiagnosticMessageTemplates.InvalidVTableWidth, + width, + machine, + expectedWidth == VTableFixupSupport.COR_VTABLE_64BIT + ? "int64" + : "int32"), + declaration.Context); + continue; + } + + if (!_mappedFieldDataNames.TryGetValue(entry.DataLabel, out int dataOffset)) + { + ReportError( + DiagnosticIds.LabelNotFound, + string.Format(DiagnosticMessageTemplates.LabelNotFound, entry.DataLabel), + declaration.Context); + continue; + } + + int availableBytes = GetAvailableMappedFieldDataBytes(dataOffset); + int requiredBytes = checked( + entry.SlotCount * VTableFixupSupport.GetSlotSize(entry.Flags)); + if (requiredBytes > availableBytes) + { + ReportError( + DiagnosticIds.InsufficientVTableData, + string.Format( + DiagnosticMessageTemplates.InsufficientVTableData, + entry.DataLabel, + availableBytes, + requiredBytes), + declaration.Context); + continue; + } + + builder.Add(new ValidatedVTableFixup(i + 1, entry, dataOffset)); + } + + return builder.ToImmutable(); + } + + private int GetAvailableMappedFieldDataBytes(int dataOffset) + { + int endOffset = _mappedFieldData.Count; + foreach (int otherOffset in _mappedFieldDataNames.Values) + { + if (otherOffset > dataOffset && otherOffset < endOffset) + { + endOffset = otherOffset; + } + } + + return endOffset - dataOffset; + } + + private ImmutableArray ValidateDataLabelFixups() + { + var builder = + ImmutableArray.CreateBuilder( + _mappedFieldDataReferenceFixups.Count); + + foreach (CILParser.DataLabelReferenceValue reference in _mappedFieldDataReferenceFixups) + { + if (!_mappedFieldDataNames.TryGetValue(reference.TargetLabel, out int targetOffset)) + { + ReportError( + DiagnosticIds.LabelNotFound, + string.Format( + DiagnosticMessageTemplates.LabelNotFound, + reference.TargetLabel), + reference.Location); + continue; + } + + builder.Add(new VTableExportPEBuilder.DataLabelFixup( + reference.DataOffset, + targetOffset, + reference.PointerSize)); + } + + return builder.ToImmutable(); + } + + private ImmutableArray ValidateVTableAssociations( + ImmutableArray validatedVTableFixups) + { + var fixupsByOriginalIndex = new Dictionary( + validatedVTableFixups.Length); + for (int i = 0; i < validatedVTableFixups.Length; i++) + { + fixupsByOriginalIndex.Add( + validatedVTableFixups[i].OriginalIndex, + (i + 1, validatedVTableFixups[i])); + } + + var builder = ImmutableArray.CreateBuilder(); + foreach (EntityRegistry.MethodDefinitionEntity method in GetParsedMethods()) + { + if (!_vtableEntryDirectiveContexts.TryGetValue(method, out ParserRuleContext? context)) + { + continue; + } + + if (!fixupsByOriginalIndex.TryGetValue( + method.VTableEntry, + out (int SerializedIndex, ValidatedVTableFixup Fixup) fixup)) + { + ReportError( + DiagnosticIds.InvalidVTableEntry, + string.Format( + DiagnosticMessageTemplates.InvalidVTableEntry, + method.Name, + method.VTableEntry), + context); + continue; + } + + if (method.VTableSlot <= 0 || method.VTableSlot > fixup.Fixup.Entry.SlotCount) + { + ReportError( + DiagnosticIds.InvalidVTableEntry, + string.Format( + DiagnosticMessageTemplates.InvalidVTableSlot, + method.Name, + method.VTableSlot, + method.VTableEntry, + fixup.Fixup.Entry.SlotCount), + context); + continue; + } + + builder.Add(new ValidatedVTableAssociation(method, fixup.SerializedIndex)); + } + + return builder.ToImmutable(); + } + + private ImmutableArray ValidateExports( + ImmutableArray validatedVTableAssociations, + Machine machine) + { + if (_vtableFixups.Count == 0) + { + return ImmutableArray.Empty; + } + + var associationsByMethod = + new Dictionary( + validatedVTableAssociations.Length); + foreach (ValidatedVTableAssociation association in validatedVTableAssociations) + { + associationsByMethod.Add(association.Method, association); + } + + var candidates = ImmutableArray.CreateBuilder(); + foreach (EntityRegistry.MethodDefinitionEntity method in GetParsedMethods()) + { + if (method.ExportOrdinal < 0) + { + continue; + } + + ParserRuleContext context = _exportDirectiveContexts[method]; + string exportName = method.ExportAlias ?? method.Name; + if (!VTableExportPEBuilder.IsExportMachineSupported(machine)) + { + ReportError( + DiagnosticIds.UnsupportedNativeExportMachine, + string.Format( + DiagnosticMessageTemplates.UnsupportedNativeExportMachine, + machine), + context); + continue; + } + + if (!associationsByMethod.TryGetValue( + method, + out ValidatedVTableAssociation association)) + { + if (!_vtableEntryDirectiveContexts.ContainsKey(method)) + { + ReportError( + DiagnosticIds.InvalidVTableExport, + string.Format( + DiagnosticMessageTemplates.InvalidVTableExport, + exportName), + context); + } + + continue; + } + + candidates.Add(new ValidatedExport(method, association.VTableEntryIndex)); + } + + if (candidates.Count == 0) + { + return ImmutableArray.Empty; + } + + var exportsByOrdinal = new Dictionary(); + var nonConflictingExports = ImmutableArray.CreateBuilder(candidates.Count); + foreach (ValidatedExport export in candidates) + { + if (exportsByOrdinal.TryGetValue( + export.Method.ExportOrdinal, + out ValidatedExport existingExport) && + (existingExport.VTableEntryIndex != export.VTableEntryIndex || + existingExport.Method.VTableSlot != export.Method.VTableSlot)) + { + ReportError( + DiagnosticIds.DuplicateExportOrdinal, + string.Format( + DiagnosticMessageTemplates.DuplicateExportOrdinal, + export.Method.ExportAlias ?? export.Method.Name, + export.Method.ExportOrdinal), + _exportDirectiveContexts[export.Method]); + continue; + } + + exportsByOrdinal.TryAdd(export.Method.ExportOrdinal, export); + nonConflictingExports.Add(export); + } + + int baseOrdinal = nonConflictingExports.Min(export => export.Method.ExportOrdinal); + var validatedExports = + ImmutableArray.CreateBuilder(nonConflictingExports.Count); + foreach (ValidatedExport export in nonConflictingExports) + { + long ordinalIndex = (long)export.Method.ExportOrdinal - baseOrdinal; + if (ordinalIndex > ushort.MaxValue) + { + ReportError( + DiagnosticIds.ExportOrdinalRangeTooLarge, + string.Format( + DiagnosticMessageTemplates.ExportOrdinalRangeTooLarge, + export.Method.ExportOrdinal, + baseOrdinal, + ushort.MaxValue), + _exportDirectiveContexts[export.Method]); + continue; + } + + validatedExports.Add(export); + } + + return validatedExports.ToImmutable(); + } + + private static ImmutableArray BuildVTableFixupInfos( + ImmutableArray validatedVTableFixups, + ImmutableArray validatedVTableAssociations) + { + var builder = + ImmutableArray.CreateBuilder( + validatedVTableFixups.Length); + + for (int i = 0; i < validatedVTableFixups.Length; i++) + { + ValidatedVTableFixup fixup = validatedVTableFixups[i]; + var methodTokens = ImmutableArray.CreateBuilder(fixup.Entry.SlotCount); + methodTokens.Count = fixup.Entry.SlotCount; + + foreach (ValidatedVTableAssociation association in validatedVTableAssociations) + { + if (association.VTableEntryIndex == i + 1) + { + methodTokens[association.Method.VTableSlot - 1] = + MetadataTokens.GetToken(association.Method.Handle); + } + } + + builder.Add(new VTableExportPEBuilder.VTableFixupInfo( + fixup.DataOffset, + fixup.Entry.SlotCount, + fixup.Entry.Flags, + methodTokens.MoveToImmutable())); + } + + return builder.MoveToImmutable(); + } + + private static ImmutableArray BuildExportInfos( + ImmutableArray validatedExports) + { + var builder = + ImmutableArray.CreateBuilder( + validatedExports.Length); + + foreach (ValidatedExport export in validatedExports) + { + builder.Add(new VTableExportPEBuilder.ExportInfo( + export.Method.ExportOrdinal, + export.Method.ExportAlias ?? export.Method.Name, + export.VTableEntryIndex, + export.Method.VTableSlot)); + } + + return builder.MoveToImmutable(); + } + + private IEnumerable GetParsedMethods() + { + foreach (EntityRegistry.TypeDefinitionEntity type in _entityRegistry.GetSeenEntities(TableIndex.TypeDef)) + { + foreach (EntityRegistry.MethodDefinitionEntity method in type.Methods) + { + yield return method; + } + } + } + + private DebugDirectoryBuilder? BuildDebugDirectory(MethodDefinitionHandle entryPoint, out int debugDataSize) + { + debugDataSize = 0; + + // Check if we have any methods with debug info + bool hasDebugInfo = false; + foreach (var entity in _entityRegistry.GetSeenEntities(TableIndex.MethodDef)) + { + if (entity is EntityRegistry.MethodDefinitionEntity method && + method.DebugInfo.SequencePoints.Count > 0) + { + hasDebugInfo = true; + break; + } + } + + // Generate PDB if we have debug info OR if --debug/--pdb options are set + bool generatePdb = hasDebugInfo || _options.Debug || _options.Pdb; + if (!generatePdb) + { + return null; + } + + // Build PDB metadata + BuildPdbMetadata(); + + // Get row counts from main metadata for the portable PDB + var typeSystemRowCounts = _metadataBuilder.GetRowCounts(); + + Func, BlobContentId> pdbIdProvider = _options.Deterministic + ? GetDeterministicContentId + : _ => new BlobContentId(Guid.NewGuid(), 0x04030201); + + // Create the portable PDB + var pdbBuilder = new PortablePdbBuilder( + _pdbBuilder, + typeSystemRowCounts, + entryPoint, + idProvider: pdbIdProvider); + + var pdbBlob = new BlobBuilder(); + var pdbContentId = pdbBuilder.Serialize(pdbBlob); + + // Create debug directory with embedded PDB + var debugDirectoryBuilder = new DebugDirectoryBuilder(); + debugDirectoryBuilder.AddCodeViewEntry( + $"assembly.pdb", + pdbContentId, + pdbBuilder.FormatVersion); + debugDirectoryBuilder.AddEmbeddedPortablePdbEntry(pdbBlob, pdbBuilder.FormatVersion); + + // Calculate debug data size: + // 2 debug directory entries (28 bytes each) + CodeView data (~24 bytes) + Embedded PDB data (compressed pdbBlob + 8 header) + // CodeView entry: signature (4) + guid (16) + age (4) + path (variable, ~12 for "assembly.pdb\0") + const int debugDirEntrySize = 28; + int codeViewDataSize = 4 + 16 + 4 + "assembly.pdb".Length + 1; // signature + guid + age + path + null + int embeddedPdbHeaderSize = 8; // MPDB signature (4) + uncompressed size (4) + // The embedded PDB is compressed, estimate conservatively as same size + int embeddedPdbDataSize = embeddedPdbHeaderSize + pdbBlob.Count; + + debugDataSize = (2 * debugDirEntrySize) + codeViewDataSize + embeddedPdbDataSize; + + return debugDirectoryBuilder; + } + + private void BuildPdbMetadata() + { + // Add documents and sequence points to the PDB metadata builder + foreach (var entity in _entityRegistry.GetSeenEntities(TableIndex.MethodDef)) + { + if (entity is not EntityRegistry.MethodDefinitionEntity method) + { + continue; + } + + var debugInfo = method.DebugInfo; + if (debugInfo.SequencePoints.Count == 0) + { + // Add empty debug info entry for methods without sequence points + _pdbBuilder.AddMethodDebugInformation(default, default); + continue; + } + + // Get or create document handle + DocumentHandle documentHandle = default; + if (debugInfo.DocumentPath is not null) + { + (string Path, Guid LanguageGuid) documentKey = + (debugInfo.DocumentPath, debugInfo.LanguageGuid); + if (!_documentHandles.TryGetValue(documentKey, out documentHandle)) + { + var nameHandle = _pdbBuilder.GetOrAddDocumentName(debugInfo.DocumentPath); + var languageGuidHandle = debugInfo.LanguageGuid != Guid.Empty + ? _pdbBuilder.GetOrAddGuid(debugInfo.LanguageGuid) + : default; + documentHandle = _pdbBuilder.AddDocument( + nameHandle, + default, // hash algorithm + default, // hash + languageGuidHandle); + _documentHandles[documentKey] = documentHandle; + } + } + + // Encode sequence points + var sequencePointsBlob = EncodeSequencePoints(debugInfo.SequencePoints); + var sequencePointsBlobHandle = _pdbBuilder.GetOrAddBlob(sequencePointsBlob); + + _pdbBuilder.AddMethodDebugInformation(documentHandle, sequencePointsBlobHandle); + } + } + + private static BlobBuilder EncodeSequencePoints(List sequencePoints) + { + var builder = new BlobBuilder(); + + if (sequencePoints.Count == 0) + { + return builder; + } + + // LocalSignature (not used here, write 0) + builder.WriteCompressedInteger(0); + + int previousOffset = 0; + int previousStartLine = -1; + int previousStartColumn = -1; + + foreach (var sp in sequencePoints) + { + // IL offset delta + int offsetDelta = sp.ILOffset - previousOffset; + builder.WriteCompressedInteger(offsetDelta); + previousOffset = sp.ILOffset; + + if (sp.IsHidden) + { + // Hidden sequence point: delta lines = 0, delta columns = 0 + builder.WriteCompressedInteger(0); + builder.WriteCompressedInteger(0); + } + else + { + // Delta lines + int deltaLines = sp.EndLine - sp.StartLine; + builder.WriteCompressedInteger(deltaLines); + + // Delta columns + int deltaColumns = sp.EndColumn - sp.StartColumn; + if (deltaLines == 0) + { + builder.WriteCompressedInteger(deltaColumns); + } + else + { + builder.WriteCompressedSignedInteger(deltaColumns); + } + + // Start line delta (signed) + if (previousStartLine < 0) + { + builder.WriteCompressedInteger(sp.StartLine); + } + else + { + builder.WriteCompressedSignedInteger(sp.StartLine - previousStartLine); + } + + // Start column delta (signed) + if (previousStartColumn < 0) + { + builder.WriteCompressedInteger(sp.StartColumn); + } + else + { + builder.WriteCompressedSignedInteger(sp.StartColumn - previousStartColumn); + } + + previousStartLine = sp.StartLine; + previousStartColumn = sp.StartColumn; + } + } + + return builder; + } + + /// + /// Add DebuggableAttribute to the assembly based on debug options. + /// - /DEBUG: 0x101 = Default | DisableOptimizations + /// - /DEBUG=OPT: 0x03 = Default | IgnoreSymbolStoreSequencePoints + /// - /DEBUG=IMPL: 0x103 = Default | DisableOptimizations | EnableEditAndContinue + /// + private void ApplyDebuggableAttribute() + { + if (_entityRegistry.Assembly is null) + { + return; + } + + // DebuggingModes enum values from System.Diagnostics.DebuggableAttribute: + // None = 0x00, Default = 0x01, IgnoreSymbolStoreSequencePoints = 0x02, + // EnableEditAndContinue = 0x04, DisableOptimizations = 0x100 + const int DebuggingModesDefault = 0x101; // Default | DisableOptimizations + const int DebuggingModesOpt = 0x03; // Default | IgnoreSymbolStoreSequencePoints + const int DebuggingModesImpl = 0x103; // Default | DisableOptimizations | EnableEditAndContinue + + int debuggingModes = _options.DebugMode switch + { + DebugMode.Opt => DebuggingModesOpt, + DebugMode.Impl => DebuggingModesImpl, + _ => DebuggingModesDefault + }; + + // Get reference to core library + var coreAsmRef = _entityRegistry.GetCoreLibAssemblyReference(); + + // Create reference to System.Diagnostics.DebuggableAttribute + var debuggableAttrType = _entityRegistry.GetOrCreateTypeReference( + coreAsmRef, + new TypeName(null, "System.Diagnostics.DebuggableAttribute")); + + // Create reference to nested type DebuggingModes + var debuggingModesType = _entityRegistry.GetOrCreateTypeReference( + debuggableAttrType, + new TypeName(null, "DebuggingModes")); + + // Create constructor signature: .ctor(DebuggingModes) + BlobBuilder ctorSig = new(); + var sigEncoder = new BlobEncoder(ctorSig); + sigEncoder.MethodSignature(SignatureCallingConvention.Default, 0, isInstanceMethod: true) + .Parameters(1, + returnType => returnType.Void(), + parameters => parameters.AddParameter().Type().Type(debuggingModesType.Handle, isValueType: true)); + + var ctor = _entityRegistry.CreateLazilyRecordedMemberReference(debuggableAttrType, ".ctor", ctorSig); + + // Create custom attribute blob: prolog (0x0001) + int32 value + named args count (0x0000) + BlobBuilder attrValue = new(); + attrValue.WriteUInt16(0x0001); // Prolog + attrValue.WriteInt32(debuggingModes); // DebuggingModes value + attrValue.WriteUInt16(0x0000); // No named arguments + + // Create and attach the custom attribute + var customAttr = _entityRegistry.CreateCustomAttribute(ctor, attrValue); + customAttr.Owner = _entityRegistry.Assembly; + } + + } +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Bytes.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Bytes.cs new file mode 100644 index 00000000000000..50ea76d4ff2830 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Bytes.cs @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Immutable; +using System.Globalization; +using Antlr4.Runtime; + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. + internal ImmutableArray.Builder CreateByteAccumulator() + => ImmutableArray.CreateBuilder(); + + internal void AddByte(ImmutableArray.Builder accumulator, byte value) + => accumulator.Add(value); + + internal ImmutableArray EndBytes(ImmutableArray.Builder accumulator) + => accumulator.DrainToImmutable(); +#pragma warning restore CA1822 + + /// + /// Parses a single hexbyte token. + /// + internal static byte ParseHexbyte(IToken token) + { + // hexbyte can be HEXBYTE, INT32, or ID token (due to lexer ambiguity). + ReadOnlySpan text = token.Text.AsSpan(); + bool isNegative = text.StartsWith("-"); + if (isNegative) + { + text = text.Slice(1); + } + + if (text.StartsWith("0x")) + { + text = text.Slice(2); + } + + if (!uint.TryParse( + text, + NumberStyles.AllowHexSpecifier, + CultureInfo.InvariantCulture, + out uint value)) + { + return 0; + } + + if (isNegative) + { + value = unchecked(0u - value); + } + + return (byte)(value & byte.MaxValue); + } + +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Conversions.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Conversions.cs new file mode 100644 index 00000000000000..aa20dedaf531ea --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Conversions.cs @@ -0,0 +1,229 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Buffers.Binary; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; +using System.Reflection.PortableExecutable; +using System.Runtime.InteropServices; +using System.Security.Cryptography; +using System.Text; +using Antlr4.Runtime; +using Antlr4.Runtime.Misc; + +namespace ILAssembler +{ + internal sealed partial class GrammarActions + { + private const int MaximumGenericParameterCount = ushort.MaxValue + 1; + private readonly ImmutableArray.Builder _diagnostics = ImmutableArray.CreateBuilder(); + private readonly EntityRegistry _entityRegistry = new(); + private readonly IReadOnlyDictionary _documents; + private readonly Options _options; + private readonly MetadataBuilder _metadataBuilder = new(); + private readonly Func _resourceLocator; + + // Record the mapped field data directly into the blob to ensure we preserve ordering + private readonly BlobBuilder _mappedFieldData = new(); + private readonly Dictionary _mappedFieldDataNames = new(); + private readonly List _mappedFieldDataReferenceFixups = new(); + private readonly BlobBuilder _manifestResources = new(); + private int _syntaxErrorCount; + + // Debug info tracking + private Guid _currentLanguageGuid = Guid.Empty; + private Guid _currentLanguageVendorGuid = Guid.Empty; + private Guid _currentDocumentTypeGuid = Guid.Empty; + private string? _currentDocumentPath; + private readonly Dictionary<(string Path, Guid LanguageGuid), DocumentHandle> _documentHandles = new(); + private readonly MetadataBuilder _pdbBuilder = new(); + private readonly List _vtableFixups = new(); + private readonly Dictionary _exportDirectiveContexts = new(); + private readonly Dictionary _vtableEntryDirectiveContexts = new(); + + internal GrammarActions(IReadOnlyDictionary documents, Options options, Func resourceLocator) + { + _documents = documents; + _options = options; + _resourceLocator = resourceLocator; + } + + private sealed record VTableFixupDeclaration( + VTableFixupSupport.VTableFixupEntry Entry, + CILParser.VtfixupDeclContext Context, + bool HasValidSlotCount); + + private readonly record struct ValidatedVTableFixup( + int OriginalIndex, + VTableFixupSupport.VTableFixupEntry Entry, + int DataOffset); + + private readonly record struct ValidatedVTableAssociation( + EntityRegistry.MethodDefinitionEntity Method, + int VTableEntryIndex); + + private readonly record struct ValidatedExport( + EntityRegistry.MethodDefinitionEntity Method, + int VTableEntryIndex); + + private void ReportDiagnostic(DiagnosticSeverity severity, string id, string message, Antlr4.Runtime.ParserRuleContext context) + { + var location = Location.From(context.Start, _documents); + _diagnostics.Add(new Diagnostic(id, severity, message, location)); + } + + private void ReportError(string id, string message, Antlr4.Runtime.ParserRuleContext context) + => ReportDiagnostic(DiagnosticSeverity.Error, id, message, context); + + private void ReportGenericParameterEncodingErrors( + ImmutableArray genericParameters, + ParserRuleContext context) + { + if (genericParameters.Length <= MaximumGenericParameterCount) + { + return; + } + + ReportError( + DiagnosticIds.TooManyGenericParameters, + string.Format( + DiagnosticMessageTemplates.TooManyGenericParameters, + genericParameters.Length, + MaximumGenericParameterCount), + genericParameters[MaximumGenericParameterCount].Location ?? context.Start); + + for (int i = MaximumGenericParameterCount; i < genericParameters.Length; i++) + { + GenericParameterDeclarationValue parameter = genericParameters[i]; + if (parameter.Constraints.IsEmpty) + { + continue; + } + + ReportError( + DiagnosticIds.GenericParameterConstraintOwnerOutOfRange, + string.Format( + DiagnosticMessageTemplates.GenericParameterConstraintOwnerOutOfRange, + i, + ushort.MaxValue), + parameter.ConstraintLocation ?? parameter.Location ?? context.Start); + } + } + + private void ReportError(string id, string message, IToken token) + { + _diagnostics.Add(new Diagnostic( + id, + DiagnosticSeverity.Error, + message, + Location.From(token, _documents))); + } + + private void ReportWarning(string id, string message, Antlr4.Runtime.ParserRuleContext context) + => ReportDiagnostic(DiagnosticSeverity.Warning, id, message, context); + + private void ReportWarning(string id, string message, IToken token) + { + _diagnostics.Add(new Diagnostic( + id, + DiagnosticSeverity.Warning, + message, + Location.From(token, _documents))); + } + + internal void RecordSyntaxError() => _syntaxErrorCount++; + + internal int SyntaxErrorCount => _syntaxErrorCount; + + internal bool HasSyntaxErrorsSince(int initialSyntaxErrorCount) + => initialSyntaxErrorCount != _syntaxErrorCount; + + private static T ApplyAttribute( + T current, + CILParser.AttributeValue attribute) + where T : struct, Enum + { + if (!attribute.ShouldAppend) + { + return attribute.Value; + } + + int currentValue = Convert.ToInt32(current); + int groupMask = Convert.ToInt32(attribute.GroupMask); + int attributeValue = Convert.ToInt32(attribute.Value); + return (T)Enum.ToObject( + typeof(T), + (currentValue & ~groupMask) | attributeValue); + } + + private static bool IsRecoverableError(string diagnosticId) + { + // Method body and signature diagnostics are recoverable - we emit the assembly but report the error. + // This matches native ilasm behavior where errors during method/field emission don't prevent + // the assembly from being written when the /ERR (OnErrGo) flag is set. + return diagnosticId is DiagnosticIds.ByteArrayTooShort + or DiagnosticIds.ArgumentNotFound + or DiagnosticIds.LocalNotFound + or DiagnosticIds.LabelNotFound + or DiagnosticIds.GenericParameterIndexOutOfRange + or DiagnosticIds.ParameterIndexOutOfRange + or DiagnosticIds.GenericParameterNotFound + or DiagnosticIds.UnknownGenericParameter + or DiagnosticIds.MissingInstanceCallConv; + } + + private sealed class CurrentMethodContext + { + public CurrentMethodContext(EntityRegistry.MethodDefinitionEntity definition) + { + Definition = definition; + // Populate argument names from the method's parameter definitions + foreach (var param in definition.Parameters) + { + if (param.Name is not null && param.Sequence > 0) + { + ArgumentNames[param.Name] = param.Sequence - 1; + } + } + } + + public EntityRegistry.MethodDefinitionEntity Definition { get; } + + public Dictionary Labels { get; } = new(); + + public Dictionary UndefinedLabelReferences { get; } = new(); + + public Dictionary ArgumentNames { get; } = new(); + + public List> LocalsScopes { get; } = new(); + + public List AllLocals { get; } = new(); + } + + private CurrentMethodContext? _currentMethod; + private EntityRegistry.FieldDefinitionEntity? _lastFieldDefinition; + private EntityRegistry.EntityBase? _pendingClassCustomAttributeOwner; + + private const ushort CustomAttributeBlobFormatVersion = 1; + + // These stacks are the active nested compiler scopes, not parser-value accumulators. + private readonly Stack _currentNamespace = new(); + private readonly Stack _currentTypeDefinition = new(); + + private bool _expectInstance; + private Subsystem _subsystem = Subsystem.WindowsCui; + private CorFlags _corflags = CorFlags.ILOnly; + private int _alignment = 0x200; + private long _imageBase = 0x00400000; + private long _stackReserve; + + } +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.CustomAttributes.Actions.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.CustomAttributes.Actions.cs new file mode 100644 index 00000000000000..f6263647ff62d0 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.CustomAttributes.Actions.cs @@ -0,0 +1,226 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using System.Reflection.Metadata; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal MethodReferenceValue CreateCustomAttributeType(MethodReferenceValue constructor) + => constructor; + + internal CustomAttributeDescriptorValue CreateDefaultCustomAttribute( + MethodReferenceValue constructor) + => CreateCustomAttributeDescriptor( + constructor, + new RawCustomAttributeBlobValue(CreateDefaultCustomAttributeBlob()), + null); + + internal CustomAttributeDescriptorValue CreateStringCustomAttribute( + MethodReferenceValue constructor, + string value) + => CreateCustomAttributeDescriptor( + constructor, + new RawCustomAttributeBlobValue(CreateStringBlob(value)), + null); + + internal CustomAttributeDescriptorValue CreateStructuredCustomAttribute( + MethodReferenceValue constructor, + CustomAttributeBlobValue value) + => CreateCustomAttributeDescriptor( + constructor, + value, + null); + + internal CustomAttributeDescriptorValue CreateRawCustomAttribute( + MethodReferenceValue constructor, + ImmutableArray value) + => CreateCustomAttributeDescriptor( + constructor, + new RawCustomAttributeBlobValue(CreateRawBlob(value)), + null); + + internal CustomAttributeDescriptorValue CreateDefaultOwnedCustomAttribute( + OwnerTypeValue owner, + MethodReferenceValue constructor) + => CreateCustomAttributeDescriptor( + constructor, + new RawCustomAttributeBlobValue(CreateDefaultCustomAttributeBlob()), + owner); + + internal CustomAttributeDescriptorValue CreateStringOwnedCustomAttribute( + OwnerTypeValue owner, + MethodReferenceValue constructor, + string value) + => CreateCustomAttributeDescriptor( + constructor, + new RawCustomAttributeBlobValue(CreateStringBlob(value)), + owner); + + internal CustomAttributeDescriptorValue CreateStructuredOwnedCustomAttribute( + OwnerTypeValue owner, + MethodReferenceValue constructor, + CustomAttributeBlobValue value) + => CreateCustomAttributeDescriptor( + constructor, + value, + owner); + + internal CustomAttributeDescriptorValue CreateRawOwnedCustomAttribute( + OwnerTypeValue owner, + MethodReferenceValue constructor, + ImmutableArray value) + => CreateCustomAttributeDescriptor( + constructor, + new RawCustomAttributeBlobValue(CreateRawBlob(value)), + owner); + + internal CustomAttributeDeclarationValue CreateCustomAttributeDeclaration( + CustomAttributeDescriptorValue value) + => value; + + internal CustomAttributeDeclarationValue CreateCustomAttributeTypedef(string alias) + => new CustomAttributeTypedefValue(alias); + + private static CustomAttributeDescriptorValue CreateCustomAttributeDescriptor( + MethodReferenceValue constructor, + CustomAttributeBlobValue value, + OwnerTypeValue? owner) + => new(constructor, value, owner); + + private static BlobBuilder CreateStringBlob(string value) + { + BlobBuilder blob = new(); + blob.WriteUTF8(value); + return blob; + } + + private static BlobBuilder CreateRawBlob(ImmutableArray value) + { + BlobBuilder blob = new(value.Length); + blob.WriteBytes(value); + return blob; + } + + private static BlobBuilder CreateDefaultCustomAttributeBlob() + { + BlobBuilder value = new(); + value.WriteUInt16(CustomAttributeBlobFormatVersion); + value.WriteUInt16(0); + return value; + } + + internal CustomAttributeBlobValue CreateCustomAttributeBlob( + ImmutableArray arguments, + ImmutableArray namedArguments) + => new StructuredCustomAttributeBlobValue(arguments, namedArguments); + + internal CustomAttributeNamedArgumentValue CreateCustomBlobNamedArgument( + byte kind, + SerializationTypeValue type, + string name, + SerializedInitializerValue value) + => new(kind, type, name, value); + + private BlobBuilder MaterializeCustomAttributeBlob(CustomAttributeBlobValue value) + { + if (value is RawCustomAttributeBlobValue raw) + { + return raw.Value; + } + + if (value is not StructuredCustomAttributeBlobValue structured) + { + return new BlobBuilder(); + } + + BlobBuilder result = new(); + result.WriteUInt16(CustomAttributeBlobFormatVersion); + foreach (SerializedInitializerValue argument in structured.Arguments) + { + MaterializeSerializedInitializer(argument).WriteContentTo(result); + } + + WriteCustomBlobNamedArguments(result, structured.NamedArguments); + return result; + } + + private void WriteCustomBlobNamedArguments( + BlobBuilder result, + ImmutableArray namedArguments) + { + result.WriteInt16((short)namedArguments.Length); + foreach (CustomAttributeNamedArgumentValue argument in namedArguments) + { + result.WriteByte(argument.Kind); + MaterializeSerializationType(argument.Type).WriteContentTo(result); + result.WriteSerializedString(argument.Name); + MaterializeSerializedInitializer(argument.Value).WriteContentTo(result); + } + } + + private EntityRegistry.CustomAttributeEntity MaterializeCustomAttribute( + CustomAttributeDescriptorValue descriptor) + { + EntityRegistry.EntityBase constructor = MaterializeMethodReference(descriptor.Constructor); + BlobBuilder value = MaterializeCustomAttributeBlob(descriptor.Value); + EntityRegistry.CustomAttributeEntity attribute = + _entityRegistry.CreateCustomAttribute(constructor, value); + if (descriptor.Owner is { } owner) + { + attribute.Owner = MaterializeOwnerType(owner); + } + + return attribute; + } + + private EntityRegistry.CustomAttributeEntity? MaterializeCustomAttributeDeclaration( + CustomAttributeDeclarationValue? value, + IToken location) + { + if (value is CustomAttributeTypedefValue typedef) + { + if (TryResolveTypedefAsCustomAttribute(typedef.Alias) is not { } resolved) + { + ReportError( + DiagnosticIds.TypedefNotFound, + string.Format(DiagnosticMessageTemplates.TypedefNotFound, typedef.Alias), + location); + return null; + } + + EntityRegistry.CustomAttributeEntity typedefAttribute = + _entityRegistry.CreateCustomAttribute(resolved.Constructor, resolved.Value); + typedefAttribute.Owner = resolved.Owner; + return typedefAttribute; + } + + if (value is not CustomAttributeDescriptorValue descriptor) + { + return null; + } + + EntityRegistry.CustomAttributeEntity attribute = MaterializeCustomAttribute(descriptor); + return descriptor.Owner is null ? attribute : null; + } + + internal EntityRegistry.CustomAttributeEntity? MaterializeCustomAttributeDeclaration( + CILParser.CustomAttrDeclContext context) + => MaterializeCustomAttributeDeclaration(context.Value, context.Start); + + internal EntityRegistry.CustomAttributeEntity MaterializeCustomAttributeDescriptor( + CILParser.CustomDescrContext context) + => MaterializeCustomAttribute(context.Value); + + internal EntityRegistry.CustomAttributeEntity? MaterializeMethodBodyCustomAttributeDeclaration( + CILParser.CustomDescrInMethodBodyContext context) + => MaterializeCustomAttributeDeclaration(context.Value, context.Start); + + internal EntityRegistry.EntityBase MaterializeOwnerType( + CILParser.OwnerTypeContext context) + => MaterializeOwnerType(context.Value); +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.CustomAttributes.Sequences.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.CustomAttributes.Sequences.cs new file mode 100644 index 00000000000000..06c356deb44c33 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.CustomAttributes.Sequences.cs @@ -0,0 +1,100 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Reflection.Metadata; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal void AddFloat32SequenceValue(BlobBuilder builder, double value) + => builder.WriteSingle((float)value); + + internal void AddFloat32SequenceValue(BlobBuilder builder, IToken value) + => builder.WriteSingle(ParseInt32(value)); + + internal void AddFloat64SequenceValue(BlobBuilder builder, double value) + => builder.WriteDouble(value); + + internal void AddFloat64SequenceValue(BlobBuilder builder, IToken value) + => builder.WriteDouble(ParseInt64(value)); + + internal void AddInt64SequenceValue(BlobBuilder builder, IToken value) + => builder.WriteInt64(ParseInt64(value)); + + internal void AddInt32SequenceValue(BlobBuilder builder, IToken value) + => builder.WriteInt32(ParseInt32(value)); + + internal void AddInt16SequenceValue(BlobBuilder builder, IToken value) + => builder.WriteInt16((short)ParseInt32(value)); + + internal void AddInt8SequenceValue(BlobBuilder builder, IToken value) + => builder.WriteByte((byte)ParseInt32(value)); + + internal void AddBooleanSequenceValue(BlobBuilder builder, bool value) + => builder.WriteBoolean(value); + + internal void AddStringSequenceValue(BlobBuilder builder, IToken value) + => builder.WriteSerializedString( + value.Type == CILParser.NULLREF + ? null + : StringHelpers.ParseQuotedString(value.Text)); + + internal ClassSequenceElementValue CreateNullClassSequenceValue() + => new StringClassSequenceElementValue(null); + + internal ClassSequenceElementValue CreateQuotedClassSequenceValue(IToken value) + => new StringClassSequenceElementValue(StringHelpers.ParseQuotedString(value.Text)); + + internal ClassSequenceElementValue CreateClassSequenceValue(ClassNameValue className) + => new TypeClassSequenceElementValue(className); + + private BlobBuilder MaterializeSerializedSequence(SerializedSequenceValue sequence) + { + if (sequence is RawSerializedSequenceValue raw) + { + return raw.Value; + } + + BlobBuilder blob = new(); + switch (sequence) + { + case ClassSerializedSequenceValue classes: + foreach (ClassSequenceElementValue value in classes.Values) + { + MaterializeClassSequenceElement(value).WriteContentTo(blob); + } + break; + case ObjectSerializedSequenceValue objects: + foreach (SerializedInitializerValue value in objects.Values) + { + SerializedInitializerValue initializer = value; + while (initializer is ObjectSerializedInitializerValue boxed) + { + initializer = boxed.Value; + } + + MaterializeSerializationType(initializer.Type).WriteContentTo(blob); + MaterializeSerializedInitializer(initializer).WriteContentTo(blob); + } + break; + } + + return blob; + } + + private BlobBuilder MaterializeClassSequenceElement(ClassSequenceElementValue value) + { + BlobBuilder blob = new(); + blob.WriteSerializedString(value switch + { + StringClassSequenceElementValue text => text.Value, + TypeClassSequenceElementValue type => GetReflectionNotation(type.ClassName), + _ => null + }); + return blob; + } + +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.CustomAttributes.Serialization.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.CustomAttributes.Serialization.cs new file mode 100644 index 00000000000000..0b365293139ced --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.CustomAttributes.Serialization.cs @@ -0,0 +1,410 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection.Metadata; +using System.Text; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal byte GetCustomAttributeNamedArgumentKind(IToken token) + => (byte)(token.Text == "field" + ? CustomAttributeNamedArgumentKind.Field + : CustomAttributeNamedArgumentKind.Property); + + internal SerializationTypeValue CreateSerializationType( + SerializationTypeValue element, + IToken? array) + { + return array is null ? element : new ArraySerializationTypeValue(element); + } + + internal SerializationTypeValue CreatePrimitiveSerializationType(byte type) + => new SimpleSerializationTypeValue((SerializationTypeCode)type); + + internal SerializationTypeValue CreateSerializationTypeTypedef( + CILParser.SerializTypeElementContext context, + string alias) + => new TypedefSerializationTypeValue(context.Start, alias); + + internal SerializationTypeValue CreateSimpleSerializationType(IToken type) + => new SimpleSerializationTypeValue(GetSerializationTypeCode(type.Type)); + + internal SerializationTypeValue CreateEnumSerializationType(IToken name) + => new StringEnumSerializationTypeValue(StringHelpers.ParseQuotedString(name.Text)); + + internal SerializationTypeValue CreateEnumSerializationType(ClassNameValue className) + => new ClassEnumSerializationTypeValue(className); + + internal BlobBuilder CreateFloat32SerializedInitializer( + CILParser.Float64Context context, + double value) + { + float serializedValue = IsPlainInteger(context) && + ParseIntegerValue(context.Start.Text.AsSpan(), out long rawValue) + ? BitConverter.Int32BitsToSingle((int)rawValue) + : (float)value; + BlobBuilder blob = CreateSerializedInitializer(SerializationTypeCode.Single); + blob.WriteSingle(serializedValue); + return blob; + } + + internal BlobBuilder CreateFloat64SerializedInitializer( + CILParser.Float64Context context, + double value) + { + double serializedValue = IsPlainInteger(context) && + ParseIntegerValue(context.Start.Text.AsSpan(), out long rawValue) + ? BitConverter.Int64BitsToDouble(rawValue) + : value; + BlobBuilder blob = CreateSerializedInitializer(SerializationTypeCode.Double); + blob.WriteDouble(serializedValue); + return blob; + } + + private static bool IsPlainInteger(CILParser.Float64Context context) + => context.Start.Type == CILParser.INT32 && + context.Stop is { Type: CILParser.INT32 }; + + internal BlobBuilder CreateFloat32BitsSerializedInitializer(IToken value) + { + BlobBuilder blob = CreateSerializedInitializer(SerializationTypeCode.Single); + blob.WriteSingle(BitConverter.Int32BitsToSingle(ParseInt32(value))); + return blob; + } + + internal BlobBuilder CreateFloat64BitsSerializedInitializer(IToken value) + { + BlobBuilder blob = CreateSerializedInitializer(SerializationTypeCode.Double); + blob.WriteDouble(BitConverter.Int64BitsToDouble(ParseInt64(value))); + return blob; + } + + internal BlobBuilder CreateIntegerSerializedInitializer(IToken type, IToken value) + { + BlobBuilder blob = CreateSerializedInitializer(GetSerializationTypeCode(type.Type)); + switch (type.Type) + { + case CILParser.INT8: + case CILParser.UINT8: + blob.WriteByte((byte)ParseInt32(value)); + break; + case CILParser.CHAR: + case CILParser.INT16: + case CILParser.UINT16: + blob.WriteInt16((short)ParseInt32(value)); + break; + case CILParser.INT32_: + case CILParser.UINT32: + blob.WriteInt32(ParseInt32(value)); + break; + case CILParser.INT64_: + case CILParser.UINT64: + blob.WriteInt64(ParseInt64(value)); + break; + default: + throw new UnreachableException(); + } + + return blob; + } + + internal BlobBuilder CreateBooleanSerializedInitializer(IToken type, bool value) + { + Debug.Assert(type.Type == CILParser.BOOL); + BlobBuilder blob = CreateSerializedInitializer(SerializationTypeCode.Boolean); + blob.WriteBoolean(value); + return blob; + } + + internal BlobBuilder CreateByteArraySerializedInitializer(ImmutableArray value) + { + BlobBuilder blob = CreateSerializedInitializer( + SerializationTypeCode.String, + value.Length + 1); + blob.WriteBytes(value); + return blob; + } + + private static BlobBuilder CreateSerializedInitializer( + SerializationTypeCode type, + int capacity = 9) + { + BlobBuilder blob = new(capacity); + blob.WriteByte((byte)type); + return blob; + } + + internal FieldInitializerValue CreateFieldInitializer(BlobBuilder value) + => new(true, ExtractConstantFromSerInit(value)); + + internal FieldInitializerValue CreateFieldInitializer(string value) + => new(true, value); + + internal FieldInitializerValue CreateNullFieldInitializer() + => new(true, null); + + internal SerializedInitializerValue CreateScalarSerializedValue( + CILParser.SerInitContext context, + CILParser.FieldSerInitContext initializer, + BlobBuilder value) + { + if (initializer.Start.Text == "bytearray") + { + return new InvalidByteArraySerializedInitializerValue(context.Start); + } + + ImmutableArray encodedValue = value.ToImmutableArray(); + BlobBuilder serializedValue = new(Math.Max(0, encodedValue.Length - 1)); + if (encodedValue.Length > 1) + { + serializedValue.WriteBytes(encodedValue.AsSpan().Slice(1).ToArray()); + } + + SerializationTypeValue type = encodedValue.Length == 0 + ? new RawSerializationTypeValue(new BlobBuilder()) + : new SimpleSerializationTypeValue((SerializationTypeCode)encodedValue[0]); + return new RawSerializedInitializerValue(type, serializedValue); + } + + internal SerializedInitializerValue CreateStringSerializedValue() + => CreateSerializedStringValue(SerializationTypeCode.String, null); + + internal SerializedInitializerValue CreateStringSerializedValue(IToken value) + => CreateSerializedStringValue( + SerializationTypeCode.String, + StringHelpers.ParseQuotedString(value.Text)); + + internal SerializedInitializerValue CreateTypeSerializedValue(IToken value) + => CreateSerializedStringValue( + SerializationTypeCode.Type, + StringHelpers.ParseQuotedString(value.Text)); + + internal SerializedInitializerValue CreateTypeSerializedValue(ClassNameValue className) + => new ClassNameSerializedInitializerValue(className); + + internal SerializedInitializerValue CreateNullTypeSerializedValue() + => CreateSerializedStringValue(SerializationTypeCode.Type, null); + + private static RawSerializedInitializerValue CreateSerializedStringValue( + SerializationTypeCode type, + string? value) + { + BlobBuilder serializedValue = new(); + serializedValue.WriteSerializedString(value); + return new RawSerializedInitializerValue( + new SimpleSerializationTypeValue(type), + serializedValue); + } + + internal SerializedInitializerValue CreateObjectSerializedValue( + SerializedInitializerValue value) + => new ObjectSerializedInitializerValue(value); + + internal SerializedInitializerValue CreateArraySerializedValue( + IToken elementType, + IToken length, + SerializedSequenceValue values) + => new ArraySerializedInitializerValue( + new ArraySerializationTypeValue( + new SimpleSerializationTypeValue(GetSerializationTypeCode(elementType.Type))), + ParseInt32(length), + values); + + internal SerializedInitializerValue CreateArraySerializedValue( + IToken elementType, + IToken length, + BlobBuilder values) + => CreateArraySerializedValue( + elementType, + length, + new RawSerializedSequenceValue(values)); + + private BlobBuilder MaterializeSerializationType(SerializationTypeValue value) + { + if (value is RawSerializationTypeValue raw) + { + return raw.Value; + } + + BlobBuilder blob = new(); + switch (value) + { + case SimpleSerializationTypeValue simple: + blob.WriteByte((byte)simple.Type); + break; + case ArraySerializationTypeValue array: + blob.WriteByte((byte)SerializationTypeCode.SZArray); + MaterializeSerializationType(array.ElementType).WriteContentTo(blob); + break; + case StringEnumSerializationTypeValue stringEnum: + blob.WriteByte((byte)SerializationTypeCode.Enum); + blob.WriteSerializedString(stringEnum.Name); + break; + case ClassEnumSerializationTypeValue classEnum: + blob.WriteByte((byte)SerializationTypeCode.Enum); + blob.WriteSerializedString(GetReflectionNotation(classEnum.ClassName)); + break; + case TypedefSerializationTypeValue typedef: + if (TryResolveTypedefAsTypeBlob(typedef.Alias) is { } resolved) + { + resolved.WriteContentTo(blob); + } + else + { + ReportError( + DiagnosticIds.TypedefNotFound, + string.Format(DiagnosticMessageTemplates.TypedefNotFound, typedef.Alias), + typedef.Token); + } + break; + } + + return blob; + } + + private BlobBuilder MaterializeSerializedInitializer(SerializedInitializerValue value) + { + if (value is RawSerializedInitializerValue raw) + { + return raw.Value; + } + + BlobBuilder blob = new(); + switch (value) + { + case ClassNameSerializedInitializerValue className: + blob.WriteSerializedString(GetReflectionNotation(className.ClassName)); + break; + case ObjectSerializedInitializerValue boxed: + MaterializeSerializationType(boxed.Value.Type).WriteContentTo(blob); + MaterializeSerializedInitializer(boxed.Value).WriteContentTo(blob); + break; + case InvalidByteArraySerializedInitializerValue invalid: + ReportError( + DiagnosticIds.InvalidMetadataToken, + "bytearray is not a valid structured custom attribute value", + invalid.Token); + blob.WriteSerializedString(null); + break; + case ArraySerializedInitializerValue array: + blob.WriteInt32(array.Length); + MaterializeSerializedSequence(array.Values).WriteContentTo(blob); + break; + } + + return blob; + } + + private string GetReflectionNotation(ClassNameValue className) + { + EntityRegistry.TypeEntity type = ResolveClassName(className); + return (type as EntityRegistry.IHasReflectionNotation)?.ReflectionNotation ?? string.Empty; + } + + private static SerializationTypeCode GetSerializationTypeCode(int tokenType) + => tokenType switch + { + CILParser.INT8 => SerializationTypeCode.SByte, + CILParser.UINT8 => SerializationTypeCode.Byte, + CILParser.INT16 => SerializationTypeCode.Int16, + CILParser.UINT16 => SerializationTypeCode.UInt16, + CILParser.INT32_ => SerializationTypeCode.Int32, + CILParser.UINT32 => SerializationTypeCode.UInt32, + CILParser.INT64_ => SerializationTypeCode.Int64, + CILParser.UINT64 => SerializationTypeCode.UInt64, + CILParser.FLOAT32 => SerializationTypeCode.Single, + CILParser.FLOAT64_ => SerializationTypeCode.Double, + CILParser.CHAR => SerializationTypeCode.Char, + CILParser.BOOL => SerializationTypeCode.Boolean, + CILParser.STRING => SerializationTypeCode.String, + CILParser.TYPE => SerializationTypeCode.Type, + CILParser.OBJECT => SerializationTypeCode.TaggedObject, + _ => throw new UnreachableException() + }; + + private static object? ExtractConstantFromSerInit(BlobBuilder blob) + { + ImmutableArray bytes = blob.ToImmutableArray(); + if (bytes.Length == 0) + { + return null; + } + + SerializationTypeCode typeCode = (SerializationTypeCode)bytes[0]; + ReadOnlySpan valueBytes = bytes.AsSpan().Slice(1); + return typeCode switch + { + SerializationTypeCode.Boolean => valueBytes.Length >= 1 && valueBytes[0] != 0, + SerializationTypeCode.Char => valueBytes.Length >= 2 ? BitConverter.ToChar(valueBytes) : '\0', + SerializationTypeCode.SByte => valueBytes.Length >= 1 ? (sbyte)valueBytes[0] : (sbyte)0, + SerializationTypeCode.Byte => valueBytes.Length >= 1 ? valueBytes[0] : (byte)0, + SerializationTypeCode.Int16 => valueBytes.Length >= 2 ? BitConverter.ToInt16(valueBytes) : (short)0, + SerializationTypeCode.UInt16 => valueBytes.Length >= 2 ? BitConverter.ToUInt16(valueBytes) : (ushort)0, + SerializationTypeCode.Int32 => valueBytes.Length >= 4 ? BitConverter.ToInt32(valueBytes) : 0, + SerializationTypeCode.UInt32 => valueBytes.Length >= 4 ? BitConverter.ToUInt32(valueBytes) : 0u, + SerializationTypeCode.Int64 => valueBytes.Length >= 8 ? BitConverter.ToInt64(valueBytes) : 0L, + SerializationTypeCode.UInt64 => valueBytes.Length >= 8 ? BitConverter.ToUInt64(valueBytes) : 0uL, + SerializationTypeCode.Single => valueBytes.Length >= 4 ? BitConverter.ToSingle(valueBytes) : 0f, + SerializationTypeCode.Double => valueBytes.Length >= 8 ? BitConverter.ToDouble(valueBytes) : 0d, + SerializationTypeCode.String => Encoding.Unicode.GetString(valueBytes), + SerializationTypeCode.Type => ExtractSerString(valueBytes), + SerializationTypeCode.SZArray => valueBytes.ToArray(), + SerializationTypeCode.TaggedObject => valueBytes.ToArray(), + SerializationTypeCode.Enum => valueBytes.ToArray(), + _ => bytes.AsSpan().ToArray() + }; + } + + private static string? ExtractSerString(ReadOnlySpan bytes) + { + if (bytes.Length == 0 || bytes[0] == 0xFF) + { + return null; + } + + int length; + int bytesRead; + if ((bytes[0] & 0x80) == 0) + { + length = bytes[0]; + bytesRead = 1; + } + else if ((bytes[0] & 0xC0) == 0x80) + { + if (bytes.Length < 2) + { + return null; + } + + length = ((bytes[0] & 0x3F) << 8) | bytes[1]; + bytesRead = 2; + } + else + { + if (bytes.Length < 4) + { + return null; + } + + length = ((bytes[0] & 0x1F) << 24) | + (bytes[1] << 16) | + (bytes[2] << 8) | + bytes[3]; + bytesRead = 4; + } + + return bytes.Length < bytesRead + length + ? null + : Encoding.UTF8.GetString(bytes.Slice(bytesRead, length)); + } + + internal static FieldInitializerValue GetInitializerValue(CILParser.InitOptContext context) + => context.Value; +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Data.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Data.cs new file mode 100644 index 00000000000000..decf807f0e4425 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Data.cs @@ -0,0 +1,228 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection.Metadata; +using System.Reflection.PortableExecutable; +using Antlr4.Runtime; + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ + internal CILParser.DataDeclarationBuilder CreateDataDeclaration( + CILParser.DataDeclContext context) + => new( + !IsDeclarationSuppressed && + (context.Parent is not CILParser.MethodDeclContext || + _currentMethod is not null)); + + internal void EndDataDeclaration( + CILParser.DataDeclContext context, + CILParser.DataDeclarationBuilder builder, + int initialSyntaxErrorCount) + { + bool hasSyntaxError = + HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null; + context.HasSyntaxError = hasSyntaxError; + + if (hasSyntaxError || !builder.ShouldCommit) + { + return; + } + + int declarationOffset = _mappedFieldData.Count; + if (builder.Name is not null && !_mappedFieldDataNames.ContainsKey(builder.Name)) + { + _mappedFieldDataNames.Add(builder.Name, declarationOffset); + } + + _mappedFieldData.LinkSuffix(builder.Data); + if (builder.ReferenceFixups is null) + { + return; + } + + foreach (CILParser.DataLabelReferenceValue reference in builder.ReferenceFixups) + { + _mappedFieldDataReferenceFixups.Add(reference with + { + DataOffset = declarationOffset + reference.DataOffset, + }); + } + } + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. + internal void SetDataDeclarationHeader( + CILParser.DataDeclarationBuilder builder, + byte section, + IToken name) + { + _ = section; + builder.Name = ParseIdentifier(name); + } + + internal void SetAnonymousDataDeclarationHeader( + CILParser.DataDeclarationBuilder builder, + byte section) + { + _ = builder; + _ = section; + } + + internal byte GetMappedDataSection() => 0; + + internal byte GetTlsDataSection(CILParser.TlsContext context) + { + ReportError( + DiagnosticIds.UnsupportedTlsData, + DiagnosticMessageTemplates.UnsupportedTlsData, + context); + return 1; + } + + internal byte GetCilDataSection() => 2; + internal int ParseDataItemCount(CILParser.DataDeclarationBuilder builder, IToken token) + { + int diagnosticCount = _diagnostics.Count; + int count = ParseInt32(token); + if (_diagnostics.Count != diagnosticCount) + { + builder.Invalidate(); + } + + return count; + } + + internal void AddDataString(CILParser.DataDeclarationBuilder builder, string value) + => builder.Data.WriteUTF16(value); + + internal void AddDataReference( + CILParser.DataDeclarationBuilder builder, + IToken targetToken) + { + string target = ParseIdentifier(targetToken); + int pointerSize = VTableFixupSupport.GetPointerSize( + _options.Machine ?? Machine.I386); + builder.ReferenceFixups ??= new List(); + builder.ReferenceFixups.Add(new CILParser.DataLabelReferenceValue( + target, + builder.Data.Count, + pointerSize, + targetToken)); + builder.Data.ReserveBytes(pointerSize); + } + + internal void AddDataBytes( + CILParser.DataDeclarationBuilder builder, + ImmutableArray value) + => builder.Data.WriteBytes(value); + + internal void AddFloatingPointData( + CILParser.DataDeclarationBuilder builder, + IToken kind, + double value, + int count) + { + if (count <= 0) + { + return; + } + + if (kind.Text == "float32") + { + float single = (float)value; + for (int i = 0; i < count; i++) + { + builder.Data.WriteSingle(single); + } + } + else + { + Debug.Assert(kind.Text == "float64"); + for (int i = 0; i < count; i++) + { + builder.Data.WriteDouble(value); + } + } + } + + internal void AddInt64Data( + CILParser.DataDeclarationBuilder builder, + IToken kind, + IToken value, + int count) + { + Debug.Assert(kind.Text == "int64"); + if (count <= 0) + { + return; + } + + long parsedValue = ParseInt64(value); + for (int i = 0; i < count; i++) + { + builder.Data.WriteInt64(parsedValue); + } + } + + internal void AddIntegerData( + CILParser.DataDeclarationBuilder builder, + IToken kind, + IToken value, + int count) + { + if (count <= 0) + { + return; + } + + int parsedValue = ParseInt32(value); + switch (kind.Text) + { + case "int8": + builder.Data.WriteBytes((byte)parsedValue, count); + break; + case "int16": + for (int i = 0; i < count; i++) + { + builder.Data.WriteInt16((short)parsedValue); + } + break; + default: + Debug.Assert(kind.Text == "int32"); + for (int i = 0; i < count; i++) + { + builder.Data.WriteInt32(parsedValue); + } + break; + } + } + + internal void AddZeroData( + CILParser.DataDeclarationBuilder builder, + IToken kind, + int count) + { + if (count <= 0) + { + return; + } + + int elementSize = kind.Text switch + { + "int8" => sizeof(byte), + "int16" => sizeof(short), + "int32" or "float32" => sizeof(int), + "int64" or "float64" => sizeof(long), + _ => throw new UnreachableException(), + }; + builder.Data.WriteBytes(0, checked(elementSize * count)); + } +#pragma warning restore CA1822 + + +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Debug.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Debug.cs new file mode 100644 index 00000000000000..5ef604eaace2b1 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Debug.cs @@ -0,0 +1,227 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using Antlr4.Runtime; + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. + internal bool IsAutoIncrementSourceDirective(IToken token) => token.Text == "#line"; +#pragma warning restore CA1822 + + internal SourceDirectiveValue CreateSourceLine( + bool autoIncrement, + IToken line, + IToken? path) + { + int lineNumber = ParseInt32(line); + return CreateSourceDirective(autoIncrement, lineNumber, 0, lineNumber, 0, path); + } + + internal SourceDirectiveValue CreateSourceColumn( + bool autoIncrement, + IToken line, + IToken column, + IToken? path) + { + int lineNumber = ParseInt32(line); + int columnNumber = ParseInt32(column); + return CreateSourceDirective( + autoIncrement, + lineNumber, + columnNumber, + lineNumber, + columnNumber, + path); + } + + internal SourceDirectiveValue CreateSourceColumnRange( + bool autoIncrement, + IToken line, + IToken startColumn, + IToken endColumn, + IToken? path) + { + int lineNumber = ParseInt32(line); + return CreateSourceDirective( + autoIncrement, + lineNumber, + ParseInt32(startColumn), + lineNumber, + ParseInt32(endColumn), + path); + } + + internal SourceDirectiveValue CreateSourceLineRange( + bool autoIncrement, + IToken startLine, + IToken endLine, + IToken column, + IToken? path) + { + int columnNumber = ParseInt32(column); + return CreateSourceDirective( + autoIncrement, + ParseInt32(startLine), + columnNumber, + ParseInt32(endLine), + columnNumber, + path); + } + + internal SourceDirectiveValue CreateSourceRange( + bool autoIncrement, + IToken startLine, + IToken endLine, + IToken startColumn, + IToken endColumn, + IToken? path) + => CreateSourceDirective( + autoIncrement, + ParseInt32(startLine), + ParseInt32(startColumn), + ParseInt32(endLine), + ParseInt32(endColumn), + path); + + private static SourceDirectiveValue CreateSourceDirective( + bool autoIncrement, + int startLine, + int startColumn, + int endLine, + int endColumn, + IToken? path) + => new( + autoIncrement, + startLine, + startColumn, + endLine, + endColumn, + path is null ? null : StringHelpers.ParseQuotedString(path.Text)); + + internal void EndSourceDirective( + CILParser.ExtSourceSpecContext context, + int initialSyntaxErrorCount) + { + context.HasSyntaxError = + HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null; + if (context.HasSyntaxError || + context.Value is not { } value || + !CanApplySharedDirective(context)) + { + context.Value = null; + return; + } + + ApplySourceDirective(value); + } + + private void ApplySourceDirective(SourceDirectiveValue value) + { + if (value.DocumentPath is not null) + { + _currentDocumentPath = value.DocumentPath; + } + + if (_currentMethod is null || _currentDocumentPath is null) + { + return; + } + + int ilOffset = _currentMethod.Definition.MethodBody.Offset; + EntityRegistry.MethodDebugInfo debugInfo = _currentMethod.Definition.DebugInfo; + if (debugInfo.DocumentPath is null) + { + debugInfo.DocumentPath = _currentDocumentPath; + debugInfo.LanguageGuid = _currentLanguageGuid; + } + + EntityRegistry.SequencePoint sequencePoint; + if (value.StartLine == 0xFEEFEE) + { + sequencePoint = EntityRegistry.SequencePoint.Hidden(ilOffset); + } + else + { + int endColumn = value.EndColumn; + if (value.EndLine == value.StartLine && endColumn == value.StartColumn) + { + endColumn++; + } + + sequencePoint = new EntityRegistry.SequencePoint( + ilOffset, + value.StartLine, + value.StartColumn, + value.EndLine, + endColumn); + } + + List sequencePoints = debugInfo.SequencePoints; + if (sequencePoints.Count > 0 && sequencePoints[^1].ILOffset == ilOffset) + { + sequencePoints[^1] = sequencePoint; + } + else + { + sequencePoints.Add(sequencePoint); + } + } + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. + internal string ParseLanguageString(IToken token) + => StringHelpers.ParseQuotedString(token.Text); + + internal LanguageDirectiveValue CreateLanguageDirective(string language) + => new LanguageDirectiveValue(language, null, null); + + internal LanguageDirectiveValue CreateLanguageDirective(string language, string vendor) + => new LanguageDirectiveValue(language, vendor, null); + + internal LanguageDirectiveValue CreateLanguageDirective( + string language, + string vendor, + string documentType) + => new LanguageDirectiveValue(language, vendor, documentType); +#pragma warning restore CA1822 + + internal void EndLanguageDirective( + CILParser.LanguageDeclContext context, + int initialSyntaxErrorCount) + { + context.HasSyntaxError = + HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null; + if (context.HasSyntaxError || + context.Value is not { } value || + !CanApplySharedDirective(context)) + { + context.Value = null; + return; + } + + if (Guid.TryParse(value.Language, out Guid language)) + { + _currentLanguageGuid = language; + } + if (value.Vendor is not null && Guid.TryParse(value.Vendor, out Guid vendor)) + { + _currentLanguageVendorGuid = vendor; + } + if (value.DocumentType is not null && + Guid.TryParse(value.DocumentType, out Guid documentType)) + { + _currentDocumentTypeGuid = documentType; + } + } + + private bool CanApplySharedDirective(ParserRuleContext context) + => !IsDeclarationSuppressed && + (context.Parent is not CILParser.MethodDeclContext || _currentMethod is not null); + +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Declarations.Actions.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Declarations.Actions.cs new file mode 100644 index 00000000000000..6aaf24e8af6faf --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Declarations.Actions.cs @@ -0,0 +1,198 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Reflection.PortableExecutable; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal void BeginTopLevelDirective() => PrepareTopLevelDeclaration(); + + internal void ProcessTopLevelDataDeclaration(CILParser.DataDeclContext context) + => _ = context; + + internal void ProcessTopLevelVTableDeclaration(CILParser.VtableDeclContext context) + { + if (!IsDeclarationSuppressed && !context.HasSyntaxError) + { + MaterializeVTable(context); + } + } + + internal void ProcessTopLevelVTableFixupDeclaration(CILParser.VtfixupDeclContext context) + { + if (!IsDeclarationSuppressed && !context.HasSyntaxError) + { + MaterializeVTableFixup(context); + } + } + + internal void ProcessTopLevelSourceDirective(CILParser.ExtSourceSpecContext context) + => _ = context; + + internal void ProcessTopLevelFileDeclaration(CILParser.FileDeclContext context) + { + if (!IsDeclarationSuppressed && !context.HasSyntaxError) + { + _ = MaterializeFileDeclaration(context); + } + } + + internal void ProcessTopLevelAssembly(CILParser.AssemblyBlockContext context) + { + if (!IsDeclarationSuppressed && !context.HasSyntaxError) + { + MaterializeAssemblyDefinition(context); + } + } + + internal void ProcessTopLevelAssemblyReference(CILParser.AssemblyRefBlockContext context) + { + if (!IsDeclarationSuppressed && !context.HasSyntaxError) + { + MaterializeAssemblyReference(context); + } + } + + internal void ProcessTopLevelExportedType(CILParser.ExptypeBlockContext context) + { + if (!IsDeclarationSuppressed && !context.HasSyntaxError) + { + MaterializeExportedType(context); + } + } + + internal void ProcessTopLevelManifestResource(CILParser.ManifestResBlockContext context) + { + if (!IsDeclarationSuppressed && !context.HasSyntaxError) + { + MaterializeManifestResource(context); + } + } + + internal void SetModuleHeader( + CILParser.ModuleHeadContext context, + string name, + bool isExternal) + { + context.Value = name; + context.HasName = true; + context.IsExternal = isExternal; + } + + internal void SetEmptyModuleHeader(CILParser.ModuleHeadContext context) + { + context.Value = string.Empty; + context.HasName = false; + context.IsExternal = false; + } + + internal void ProcessTopLevelModule(string? name, bool hasName, bool isExternal) + { + if (IsDeclarationSuppressed) + { + return; + } + + if (!hasName) + { + _entityRegistry.Module.Name = null; + } + else if (isExternal) + { + _entityRegistry.GetOrCreateModuleReference(name ?? string.Empty, _ => { }); + } + else + { + _entityRegistry.Module.Name = name; + } + } + + internal void ProcessTopLevelSecurityDeclaration(CILParser.SecDeclContext context) + { + if (!IsDeclarationSuppressed && !context.HasSyntaxError) + { + EntityRegistry.DeclarativeSecurityAttributeEntity? security = + MaterializeSecurityDeclaration(context); + security?.Parent = _entityRegistry.Assembly; + } + } + + internal void ProcessTopLevelCustomAttribute(CILParser.CustomAttrDeclContext context) + { + if (!IsDeclarationSuppressed && + !context.HasSyntaxError && + MaterializeCustomAttributeDeclaration(context) is { } customAttribute) + { + customAttribute.Owner ??= + (EntityRegistry.EntityBase?)_lastFieldDefinition ?? _entityRegistry.Module; + } + } + + internal void ProcessTopLevelSubsystem(IToken value) + { + if (!IsDeclarationSuppressed) + { + _subsystem = (Subsystem)ParseInt32(value); + } + } + + internal void ProcessTopLevelCorFlags(IToken value) + { + if (!IsDeclarationSuppressed) + { + _corflags = (CorFlags)ParseInt32(value); + } + } + + internal void ProcessTopLevelAlignment(IToken value) + { + if (!IsDeclarationSuppressed) + { + _alignment = ParseInt32(value); + } + } + + internal void ProcessTopLevelImageBase(IToken value) + { + if (!IsDeclarationSuppressed) + { + _imageBase = ParseInt64(value); + } + } + + internal void ProcessTopLevelStackReserve(IToken value) + { + if (!IsDeclarationSuppressed) + { + _stackReserve = ParseInt64(value); + } + } + + internal void ProcessTopLevelLanguageDirective(CILParser.LanguageDeclContext context) + => _ = context; + + internal void ProcessTopLevelTypedef(CILParser.TypedefDeclContext context) + { + if (!IsDeclarationSuppressed && !context.HasSyntaxError) + { + MaterializeTypedef(context); + } + } + + internal void BeginTopLevelTypeList() => PrepareTopLevelDeclaration(); + + internal void ProcessTopLevelTypeListEntry(ClassNameValue value) + { + if (!IsDeclarationSuppressed) + { + _ = ResolveClassName(value); + } + } + + private void PrepareTopLevelDeclaration() => ClearPendingCustomAttributeOwners(); +} +#pragma warning restore CA1822 diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Instructions.References.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Instructions.References.cs new file mode 100644 index 00000000000000..5bda6c6db7710b --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Instructions.References.cs @@ -0,0 +1,114 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; +using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; +using Antlr4.Runtime; + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ + internal void EmitMethodReferenceInstruction(IToken opcodeToken, CILParser.MethodRefContext context) + { + if (StartInstruction(opcodeToken) is not { } instruction || context.HasSyntaxError) + { + return; + } + + ILOpCode opcode = instruction.OpCode; + CurrentMethodContext method = instruction.Method; + bool expectInstance = opcode is ILOpCode.Callvirt or ILOpCode.Newobj; + _expectInstance = expectInstance; + try + { + method.Definition.MethodBody.OpCode(opcode); + WriteInstructionToken(method, MaterializeMethodReference(context)); + } + finally + { + if (expectInstance) + { + _expectInstance = false; + } + } + } + + internal void EmitFieldReferenceInstruction(IToken opcodeToken, CILParser.FieldRefContext context) + { + if (StartInstruction(opcodeToken) is not { } instruction || context.HasSyntaxError) + { + return; + } + + instruction.Method.Definition.MethodBody.OpCode(instruction.OpCode); + WriteInstructionToken(instruction.Method, MaterializeFieldReference(context)); + } + + internal void EmitMetadataTokenInstruction(IToken opcodeToken, CILParser.MdtokenContext context) + { + if (StartInstruction(opcodeToken) is not { } instruction || context.HasSyntaxError) + { + return; + } + + instruction.Method.Definition.MethodBody.OpCode(instruction.OpCode); + WriteInstructionToken(instruction.Method, ResolveMetadataToken(context)); + } + + internal void EmitTypeReferenceInstruction(IToken opcodeToken, CILParser.TypeSpecContext context) + { + if (StartInstruction(opcodeToken) is not { } instruction || context.HasSyntaxError) + { + return; + } + + instruction.Method.Definition.MethodBody.OpCode(instruction.OpCode); + WriteInstructionToken(instruction.Method, ResolveTypeSpecification(context)); + } + + internal void EmitCalliInstruction(IToken opcodeToken, CILParser.CalliSignatureContext context) + { + if (StartInstruction(opcodeToken) is not { } instruction || context.HasSyntaxError) + { + return; + } + + Debug.Assert(instruction.OpCode == ILOpCode.Calli); + instruction.Method.Definition.MethodBody.OpCode(instruction.OpCode); + instruction.Method.Definition.MethodBody.Token( + _entityRegistry.GetOrCreateStandaloneSignature( + MaterializeCalliSignature(context.Value)).Handle); + } + + internal void EmitOwnerTokenInstruction(IToken opcodeToken, CILParser.OwnerTypeContext context) + { + if (StartInstruction(opcodeToken) is not { } instruction || context.HasSyntaxError) + { + return; + } + + instruction.Method.Definition.MethodBody.OpCode(instruction.OpCode); + WriteInstructionToken(instruction.Method, MaterializeOwnerType(context)); + } + + private static void WriteInstructionToken(CurrentMethodContext method, EntityRegistry.EntityBase entity) + { + if (entity is EntityRegistry.TypeReferenceEntity typeReference) + { + typeReference.RecordBlobToWriteResolvedToken( + method.Definition.MethodBody.CodeBuilder.ReserveBytes(sizeof(int))); + } + else if (entity is EntityRegistry.MemberReferenceEntity memberReference) + { + memberReference.RecordBlobToWriteResolvedHandle( + method.Definition.MethodBody.CodeBuilder.ReserveBytes(sizeof(int))); + } + else + { + method.Definition.MethodBody.Token(entity.Handle); + } + } + +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Instructions.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Instructions.cs new file mode 100644 index 00000000000000..9161542663e550 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Instructions.cs @@ -0,0 +1,415 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; +using System.Runtime.InteropServices; +using System.Text; +using Antlr4.Runtime; + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ + internal void EmitNoOperandInstruction(IToken opcodeToken) + { + if (StartInstruction(opcodeToken) is not { } instruction) + { + return; + } + + instruction.Method.Definition.MethodBody.OpCode(instruction.OpCode); + } + + internal void EmitVariableIndexInstruction(IToken opcodeToken, IToken indexToken) + { + if (StartInstruction(opcodeToken) is not { } instruction) + { + return; + } + + WriteVariableIndex(instruction.Method, instruction.OpCode, ParseInt32(indexToken)); + } + + internal void EmitVariableNameInstruction(IToken opcodeToken, IToken nameToken) + { + if (StartInstruction(opcodeToken) is not { } instruction) + { + return; + } + + CurrentMethodContext method = instruction.Method; + ILOpCode opcode = instruction.OpCode; + string instructionName = opcode.ToString(); + string variableName = ParseIdentifier(nameToken); + int? index = null; + + if (instructionName.Contains("arg", StringComparison.Ordinal)) + { + if (method.ArgumentNames.TryGetValue(variableName, out int argumentIndex)) + { + index = method.Definition.SignatureHeader.IsInstance ? argumentIndex + 1 : argumentIndex; + } + else + { + ReportError( + DiagnosticIds.ArgumentNotFound, + string.Format(DiagnosticMessageTemplates.ArgumentNotFound, variableName), + opcodeToken); + } + } + else + { + for (int i = method.LocalsScopes.Count - 1; i >= 0; i--) + { + if (method.LocalsScopes[i].TryGetValue(variableName, out int localIndex)) + { + index = localIndex; + break; + } + } + + if (index is null) + { + ReportError( + DiagnosticIds.LocalNotFound, + string.Format(DiagnosticMessageTemplates.LocalNotFound, variableName), + opcodeToken); + } + } + + WriteVariableIndex(method, opcode, index ?? -1); + } + + internal void EmitInt32Instruction(IToken opcodeToken, IToken valueToken) + { + if (StartInstruction(opcodeToken) is not { } instruction) + { + return; + } + + int value = ParseInt32(valueToken); + if (instruction.OpCode is ILOpCode.Ldc_i4 or ILOpCode.Ldc_i4_s) + { + instruction.Method.Definition.MethodBody.LoadConstantI4(value); + return; + } + + instruction.Method.Definition.MethodBody.OpCode(instruction.OpCode); + instruction.Method.Definition.MethodBody.CodeBuilder.WriteByte((byte)value); + } + + internal void EmitInt64Instruction(IToken opcodeToken, IToken valueToken) + { + if (StartInstruction(opcodeToken) is not { } instruction) + { + return; + } + + Debug.Assert(instruction.OpCode == ILOpCode.Ldc_i8); + instruction.Method.Definition.MethodBody.LoadConstantI8(ParseInt64(valueToken)); + } + + internal void EmitFloatingInstruction(IToken opcodeToken, double value) + { + if (StartInstruction(opcodeToken) is not { } instruction) + { + return; + } + + WriteFloatingInstruction(instruction.Method, instruction.OpCode, value); + } + + internal void EmitFloatingInstruction(IToken opcodeToken, IToken valueToken) + { + if (StartInstruction(opcodeToken) is not { } instruction) + { + return; + } + + WriteFloatingInstruction(instruction.Method, instruction.OpCode, ParseInt64(valueToken)); + } + + internal void EmitBranchOffsetInstruction(IToken opcodeToken, IToken offsetToken) + { + if (StartInstruction(opcodeToken) is not { } instruction) + { + return; + } + + InstructionEncoder body = instruction.Method.Definition.MethodBody; + int offset = ParseInt32(offsetToken); + body.OpCode(instruction.OpCode); + if (instruction.OpCode.GetBranchOperandSize() == 1) + { + body.CodeBuilder.WriteSByte(unchecked((sbyte)offset)); + } + else + { + body.CodeBuilder.WriteInt32(offset); + } + } + + internal void EmitBranchLabelInstruction(IToken opcodeToken, IToken labelToken) + { + if (StartInstruction(opcodeToken) is not { } instruction) + { + return; + } + + CurrentMethodContext method = instruction.Method; + string labelName = ParseIdentifier(labelToken); + LabelHandle label = GetOrCreateMethodLabel(method, labelName, opcodeToken); + + method.Definition.MethodBody.Branch(instruction.OpCode, label); + } + + internal void EmitRawFloatingInstruction( + IToken opcodeToken, + ImmutableArray bytes, + IToken bytesToken) + { + if (StartInstruction(opcodeToken) is not { } instruction) + { + return; + } + + double value; + ReadOnlySpan byteSpan = bytes.AsSpan(); + if (byteSpan.Length >= sizeof(double)) + { + value = BitConverter.ToDouble(byteSpan); + } + else if (byteSpan.Length >= sizeof(float)) + { + value = BitConverter.ToSingle(byteSpan); + } + else + { + ReportError( + DiagnosticIds.ByteArrayTooShort, + DiagnosticMessageTemplates.ByteArrayTooShort, + bytesToken); + value = 0; + } + + WriteFloatingInstruction(instruction.Method, instruction.OpCode, value); + } + + internal void EmitRawStringInstruction(IToken opcodeToken, ImmutableArray bytes) + { + if (StartInstruction(opcodeToken) is not { } instruction) + { + return; + } + + string value = MemoryMarshal.Cast(bytes.AsSpan()).ToString(); + instruction.Method.Definition.MethodBody.LoadString(_metadataBuilder.GetOrAddUserString(value)); + } + + internal void EmitStringInstruction(IToken opcodeToken, string value) + { + if (StartInstruction(opcodeToken) is not { } instruction) + { + return; + } + + instruction.Method.Definition.MethodBody.LoadString(_metadataBuilder.GetOrAddUserString(value)); + } + + internal void EmitAnsiStringInstruction(IToken opcodeToken, string value) + { + int byteCount = Encoding.UTF8.GetByteCount(value); + if ((byteCount % 2) != 0) + { + byteCount++; + } + + Span utf8Bytes = new byte[byteCount]; + Encoding.UTF8.GetBytes(value, utf8Bytes); + EmitStringInstruction(opcodeToken, new string(MemoryMarshal.Cast(utf8Bytes))); + } + + internal void EmitRawTokenInstruction(IToken opcodeToken, IToken valueToken) + { + if (StartInstruction(opcodeToken) is not { } instruction) + { + return; + } + + instruction.Method.Definition.MethodBody.OpCode(instruction.OpCode); + instruction.Method.Definition.MethodBody.CodeBuilder.WriteInt32(ParseInt32(valueToken)); + } + + internal void EmitByte(IToken valueToken) + { + _currentMethod?.Definition.MethodBody.CodeBuilder.WriteByte((byte)ParseInt32(valueToken)); + } + + internal void SetMaxStack(IToken valueToken) + { + if (_currentMethod is not null) + { + _currentMethod.Definition.MaxStack = ParseInt32(valueToken); + } + } + + internal void SetEntryPoint() + { + if (_currentMethod is not null) + { + _entityRegistry.EntryPoint = _currentMethod.Definition; + } + } + + internal void SetZeroInit() + { + if (_currentMethod is not null) + { + _currentMethod.Definition.BodyAttributes = MethodBodyAttributes.InitLocals; + } + } + + internal void DefineLabel(IToken nameToken) + { + if (_currentMethod is not { } method) + { + return; + } + + string labelName = ParseIdentifier(nameToken); + method.UndefinedLabelReferences.Remove(labelName); + if (!method.Labels.TryGetValue(labelName, out LabelHandle label)) + { + label = method.Definition.MethodBody.DefineLabel(); + method.Labels[labelName] = label; + } + + method.Definition.MethodBody.MarkLabel(label); + } + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. + internal CILParser.SwitchInstructionBuilder CreateSwitchInstruction(IToken opcodeToken) + => new(opcodeToken); + + internal void AddSwitchLabel(CILParser.SwitchInstructionBuilder builder, IToken labelToken) + => builder.Operands.Add((labelToken, false)); + + internal void AddSwitchOffset(CILParser.SwitchInstructionBuilder builder, IToken offsetToken) + => builder.Operands.Add((offsetToken, true)); +#pragma warning restore CA1822 + + internal void CompleteSwitchInstruction(CILParser.SwitchInstructionBuilder? builder) + { + if (builder is null || + StartInstruction(builder.OpcodeToken) is not { } instruction) + { + return; + } + + Debug.Assert(instruction.OpCode == ILOpCode.Switch); + CurrentMethodContext method = instruction.Method; + List<(LabelHandle Label, int? Offset)> labels = new(builder.Operands.Count); + foreach ((IToken token, bool isOffset) in builder.Operands) + { + if (isOffset) + { + labels.Add((method.Definition.MethodBody.DefineLabel(), ParseInt32(token))); + continue; + } + + string labelName = ParseIdentifier(token); + LabelHandle label = GetOrCreateMethodLabel( + method, + labelName, + builder.OpcodeToken); + + labels.Add((label, null)); + } + + if (labels.Count > 0) + { + SwitchInstructionEncoder switchEncoder = method.Definition.MethodBody.Switch(labels.Count); + foreach ((LabelHandle label, _) in labels) + { + switchEncoder.Branch(label); + } + } + else + { + method.Definition.MethodBody.OpCode(ILOpCode.Switch); + method.Definition.MethodBody.CodeBuilder.WriteInt32(0); + } + + foreach ((LabelHandle label, int? offset) in labels) + { + if (offset is int value) + { + method.Definition.MethodBody.MarkLabel(label, method.Definition.MethodBody.Offset + value); + } + } + } + + private (CurrentMethodContext Method, ILOpCode OpCode)? StartInstruction(IToken opcodeToken) + { + if (_currentMethod is not { } method) + { + return null; + } + + ILOpCode opcode = ParseOpCodeFromToken(opcodeToken); + return (method, opcode); + } + + private static void WriteVariableIndex(CurrentMethodContext method, ILOpCode opcode, int index) + { + method.Definition.MethodBody.OpCode(opcode); + if (opcode.ToString().EndsWith("_s", StringComparison.Ordinal)) + { + method.Definition.MethodBody.CodeBuilder.WriteByte((byte)index); + } + else + { + method.Definition.MethodBody.CodeBuilder.WriteInt32(index); + } + } + + private static void WriteFloatingInstruction(CurrentMethodContext method, ILOpCode opcode, double value) + { + if (opcode == ILOpCode.Ldc_r4) + { + method.Definition.MethodBody.LoadConstantR4((float)value); + } + else + { + method.Definition.MethodBody.LoadConstantR8(value); + } + } + + private static ILOpCode ParseOpCodeFromToken(IToken token) + { + string text = token.Text.TrimEnd('.'); + if (text == "unused") + { + return ILOpCode.Unused; + } + + string normalized = text.Replace('.', '_'); + normalized = normalized switch + { + "ldelem_u8" => "ldelem_i8", + "ldind_u8" => "ldind_i8", + "endfault" => "endfinally", + _ => normalized + }; + + return (ILOpCode)Enum.Parse(typeof(ILOpCode), normalized, ignoreCase: true); + } + + internal EntityRegistry.EntityBase ResolveMetadataToken(CILParser.MdtokenContext context) + => ResolveMetadataToken(context.Value); +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Literals.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Literals.cs new file mode 100644 index 00000000000000..7980ff6030ac98 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Literals.cs @@ -0,0 +1,222 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Buffers.Binary; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; +using System.Reflection.PortableExecutable; +using System.Runtime.InteropServices; +using System.Security.Cryptography; +using System.Text; +using Antlr4.Runtime; +using Antlr4.Runtime.Misc; + +namespace ILAssembler +{ +#pragma warning disable CA1822 // Mark members as static + internal sealed partial class GrammarActions + { + internal void AddComposedStringPart(StringBuilder builder, IToken token) + => builder.Append(StringHelpers.ParseQuotedString(token.Text)); + + internal string EndComposedString(StringBuilder builder) + => builder.ToString(); + + internal void AddDottedNamePart(CILParser.DottedNameBuilder builder, string value) + { + if (builder.HasPart) + { + builder.Value.Append('.'); + } + + builder.Value.Append(value); + builder.HasPart = true; + } + + internal void AddDottedNameToken(CILParser.DottedNameBuilder builder, IToken token) + => AddDottedNamePart(builder, ParseIdentifier(token)); + + internal string EndDottedName(CILParser.DottedNameBuilder builder) + => builder.Value.ToString(); + + internal string ParseDottedNamePart(IToken token) + => token.Text.Length >= 2 && token.Text[0] == '\'' + ? StringHelpers.ParseQuotedString(token.Text) + : token.Text; + + internal double ParseFloatingLiteral(IToken token) + { + string text = token.Text; + bool neg = text.StartsWith('-'); + if (!double.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out double result)) + { + result = neg ? double.MinValue : double.MaxValue; + } + + return result; + } + + internal double ParseFloatingInteger(IToken token) + { + if (!ParseIntegerValue(token.Text.AsSpan(), out long value, out bool invalidOctal)) + { + ReportIntegerParseError(token, invalidOctal); + value = 0; + } + + return value; + } + + internal double ParseFloat32Bits(IToken token) + => BitConverter.Int32BitsToSingle(ParseInt32(token)); + + internal double ParseFloat64Bits(IToken token) + => BitConverter.Int64BitsToDouble(ParseInt64(token)); + + internal static string GetIdentifier(CILParser.IdContext context) + => ParseIdentifier(context.Start); + + private static string ParseIdentifier(IToken token) + { + string text = token.Text; + return text.Length >= 2 && text[0] == '\'' + ? text.Substring(1, text.Length - 2) + : text; + } + + private static bool ParseIntegerValue(ReadOnlySpan value, out long result) + => ParseIntegerValue(value, out result, out _); + + private static bool ParseIntegerValue(ReadOnlySpan value, out long result, out bool invalidOctal) + { + NumberStyles parseStyle = NumberStyles.None; + bool negate = false; + invalidOctal = false; + if (value.StartsWith("-".AsSpan())) + { + negate = true; + value = value.Slice(1); + } + + if (value.StartsWith("0x".AsSpan())) + { + parseStyle = NumberStyles.AllowHexSpecifier; + value = value.Slice(2); + } + else if (value.StartsWith("0".AsSpan())) + { + // Octal support isn't built-in, so we'll do it manually. + result = 0; + for (int i = 0; i < value.Length; i++) + { + int digitValue = value[i] - '0'; + if (digitValue < 0 || digitValue > 7) + { + result = 0; + invalidOctal = true; + return false; + } + if (i != 0) + { + result *= 8; + } + + result += digitValue; + } + if (negate) result = -result; + return true; + } + + bool success = long.TryParse(value.ToString(), parseStyle, CultureInfo.InvariantCulture, out result); + if (!success) + { + // Try parsing as unsigned to handle values like: + // - Decimal overflow with negation: 9223372036854775808 (= -Int64.MinValue) + // - Large unsigned decimal: 18444492274432737280 + if (ulong.TryParse(value.ToString(), parseStyle, CultureInfo.InvariantCulture, out ulong uresult)) + { + result = unchecked((long)uresult); + if (negate) result = unchecked(-result); + return true; + } + // Handle oversized hex values (>64 bits) by truncating to low 64 bits, + // matching native ilasm behavior for values like 0x94188556b24089e8b90c9c61f9f3088 + if (parseStyle == NumberStyles.AllowHexSpecifier && value.Length > 16) + { + var truncated = value.Slice(value.Length - 16); + if (ulong.TryParse(truncated.ToString(), parseStyle, CultureInfo.InvariantCulture, out uresult)) + { + result = unchecked((long)uresult); + if (negate) result = unchecked(-result); + return true; + } + } + return false; + } + + if (negate) result = -result; + return true; + } + + private void ReportIntegerParseError(IToken token, bool invalidOctal) + { + if (invalidOctal) + { + _diagnostics.Add(new Diagnostic( + DiagnosticIds.InvalidOctalLiteral, + DiagnosticSeverity.Error, + string.Format(DiagnosticMessageTemplates.InvalidOctalLiteral, token.Text), + Location.From(token, _documents))); + } + else + { + ReportLiteralOutOfRange(token); + } + } + + internal int ParseInt32(IToken token) + { + ReadOnlySpan value = token.Text.AsSpan(); + if (!ParseIntegerValue(value, out long num, out bool invalidOctal)) + { + ReportIntegerParseError(token, invalidOctal); + return 0; + } + + return (int)num; + } + + + private long ParseInt64(IToken token) + { + ReadOnlySpan value = token.Text.AsSpan(); + if (!ParseIntegerValue(value, out long num, out bool invalidOctal)) + { + ReportIntegerParseError(token, invalidOctal); + return 0; + } + + return num; + } + + private void ReportLiteralOutOfRange(IToken token) + { + _diagnostics.Add(new Diagnostic( + DiagnosticIds.LiteralOutOfRange, + DiagnosticSeverity.Error, + string.Format(DiagnosticMessageTemplates.LiteralOutOfRange, token.Text), + Location.From(token, _documents))); + } + + internal bool ParseBoolean(IToken token) => token.Text == "true"; + + } +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Assembly.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Assembly.cs new file mode 100644 index 00000000000000..96b3a08663edf0 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Assembly.cs @@ -0,0 +1,205 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Immutable; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Reflection.Metadata; +using System.Text; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal void SetAssemblyAttribute(CILParser.AsmAttrAnyContext context) + { + (AssemblyFlags value, AssemblyFlags mask) = context.Start.Text switch + { + "retargetable" => (AssemblyFlags.Retargetable, (AssemblyFlags)0), + "windowsruntime" => (AssemblyFlags.WindowsRuntime, (AssemblyFlags)0), + "noplatform" => (AssemblyFlags.NoPlatform, (AssemblyFlags)0), + "legacy library" => ((AssemblyFlags)0, (AssemblyFlags)0), + "cil" => (GetFlagForArch(ProcessorArchitecture.MSIL), AssemblyFlags.ArchitectureMask), + "x86" => (GetFlagForArch(ProcessorArchitecture.X86), AssemblyFlags.ArchitectureMask), + "amd64" => (GetFlagForArch(ProcessorArchitecture.Amd64), AssemblyFlags.ArchitectureMask), + "arm" => (GetFlagForArch(ProcessorArchitecture.Arm), AssemblyFlags.ArchitectureMask), + "arm64" => (GetFlagForArch((ProcessorArchitecture)6), AssemblyFlags.ArchitectureMask), + _ => ((AssemblyFlags)0, (AssemblyFlags)0) + }; + context.Value = value; + context.Mask = mask; + } + + internal AssemblyFlags AddAssemblyAttribute( + AssemblyFlags attributes, + AssemblyFlags value, + AssemblyFlags mask) + => mask == 0 ? attributes | value : (attributes & ~mask) | value; + + internal AssemblyDefinitionValue CreateAssemblyDefinition( + AssemblyFlags attributes, + string name, + ImmutableArray declarations) + => new(attributes, name, declarations); + + internal AssemblyDeclarationValue CreateAssemblyHashAlgorithmDeclaration(IToken value) + => new AssemblyHashAlgorithmDirectiveValue((AssemblyHashAlgorithm)ParseInt32(value)); + + internal AssemblyDeclarationValue CreateAssemblySecurityDeclaration( + SecurityDeclarationValue? value, + IToken location) + => new AssemblySecurityDirectiveValue(value, location); + + internal AssemblyDeclarationValue CreateAssemblyPublicKeyDeclaration( + ImmutableArray value) + => new AssemblyPublicKeyDirectiveValue(value); + + internal AssemblyDeclarationValue CreateAssemblyVersionDeclaration( + int? major, + int? minor, + int? build, + int? revision) + => new AssemblyVersionDirectiveValue(new( + major ?? 0, + minor ?? 0, + build ?? 0, + revision ?? 0)); + + internal AssemblyDeclarationValue CreateAssemblyLocaleDeclaration(string value) + => new AssemblyLocaleDirectiveValue(value); + + internal AssemblyDeclarationValue CreateAssemblyLocaleDeclaration( + ImmutableArray value) + => new AssemblyLocaleDirectiveValue(Encoding.Unicode.GetString(value.AsSpan())); + + internal AssemblyDeclarationValue CreateAssemblyCustomAttributeDeclaration( + CustomAttributeDeclarationValue? value, + IToken location) + => new AssemblyCustomAttributeDirectiveValue(value, location); + + private static AssemblyFlags GetFlagForArch(ProcessorArchitecture architecture) + => (AssemblyFlags)((int)architecture << 4); + + private static (ProcessorArchitecture Architecture, AssemblyFlags Flags) GetArchAndFlags( + AssemblyFlags flags) + { + ProcessorArchitecture architecture = + (ProcessorArchitecture)(((int)flags & 0xF0) >> 4); + return (architecture, flags & ~GetFlagForArch(architecture)); + } + + private void MaterializeAssemblyDefinition(AssemblyDefinitionValue definition) + { + string assemblyName = _options.AssemblyName ?? definition.Name; + _entityRegistry.Assembly ??= new EntityRegistry.AssemblyEntity(assemblyName); + EntityRegistry.AssemblyEntity assembly = _entityRegistry.Assembly; + (assembly.ProcessorArchitecture, assembly.Flags) = + GetArchAndFlags(definition.Attributes); + + foreach (AssemblyDeclarationValue declaration in definition.Declarations) + { + switch (declaration) + { + case AssemblyHashAlgorithmDirectiveValue hashAlgorithm: + assembly.HashAlgorithm = hashAlgorithm.Value; + break; + case AssemblySecurityDirectiveValue security: + if (security.Value is { } securityValue && + MaterializeSecurityDeclaration(securityValue, security.Location) is { } entity) + { + entity.Parent = assembly; + } + break; + default: + ApplyAssemblyOrReferenceDirective(assembly, declaration); + break; + } + } + + if (_options.KeyFile is not null) + { + ApplyKeyFile(_options.KeyFile); + } + } + + private void ApplyAssemblyOrReferenceDirective( + EntityRegistry.AssemblyOrRefEntity target, + AssemblyDeclarationValue declaration) + { + switch (declaration) + { + case AssemblyPublicKeyDirectiveValue publicKey: + // COMPAT: A reference's public key token wins regardless of declaration order. + if (target is not EntityRegistry.AssemblyReferenceEntity assemblyReference || + assemblyReference.PublicKeyOrToken is null || + assemblyReference.Flags.HasFlag(AssemblyFlags.PublicKey)) + { + target.PublicKeyOrToken = CreateManifestBlob(publicKey.Value); + target.Flags |= AssemblyFlags.PublicKey; + } + break; + case AssemblyVersionDirectiveValue version: + target.Version = version.Value; + break; + case AssemblyLocaleDirectiveValue locale: + target.Culture = locale.Value; + break; + case AssemblyCustomAttributeDirectiveValue customAttribute: + if (MaterializeCustomAttributeDeclaration( + customAttribute.Value, + customAttribute.Location) is { } attribute) + { + attribute.Owner ??= target; + } + break; + } + } + + private static BlobBuilder CreateManifestBlob(ImmutableArray value) + { + BlobBuilder blob = new(value.Length); + blob.WriteBytes(value); + return blob; + } + + private void ApplyKeyFile(string keyFilePath) + { + if (_entityRegistry.Assembly is null) + { + return; + } + + try + { + byte[] keyBytes = File.ReadAllBytes(keyFilePath); + BlobBuilder blob = new(keyBytes.Length); + blob.WriteBytes(keyBytes); + _entityRegistry.Assembly.PublicKeyOrToken = blob; + _entityRegistry.Assembly.Flags |= AssemblyFlags.PublicKey; + } + catch (Exception ex) + { + SourceText? firstDocument = _documents.Values.FirstOrDefault(); + Location location = firstDocument is not null + ? new Location(new SourceSpan(0, 0), firstDocument) + : new Location(new SourceSpan(0, 0), new SourceText(string.Empty, keyFilePath)); + _diagnostics.Add(new Diagnostic( + DiagnosticIds.KeyFileError, + DiagnosticSeverity.Error, + $"Failed to read key file '{keyFilePath}': {ex.Message}", + location)); + } + } + + internal void MaterializeAssemblyDefinition(CILParser.AssemblyBlockContext context) + { + if (context.Value is AssemblyDefinitionValue definition) + { + MaterializeAssemblyDefinition(definition); + } + } +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.ExportedTypes.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.ExportedTypes.cs new file mode 100644 index 00000000000000..67f778d26b1477 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.ExportedTypes.cs @@ -0,0 +1,302 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Reflection; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal void SetExportedTypeAttribute(CILParser.ExptAttrContext context) + { + string attribute = context.Start.Text == "nested" + ? $"nested{context.Stop?.Text}" + : context.Start.Text; + (TypeAttributes value, TypeAttributes mask) = attribute switch + { + "private" => (TypeAttributes.NotPublic, TypeAttributes.VisibilityMask), + "public" => (TypeAttributes.Public, TypeAttributes.VisibilityMask), + "forwarder" => (TypeAttributes.Forwarder, (TypeAttributes)0), + "nestedpublic" => (TypeAttributes.NestedPublic, TypeAttributes.VisibilityMask), + "nestedprivate" => (TypeAttributes.NestedPrivate, TypeAttributes.VisibilityMask), + "nestedfamily" => (TypeAttributes.NestedFamily, TypeAttributes.VisibilityMask), + "nestedassembly" => (TypeAttributes.NestedAssembly, TypeAttributes.VisibilityMask), + "nestedfamandassem" => (TypeAttributes.NestedFamANDAssem, TypeAttributes.VisibilityMask), + "nestedfamorassem" => (TypeAttributes.NestedFamORAssem, TypeAttributes.VisibilityMask), + _ => ((TypeAttributes)0, (TypeAttributes)0) + }; + context.Value = value; + context.Mask = mask; + } + + internal TypeAttributes AddExportedTypeAttribute( + TypeAttributes attributes, + TypeAttributes value, + TypeAttributes mask) + => mask == 0 ? attributes | value : (attributes & ~mask) | value; + + internal ExportedTypeHeaderValue CreateExportedTypeHeader( + TypeAttributes attributes, + string name, + IToken location) + => new ExportedTypeHeaderValue(true, attributes, name, location); + + internal ExportedTypeValue CreateExportedType( + ExportedTypeHeaderValue header, + ImmutableArray declarations) + => new ExportedTypeValue( + header, + declarations); + + internal ExportedTypeDeclarationValue CreateExportedTypeFileDeclaration( + string name, + IToken location) + => new ExportedTypeFileDirectiveValue(name, location); + + internal ExportedTypeDeclarationValue CreateNestedExportedTypeDeclaration( + TypeName name, + IToken location) + => new NestedExportedTypeDirectiveValue(name, location); + + internal ExportedTypeDeclarationValue CreateExportedTypeAssemblyDeclaration( + string name, + IToken location) + => new ExportedTypeAssemblyDirectiveValue(name, location); + + internal ExportedTypeDeclarationValue CreateExportedTypeMetadataTokenDeclaration( + int token, + IToken location) + => new ExportedTypeMetadataTokenDirectiveValue(token, location); + + internal ExportedTypeDeclarationValue CreateExportedTypeDefinitionIdDeclaration( + IToken value) + => new ExportedTypeDefinitionIdDirectiveValue(ParseInt32(value)); + + internal ExportedTypeDeclarationValue CreateExportedTypeCustomAttributeDeclaration( + CustomAttributeDeclarationValue? value, + IToken location) + => new ExportedTypeCustomAttributeDirectiveValue(value, location); + + private void MaterializeExportedType(ExportedTypeValue value) + { + ExportedTypeHeaderValue header = value.Header; + if (!header.IsValid || + header.Location is not IToken location) + { + return; + } + + (string typeNamespace, string name) = + NameHelpers.SplitDottedNameToNamespaceAndName(header.Name); + ( + EntityRegistry.EntityBase? implementation, + int typeDefinitionId, + ImmutableArray customAttributes + ) = MaterializeExportedTypeDeclarations(value.Declarations); + + if (implementation is null) + { + ReportWarning( + DiagnosticIds.MissingExportedTypeImplementation, + string.Format( + DiagnosticMessageTemplates.MissingExportedTypeImplementation, + header.Name), + location); + return; + } + + EntityRegistry.ExportedTypeEntity exportedType = + _entityRegistry.GetOrCreateExportedType( + implementation, + typeNamespace, + name, + entity => + { + entity.Attributes = header.Attributes; + entity.TypeDefinitionId = typeDefinitionId; + }); + foreach (EntityRegistry.CustomAttributeEntity attribute in customAttributes) + { + attribute.Owner ??= exportedType; + } + } + + private ( + EntityRegistry.EntityBase? Implementation, + int TypeDefinitionId, + ImmutableArray CustomAttributes + ) MaterializeExportedTypeDeclarations( + ImmutableArray declarations) + { + EntityRegistry.EntityBase? implementation = null; + int typeDefinitionId = 0; + ImmutableArray.Builder customAttributes = + ImmutableArray.CreateBuilder(); + + foreach (ExportedTypeDeclarationValue declaration in declarations) + { + switch (declaration) + { + case ExportedTypeCustomAttributeDirectiveValue customAttribute: + if (MaterializeCustomAttributeDeclaration( + customAttribute.Value, + customAttribute.Location) is { } attribute) + { + customAttributes.Add(attribute); + } + break; + case ExportedTypeMetadataTokenDirectiveValue metadataToken: + EntityRegistry.EntityBase entity = ResolveMetadataToken(metadataToken.Token); + if (entity is EntityRegistry.FakeTypeEntity) + { + ReportError( + DiagnosticIds.InvalidMetadataToken, + DiagnosticMessageTemplates.InvalidMetadataToken, + metadataToken.Location); + } + implementation = ResolveBetterExportedTypeImplementation( + implementation, + entity); + break; + case ExportedTypeFileDirectiveValue file: + implementation = _entityRegistry.FindFile(file.Name); + if (implementation is null) + { + ReportError( + DiagnosticIds.FileNotFound, + string.Format(DiagnosticMessageTemplates.FileNotFound, file.Name), + file.Location); + } + break; + case ExportedTypeAssemblyDirectiveValue assembly: + implementation = _entityRegistry.FindAssemblyReference(assembly.Name); + if (implementation is null) + { + ReportError( + DiagnosticIds.AssemblyNotFound, + string.Format( + DiagnosticMessageTemplates.AssemblyNotFound, + assembly.Name), + assembly.Location); + } + break; + case NestedExportedTypeDirectiveValue nested: + EntityRegistry.ExportedTypeEntity? containingType = + ResolveExportedType(nested.Name, nested.Location); + if (containingType is null) + { + ReportError( + DiagnosticIds.ExportedTypeNotFound, + string.Format( + DiagnosticMessageTemplates.ExportedTypeNotFound, + GetExportedTypeDisplayName(nested.Name)), + nested.Location); + } + else + { + implementation = ResolveBetterExportedTypeImplementation( + implementation, + containingType); + } + break; + case ExportedTypeDefinitionIdDirectiveValue definitionId: + typeDefinitionId = definitionId.Value; + break; + } + } + + return (implementation, typeDefinitionId, customAttributes.ToImmutable()); + } + + private static EntityRegistry.EntityBase? ResolveBetterExportedTypeImplementation( + EntityRegistry.EntityBase? current, + EntityRegistry.EntityBase? candidate) + { + if (candidate is null) + { + return current; + } + + if (current is null) + { + return candidate; + } + + return GetImplementationPriority(candidate) >= GetImplementationPriority(current) + ? candidate + : current; + + static int GetImplementationPriority(EntityRegistry.EntityBase entity) + => entity switch + { + EntityRegistry.FileEntity => 4, + EntityRegistry.AssemblyReferenceEntity => 3, + EntityRegistry.ExportedTypeEntity => 2, + _ => 1 + }; + } + + private EntityRegistry.ExportedTypeEntity? ResolveExportedType( + TypeName typeName, + IToken location) + { + Stack containingTypes = new(); + for (TypeName? containingType = typeName; + containingType is not null; + containingType = containingType.ContainingTypeName) + { + containingTypes.Push(containingType); + } + + EntityRegistry.ExportedTypeEntity? exportedType = null; + while (containingTypes.Count != 0) + { + TypeName containingType = containingTypes.Pop(); + (string typeNamespace, string name) = + NameHelpers.SplitDottedNameToNamespaceAndName(containingType.DottedName); + exportedType = _entityRegistry.FindExportedType( + exportedType, + typeNamespace, + name); + if (exportedType is null) + { + ReportError( + DiagnosticIds.ExportedTypeNotFound, + string.Format( + DiagnosticMessageTemplates.ExportedTypeNotFound, + containingType.DottedName), + location); + return null; + } + } + + return exportedType; + } + + private static string GetExportedTypeDisplayName(TypeName typeName) + { + Stack names = new(); + for (TypeName? current = typeName; + current is not null; + current = current.ContainingTypeName) + { + names.Push(current.DottedName); + } + + return string.Join("/", names); + } + + internal void MaterializeExportedType(CILParser.ExptypeBlockContext context) + { + if (context.Value is ExportedTypeValue value) + { + MaterializeExportedType(value); + } + } + +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Files.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Files.cs new file mode 100644 index 00000000000000..822528ae5e6da8 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Files.cs @@ -0,0 +1,79 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection.Metadata; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal bool ParseFileAttribute(IToken token) + => token.Text != "nometadata"; + + internal bool ParseFileEntry(IToken token) + { + Debug.Assert(token.Text == ".entrypoint"); + return true; + } + + internal void AddFileAttribute( + CILParser.FileDeclarationBuilder builder, + bool hasMetadata) + => builder.HasMetadata &= hasMetadata; + + internal void SetFileName(CILParser.FileDeclarationBuilder builder, string name) + => builder.Name = name; + + internal void AddFileEntry( + CILParser.FileDeclarationBuilder builder, + bool isEntryPoint) + => builder.IsEntryPoint |= isEntryPoint; + + internal void SetFileHash( + CILParser.FileDeclarationBuilder builder, + ImmutableArray hash) + => builder.Hash = hash; + + internal void EndFileDeclaration( + CILParser.FileDeclContext context, + CILParser.FileDeclarationBuilder builder, + int initialSyntaxErrorCount) + { + context.HasSyntaxError = + HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null; + context.Value = context.HasSyntaxError + ? null + : new FileDeclarationValue( + builder.Name, + builder.HasMetadata, + builder.IsEntryPoint, + builder.Hash); + } + + private EntityRegistry.FileEntity MaterializeFileDeclaration(FileDeclarationValue declaration) + { + BlobBuilder? hash = declaration.Hash is { } value ? CreateManifestBlob(value) : null; + EntityRegistry.FileEntity entity = + _entityRegistry.GetOrCreateFile(declaration.Name, declaration.HasMetadata, hash); + if (declaration.IsEntryPoint) + { + _entityRegistry.EntryPoint = entity; + } + + return entity; + } + + internal EntityRegistry.FileEntity MaterializeFileDeclaration( + CILParser.FileDeclContext context) + { + Debug.Assert(context.Value is not null); + FileDeclarationValue declaration = + context.Value ?? new(string.Empty, HasMetadata: true, IsEntryPoint: false, Hash: null); + return MaterializeFileDeclaration(declaration); + } +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.References.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.References.cs new file mode 100644 index 00000000000000..3e9ecb258284ef --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.References.cs @@ -0,0 +1,85 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using System.Reflection; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal AssemblyReferenceHeaderValue CreateAssemblyReferenceHeader( + AssemblyFlags attributes, + string name, + string alias) + => new AssemblyReferenceHeaderValue(true, attributes, name, alias); + + internal AssemblyReferenceValue CreateAssemblyReference( + AssemblyReferenceHeaderValue header, + ImmutableArray declarations) + => new AssemblyReferenceValue( + header, + declarations); + + internal AssemblyDeclarationValue CreateAssemblyReferenceHashDeclaration( + ImmutableArray value) + => new AssemblyReferenceHashDirectiveValue(value); + + internal AssemblyDeclarationValue CreateAssemblyReferencePublicKeyTokenDeclaration( + ImmutableArray value) + => new AssemblyReferencePublicKeyTokenDirectiveValue(value); + + internal AssemblyDeclarationValue? CreateAssemblyReferenceAutoDeclaration() => null; + + private EntityRegistry.AssemblyReferenceEntity MaterializeAssemblyReferenceHeader( + AssemblyReferenceHeaderValue header) + { + (ProcessorArchitecture architecture, AssemblyFlags flags) = + GetArchAndFlags(header.Attributes); + return _entityRegistry.GetOrCreateAssemblyReference( + header.Alias, + assemblyReference => + { + assemblyReference.Name = header.Name; + assemblyReference.Flags = flags; + assemblyReference.ProcessorArchitecture = architecture; + }); + } + + private void MaterializeAssemblyReference(AssemblyReferenceValue reference) + { + if (!reference.Header.IsValid) + { + return; + } + + EntityRegistry.AssemblyReferenceEntity entity = + MaterializeAssemblyReferenceHeader(reference.Header); + foreach (AssemblyDeclarationValue declaration in reference.Declarations) + { + switch (declaration) + { + case AssemblyReferenceHashDirectiveValue hash: + entity.Hash = CreateManifestBlob(hash.Value); + break; + case AssemblyReferencePublicKeyTokenDirectiveValue publicKeyToken: + entity.PublicKeyOrToken = CreateManifestBlob(publicKeyToken.Value); + entity.Flags &= ~AssemblyFlags.PublicKey; + break; + default: + ApplyAssemblyOrReferenceDirective(entity, declaration); + break; + } + } + } + + internal void MaterializeAssemblyReference(CILParser.AssemblyRefBlockContext context) + { + if (context.Value is AssemblyReferenceValue reference) + { + MaterializeAssemblyReference(reference); + } + } + +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Resources.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Resources.cs new file mode 100644 index 00000000000000..493e6611acd41a --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Resources.cs @@ -0,0 +1,159 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using System.Reflection; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal ManifestResourceAttributes AddManifestResourceAttribute( + ManifestResourceAttributes attributes, + ManifestResourceAttributes value) + => attributes | value; + + internal ManifestResourceAttributes ParseManifestResourceAttribute(IToken token) + => token.Text switch + { + "public" => ManifestResourceAttributes.Public, + "private" => ManifestResourceAttributes.Private, + _ => 0 + }; + + internal ManifestResourceHeaderValue CreateManifestResourceHeader( + ManifestResourceAttributes attributes, + string name, + string alias, + IToken location) + => new ManifestResourceHeaderValue(true, attributes, name, alias, location); + + internal ManifestResourceValue CreateManifestResource( + ManifestResourceHeaderValue header, + ImmutableArray declarations) + => new ManifestResourceValue( + header, + declarations); + + internal ManifestResourceDeclarationValue CreateManifestResourceFileDeclaration( + string name, + IToken offset, + IToken location) + => new ManifestResourceFileDirectiveValue(name, (uint)ParseInt32(offset), location); + + internal ManifestResourceDeclarationValue CreateManifestResourceAssemblyDeclaration( + string name) + => new ManifestResourceAssemblyDirectiveValue(name); + + internal ManifestResourceDeclarationValue CreateManifestResourceCustomAttributeDeclaration( + CustomAttributeDeclarationValue? value, + IToken location) + => new ManifestResourceCustomAttributeDirectiveValue(value, location); + + private void MaterializeManifestResource(ManifestResourceValue value) + { + ManifestResourceHeaderValue header = value.Header; + if (!header.IsValid || + header.Location is not IToken location) + { + return; + } + + ( + EntityRegistry.EntityBase? implementation, + uint offset, + ImmutableArray customAttributes + ) = MaterializeManifestResourceDeclarations(value.Declarations); + + if (implementation is null) + { + offset = (uint)_manifestResources.Count; + byte[]? resourceData = _resourceLocator(header.Alias); + if (resourceData is null) + { + ReportError( + DiagnosticIds.FileNotFound, + string.Format( + DiagnosticMessageTemplates.FileNotFound, + header.Alias), + location); + _manifestResources.WriteInt32(0); + } + else + { + _manifestResources.WriteInt32(resourceData.Length); + _manifestResources.WriteBytes(resourceData); + } + } + + EntityRegistry.ManifestResourceEntity resource = + _entityRegistry.CreateManifestResource(header.Name, offset); + resource.Attributes = header.Attributes; + resource.Implementation = implementation; + foreach (EntityRegistry.CustomAttributeEntity customAttribute in customAttributes) + { + customAttribute.Owner ??= resource; + } + } + + private ( + EntityRegistry.EntityBase? Implementation, + uint Offset, + ImmutableArray CustomAttributes + ) MaterializeManifestResourceDeclarations( + ImmutableArray declarations) + { + EntityRegistry.EntityBase? implementation = null; + uint offset = 0; + ImmutableArray.Builder customAttributes = + ImmutableArray.CreateBuilder(); + + foreach (ManifestResourceDeclarationValue declaration in declarations) + { + switch (declaration) + { + case ManifestResourceCustomAttributeDirectiveValue customAttribute: + if (MaterializeCustomAttributeDeclaration( + customAttribute.Value, + customAttribute.Location) is { } attribute) + { + customAttributes.Add(attribute); + } + break; + case ManifestResourceFileDirectiveValue file + when implementation is not EntityRegistry.AssemblyReferenceEntity: + EntityRegistry.FileEntity? fileEntity = _entityRegistry.FindFile(file.Name); + if (fileEntity is null) + { + ReportError( + DiagnosticIds.FileNotFound, + string.Format(DiagnosticMessageTemplates.FileNotFound, file.Name), + file.Location); + } + else + { + implementation = fileEntity; + offset = file.Offset; + } + break; + case ManifestResourceAssemblyDirectiveValue assembly: + implementation = + _entityRegistry.GetOrCreateAssemblyReference(assembly.Name, _ => { }); + break; + } + } + + return (implementation, offset, customAttributes.ToImmutable()); + } + + internal void MaterializeManifestResource(CILParser.ManifestResBlockContext context) + { + if (context.Value is ManifestResourceValue value) + { + MaterializeManifestResource(value); + } + } + +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Typedefs.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Typedefs.cs new file mode 100644 index 00000000000000..2507487a15cfe0 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Typedefs.cs @@ -0,0 +1,134 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using System.Reflection.Metadata; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + private readonly Dictionary _typedefs = new(); + + internal TypedefDeclarationValue CreateTypeSignatureTypedef( + TypeValue type, + string alias) + => new TypeSignatureTypedefDeclarationValue(type, alias); + + internal TypedefDeclarationValue CreateClassTypedef( + ClassNameValue type, + string alias) + => new ClassTypedefDeclarationValue(type, alias); + + internal TypedefDeclarationValue CreateMemberTypedef( + MemberReferenceValue member, + string alias) + => new MemberTypedefDeclarationValue(member, alias); + + internal TypedefDeclarationValue CreateCustomAttributeTypedefDeclaration( + CustomAttributeDescriptorValue attribute, + IToken location, + string alias) + => new CustomAttributeTypedefDeclarationValue( + attribute, + location, + alias); + + private void MaterializeTypedef(TypedefDeclarationValue declaration) + { + switch (declaration) + { + case TypeSignatureTypedefDeclarationValue type: + BlobBuilder typeBlob = MaterializeType(type.Type); + BlobBuilder copy = new(typeBlob.Count); + typeBlob.WriteContentTo(copy); + _typedefs[type.Alias] = new TypedefEntry.TypeBlob(copy); + break; + case ClassTypedefDeclarationValue type: + _typedefs[type.Alias] = new TypedefEntry.Type(ResolveClassName(type.Type)); + break; + case MemberTypedefDeclarationValue member: + _typedefs[member.Alias] = + new TypedefEntry.Member(MaterializeMemberReference(member.Member)); + break; + case CustomAttributeTypedefDeclarationValue customAttribute: + EntityRegistry.CustomAttributeEntity attribute = + MaterializeCustomAttribute(customAttribute.Attribute); + EntityRegistry.EntityBase? owner = attribute.Owner; + attribute.Owner = null; + _typedefs[customAttribute.Alias] = + new TypedefEntry.CustomAttribute(attribute.Constructor, attribute.Value, owner); + break; + } + } + + internal void MaterializeTypedef(CILParser.TypedefDeclContext context) + { + if (context.Value is TypedefDeclarationValue declaration) + { + MaterializeTypedef(declaration); + } + } + + private EntityRegistry.TypeEntity? TryResolveTypedefAsType(string alias) + { + if (_typedefs.TryGetValue(alias, out TypedefEntry? entry) && + entry is TypedefEntry.Type type) + { + return type.Entity; + } + + return null; + } + + private BlobBuilder? TryResolveTypedefAsTypeBlob(string alias) + { + if (!_typedefs.TryGetValue(alias, out TypedefEntry? entry)) + { + return null; + } + + if (entry is TypedefEntry.TypeBlob blob) + { + return blob.Blob; + } + + if (entry is TypedefEntry.Type type) + { + BlobBuilder result = new(5); + result.WriteByte((byte)SignatureTypeKind.Class); + result.WriteTypeEntity(type.Entity); + return result; + } + + return null; + } + + private EntityRegistry.EntityBase? TryResolveTypedefAsMember(string alias) + { + if (_typedefs.TryGetValue(alias, out TypedefEntry? entry) && + entry is TypedefEntry.Member member) + { + return member.Entity; + } + + return null; + } + + private ( + EntityRegistry.EntityBase Constructor, + BlobBuilder Value, + EntityRegistry.EntityBase? Owner)? + TryResolveTypedefAsCustomAttribute(string alias) + { + if (_typedefs.TryGetValue(alias, out TypedefEntry? entry) && + entry is TypedefEntry.CustomAttribute customAttribute) + { + return (customAttribute.Constructor, customAttribute.Value, customAttribute.Owner); + } + + return null; + } +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.VTable.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.VTable.cs new file mode 100644 index 00000000000000..dc0fae847bd2a6 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.VTable.cs @@ -0,0 +1,78 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal ushort ParseVTableFixupAttribute(IToken token) + => token.Text switch + { + "int32" => VTableFixupSupport.COR_VTABLE_32BIT, + "int64" => VTableFixupSupport.COR_VTABLE_64BIT, + "fromunmanaged" => VTableFixupSupport.COR_VTABLE_FROM_UNMANAGED, + "callmostderived" => VTableFixupSupport.COR_VTABLE_CALL_MOST_DERIVED, + "retainappdomain" => + VTableFixupSupport.COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN, + _ => 0 + }; + + internal ushort AddVTableFixupAttribute(ushort attributes, ushort value) + => (ushort)(attributes | value); + + internal ushort CompleteVTableFixupAttributes(ushort attributes) => attributes; + + internal VTableFixupValue CreateVTableFixup( + IToken slotCount, + ushort flags, + IToken dataLabel) + { + int diagnosticCount = _diagnostics.Count; + int count = ParseInt32(slotCount); + bool hasValidSlotCount = _diagnostics.Count == diagnosticCount; + if (hasValidSlotCount && (uint)count > ushort.MaxValue) + { + ReportError( + DiagnosticIds.InvalidVTableSlotCount, + string.Format( + DiagnosticMessageTemplates.InvalidVTableSlotCount, + count, + ushort.MaxValue), + slotCount); + hasValidSlotCount = false; + } + + return new VTableFixupValue( + count, + flags, + ParseIdentifier(dataLabel), + hasValidSlotCount); + } + + internal RawVTableValue CreateRawVTable(ImmutableArray value) + => new(value); + + internal void MaterializeVTable(CILParser.VtableDeclContext context) + => ReportError( + DiagnosticIds.UnsupportedVTableDeclaration, + DiagnosticMessageTemplates.UnsupportedVTableDeclaration, + context); + + internal void MaterializeVTableFixup(CILParser.VtfixupDeclContext context) + { + if (context.Value is VTableFixupValue value) + { + _vtableFixups.Add(new VTableFixupDeclaration( + new VTableFixupSupport.VTableFixupEntry( + value.SlotCount, + value.Flags, + value.DataLabel), + context, + value.HasValidSlotCount)); + } + } +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Marshalling.Actions.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Marshalling.Actions.cs new file mode 100644 index 00000000000000..4eb060b9e92bd5 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Marshalling.Actions.cs @@ -0,0 +1,514 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection.Metadata; +using System.Runtime.InteropServices; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + private const byte NativeTypeVoid = 0x01; + private const byte NativeTypeSysChar = 0x0D; + private const byte NativeTypeVariant = 0x0E; + private const byte NativeTypePointer = 0x10; + private const byte NativeTypeDecimal = 0x11; + private const byte NativeTypeDate = 0x12; + private const byte NativeTypeObjectReference = 0x18; + private const byte NativeTypeNestedStruct = 0x21; + private const byte NativeTypeMax = 0x50; + + internal MarshallingDescriptorValue CreateEmptyMarshallingDescriptor() + => MarshallingDescriptorValue.Empty; + + internal MarshallingDescriptorValue CompleteMarshalClause( + MarshallingDescriptorValue value) + => value; + + internal void SetMarshalBlobNativeType( + CILParser.MarshalBlobBuilder builder, + NativeTypeValue value) + => builder.NativeType = value; + + internal void AddMarshalBlobByte(CILParser.MarshalBlobBuilder builder, byte value) + => (builder.RawBytes ??= new BlobBuilder()).WriteByte(value); + + internal MarshallingDescriptorValue CreateMarshallingDescriptor( + CILParser.MarshalBlobBuilder builder) + => new(builder.RawBytes, builder.NativeType); + + internal void SetNativeTypeElement( + CILParser.NativeTypeBuilder builder, + NativeTypeElementValue value) + => builder.Element = value; + + internal void AddNativeTypeArrayPointerInfo( + CILParser.NativeTypeBuilder builder, + NativeTypeArrayPointerInfoValue value) + => (builder.ArrayPointerInfo ??= new List()) + .Add(value); + + internal NativeTypeValue CreateNativeType( + IToken token, + CILParser.NativeTypeBuilder builder) + => new( + token, + builder.Element, + builder.ArrayPointerInfo?.ToImmutableArray() ?? []); + + internal NativeTypeArrayPointerInfoValue CreatePointerNativeType() + => new NativeTypeArrayPointerInfoValue(NativeTypeArrayPointerInfoKind.Pointer); + + internal NativeTypeArrayPointerInfoValue CreatePointerArrayTypeNoSizeData() + => new NativeTypeArrayPointerInfoValue(NativeTypeArrayPointerInfoKind.ArrayNoSizeData); + + internal NativeTypeArrayPointerInfoValue CreatePointerArrayTypeSize(IToken size) + => new NativeTypeArrayPointerInfoValue(NativeTypeArrayPointerInfoKind.ArraySize, Size: size); + + internal NativeTypeArrayPointerInfoValue CreatePointerArrayTypeSizeParamIndex( + IToken size, + IToken parameterIndex) + => new NativeTypeArrayPointerInfoValue( + NativeTypeArrayPointerInfoKind.ArraySizeParamIndex, + size, + parameterIndex); + + internal NativeTypeArrayPointerInfoValue CreatePointerArrayTypeParamIndex( + IToken parameterIndex) + => new NativeTypeArrayPointerInfoValue( + NativeTypeArrayPointerInfoKind.ArrayParamIndex, + ParameterIndex: parameterIndex); + + internal NativeTypeElementValue CreateEmptyNativeType() + => EmptyNativeTypeElementValue.Instance; + + internal NativeTypeElementValue CreateDeprecatedCustomMarshallerNativeType( + CILParser.NativeTypeElementContext context, + string guid, + string nativeTypeName, + string marshallerType, + string cookie) + => new CustomMarshallerNativeTypeElementValue( + context.Start, + guid, + nativeTypeName, + marshallerType, + cookie); + + internal NativeTypeElementValue CreateCustomMarshallerNativeType( + string marshallerType, + string cookie) + => new CustomMarshallerNativeTypeElementValue( + null, + null, + null, + marshallerType, + cookie); + + internal NativeTypeElementValue CreateFixedSysStringNativeType(IToken size) + => new FixedSysStringNativeTypeElementValue(size); + + internal NativeTypeElementValue CreateFixedArrayNativeType( + IToken size, + NativeTypeValue element) + => new FixedArrayNativeTypeElementValue(size, element); + + internal NativeTypeElementValue CreateDeprecatedNativeType( + CILParser.NativeTypeElementContext context, + IToken nativeType) + => new DeprecatedNativeTypeElementValue(context.Start, nativeType.Type); + + internal NativeTypeElementValue CreateSimpleNativeType(IToken nativeType) + => new SimpleNativeTypeElementValue(nativeType.Type); + + internal NativeTypeElementValue CreateIidNativeType( + IToken nativeType, + IidParamIndexValue index) + => new IidNativeTypeElementValue(nativeType.Type, index); + + internal NativeTypeElementValue CreateSafeArrayNativeType( + VariantTypeValue variantType, + string? userDefinedType) + => new SafeArrayNativeTypeElementValue(variantType, userDefinedType); + + internal NativeTypeElementValue CreateUnsignedNativeType(IToken nativeType) + => new UnsignedNativeTypeElementValue(nativeType.Type); + + internal NativeTypeElementValue CreateNestedStructNativeType( + CILParser.NativeTypeElementContext context) + => new NestedStructNativeTypeElementValue(context.Start); + + internal NativeTypeElementValue CreateAnsiBstrNativeType() + => AnsiBstrNativeTypeElementValue.Instance; + + internal NativeTypeElementValue CreateVariantBoolNativeType() + => VariantBoolNativeTypeElementValue.Instance; + + internal NativeTypeElementValue CreateNativeTypeTypedef( + CILParser.NativeTypeElementContext context, + string alias) + => new NativeTypeTypedefValue(context.Start, alias); + + internal IidParamIndexValue GetIidParamIndex(IToken index) + => new(index); + + internal void SetVariantTypeElement( + CILParser.VariantTypeBuilder builder, + VariantTypeElementValue value) + => builder.Element = value; + + internal void AddVariantTypeModifier( + CILParser.VariantTypeBuilder builder, + IToken modifier) + { + builder.Modifiers |= modifier.Type switch + { + CILParser.ARRAY_TYPE_NO_BOUNDS => VarEnum.VT_ARRAY, + CILParser.VECTOR => VarEnum.VT_VECTOR, + CILParser.REF => VarEnum.VT_BYREF, + _ => throw new UnreachableException() + }; + } + + internal VariantTypeValue CreateVariantType(CILParser.VariantTypeBuilder builder) + => new(builder.Element, builder.Modifiers); + + internal VariantTypeElementValue GetVariantTypeElement(IToken variantType) + => new VariantTypeElementValue(variantType.Type); + + private BlobBuilder MaterializeMarshallingDescriptor(MarshallingDescriptorValue? value) + { + if (value?.RawBytes is BlobBuilder rawBytes) + { + return rawBytes; + } + + return MaterializeNativeType(value?.NativeType ?? NativeTypeValue.Empty); + } + + private BlobBuilder MaterializeNativeType(NativeTypeValue value) + { + if (value.Element is null) + { + return new BlobBuilder(); + } + + BlobBuilder element = MaterializeNativeTypeElement(value.Element); + if (value.ArrayPointerInfo.IsDefaultOrEmpty) + { + return element; + } + + BlobBuilder prefix = new(value.ArrayPointerInfo.Length); + BlobBuilder suffix = new(); + + for (int i = value.ArrayPointerInfo.Length - 1; i >= 0; i--) + { + NativeTypeArrayPointerInfoValue info = value.ArrayPointerInfo[i]; + if (info.Kind == NativeTypeArrayPointerInfoKind.Pointer) + { + if (value.Token is IToken token) + { + ReportWarning( + DiagnosticIds.DeprecatedNativeType, + string.Format(DiagnosticMessageTemplates.DeprecatedNativeType, "pointer in array"), + token); + } + prefix.WriteByte(NativeTypePointer); + } + else + { + prefix.WriteByte((byte)UnmanagedType.LPArray); + if (element.Count == 0) + { + element.WriteByte(NativeTypeMax); + } + } + } + + foreach (NativeTypeArrayPointerInfoValue info in value.ArrayPointerInfo) + { + switch (info.Kind) + { + case NativeTypeArrayPointerInfoKind.ArraySize: + suffix.WriteCompressedInteger(0); + suffix.WriteCompressedInteger(ParseMarshallingInt32(info.Size)); + suffix.WriteCompressedInteger(0); + break; + case NativeTypeArrayPointerInfoKind.ArraySizeParamIndex: + suffix.WriteCompressedInteger(ParseMarshallingInt32(info.ParameterIndex)); + suffix.WriteCompressedInteger(ParseMarshallingInt32(info.Size)); + suffix.WriteCompressedInteger(1); + break; + case NativeTypeArrayPointerInfoKind.ArrayParamIndex: + suffix.WriteCompressedInteger(ParseMarshallingInt32(info.ParameterIndex)); + break; + } + } + + prefix.LinkSuffix(element); + prefix.LinkSuffix(suffix); + return prefix; + } + + private BlobBuilder MaterializeNativeTypeElement(NativeTypeElementValue value) + { + switch (value) + { + case EmptyNativeTypeElementValue: + return new BlobBuilder(); + case CustomMarshallerNativeTypeElementValue customMarshaller: + return MaterializeCustomMarshallerNativeType(customMarshaller); + case FixedSysStringNativeTypeElementValue fixedSysString: + { + BlobBuilder blob = CreateNativeTypeBlob(UnmanagedType.ByValTStr); + blob.WriteCompressedInteger(ParseInt32(fixedSysString.Size)); + return blob; + } + case FixedArrayNativeTypeElementValue fixedArray: + { + BlobBuilder blob = CreateNativeTypeBlob(UnmanagedType.ByValArray); + blob.WriteCompressedInteger(ParseInt32(fixedArray.Size)); + MaterializeNativeType(fixedArray.Element).WriteContentTo(blob); + return blob; + } + case DeprecatedNativeTypeElementValue deprecated: + return MaterializeDeprecatedNativeType(deprecated); + case SimpleNativeTypeElementValue simple: + return CreateNativeTypeBlob(GetSimpleNativeType(simple.TokenType)); + case IidNativeTypeElementValue iid: + return MaterializeIidNativeType(iid); + case SafeArrayNativeTypeElementValue safeArray: + return MaterializeSafeArrayNativeType(safeArray); + case UnsignedNativeTypeElementValue unsigned: + return CreateNativeTypeBlob(GetUnsignedNativeType(unsigned.TokenType)); + case NestedStructNativeTypeElementValue nestedStruct: + ReportWarning( + DiagnosticIds.DeprecatedNativeType, + string.Format(DiagnosticMessageTemplates.DeprecatedNativeType, "NESTEDSTRUCT"), + nestedStruct.Token); + return CreateNativeTypeBlob(NativeTypeNestedStruct); + case AnsiBstrNativeTypeElementValue: +#pragma warning disable CS0618 // Preserve the legacy IL native type spelling. + return CreateNativeTypeBlob(UnmanagedType.AnsiBStr); +#pragma warning restore CS0618 + case VariantBoolNativeTypeElementValue: + return CreateNativeTypeBlob(UnmanagedType.VariantBool); + case NativeTypeTypedefValue typedef: + if (TryResolveTypedefAsTypeBlob(typedef.Alias) is { } resolved) + { + BlobBuilder blob = new(resolved.Count); + resolved.WriteContentTo(blob); + return blob; + } + + ReportError( + DiagnosticIds.TypedefNotFound, + string.Format(DiagnosticMessageTemplates.TypedefNotFound, typedef.Alias), + typedef.Token); + return new BlobBuilder(); + default: + throw new UnreachableException(); + } + } + + private BlobBuilder MaterializeCustomMarshallerNativeType( + CustomMarshallerNativeTypeElementValue customMarshaller) + { + BlobBuilder blob = CreateNativeTypeBlob(UnmanagedType.CustomMarshaler); + if (customMarshaller.Guid is not null) + { + if (customMarshaller.Token is IToken token) + { + ReportWarning( + DiagnosticIds.DeprecatedCustomMarshaller, + DiagnosticMessageTemplates.DeprecatedCustomMarshaller, + token); + } + blob.WriteSerializedString(customMarshaller.Guid); + blob.WriteSerializedString(customMarshaller.NativeTypeName); + } + else + { + blob.WriteCompressedInteger(0); + blob.WriteCompressedInteger(0); + } + + blob.WriteSerializedString(customMarshaller.MarshallerType); + blob.WriteSerializedString(customMarshaller.Cookie); + return blob; + } + + private BlobBuilder MaterializeDeprecatedNativeType(DeprecatedNativeTypeElementValue deprecated) + { + (byte value, string name) = deprecated.TokenType switch + { + CILParser.VARIANT => (NativeTypeVariant, "VARIANT"), + CILParser.SYSCHAR => (NativeTypeSysChar, "SYSCHAR"), + CILParser.VOID => (NativeTypeVoid, "VOID"), + CILParser.DECIMAL => (NativeTypeDecimal, "DECIMAL"), + CILParser.DATE => (NativeTypeDate, "DATE"), + CILParser.OBJECTREF => (NativeTypeObjectReference, "OBJECTREF"), + _ => throw new UnreachableException() + }; + + ReportWarning( + DiagnosticIds.DeprecatedNativeType, + string.Format(DiagnosticMessageTemplates.DeprecatedNativeType, name), + deprecated.Token); + return CreateNativeTypeBlob(value); + } + + private BlobBuilder MaterializeIidNativeType(IidNativeTypeElementValue iid) + { + UnmanagedType nativeType = iid.TokenType switch + { + CILParser.IUNKNOWN => UnmanagedType.IUnknown, + CILParser.IDISPATCH => UnmanagedType.IDispatch, + CILParser.INTERFACE => UnmanagedType.Interface, + _ => throw new UnreachableException() + }; + + BlobBuilder blob = CreateNativeTypeBlob(nativeType); + if (MaterializeIidParamIndex(iid.IidParamIndex) is int parameterIndex) + { + blob.WriteCompressedInteger(parameterIndex); + } + return blob; + } + + private BlobBuilder MaterializeSafeArrayNativeType(SafeArrayNativeTypeElementValue safeArray) + { + BlobBuilder blob = CreateNativeTypeBlob(UnmanagedType.SafeArray); + blob.WriteCompressedInteger((int)MaterializeVariantType(safeArray.VariantType)); + if (safeArray.UserDefinedType is null) + { + blob.WriteCompressedInteger(0); + } + else + { + blob.WriteSerializedString(safeArray.UserDefinedType); + } + return blob; + } + + private int? MaterializeIidParamIndex(IidParamIndexValue value) + => value.Index is null ? null : ParseInt32(value.Index); + + private VarEnum MaterializeVariantType(VariantTypeValue value) + => value.Element is null + ? VarEnum.VT_EMPTY + : MaterializeVariantTypeElement(value.Element) | value.Modifiers; + + private static VarEnum MaterializeVariantTypeElement(VariantTypeElementValue value) + => value.TokenType switch + { + CILParser.NULL => VarEnum.VT_EMPTY, + CILParser.VARIANT => VarEnum.VT_VARIANT, + CILParser.CURRENCY => VarEnum.VT_CY, + CILParser.VOID => VarEnum.VT_VOID, + CILParser.BOOL => VarEnum.VT_BOOL, + CILParser.INT8 => VarEnum.VT_I1, + CILParser.INT16 => VarEnum.VT_I2, + CILParser.INT32_ => VarEnum.VT_I4, + CILParser.INT64_ => VarEnum.VT_I8, + CILParser.FLOAT32 => VarEnum.VT_R4, + CILParser.FLOAT64_ => VarEnum.VT_R8, + CILParser.UINT8 => VarEnum.VT_UI1, + CILParser.UINT16 => VarEnum.VT_UI2, + CILParser.UINT32 => VarEnum.VT_UI4, + CILParser.UINT64 => VarEnum.VT_UI8, + CILParser.PTR => VarEnum.VT_PTR, + CILParser.DECIMAL => VarEnum.VT_DECIMAL, + CILParser.DATE => VarEnum.VT_DATE, + CILParser.BSTR => VarEnum.VT_BSTR, + CILParser.LPSTR => VarEnum.VT_LPSTR, + CILParser.LPWSTR => VarEnum.VT_LPWSTR, + CILParser.IUNKNOWN => VarEnum.VT_UNKNOWN, + CILParser.IDISPATCH => VarEnum.VT_DISPATCH, + CILParser.SAFEARRAY => VarEnum.VT_SAFEARRAY, + CILParser.INT => VarEnum.VT_INT, + CILParser.UINT => VarEnum.VT_UINT, + CILParser.ERROR => VarEnum.VT_ERROR, + CILParser.HRESULT => VarEnum.VT_HRESULT, + CILParser.CARRAY => VarEnum.VT_CARRAY, + CILParser.USERDEFINED => VarEnum.VT_USERDEFINED, + CILParser.RECORD => VarEnum.VT_RECORD, + CILParser.FILETIME => VarEnum.VT_FILETIME, + CILParser.BLOB => VarEnum.VT_BLOB, + CILParser.STREAM => VarEnum.VT_STREAM, + CILParser.STORAGE => VarEnum.VT_STORAGE, + CILParser.STREAMED_OBJECT => VarEnum.VT_STREAMED_OBJECT, + CILParser.STORED_OBJECT => VarEnum.VT_STORED_OBJECT, + CILParser.BLOB_OBJECT => VarEnum.VT_BLOB_OBJECT, + CILParser.CF => VarEnum.VT_CF, + CILParser.CLSID => VarEnum.VT_CLSID, + TokenConstants.InvalidType => VarEnum.VT_EMPTY, + _ => throw new UnreachableException() + }; + + private static UnmanagedType GetSimpleNativeType(int tokenType) + { +#pragma warning disable CS0618 // Preserve the legacy IL native type spellings. + return tokenType switch + { + CILParser.CURRENCY => UnmanagedType.Currency, + CILParser.BOOL => UnmanagedType.Bool, + CILParser.INT8 => UnmanagedType.I1, + CILParser.INT16 => UnmanagedType.I2, + CILParser.INT32_ => UnmanagedType.I4, + CILParser.INT64_ => UnmanagedType.I8, + CILParser.FLOAT32 => UnmanagedType.R4, + CILParser.FLOAT64_ => UnmanagedType.R8, + CILParser.ERROR => UnmanagedType.Error, + CILParser.UINT8 => UnmanagedType.U1, + CILParser.UINT16 => UnmanagedType.U2, + CILParser.UINT32 => UnmanagedType.U4, + CILParser.UINT64 => UnmanagedType.U8, + CILParser.BSTR => UnmanagedType.BStr, + CILParser.LPSTR => UnmanagedType.LPStr, + CILParser.LPWSTR => UnmanagedType.LPWStr, + CILParser.LPTSTR => UnmanagedType.LPTStr, + CILParser.STRUCT => UnmanagedType.Struct, + CILParser.INT => UnmanagedType.SysInt, + CILParser.UINT => UnmanagedType.SysUInt, + CILParser.BYVALSTR => UnmanagedType.VBByRefStr, + CILParser.TBSTR => UnmanagedType.TBStr, + CILParser.METHOD => UnmanagedType.FunctionPtr, + CILParser.LPSTRUCT => UnmanagedType.LPStruct, + CILParser.ANY => UnmanagedType.AsAny, + _ => throw new UnreachableException() + }; +#pragma warning restore CS0618 + } + + private static UnmanagedType GetUnsignedNativeType(int tokenType) + => tokenType switch + { + CILParser.INT8 => UnmanagedType.U1, + CILParser.INT16 => UnmanagedType.U2, + CILParser.INT32_ => UnmanagedType.U4, + CILParser.INT64_ => UnmanagedType.U8, + _ => throw new UnreachableException() + }; + + private static BlobBuilder CreateNativeTypeBlob(UnmanagedType value) + => CreateNativeTypeBlob((byte)value); + + private static BlobBuilder CreateNativeTypeBlob(byte value) + { + BlobBuilder blob = new(1); + blob.WriteByte(value); + return blob; + } + + private int ParseMarshallingInt32(IToken? token) + => token is null ? 0 : ParseInt32(token); + +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Members.Class.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Members.Class.cs new file mode 100644 index 00000000000000..000a81d67bcf7d --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Members.Class.cs @@ -0,0 +1,512 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection; +using System.Reflection.Metadata; +using Antlr4.Runtime; + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ + private readonly Dictionary< + EntityRegistry.TypeDefinitionEntity, + List> _pendingClassMethodOverrides = new(); + + private sealed record PendingClassMethodOverride( + EntityRegistry.MemberReferenceEntity Declaration, + EntityRegistry.MemberReferenceEntity? ReferencedBody, + string BodyName, + BlobBuilder BodySignature, + IToken Location); + + private bool PrepareClassMember() + { + _pendingClassCustomAttributeOwner = null; + return !IsDeclarationSuppressed; + } + + internal void ProcessClassDataDeclaration(CILParser.DataDeclContext context) + { + PrepareClassMember(); + _ = context; + } + + internal void ProcessClassSecurityDeclaration(CILParser.SecDeclContext context) + { + if (!PrepareClassMember() || context.HasSyntaxError) + { + return; + } + + EntityRegistry.DeclarativeSecurityAttributeEntity? security = MaterializeSecurityDeclaration(context); + security?.Parent = _currentTypeDefinition.PeekOrDefault(); + } + + internal void ProcessClassSourceDirective(CILParser.ExtSourceSpecContext context) + { + PrepareClassMember(); + _ = context; + } + + internal void ProcessClassLanguageDirective(CILParser.LanguageDeclContext context) + { + PrepareClassMember(); + _ = context; + } + + internal void ProcessClassCustomAttribute(CILParser.CustomAttrDeclContext context) + { + if (IsDeclarationSuppressed || context.HasSyntaxError) + { + return; + } + + if (MaterializeCustomAttributeDeclaration(context) is { } customAttribute) + { + customAttribute.Owner ??= + _pendingClassCustomAttributeOwner ?? + _currentTypeDefinition.PeekOrDefault(); + } + } + + internal void SetClassSize(IToken token) + { + if (PrepareClassMember() && + _currentTypeDefinition.PeekOrDefault() is { } currentType) + { + currentType.ClassSize = ParseInt32(token); + } + } + + internal void SetClassPackingSize(IToken token) + { + if (PrepareClassMember() && + _currentTypeDefinition.PeekOrDefault() is { } currentType) + { + currentType.PackingSize = ParseInt32(token); + } + } + + internal void ProcessClassExport( + CILParser.ExportHeadContext export, + CILParser.ExptypeDeclsContext declarations) + { + PrepareClassMember(); + _ = export; + _ = declarations; + } + + internal void ProcessClassCompilerControl() + { + PrepareClassMember(); + } + + internal void AddClassMethodOverride( + CILParser.ClassDeclContext context, + TypeSpecificationValue declarationOwner, + string declarationName, + byte bodyCallingConvention, + TypeValue bodyReturnType, + TypeSpecificationValue bodyOwner, + string bodyName, + ImmutableArray bodyArguments) + { + if (!PrepareClassMember()) + { + return; + } + + AddClassMethodOverrideCore( + context, + bodyCallingConvention, + bodyReturnType, + declarationOwner, + declarationName, + 0, + bodyArguments, + bodyCallingConvention, + bodyReturnType, + bodyOwner, + bodyName, + 0, + bodyArguments); + } + + internal void AddClassMethodOverride( + CILParser.ClassDeclContext context, + byte declarationCallingConvention, + TypeValue declarationReturnType, + TypeSpecificationValue declarationOwner, + string declarationName, + int declarationArity, + ImmutableArray declarationArguments, + byte bodyCallingConvention, + TypeValue bodyReturnType, + TypeSpecificationValue bodyOwner, + string bodyName, + int bodyArity, + ImmutableArray bodyArguments) + { + if (!PrepareClassMember()) + { + return; + } + + AddClassMethodOverrideCore( + context, + declarationCallingConvention, + declarationReturnType, + declarationOwner, + declarationName, + declarationArity, + declarationArguments, + bodyCallingConvention, + bodyReturnType, + bodyOwner, + bodyName, + bodyArity, + bodyArguments); + } + + private void AddClassMethodOverrideCore( + CILParser.ClassDeclContext context, + byte declarationCallingConvention, + TypeValue declarationReturnType, + TypeSpecificationValue declarationOwner, + string declarationName, + int declarationArity, + ImmutableArray declarationArguments, + byte bodyCallingConvention, + TypeValue bodyReturnType, + TypeSpecificationValue bodyOwner, + string bodyName, + int bodyArity, + ImmutableArray bodyArguments) + { + if (_currentTypeDefinition.PeekOrDefault() is not { } currentType) + { + return; + } + + BlobBuilder declarationSignature = BuildClassMethodOverrideSignature( + declarationCallingConvention, + declarationReturnType, + declarationArguments, + declarationArity); + BlobBuilder bodySignature = BuildClassMethodOverrideSignature( + bodyCallingConvention, + bodyReturnType, + bodyArguments, + bodyArity); + + EntityRegistry.MemberReferenceEntity declaration = + _entityRegistry.CreateLazilyRecordedMemberReference( + ResolveTypeSpecification(declarationOwner), + declarationName, + declarationSignature); + EntityRegistry.TypeEntity resolvedBodyOwner = + ResolveTypeSpecification(bodyOwner); + EntityRegistry.MemberReferenceEntity? referencedBody = + ReferenceEquals(resolvedBodyOwner, currentType) + ? null + : _entityRegistry.CreateLazilyRecordedMemberReference( + resolvedBodyOwner, + bodyName, + bodySignature); + + if (!_pendingClassMethodOverrides.TryGetValue( + currentType, + out List? pendingOverrides)) + { + pendingOverrides = new(); + _pendingClassMethodOverrides.Add(currentType, pendingOverrides); + } + + pendingOverrides.Add( + new( + declaration, + referencedBody, + bodyName, + bodySignature, + context.Start)); + } + + private void CompleteClassMethodOverrides(EntityRegistry.TypeDefinitionEntity type) + { + if (!_pendingClassMethodOverrides.Remove( + type, + out List? pendingOverrides)) + { + return; + } + + foreach (PendingClassMethodOverride pending in pendingOverrides) + { + if (pending.ReferencedBody is { } referencedBody) + { + type.MethodImplementations.Add( + EntityRegistry.CreateUnrecordedMethodImplementation( + type, + referencedBody, + pending.Declaration)); + continue; + } + + EntityRegistry.MethodDefinitionEntity? bodyMethod = null; + bool isAmbiguous = false; + foreach (EntityRegistry.MethodDefinitionEntity candidate in type.Methods) + { + if (candidate.Name != pending.BodyName || + candidate.MethodSignature is null || + !candidate.MethodSignature.ContentEquals(pending.BodySignature)) + { + continue; + } + + if (bodyMethod is not null) + { + isAmbiguous = true; + break; + } + + bodyMethod = candidate; + } + + if (bodyMethod is null || isAmbiguous) + { + ReportError( + DiagnosticIds.InvalidMetadataToken, + $"Override body method '{pending.BodyName}' could not be resolved uniquely", + pending.Location); + continue; + } + + type.MethodImplementations.Add( + EntityRegistry.CreateUnrecordedMethodImplementation( + bodyMethod, + pending.Declaration)); + } + } + + private BlobBuilder BuildClassMethodOverrideSignature( + byte callingConvention, + TypeValue returnType, + ImmutableArray arguments, + int genericArity) + { + BlobBuilder signature = new(); + byte header = callingConvention; + if (genericArity > 0) + { + header |= (byte)SignatureAttributes.Generic; + } + signature.WriteByte(header); + if (genericArity > 0) + { + signature.WriteCompressedInteger(genericArity); + } + + ImmutableArray materializedArguments = + MaterializeSignatureArguments(arguments); + int parameterCount = 0; + foreach (SignatureArg argument in materializedArguments) + { + if (!argument.IsSentinel) + { + parameterCount++; + } + } + signature.WriteCompressedInteger(parameterCount); + MaterializeType(returnType).WriteContentTo(signature); + foreach (SignatureArg argument in materializedArguments) + { + argument.SignatureBlob.WriteContentTo(signature); + } + + return signature; + } + + internal CILParser.CustomAttributeOwnerValue BeginClassGenericParameterDirective( + CILParser.ClassDeclContext context, + IToken index) + { + if (!PrepareClassMember()) + { + return BeginClassGenericDirective(null); + } + + return BeginClassGenericDirective( + FindClassGenericParameter(context, ParseInt32(index))); + } + + internal CILParser.CustomAttributeOwnerValue BeginClassGenericParameterDirective( + string name) + { + if (!PrepareClassMember()) + { + return BeginClassGenericDirective(null); + } + + return BeginClassGenericDirective(FindClassGenericParameter(name)); + } + + internal CILParser.CustomAttributeOwnerValue BeginClassGenericConstraintDirective( + CILParser.ClassDeclContext context, + IToken index, + TypeSpecificationValue constraintType) + { + if (!PrepareClassMember()) + { + return BeginClassGenericDirective(null); + } + + return BeginClassGenericDirective( + FindOrCreateClassGenericConstraint( + FindClassGenericParameter(context, ParseInt32(index)), + constraintType)); + } + + internal CILParser.CustomAttributeOwnerValue BeginClassGenericConstraintDirective( + string name, + TypeSpecificationValue constraintType) + { + if (!PrepareClassMember()) + { + return BeginClassGenericDirective(null); + } + + return BeginClassGenericDirective( + FindOrCreateClassGenericConstraint( + FindClassGenericParameter(name), + constraintType)); + } + + private CILParser.CustomAttributeOwnerValue BeginClassGenericDirective( + EntityRegistry.EntityBase? owner) + { + _pendingClassCustomAttributeOwner = owner; + return new CILParser.CustomAttributeOwnerValue(owner); + } + + internal void AddClassGenericDirectiveAttribute( + CILParser.CustomAttributeOwnerValue ownerValue, + CILParser.CustomAttrDeclContext attribute) + { + if (attribute.HasSyntaxError || + ownerValue.Owner is not { } owner) + { + return; + } + + if (MaterializeCustomAttributeDeclaration(attribute) is { } customAttribute) + { + customAttribute.Owner ??= owner; + } + } + + private EntityRegistry.GenericParameterEntity? FindClassGenericParameter( + CILParser.ClassDeclContext context, + int index) + { + EntityRegistry.TypeDefinitionEntity? currentType = _currentTypeDefinition.PeekOrDefault(); + if (currentType is not null && + index >= 0 && + index < currentType.GenericParameters.Count) + { + return currentType.GenericParameters[index]; + } + + ReportError( + DiagnosticIds.GenericParameterIndexOutOfRange, + string.Format(DiagnosticMessageTemplates.GenericParameterIndexOutOfRange, index), + context); + return null; + } + + private EntityRegistry.GenericParameterEntity? FindClassGenericParameter(string name) + { + EntityRegistry.TypeDefinitionEntity? currentType = _currentTypeDefinition.PeekOrDefault(); + if (currentType is null) + { + return null; + } + + foreach (EntityRegistry.GenericParameterEntity parameter in currentType.GenericParameters) + { + if (parameter.Name == name) + { + return parameter; + } + } + + return null; + } + + private EntityRegistry.GenericParameterConstraintEntity? FindOrCreateClassGenericConstraint( + EntityRegistry.GenericParameterEntity? parameter, + TypeSpecificationValue constraintType) + { + if (parameter is null || + _currentTypeDefinition.PeekOrDefault() is not { } currentType) + { + return null; + } + + EntityRegistry.TypeEntity baseType = + ResolveTypeSpecification(constraintType); + foreach (EntityRegistry.GenericParameterConstraintEntity constraint in parameter.Constraints) + { + if (constraint.BaseType == baseType) + { + return constraint; + } + } + + EntityRegistry.GenericParameterConstraintEntity newConstraint = + EntityRegistry.CreateGenericConstraint(baseType); + newConstraint.Owner = parameter; + parameter.Constraints.Add(newConstraint); + currentType.GenericParameterConstraints.Add(newConstraint); + return newConstraint; + } + + internal void AddInterfaceImplementationAttribute( + CILParser.ClassDeclContext context, + TypeSpecificationValue interfaceType, + CILParser.CustomDescrContext attribute) + { + if (!PrepareClassMember() || + attribute.HasSyntaxError || + _currentTypeDefinition.PeekOrDefault() is not { } currentType) + { + return; + } + + EntityRegistry.TypeEntity resolvedInterface = + ResolveTypeSpecification(interfaceType); + EntityRegistry.InterfaceImplementationEntity? implementation = null; + foreach (EntityRegistry.InterfaceImplementationEntity candidate in currentType.InterfaceImplementations) + { + if (candidate.InterfaceType == resolvedInterface) + { + implementation = candidate; + break; + } + } + + if (implementation is null) + { + implementation = + EntityRegistry.CreateUnrecordedInterfaceImplementation(currentType, resolvedInterface); + currentType.InterfaceImplementations.Add(implementation); + } + + MaterializeCustomAttributeDescriptor(attribute).Owner = implementation; + _ = context; + } + +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Members.Fields.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Members.Fields.cs new file mode 100644 index 00000000000000..c73e937517fb58 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Members.Fields.cs @@ -0,0 +1,166 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; +using System.Globalization; +using System.Reflection; +using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal CILParser.FieldDeclarationBuilder PrepareFieldDeclaration() + { + ClearPendingCustomAttributeOwners(); + return new CILParser.FieldDeclarationBuilder(); + } + + internal void AddFieldAttribute( + CILParser.FieldDeclarationBuilder builder, + CILParser.AttributeValue value) + => builder.Attributes = ApplyAttribute(builder.Attributes, value); + + internal void SetFieldMarshalling( + CILParser.FieldDeclarationBuilder builder, + MarshallingDescriptorValue value) + => builder.Marshalling = value; + + internal FieldDeclarationValue CreateFieldDeclaration( + CILParser.FieldDeclContext context, + CILParser.FieldDeclarationBuilder builder, + int initialSyntaxErrorCount, + CILParser.RepeatOptContext offset, + TypeValue fieldType, + string name, + string? dataDeclarationName, + FieldInitializerValue initializer) + { + if (HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null) + { + return FieldDeclarationValue.Error; + } + + FieldAttributes attributes = builder.Attributes; + if (attributes.HasFlag(FieldAttributes.RTSpecialName)) + { + attributes |= FieldAttributes.SpecialName; + } + + return new FieldDeclarationValue( + true, + attributes, + fieldType, + name, + builder.Marshalling, + dataDeclarationName, + offset.HasValue ? offset.Value : null, + initializer); + } + + internal void DefineField( + CILParser.FieldDeclContext context, + FieldDeclarationValue value) + { + _ = context; + if (IsDeclarationSuppressed || !value.IsValid) + { + return; + } + + FieldDeclarationValue declaration = value; + + BlobBuilder signature = new(); + _ = new BlobEncoder(signature).Field(); + MaterializeType(declaration.FieldType).WriteContentTo(signature); + + EntityRegistry.FieldDefinitionEntity? field = + EntityRegistry.CreateUnrecordedFieldDefinition( + declaration.Attributes, + _currentTypeDefinition.PeekOrDefault() ?? _entityRegistry.ModuleType, + declaration.Name, + signature); + _lastFieldDefinition = field; + _pendingClassCustomAttributeOwner = field; + + if (field is null) + { + return; + } + + field.MarshallingDescriptor = MaterializeMarshallingDescriptor(declaration.Marshalling); + field.DataDeclarationName = declaration.DataDeclarationName; + field.Offset = declaration.Offset; + if (declaration.Initializer.HasValue) + { + field.ConstantValue = declaration.Initializer.ConstantValue; + field.HasConstant = true; + } + } + + internal CILParser.AttributeValue CreateFieldAttribute(IToken token) + => token.Text switch + { + "static" => new CILParser.AttributeValue(FieldAttributes.Static, 0, true), + "public" => new CILParser.AttributeValue( + FieldAttributes.Public, + FieldAttributes.FieldAccessMask, + true), + "private" => new CILParser.AttributeValue( + FieldAttributes.Private, + FieldAttributes.FieldAccessMask, + true), + "family" => new CILParser.AttributeValue( + FieldAttributes.Family, + FieldAttributes.FieldAccessMask, + true), + "initonly" => new CILParser.AttributeValue(FieldAttributes.InitOnly, 0, true), + "rtspecialname" => new CILParser.AttributeValue(FieldAttributes.RTSpecialName, 0, true), + "specialname" => new CILParser.AttributeValue(FieldAttributes.SpecialName, 0, true), + "assembly" => new CILParser.AttributeValue( + FieldAttributes.Assembly, + FieldAttributes.FieldAccessMask, + true), + "famandassem" => new CILParser.AttributeValue( + FieldAttributes.FamANDAssem, + FieldAttributes.FieldAccessMask, + true), + "famorassem" => new CILParser.AttributeValue( + FieldAttributes.FamORAssem, + FieldAttributes.FieldAccessMask, + true), + "privatescope" => new CILParser.AttributeValue( + FieldAttributes.PrivateScope, + FieldAttributes.FieldAccessMask, + true), + "literal" => new CILParser.AttributeValue(FieldAttributes.Literal, 0, true), +#pragma warning disable SYSLIB0050 + "notserialized" => new CILParser.AttributeValue(FieldAttributes.NotSerialized, 0, true), +#pragma warning restore SYSLIB0050 + "volatile" => new CILParser.AttributeValue(0, 0, true), + _ => throw new UnreachableException(), + }; + + internal CILParser.AttributeValue CreateRawFieldAttribute(IToken token) + => new((FieldAttributes)ParseInt32(token), 0, false); + + internal string GetFieldDataName(IToken token) + => ParseIdentifier(token); + + internal string GetFieldDataOffset(IToken token) + => ParseInt32(token).ToString(CultureInfo.InvariantCulture); + + internal void SetFieldOffset(CILParser.RepeatOptContext context, IToken token) + { + context.Value = ParseInt32(token); + context.HasValue = true; + } + + internal EntityRegistry.EntityBase MaterializeFieldReference( + CILParser.FieldRefContext context) + => MaterializeFieldReference(context.Value); +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Members.PropertiesEvents.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Members.PropertiesEvents.cs new file mode 100644 index 00000000000000..4af6e7321c03e1 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Members.PropertiesEvents.cs @@ -0,0 +1,258 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; +using System.Reflection; +using System.Reflection.Metadata; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal void AddPropertyAttribute( + CILParser.PropertyHeaderBuilder builder, + CILParser.AttributeValue value) + => builder.Attributes = ApplyAttribute(builder.Attributes, value); + + internal PropertyHeaderValue CreatePropertyHeader( + CILParser.PropHeadContext context, + CILParser.PropertyHeaderBuilder builder, + int initialSyntaxErrorCount, + byte callingConvention, + TypeValue propertyType, + string name, + System.Collections.Immutable.ImmutableArray arguments, + FieldInitializerValue initializer) + { + if (HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null) + { + return PropertyHeaderValue.Error; + } + + return new PropertyHeaderValue( + true, + builder.Attributes, + callingConvention, + propertyType, + name, + arguments, + initializer); + } + + internal CILParser.AttributeValue CreatePropertyAttribute(IToken token) + => token.Text switch + { + "specialname" => new CILParser.AttributeValue( + PropertyAttributes.SpecialName, + 0, + true), + "rtspecialname" => new CILParser.AttributeValue(0, 0, true), + _ => throw new UnreachableException(), + }; + + internal CILParser.PropertyBodyValue BeginProperty(PropertyHeaderValue value) + { + PrepareClassMember(); + EntityRegistry.PropertyEntity? property = null; + if (!IsDeclarationSuppressed && + value.IsValid && + _currentTypeDefinition.PeekOrDefault() is { } currentType) + { + BlobBuilder signature = new(); + signature.WriteByte( + (byte)(value.CallingConvention | (byte)SignatureKind.Property)); + signature.WriteCompressedInteger(value.Arguments.Length); + MaterializeType(value.PropertyType).WriteContentTo(signature); + foreach (SignatureArgumentValue argument in value.Arguments) + { + MaterializeSignatureArgument(argument).SignatureBlob.WriteContentTo(signature); + } + + property = new EntityRegistry.PropertyEntity(value.Attributes, signature, value.Name); + if (value.Initializer.HasValue) + { + property.ConstantValue = value.Initializer.ConstantValue; + property.HasConstant = true; + property.Attributes |= PropertyAttributes.HasDefault; + } + + currentType.Properties.Add(property); + } + + return new CILParser.PropertyBodyValue(property); + } + + internal void AddPropertySetter( + CILParser.PropertyBodyValue body, + MethodReferenceValue value) + => AddPropertyAccessor(body, MethodSemanticsAttributes.Setter, value); + + internal void AddPropertyGetter( + CILParser.PropertyBodyValue body, + MethodReferenceValue value) + => AddPropertyAccessor(body, MethodSemanticsAttributes.Getter, value); + + internal void AddPropertyOther( + CILParser.PropertyBodyValue body, + MethodReferenceValue value) + => AddPropertyAccessor(body, MethodSemanticsAttributes.Other, value); + + private void AddPropertyAccessor( + CILParser.PropertyBodyValue body, + MethodSemanticsAttributes semantics, + MethodReferenceValue value) + { + if (body.Property is { } property) + { + property.Accessors.Add( + (semantics, MaterializeMethodReference(value))); + } + } + + internal void AddPropertyCustomAttribute( + CILParser.PropertyBodyValue body, + CILParser.CustomAttrDeclContext attribute) + { + if (attribute.HasSyntaxError || + body.Property is not { } property) + { + return; + } + + if (MaterializeCustomAttributeDeclaration(attribute) is { } customAttribute) + { + customAttribute.Owner ??= property; + } + } + + internal void ProcessPropertySourceDirective( + CILParser.PropertyBodyValue body, + CILParser.ExtSourceSpecContext context) + { + _ = body; + _ = context; + } + + internal void ProcessPropertyLanguageDirective( + CILParser.PropertyBodyValue body, + CILParser.LanguageDeclContext context) + { + _ = body; + _ = context; + } + + internal void AddEventAttribute( + CILParser.EventHeaderBuilder builder, + CILParser.AttributeValue value) + => builder.Attributes = ApplyAttribute(builder.Attributes, value); + + internal EventHeaderValue CreateEventHeader( + CILParser.EventHeadContext context, + CILParser.EventHeaderBuilder builder, + int initialSyntaxErrorCount, + TypeSpecificationValue? eventType, + string name) + { + if (HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null) + { + return EventHeaderValue.Error; + } + + return new EventHeaderValue( + true, + builder.Attributes, + eventType, + name); + } + + internal CILParser.AttributeValue CreateEventAttribute(IToken token) + => token.Text switch + { + "specialname" => new CILParser.AttributeValue( + EventAttributes.SpecialName, + 0, + true), + "rtspecialname" => new CILParser.AttributeValue(0, 0, true), + _ => throw new UnreachableException(), + }; + + internal CILParser.EventBodyValue BeginEvent(EventHeaderValue value) + { + PrepareClassMember(); + EntityRegistry.EventEntity? @event = null; + if (!IsDeclarationSuppressed && + value.IsValid && + _currentTypeDefinition.PeekOrDefault() is { } currentType) + { + @event = new EntityRegistry.EventEntity( + value.Attributes, + value.EventType is null + ? null + : ResolveTypeSpecification(value.EventType), + value.Name); + currentType.Events.Add(@event); + } + + return new CILParser.EventBodyValue(@event); + } + + internal void AddEventAdder(CILParser.EventBodyValue body, MethodReferenceValue value) + => AddEventAccessor(body, MethodSemanticsAttributes.Adder, value); + + internal void AddEventRemover(CILParser.EventBodyValue body, MethodReferenceValue value) + => AddEventAccessor(body, MethodSemanticsAttributes.Remover, value); + + internal void AddEventRaiser(CILParser.EventBodyValue body, MethodReferenceValue value) + => AddEventAccessor(body, MethodSemanticsAttributes.Raiser, value); + + internal void AddEventOther(CILParser.EventBodyValue body, MethodReferenceValue value) + => AddEventAccessor(body, MethodSemanticsAttributes.Other, value); + + private void AddEventAccessor( + CILParser.EventBodyValue body, + MethodSemanticsAttributes semantics, + MethodReferenceValue value) + { + if (body.Event is { } @event) + { + @event.Accessors.Add( + (semantics, MaterializeMethodReference(value))); + } + } + + internal void AddEventCustomAttribute( + CILParser.EventBodyValue body, + CILParser.CustomAttrDeclContext attribute) + { + if (attribute.HasSyntaxError || + body.Event is not { } @event) + { + return; + } + + if (MaterializeCustomAttributeDeclaration(attribute) is { } customAttribute) + { + customAttribute.Owner ??= @event; + } + } + + internal void ProcessEventSourceDirective( + CILParser.EventBodyValue body, + CILParser.ExtSourceSpecContext context) + { + _ = body; + _ = context; + } + + internal void ProcessEventLanguageDirective( + CILParser.EventBodyValue body, + CILParser.LanguageDeclContext context) + { + _ = body; + _ = context; + } +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodBodies.Directives.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodBodies.Directives.cs new file mode 100644 index 00000000000000..60fcbf9770fa6d --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodBodies.Directives.cs @@ -0,0 +1,401 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Linq; +using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ + internal void EndLocalsDirective( + CILParser.LocalsDeclContext context, + int initialSyntaxErrorCount) + { + bool hasSyntaxError = + HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null; + if (hasSyntaxError || _currentMethod is null || context.arguments is null) + { + return; + } + + if (context.initialize is not null) + { + _currentMethod.Definition.BodyAttributes = MethodBodyAttributes.InitLocals; + } + + Dictionary localsScope; + if (_currentMethod.LocalsScopes.Count > 0) + { + localsScope = _currentMethod.LocalsScopes[^1]; + } + else + { + localsScope = new(); + _currentMethod.LocalsScopes.Add(localsScope); + } + + ImmutableArray locals = + MaterializeSignatureArguments(context.arguments.Value); + foreach (SignatureArg local in locals) + { + if (local.Name is not null) + { + localsScope.TryAdd(local.Name, _currentMethod.AllLocals.Count); + } + + _currentMethod.AllLocals.Add(local); + } + } + + internal void EndExportDirective( + CILParser.ExportDeclContext context, + int initialSyntaxErrorCount) + { + bool hasSyntaxError = + HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null; + if (_currentMethod is null) + { + return; + } + + _currentMethod.Definition.ExportOrdinal = -1; + _currentMethod.Definition.ExportAlias = null; + _exportDirectiveContexts.Remove(_currentMethod.Definition); + if (hasSyntaxError || context.ordinal is null) + { + return; + } + + int diagnosticCount = _diagnostics.Count; + int ordinal = ParseInt32(context.ordinal.Start); + string? alias = context.alias is null ? null : ParseIdentifier(context.alias.Start); + if (_diagnostics.Count != diagnosticCount) + { + return; + } + + if (ordinal <= 0) + { + ReportError( + DiagnosticIds.InvalidExportOrdinal, + string.Format(DiagnosticMessageTemplates.InvalidExportOrdinal, ordinal), + context); + return; + } + + _currentMethod.Definition.ExportOrdinal = ordinal; + _currentMethod.Definition.ExportAlias = alias; + _exportDirectiveContexts[_currentMethod.Definition] = context; + } + + internal void EndVTableEntryDirective( + CILParser.VtentryDeclContext context, + int initialSyntaxErrorCount) + { + bool hasSyntaxError = + HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null; + if (_currentMethod is null) + { + return; + } + + _currentMethod.Definition.VTableEntry = 0; + _currentMethod.Definition.VTableSlot = 0; + _vtableEntryDirectiveContexts.Remove(_currentMethod.Definition); + if (hasSyntaxError || context.table is null || context.slot is null) + { + return; + } + + int diagnosticCount = _diagnostics.Count; + int vtableEntry = ParseInt32(context.table.Start); + int vtableSlot = ParseInt32(context.slot.Start); + if (_diagnostics.Count != diagnosticCount) + { + return; + } + + _currentMethod.Definition.VTableEntry = vtableEntry; + _currentMethod.Definition.VTableSlot = vtableSlot; + _vtableEntryDirectiveContexts[_currentMethod.Definition] = context; + } + + internal void EndOverrideDirective( + CILParser.OverrideDeclContext context, + int initialSyntaxErrorCount) + { + bool hasSyntaxError = + HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null; + if (hasSyntaxError || + _currentMethod is null || + context.owner is null || + context.name is null || + _currentTypeDefinition.PeekOrDefault() is not { } currentType) + { + return; + } + + BlobBuilder signature = _currentMethod.Definition.MethodSignature!; + if (context.convention is not null) + { + if (context.returnType is null || context.arity is null || context.arguments is null) + { + return; + } + + signature = BuildOverrideSignature( + context.convention.Value, + context.returnType.Value, + context.arity.Value, + context.arguments.Value); + } + + EntityRegistry.TypeEntity owner = + ResolveTypeSpecification(context.owner.Value); + EntityRegistry.MemberReferenceEntity declaration = + _entityRegistry.CreateLazilyRecordedMemberReference(owner, context.name.Value, signature); + currentType.MethodImplementations.Add( + EntityRegistry.CreateUnrecordedMethodImplementation(_currentMethod.Definition, declaration)); + } + + private BlobBuilder BuildOverrideSignature( + byte callingConvention, + TypeValue returnType, + int genericArity, + ImmutableArray signatureArguments) + { + BlobBuilder signature = new(); + byte header = callingConvention; + if (genericArity > 0) + { + header |= (byte)SignatureAttributes.Generic; + } + + signature.WriteByte(header); + if (genericArity > 0) + { + signature.WriteCompressedInteger(genericArity); + } + + ImmutableArray arguments = + MaterializeSignatureArguments(signatureArguments); + signature.WriteCompressedInteger(arguments.Length); + MaterializeType(returnType).WriteContentTo(signature); + foreach (SignatureArg argument in arguments) + { + argument.SignatureBlob.WriteContentTo(signature); + } + + return signature; + } + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. + internal void AddCustomAttributeApplication( + ImmutableArray.Builder attributes, + CILParser.CustomAttrDeclContext attribute) + => attributes.Add(new( + attribute.Value, + attribute.Start, + attribute.HasSyntaxError)); +#pragma warning restore CA1822 + + internal void EndParameterDirective( + CILParser.ParameterDeclContext context, + ImmutableArray attributes, + int initialSyntaxErrorCount) + { + bool hasSyntaxError = + HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null; + if (hasSyntaxError || _currentMethod is null) + { + return; + } + + if (context.genericIndex is not null || context.genericName is not null) + { + EntityRegistry.GenericParameterEntity? parameter = ResolveMethodGenericParameter( + context.genericIndex, + context.genericName?.Value, + context); + if (parameter is not null) + { + ApplyCustomAttributes(attributes, parameter); + } + + return; + } + + if (context.constraintIndex is not null || context.constraintName is not null) + { + EntityRegistry.GenericParameterEntity? parameter = ResolveMethodGenericParameter( + context.constraintIndex, + context.constraintName?.Value, + context); + if (parameter is null || context.constraintType is null) + { + return; + } + + EntityRegistry.TypeEntity baseType = + ResolveTypeSpecification(context.constraintType.Value); + EntityRegistry.GenericParameterConstraintEntity? constraint = + parameter.Constraints.FirstOrDefault(candidate => candidate.BaseType == baseType); + if (constraint is null) + { + constraint = EntityRegistry.CreateGenericConstraint(baseType); + constraint.Owner = parameter; + parameter.Constraints.Add(constraint); + _currentMethod.Definition.GenericParameterConstraints.Add(constraint); + } + + ApplyCustomAttributes(attributes, constraint); + return; + } + + if (context.parameterIndex is null || context.initializer is null) + { + return; + } + + int index = ParseInt32(context.parameterIndex.Start); + if ((uint)index >= (uint)_currentMethod.Definition.Parameters.Count) + { + ReportError( + DiagnosticIds.ParameterIndexOutOfRange, + string.Format(DiagnosticMessageTemplates.ParameterIndexOutOfRange, index), + context); + return; + } + + EntityRegistry.ParameterEntity parameterEntity = _currentMethod.Definition.Parameters[index]; + FieldInitializerValue initializer = GetInitializerValue(context.initializer); + if (initializer.HasValue) + { + parameterEntity.ConstantValue = initializer.ConstantValue; + parameterEntity.HasConstant = true; + } + + foreach (CustomAttributeApplicationValue application in attributes) + { + if (application.HasSyntaxError) + { + continue; + } + + EntityRegistry.CustomAttributeEntity? attribute = + MaterializeCustomAttributeDeclaration( + application.Value, + application.Location); + if (attribute is not null) + { + attribute.Owner ??= parameterEntity; + parameterEntity.HasCustomAttributes = true; + } + } + } + + private EntityRegistry.GenericParameterEntity? ResolveMethodGenericParameter( + CILParser.Int32Context? indexContext, + string? name, + CILParser.ParameterDeclContext diagnosticContext) + { + Debug.Assert(_currentMethod is not null); + if (indexContext is not null) + { + int index = ParseInt32(indexContext.Start); + if ((uint)index >= (uint)_currentMethod.Definition.GenericParameters.Count) + { + ReportError( + DiagnosticIds.GenericParameterIndexOutOfRange, + string.Format(DiagnosticMessageTemplates.GenericParameterIndexOutOfRange, index), + diagnosticContext); + return null; + } + + return _currentMethod.Definition.GenericParameters[index]; + } + + EntityRegistry.GenericParameterEntity? parameter = + _currentMethod.Definition.GenericParameters.FirstOrDefault(candidate => candidate.Name == name); + if (parameter is null) + { + ReportError( + DiagnosticIds.UnknownGenericParameter, + string.Format(DiagnosticMessageTemplates.UnknownGenericParameter, name), + diagnosticContext); + } + + return parameter; + } + + private void ApplyCustomAttributes( + ImmutableArray attributes, + EntityRegistry.EntityBase owner) + { + foreach (CustomAttributeApplicationValue application in attributes) + { + if (application.HasSyntaxError) + { + continue; + } + + EntityRegistry.CustomAttributeEntity? attribute = + MaterializeCustomAttributeDeclaration( + application.Value, + application.Location); + if (attribute is not null) + { + attribute.Owner ??= owner; + } + } + } + +#pragma warning disable CA1822 // Parser actions own these directive side effects. + internal void ProcessMethodDataDeclaration(CILParser.DataDeclContext context) + => _ = context; +#pragma warning restore CA1822 + + internal void ProcessMethodSecurityDeclaration(CILParser.SecDeclContext context) + { + if (_currentMethod is null || context.HasSyntaxError) + { + return; + } + + EntityRegistry.DeclarativeSecurityAttributeEntity? security = MaterializeSecurityDeclaration(context); + security?.Parent = _currentMethod.Definition; + } + +#pragma warning disable CA1822 // Parser actions own these directive side effects. + internal void ProcessMethodSourceDirective(CILParser.ExtSourceSpecContext context) + => _ = context; + + internal void ProcessMethodLanguageDirective(CILParser.LanguageDeclContext context) + => _ = context; +#pragma warning restore CA1822 + + internal void ProcessMethodCustomAttribute(CILParser.CustomDescrInMethodBodyContext context) + { + if (_currentMethod is null || context.HasSyntaxError) + { + return; + } + + EntityRegistry.CustomAttributeEntity? attribute = MaterializeMethodBodyCustomAttributeDeclaration(context); + if (attribute is not null) + { + attribute.Owner ??= _currentMethod.Definition; + } + } +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodBodies.ExceptionHandling.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodBodies.ExceptionHandling.cs new file mode 100644 index 00000000000000..11b9578005ad2f --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodBodies.ExceptionHandling.cs @@ -0,0 +1,275 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + private readonly Dictionary _scopeRanges = new(); + // Method scopes nest while IL and local declarations are emitted, so their live offsets and + // local-scope depth must be restored when each lexical scope exits. + private readonly Stack _scopeStack = new(); + private RuleContext? _methodOwner; + + private void EndMethod() + { + Debug.Assert( + _scopeStack.Count == 0, + "Lexical scope state must be released by its owning rule."); + + _methodOwner = null; + if (_currentMethod is not null) + { + if (_currentMethod.AllLocals.Count > 0) + { + BlobBuilder localsSignature = new(); + BlobEncoder encoder = new(localsSignature); + LocalVariablesEncoder localsEncoder = + encoder.LocalVariableSignature(_currentMethod.AllLocals.Count); + foreach (SignatureArg local in _currentMethod.AllLocals) + { + local.SignatureBlob.WriteContentTo(localsEncoder.AddVariable().Builder); + } + + _currentMethod.Definition.LocalsSignature = + _entityRegistry.GetOrCreateStandaloneSignature(localsSignature); + } + + ValidateLabelReferences(); + _currentMethod = null; + } + + ResetMethodBodyState(); + ClearPendingCustomAttributeOwners(); + } + + private void ResetMethodBodyState() + { + _scopeRanges.Clear(); + _scopeStack.Clear(); + } + + internal void BeginScope(CILParser.ScopeBlockContext context) + { + if (_currentMethod is not null) + { + _scopeStack.Push( + new ScopeFrame(context, CurrentMethodBodyOffset, _currentMethod.LocalsScopes.Count)); + } + } + + internal void EndScope(CILParser.ScopeBlockContext context) + { + if (_scopeStack.Count == 0 || !ReferenceEquals(_scopeStack.Peek().Context, context)) + { + return; + } + + ScopeFrame frame = _scopeStack.Pop(); + if (_currentMethod is not null && frame.LocalsScopeCount < _currentMethod.LocalsScopes.Count) + { + _currentMethod.LocalsScopes.RemoveRange( + frame.LocalsScopeCount, + _currentMethod.LocalsScopes.Count - frame.LocalsScopeCount); + } + + _scopeRanges[context] = (frame.Start, CurrentMethodBodyOffset); + } + + internal void EndExceptionBlock( + CILParser.SehBlockContext context, + int initialSyntaxErrorCount) + { + if (_currentMethod is null || + HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null || + context.tryRange is null || + context.clauses is null) + { + return; + } + + ExceptionRangeValue tryRangeValue = context.tryRange.Value; + (LabelHandle Start, LabelHandle End)? tryRange = ResolveExceptionRange(tryRangeValue); + if (tryRange is null) + { + return; + } + + foreach (ExceptionClauseValue clause in context.clauses.Value) + { + (LabelHandle Start, LabelHandle End)? handlerRange = ResolveExceptionRange(clause.Handler); + if (handlerRange is null) + { + continue; + } + + switch (clause) + { + case FinallyExceptionClauseValue: + AddExceptionRegion(new EntityRegistry.ExceptionRegion.FinallyRegion( + tryRange.Value.Start, + tryRange.Value.End, + handlerRange.Value.Start, + handlerRange.Value.End)); + break; + case FaultExceptionClauseValue: + AddExceptionRegion(new EntityRegistry.ExceptionRegion.FaultRegion( + tryRange.Value.Start, + tryRange.Value.End, + handlerRange.Value.Start, + handlerRange.Value.End)); + break; + case CatchExceptionClauseValue { CatchType: { IsValid: true, Type: not null } catchType }: + AddExceptionRegion(new EntityRegistry.ExceptionRegion.CatchRegion( + tryRange.Value.Start, + tryRange.Value.End, + handlerRange.Value.Start, + handlerRange.Value.End, + catchType.Type)); + break; + case FilterExceptionClauseValue filterClause + when ResolveExceptionFilter(filterClause.Filter) is LabelHandle filterStart: + AddExceptionRegion(new EntityRegistry.ExceptionRegion.FilterRegion( + tryRange.Value.Start, + tryRange.Value.End, + handlerRange.Value.Start, + handlerRange.Value.End, + filterStart)); + break; + } + } + } + + internal CatchTypeValue EndCatchClause( + CILParser.CatchClauseContext context, + int initialSyntaxErrorCount) + { + if (_currentMethod is null || + HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null || + context.catchType is null || + context.catchType.HasSyntaxError) + { + return CatchTypeValue.Invalid; + } + + EntityRegistry.TypeEntity catchType = + ResolveTypeSpecification(context.catchType.Value); + return new CatchTypeValue(catchType, isValid: true); + } + + internal ExceptionRangeValue CreateScopeExceptionRange(CILParser.ScopeBlockContext scope) + => new ScopeExceptionRangeValue(scope); + + internal ExceptionRangeValue CreateLabelExceptionRange(IToken start, IToken end) + => new LabelExceptionRangeValue( + ParseIdentifier(start), + start, + ParseIdentifier(end), + end); + + internal ExceptionRangeValue CreateOffsetExceptionRange(IToken start, IToken end) + => new OffsetExceptionRangeValue(ParseInt32(start), ParseInt32(end)); + + internal ExceptionFilterValue CreateScopeFilter(CILParser.ScopeBlockContext scope) + => new ScopeExceptionFilterValue(scope); + + internal ExceptionFilterValue CreateLabelFilter(IToken label) + => new LabelExceptionFilterValue(ParseIdentifier(label), label); + + internal ExceptionFilterValue CreateOffsetFilter(IToken offset) + => new OffsetExceptionFilterValue(ParseInt32(offset)); + + internal ExceptionClauseValue CreateCatchExceptionClause( + CatchTypeValue catchType, + ExceptionRangeValue handler) + => new CatchExceptionClauseValue( + catchType, + handler); + + internal ExceptionClauseValue CreateFilterExceptionClause( + ExceptionFilterValue filter, + ExceptionRangeValue handler) + => new FilterExceptionClauseValue( + filter, + handler); + + internal ExceptionClauseValue CreateFinallyExceptionClause(ExceptionRangeValue handler) + => new FinallyExceptionClauseValue(handler); + + internal ExceptionClauseValue CreateFaultExceptionClause(ExceptionRangeValue handler) + => new FaultExceptionClauseValue(handler); + + private void AddExceptionRegion(EntityRegistry.ExceptionRegion region) + { + Debug.Assert(_currentMethod is not null); + _currentMethod.Definition.ExceptionRegions.Add(region); + } + + private (LabelHandle Start, LabelHandle End)? ResolveExceptionRange(ExceptionRangeValue range) + => range switch + { + ScopeExceptionRangeValue scope => GetScopeRange(scope.Scope), + LabelExceptionRangeValue labels => ( + GetOrCreateMethodLabel(labels.Start, labels.StartToken), + GetOrCreateMethodLabel(labels.End, labels.EndToken)), + OffsetExceptionRangeValue offsets => ( + DefineMethodLabelAtOffset(offsets.Start), + DefineMethodLabelAtOffset(offsets.End)), + _ => null, + }; + + private LabelHandle? ResolveExceptionFilter(ExceptionFilterValue filter) + => filter switch + { + ScopeExceptionFilterValue scope => GetScopeRange(scope.Scope).Start, + LabelExceptionFilterValue label => GetOrCreateMethodLabel(label.Label, label.Token), + OffsetExceptionFilterValue offset => DefineMethodLabelAtOffset(offset.Offset), + _ => null, + }; + + private (LabelHandle Start, LabelHandle End) GetScopeRange(CILParser.ScopeBlockContext context) + { + if (!_scopeRanges.TryGetValue(context, out (int Start, int End) range)) + { + int offset = CurrentMethodBodyOffset; + range = (offset, offset); + } + + return ( + DefineMethodLabelAtOffset(range.Start), + DefineMethodLabelAtOffset(range.End)); + } + + private LabelHandle GetOrCreateMethodLabel(string name, IToken reference) + { + Debug.Assert(_currentMethod is not null); + return GetOrCreateMethodLabel(_currentMethod, name, reference); + } + + private LabelHandle DefineMethodLabelAtOffset(int offset) + { + Debug.Assert(_currentMethod is not null); + LabelHandle label = _currentMethod.Definition.MethodBody.DefineLabel(); + _currentMethod.Definition.MethodBody.MarkLabel(label, offset); + return label; + } + + private int CurrentMethodBodyOffset => _currentMethod?.Definition.MethodBody.Offset ?? 0; + + private readonly record struct ScopeFrame( + CILParser.ScopeBlockContext Context, + int Start, + int LocalsScopeCount); +} +#pragma warning restore CA1822 diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodBodies.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodBodies.cs new file mode 100644 index 00000000000000..d3b0c30fe9c79d --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodBodies.cs @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Reflection.Metadata.Ecma335; +using Antlr4.Runtime; + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ + private void ValidateLabelReferences() + { + if (_currentMethod is null) + { + return; + } + + // Report errors for any labels that were referenced but never declared + foreach (var undefinedLabel in _currentMethod.UndefinedLabelReferences) + { + ReportError( + DiagnosticIds.LabelNotFound, + string.Format(DiagnosticMessageTemplates.LabelNotFound, undefinedLabel.Key), + undefinedLabel.Value); + } + } + + private static LabelHandle GetOrCreateMethodLabel( + CurrentMethodContext method, + string name, + IToken reference) + { + if (!method.Labels.TryGetValue(name, out LabelHandle label)) + { + label = method.Definition.MethodBody.DefineLabel(); + method.Labels[name] = label; + method.UndefinedLabelReferences.TryAdd(name, reference); + } + + return label; + } + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. + internal string GetMethodName(IToken token) => token.Text; +#pragma warning restore CA1822 +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodHeaders.Actions.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodHeaders.Actions.cs new file mode 100644 index 00000000000000..ebdc8097432f89 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodHeaders.Actions.cs @@ -0,0 +1,312 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal CILParser.MethodHeaderBuilder PrepareMethodHeader() + { + ClearPendingCustomAttributeOwners(); + return new CILParser.MethodHeaderBuilder(); + } + + internal void AddMethodAttribute( + CILParser.MethodHeaderBuilder builder, + CILParser.AttributeValue value) + => builder.Attributes = ApplyAttribute(builder.Attributes, value); + + internal void AddPInvoke(CILParser.MethodHeaderBuilder builder, PInvokeValue value) + => builder.PInvokes.Add(value); + + internal void AddMethodImplementationAttribute( + CILParser.MethodHeaderBuilder builder, + CILParser.AttributeValue value) + => builder.ImplementationAttributes = ApplyAttribute( + builder.ImplementationAttributes, + value); + + internal MethodHeaderValue CreateMethodHeader( + CILParser.MethodHeadContext context, + CILParser.MethodHeaderBuilder builder, + int initialSyntaxErrorCount, + byte callingConvention, + int returnAttributes, + TypeValue returnType, + MarshallingDescriptorValue returnMarshalling, + string name, + ImmutableArray genericParameters, + ImmutableArray arguments) + { + if (HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null) + { + return MethodHeaderValue.Error; + } + + return new MethodHeaderValue( + true, + builder.Attributes, + builder.PInvokes.ToImmutable(), + callingConvention, + returnAttributes, + returnType, + returnMarshalling, + name, + genericParameters, + arguments, + builder.ImplementationAttributes); + } + + internal CILParser.AttributeValue CreateMethodAttribute(IToken token) + => token.Text switch + { + "static" => new CILParser.AttributeValue(MethodAttributes.Static, 0, true), + "public" => new CILParser.AttributeValue( + MethodAttributes.Public, + MethodAttributes.MemberAccessMask, + true), + "private" => new CILParser.AttributeValue( + MethodAttributes.Private, + MethodAttributes.MemberAccessMask, + true), + "family" => new CILParser.AttributeValue( + MethodAttributes.Family, + MethodAttributes.MemberAccessMask, + true), + "final" => new CILParser.AttributeValue(MethodAttributes.Final, 0, true), + "specialname" => new CILParser.AttributeValue(MethodAttributes.SpecialName, 0, true), + "virtual" => new CILParser.AttributeValue(MethodAttributes.Virtual, 0, true), + "strict" => new CILParser.AttributeValue( + MethodAttributes.CheckAccessOnOverride, + 0, + true), + "abstract" => new CILParser.AttributeValue(MethodAttributes.Abstract, 0, true), + "assembly" => new CILParser.AttributeValue( + MethodAttributes.Assembly, + MethodAttributes.MemberAccessMask, + true), + "famandassem" => new CILParser.AttributeValue( + MethodAttributes.FamANDAssem, + MethodAttributes.MemberAccessMask, + true), + "famorassem" => new CILParser.AttributeValue( + MethodAttributes.FamORAssem, + MethodAttributes.MemberAccessMask, + true), + "privatescope" => new CILParser.AttributeValue( + MethodAttributes.PrivateScope, + MethodAttributes.MemberAccessMask, + true), + "hidebysig" => new CILParser.AttributeValue(MethodAttributes.HideBySig, 0, true), + "newslot" => new CILParser.AttributeValue(MethodAttributes.NewSlot, 0, true), + "rtspecialname" => new CILParser.AttributeValue(MethodAttributes.RTSpecialName, 0, true), + "unmanagedexp" => new CILParser.AttributeValue(MethodAttributes.UnmanagedExport, 0, true), + "reqsecobj" => new CILParser.AttributeValue(MethodAttributes.RequireSecObject, 0, true), + _ => throw new UnreachableException(), + }; + + internal CILParser.AttributeValue CreateRawMethodAttribute(IToken token) + => new((MethodAttributes)ParseInt32(token), 0, false); + + internal CILParser.AttributeValue + CreateMethodImplementationAttribute(IToken token) + => token.Text switch + { + "native" => new CILParser.AttributeValue( + MethodImplAttributes.Native, + MethodImplAttributes.CodeTypeMask, + true), + "cil" or "il" => new CILParser.AttributeValue( + MethodImplAttributes.IL, + MethodImplAttributes.CodeTypeMask, + true), + "optil" => new CILParser.AttributeValue( + MethodImplAttributes.OPTIL, + MethodImplAttributes.CodeTypeMask, + true), + "managed" => new CILParser.AttributeValue( + MethodImplAttributes.Managed, + MethodImplAttributes.ManagedMask, + true), + "unmanaged" => new CILParser.AttributeValue( + MethodImplAttributes.Unmanaged, + MethodImplAttributes.ManagedMask, + true), + "forwardref" => new CILParser.AttributeValue(MethodImplAttributes.ForwardRef, 0, true), + "preservesig" => new CILParser.AttributeValue(MethodImplAttributes.PreserveSig, 0, true), + "runtime" => new CILParser.AttributeValue( + MethodImplAttributes.Runtime, + MethodImplAttributes.CodeTypeMask, + true), + "internalcall" => new CILParser.AttributeValue(MethodImplAttributes.InternalCall, 0, true), + "synchronized" => new CILParser.AttributeValue(MethodImplAttributes.Synchronized, 0, true), + "noinlining" => new CILParser.AttributeValue(MethodImplAttributes.NoInlining, 0, true), + "aggressiveinlining" => new CILParser.AttributeValue( + MethodImplAttributes.AggressiveInlining, + 0, + true), + "nooptimization" => new CILParser.AttributeValue(MethodImplAttributes.NoOptimization, 0, true), + "aggressiveoptimization" => new CILParser.AttributeValue( + MethodImplAttributes.AggressiveOptimization, + 0, + true), + "async" => new CILParser.AttributeValue(MethodImplAttributes.Async, 0, true), + _ => throw new UnreachableException(), + }; + + internal CILParser.AttributeValue + CreateRawMethodImplementationAttribute(IToken token) + => new((MethodImplAttributes)ParseInt32(token), 0, false); + + internal void SetPInvokeModule(CILParser.PInvokeBuilder builder, string moduleName) + => builder.ModuleName = moduleName; + + internal void SetPInvokeEntryPoint( + CILParser.PInvokeBuilder builder, + string entryPointName) + => builder.EntryPointName = entryPointName; + + internal void AddPInvokeAttribute( + CILParser.PInvokeBuilder builder, + CILParser.AttributeValue value) + => builder.Attributes = ApplyAttribute(builder.Attributes, value); + + internal PInvokeValue CreatePInvoke(CILParser.PInvokeBuilder builder) + => new(builder.ModuleName, builder.EntryPointName, builder.Attributes); + + internal CILParser.AttributeValue + CreatePInvokeAttribute(IToken token) + => token.Text switch + { + "nomangle" => new CILParser.AttributeValue( + MethodImportAttributes.ExactSpelling, + 0, + true), + "ansi" => new CILParser.AttributeValue( + MethodImportAttributes.CharSetAnsi, + 0, + true), + "unicode" => new CILParser.AttributeValue( + MethodImportAttributes.CharSetUnicode, + 0, + true), + "autochar" => new CILParser.AttributeValue( + MethodImportAttributes.CharSetAuto, + 0, + true), + "lasterr" => new CILParser.AttributeValue( + MethodImportAttributes.SetLastError, + 0, + true), + "winapi" => new CILParser.AttributeValue( + MethodImportAttributes.CallingConventionWinApi, + 0, + true), + "cdecl" => new CILParser.AttributeValue( + MethodImportAttributes.CallingConventionCDecl, + 0, + true), + "stdcall" => new CILParser.AttributeValue( + MethodImportAttributes.CallingConventionStdCall, + 0, + true), + "thiscall" => new CILParser.AttributeValue( + MethodImportAttributes.CallingConventionThisCall, + 0, + true), + "fastcall" => new CILParser.AttributeValue( + MethodImportAttributes.CallingConventionFastCall, + 0, + true), + _ => throw new UnreachableException(), + }; + + internal CILParser.AttributeValue + CreateBestFitPInvokeAttribute(IToken setting) + => new( + setting.Text == "on" + ? MethodImportAttributes.BestFitMappingEnable + : MethodImportAttributes.BestFitMappingDisable, + 0, + true); + + internal CILParser.AttributeValue + CreateCharMapErrorPInvokeAttribute(IToken setting) + => new( + setting.Text == "on" + ? MethodImportAttributes.ThrowOnUnmappableCharEnable + : MethodImportAttributes.ThrowOnUnmappableCharDisable, + 0, + true); + + internal CILParser.AttributeValue + CreateRawPInvokeAttribute(IToken token) + => new( + (MethodImportAttributes)ParseInt32(token), + 0, + false); + + internal CILParser.AttributeValue + CreateGenericParameterAttribute(IToken token) + => token.Text switch + { + "+" => new CILParser.AttributeValue( + GenericParameterAttributes.Covariant, + 0, + true), + "-" => new CILParser.AttributeValue( + GenericParameterAttributes.Contravariant, + 0, + true), + "class" => new CILParser.AttributeValue( + GenericParameterAttributes.ReferenceTypeConstraint, + 0, + true), + "valuetype" => new CILParser.AttributeValue( + GenericParameterAttributes.NotNullableValueTypeConstraint, + 0, + true), + "byreflike" => new CILParser.AttributeValue( + GenericParameterAttributes.AllowByRefLike, + 0, + true), + ".ctor" => new CILParser.AttributeValue( + GenericParameterAttributes.DefaultConstructorConstraint, + 0, + true), + _ => throw new UnreachableException(), + }; + + internal CILParser.AttributeValue + CreateRawGenericParameterAttribute(IToken token) + => new( + (GenericParameterAttributes)ParseInt32(token), + 0, + true); + + internal GenericParameterAttributes AddGenericParameterAttribute( + GenericParameterAttributes attributes, + CILParser.AttributeValue value) + => ApplyAttribute(attributes, value); + + internal GenericParameterDeclarationValue CreateGenericParameterDeclaration( + IToken location, + GenericParameterAttributes attributes, + CILParser.TyBoundContext? constraints, + string name) + => new GenericParameterDeclarationValue( + attributes, + name, + constraints?.Value ?? []) + { + Location = location, + ConstraintLocation = constraints?.Start + }; +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodHeaders.Generics.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodHeaders.Generics.cs new file mode 100644 index 00000000000000..9a08cd78532d69 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodHeaders.Generics.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection; + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ + private static void RegisterGenericParameterNames( + EntityRegistry.EntityBase owner, + NamedElementList parameters, + ImmutableArray declarations) + { + for (int i = 0; i < declarations.Length; i++) + { + GenericParameterDeclarationValue declaration = declarations[i]; + EntityRegistry.GenericParameterEntity parameter = + EntityRegistry.CreateGenericParameter(declaration.Attributes, declaration.Name); + parameter.Owner = owner; + parameter.Index = i; + parameters.Add(parameter); + } + } + private void MaterializeGenericParameterConstraints( + NamedElementList parameters, + List constraints, + ImmutableArray declarations) + { + Debug.Assert(parameters.Count >= declarations.Length); + int count = System.Math.Min(parameters.Count, declarations.Length); + for (int i = 0; i < count; i++) + { + EntityRegistry.GenericParameterEntity parameter = parameters[i]; + foreach (TypeSpecificationValue constraintType in declarations[i].Constraints) + { + EntityRegistry.GenericParameterConstraintEntity constraint = + EntityRegistry.CreateGenericConstraint(ResolveTypeSpecification(constraintType)); + constraint.Owner = parameter; + parameter.Constraints.Add(constraint); + constraints.Add(constraint); + } + } + } + +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodHeaders.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodHeaders.cs new file mode 100644 index 00000000000000..c91a72d8c24c86 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodHeaders.cs @@ -0,0 +1,177 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using System.Reflection; +using System.Reflection.Metadata; + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ + internal void BeginMethod(CILParser.MethodHeadContext context, MethodHeaderValue value) + { + ResetMethodBodyState(); + if (IsDeclarationSuppressed || !value.IsValid) + { + return; + } + + MethodHeaderValue header = value; + + EntityRegistry.TypeDefinitionEntity containingType = + _currentTypeDefinition.PeekOrDefault() ?? _entityRegistry.ModuleType; + EntityRegistry.MethodDefinitionEntity methodDefinition = + EntityRegistry.CreateUnrecordedMethodDefinition(containingType, header.Name); + + _currentMethod = new(methodDefinition); + try + { + ReportGenericParameterEncodingErrors(header.GenericParameters, context); + RegisterGenericParameterNames( + methodDefinition, + methodDefinition.GenericParameters, + header.GenericParameters); + + methodDefinition.MethodAttributes = header.Attributes; + ApplyImplicitMethodAttributes(methodDefinition); + + if (methodDefinition.MethodAttributes.HasFlag(MethodAttributes.Abstract) && + !methodDefinition.ContainingType.Attributes.HasFlag(TypeAttributes.Abstract)) + { + ReportWarning( + DiagnosticIds.AbstractMethodNotInAbstractType, + string.Format( + DiagnosticMessageTemplates.AbstractMethodNotInAbstractType, + methodDefinition.Name), + context); + } + + ApplyPInvokeInformation(methodDefinition, header, context); + + byte signatureHeader = header.CallingConvention; + if (header.GenericParameters.Length != 0) + { + signatureHeader |= (byte)SignatureAttributes.Generic; + } + + SignatureHeader parsedHeader = new(signatureHeader); + if (!methodDefinition.MethodAttributes.HasFlag(MethodAttributes.Static) && + !parsedHeader.IsInstance && + _currentTypeDefinition.Count > 0) + { + signatureHeader |= (byte)SignatureAttributes.Instance; + parsedHeader = new(signatureHeader); + } + if (parsedHeader.HasExplicitThis && !parsedHeader.IsInstance) + { + signatureHeader |= (byte)SignatureAttributes.Instance; + parsedHeader = new(signatureHeader); + } + + BlobBuilder methodSignature = new(); + methodSignature.WriteByte(signatureHeader); + if (header.GenericParameters.Length != 0) + { + methodSignature.WriteCompressedInteger(header.GenericParameters.Length); + } + + MaterializeGenericParameterConstraints( + methodDefinition.GenericParameters, + methodDefinition.GenericParameterConstraints, + header.GenericParameters); + + ImmutableArray arguments = MaterializeSignatureArguments(header.Arguments); + methodSignature.WriteCompressedInteger(arguments.Length); + + SignatureArg returnValue = new( + (ParameterAttributes)header.ReturnAttributes, + MaterializeType(header.ReturnType), + MaterializeMarshallingDescriptor(header.ReturnMarshalling), + null); + returnValue.SignatureBlob.WriteContentTo(methodSignature); + methodDefinition.Parameters.Add( + EntityRegistry.CreateParameter( + returnValue.Attributes, + returnValue.Name, + returnValue.MarshallingDescriptor, + 0)); + + for (int i = 0; i < arguments.Length; i++) + { + SignatureArg argument = arguments[i]; + argument.SignatureBlob.WriteContentTo(methodSignature); + string? parameterName = argument.Name ?? $"A_{i}"; + methodDefinition.Parameters.Add( + EntityRegistry.CreateParameter( + argument.Attributes, + parameterName, + argument.MarshallingDescriptor, + i + 1)); + } + + methodDefinition.SignatureHeader = parsedHeader; + methodDefinition.MethodSignature = methodSignature; + methodDefinition.ImplementationAttributes = header.ImplementationAttributes; + + if (!EntityRegistry.TryAddMethodDefinitionToContainingType(methodDefinition)) + { + ReportError( + DiagnosticIds.DuplicateMethod, + DiagnosticMessageTemplates.DuplicateMethod, + context); + } + + _currentMethod = new(methodDefinition); + _methodOwner = context.Parent; + } + catch + { + _currentMethod = null; + _methodOwner = null; + ResetMethodBodyState(); + throw; + } + } + + private static void ApplyImplicitMethodAttributes(EntityRegistry.MethodDefinitionEntity method) + { + if (method.Name is ".ctor" or ".cctor") + { + method.MethodAttributes |= MethodAttributes.RTSpecialName | MethodAttributes.SpecialName; + } + else if (method.MethodAttributes.HasFlag(MethodAttributes.RTSpecialName)) + { + method.MethodAttributes |= MethodAttributes.SpecialName; + } + } + + private void ApplyPInvokeInformation( + EntityRegistry.MethodDefinitionEntity method, + MethodHeaderValue header, + CILParser.MethodHeadContext context) + { + (EntityRegistry.ModuleReferenceEntity Module, string? EntryPoint, MethodImportAttributes Attributes)? + pInvokeInformation = null; + + foreach (PInvokeValue pInvoke in header.PInvokes) + { + if (pInvoke.ModuleName is null) + { + ReportError( + DiagnosticIds.InvalidPInvokeSignature, + DiagnosticMessageTemplates.InvalidPInvokeSignature, + context); + continue; + } + + pInvokeInformation = ( + _entityRegistry.GetOrCreateModuleReference(pInvoke.ModuleName, _ => { }), + pInvoke.EntryPointName ?? header.Name, + pInvoke.Attributes); + } + + method.MethodImportInformation = pInvokeInformation; + } + +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Security.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Security.cs new file mode 100644 index 00000000000000..e3cda018d4c0ef --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Security.cs @@ -0,0 +1,214 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection; +using System.Reflection.Metadata; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal DeclarativeSecurityAction ParseSecurityAction(IToken token) + => token.Text switch + { + "request" => DeclarativeSecurityAction.Request, + "demand" => DeclarativeSecurityAction.Demand, + "assert" => DeclarativeSecurityAction.Assert, + "deny" => DeclarativeSecurityAction.Deny, + "permitonly" => DeclarativeSecurityAction.PermitOnly, + "linkcheck" => DeclarativeSecurityAction.LinkDemand, + "inheritcheck" => DeclarativeSecurityAction.InheritanceDemand, + "reqmin" => DeclarativeSecurityAction.RequestMinimum, + "reqopt" => DeclarativeSecurityAction.RequestOptional, + "reqrefuse" => DeclarativeSecurityAction.RequestRefuse, + "prejitgrant" => DeclarativeSecurityAction.PrejitGrant, + "prejitdeny" => DeclarativeSecurityAction.PrejitDeny, + "noncasdemand" => DeclarativeSecurityAction.NonCasDemand, + "noncaslinkdemand" => DeclarativeSecurityAction.NonCasLinkDemand, + "noncasinheritance" => DeclarativeSecurityAction.NonCasInheritanceDemand, + _ => DeclarativeSecurityAction.Request, + }; + + internal SecurityDeclarationValue CreateNamedPermissionDeclaration( + DeclarativeSecurityAction action, + TypeSpecificationValue permissionType, + ImmutableArray pairs) + => new NamedPermissionDeclarationValue( + action, + permissionType, + pairs); + + internal SecurityDeclarationValue CreateStructuredPermissionDeclaration( + DeclarativeSecurityAction action, + TypeSpecificationValue permissionType, + CustomAttributeBlobValue value) + => new StructuredPermissionDeclarationValue( + action, + permissionType, + value); + + internal SecurityDeclarationValue CreateEmptyPermissionDeclaration( + DeclarativeSecurityAction action, + TypeSpecificationValue permissionType) + => new EmptyPermissionDeclarationValue( + action, + permissionType); + + internal SecurityDeclarationValue CreateRawPermissionSetDeclaration( + DeclarativeSecurityAction action, + ImmutableArray value) + => new RawPermissionSetValue(action, value); + + internal SecurityDeclarationValue CreateStringPermissionSetDeclaration( + DeclarativeSecurityAction action, + string value) + => new StringPermissionSetValue(action, value); + + internal SecurityDeclarationValue CreateAttributePermissionSetDeclaration( + DeclarativeSecurityAction action, + ImmutableArray value) + => new AttributePermissionSetValue(action, value); + + internal void EndSecurityDeclaration( + CILParser.SecDeclContext context, + int initialSyntaxErrorCount) + { + context.HasSyntaxError = + HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null; + if (context.HasSyntaxError) + { + context.Value = null; + } + } + + internal SecurityAttributeValue CreateNamedSecurityAttribute( + IToken name, + ImmutableArray arguments) + => new SecurityAttributeValue( + StringHelpers.ParseQuotedString(name.Text), + null, + arguments); + + internal SecurityAttributeValue CreateTypedSecurityAttribute( + TypeSpecificationValue type, + ImmutableArray arguments) + => new SecurityAttributeValue( + null, + type, + arguments); + + internal SecurityNameValuePairValue CreateSecurityNameValuePair( + string name, + SecurityCaValue value) + => new(name, value); + + internal SecurityCaValue CreateSecurityBooleanValue(bool value) + => new SecurityBooleanValue(value); + + internal SecurityCaValue CreateSecurityInt32Value(IToken value) + => new SecurityInt32Value(ParseInt32(value)); + + internal SecurityCaValue CreateSecurityStringValue(string value) + => new SecurityStringValue(value); + + internal SecurityCaValue CreateSecurityEnumValue( + ClassNameValue type, + IToken kind, + IToken value) + => new SecurityEnumValue( + type, + kind.Text switch + { + "int8" => 1, + "int16" => 2, + "int32" => 4, + _ => throw new UnreachableException(), + }, + ParseInt32(value)); + + internal SecurityCaValue CreateSecurityEnumValue( + ClassNameValue type, + IToken value) + => new SecurityEnumValue(type, 4, ParseInt32(value)); + + private EntityRegistry.DeclarativeSecurityAttributeEntity? MaterializeSecurityDeclaration( + SecurityDeclarationValue value, + IToken location) + { + if (value is PermissionDeclarationValue) + { + ReportError( + DiagnosticIds.UnsupportedSecurityDeclaration, + DiagnosticMessageTemplates.UnsupportedSecurityDeclaration, + location); + return null; + } + + BlobBuilder permissionSet = value switch + { + RawPermissionSetValue raw => CreateRawPermissionSet(raw.Value), + StringPermissionSetValue text => CreateStringPermissionSet(text.Value), + AttributePermissionSetValue attributes => + MaterializeSecurityAttributeSet(attributes.Attributes), + _ => throw new UnreachableException(), + }; + return _entityRegistry.CreateDeclarativeSecurityAttribute(value.Action, permissionSet); + } + + private static BlobBuilder CreateRawPermissionSet(ImmutableArray value) + { + BlobBuilder blob = new(value.Length); + blob.WriteBytes(value); + return blob; + } + + private static BlobBuilder CreateStringPermissionSet(string value) + { + BlobBuilder blob = new(); + blob.WriteUTF16(value); + blob.WriteUTF16("\0"); + return blob; + } + + private BlobBuilder MaterializeSecurityAttributeSet( + ImmutableArray attributes) + { + BlobBuilder blob = new(); + blob.WriteByte((byte)'.'); + blob.WriteCompressedInteger(attributes.Length); + foreach (SecurityAttributeValue attribute in attributes) + { + MaterializeSecurityAttribute(attribute).WriteContentTo(blob); + } + + return blob; + } + + private BlobBuilder MaterializeSecurityAttribute(SecurityAttributeValue attribute) + { + string attributeName = attribute.Name ?? string.Empty; + if (attribute.Type is { } type && + ResolveTypeSpecification(type) is EntityRegistry.IHasReflectionNotation reflectionNotation) + { + attributeName = reflectionNotation.ReflectionNotation; + } + + BlobBuilder blob = new(); + blob.WriteSerializedString(attributeName); + WriteCustomBlobNamedArguments(blob, attribute.Arguments); + return blob; + } + + internal EntityRegistry.DeclarativeSecurityAttributeEntity? MaterializeSecurityDeclaration( + CILParser.SecDeclContext context) + => context.Value is SecurityDeclarationValue value + ? MaterializeSecurityDeclaration(value, context.Start) + : null; + +} +#pragma warning restore CA1822 diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.Actions.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.Actions.cs new file mode 100644 index 00000000000000..229b47ae2637f3 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.Actions.cs @@ -0,0 +1,246 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Reflection.Metadata; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal byte AddInstanceCallingConvention(byte callingConvention) + => (byte)(callingConvention | (byte)SignatureAttributes.Instance); + + internal byte AddExplicitCallingConvention(byte callingConvention) + => (byte)(callingConvention | (byte)(SignatureAttributes.ExplicitThis | SignatureAttributes.Instance)); + + internal byte GetRawCallingConvention(IToken token) => (byte)ParseInt32(token); + + internal byte GetDefaultCallingConvention() => (byte)SignatureCallingConvention.Default; + + internal byte GetCallingConvention(IToken token) + => (byte)(token.Type switch + { + CILParser.DEFAULT => SignatureCallingConvention.Default, + CILParser.VARARG => SignatureCallingConvention.VarArgs, + CILParser.CDECL => SignatureCallingConvention.CDecl, + CILParser.STDCALL => SignatureCallingConvention.StdCall, + CILParser.THISCALL => SignatureCallingConvention.ThisCall, + CILParser.FASTCALL => SignatureCallingConvention.FastCall, + CILParser.UNMANAGED => SignatureCallingConvention.Unmanaged, + _ => throw new UnreachableException() + }); + + internal void InitializeBound(CILParser.BoundContext context) + { + context.Lower = 0; + context.Upper = 0; + context.HasLower = false; + context.HasUpper = false; + } + + internal void SetBoundSize(CILParser.BoundContext context, IToken sizeToken) + { + context.Lower = 0; + context.Upper = ParseInt32(sizeToken); + context.HasLower = true; + context.HasUpper = true; + } + + internal void SetBoundRange(CILParser.BoundContext context, IToken lowerToken, IToken upperToken) + { + int lower = ParseInt32(lowerToken); + context.Lower = lower; + context.Upper = ParseInt32(upperToken) - lower + 1; + context.HasLower = true; + context.HasUpper = true; + } + + internal void SetBoundLower(CILParser.BoundContext context, IToken lowerToken) + { + context.Lower = ParseInt32(lowerToken); + context.HasLower = true; + } + + internal ArrayBoundValue CreateArrayBound(CILParser.BoundContext bound) + => new( + bound.HasLower ? bound.Lower : null, + bound.HasUpper ? bound.Upper : null); + + internal SignatureArgumentValue CreateSentinelSignatureArgument() + => new SignatureArgumentValue(true, 0, null, null, null); + + internal SignatureArgumentValue CreateSignatureArgument( + int attributes, + TypeValue type, + MarshallingDescriptorValue marshalling, + CILParser.IdContext? name) + => new SignatureArgumentValue( + false, + attributes, + type, + marshalling, + name is null ? null : GetIdentifier(name)); + + internal void SetParameterAttributeElement(CILParser.ParamAttrElementContext context, IToken attribute) + { + context.Value = attribute.Text switch + { + "in" => (int)ParameterAttributes.In, + "out" => (int)ParameterAttributes.Out, + "opt" => (int)ParameterAttributes.Optional, + _ => throw new UnreachableException() + }; + context.ShouldAppend = true; + } + + internal void SetRawParameterAttributeElement(CILParser.ParamAttrElementContext context, IToken token) + { + context.Value = ParseInt32(token) + 1; + context.ShouldAppend = false; + } + + internal int AddParameterAttribute(int attributes, int value, bool shouldAppend) + => shouldAppend ? attributes | value : value; + + internal ElementTypeValue CreateClassElementType(ClassNameValue className, bool isValueType) + => new ClassElementTypeValue(className, isValueType); + + internal ElementTypeValue CreateObjectElementType() + => new PrimitiveElementTypeValue((byte)SignatureTypeCode.Object); + + internal ElementTypeValue CreateTypedReferenceElementType() + => new PrimitiveElementTypeValue((byte)SignatureTypeCode.TypedReference); + + internal ElementTypeValue CreateVoidElementType() + => new PrimitiveElementTypeValue((byte)SignatureTypeCode.Void); + + internal ElementTypeValue CreatePrimitiveElementType(byte typeCode) + => new PrimitiveElementTypeValue(typeCode); + + internal ElementTypeValue CreateFunctionPointerElementType( + byte callingConvention, + TypeValue returnType, + ImmutableArray arguments) + => new FunctionPointerElementTypeValue( + callingConvention, + returnType, + arguments); + + internal ElementTypeValue CreateIndexedGenericParameterElementType( + bool isMethodParameter, + IToken token) + => new IndexedGenericParameterElementTypeValue(isMethodParameter, ParseInt32(token)); + + internal ElementTypeValue CreateNamedGenericParameterElementType( + IToken token, + bool isMethodParameter, + string name) + => new NamedGenericParameterElementTypeValue(token, isMethodParameter, name); + + internal ElementTypeValue CreateTypedefElementType(IToken token, string alias) + => new TypedefElementTypeValue(token, alias); + + internal ElementTypeValue CreateSentinelElementType(TypeValue type) + => new SentinelElementTypeValue(type); + + internal TypeModifierValue CreateSzArrayTypeModifier() + => new SimpleTypeModifierValue(SimpleTypeModifierKind.SzArray); + + internal TypeModifierValue CreateByReferenceTypeModifier() + => new SimpleTypeModifierValue(SimpleTypeModifierKind.ByReference); + + internal TypeModifierValue CreatePointerTypeModifier() + => new SimpleTypeModifierValue(SimpleTypeModifierKind.Pointer); + + internal TypeModifierValue CreatePinnedTypeModifier() + => new SimpleTypeModifierValue(SimpleTypeModifierKind.Pinned); + + internal TypeModifierValue CreateArrayTypeModifier(ImmutableArray bounds) + => new ArrayTypeModifierValue(bounds); + + internal TypeModifierValue CreateCustomTypeModifier( + TypeSpecificationValue type, + bool isRequired) + => new CustomTypeModifierValue(type, isRequired); + + internal TypeModifierValue CreateGenericArgumentsModifier( + ImmutableArray arguments) + => new GenericArgumentsTypeModifierValue(arguments); + + internal byte GetSimpleType(IToken token, bool isUnsigned) + { + SignatureTypeCode typeCode = (token.Type, isUnsigned) switch + { + (CILParser.CHAR, false) => SignatureTypeCode.Char, + (CILParser.STRING, false) => SignatureTypeCode.String, + (CILParser.BOOL, false) => SignatureTypeCode.Boolean, + (CILParser.INT8, false) => SignatureTypeCode.SByte, + (CILParser.INT16, false) => SignatureTypeCode.Int16, + (CILParser.INT32_, false) => SignatureTypeCode.Int32, + (CILParser.INT64_, false) => SignatureTypeCode.Int64, + (CILParser.FLOAT32, false) => SignatureTypeCode.Single, + (CILParser.FLOAT64_, false) => SignatureTypeCode.Double, + (CILParser.UINT8, false) => SignatureTypeCode.Byte, + (CILParser.UINT16, false) => SignatureTypeCode.UInt16, + (CILParser.UINT32, false) => SignatureTypeCode.UInt32, + (CILParser.UINT64, false) => SignatureTypeCode.UInt64, + (CILParser.INT8, true) => SignatureTypeCode.Byte, + (CILParser.INT16, true) => SignatureTypeCode.UInt16, + (CILParser.INT32_, true) => SignatureTypeCode.UInt32, + (CILParser.INT64_, true) => SignatureTypeCode.UInt64, + _ => throw new UnreachableException() + }; + + return (byte)typeCode; + } + + internal byte GetNativeIntType() => (byte)SignatureTypeCode.IntPtr; + + internal byte GetNativeUIntType() => (byte)SignatureTypeCode.UIntPtr; + + internal TypeSpecificationValue CreateClassTypeSpecification(ClassNameValue className) + => new ClassTypeSpecificationValue(className); + + internal TypeSpecificationValue CreateAssemblyTypeSpecification(string assemblyName) + => new AssemblyTypeSpecificationValue(assemblyName); + + internal TypeSpecificationValue CreateModuleTypeSpecification(string moduleName) + => new ModuleTypeSpecificationValue(moduleName); + + internal TypeSpecificationValue CreateSignatureTypeSpecification(TypeValue type) + => new SignatureTypeSpecificationValue(type); + + internal int GetGenericArity(CILParser.GenArityNotEmptyContext? context) + => context?.Value ?? 0; + + internal CalliSignatureValue CreateCalliSignature( + byte callingConvention, + TypeValue returnType, + ImmutableArray arguments) + => new CalliSignatureValue( + callingConvention, + returnType, + arguments); + + private BlobBuilder MaterializeCalliSignature(CalliSignatureValue calliSignature) + { + BlobBuilder signature = new(); + signature.WriteByte(calliSignature.CallingConvention); + ImmutableArray materializedArguments = MaterializeSignatureArguments(calliSignature.Arguments); + signature.WriteCompressedInteger(materializedArguments.Count(argument => !argument.IsSentinel)); + MaterializeType(calliSignature.ReturnType).WriteContentTo(signature); + foreach (SignatureArg argument in materializedArguments) + { + argument.SignatureBlob.WriteContentTo(signature); + } + + return signature; + } +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.References.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.References.cs new file mode 100644 index 00000000000000..2080f0721e640d --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.References.cs @@ -0,0 +1,212 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using System.Linq; +using System.Reflection.Metadata; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal MethodReferenceValue CreateMethodReference( + IToken token, + byte callingConvention, + TypeValue returnType, + TypeSpecificationValue? owner, + string name, + ImmutableArray? genericArguments, + int? genericArity, + ImmutableArray arguments) + => new ParsedMethodReferenceValue( + token, + callingConvention, + returnType, + owner, + name, + genericArguments, + genericArity.GetValueOrDefault(), + arguments); + + internal MethodReferenceValue CreateTokenMethodReference(int token) + => new TokenMethodReferenceValue(token); + + internal MethodReferenceValue CreateTypedefMethodReference(IToken token, string alias) + => new TypedefMethodReferenceValue(token, alias); + + internal FieldReferenceValue CreateFieldReference( + TypeValue fieldType, + TypeSpecificationValue? owner, + string name) + => new ParsedFieldReferenceValue( + fieldType, + owner, + name); + + internal FieldReferenceValue CreateTypedefFieldReference(IToken token, string alias) + => new TypedefFieldReferenceValue(token, alias); + + internal MemberReferenceValue CreateMethodMemberReference(MethodReferenceValue method) + => new MethodMemberReferenceValue(method); + + internal MemberReferenceValue CreateFieldMemberReference(FieldReferenceValue field) + => new FieldMemberReferenceValue(field); + + internal MemberReferenceValue CreateTokenMemberReference(int token) + => new TokenMemberReferenceValue(token); + + internal OwnerTypeValue CreateTypeOwner(TypeSpecificationValue type) + => new TypeOwnerValue(type); + + internal OwnerTypeValue CreateMemberOwner(MemberReferenceValue member) + => new MemberOwnerValue(member); + + private EntityRegistry.EntityBase MaterializeMethodReference(MethodReferenceValue methodReference) + { + switch (methodReference) + { + case TokenMethodReferenceValue token: + return ResolveMetadataToken(token.Token); + case TypedefMethodReferenceValue typedef: + if (TryResolveTypedefAsMember(typedef.Alias) is { } resolved) + { + return resolved; + } + ReportError( + DiagnosticIds.TypedefNotFound, + string.Format(DiagnosticMessageTemplates.TypedefNotFound, typedef.Alias), + typedef.Token); + return CreateErrorMethodReference(typedef.Alias); + case ParsedMethodReferenceValue parsed: + return MaterializeParsedMethodReference(parsed); + default: + return CreateErrorMethodReference(""); + } + } + + private EntityRegistry.EntityBase MaterializeParsedMethodReference(ParsedMethodReferenceValue methodReference) + { + byte callingConvention = methodReference.CallingConvention; + EntityRegistry.TypeEntity owner = methodReference.Owner is null + ? _entityRegistry.ModuleType + : ResolveTypeSpecification(methodReference.Owner); + + BlobBuilder? methodSpecificationSignature = null; + int genericArity = methodReference.GenericArity; + if (methodReference.GenericArguments is { } genericArguments) + { + genericArity = genericArguments.Length; + if (genericArity != 0) + { + methodSpecificationSignature = new BlobBuilder(); + methodSpecificationSignature.WriteByte((byte)SignatureKind.MethodSpecification); + MaterializeTypeArguments(genericArguments).WriteContentTo(methodSpecificationSignature); + } + } + + if (genericArity != 0) + { + callingConvention |= (byte)SignatureAttributes.Generic; + } + + if (_expectInstance && (callingConvention & (byte)SignatureAttributes.Instance) == 0) + { + ReportWarning( + DiagnosticIds.MissingInstanceCallConv, + DiagnosticMessageTemplates.MissingInstanceCallConv, + methodReference.Token); + callingConvention |= (byte)SignatureAttributes.Instance; + } + + BlobBuilder signature = new(); + signature.WriteByte(callingConvention); + if (genericArity != 0) + { + signature.WriteCompressedInteger(genericArity); + } + + ImmutableArray arguments = MaterializeSignatureArguments(methodReference.Arguments); + signature.WriteCompressedInteger(arguments.Count(argument => !argument.IsSentinel)); + MaterializeType(methodReference.ReturnType).WriteContentTo(signature); + foreach (SignatureArg argument in arguments) + { + argument.SignatureBlob.WriteContentTo(signature); + } + + EntityRegistry.MemberReferenceEntity memberReference = + _entityRegistry.CreateLazilyRecordedMemberReference(owner, methodReference.Name, signature); + return methodSpecificationSignature is null + ? memberReference + : _entityRegistry.GetOrCreateMethodSpecification(memberReference, methodSpecificationSignature); + } + + private EntityRegistry.EntityBase MaterializeFieldReference(FieldReferenceValue fieldReference) + { + switch (fieldReference) + { + case TypedefFieldReferenceValue typedef: + if (TryResolveTypedefAsMember(typedef.Alias) is { } resolved) + { + return resolved; + } + ReportError( + DiagnosticIds.TypedefNotFound, + string.Format(DiagnosticMessageTemplates.TypedefNotFound, typedef.Alias), + typedef.Token); + return CreateErrorFieldReference(typedef.Alias); + case ParsedFieldReferenceValue parsed: + BlobBuilder fieldType = MaterializeType(parsed.FieldType); + EntityRegistry.TypeEntity owner = parsed.Owner is null + ? _entityRegistry.ModuleType + : ResolveTypeSpecification(parsed.Owner); + BlobBuilder signature = new(fieldType.Count + 1); + signature.WriteByte((byte)SignatureKind.Field); + fieldType.WriteContentTo(signature); + return _entityRegistry.CreateLazilyRecordedMemberReference(owner, parsed.Name, signature); + default: + return CreateErrorFieldReference(""); + } + } + + private EntityRegistry.EntityBase MaterializeMemberReference(MemberReferenceValue memberReference) + => memberReference switch + { + MethodMemberReferenceValue method => MaterializeMethodReference(method.Method), + FieldMemberReferenceValue field => MaterializeFieldReference(field.Field), + TokenMemberReferenceValue token => ResolveMetadataToken(token.Token), + _ => CreateErrorMethodReference("") + }; + + private EntityRegistry.MemberReferenceEntity CreateErrorMethodReference(string name) + { + BlobBuilder signature = new(3); + signature.WriteByte((byte)SignatureCallingConvention.Default); + signature.WriteCompressedInteger(0); + signature.WriteByte((byte)SignatureTypeCode.Void); + return _entityRegistry.CreateLazilyRecordedMemberReference( + _entityRegistry.ModuleType, + name, + signature); + } + + private EntityRegistry.MemberReferenceEntity CreateErrorFieldReference(string name) + { + BlobBuilder signature = new(2); + signature.WriteByte((byte)SignatureKind.Field); + signature.WriteByte((byte)SignatureTypeCode.Object); + return _entityRegistry.CreateLazilyRecordedMemberReference( + _entityRegistry.ModuleType, + name, + signature); + } + + private EntityRegistry.EntityBase MaterializeOwnerType(OwnerTypeValue owner) + => owner switch + { + TypeOwnerValue type => ResolveTypeSpecification(type.Type), + MemberOwnerValue member => MaterializeMemberReference(member.Member), + _ => new EntityRegistry.FakeTypeEntity(default(TypeDefinitionHandle)) + }; +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.Types.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.Types.cs new file mode 100644 index 00000000000000..ca8e52ed1cd849 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.Types.cs @@ -0,0 +1,298 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Immutable; +using System.Linq; +using System.Reflection.Metadata; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + private BlobBuilder MaterializeType(TypeValue type) + { + const int DefaultSignatureElementBlobSize = 10; + + BlobBuilder elementType = MaterializeElementType(type.ElementType); + BlobBuilder prefix = new(DefaultSignatureElementBlobSize); + BlobBuilder suffix = new(DefaultSignatureElementBlobSize); + + for (int i = type.Modifiers.Length - 1; i >= 0; i--) + { + switch (type.Modifiers[i]) + { + case SimpleTypeModifierValue { Kind: SimpleTypeModifierKind.SzArray }: + prefix.WriteByte((byte)SignatureTypeCode.SZArray); + break; + case ArrayTypeModifierValue: + prefix.WriteByte((byte)SignatureTypeCode.Array); + break; + case SimpleTypeModifierValue { Kind: SimpleTypeModifierKind.ByReference }: + prefix.WriteByte((byte)SignatureTypeCode.ByReference); + break; + case SimpleTypeModifierValue { Kind: SimpleTypeModifierKind.Pointer }: + prefix.WriteByte((byte)SignatureTypeCode.Pointer); + break; + case SimpleTypeModifierValue { Kind: SimpleTypeModifierKind.Pinned }: + prefix.WriteByte((byte)SignatureTypeCode.Pinned); + break; + case CustomTypeModifierValue customModifier: + prefix.WriteByte((byte)(customModifier.IsRequired + ? SignatureTypeCode.RequiredModifier + : SignatureTypeCode.OptionalModifier)); + prefix.WriteTypeEntity(ResolveTypeSpecification(customModifier.Type)); + break; + case GenericArgumentsTypeModifierValue: + prefix.WriteByte((byte)SignatureTypeCode.GenericTypeInstance); + break; + } + } + + foreach (TypeModifierValue modifier in type.Modifiers) + { + switch (modifier) + { + case ArrayTypeModifierValue array: + WriteArrayShape(suffix, array.Bounds); + break; + case GenericArgumentsTypeModifierValue genericArguments: + MaterializeTypeArguments(genericArguments.Arguments).WriteContentTo(suffix); + break; + } + } + + // Work around https://github.com/dotnet/runtime/issues/127243 by writing to a separate blob. + BlobBuilder fullBlob = new(elementType.Count + prefix.Count + suffix.Count); + prefix.WriteContentTo(fullBlob); + elementType.WriteContentTo(fullBlob); + suffix.WriteContentTo(fullBlob); + return fullBlob; + } + + private BlobBuilder MaterializeElementType(ElementTypeValue elementType) + { + BlobBuilder blob = new(5); + switch (elementType) + { + case CILParser.ErrorElementTypeValue: + blob.WriteByte((byte)SignatureTypeCode.Object); + break; + case PrimitiveElementTypeValue primitive: + blob.WriteByte(primitive.TypeCode); + break; + case ClassElementTypeValue classType: + EntityRegistry.TypeEntity typeEntity = ResolveClassName(classType.ClassName); + if (TryGetPrimitiveTypeCode(typeEntity, classType.IsValueType) is { } primitiveTypeCode) + { + blob.WriteByte((byte)primitiveTypeCode); + } + else + { + blob.WriteByte((byte)(classType.IsValueType ? SignatureTypeKind.ValueType : SignatureTypeKind.Class)); + blob.WriteTypeEntity(typeEntity); + } + break; + case FunctionPointerElementTypeValue functionPointer: + blob.WriteByte((byte)SignatureTypeCode.FunctionPointer); + blob.WriteByte(functionPointer.CallingConvention); + ImmutableArray arguments = MaterializeSignatureArguments(functionPointer.Arguments); + blob.WriteCompressedInteger(arguments.Count(argument => !argument.IsSentinel)); + blob.LinkSuffix(MaterializeType(functionPointer.ReturnType)); + foreach (SignatureArg argument in arguments) + { + blob.LinkSuffix(argument.SignatureBlob); + } + break; + case IndexedGenericParameterElementTypeValue indexedGenericParameter: + blob.WriteByte((byte)(indexedGenericParameter.IsMethodParameter + ? SignatureTypeCode.GenericMethodParameter + : SignatureTypeCode.GenericTypeParameter)); + // Always emit indexed generic parameters, including intentionally invalid IL. + blob.WriteCompressedInteger(indexedGenericParameter.Index); + break; + case NamedGenericParameterElementTypeValue namedGenericParameter: + WriteNamedGenericParameter(blob, namedGenericParameter); + break; + case TypedefElementTypeValue typedef: + if (TryResolveTypedefAsTypeBlob(typedef.Alias) is { } resolved) + { + resolved.WriteContentTo(blob); + } + else + { + ReportError( + DiagnosticIds.TypedefNotFound, + string.Format(DiagnosticMessageTemplates.TypedefNotFound, typedef.Alias), + typedef.Token); + } + break; + case SentinelElementTypeValue sentinel: + blob.WriteByte((byte)SignatureTypeCode.Sentinel); + blob.LinkSuffix(MaterializeType(sentinel.Type)); + break; + } + + return blob; + } + + private void WriteNamedGenericParameter(BlobBuilder blob, NamedGenericParameterElementTypeValue genericParameter) + { + blob.WriteByte((byte)(genericParameter.IsMethodParameter + ? SignatureTypeCode.GenericMethodParameter + : SignatureTypeCode.GenericTypeParameter)); + + string name = genericParameter.Name; + if (genericParameter.IsMethodParameter) + { + if (_currentMethod is null) + { + ReportError( + DiagnosticIds.MethodTypeParameterOutsideMethod, + string.Format(DiagnosticMessageTemplates.MethodTypeParameterOutsideMethod, name), + genericParameter.Token); + blob.WriteCompressedInteger(0); + return; + } + + for (int i = 0; i < _currentMethod.Definition.GenericParameters.Count; i++) + { + if (_currentMethod.Definition.GenericParameters[i].Name == name) + { + blob.WriteCompressedInteger(i); + return; + } + } + } + else + { + if (_currentTypeDefinition.Count == 0) + { + ReportError( + DiagnosticIds.TypeParameterOutsideType, + string.Format(DiagnosticMessageTemplates.TypeParameterOutsideType, name), + genericParameter.Token); + blob.WriteCompressedInteger(0); + return; + } + + for (int i = 0; i < _currentTypeDefinition.Peek().GenericParameters.Count; i++) + { + if (_currentTypeDefinition.Peek().GenericParameters[i].Name == name) + { + blob.WriteCompressedInteger(i); + return; + } + } + } + + ReportError( + DiagnosticIds.GenericParameterNotFound, + string.Format(DiagnosticMessageTemplates.GenericParameterNotFound, name), + genericParameter.Token); + blob.WriteCompressedInteger(0); + } + + private ImmutableArray MaterializeSignatureArguments(ImmutableArray arguments) + { + ImmutableArray.Builder builder = ImmutableArray.CreateBuilder(arguments.Length); + foreach (SignatureArgumentValue argument in arguments) + { + builder.Add(MaterializeSignatureArgument(argument)); + } + return builder.MoveToImmutable(); + } + + private SignatureArg MaterializeSignatureArgument(SignatureArgumentValue argument) + { + if (argument.IsSentinel) + { + return SignatureArg.CreateSentinelArgument(); + } + + return new SignatureArg( + (System.Reflection.ParameterAttributes)argument.Attributes, + MaterializeType(argument.Type ?? TypeValue.Error), + MaterializeMarshallingDescriptor(argument.Marshalling), + argument.Name); + } + + private BlobBuilder MaterializeTypeArguments(ImmutableArray arguments) + { + BlobBuilder blob = new(4); + blob.WriteCompressedInteger(arguments.Length); + foreach (TypeValue argument in arguments) + { + blob.LinkSuffix(MaterializeType(argument)); + } + return blob; + } + + private static void WriteArrayShape(BlobBuilder suffix, ImmutableArray bounds) + { + suffix.WriteCompressedInteger(bounds.Length); + + int sizeCount = 0; + while (sizeCount < bounds.Length && bounds[sizeCount].Upper is not null) + { + sizeCount++; + } + + suffix.WriteCompressedInteger(sizeCount); + for (int i = 0; i < sizeCount; i++) + { + suffix.WriteCompressedInteger(bounds[i].Upper.GetValueOrDefault()); + } + + int lowerBoundCount = 0; + while (lowerBoundCount < bounds.Length && bounds[lowerBoundCount].Lower is not null) + { + lowerBoundCount++; + } + + suffix.WriteCompressedInteger(lowerBoundCount); + for (int i = 0; i < lowerBoundCount; i++) + { + suffix.WriteCompressedSignedInteger(bounds[i].Lower.GetValueOrDefault()); + } + } + + private static SignatureTypeCode? TryGetPrimitiveTypeCode(EntityRegistry.TypeEntity typeEntity, bool isValueType) + { + if (typeEntity is not EntityRegistry.TypeReferenceEntity typeReference || typeReference.Namespace != "System") + { + return null; + } + + if (isValueType) + { + return typeReference.Name switch + { + "Boolean" => SignatureTypeCode.Boolean, + "Char" => SignatureTypeCode.Char, + "SByte" => SignatureTypeCode.SByte, + "Byte" => SignatureTypeCode.Byte, + "Int16" => SignatureTypeCode.Int16, + "UInt16" => SignatureTypeCode.UInt16, + "Int32" => SignatureTypeCode.Int32, + "UInt32" => SignatureTypeCode.UInt32, + "Int64" => SignatureTypeCode.Int64, + "UInt64" => SignatureTypeCode.UInt64, + "Single" => SignatureTypeCode.Single, + "Double" => SignatureTypeCode.Double, + "IntPtr" => SignatureTypeCode.IntPtr, + "UIntPtr" => SignatureTypeCode.UIntPtr, + "TypedReference" => SignatureTypeCode.TypedReference, + _ => null + }; + } + + return typeReference.Name switch + { + "String" => SignatureTypeCode.String, + "Object" => SignatureTypeCode.Object, + _ => null + }; + } +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.cs new file mode 100644 index 00000000000000..15fa76626d8694 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ + internal EntityRegistry.EntityBase MaterializeMethodReference(CILParser.MethodRefContext context) + => MaterializeMethodReference(context.Value); + + internal EntityRegistry.TypeEntity ResolveTypeSpecification(CILParser.TypeSpecContext context) + => ResolveTypeSpecification(context.Value); +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.Headers.Actions.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.Headers.Actions.cs new file mode 100644 index 00000000000000..e066a53daddb23 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.Headers.Actions.cs @@ -0,0 +1,151 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal void PrepareNamespaceHeader() + => ClearPendingCustomAttributeOwners(); + + internal CILParser.ClassHeaderBuilder PrepareClassHeader() + { + ClearPendingCustomAttributeOwners(); + return new CILParser.ClassHeaderBuilder(); + } + + internal void AddClassHeaderAttribute( + CILParser.ClassHeaderBuilder builder, + ClassAttributeValue value) + => builder.Attributes.Add(value); + + internal ClassHeaderValue CreateClassHeader( + CILParser.ClassHeadContext context, + CILParser.ClassHeaderBuilder builder, + int initialSyntaxErrorCount, + IToken nameToken, + string fullName, + ImmutableArray genericParameters, + TypeSpecificationValue? baseType, + ImmutableArray interfaces) + { + if (HasSyntaxErrorsSince(initialSyntaxErrorCount) || + context.exception is not null) + { + return ClassHeaderValue.Error; + } + + return new ClassHeaderValue( + true, + nameToken, + fullName, + builder.Attributes.ToImmutable(), + genericParameters, + baseType, + interfaces); + } + + internal ClassAttributeValue CreateClassAttribute(IToken token) + { + return token.Text switch + { + "public" => CreateClassAttribute( + TypeAttributes.Public, + TypeAttributes.VisibilityMask), + "private" => CreateClassAttribute( + TypeAttributes.NotPublic, + TypeAttributes.VisibilityMask), + "value" => CreateClassAttribute( + TypeAttributes.Sealed, + fallbackBase: EntityRegistry.WellKnownBaseType.System_ValueType, + requireSealed: true), + "enum" => CreateClassAttribute( + 0, + fallbackBase: EntityRegistry.WellKnownBaseType.System_Enum), + "interface" => CreateClassAttribute(TypeAttributes.Interface | TypeAttributes.Abstract), + "sealed" => CreateClassAttribute(TypeAttributes.Sealed), + "abstract" => CreateClassAttribute(TypeAttributes.Abstract), + "auto" => CreateClassAttribute(TypeAttributes.AutoLayout, TypeAttributes.LayoutMask), + "sequential" => CreateClassAttribute( + TypeAttributes.SequentialLayout, + TypeAttributes.LayoutMask), + "explicit" => CreateClassAttribute(TypeAttributes.ExplicitLayout), + "extended" => CreateClassAttribute(TypeAttributes.ExtendedLayout, TypeAttributes.LayoutMask), + "ansi" => CreateClassAttribute(TypeAttributes.AnsiClass, TypeAttributes.StringFormatMask), + "unicode" => CreateClassAttribute( + TypeAttributes.UnicodeClass, + TypeAttributes.StringFormatMask), + "autochar" => CreateClassAttribute( + TypeAttributes.AutoClass, + TypeAttributes.StringFormatMask), + "import" => CreateClassAttribute(TypeAttributes.Import), +#pragma warning disable SYSLIB0050 + "serializable" => CreateClassAttribute(TypeAttributes.Serializable), +#pragma warning restore SYSLIB0050 + "windowsruntime" => CreateClassAttribute(TypeAttributes.WindowsRuntime), + "beforefieldinit" => CreateClassAttribute(TypeAttributes.BeforeFieldInit), + "specialname" => CreateClassAttribute(TypeAttributes.SpecialName), + "rtspecialname" => CreateClassAttribute(TypeAttributes.RTSpecialName), + _ => throw new UnreachableException(), + }; + } + + internal ClassAttributeValue CreateNestedClassAttribute(IToken visibility) + { + TypeAttributes attribute = visibility.Text switch + { + "public" => TypeAttributes.NestedPublic, + "private" => TypeAttributes.NestedPrivate, + "family" => TypeAttributes.NestedFamily, + "assembly" => TypeAttributes.NestedAssembly, + "famandassem" => TypeAttributes.NestedFamANDAssem, + "famorassem" => TypeAttributes.NestedFamORAssem, + _ => throw new UnreachableException(), + }; + return CreateClassAttribute(attribute, TypeAttributes.VisibilityMask); + } + + internal ClassAttributeValue CreateRawClassAttribute(IToken token) + { + int value = ParseInt32(token); + bool requireSealed = false; + EntityRegistry.WellKnownBaseType? fallbackBase = null; + if ((value & 0x80000000) != 0) + { + requireSealed = true; + fallbackBase = EntityRegistry.WellKnownBaseType.System_ValueType; + } + if ((value & 0x40000000) != 0) + { + fallbackBase = EntityRegistry.WellKnownBaseType.System_Enum; + } + + value &= unchecked((int)~0xC0000000); + return new ClassAttributeValue( + new((TypeAttributes)value, 0, false), + fallbackBase, + requireSealed); + } + + internal TypeSpecificationValue? CreateEmptyClassBase() => null; + + internal TypeSpecificationValue CreateClassBase(TypeSpecificationValue value) + => value; + + internal ImmutableArray CreateEmptyInterfaceList() + => []; + + private static ClassAttributeValue CreateClassAttribute( + TypeAttributes value, + TypeAttributes groupMask = 0, + EntityRegistry.WellKnownBaseType? fallbackBase = null, + bool requireSealed = false) + => new(new CILParser.AttributeValue(value, groupMask, true), fallbackBase, requireSealed); +} +#pragma warning restore CA1822 diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.Headers.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.Headers.cs new file mode 100644 index 00000000000000..a81c5f05ae3cca --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.Headers.cs @@ -0,0 +1,253 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection; +using Antlr4.Runtime; + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ + internal void BeginNamespace( + CILParser.NameSpaceHeadContext context, + string? namespaceName, + int initialSyntaxErrorCount) + { + if (!EnterDeclarationScope( + context.Parent, + !HasSyntaxErrorsSince(initialSyntaxErrorCount) && + context.exception is null && + namespaceName is not null)) + { + return; + } + + Debug.Assert(namespaceName is not null); + string? outerNamespace = _currentNamespace.PeekOrDefault(); + _currentNamespace.Push( + string.IsNullOrEmpty(outerNamespace) + ? namespaceName + : $"{outerNamespace}.{namespaceName}"); + _namespaceOwners.Push(context.Parent); + } + + internal void BeginType(CILParser.ClassHeadContext context, ClassHeaderValue value) + { + if (!EnterDeclarationScope(context.Parent, value.IsValid)) + { + return; + } + + EntityRegistry.TypeDefinitionEntity typeDefinition = MaterializeClassHeader(context, value); + _currentTypeDefinition.Push(typeDefinition); + _typeOwners.Push(context.Parent); + } + + private EntityRegistry.TypeDefinitionEntity MaterializeClassHeader( + CILParser.ClassHeadContext context, + ClassHeaderValue header) + { + (string typeNamespace, string typeName) = GetTypeDefinitionName(header.FullName); + bool isNewType = false; + EntityRegistry.TypeDefinitionEntity typeDefinition = + _entityRegistry.GetOrCreateTypeDefinition( + _currentTypeDefinition.PeekOrDefault(), + typeNamespace, + typeName, + newTypeDefinition => + { + isNewType = true; + InitializeTypeDefinition(context, header, newTypeDefinition); + }); + + if (!isNewType) + { + MergeTypeDefinition(context, header, typeDefinition); + } + + return typeDefinition; + } + + private (string Namespace, string Name) GetTypeDefinitionName(string fullName) + { + int lastDot = fullName.LastIndexOf('.'); + if (lastDot == 0) + { + lastDot = -1; + } + + string typeNamespace; + if (_currentTypeDefinition.Count != 0) + { + typeNamespace = lastDot == -1 ? string.Empty : fullName.Substring(0, lastDot); + } + else if (lastDot == -1) + { + typeNamespace = _currentNamespace.PeekOrDefault() ?? string.Empty; + } + else + { + string containingNamespace = fullName.Substring(0, lastDot); + string? currentNamespace = _currentNamespace.PeekOrDefault(); + typeNamespace = string.IsNullOrEmpty(currentNamespace) + ? containingNamespace + : $"{currentNamespace}.{containingNamespace}"; + } + + return ( + typeNamespace, + lastDot == -1 ? fullName : fullName.Substring(lastDot + 1)); + } + + private void InitializeTypeDefinition( + CILParser.ClassHeadContext context, + ClassHeaderValue header, + EntityRegistry.TypeDefinitionEntity typeDefinition) + { + EntityRegistry.WellKnownBaseType? fallbackBase = + _options.NoAutoInherit ? null : EntityRegistry.WellKnownBaseType.System_Object; + bool requireSealed = false; + TypeAttributes attributes = 0; + foreach (ClassAttributeValue classAttribute in header.Attributes) + { + if (classAttribute.FallbackBase is not null) + { + fallbackBase = classAttribute.FallbackBase; + } + + CILParser.AttributeValue attribute = classAttribute.Attribute; + if (!attribute.ShouldAppend) + { + attributes = attribute.Value; + requireSealed = classAttribute.RequireSealed; + continue; + } + + requireSealed |= classAttribute.RequireSealed; + if (attribute.Value == TypeAttributes.RTSpecialName) + { + continue; + } + + attributes = ApplyAttribute(attributes, attribute); + } + typeDefinition.Attributes = attributes; + ReportGenericParameterEncodingErrors(header.GenericParameters, context); + RegisterGenericParameterNames( + typeDefinition, + typeDefinition.GenericParameters, + header.GenericParameters); + + _currentTypeDefinition.Push(typeDefinition); + try + { + MaterializeGenericParameterConstraints( + typeDefinition.GenericParameters, + typeDefinition.GenericParameterConstraints, + header.GenericParameters); + if (header.BaseType is not null) + { + typeDefinition.BaseType = ResolveTypeSpecification(header.BaseType); + } + + AddInterfaceImplementations(typeDefinition, header.Interfaces); + } + finally + { + _currentTypeDefinition.Pop(); + } + + if (typeDefinition.Attributes.HasFlag(TypeAttributes.Interface)) + { + fallbackBase = null; + } + + typeDefinition.BaseType ??= _entityRegistry.ResolveImplicitBaseType(fallbackBase); + if (!typeDefinition.Attributes.HasFlag(TypeAttributes.Sealed) && + (requireSealed || _entityRegistry.SystemValueTypeType.Equals(typeDefinition.BaseType))) + { + IToken location = header.NameToken ?? context.Start; + _diagnostics.Add( + new Diagnostic( + DiagnosticIds.UnsealedValueType, + DiagnosticSeverity.Error, + string.Format(DiagnosticMessageTemplates.UnsealedValueType, typeDefinition.Name), + Location.From(location, _documents))); + typeDefinition.Attributes |= TypeAttributes.Sealed; + } + } + + private void MergeTypeDefinition( + CILParser.ClassHeadContext context, + ClassHeaderValue header, + EntityRegistry.TypeDefinitionEntity typeDefinition) + { + TypeAttributes attributes = typeDefinition.Attributes; + foreach (ClassAttributeValue classAttribute in header.Attributes) + { + CILParser.AttributeValue attribute = classAttribute.Attribute; + if (!attribute.ShouldAppend) + { + attributes = attribute.Value; + } + else if ((attribute.Value & TypeAttributes.Interface) != 0) + { + attributes |= TypeAttributes.Interface | TypeAttributes.Abstract; + } + else + { + attributes |= attribute.Value; + } + } + typeDefinition.Attributes = attributes; + + bool materializeConstraints = typeDefinition.GenericParameters.Count == 0; + if (materializeConstraints) + { + ReportGenericParameterEncodingErrors(header.GenericParameters, context); + RegisterGenericParameterNames( + typeDefinition, + typeDefinition.GenericParameters, + header.GenericParameters); + } + + _currentTypeDefinition.Push(typeDefinition); + try + { + if (materializeConstraints) + { + MaterializeGenericParameterConstraints( + typeDefinition.GenericParameters, + typeDefinition.GenericParameterConstraints, + header.GenericParameters); + } + + if (header.BaseType is not null) + { + EntityRegistry.TypeEntity baseType = ResolveTypeSpecification(header.BaseType); + typeDefinition.BaseType ??= baseType; + } + + AddInterfaceImplementations(typeDefinition, header.Interfaces); + } + finally + { + _currentTypeDefinition.Pop(); + } + } + + private void AddInterfaceImplementations( + EntityRegistry.TypeDefinitionEntity typeDefinition, + ImmutableArray interfaces) + { + foreach (TypeSpecificationValue interfaceType in interfaces) + { + typeDefinition.InterfaceImplementations.Add( + EntityRegistry.CreateUnrecordedInterfaceImplementation( + typeDefinition, + ResolveTypeSpecification(interfaceType))); + } + } +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.References.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.References.cs new file mode 100644 index 00000000000000..021711a9dd2911 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.References.cs @@ -0,0 +1,171 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using System.Diagnostics; +using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; +using Antlr4.Runtime; + +namespace ILAssembler; + +#pragma warning disable CA1822 // Parser actions are invoked through the per-parser GrammarActions instance. +internal sealed partial class GrammarActions +{ + internal TypeName AddSlashedNamePart(TypeName? containingTypeName, string name) + => new(containingTypeName, name); + + internal ClassNameValue CreateUnqualifiedClassName(TypeName name) + => new UnqualifiedClassNameValue(name); + + internal ClassNameValue CreateAssemblyQualifiedClassName(string assemblyName, TypeName name) + => new AssemblyQualifiedClassNameValue(assemblyName, name); + + internal ClassNameValue CreateModuleQualifiedClassName( + IToken token, + string moduleName, + TypeName name) + => new ModuleQualifiedClassNameValue(token, moduleName, name); + + internal ClassNameValue CreateTokenQualifiedClassName(int scopeToken, TypeName name) + => new TokenQualifiedClassNameValue(scopeToken, name); + + internal ClassNameValue CreatePointerQualifiedClassName(TypeName name) + => new PointerQualifiedClassNameValue(name); + + internal ClassNameValue CreateTokenClassName(int typeToken) + => new TokenClassNameValue(typeToken); + + internal ClassNameValue CreateThisClassName(IToken token) + => new SpecialClassNameValue(token, SpecialClassNameKind.This); + + internal ClassNameValue CreateBaseClassName(IToken token) + => new SpecialClassNameValue(token, SpecialClassNameKind.Base); + + internal ClassNameValue CreateNesterClassName(IToken token) + => new SpecialClassNameValue(token, SpecialClassNameKind.Nester); + + private EntityRegistry.TypeEntity ResolveClassName(ClassNameValue className) + { + switch (className) + { + case SpecialClassNameValue { Kind: SpecialClassNameKind.This } special: + if (_currentTypeDefinition.Count == 0) + { + ReportError(DiagnosticIds.ThisOutsideClass, DiagnosticMessageTemplates.ThisOutsideClass, special.Token); + return new EntityRegistry.FakeTypeEntity(default(TypeDefinitionHandle)); + } + return _currentTypeDefinition.Peek(); + case SpecialClassNameValue { Kind: SpecialClassNameKind.Base } special: + if (_currentTypeDefinition.Count == 0) + { + ReportError(DiagnosticIds.BaseOutsideClass, DiagnosticMessageTemplates.BaseOutsideClass, special.Token); + return new EntityRegistry.FakeTypeEntity(default(TypeDefinitionHandle)); + } + if (_currentTypeDefinition.Peek().BaseType is not { } baseType) + { + ReportError(DiagnosticIds.NoBaseType, DiagnosticMessageTemplates.NoBaseType, special.Token); + return new EntityRegistry.FakeTypeEntity(default(TypeDefinitionHandle)); + } + return baseType; + case SpecialClassNameValue { Kind: SpecialClassNameKind.Nester } special: + if (_currentTypeDefinition.Count < 2) + { + ReportError(DiagnosticIds.NesterOutsideNestedClass, DiagnosticMessageTemplates.NesterOutsideNestedClass, special.Token); + return new EntityRegistry.FakeTypeEntity(default(TypeDefinitionHandle)); + } + return _currentTypeDefinition.Peek().ContainingType!; + case AssemblyQualifiedClassNameValue assembly: + return _entityRegistry.GetOrCreateTypeReference( + _entityRegistry.GetOrCreateAssemblyReference(assembly.AssemblyName, _ => { }), + assembly.Name); + case ModuleQualifiedClassNameValue module: + if (_entityRegistry.FindModuleReference(module.ModuleName) is not { } moduleReference) + { + ReportError( + DiagnosticIds.ModuleNotFound, + string.Format(DiagnosticMessageTemplates.ModuleNotFound, module.ModuleName), + module.Token); + return new EntityRegistry.FakeTypeEntity(default(TypeDefinitionHandle)); + } + return _entityRegistry.GetOrCreateTypeReference(moduleReference, module.Name); + case TokenQualifiedClassNameValue tokenScope: + return _entityRegistry.GetOrCreateTypeReference( + ResolveMetadataToken(tokenScope.Token), + tokenScope.Name); + case PointerQualifiedClassNameValue pointer: + return _entityRegistry.GetOrCreateTypeReference( + new EntityRegistry.FakeTypeEntity(default(ModuleDefinitionHandle)), + pointer.Name); + case UnqualifiedClassNameValue unqualified: + return ResolveUnqualifiedClassName(unqualified.Name); + case TokenClassNameValue typeToken: + EntityRegistry.EntityBase resolvedToken = ResolveMetadataToken(typeToken.Token); + return resolvedToken is EntityRegistry.TypeEntity type + ? type + : new EntityRegistry.FakeTypeEntity(resolvedToken.Handle); + default: + return new EntityRegistry.FakeTypeEntity(default(TypeDefinitionHandle)); + } + } + + private EntityRegistry.TypeEntity ResolveUnqualifiedClassName(TypeName typeName) + { + if (typeName.ContainingTypeName is null && TryResolveTypedefAsType(typeName.DottedName) is { } typedef) + { + return typedef; + } + + if (typeName.ContainingTypeName is null) + { + (string ns, string name) = NameHelpers.SplitDottedNameToNamespaceAndName(typeName.DottedName); + if (ns == "System" && name is "String" or "Object" or "ValueType" or "Enum" + or "Type" or "Array" or "Delegate" or "MulticastDelegate" + or "Exception" or "Attribute") + { + return _entityRegistry.GetOrCreateTypeReference(_entityRegistry.GetCoreLibAssemblyReference(), typeName); + } + } + + Stack containingTypes = new(); + for (TypeName? containingType = typeName; containingType is not null; containingType = containingType.ContainingTypeName) + { + containingTypes.Push(containingType); + } + + EntityRegistry.TypeDefinitionEntity? typeDefinition = null; + while (containingTypes.Count != 0) + { + TypeName containingType = containingTypes.Pop(); + (string ns, string name) = NameHelpers.SplitDottedNameToNamespaceAndName(containingType.DottedName); + typeDefinition = _entityRegistry.GetOrCreateTypeDefinition(typeDefinition, ns, name, _ => { }); + } + + Debug.Assert(typeDefinition is not null); + return typeDefinition; + } + + private EntityRegistry.TypeEntity ResolveTypeSpecification(TypeSpecificationValue typeSpecification) + { + return typeSpecification switch + { + ClassTypeSpecificationValue classType => ResolveClassName(classType.ClassName), + ModuleTypeSpecificationValue module => ResolveModuleTypeSpecification(module.ModuleName), + AssemblyTypeSpecificationValue assembly => new EntityRegistry.FakeTypeEntity( + _entityRegistry.GetOrCreateAssemblyReference(assembly.AssemblyName, _ => { }).Handle), + SignatureTypeSpecificationValue signature => _entityRegistry.GetOrCreateTypeSpec(MaterializeType(signature.Type)), + _ => new EntityRegistry.FakeTypeEntity(default(TypeDefinitionHandle)) + }; + } + + private EntityRegistry.FakeTypeEntity ResolveModuleTypeSpecification(string moduleName) + { + EntityRegistry.ModuleReferenceEntity? module = _entityRegistry.FindModuleReference(moduleName); + return module is null + ? new EntityRegistry.FakeTypeEntity(MetadataTokens.ModuleReferenceHandle(0)) + : new EntityRegistry.FakeTypeEntity(module.Handle); + } + + private EntityRegistry.EntityBase ResolveMetadataToken(int token) + => _entityRegistry.ResolveHandleToEntity(MetadataTokens.EntityHandle(token)); +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.cs new file mode 100644 index 00000000000000..9d4638aeb91774 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.cs @@ -0,0 +1,118 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using System.Reflection.Metadata; +using Antlr4.Runtime; + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ + // Active namespace and type scopes are paired with their owning declaration so a rule's + // finally block can unwind real compiler state after syntax-error recovery. + private readonly Stack _namespaceOwners = new(); + private readonly Stack _typeOwners = new(); + + // Invalid scopes also retain their owners so nested declarations stay suppressed until the + // matching declaration finally block unwinds them. + private readonly Stack _suppressedDeclarationOwners = new(); + + private bool IsDeclarationSuppressed => _suppressedDeclarationOwners.Count != 0; + + private bool EnterDeclarationScope(RuleContext owner, bool hasValidHeader) + { + if (hasValidHeader && !IsDeclarationSuppressed) + { + return true; + } + + _suppressedDeclarationOwners.Push(owner); + return false; + } + + /// + /// Releases the namespace, type and method state that a top-level declaration introduced. + /// + /// + /// This runs from the decl rule's finally block so that a syntax error inside the + /// declaration body cannot leak a namespace, type or method scope into the following declarations. + /// + internal void EndDeclaration(CILParser.DeclContext context) + { + EndScopesOwnedBy(context); + } + + /// + /// Releases the type and method state that a class member declaration introduced. + /// + internal void EndClassDeclaration(CILParser.ClassDeclContext context) + { + EndScopesOwnedBy(context); + } + + private void EndScopesOwnedBy(RuleContext owner) + { + if (ReferenceEquals(_methodOwner, owner)) + { + EndMethod(); + } + + if (_suppressedDeclarationOwners.Count > 0 && + ReferenceEquals(_suppressedDeclarationOwners.Peek(), owner)) + { + _suppressedDeclarationOwners.Pop(); + ClearPendingCustomAttributeOwners(); + return; + } + + if (_typeOwners.Count > 0 && ReferenceEquals(_typeOwners.Peek(), owner)) + { + EndType(); + } + + if (_namespaceOwners.Count > 0 && ReferenceEquals(_namespaceOwners.Peek(), owner)) + { + EndNamespace(); + } + } + + private void EndType() + { + CompleteClassMethodOverrides(_currentTypeDefinition.Peek()); + _typeOwners.Pop(); + _currentTypeDefinition.Pop(); + ClearPendingCustomAttributeOwners(); + } + + private void EndNamespace() + { + _namespaceOwners.Pop(); + _currentNamespace.Pop(); + ClearPendingCustomAttributeOwners(); + } + + private void ResetTypeScopes() + { + _typeOwners.Clear(); + _currentTypeDefinition.Clear(); + _namespaceOwners.Clear(); + _currentNamespace.Clear(); + _suppressedDeclarationOwners.Clear(); + } + + /// + /// Drops the owners that a trailing .custom directive would bind to. + /// + /// + /// A trailing custom attribute only binds to the preceding field, generic parameter or generic + /// constraint within the same type body, so the pending owners must be dropped whenever a + /// namespace, type or method boundary is crossed. + /// + private void ClearPendingCustomAttributeOwners() + { + _lastFieldDefinition = null; + _pendingClassCustomAttributeOwner = null; + } + +} diff --git a/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.cs b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.cs new file mode 100644 index 00000000000000..410b17063310e7 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Diagnostics; + +namespace ILAssembler; + +internal sealed partial class GrammarActions +{ + /// + /// Resets the semantic state that must not flow from one document to the next. + /// + /// + /// The same instance compiles every document of a compilation so + /// that they share an entity registry. Every rule that introduces namespace, type, method or + /// scope state releases it from its own finally block, so this is only a safety net for + /// release builds. + /// + internal void BeginDocument() + { + Debug.Assert( + _currentMethod is null + && _typeOwners.Count == 0 + && _namespaceOwners.Count == 0 + && _suppressedDeclarationOwners.Count == 0 + && _scopeStack.Count == 0 + && _pendingClassMethodOverrides.Count == 0, + "Nested compiler state must be released by its owning declaration."); + EndMethod(); + ResetTypeScopes(); + ClearPendingCustomAttributeOwners(); + _pendingClassMethodOverrides.Clear(); + _currentDocumentPath = null; + _syntaxErrorCount = 0; + } +} diff --git a/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValueAliases.cs b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValueAliases.cs new file mode 100644 index 00000000000000..973abd2df5be75 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValueAliases.cs @@ -0,0 +1,176 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +global using AnsiBstrNativeTypeElementValue = ILAssembler.CILParser.AnsiBstrNativeTypeElementValue; +global using ArrayBoundValue = ILAssembler.CILParser.ArrayBoundValue; +global using ArraySerializationTypeValue = ILAssembler.CILParser.ArraySerializationTypeValue; +global using ArraySerializedInitializerValue = ILAssembler.CILParser.ArraySerializedInitializerValue; +global using ArrayTypeModifierValue = ILAssembler.CILParser.ArrayTypeModifierValue; +global using AssemblyCustomAttributeDirectiveValue = ILAssembler.CILParser.AssemblyCustomAttributeDirectiveValue; +global using AssemblyQualifiedClassNameValue = ILAssembler.CILParser.AssemblyQualifiedClassNameValue; +global using AssemblyDeclarationValue = ILAssembler.CILParser.AssemblyDeclarationValue; +global using AssemblyDefinitionValue = ILAssembler.CILParser.AssemblyDefinitionValue; +global using AssemblyHashAlgorithmDirectiveValue = ILAssembler.CILParser.AssemblyHashAlgorithmDirectiveValue; +global using AssemblyLocaleDirectiveValue = ILAssembler.CILParser.AssemblyLocaleDirectiveValue; +global using AssemblyPublicKeyDirectiveValue = ILAssembler.CILParser.AssemblyPublicKeyDirectiveValue; +global using AssemblyReferenceHashDirectiveValue = ILAssembler.CILParser.AssemblyReferenceHashDirectiveValue; +global using AssemblyReferenceHeaderValue = ILAssembler.CILParser.AssemblyReferenceHeaderValue; +global using AssemblyReferencePublicKeyTokenDirectiveValue = ILAssembler.CILParser.AssemblyReferencePublicKeyTokenDirectiveValue; +global using AssemblyReferenceValue = ILAssembler.CILParser.AssemblyReferenceValue; +global using AssemblySecurityDirectiveValue = ILAssembler.CILParser.AssemblySecurityDirectiveValue; +global using AssemblyTypeSpecificationValue = ILAssembler.CILParser.AssemblyTypeSpecificationValue; +global using AssemblyVersionDirectiveValue = ILAssembler.CILParser.AssemblyVersionDirectiveValue; +global using AttributePermissionSetValue = ILAssembler.CILParser.AttributePermissionSetValue; +global using CalliSignatureValue = ILAssembler.CILParser.CalliSignatureValue; +global using CatchExceptionClauseValue = ILAssembler.CILParser.CatchExceptionClauseValue; +global using CatchTypeValue = ILAssembler.CILParser.CatchTypeValue; +global using ClassAttributeValue = ILAssembler.CILParser.ClassAttributeValue; +global using ClassElementTypeValue = ILAssembler.CILParser.ClassElementTypeValue; +global using ClassEnumSerializationTypeValue = ILAssembler.CILParser.ClassEnumSerializationTypeValue; +global using ClassHeaderValue = ILAssembler.CILParser.ClassHeaderValue; +global using ClassNameSerializedInitializerValue = ILAssembler.CILParser.ClassNameSerializedInitializerValue; +global using ClassNameValue = ILAssembler.CILParser.ClassNameValue; +global using ClassSerializedSequenceValue = ILAssembler.CILParser.ClassSerializedSequenceValue; +global using ClassSequenceElementValue = ILAssembler.CILParser.ClassSequenceElementValue; +global using ClassTypeSpecificationValue = ILAssembler.CILParser.ClassTypeSpecificationValue; +global using ClassTypedefDeclarationValue = ILAssembler.CILParser.ClassTypedefDeclarationValue; +global using CustomAttributeApplicationValue = ILAssembler.CILParser.CustomAttributeApplicationValue; +global using CustomAttributeBlobValue = ILAssembler.CILParser.CustomAttributeBlobValue; +global using CustomAttributeDeclarationValue = ILAssembler.CILParser.CustomAttributeDeclarationValue; +global using CustomAttributeDescriptorValue = ILAssembler.CILParser.CustomAttributeDescriptorValue; +global using CustomAttributeNamedArgumentValue = ILAssembler.CILParser.CustomAttributeNamedArgumentValue; +global using CustomAttributeTypedefDeclarationValue = ILAssembler.CILParser.CustomAttributeTypedefDeclarationValue; +global using CustomAttributeTypedefValue = ILAssembler.CILParser.CustomAttributeTypedefValue; +global using CustomMarshallerNativeTypeElementValue = ILAssembler.CILParser.CustomMarshallerNativeTypeElementValue; +global using CustomTypeModifierValue = ILAssembler.CILParser.CustomTypeModifierValue; +global using DataDeclarationBuilder = ILAssembler.CILParser.DataDeclarationBuilder; +global using DeprecatedNativeTypeElementValue = ILAssembler.CILParser.DeprecatedNativeTypeElementValue; +global using ElementTypeValue = ILAssembler.CILParser.ElementTypeValue; +global using EmptyNativeTypeElementValue = ILAssembler.CILParser.EmptyNativeTypeElementValue; +global using EmptyPermissionDeclarationValue = ILAssembler.CILParser.EmptyPermissionDeclarationValue; +global using EventHeaderValue = ILAssembler.CILParser.EventHeaderValue; +global using ExceptionClauseValue = ILAssembler.CILParser.ExceptionClauseValue; +global using ExceptionFilterValue = ILAssembler.CILParser.ExceptionFilterValue; +global using ExceptionRangeValue = ILAssembler.CILParser.ExceptionRangeValue; +global using ExportedTypeAssemblyDirectiveValue = ILAssembler.CILParser.ExportedTypeAssemblyDirectiveValue; +global using ExportedTypeCustomAttributeDirectiveValue = ILAssembler.CILParser.ExportedTypeCustomAttributeDirectiveValue; +global using ExportedTypeDeclarationValue = ILAssembler.CILParser.ExportedTypeDeclarationValue; +global using ExportedTypeDefinitionIdDirectiveValue = ILAssembler.CILParser.ExportedTypeDefinitionIdDirectiveValue; +global using ExportedTypeFileDirectiveValue = ILAssembler.CILParser.ExportedTypeFileDirectiveValue; +global using ExportedTypeHeaderValue = ILAssembler.CILParser.ExportedTypeHeaderValue; +global using ExportedTypeMetadataTokenDirectiveValue = ILAssembler.CILParser.ExportedTypeMetadataTokenDirectiveValue; +global using ExportedTypeValue = ILAssembler.CILParser.ExportedTypeValue; +global using FaultExceptionClauseValue = ILAssembler.CILParser.FaultExceptionClauseValue; +global using FieldDeclarationValue = ILAssembler.CILParser.FieldDeclarationValue; +global using FileDeclarationValue = ILAssembler.CILParser.FileDeclarationValue; +global using FieldInitializerValue = ILAssembler.CILParser.FieldInitializerValue; +global using FieldMemberReferenceValue = ILAssembler.CILParser.FieldMemberReferenceValue; +global using FieldReferenceValue = ILAssembler.CILParser.FieldReferenceValue; +global using FilterExceptionClauseValue = ILAssembler.CILParser.FilterExceptionClauseValue; +global using FinallyExceptionClauseValue = ILAssembler.CILParser.FinallyExceptionClauseValue; +global using FixedArrayNativeTypeElementValue = ILAssembler.CILParser.FixedArrayNativeTypeElementValue; +global using FixedSysStringNativeTypeElementValue = ILAssembler.CILParser.FixedSysStringNativeTypeElementValue; +global using FunctionPointerElementTypeValue = ILAssembler.CILParser.FunctionPointerElementTypeValue; +global using GenericArgumentsTypeModifierValue = ILAssembler.CILParser.GenericArgumentsTypeModifierValue; +global using GenericParameterDeclarationValue = ILAssembler.CILParser.GenericParameterDeclarationValue; +global using IidNativeTypeElementValue = ILAssembler.CILParser.IidNativeTypeElementValue; +global using IidParamIndexValue = ILAssembler.CILParser.IidParamIndexValue; +global using IndexedGenericParameterElementTypeValue = ILAssembler.CILParser.IndexedGenericParameterElementTypeValue; +global using InvalidByteArraySerializedInitializerValue = ILAssembler.CILParser.InvalidByteArraySerializedInitializerValue; +global using LabelExceptionFilterValue = ILAssembler.CILParser.LabelExceptionFilterValue; +global using LabelExceptionRangeValue = ILAssembler.CILParser.LabelExceptionRangeValue; +global using LanguageDirectiveValue = ILAssembler.CILParser.LanguageDirectiveValue; +global using ManifestResourceAssemblyDirectiveValue = ILAssembler.CILParser.ManifestResourceAssemblyDirectiveValue; +global using ManifestResourceCustomAttributeDirectiveValue = ILAssembler.CILParser.ManifestResourceCustomAttributeDirectiveValue; +global using ManifestResourceDeclarationValue = ILAssembler.CILParser.ManifestResourceDeclarationValue; +global using ManifestResourceFileDirectiveValue = ILAssembler.CILParser.ManifestResourceFileDirectiveValue; +global using ManifestResourceHeaderValue = ILAssembler.CILParser.ManifestResourceHeaderValue; +global using ManifestResourceValue = ILAssembler.CILParser.ManifestResourceValue; +global using MarshallingDescriptorValue = ILAssembler.CILParser.MarshallingDescriptorValue; +global using MemberOwnerValue = ILAssembler.CILParser.MemberOwnerValue; +global using MemberReferenceValue = ILAssembler.CILParser.MemberReferenceValue; +global using MemberTypedefDeclarationValue = ILAssembler.CILParser.MemberTypedefDeclarationValue; +global using MethodHeaderValue = ILAssembler.CILParser.MethodHeaderValue; +global using MethodMemberReferenceValue = ILAssembler.CILParser.MethodMemberReferenceValue; +global using MethodReferenceValue = ILAssembler.CILParser.MethodReferenceValue; +global using ModuleQualifiedClassNameValue = ILAssembler.CILParser.ModuleQualifiedClassNameValue; +global using ModuleTypeSpecificationValue = ILAssembler.CILParser.ModuleTypeSpecificationValue; +global using NamedGenericParameterElementTypeValue = ILAssembler.CILParser.NamedGenericParameterElementTypeValue; +global using NamedPermissionDeclarationValue = ILAssembler.CILParser.NamedPermissionDeclarationValue; +global using NativeTypeArrayPointerInfoKind = ILAssembler.CILParser.NativeTypeArrayPointerInfoKind; +global using NativeTypeArrayPointerInfoValue = ILAssembler.CILParser.NativeTypeArrayPointerInfoValue; +global using NativeTypeElementValue = ILAssembler.CILParser.NativeTypeElementValue; +global using NativeTypeTypedefValue = ILAssembler.CILParser.NativeTypeTypedefValue; +global using NativeTypeValue = ILAssembler.CILParser.NativeTypeValue; +global using NestedExportedTypeDirectiveValue = ILAssembler.CILParser.NestedExportedTypeDirectiveValue; +global using NestedStructNativeTypeElementValue = ILAssembler.CILParser.NestedStructNativeTypeElementValue; +global using ObjectSerializedInitializerValue = ILAssembler.CILParser.ObjectSerializedInitializerValue; +global using ObjectSerializedSequenceValue = ILAssembler.CILParser.ObjectSerializedSequenceValue; +global using OffsetExceptionFilterValue = ILAssembler.CILParser.OffsetExceptionFilterValue; +global using OffsetExceptionRangeValue = ILAssembler.CILParser.OffsetExceptionRangeValue; +global using OwnerTypeValue = ILAssembler.CILParser.OwnerTypeValue; +global using ParsedFieldReferenceValue = ILAssembler.CILParser.ParsedFieldReferenceValue; +global using ParsedMethodReferenceValue = ILAssembler.CILParser.ParsedMethodReferenceValue; +global using PermissionDeclarationValue = ILAssembler.CILParser.PermissionDeclarationValue; +global using PInvokeValue = ILAssembler.CILParser.PInvokeValue; +global using PointerQualifiedClassNameValue = ILAssembler.CILParser.PointerQualifiedClassNameValue; +global using PrimitiveElementTypeValue = ILAssembler.CILParser.PrimitiveElementTypeValue; +global using PropertyHeaderValue = ILAssembler.CILParser.PropertyHeaderValue; +global using RawCustomAttributeBlobValue = ILAssembler.CILParser.RawCustomAttributeBlobValue; +global using RawPermissionSetValue = ILAssembler.CILParser.RawPermissionSetValue; +global using RawSerializationTypeValue = ILAssembler.CILParser.RawSerializationTypeValue; +global using RawSerializedInitializerValue = ILAssembler.CILParser.RawSerializedInitializerValue; +global using RawSerializedSequenceValue = ILAssembler.CILParser.RawSerializedSequenceValue; +global using RawVTableValue = ILAssembler.CILParser.RawVTableValue; +global using SafeArrayNativeTypeElementValue = ILAssembler.CILParser.SafeArrayNativeTypeElementValue; +global using ScopeExceptionFilterValue = ILAssembler.CILParser.ScopeExceptionFilterValue; +global using ScopeExceptionRangeValue = ILAssembler.CILParser.ScopeExceptionRangeValue; +global using SecurityAttributeValue = ILAssembler.CILParser.SecurityAttributeValue; +global using SecurityBooleanValue = ILAssembler.CILParser.SecurityBooleanValue; +global using SecurityCaValue = ILAssembler.CILParser.SecurityCaValue; +global using SecurityDeclarationValue = ILAssembler.CILParser.SecurityDeclarationValue; +global using SecurityEnumValue = ILAssembler.CILParser.SecurityEnumValue; +global using SecurityInt32Value = ILAssembler.CILParser.SecurityInt32Value; +global using SecurityNameValuePairValue = ILAssembler.CILParser.SecurityNameValuePairValue; +global using SecurityStringValue = ILAssembler.CILParser.SecurityStringValue; +global using SentinelElementTypeValue = ILAssembler.CILParser.SentinelElementTypeValue; +global using SerializationTypeValue = ILAssembler.CILParser.SerializationTypeValue; +global using SerializedInitializerValue = ILAssembler.CILParser.SerializedInitializerValue; +global using SerializedSequenceValue = ILAssembler.CILParser.SerializedSequenceValue; +global using SignatureArgumentValue = ILAssembler.CILParser.SignatureArgumentValue; +global using SignatureTypeSpecificationValue = ILAssembler.CILParser.SignatureTypeSpecificationValue; +global using SimpleNativeTypeElementValue = ILAssembler.CILParser.SimpleNativeTypeElementValue; +global using SimpleSerializationTypeValue = ILAssembler.CILParser.SimpleSerializationTypeValue; +global using SimpleTypeModifierKind = ILAssembler.CILParser.SimpleTypeModifierKind; +global using SimpleTypeModifierValue = ILAssembler.CILParser.SimpleTypeModifierValue; +global using SourceDirectiveValue = ILAssembler.CILParser.SourceDirectiveValue; +global using SpecialClassNameKind = ILAssembler.CILParser.SpecialClassNameKind; +global using SpecialClassNameValue = ILAssembler.CILParser.SpecialClassNameValue; +global using StringClassSequenceElementValue = ILAssembler.CILParser.StringClassSequenceElementValue; +global using StringEnumSerializationTypeValue = ILAssembler.CILParser.StringEnumSerializationTypeValue; +global using StringPermissionSetValue = ILAssembler.CILParser.StringPermissionSetValue; +global using StructuredCustomAttributeBlobValue = ILAssembler.CILParser.StructuredCustomAttributeBlobValue; +global using StructuredPermissionDeclarationValue = ILAssembler.CILParser.StructuredPermissionDeclarationValue; +global using TokenClassNameValue = ILAssembler.CILParser.TokenClassNameValue; +global using TokenMemberReferenceValue = ILAssembler.CILParser.TokenMemberReferenceValue; +global using TokenMethodReferenceValue = ILAssembler.CILParser.TokenMethodReferenceValue; +global using TokenQualifiedClassNameValue = ILAssembler.CILParser.TokenQualifiedClassNameValue; +global using TypeClassSequenceElementValue = ILAssembler.CILParser.TypeClassSequenceElementValue; +global using TypeModifierValue = ILAssembler.CILParser.TypeModifierValue; +global using TypeName = ILAssembler.CILParser.TypeName; +global using TypeOwnerValue = ILAssembler.CILParser.TypeOwnerValue; +global using TypeSignatureTypedefDeclarationValue = ILAssembler.CILParser.TypeSignatureTypedefDeclarationValue; +global using TypeSpecificationValue = ILAssembler.CILParser.TypeSpecificationValue; +global using TypeValue = ILAssembler.CILParser.TypeValue; +global using TypedefDeclarationValue = ILAssembler.CILParser.TypedefDeclarationValue; +global using TypedefElementTypeValue = ILAssembler.CILParser.TypedefElementTypeValue; +global using TypedefEntry = ILAssembler.CILParser.TypedefEntry; +global using TypedefFieldReferenceValue = ILAssembler.CILParser.TypedefFieldReferenceValue; +global using TypedefMethodReferenceValue = ILAssembler.CILParser.TypedefMethodReferenceValue; +global using TypedefSerializationTypeValue = ILAssembler.CILParser.TypedefSerializationTypeValue; +global using UnqualifiedClassNameValue = ILAssembler.CILParser.UnqualifiedClassNameValue; +global using UnsignedNativeTypeElementValue = ILAssembler.CILParser.UnsignedNativeTypeElementValue; +global using VariantBoolNativeTypeElementValue = ILAssembler.CILParser.VariantBoolNativeTypeElementValue; +global using VariantTypeElementValue = ILAssembler.CILParser.VariantTypeElementValue; +global using VariantTypeValue = ILAssembler.CILParser.VariantTypeValue; +global using VTableFixupValue = ILAssembler.CILParser.VTableFixupValue; diff --git a/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.CustomAttributes.cs b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.CustomAttributes.cs new file mode 100644 index 00000000000000..75c72a98e4f2ff --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.CustomAttributes.cs @@ -0,0 +1,148 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using System.Reflection.Metadata; +using Antlr4.Runtime; + +namespace ILAssembler; + +public partial class CILParser +{ + public abstract record CustomAttributeDeclarationValue + { + public static CustomAttributeDeclarationValue Error { get; } = + new ErrorCustomAttributeDeclarationValue(); + } + + public sealed record ErrorCustomAttributeDeclarationValue : CustomAttributeDeclarationValue; + + public sealed record CustomAttributeDescriptorValue( + MethodReferenceValue Constructor, + CustomAttributeBlobValue Value, + OwnerTypeValue? Owner) : CustomAttributeDeclarationValue + { + public static new CustomAttributeDescriptorValue Error { get; } = + new(MethodReferenceValue.Error, CustomAttributeBlobValue.Error, null); + } + + public sealed record CustomAttributeTypedefValue( + string Alias) : CustomAttributeDeclarationValue; + + public sealed record CustomAttributeApplicationValue( + CustomAttributeDeclarationValue? Value, + IToken Location, + bool HasSyntaxError); + + public abstract record CustomAttributeBlobValue + { + public static CustomAttributeBlobValue Error { get; } = + new ErrorCustomAttributeBlobValue(); + } + + public sealed record ErrorCustomAttributeBlobValue : CustomAttributeBlobValue; + + public sealed record RawCustomAttributeBlobValue( + BlobBuilder Value) : CustomAttributeBlobValue; + + public sealed record StructuredCustomAttributeBlobValue( + ImmutableArray Arguments, + ImmutableArray NamedArguments) + : CustomAttributeBlobValue; + + public sealed record CustomAttributeNamedArgumentValue( + byte Kind, + SerializationTypeValue Type, + string Name, + SerializedInitializerValue Value); + + public abstract record SerializationTypeValue + { + public static SerializationTypeValue Error { get; } = + new ErrorSerializationTypeValue(); + } + + public sealed record ErrorSerializationTypeValue : SerializationTypeValue; + + public sealed record RawSerializationTypeValue( + BlobBuilder Value) : SerializationTypeValue; + + public sealed record SimpleSerializationTypeValue( + SerializationTypeCode Type) : SerializationTypeValue; + + public sealed record ArraySerializationTypeValue( + SerializationTypeValue ElementType) : SerializationTypeValue; + + public sealed record StringEnumSerializationTypeValue( + string Name) : SerializationTypeValue; + + public sealed record ClassEnumSerializationTypeValue( + ClassNameValue ClassName) : SerializationTypeValue; + + public sealed record TypedefSerializationTypeValue( + IToken Token, + string Alias) : SerializationTypeValue; + + public abstract record SerializedInitializerValue(SerializationTypeValue Type) + { + public static SerializedInitializerValue Error { get; } = + new ErrorSerializedInitializerValue(); + } + + public sealed record ErrorSerializedInitializerValue() + : SerializedInitializerValue(SerializationTypeValue.Error); + + public sealed record RawSerializedInitializerValue( + SerializationTypeValue Type, + BlobBuilder Value) : SerializedInitializerValue(Type); + + public sealed record ClassNameSerializedInitializerValue( + ClassNameValue ClassName) + : SerializedInitializerValue( + new SimpleSerializationTypeValue(SerializationTypeCode.Type)); + + public sealed record ObjectSerializedInitializerValue( + SerializedInitializerValue Value) + : SerializedInitializerValue( + new SimpleSerializationTypeValue(SerializationTypeCode.TaggedObject)); + + public sealed record InvalidByteArraySerializedInitializerValue( + IToken Token) + : SerializedInitializerValue( + new SimpleSerializationTypeValue(SerializationTypeCode.String)); + + public sealed record ArraySerializedInitializerValue( + SerializationTypeValue Type, + int Length, + SerializedSequenceValue Values) : SerializedInitializerValue(Type); + + public abstract record SerializedSequenceValue; + + public sealed record RawSerializedSequenceValue( + BlobBuilder Value) : SerializedSequenceValue; + + public sealed record ClassSerializedSequenceValue( + ImmutableArray Values) : SerializedSequenceValue; + + public sealed record ObjectSerializedSequenceValue( + ImmutableArray Values) : SerializedSequenceValue; + + public abstract record ClassSequenceElementValue + { + public static ClassSequenceElementValue Error { get; } = + new ErrorClassSequenceElementValue(); + } + + public sealed record ErrorClassSequenceElementValue : ClassSequenceElementValue; + + public sealed record StringClassSequenceElementValue( + string? Value) : ClassSequenceElementValue; + + public sealed record TypeClassSequenceElementValue( + ClassNameValue ClassName) : ClassSequenceElementValue; + + public sealed record FieldInitializerValue(bool HasValue, object? ConstantValue) + { + public static FieldInitializerValue Empty { get; } = new(false, null); + } +} diff --git a/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Declarations.cs b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Declarations.cs new file mode 100644 index 00000000000000..948297d8e5e1c2 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Declarations.cs @@ -0,0 +1,225 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using System.Reflection; +using Antlr4.Runtime; + +namespace ILAssembler; + +public partial class CILParser +{ + public sealed record AttributeValue(T Value, T GroupMask, bool ShouldAppend) + where T : struct, System.Enum + { + public static AttributeValue Empty { get; } = new(default, default, true); + } + + public sealed record PInvokeValue( + string? ModuleName, + string? EntryPointName, + MethodImportAttributes Attributes); + + public sealed record GenericParameterDeclarationValue( + GenericParameterAttributes Attributes, + string Name, + ImmutableArray Constraints) + { + internal IToken? Location { get; init; } + internal IToken? ConstraintLocation { get; init; } + + public static GenericParameterDeclarationValue Error { get; } = + new(0, string.Empty, []); + } + + public sealed record MethodHeaderValue( + bool IsValid, + MethodAttributes Attributes, + ImmutableArray PInvokes, + byte CallingConvention, + int ReturnAttributes, + TypeValue ReturnType, + MarshallingDescriptorValue ReturnMarshalling, + string Name, + ImmutableArray GenericParameters, + ImmutableArray Arguments, + MethodImplAttributes ImplementationAttributes) + { + public static MethodHeaderValue Error { get; } = new( + false, + 0, + [], + 0, + 0, + TypeValue.Error, + MarshallingDescriptorValue.Empty, + string.Empty, + [], + [], + 0); + } + + public sealed record FieldDeclarationValue( + bool IsValid, + FieldAttributes Attributes, + TypeValue FieldType, + string Name, + MarshallingDescriptorValue Marshalling, + string? DataDeclarationName, + int? Offset, + FieldInitializerValue Initializer) + { + public static FieldDeclarationValue Error { get; } = new( + false, + 0, + TypeValue.Error, + string.Empty, + MarshallingDescriptorValue.Empty, + null, + null, + FieldInitializerValue.Empty); + } + + public sealed record PropertyHeaderValue( + bool IsValid, + PropertyAttributes Attributes, + byte CallingConvention, + TypeValue PropertyType, + string Name, + ImmutableArray Arguments, + FieldInitializerValue Initializer) + { + public static PropertyHeaderValue Error { get; } = new( + false, + 0, + 0, + TypeValue.Error, + string.Empty, + [], + FieldInitializerValue.Empty); + } + + public sealed record EventHeaderValue( + bool IsValid, + EventAttributes Attributes, + TypeSpecificationValue? EventType, + string Name) + { + public static EventHeaderValue Error { get; } = + new(false, 0, null, string.Empty); + } + + public sealed class ClassAttributeValue + { + public static ClassAttributeValue Empty { get; } = + new(AttributeValue.Empty, null, false); + + internal ClassAttributeValue( + AttributeValue attribute, + EntityRegistry.WellKnownBaseType? fallbackBase, + bool requireSealed) + { + Attribute = attribute; + FallbackBase = fallbackBase; + RequireSealed = requireSealed; + } + + internal AttributeValue Attribute { get; } + + internal EntityRegistry.WellKnownBaseType? FallbackBase { get; } + + internal bool RequireSealed { get; } + } + + public sealed record ClassHeaderValue( + bool IsValid, + IToken? NameToken, + string FullName, + ImmutableArray Attributes, + ImmutableArray GenericParameters, + TypeSpecificationValue? BaseType, + ImmutableArray Interfaces) + { + public static ClassHeaderValue Error { get; } = new( + false, + null, + string.Empty, + [], + [], + null, + []); + } + + public sealed class MethodHeaderBuilder + { + internal MethodAttributes Attributes { get; set; } + + internal ImmutableArray.Builder PInvokes { get; } = + ImmutableArray.CreateBuilder(); + + internal MethodImplAttributes ImplementationAttributes { get; set; } + } + + public sealed class PInvokeBuilder + { + internal string? ModuleName { get; set; } + + internal string? EntryPointName { get; set; } + + internal MethodImportAttributes Attributes { get; set; } + } + + public sealed class FieldDeclarationBuilder + { + internal FieldAttributes Attributes { get; set; } + + internal MarshallingDescriptorValue Marshalling { get; set; } = + MarshallingDescriptorValue.Empty; + } + + public sealed class PropertyHeaderBuilder + { + internal PropertyAttributes Attributes { get; set; } + } + + public sealed class EventHeaderBuilder + { + internal EventAttributes Attributes { get; set; } + } + + public sealed class ClassHeaderBuilder + { + internal ImmutableArray.Builder Attributes { get; } = + ImmutableArray.CreateBuilder(); + } + + public sealed class PropertyBodyValue + { + internal PropertyBodyValue(EntityRegistry.PropertyEntity? property) + { + Property = property; + } + + internal EntityRegistry.PropertyEntity? Property { get; } + } + + public sealed class EventBodyValue + { + internal EventBodyValue(EntityRegistry.EventEntity? @event) + { + Event = @event; + } + + internal EntityRegistry.EventEntity? Event { get; } + } + + public sealed class CustomAttributeOwnerValue + { + internal CustomAttributeOwnerValue(EntityRegistry.EntityBase? owner) + { + Owner = owner; + } + + internal EntityRegistry.EntityBase? Owner { get; } + } +} diff --git a/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Manifest.cs b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Manifest.cs new file mode 100644 index 00000000000000..09642c64c55621 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Manifest.cs @@ -0,0 +1,231 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Immutable; +using System.Reflection; +using System.Reflection.Metadata; +using Antlr4.Runtime; + +namespace ILAssembler; + +public partial class CILParser +{ + public abstract record AssemblyDeclarationValue; + + public sealed record AssemblyDefinitionValue( + AssemblyFlags Attributes, + string Name, + ImmutableArray Declarations); + + public sealed record AssemblyReferenceValue( + AssemblyReferenceHeaderValue Header, + ImmutableArray Declarations); + + public sealed record AssemblyReferenceHeaderValue( + bool IsValid, + AssemblyFlags Attributes, + string Name, + string Alias) + { + public static AssemblyReferenceHeaderValue Error { get; } = + new(false, 0, string.Empty, string.Empty); + } + + public sealed record AssemblyPublicKeyDirectiveValue( + ImmutableArray Value) : AssemblyDeclarationValue; + + public sealed record AssemblyVersionDirectiveValue( + Version Value) : AssemblyDeclarationValue; + + public sealed record AssemblyLocaleDirectiveValue( + string Value) : AssemblyDeclarationValue; + + public sealed record AssemblyCustomAttributeDirectiveValue( + CustomAttributeDeclarationValue? Value, + IToken Location) : AssemblyDeclarationValue; + + public sealed record AssemblyHashAlgorithmDirectiveValue( + AssemblyHashAlgorithm Value) : AssemblyDeclarationValue; + + public sealed record AssemblySecurityDirectiveValue( + SecurityDeclarationValue? Value, + IToken Location) : AssemblyDeclarationValue; + + public sealed record AssemblyReferenceHashDirectiveValue( + ImmutableArray Value) : AssemblyDeclarationValue; + + public sealed record AssemblyReferencePublicKeyTokenDirectiveValue( + ImmutableArray Value) : AssemblyDeclarationValue; + + public sealed record FileDeclarationValue( + string Name, + bool HasMetadata, + bool IsEntryPoint, + ImmutableArray? Hash); + + public sealed class FileDeclarationBuilder + { + internal string Name { get; set; } = string.Empty; + + internal bool HasMetadata { get; set; } = true; + + internal bool IsEntryPoint { get; set; } + + internal ImmutableArray? Hash { get; set; } + } + + public abstract record ExportedTypeDeclarationValue; + + public sealed record ExportedTypeValue( + ExportedTypeHeaderValue Header, + ImmutableArray Declarations); + + public sealed record ExportedTypeHeaderValue( + bool IsValid, + TypeAttributes Attributes, + string Name, + IToken? Location) + { + public static ExportedTypeHeaderValue Error { get; } = + new(false, 0, string.Empty, null); + } + + public sealed record ExportedTypeFileDirectiveValue( + string Name, + IToken Location) : ExportedTypeDeclarationValue; + + public sealed record NestedExportedTypeDirectiveValue( + TypeName Name, + IToken Location) : ExportedTypeDeclarationValue; + + public sealed record ExportedTypeAssemblyDirectiveValue( + string Name, + IToken Location) : ExportedTypeDeclarationValue; + + public sealed record ExportedTypeMetadataTokenDirectiveValue( + int Token, + IToken Location) : ExportedTypeDeclarationValue; + + public sealed record ExportedTypeDefinitionIdDirectiveValue( + int Value) : ExportedTypeDeclarationValue; + + public sealed record ExportedTypeCustomAttributeDirectiveValue( + CustomAttributeDeclarationValue? Value, + IToken Location) : ExportedTypeDeclarationValue; + + public abstract record ManifestResourceDeclarationValue; + + public sealed record ManifestResourceValue( + ManifestResourceHeaderValue Header, + ImmutableArray Declarations); + + public sealed record ManifestResourceHeaderValue( + bool IsValid, + ManifestResourceAttributes Attributes, + string Name, + string Alias, + IToken? Location) + { + public static ManifestResourceHeaderValue Error { get; } = + new(false, 0, string.Empty, string.Empty, null); + } + + public sealed record ManifestResourceFileDirectiveValue( + string Name, + uint Offset, + IToken Location) : ManifestResourceDeclarationValue; + + public sealed record ManifestResourceAssemblyDirectiveValue( + string Name) : ManifestResourceDeclarationValue; + + public sealed record ManifestResourceCustomAttributeDirectiveValue( + CustomAttributeDeclarationValue? Value, + IToken Location) : ManifestResourceDeclarationValue; + + public sealed record RawVTableValue(ImmutableArray Value); + + public sealed record VTableFixupValue( + int SlotCount, + ushort Flags, + string DataLabel, + bool HasValidSlotCount); + + public abstract record TypedefDeclarationValue(string Alias) + { + public static TypedefDeclarationValue Error { get; } = + new ErrorTypedefDeclarationValue(); + } + + public sealed record ErrorTypedefDeclarationValue() + : TypedefDeclarationValue(string.Empty); + + public sealed record TypeSignatureTypedefDeclarationValue( + TypeValue Type, + string Alias) : TypedefDeclarationValue(Alias); + + public sealed record ClassTypedefDeclarationValue( + ClassNameValue Type, + string Alias) : TypedefDeclarationValue(Alias); + + public sealed record MemberTypedefDeclarationValue( + MemberReferenceValue Member, + string Alias) : TypedefDeclarationValue(Alias); + + public sealed record CustomAttributeTypedefDeclarationValue( + CustomAttributeDescriptorValue Attribute, + IToken Location, + string Alias) : TypedefDeclarationValue(Alias); + + public abstract class TypedefEntry + { + public sealed class Type : TypedefEntry + { + internal Type(EntityRegistry.TypeEntity entity) + { + Entity = entity; + } + + internal EntityRegistry.TypeEntity Entity { get; } + } + + public sealed class TypeBlob : TypedefEntry + { + internal TypeBlob(BlobBuilder blob) + { + Blob = blob; + } + + internal BlobBuilder Blob { get; } + } + + public sealed class Member : TypedefEntry + { + internal Member(EntityRegistry.EntityBase entity) + { + Entity = entity; + } + + internal EntityRegistry.EntityBase Entity { get; } + } + + public sealed class CustomAttribute : TypedefEntry + { + internal CustomAttribute( + EntityRegistry.EntityBase constructor, + BlobBuilder value, + EntityRegistry.EntityBase? owner) + { + Constructor = constructor; + Value = value; + Owner = owner; + } + + internal EntityRegistry.EntityBase Constructor { get; } + + internal BlobBuilder Value { get; } + + internal EntityRegistry.EntityBase? Owner { get; } + } + } +} diff --git a/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Marshalling.cs b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Marshalling.cs new file mode 100644 index 00000000000000..fa0e57c974a4e7 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Marshalling.cs @@ -0,0 +1,138 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Reflection.Metadata; +using System.Runtime.InteropServices; +using Antlr4.Runtime; + +namespace ILAssembler; + +public partial class CILParser +{ + public sealed record MarshallingDescriptorValue( + BlobBuilder? RawBytes, + NativeTypeValue? NativeType) + { + public static MarshallingDescriptorValue Empty { get; } = + new(new BlobBuilder(0), null); + } + + public sealed record NativeTypeValue( + IToken? Token, + NativeTypeElementValue? Element, + ImmutableArray ArrayPointerInfo) + { + public static NativeTypeValue Empty { get; } = new(null, null, []); + } + + public abstract record NativeTypeElementValue; + + public sealed record EmptyNativeTypeElementValue : NativeTypeElementValue + { + public static EmptyNativeTypeElementValue Instance { get; } = new(); + } + + public sealed record CustomMarshallerNativeTypeElementValue( + IToken? Token, + string? Guid, + string? NativeTypeName, + string MarshallerType, + string Cookie) : NativeTypeElementValue; + + public sealed record FixedSysStringNativeTypeElementValue( + IToken Size) : NativeTypeElementValue; + + public sealed record FixedArrayNativeTypeElementValue( + IToken Size, + NativeTypeValue Element) : NativeTypeElementValue; + + public sealed record DeprecatedNativeTypeElementValue( + IToken Token, + int TokenType) : NativeTypeElementValue; + + public sealed record SimpleNativeTypeElementValue( + int TokenType) : NativeTypeElementValue; + + public sealed record IidNativeTypeElementValue( + int TokenType, + IidParamIndexValue IidParamIndex) : NativeTypeElementValue; + + public sealed record SafeArrayNativeTypeElementValue( + VariantTypeValue VariantType, + string? UserDefinedType) : NativeTypeElementValue; + + public sealed record UnsignedNativeTypeElementValue( + int TokenType) : NativeTypeElementValue; + + public sealed record NestedStructNativeTypeElementValue( + IToken Token) : NativeTypeElementValue; + + public sealed record AnsiBstrNativeTypeElementValue : NativeTypeElementValue + { + public static AnsiBstrNativeTypeElementValue Instance { get; } = new(); + } + + public sealed record VariantBoolNativeTypeElementValue : NativeTypeElementValue + { + public static VariantBoolNativeTypeElementValue Instance { get; } = new(); + } + + public sealed record NativeTypeTypedefValue( + IToken Token, + string Alias) : NativeTypeElementValue; + + public enum NativeTypeArrayPointerInfoKind + { + Pointer, + ArrayNoSizeData, + ArraySize, + ArraySizeParamIndex, + ArrayParamIndex + } + + public sealed record NativeTypeArrayPointerInfoValue( + NativeTypeArrayPointerInfoKind Kind, + IToken? Size = null, + IToken? ParameterIndex = null); + + public sealed record IidParamIndexValue(IToken? Index) + { + public static IidParamIndexValue Empty { get; } = new((IToken?)null); + } + + public sealed record VariantTypeValue( + VariantTypeElementValue? Element, + VarEnum Modifiers) + { + public static VariantTypeValue Empty { get; } = new(null, 0); + } + + public sealed record VariantTypeElementValue(int TokenType) + { + public static VariantTypeElementValue Error { get; } = + new(TokenConstants.InvalidType); + } + + public sealed class MarshalBlobBuilder + { + internal NativeTypeValue? NativeType { get; set; } + + internal BlobBuilder? RawBytes { get; set; } + } + + public sealed class NativeTypeBuilder + { + internal NativeTypeElementValue? Element { get; set; } + + internal List? ArrayPointerInfo { get; set; } + } + + public sealed class VariantTypeBuilder + { + internal VariantTypeElementValue? Element { get; set; } + + internal VarEnum Modifiers { get; set; } + } +} diff --git a/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.MethodBodies.cs b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.MethodBodies.cs new file mode 100644 index 00000000000000..e83276c99152ba --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.MethodBodies.cs @@ -0,0 +1,217 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Reflection; +using System.Reflection.Metadata; +using System.Text; +using Antlr4.Runtime; + +namespace ILAssembler; + +public partial class CILParser +{ + public sealed class DottedNameBuilder + { + internal StringBuilder Value { get; } = new(); + + internal bool HasPart { get; set; } + } + + public sealed record SourceDirectiveValue( + bool AutoIncrement, + int StartLine, + int StartColumn, + int EndLine, + int EndColumn, + string? DocumentPath); + + public sealed record LanguageDirectiveValue( + string Language, + string? Vendor, + string? DocumentType); + + public abstract record ExceptionRangeValue + { + public static ExceptionRangeValue Invalid { get; } = + new InvalidExceptionRangeValue(); + } + + public sealed record InvalidExceptionRangeValue : ExceptionRangeValue; + + public sealed record ScopeExceptionRangeValue( + ScopeBlockContext Scope) : ExceptionRangeValue; + + public sealed record LabelExceptionRangeValue( + string Start, + IToken StartToken, + string End, + IToken EndToken) : ExceptionRangeValue; + + public sealed record OffsetExceptionRangeValue( + int Start, + int End) : ExceptionRangeValue; + + public abstract record ExceptionFilterValue + { + public static ExceptionFilterValue Invalid { get; } = + new InvalidExceptionFilterValue(); + } + + public sealed record InvalidExceptionFilterValue : ExceptionFilterValue; + + public sealed record ScopeExceptionFilterValue( + ScopeBlockContext Scope) : ExceptionFilterValue; + + public sealed record LabelExceptionFilterValue( + string Label, + IToken Token) : ExceptionFilterValue; + + public sealed record OffsetExceptionFilterValue( + int Offset) : ExceptionFilterValue; + + public sealed class CatchTypeValue + { + internal CatchTypeValue(EntityRegistry.TypeEntity? type, bool isValid) + { + Type = type; + IsValid = isValid; + } + + public static CatchTypeValue Invalid { get; } = new(null, isValid: false); + + internal EntityRegistry.TypeEntity? Type { get; } + + public bool IsValid { get; } + } + + public abstract record ExceptionClauseValue(ExceptionRangeValue Handler) + { + public static ExceptionClauseValue Invalid { get; } = + new InvalidExceptionClauseValue(ExceptionRangeValue.Invalid); + } + + public sealed record InvalidExceptionClauseValue( + ExceptionRangeValue Handler) : ExceptionClauseValue(Handler); + + public sealed record CatchExceptionClauseValue( + CatchTypeValue CatchType, + ExceptionRangeValue Handler) : ExceptionClauseValue(Handler); + + public sealed record FilterExceptionClauseValue( + ExceptionFilterValue Filter, + ExceptionRangeValue Handler) : ExceptionClauseValue(Handler); + + public sealed record FinallyExceptionClauseValue( + ExceptionRangeValue Handler) : ExceptionClauseValue(Handler); + + public sealed record FaultExceptionClauseValue( + ExceptionRangeValue Handler) : ExceptionClauseValue(Handler); + + public abstract record SecurityDeclarationValue(DeclarativeSecurityAction Action); + + public abstract record PermissionDeclarationValue( + DeclarativeSecurityAction Action, + TypeSpecificationValue PermissionType) : SecurityDeclarationValue(Action); + + public sealed record NamedPermissionDeclarationValue( + DeclarativeSecurityAction Action, + TypeSpecificationValue PermissionType, + ImmutableArray Pairs) + : PermissionDeclarationValue(Action, PermissionType); + + public sealed record StructuredPermissionDeclarationValue( + DeclarativeSecurityAction Action, + TypeSpecificationValue PermissionType, + CustomAttributeBlobValue Value) + : PermissionDeclarationValue(Action, PermissionType); + + public sealed record EmptyPermissionDeclarationValue( + DeclarativeSecurityAction Action, + TypeSpecificationValue PermissionType) + : PermissionDeclarationValue(Action, PermissionType); + + public sealed record RawPermissionSetValue( + DeclarativeSecurityAction Action, + ImmutableArray Value) : SecurityDeclarationValue(Action); + + public sealed record StringPermissionSetValue( + DeclarativeSecurityAction Action, + string Value) : SecurityDeclarationValue(Action); + + public sealed record AttributePermissionSetValue( + DeclarativeSecurityAction Action, + ImmutableArray Attributes) : SecurityDeclarationValue(Action); + + public sealed record SecurityAttributeValue( + string? Name, + TypeSpecificationValue? Type, + ImmutableArray Arguments) + { + public static SecurityAttributeValue Error { get; } = + new(null, null, []); + } + + public sealed record SecurityNameValuePairValue( + string Name, + SecurityCaValue Value) + { + public static SecurityNameValuePairValue Error { get; } = + new(string.Empty, SecurityCaValue.Error); + } + + public abstract record SecurityCaValue + { + public static SecurityCaValue Error { get; } = new ErrorSecurityCaValue(); + } + + public sealed record ErrorSecurityCaValue : SecurityCaValue; + + public sealed record SecurityBooleanValue(bool Value) : SecurityCaValue; + + public sealed record SecurityInt32Value(int Value) : SecurityCaValue; + + public sealed record SecurityStringValue(string Value) : SecurityCaValue; + + public sealed record SecurityEnumValue( + ClassNameValue Type, + byte Size, + int Value) : SecurityCaValue; + + public sealed class DataDeclarationBuilder + { + internal DataDeclarationBuilder(bool shouldCommit) + { + ShouldCommit = shouldCommit; + } + + internal bool ShouldCommit { get; private set; } + + internal void Invalidate() => ShouldCommit = false; + + internal BlobBuilder Data { get; } = new(); + + internal List? ReferenceFixups { get; set; } + + internal string? Name { get; set; } + } + + internal sealed record DataLabelReferenceValue( + string TargetLabel, + int DataOffset, + int PointerSize, + IToken Location); + + public sealed class SwitchInstructionBuilder + { + internal SwitchInstructionBuilder(IToken opcodeToken) + { + OpcodeToken = opcodeToken; + } + + internal IToken OpcodeToken { get; } + + internal List<(IToken Token, bool IsOffset)> Operands { get; } = new(); + } +} diff --git a/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Signatures.cs b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Signatures.cs new file mode 100644 index 00000000000000..d5b0b627a2fff7 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Signatures.cs @@ -0,0 +1,218 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Immutable; +using Antlr4.Runtime; + +namespace ILAssembler; + +public partial class CILParser +{ + public sealed record TypeName(TypeName? ContainingTypeName, string DottedName); + + public sealed record ArrayBoundValue(int? Lower, int? Upper); + + public abstract record ElementTypeValue + { + public static ElementTypeValue Error { get; } = new ErrorElementTypeValue(); + } + + public sealed record ErrorElementTypeValue : ElementTypeValue; + + public sealed record PrimitiveElementTypeValue(byte TypeCode) : ElementTypeValue; + + public sealed record ClassElementTypeValue(ClassNameValue ClassName, bool IsValueType) : ElementTypeValue; + + public sealed record FunctionPointerElementTypeValue( + byte CallingConvention, + TypeValue ReturnType, + ImmutableArray Arguments) : ElementTypeValue; + + public abstract record GenericParameterElementTypeValue(bool IsMethodParameter) : ElementTypeValue; + + public sealed record IndexedGenericParameterElementTypeValue(bool IsMethodParameter, int Index) + : GenericParameterElementTypeValue(IsMethodParameter); + + public sealed record NamedGenericParameterElementTypeValue( + IToken Token, + bool IsMethodParameter, + string Name) : GenericParameterElementTypeValue(IsMethodParameter); + + public sealed record TypedefElementTypeValue(IToken Token, string Alias) : ElementTypeValue; + + public sealed record SentinelElementTypeValue(TypeValue Type) : ElementTypeValue; + + public sealed record TypeValue( + ElementTypeValue ElementType, + ImmutableArray Modifiers) + { + public static TypeValue Error { get; } = new(ElementTypeValue.Error, []); + } + + public abstract record TypeModifierValue + { + public static TypeModifierValue Error { get; } = new ErrorTypeModifierValue(); + } + + public sealed record ErrorTypeModifierValue : TypeModifierValue; + + public enum SimpleTypeModifierKind + { + SzArray, + ByReference, + Pointer, + Pinned + } + + public sealed record SimpleTypeModifierValue(SimpleTypeModifierKind Kind) : TypeModifierValue; + + public sealed record ArrayTypeModifierValue(ImmutableArray Bounds) : TypeModifierValue; + + public sealed record CustomTypeModifierValue( + TypeSpecificationValue Type, + bool IsRequired) : TypeModifierValue; + + public sealed record GenericArgumentsTypeModifierValue( + ImmutableArray Arguments) : TypeModifierValue; + + public sealed record SignatureArgumentValue( + bool IsSentinel, + int Attributes, + TypeValue? Type, + MarshallingDescriptorValue? Marshalling, + string? Name) + { + public static SignatureArgumentValue Error { get; } = + new(false, 0, TypeValue.Error, null, null); + } + + public sealed record CalliSignatureValue( + byte CallingConvention, + TypeValue ReturnType, + ImmutableArray Arguments) + { + public static CalliSignatureValue Error { get; } = new(0, TypeValue.Error, []); + } + + public abstract record ClassNameValue + { + public static ClassNameValue Error { get; } = new ErrorClassNameValue(); + } + + public sealed record ErrorClassNameValue : ClassNameValue; + + public sealed record UnqualifiedClassNameValue(TypeName Name) : ClassNameValue; + + public sealed record AssemblyQualifiedClassNameValue( + string AssemblyName, + TypeName Name) : ClassNameValue; + + public sealed record ModuleQualifiedClassNameValue( + IToken Token, + string ModuleName, + TypeName Name) : ClassNameValue; + + public sealed record TokenQualifiedClassNameValue( + int Token, + TypeName Name) : ClassNameValue; + + public sealed record PointerQualifiedClassNameValue(TypeName Name) : ClassNameValue; + + public sealed record TokenClassNameValue(int Token) : ClassNameValue; + + public enum SpecialClassNameKind + { + This, + Base, + Nester + } + + public sealed record SpecialClassNameValue( + IToken Token, + SpecialClassNameKind Kind) : ClassNameValue; + + public abstract record TypeSpecificationValue + { + public static TypeSpecificationValue Error { get; } = + new ErrorTypeSpecificationValue(); + } + + public sealed record ErrorTypeSpecificationValue : TypeSpecificationValue; + + public sealed record ClassTypeSpecificationValue( + ClassNameValue ClassName) : TypeSpecificationValue; + + public sealed record AssemblyTypeSpecificationValue( + string AssemblyName) : TypeSpecificationValue; + + public sealed record ModuleTypeSpecificationValue( + string ModuleName) : TypeSpecificationValue; + + public sealed record SignatureTypeSpecificationValue( + TypeValue Type) : TypeSpecificationValue; + + public abstract record MethodReferenceValue + { + public static MethodReferenceValue Error { get; } = new ErrorMethodReferenceValue(); + } + + public sealed record ErrorMethodReferenceValue : MethodReferenceValue; + + public sealed record TokenMethodReferenceValue(int Token) : MethodReferenceValue; + + public sealed record TypedefMethodReferenceValue( + IToken Token, + string Alias) : MethodReferenceValue; + + public sealed record ParsedMethodReferenceValue( + IToken Token, + byte CallingConvention, + TypeValue ReturnType, + TypeSpecificationValue? Owner, + string Name, + ImmutableArray? GenericArguments, + int GenericArity, + ImmutableArray Arguments) : MethodReferenceValue; + + public abstract record FieldReferenceValue + { + public static FieldReferenceValue Error { get; } = new ErrorFieldReferenceValue(); + } + + public sealed record ErrorFieldReferenceValue : FieldReferenceValue; + + public sealed record TypedefFieldReferenceValue( + IToken Token, + string Alias) : FieldReferenceValue; + + public sealed record ParsedFieldReferenceValue( + TypeValue FieldType, + TypeSpecificationValue? Owner, + string Name) : FieldReferenceValue; + + public abstract record MemberReferenceValue + { + public static MemberReferenceValue Error { get; } = new ErrorMemberReferenceValue(); + } + + public sealed record ErrorMemberReferenceValue : MemberReferenceValue; + + public sealed record MethodMemberReferenceValue( + MethodReferenceValue Method) : MemberReferenceValue; + + public sealed record FieldMemberReferenceValue( + FieldReferenceValue Field) : MemberReferenceValue; + + public sealed record TokenMemberReferenceValue(int Token) : MemberReferenceValue; + + public abstract record OwnerTypeValue + { + public static OwnerTypeValue Error { get; } = new ErrorOwnerTypeValue(); + } + + public sealed record ErrorOwnerTypeValue : OwnerTypeValue; + + public sealed record TypeOwnerValue(TypeSpecificationValue Type) : OwnerTypeValue; + + public sealed record MemberOwnerValue(MemberReferenceValue Member) : OwnerTypeValue; +} diff --git a/src/tools/ilasm/src/ILAssembler/Diagnostic.cs b/src/tools/ilasm/src/ILAssembler/Diagnostic.cs index a00d7860f6bd43..e33466df2a5c45 100644 --- a/src/tools/ilasm/src/ILAssembler/Diagnostic.cs +++ b/src/tools/ilasm/src/ILAssembler/Diagnostic.cs @@ -62,6 +62,8 @@ public static class DiagnosticIds public const string InvalidVTableWidth = "ILA0042"; public const string InvalidVTableEntry = "ILA0043"; public const string DuplicateExportOrdinal = "ILA0044"; + public const string UnsupportedVTableDeclaration = "ILA0045"; + public const string InvalidOctalLiteral = "ILA0046"; } internal static class DiagnosticMessageTemplates @@ -110,4 +112,6 @@ internal static class DiagnosticMessageTemplates public const string InvalidVTableEntry = "Method '{0}' references invalid VTable entry {1}"; public const string InvalidVTableSlot = "Method '{0}' references invalid VTable slot {1}; VTable entry {2} contains {3} slots"; public const string DuplicateExportOrdinal = "Export '{0}' uses ordinal {1}, which is already assigned to a different VTable target"; + public const string UnsupportedVTableDeclaration = "Raw .vtable declarations are not supported; use .vtfixup instead"; + public const string InvalidOctalLiteral = "The value '{0}' is not a valid octal literal"; } diff --git a/src/tools/ilasm/src/ILAssembler/DocumentCompiler.cs b/src/tools/ilasm/src/ILAssembler/DocumentCompiler.cs index c35dde3c0dc697..0daf994b2c1d4f 100644 --- a/src/tools/ilasm/src/ILAssembler/DocumentCompiler.cs +++ b/src/tools/ilasm/src/ILAssembler/DocumentCompiler.cs @@ -6,43 +6,36 @@ using System.IO; using System.Linq; using Antlr4.Runtime; -using Antlr4.Runtime.Tree; namespace ILAssembler; public sealed class DocumentCompiler { - public (ImmutableArray, CompilationResult?) Compile(SourceText document, Func includedDocumentLoader, Func resourceLocator, Options options) + public (ImmutableArray, CompilationResult?) Compile(SourceText document, Func includedDocumentLoader, Func resourceLocator, Options options) { return Compile([document], includedDocumentLoader, resourceLocator, options); } - public (ImmutableArray, CompilationResult?) Compile(ImmutableArray documents, Func includedDocumentLoader, Func resourceLocator, Options options) + public (ImmutableArray, CompilationResult?) Compile(ImmutableArray documents, Func includedDocumentLoader, Func resourceLocator, Options options) { Dictionary loadedDocuments = new(); ImmutableArray.Builder diagnostics = ImmutableArray.CreateBuilder(); - GrammarVisitor? visitor = null; + GrammarActions? actions = null; IReadOnlyDictionary? definedVariables = null; foreach (var document in documents) { - loadedDocuments[document.Path!] = document; + loadedDocuments[document.Path] = document; - var inputSource = new AntlrInputStream(document.Text) - { - name = document.Path - }; + StringCharStream inputSource = new(document.Text, document.Path); CILLexer lexer = new(inputSource); PreprocessedTokenSource preprocessor = new(lexer, path => { - var includedDocument = includedDocumentLoader(path); - var includedSource = new AntlrInputStream(includedDocument.Text) - { - name = includedDocument.Path - }; - loadedDocuments[includedDocument.Path!] = includedDocument; + SourceText includedDocument = includedDocumentLoader(path); + StringCharStream includedSource = new(includedDocument.Text, includedDocument.Path); + loadedDocuments[includedDocument.Path] = includedDocument; return new CILLexer(includedSource); - }, text => new CILLexer(new AntlrInputStream(text)), definedVariables); + }, text => new CILLexer(new StringCharStream(text)), definedVariables); preprocessor.OnPreprocessorSyntaxError += (source, start, length, msg) => { @@ -56,32 +49,32 @@ public sealed class DocumentCompiler } }; - CILParser parser = new(new CommonTokenStream(preprocessor)); + actions ??= new GrammarActions(loadedDocuments, options, resourceLocator); + actions.BeginDocument(); + + CILParser parser = new(new UnbufferedTokenStream(preprocessor)) + { + Actions = actions, + BuildParseTree = false + }; parser.RemoveErrorListeners(); - var parserDiagnostics = ImmutableArray.CreateBuilder(); - ParserErrorListener parserErrorListener = new(parserDiagnostics, loadedDocuments); - parser.AddErrorListener(parserErrorListener); - var result = parser.decls(); - parserErrorListener.AddErrorNodeContexts(result); + ImmutableArray.Builder parserDiagnostics = ImmutableArray.CreateBuilder(); + parser.AddErrorListener(new ParserErrorListener(parserDiagnostics, loadedDocuments, actions.RecordSyntaxError)); + _ = parser.decls(); // Add parser diagnostics to the main list diagnostics.AddRange(parserDiagnostics); - visitor ??= new GrammarVisitor(loadedDocuments, options, resourceLocator); - visitor.BeginDocument(parserErrorListener.ErrorContexts); - - _ = result.Accept(visitor); - // Transfer defined constants to the next document definedVariables = preprocessor.DefinedVariables; } - if (visitor is null) + if (actions is null) { return (diagnostics.ToImmutable(), null); } - var image = visitor.BuildImage(); + var image = actions.BuildImage(); bool anyErrors = diagnostics.Any(diagnostic => diagnostic.Severity == DiagnosticSeverity.Error); anyErrors |= image.Diagnostics.Any(diagnostic => diagnostic.Severity == DiagnosticSeverity.Error); @@ -98,23 +91,26 @@ internal sealed class ParserErrorListener : Antlr4.Runtime.IAntlrErrorListener.Builder _diagnostics; private readonly Dictionary _loadedDocuments; - public HashSet ErrorContexts { get; } = []; + private readonly Action _recordSyntaxError; - public ParserErrorListener(ImmutableArray.Builder diagnostics, Dictionary loadedDocuments) + public ParserErrorListener( + ImmutableArray.Builder diagnostics, + Dictionary loadedDocuments, + Action recordSyntaxError) { _diagnostics = diagnostics; _loadedDocuments = loadedDocuments; + _recordSyntaxError = recordSyntaxError; } public void SyntaxError(TextWriter output, IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e) { - if (recognizer is Parser { Context: { } context }) - { - AddContextAndAncestors(context); - } - - var sourceName = offendingSymbol?.TokenSource?.SourceName ?? ""; - var span = new SourceSpan(offendingSymbol?.StartIndex ?? 0, offendingSymbol is null ? 0 : offendingSymbol.StopIndex - offendingSymbol.StartIndex + 1); + _recordSyntaxError(); + string sourceName = + offendingSymbol?.TokenSource?.InputStream?.SourceName ?? + offendingSymbol?.TokenSource?.SourceName ?? + string.Empty; + SourceSpan span = Location.GetSourceSpan(offendingSymbol); if (_loadedDocuments.TryGetValue(sourceName, out var sourceText)) { _diagnostics.Add(new Diagnostic("Parser", DiagnosticSeverity.Error, $"line {line}:{charPositionInLine} {msg}", new Location(span, sourceText))); @@ -124,27 +120,4 @@ public void SyntaxError(TextWriter output, IRecognizer recognizer, IToken offend _diagnostics.Add(new Diagnostic("Parser", DiagnosticSeverity.Error, $"line {line}:{charPositionInLine} {msg}", new Location(span, new SourceText("", sourceName)))); } } - - public void AddErrorNodeContexts(IParseTree tree) - { - if (tree is IErrorNode) - { - AddContextAndAncestors(tree.Parent as ParserRuleContext); - return; - } - - for (int i = 0; i < tree.ChildCount; i++) - { - AddErrorNodeContexts(tree.GetChild(i)); - } - } - - private void AddContextAndAncestors(ParserRuleContext? context) - { - while (context is not null) - { - ErrorContexts.Add(context); - context = context.Parent as ParserRuleContext; - } - } } diff --git a/src/tools/ilasm/src/ILAssembler/EntityRegistry.cs b/src/tools/ilasm/src/ILAssembler/EntityRegistry.cs index fa87d9c393e6dd..24e392a9576009 100644 --- a/src/tools/ilasm/src/ILAssembler/EntityRegistry.cs +++ b/src/tools/ilasm/src/ILAssembler/EntityRegistry.cs @@ -569,7 +569,7 @@ public Blob WriteContentTo(MetadataBuilder builder, BlobBuilder ilStream, IReadO builder.AddEvent( evt.Attributes, builder.GetOrAddString(evt.Name), - evt.Type?.Handle ?? (EntityHandle)default(TypeDefinitionHandle)); + evt.Type?.Handle ?? default(TypeDefinitionHandle)); foreach (var accessor in evt.Accessors) { @@ -2232,6 +2232,7 @@ public SequencePoint(int ilOffset, int startLine, int startColumn, int endLine, public sealed class MethodDebugInfo { public string? DocumentPath { get; set; } + public Guid LanguageGuid { get; set; } public List SequencePoints { get; } = new(); } diff --git a/src/tools/ilasm/src/ILAssembler/GrammarVisitor.cs b/src/tools/ilasm/src/ILAssembler/GrammarVisitor.cs deleted file mode 100644 index 336f1176e19cdd..00000000000000 --- a/src/tools/ilasm/src/ILAssembler/GrammarVisitor.cs +++ /dev/null @@ -1,7056 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Buffers.Binary; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Diagnostics; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Reflection.Metadata; -using System.Reflection.Metadata.Ecma335; -using System.Reflection.PortableExecutable; -using System.Runtime.InteropServices; -using System.Security.Cryptography; -using System.Text; -using Antlr4.Runtime; -using Antlr4.Runtime.Tree; - -namespace ILAssembler -{ - internal abstract record GrammarResult - { - protected GrammarResult() { } - - public sealed record String(string Value) : GrammarResult; - - public sealed record Literal(T Value) : GrammarResult; - - public sealed record Sequence(ImmutableArray Value) : GrammarResult; - - /// - /// A formatted blob of bytes. - /// - /// The bytes of the blob. - public sealed record FormattedBlob(BlobBuilder Value) : GrammarResult; - - public sealed record SentinelValue - { - public static SentinelValue Instance { get; } = new(); - - public static Literal Result { get; } = new(Instance); - } - - public sealed record Flag(T Value, bool ShouldAppend = true) : GrammarResult - where T : struct, Enum - { - private readonly T _groupMask; - public Flag(T value, bool shouldAppend, T groupMask) - : this(value, shouldAppend) - { - _groupMask = groupMask; - } - public Flag(T value, T groupMask) - : this(value) - { - _groupMask = groupMask; - } - - public static T operator |(T lhs, Flag rhs) - { - if (!rhs.ShouldAppend) - { - return rhs.Value; - } - int lhsInt = Convert.ToInt32(lhs); - int maskInt = Convert.ToInt32(rhs._groupMask); - int valueInt = Convert.ToInt32(rhs.Value); - return (T)Enum.ToObject(typeof(T), (lhsInt & ~maskInt) | valueInt); - } - } - } - -#pragma warning disable CA1822 // Mark members as static - internal sealed class GrammarVisitor : ICILVisitor - { - private const int MaximumGenericParameterCount = ushort.MaxValue + 1; - private const string NodeShouldNeverBeDirectlyVisited = "This node should never be directly visited. It should be directly processed by its parent node."; - private readonly ImmutableArray.Builder _diagnostics = ImmutableArray.CreateBuilder(); - private readonly EntityRegistry _entityRegistry = new(); - private readonly IReadOnlyDictionary _documents; - private readonly Options _options; - private readonly MetadataBuilder _metadataBuilder = new(); - private readonly Func _resourceLocator; - private IReadOnlySet _parserErrorContexts = new HashSet(); - - // Record the mapped field data directly into the blob to ensure we preserve ordering - private readonly BlobBuilder _mappedFieldData = new(); - private readonly Dictionary _mappedFieldDataNames = new(); - private readonly List _mappedFieldDataReferenceFixups = new(); - private readonly BlobBuilder _manifestResources = new(); - - // Typedef aliases - maps alias name to the resolved entity - private readonly Dictionary _typedefs = new(); - - // Debug info tracking - private Guid _currentLanguageGuid = Guid.Empty; - private Guid _currentLanguageVendorGuid = Guid.Empty; - private Guid _currentDocumentTypeGuid = Guid.Empty; - private string? _currentDocumentPath; - private readonly Dictionary _documentHandles = new(); - private readonly MetadataBuilder _pdbBuilder = new(); - - private readonly List _vtableFixups = new(); - private readonly Dictionary _exportDirectiveContexts = new(); - private readonly Dictionary _vtableEntryDirectiveContexts = new(); - - public GrammarVisitor(IReadOnlyDictionary documents, Options options, Func resourceLocator) - { - _documents = documents; - _options = options; - _resourceLocator = resourceLocator; - } - - internal void BeginDocument(IReadOnlySet parserErrorContexts) - { - _currentDocumentPath = null; - _parserErrorContexts = parserErrorContexts; - } - - /// - /// Represents a typedef alias entry. - /// - private abstract record TypedefEntry - { - public sealed record Type(EntityRegistry.TypeEntity Entity) : TypedefEntry; - public sealed record TypeBlob(BlobBuilder Blob) : TypedefEntry; - public sealed record Member(EntityRegistry.EntityBase Entity) : TypedefEntry; - public sealed record CustomAttribute( - EntityRegistry.EntityBase Constructor, - BlobBuilder Value, - EntityRegistry.EntityBase? Owner) : TypedefEntry; - } - - private sealed record VTableFixupDeclaration( - VTableFixupSupport.VTableFixupEntry Entry, - CILParser.VtfixupDeclContext Context, - bool HasValidSlotCount); - - private sealed record DataLabelReference( - string TargetLabel, - int DataOffset, - int PointerSize, - CILParser.DdItemContext Context); - - private readonly record struct ValidatedVTableFixup( - int OriginalIndex, - VTableFixupSupport.VTableFixupEntry Entry, - int DataOffset); - - private readonly record struct ValidatedVTableAssociation( - EntityRegistry.MethodDefinitionEntity Method, - int VTableEntryIndex); - - private readonly record struct ValidatedExport( - EntityRegistry.MethodDefinitionEntity Method, - int VTableEntryIndex); - - private void ReportDiagnostic(DiagnosticSeverity severity, string id, string message, Antlr4.Runtime.ParserRuleContext context) - { - var location = Location.From(context.Start, _documents); - _diagnostics.Add(new Diagnostic(id, severity, message, location)); - } - - private void ReportError(string id, string message, Antlr4.Runtime.ParserRuleContext context) - => ReportDiagnostic(DiagnosticSeverity.Error, id, message, context); - - private void ReportGenericParameterEncodingErrors(CILParser.TyparContext[] genericParameters) - { - if (genericParameters.Length <= MaximumGenericParameterCount) - { - return; - } - - ReportError( - DiagnosticIds.TooManyGenericParameters, - string.Format( - DiagnosticMessageTemplates.TooManyGenericParameters, - genericParameters.Length, - MaximumGenericParameterCount), - genericParameters[MaximumGenericParameterCount]); - - for (int i = MaximumGenericParameterCount; i < genericParameters.Length; i++) - { - if (genericParameters[i].tyBound() is not CILParser.TyBoundContext constraint) - { - continue; - } - - ReportError( - DiagnosticIds.GenericParameterConstraintOwnerOutOfRange, - string.Format( - DiagnosticMessageTemplates.GenericParameterConstraintOwnerOutOfRange, - i, - ushort.MaxValue), - constraint); - } - } - - private void ReportWarning(string id, string message, Antlr4.Runtime.ParserRuleContext context) - => ReportDiagnostic(DiagnosticSeverity.Warning, id, message, context); - - public (ImmutableArray Diagnostics, CompilationResult? Image) BuildImage() - { - // Default module name to output filename if no .module directive was provided - if (_entityRegistry.Module.Name is null && _options.OutputFileName is not null) - { - _entityRegistry.Module.Name = _options.OutputFileName; - } - - // Apply DebuggableAttribute AFTER all source declarations have been processed, - // so that GetCoreLibAssemblyReference() can find the correct corelib assembly ref - // declared in the source (e.g., System.Runtime) instead of creating a fallback mscorlib. - if (_entityRegistry.Assembly is not null && (_options.Debug || _options.DebugMode is not null)) - { - ApplyDebuggableAttribute(); - } - - Machine requestedMachine = _options.Machine ?? Machine.I386; - Machine machine = requestedMachine == Machine.Unknown ? Machine.I386 : requestedMachine; - if (!(machine is Machine.I386 or Machine.Amd64 or Machine.Arm64)) - { - throw new NotSupportedException($"Target machine '{machine}' is not supported."); - } - - ImmutableArray validatedVTableFixups = - ValidateVTableFixups(machine); - ImmutableArray validatedVTableAssociations = - ValidateVTableAssociations(validatedVTableFixups); - ImmutableArray validatedDataLabelFixups = - ValidateDataLabelFixups(); - ImmutableArray validatedExports = - ValidateExports(validatedVTableAssociations, machine); - - // Return early if there are structural errors that prevent building valid metadata. - // However, allow errors in method bodies (ILA0016-0019) to pass through so we can - // emit the assembly with the errors reported. - // In error-tolerant mode, continue despite errors. - var structuralErrors = _diagnostics.Where(d => d.Severity == DiagnosticSeverity.Error && !IsRecoverableError(d.Id)); - if (structuralErrors.Any() && !_options.ErrorTolerant) - { - return (_diagnostics.ToImmutable(), null); - } - - BlobBuilder ilStream = new(); - Blob mvidFixup = _entityRegistry.WriteContentTo(_metadataBuilder, ilStream, _mappedFieldDataNames, _options.Deterministic); - // MetadataRootBuilder only supports module-wide validation suppression, which is - // required because wrapped GenericParam numbers intentionally violate table ordering. - bool suppressMetadataValidation = - _options.ErrorTolerant && - _diagnostics.Any(diagnostic => diagnostic.Id == DiagnosticIds.TooManyGenericParameters); - MetadataRootBuilder rootBuilder = new( - _metadataBuilder, - _options.MetadataVersion, - suppressValidation: suppressMetadataValidation); - - // Apply command-line overrides - Subsystem subsystem = _options.Subsystem ?? _subsystem; - int fileAlignment = _options.FileAlignment ?? _alignment; - long imageBase = _options.ImageBase ?? _imageBase; - ushort majorSubsystemVersion = _options.SubsystemVersion?.Major ?? 4; - ushort minorSubsystemVersion = _options.SubsystemVersion?.Minor ?? 0; - - // Build DllCharacteristics from options - DllCharacteristics dllCharacteristics = DllCharacteristics.DynamicBase | DllCharacteristics.NxCompatible | DllCharacteristics.NoSeh | DllCharacteristics.TerminalServerAware; - if (_options.AppContainer) - { - dllCharacteristics |= DllCharacteristics.AppContainer; - } - if (_options.HighEntropyVA) - { - dllCharacteristics |= DllCharacteristics.HighEntropyVirtualAddressSpace; - } - if (_options.StripReloc) - { - dllCharacteristics &= ~DllCharacteristics.DynamicBase; - } - - Characteristics imageCharacteristics = Characteristics.ExecutableImage; - if (_options.Dll) - { - imageCharacteristics |= Characteristics.Dll; - } - if (machine == Machine.I386) - { - imageCharacteristics |= Characteristics.Bit32Machine; - } - else if (machine is Machine.Amd64 or Machine.Arm64) - { - imageCharacteristics |= Characteristics.LargeAddressAware; - } - - // Compute stack reserve: command-line option overrides directive, which overrides default - ulong sizeOfStackReserve = (ulong)(_options.StackReserve ?? (_stackReserve != 0 ? _stackReserve : 0x00100000)); - - PEHeaderBuilder header = new( - machine: machine, - fileAlignment: fileAlignment, - imageBase: (ulong)imageBase, - subsystem: subsystem, - majorSubsystemVersion: majorSubsystemVersion, - minorSubsystemVersion: minorSubsystemVersion, - dllCharacteristics: dllCharacteristics, - imageCharacteristics: imageCharacteristics, - sizeOfStackReserve: sizeOfStackReserve); - - MethodDefinitionHandle entryPoint = default; - if (_entityRegistry.EntryPoint is not null) - { - entryPoint = (MethodDefinitionHandle)_entityRegistry.EntryPoint.Handle; - } - - // Build debug directory if we have any debug info - DebugDirectoryBuilder? debugDirectoryBuilder = BuildDebugDirectory(entryPoint, out _); - - Func, BlobContentId>? deterministicIdProvider = _options.Deterministic - ? GetDeterministicContentId - : null; - - // Use custom PE builder if we have vtable fixups, exports, or data label reference fixups - if (validatedVTableFixups.Length > 0 || - validatedExports.Length > 0 || - validatedDataLabelFixups.Length > 0) - { - ImmutableArray vtableFixupInfos = - BuildVTableFixupInfos( - validatedVTableFixups, - validatedVTableAssociations); - ImmutableArray exports = - BuildExportInfos(validatedExports); - - // Apply CorFlags from options or directive - CorFlags corFlags = _options.CorFlags ?? _corflags; - if (_options.Prefer32Bit) - { - corFlags |= CorFlags.Prefers32Bit; - } - - VTableExportPEBuilder peBuilder = new( - header, - rootBuilder, - ilStream, - _mappedFieldData, - _manifestResources, - debugDirectoryBuilder: debugDirectoryBuilder, - entryPoint: entryPoint, - flags: corFlags, - deterministicIdProvider: deterministicIdProvider, - vtableFixups: vtableFixupInfos, - exports: exports, - dataLabelFixups: validatedDataLabelFixups); - - return (_diagnostics.ToImmutable(), new CompilationResult(peBuilder, mvidFixup)); - } - - // Apply CorFlags from options or directive - CorFlags standardCorFlags = _options.CorFlags ?? _corflags; - if (_options.Prefer32Bit) - { - standardCorFlags |= CorFlags.Prefers32Bit; - } - - ManagedPEBuilder standardBuilder = new( - header, - rootBuilder, - ilStream, - _mappedFieldData, - _manifestResources, - flags: standardCorFlags, - entryPoint: entryPoint, - debugDirectoryBuilder: debugDirectoryBuilder, - deterministicIdProvider: deterministicIdProvider); - - return (_diagnostics.ToImmutable(), new CompilationResult(standardBuilder, mvidFixup)); - } - - private static BlobContentId GetDeterministicContentId(IEnumerable content) - { - using IncrementalHash hash = IncrementalHash.CreateHash(HashAlgorithmName.SHA256); - foreach (Blob blob in content) - { - hash.AppendData(blob.GetBytes()); - } - - return BlobContentId.FromHash(hash.GetHashAndReset()); - } - - private ImmutableArray ValidateVTableFixups(Machine machine) - { - if (_vtableFixups.Count == 0) - { - return ImmutableArray.Empty; - } - - var builder = ImmutableArray.CreateBuilder(_vtableFixups.Count); - - for (int i = 0; i < _vtableFixups.Count; i++) - { - VTableFixupDeclaration declaration = _vtableFixups[i]; - if (!declaration.HasValidSlotCount) - { - continue; - } - - VTableFixupSupport.VTableFixupEntry entry = declaration.Entry; - const ushort WidthMask = - VTableFixupSupport.COR_VTABLE_32BIT | - VTableFixupSupport.COR_VTABLE_64BIT; - ushort width = (ushort)(entry.Flags & WidthMask); - ushort expectedWidth = VTableFixupSupport.GetPointerSize(machine) == sizeof(long) - ? VTableFixupSupport.COR_VTABLE_64BIT - : VTableFixupSupport.COR_VTABLE_32BIT; - if (width != expectedWidth) - { - ReportError( - DiagnosticIds.InvalidVTableWidth, - string.Format( - DiagnosticMessageTemplates.InvalidVTableWidth, - width, - machine, - expectedWidth == VTableFixupSupport.COR_VTABLE_64BIT - ? "int64" - : "int32"), - declaration.Context); - continue; - } - - if (!_mappedFieldDataNames.TryGetValue(entry.DataLabel, out int dataOffset)) - { - ReportError( - DiagnosticIds.LabelNotFound, - string.Format(DiagnosticMessageTemplates.LabelNotFound, entry.DataLabel), - declaration.Context.id()); - continue; - } - - int availableBytes = GetAvailableMappedFieldDataBytes(dataOffset); - int requiredBytes = checked( - entry.SlotCount * VTableFixupSupport.GetSlotSize(entry.Flags)); - if (requiredBytes > availableBytes) - { - ReportError( - DiagnosticIds.InsufficientVTableData, - string.Format( - DiagnosticMessageTemplates.InsufficientVTableData, - entry.DataLabel, - availableBytes, - requiredBytes), - declaration.Context.id()); - continue; - } - - builder.Add(new ValidatedVTableFixup(i + 1, entry, dataOffset)); - } - - return builder.ToImmutable(); - } - - private int GetAvailableMappedFieldDataBytes(int dataOffset) - { - int endOffset = _mappedFieldData.Count; - foreach (int otherOffset in _mappedFieldDataNames.Values) - { - if (otherOffset > dataOffset && otherOffset < endOffset) - { - endOffset = otherOffset; - } - } - - return endOffset - dataOffset; - } - - private ImmutableArray ValidateDataLabelFixups() - { - var builder = - ImmutableArray.CreateBuilder( - _mappedFieldDataReferenceFixups.Count); - - foreach (DataLabelReference reference in _mappedFieldDataReferenceFixups) - { - if (!_mappedFieldDataNames.TryGetValue(reference.TargetLabel, out int targetOffset)) - { - ReportError( - DiagnosticIds.LabelNotFound, - string.Format( - DiagnosticMessageTemplates.LabelNotFound, - reference.TargetLabel), - reference.Context); - continue; - } - - builder.Add(new VTableExportPEBuilder.DataLabelFixup( - reference.DataOffset, - targetOffset, - reference.PointerSize)); - } - - return builder.ToImmutable(); - } - - private ImmutableArray ValidateVTableAssociations( - ImmutableArray validatedVTableFixups) - { - var fixupsByOriginalIndex = new Dictionary( - validatedVTableFixups.Length); - for (int i = 0; i < validatedVTableFixups.Length; i++) - { - fixupsByOriginalIndex.Add( - validatedVTableFixups[i].OriginalIndex, - (i + 1, validatedVTableFixups[i])); - } - - var builder = ImmutableArray.CreateBuilder(); - foreach (EntityRegistry.MethodDefinitionEntity method in GetParsedMethods()) - { - if (!_vtableEntryDirectiveContexts.TryGetValue(method, out ParserRuleContext? context)) - { - continue; - } - - if (!fixupsByOriginalIndex.TryGetValue( - method.VTableEntry, - out (int SerializedIndex, ValidatedVTableFixup Fixup) fixup)) - { - ReportError( - DiagnosticIds.InvalidVTableEntry, - string.Format( - DiagnosticMessageTemplates.InvalidVTableEntry, - method.Name, - method.VTableEntry), - context); - continue; - } - - if (method.VTableSlot <= 0 || method.VTableSlot > fixup.Fixup.Entry.SlotCount) - { - ReportError( - DiagnosticIds.InvalidVTableEntry, - string.Format( - DiagnosticMessageTemplates.InvalidVTableSlot, - method.Name, - method.VTableSlot, - method.VTableEntry, - fixup.Fixup.Entry.SlotCount), - context); - continue; - } - - builder.Add(new ValidatedVTableAssociation(method, fixup.SerializedIndex)); - } - - return builder.ToImmutable(); - } - - private ImmutableArray ValidateExports( - ImmutableArray validatedVTableAssociations, - Machine machine) - { - if (_vtableFixups.Count == 0) - { - return ImmutableArray.Empty; - } - - var associationsByMethod = - new Dictionary( - validatedVTableAssociations.Length); - foreach (ValidatedVTableAssociation association in validatedVTableAssociations) - { - associationsByMethod.Add(association.Method, association); - } - - var candidates = ImmutableArray.CreateBuilder(); - foreach (EntityRegistry.MethodDefinitionEntity method in GetParsedMethods()) - { - if (method.ExportOrdinal < 0) - { - continue; - } - - ParserRuleContext context = _exportDirectiveContexts[method]; - string exportName = method.ExportAlias ?? method.Name; - if (!VTableExportPEBuilder.IsExportMachineSupported(machine)) - { - ReportError( - DiagnosticIds.UnsupportedNativeExportMachine, - string.Format( - DiagnosticMessageTemplates.UnsupportedNativeExportMachine, - machine), - context); - continue; - } - - if (!associationsByMethod.TryGetValue( - method, - out ValidatedVTableAssociation association)) - { - if (!_vtableEntryDirectiveContexts.ContainsKey(method)) - { - ReportError( - DiagnosticIds.InvalidVTableExport, - string.Format( - DiagnosticMessageTemplates.InvalidVTableExport, - exportName), - context); - } - - continue; - } - - candidates.Add(new ValidatedExport(method, association.VTableEntryIndex)); - } - - if (candidates.Count == 0) - { - return ImmutableArray.Empty; - } - - var exportsByOrdinal = new Dictionary(); - var nonConflictingExports = ImmutableArray.CreateBuilder(candidates.Count); - foreach (ValidatedExport export in candidates) - { - if (exportsByOrdinal.TryGetValue( - export.Method.ExportOrdinal, - out ValidatedExport existingExport) && - (existingExport.VTableEntryIndex != export.VTableEntryIndex || - existingExport.Method.VTableSlot != export.Method.VTableSlot)) - { - ReportError( - DiagnosticIds.DuplicateExportOrdinal, - string.Format( - DiagnosticMessageTemplates.DuplicateExportOrdinal, - export.Method.ExportAlias ?? export.Method.Name, - export.Method.ExportOrdinal), - _exportDirectiveContexts[export.Method]); - continue; - } - - exportsByOrdinal.TryAdd(export.Method.ExportOrdinal, export); - nonConflictingExports.Add(export); - } - - int baseOrdinal = nonConflictingExports.Min(export => export.Method.ExportOrdinal); - var validatedExports = - ImmutableArray.CreateBuilder(nonConflictingExports.Count); - foreach (ValidatedExport export in nonConflictingExports) - { - long ordinalIndex = (long)export.Method.ExportOrdinal - baseOrdinal; - if (ordinalIndex > ushort.MaxValue) - { - ReportError( - DiagnosticIds.ExportOrdinalRangeTooLarge, - string.Format( - DiagnosticMessageTemplates.ExportOrdinalRangeTooLarge, - export.Method.ExportOrdinal, - baseOrdinal, - ushort.MaxValue), - _exportDirectiveContexts[export.Method]); - continue; - } - - validatedExports.Add(export); - } - - return validatedExports.ToImmutable(); - } - - private ImmutableArray BuildVTableFixupInfos( - ImmutableArray validatedVTableFixups, - ImmutableArray validatedVTableAssociations) - { - var builder = - ImmutableArray.CreateBuilder( - validatedVTableFixups.Length); - - for (int i = 0; i < validatedVTableFixups.Length; i++) - { - ValidatedVTableFixup fixup = validatedVTableFixups[i]; - var methodTokens = ImmutableArray.CreateBuilder(fixup.Entry.SlotCount); - methodTokens.Count = fixup.Entry.SlotCount; - - foreach (ValidatedVTableAssociation association in validatedVTableAssociations) - { - if (association.VTableEntryIndex == i + 1) - { - methodTokens[association.Method.VTableSlot - 1] = - MetadataTokens.GetToken(association.Method.Handle); - } - } - - builder.Add(new VTableExportPEBuilder.VTableFixupInfo( - fixup.DataOffset, - fixup.Entry.SlotCount, - fixup.Entry.Flags, - methodTokens.MoveToImmutable())); - } - - return builder.MoveToImmutable(); - } - - private static ImmutableArray BuildExportInfos( - ImmutableArray validatedExports) - { - var builder = - ImmutableArray.CreateBuilder( - validatedExports.Length); - - foreach (ValidatedExport export in validatedExports) - { - builder.Add(new VTableExportPEBuilder.ExportInfo( - export.Method.ExportOrdinal, - export.Method.ExportAlias ?? export.Method.Name, - export.VTableEntryIndex, - export.Method.VTableSlot)); - } - - return builder.MoveToImmutable(); - } - - private IEnumerable GetParsedMethods() - { - foreach (EntityRegistry.TypeDefinitionEntity type in _entityRegistry.GetSeenEntities(TableIndex.TypeDef)) - { - foreach (EntityRegistry.MethodDefinitionEntity method in type.Methods) - { - yield return method; - } - } - } - - private DebugDirectoryBuilder? BuildDebugDirectory(MethodDefinitionHandle entryPoint, out int debugDataSize) - { - debugDataSize = 0; - - // Check if we have any methods with debug info - bool hasDebugInfo = false; - foreach (var entity in _entityRegistry.GetSeenEntities(TableIndex.MethodDef)) - { - if (entity is EntityRegistry.MethodDefinitionEntity method && - method.DebugInfo.SequencePoints.Count > 0) - { - hasDebugInfo = true; - break; - } - } - - // Generate PDB if we have debug info OR if --debug/--pdb options are set - bool generatePdb = hasDebugInfo || _options.Debug || _options.Pdb; - if (!generatePdb) - { - return null; - } - - // Build PDB metadata - BuildPdbMetadata(); - - // Get row counts from main metadata for the portable PDB - var typeSystemRowCounts = _metadataBuilder.GetRowCounts(); - - Func, BlobContentId> pdbIdProvider = _options.Deterministic - ? GetDeterministicContentId - : _ => new BlobContentId(Guid.NewGuid(), 0x04030201); - - // Create the portable PDB - var pdbBuilder = new PortablePdbBuilder( - _pdbBuilder, - typeSystemRowCounts, - entryPoint, - idProvider: pdbIdProvider); - - var pdbBlob = new BlobBuilder(); - var pdbContentId = pdbBuilder.Serialize(pdbBlob); - - // Create debug directory with embedded PDB - var debugDirectoryBuilder = new DebugDirectoryBuilder(); - debugDirectoryBuilder.AddCodeViewEntry( - $"assembly.pdb", - pdbContentId, - pdbBuilder.FormatVersion); - debugDirectoryBuilder.AddEmbeddedPortablePdbEntry(pdbBlob, pdbBuilder.FormatVersion); - - // Calculate debug data size: - // 2 debug directory entries (28 bytes each) + CodeView data (~24 bytes) + Embedded PDB data (compressed pdbBlob + 8 header) - // CodeView entry: signature (4) + guid (16) + age (4) + path (variable, ~12 for "assembly.pdb\0") - const int debugDirEntrySize = 28; - int codeViewDataSize = 4 + 16 + 4 + "assembly.pdb".Length + 1; // signature + guid + age + path + null - int embeddedPdbHeaderSize = 8; // MPDB signature (4) + uncompressed size (4) - // The embedded PDB is compressed, estimate conservatively as same size - int embeddedPdbDataSize = embeddedPdbHeaderSize + pdbBlob.Count; - - debugDataSize = (2 * debugDirEntrySize) + codeViewDataSize + embeddedPdbDataSize; - - return debugDirectoryBuilder; - } - - private void BuildPdbMetadata() - { - // Add documents and sequence points to the PDB metadata builder - foreach (var entity in _entityRegistry.GetSeenEntities(TableIndex.MethodDef)) - { - if (entity is not EntityRegistry.MethodDefinitionEntity method) - { - continue; - } - - var debugInfo = method.DebugInfo; - if (debugInfo.SequencePoints.Count == 0) - { - // Add empty debug info entry for methods without sequence points - _pdbBuilder.AddMethodDebugInformation(default, default); - continue; - } - - // Get or create document handle - DocumentHandle documentHandle = default; - if (debugInfo.DocumentPath is not null) - { - if (!_documentHandles.TryGetValue(debugInfo.DocumentPath, out documentHandle)) - { - var nameHandle = _pdbBuilder.GetOrAddDocumentName(debugInfo.DocumentPath); - var languageGuidHandle = _currentLanguageGuid != Guid.Empty - ? _pdbBuilder.GetOrAddGuid(_currentLanguageGuid) - : default; - documentHandle = _pdbBuilder.AddDocument( - nameHandle, - default, // hash algorithm - default, // hash - languageGuidHandle); - _documentHandles[debugInfo.DocumentPath] = documentHandle; - } - } - - // Encode sequence points - var sequencePointsBlob = EncodeSequencePoints(debugInfo.SequencePoints); - var sequencePointsBlobHandle = _pdbBuilder.GetOrAddBlob(sequencePointsBlob); - - _pdbBuilder.AddMethodDebugInformation(documentHandle, sequencePointsBlobHandle); - } - } - - private static BlobBuilder EncodeSequencePoints(List sequencePoints) - { - var builder = new BlobBuilder(); - - if (sequencePoints.Count == 0) - { - return builder; - } - - // LocalSignature (not used here, write 0) - builder.WriteCompressedInteger(0); - - int previousOffset = 0; - int previousStartLine = -1; - int previousStartColumn = -1; - - foreach (var sp in sequencePoints) - { - // IL offset delta - int offsetDelta = sp.ILOffset - previousOffset; - builder.WriteCompressedInteger(offsetDelta); - previousOffset = sp.ILOffset; - - if (sp.IsHidden) - { - // Hidden sequence point: delta lines = 0, delta columns = 0 - builder.WriteCompressedInteger(0); - builder.WriteCompressedInteger(0); - } - else - { - // Delta lines - int deltaLines = sp.EndLine - sp.StartLine; - builder.WriteCompressedInteger(deltaLines); - - // Delta columns - int deltaColumns = sp.EndColumn - sp.StartColumn; - if (deltaLines == 0) - { - builder.WriteCompressedInteger(deltaColumns); - } - else - { - builder.WriteCompressedSignedInteger(deltaColumns); - } - - // Start line delta (signed) - if (previousStartLine < 0) - { - builder.WriteCompressedInteger(sp.StartLine); - } - else - { - builder.WriteCompressedSignedInteger(sp.StartLine - previousStartLine); - } - - // Start column delta (signed) - if (previousStartColumn < 0) - { - builder.WriteCompressedInteger(sp.StartColumn); - } - else - { - builder.WriteCompressedSignedInteger(sp.StartColumn - previousStartColumn); - } - - previousStartLine = sp.StartLine; - previousStartColumn = sp.StartColumn; - } - } - - return builder; - } - - private static bool IsRecoverableError(string diagnosticId) - { - // Method body and signature diagnostics are recoverable - we emit the assembly but report the error. - // This matches native ilasm behavior where errors during method/field emission don't prevent - // the assembly from being written when the /ERR (OnErrGo) flag is set. - return diagnosticId is DiagnosticIds.ByteArrayTooShort - or DiagnosticIds.ArgumentNotFound - or DiagnosticIds.LocalNotFound - or DiagnosticIds.LabelNotFound - or DiagnosticIds.GenericParameterIndexOutOfRange - or DiagnosticIds.ParameterIndexOutOfRange - or DiagnosticIds.GenericParameterNotFound - or DiagnosticIds.UnknownGenericParameter - or DiagnosticIds.MissingInstanceCallConv; - } - - public GrammarResult Visit(IParseTree tree) => tree.Accept(this); - - GrammarResult ICILVisitor.VisitAlignment(CILParser.AlignmentContext context) => VisitAlignment(context); - public GrammarResult.Literal VisitAlignment(CILParser.AlignmentContext context) - { - return VisitInt32(context.int32()); - } - - GrammarResult ICILVisitor.VisitAsmAttr(CILParser.AsmAttrContext context) => VisitAsmAttr(context); - public GrammarResult.Literal VisitAsmAttr(CILParser.AsmAttrContext context) - => new(context.asmAttrAny().Select(VisitAsmAttrAny).Aggregate((AssemblyFlags)0, (lhs, rhs) => lhs | rhs)); - GrammarResult ICILVisitor.VisitAsmAttrAny(CILParser.AsmAttrAnyContext context) => VisitAsmAttrAny(context); - public GrammarResult.Flag VisitAsmAttrAny(CILParser.AsmAttrAnyContext context) - { - return context.GetText() switch - { - "retargetable" => new(AssemblyFlags.Retargetable), - "windowsruntime" => new(AssemblyFlags.WindowsRuntime), - "noplatform" => new(AssemblyFlags.NoPlatform), - "legacy library" => new(0), - "cil" => new(GetFlagForArch(ProcessorArchitecture.MSIL), AssemblyFlags.ArchitectureMask), - "x86" => new(GetFlagForArch(ProcessorArchitecture.X86), AssemblyFlags.ArchitectureMask), - "amd64" => new(GetFlagForArch(ProcessorArchitecture.Amd64), AssemblyFlags.ArchitectureMask), - "arm" => new(GetFlagForArch(ProcessorArchitecture.Arm), AssemblyFlags.ArchitectureMask), - "arm64" => new(GetFlagForArch((ProcessorArchitecture)6), AssemblyFlags.ArchitectureMask), - _ => throw new UnreachableException() - }; - } - - private static AssemblyFlags GetFlagForArch(ProcessorArchitecture arch) - { - return (AssemblyFlags)((int)arch << 4); - } - - private static (ProcessorArchitecture, AssemblyFlags) GetArchAndFlags(AssemblyFlags flags) - { - var arch = (ProcessorArchitecture)(((int)flags & 0xF0) >> 4); - var newFlags = flags & ~((AssemblyFlags)((int)arch << 4)); - return (arch, newFlags); - } - - private EntityRegistry.AssemblyOrRefEntity? _currentAssemblyOrRef; - public GrammarResult VisitAsmOrRefDecl(CILParser.AsmOrRefDeclContext context) - { - Debug.Assert(_currentAssemblyOrRef is not null); - - if (context.customAttrDecl() is { } attr) - { - var customAttr = VisitCustomAttrDecl(attr).Value; - if (customAttr is not null) - { - customAttr.Owner ??= _currentAssemblyOrRef; - } - return GrammarResult.SentinelValue.Result; - } - - string decl = context.GetChild(0).GetText(); - if (decl == ".publickey") - { - BlobBuilder blob = new(); - blob.WriteBytes(VisitBytes(context.bytes()).Value); - // COMPAT: Native ilasm gives a public key token precedence regardless of declaration order. - if (_currentAssemblyOrRef is not EntityRegistry.AssemblyReferenceEntity assemblyReference - || assemblyReference.PublicKeyOrToken is null - || assemblyReference.Flags.HasFlag(AssemblyFlags.PublicKey)) - { - _currentAssemblyOrRef!.PublicKeyOrToken = blob; - _currentAssemblyOrRef.Flags |= AssemblyFlags.PublicKey; - } - } - else if (decl == ".ver") - { - var versionComponents = context.intOrWildcard(); - _currentAssemblyOrRef!.Version = new Version( - VisitIntOrWildcard(versionComponents[0]).Value ?? 0, - VisitIntOrWildcard(versionComponents[1]).Value ?? 0, - VisitIntOrWildcard(versionComponents[2]).Value ?? 0, - VisitIntOrWildcard(versionComponents[3]).Value ?? 0); - } - else if (decl == ".locale") - { - _currentAssemblyOrRef!.Culture = context.compQstring() is { } compQstring - ? VisitCompQstring(compQstring).Value - : Encoding.Unicode.GetString([.. VisitBytes(context.bytes()).Value]); - } - return GrammarResult.SentinelValue.Result; - } - - GrammarResult ICILVisitor.VisitAssemblyBlock(CILParser.AssemblyBlockContext context) => VisitAssemblyBlock(context); - public GrammarResult VisitAssemblyBlock(CILParser.AssemblyBlockContext context) - { - // Use command-line override if specified, otherwise use the name from the .assembly directive - string assemblyName = _options.AssemblyName ?? VisitDottedName(context.dottedName()).Value; - _entityRegistry.Assembly ??= new EntityRegistry.AssemblyEntity(assemblyName); - var attr = VisitAsmAttr(context.asmAttr()).Value; - (_entityRegistry.Assembly.ProcessorArchitecture, _entityRegistry.Assembly.Flags) = GetArchAndFlags(attr); - foreach (var decl in context.assemblyDecls().assemblyDecl()) - { - VisitAssemblyDecl(decl); - } - - // Apply command-line key file override (overrides .publickey directive) - if (_options.KeyFile is not null) - { - ApplyKeyFile(_options.KeyFile); - } - - // DebuggableAttribute is applied in BuildImage() after all source declarations - // have been processed, so the correct corelib assembly ref can be found. - - return GrammarResult.SentinelValue.Result; - } - - /// - /// Add DebuggableAttribute to the assembly based on debug options. - /// - /DEBUG: 0x101 = Default | DisableOptimizations - /// - /DEBUG=OPT: 0x03 = Default | IgnoreSymbolStoreSequencePoints - /// - /DEBUG=IMPL: 0x103 = Default | DisableOptimizations | EnableEditAndContinue - /// - private void ApplyDebuggableAttribute() - { - if (_entityRegistry.Assembly is null) - { - return; - } - - // DebuggingModes enum values from System.Diagnostics.DebuggableAttribute: - // None = 0x00, Default = 0x01, IgnoreSymbolStoreSequencePoints = 0x02, - // EnableEditAndContinue = 0x04, DisableOptimizations = 0x100 - const int DebuggingModesDefault = 0x101; // Default | DisableOptimizations - const int DebuggingModesOpt = 0x03; // Default | IgnoreSymbolStoreSequencePoints - const int DebuggingModesImpl = 0x103; // Default | DisableOptimizations | EnableEditAndContinue - - int debuggingModes = _options.DebugMode switch - { - DebugMode.Opt => DebuggingModesOpt, - DebugMode.Impl => DebuggingModesImpl, - _ => DebuggingModesDefault - }; - - // Get reference to core library - var coreAsmRef = _entityRegistry.GetCoreLibAssemblyReference(); - - // Create reference to System.Diagnostics.DebuggableAttribute - var debuggableAttrType = _entityRegistry.GetOrCreateTypeReference( - coreAsmRef, - new TypeName(null, "System.Diagnostics.DebuggableAttribute")); - - // Create reference to nested type DebuggingModes - var debuggingModesType = _entityRegistry.GetOrCreateTypeReference( - debuggableAttrType, - new TypeName(null, "DebuggingModes")); - - // Create constructor signature: .ctor(DebuggingModes) - BlobBuilder ctorSig = new(); - var sigEncoder = new BlobEncoder(ctorSig); - sigEncoder.MethodSignature(SignatureCallingConvention.Default, 0, isInstanceMethod: true) - .Parameters(1, - returnType => returnType.Void(), - parameters => parameters.AddParameter().Type().Type(debuggingModesType.Handle, isValueType: true)); - - var ctor = _entityRegistry.CreateLazilyRecordedMemberReference(debuggableAttrType, ".ctor", ctorSig); - - // Create custom attribute blob: prolog (0x0001) + int32 value + named args count (0x0000) - BlobBuilder attrValue = new(); - attrValue.WriteUInt16(0x0001); // Prolog - attrValue.WriteInt32(debuggingModes); // DebuggingModes value - attrValue.WriteUInt16(0x0000); // No named arguments - - // Create and attach the custom attribute - var customAttr = _entityRegistry.CreateCustomAttribute(ctor, attrValue); - customAttr.Owner = _entityRegistry.Assembly; - } - - private void ApplyKeyFile(string keyFilePath) - { - if (_entityRegistry.Assembly is null) - { - return; - } - - try - { - byte[] keyBytes = File.ReadAllBytes(keyFilePath); - BlobBuilder blob = new(); - blob.WriteBytes(keyBytes); - _entityRegistry.Assembly.PublicKeyOrToken = blob; - _entityRegistry.Assembly.Flags |= AssemblyFlags.PublicKey; - } - catch (Exception ex) - { - // Create a location pointing to the first document (if available) - var firstDoc = _documents.Values.FirstOrDefault(); - var location = firstDoc is not null - ? new Location(new SourceSpan(0, 0), firstDoc) - : new Location(new SourceSpan(0, 0), new SourceText(string.Empty, keyFilePath)); - _diagnostics.Add(new Diagnostic(DiagnosticIds.KeyFileError, DiagnosticSeverity.Error, $"Failed to read key file '{keyFilePath}': {ex.Message}", location)); - } - } - - GrammarResult ICILVisitor.VisitAssemblyDecl(CILParser.AssemblyDeclContext context) => VisitAssemblyDecl(context); - public GrammarResult VisitAssemblyDecl(CILParser.AssemblyDeclContext context) - { - if (context.secDecl() is { } secDecl) - { - var declarativeSecurity = VisitSecDecl(secDecl); - if (declarativeSecurity.Value is { } sec) - { - sec.Parent = _entityRegistry.Assembly; - } - } - else if (context.int32() is { } hashAlg) - { - _entityRegistry.Assembly!.HashAlgorithm = (AssemblyHashAlgorithm)VisitInt32(hashAlg).Value; - } - else if (context.asmOrRefDecl() is { } asmOrRef) - { - _currentAssemblyOrRef = _entityRegistry.Assembly; - VisitAsmOrRefDecl(asmOrRef); - _currentAssemblyOrRef = null; - } - return GrammarResult.SentinelValue.Result; - } - public GrammarResult VisitAssemblyDecls(CILParser.AssemblyDeclsContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - public GrammarResult VisitAssemblyRefDecl(CILParser.AssemblyRefDeclContext context) - { - if (context.asmOrRefDecl() is { } asmOrRef) - { - VisitAsmOrRefDecl(asmOrRef); - } - string decl = context.GetChild(0).GetText(); - if (decl == ".hash") - { - var blob = new BlobBuilder(); - blob.WriteBytes(VisitBytes(context.bytes()).Value); - ((EntityRegistry.AssemblyReferenceEntity)_currentAssemblyOrRef!).Hash = blob; - } - if (decl == ".publickeytoken") - { - var blob = new BlobBuilder(); - blob.WriteBytes(VisitBytes(context.bytes()).Value); - _currentAssemblyOrRef!.PublicKeyOrToken = blob; - _currentAssemblyOrRef.Flags &= ~AssemblyFlags.PublicKey; - } - return GrammarResult.SentinelValue.Result; - } - public GrammarResult VisitAssemblyRefDecls(CILParser.AssemblyRefDeclsContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - GrammarResult ICILVisitor.VisitAssemblyRefHead(CILParser.AssemblyRefHeadContext context) => VisitAssemblyRefHead(context); - public GrammarResult.Literal VisitAssemblyRefHead(CILParser.AssemblyRefHeadContext context) - { - var (arch, flags) = GetArchAndFlags(VisitAsmAttr(context.asmAttr()).Value); - var dottedNames = context.dottedName(); - string name = VisitDottedName(dottedNames[0]).Value; - string alias = name; - if (dottedNames.Length > 1) - { - alias = VisitDottedName(dottedNames[1]).Value; - } - return new(_entityRegistry.GetOrCreateAssemblyReference(alias, asmref => - { - asmref.Name = name; - asmref.Flags = flags; - asmref.ProcessorArchitecture = arch; - })); - } - - GrammarResult ICILVisitor.VisitAtOpt(CILParser.AtOptContext context) => VisitAtOpt(context); - public GrammarResult.Literal VisitAtOpt(CILParser.AtOptContext context) - => context.id() is { } id ? new(VisitId(id).Value) - : context.int32() is { } i ? new(VisitInt32(i).Value.ToString()) - : new(null); - - GrammarResult ICILVisitor.VisitBoolSeq(CILParser.BoolSeqContext context) => VisitBoolSeq(context); - public static GrammarResult.FormattedBlob VisitBoolSeq(CILParser.BoolSeqContext context) - { - var builder = ImmutableArray.CreateBuilder(); - - foreach (var item in context.truefalse()) - { - builder.AddRange(VisitTruefalse(item).Value); - } - - return new(builder.ToImmutable().SerializeSequence()); - } - GrammarResult ICILVisitor.VisitBound(CILParser.BoundContext context) => VisitBound(context); - public GrammarResult.Literal<(int? Lower, int? Upper)> VisitBound(CILParser.BoundContext context) - { - bool hasEllipsis = context.ELLIPSIS() is not null; - var indices = context.int32(); - - if (indices.Length == 0) - { - // Empty or standalone "..." - return new((null, null)); - } - - int firstValue = VisitInt32(indices[0]).Value; - - return (indices.Length, hasEllipsis) switch - { - (1, false) => new((0, firstValue)), - (1, true) => new((firstValue, null)), - (2, _) => new((firstValue, VisitInt32(indices[1]).Value - firstValue + 1)), - _ => throw new UnreachableException() - }; - } - - GrammarResult ICILVisitor.VisitBounds(CILParser.BoundsContext context) => VisitBounds(context); - public GrammarResult.Sequence<(int? Lower, int? Upper)> VisitBounds(CILParser.BoundsContext context) - { - return new(context.bound().Select(bound => VisitBound(bound).Value).ToImmutableArray()); - } - - GrammarResult ICILVisitor.VisitBytes(CILParser.BytesContext context) => VisitBytes(context); - public static GrammarResult.Sequence VisitBytes(CILParser.BytesContext context) - { - var builder = ImmutableArray.CreateBuilder(); - - foreach (var item in context.hexbyte()) - { - builder.Add(VisitHexbyte(item)); - } - - return new(builder.ToImmutable()); - } - GrammarResult ICILVisitor.VisitCallConv(CILParser.CallConvContext context) => VisitCallConv(context); - public GrammarResult.Literal VisitCallConv(CILParser.CallConvContext context) - { - if (context.callKind() is CILParser.CallKindContext callKind) - { - return new((byte)VisitCallKind(callKind).Value); - } - else if (context.int32() is CILParser.Int32Context int32) - { - return new((byte)VisitInt32(int32).Value); - } - else if (context.INSTANCE() is not null) - { - return new((byte)(VisitCallConv(context.callConv()).Value | (byte)SignatureAttributes.Instance)); - } - else if (context.EXPLICIT() is not null) - { - return new((byte)( - VisitCallConv(context.callConv()).Value | - (byte)(SignatureAttributes.ExplicitThis | SignatureAttributes.Instance))); - } - return new(0); - } - GrammarResult ICILVisitor.VisitCallKind(CILParser.CallKindContext context) => VisitCallKind(context); - public GrammarResult.Literal VisitCallKind(CILParser.CallKindContext context) - { - // callKind can be empty (/* EMPTY */) - return Default in that case - if (context.ChildCount == 0) - { - return new(SignatureCallingConvention.Default); - } - int childType = context.GetChild(context.ChildCount - 1).Symbol.Type; - return new(childType switch - { - CILParser.DEFAULT => SignatureCallingConvention.Default, - CILParser.VARARG => SignatureCallingConvention.VarArgs, - CILParser.CDECL => SignatureCallingConvention.CDecl, - CILParser.STDCALL => SignatureCallingConvention.StdCall, - CILParser.THISCALL => SignatureCallingConvention.ThisCall, - CILParser.FASTCALL => SignatureCallingConvention.FastCall, - CILParser.UNMANAGED => SignatureCallingConvention.Unmanaged, - _ => throw new UnreachableException() - }); - } - - GrammarResult ICILVisitor.VisitCatchClause(CILParser.CatchClauseContext context) => VisitCatchClause(context); - public GrammarResult.Literal VisitCatchClause(CILParser.CatchClauseContext context) => VisitTypeSpec(context.typeSpec()); - - GrammarResult ICILVisitor.VisitCaValue(CILParser.CaValueContext context) => VisitCaValue(context); - public GrammarResult.FormattedBlob VisitCaValue(CILParser.CaValueContext context) - { - BlobBuilder blob = new(); - if (context.truefalse() is CILParser.TruefalseContext truefalse) - { - blob.WriteByte((byte)SerializationTypeCode.Boolean); - blob.WriteBoolean(VisitTruefalse(truefalse).Value); - } - else if (context.compQstring() is CILParser.CompQstringContext str) - { - blob.WriteUTF8(VisitCompQstring(str).Value); - blob.WriteByte(0); - } - else if (context.className() is CILParser.ClassNameContext className) - { - var name = VisitClassName(className).Value; - blob.WriteByte((byte)SerializationTypeCode.Enum); - blob.WriteUTF8((name as EntityRegistry.IHasReflectionNotation)?.ReflectionNotation ?? ""); - blob.WriteByte(0); - byte size = 4; - if (context.INT8() is not null) - { - size = 1; - } - else if (context.INT16() is not null) - { - size = 2; - } - blob.WriteByte(size); - blob.WriteInt32(VisitInt32(context.int32()).Value); - } - else - { - blob.WriteByte((byte)SerializationTypeCode.Int32); - blob.WriteInt32(VisitInt32(context.int32()).Value); - } - return new(blob); - } - - public GrammarResult VisitChildren(IRuleNode node) - { - for (int i = 0; i < node.ChildCount; i++) - { - node.GetChild(i).Accept(this); - } - return GrammarResult.SentinelValue.Result; - } - GrammarResult ICILVisitor.VisitClassAttr(CILParser.ClassAttrContext context) => VisitClassAttr(context); - - public GrammarResult.Literal<(GrammarResult.Flag Attribute, EntityRegistry.WellKnownBaseType? FallbackBase, bool RequireSealed)> VisitClassAttr(CILParser.ClassAttrContext context) - { - if (context.int32() is CILParser.Int32Context int32) - { - int value = VisitInt32(int32).Value; - // COMPAT: The VALUE and ENUM keywords use sentinel values to pass through the fallback base type - // in ILASM. These sentinel values can be provided through the "pass the value of the flag" feature, - // so we detect those old flags here and provide the correct fallback type. - bool requireSealed = false; - EntityRegistry.WellKnownBaseType? fallbackBase = null; - if ((value & 0x80000000) != 0) - { - requireSealed = true; - fallbackBase = EntityRegistry.WellKnownBaseType.System_ValueType; - } - if ((value & 0x40000000) != 0) - { - fallbackBase = EntityRegistry.WellKnownBaseType.System_Enum; - } - // Mask off the sentinel bits - value &= unchecked((int)~0xC0000000); - // COMPAT: When explicit flags are provided they always supercede previously set flags - // (other than the sentinel values) - return new((new((TypeAttributes)value, ShouldAppend: false), fallbackBase, requireSealed)); - } - - if (context.ENUM() is not null) - { - // COMPAT: ilasm implies the Sealed flag when using the 'value' keyword in a type declaration - // even when the 'enum' keyword is used. - return new((new(context.VALUE() is not null ? TypeAttributes.Sealed : 0), EntityRegistry.WellKnownBaseType.System_Enum, false)); - } - else if (context.VALUE() is not null) - { - // COMPAT: ilasm implies the Sealed flag when using the 'value' keyword in a type declaration - return new((new(TypeAttributes.Sealed), EntityRegistry.WellKnownBaseType.System_ValueType, true)); - } - else if (context.EXPLICIT() is not null) - { - return new((new(TypeAttributes.ExplicitLayout), null, false)); - } - else if (context.INTERFACE() is not null) - { - // COMPAT: interface implies abstract - return new((new(TypeAttributes.Interface | TypeAttributes.Abstract), null, false)); - } - - switch (context.GetText()) - { - case "public": - return new((new(TypeAttributes.Public, TypeAttributes.VisibilityMask), null, false)); - case "private": - return new((new(TypeAttributes.NotPublic, TypeAttributes.VisibilityMask), null, false)); - case "nestedpublic": - return new((new(TypeAttributes.NestedPublic, TypeAttributes.VisibilityMask), null, false)); - case "nestedprivate": - return new((new(TypeAttributes.NestedPrivate, TypeAttributes.VisibilityMask), null, false)); - case "nestedfamily": - return new((new(TypeAttributes.NestedFamily, TypeAttributes.VisibilityMask), null, false)); - case "nestedassembly": - return new((new(TypeAttributes.NestedAssembly, TypeAttributes.VisibilityMask), null, false)); - case "nestedfamandassem": - return new((new(TypeAttributes.NestedFamANDAssem, TypeAttributes.VisibilityMask), null, false)); - case "nestedfamorassem": - return new((new(TypeAttributes.NestedFamORAssem, TypeAttributes.VisibilityMask), null, false)); - case "ansi": - return new((new(TypeAttributes.AnsiClass, TypeAttributes.StringFormatMask), null, false)); - case "autochar": - return new((new(TypeAttributes.AutoClass, TypeAttributes.StringFormatMask), null, false)); - case "unicode": - return new((new(TypeAttributes.UnicodeClass, TypeAttributes.StringFormatMask), null, false)); - case "auto": - return new((new(TypeAttributes.AutoLayout, TypeAttributes.LayoutMask), null, false)); - case "sequential": - return new((new(TypeAttributes.SequentialLayout, TypeAttributes.LayoutMask), null, false)); - case "extended": - return new((new(TypeAttributes.ExtendedLayout, TypeAttributes.LayoutMask), null, false)); - case "sealed": - return new((new(TypeAttributes.Sealed), null, false)); - case "abstract": - return new((new(TypeAttributes.Abstract), null, false)); - case "import": - return new((new(TypeAttributes.Import), null, false)); - case "serializable": -#pragma warning disable SYSLIB0050 - return new((new(TypeAttributes.Serializable), null, false)); -#pragma warning restore SYSLIB0050 - case "windowsruntime": - return new((new(TypeAttributes.WindowsRuntime), null, false)); - case "beforefieldinit": - return new((new(TypeAttributes.BeforeFieldInit), null, false)); - case "specialname": - return new((new(TypeAttributes.SpecialName), null, false)); - case "rtspecialname": - return new((new(TypeAttributes.RTSpecialName), null, false)); - default: - return new((new((TypeAttributes)Enum.Parse(typeof(TypeAttributes), context.GetText(), true)), null, false)); - } - } - - private sealed class CurrentMethodContext - { - public CurrentMethodContext(EntityRegistry.MethodDefinitionEntity definition) - { - Definition = definition; - // Populate argument names from the method's parameter definitions - foreach (var param in definition.Parameters) - { - if (param.Name is not null && param.Sequence > 0) - { - ArgumentNames[param.Name] = param.Sequence - 1; - } - } - } - - public EntityRegistry.MethodDefinitionEntity Definition { get; } - - public Dictionary Labels { get; } = new(); - - public HashSet DeclaredLabels { get; } = new(); - - public Dictionary UndefinedLabelReferences { get; } = new(); - - public Dictionary ArgumentNames { get; } = new(); - - public List> LocalsScopes { get; } = new(); - - public List AllLocals { get; } = new(); - } - - private CurrentMethodContext? _currentMethod; - private EntityRegistry.EntityBase? _pendingClassCustomAttributeOwner; - - public GrammarResult VisitClassDecl(CILParser.ClassDeclContext context) - { - bool isStandaloneCustomAttribute = - context.customAttrDecl().Length == 1 && - context.PARAM() is null; - if (!isStandaloneCustomAttribute) - { - _pendingClassCustomAttributeOwner = null; - } - - bool hasNestedDeclarations = - context.classHead() is not null - || context.methodHead() is not null; - if (!hasNestedDeclarations && ContainsParserError(context)) - { - return GrammarResult.SentinelValue.Result; - } - - if (context.classHead() is CILParser.ClassHeadContext classHead) - { - if (ContainsParserError(classHead) - || context.classDecls() is not CILParser.ClassDeclsContext classDecls) - { - return GrammarResult.SentinelValue.Result; - } - - _currentTypeDefinition.Push(VisitClassHead(classHead).Value); - VisitClassDecls(classDecls); - _currentTypeDefinition.Pop(); - _pendingClassCustomAttributeOwner = null; - } - else if (context.methodHead() is CILParser.MethodHeadContext methodHead) - { - if (ContainsParserError(methodHead) - || context.methodDecls() is not CILParser.MethodDeclsContext methodDecls) - { - return GrammarResult.SentinelValue.Result; - } - - _currentMethod = new(VisitMethodHead(methodHead).Value); - VisitMethodDecls(methodDecls); - // Build the locals signature from parsed local variable declarations - if (_currentMethod.AllLocals.Count > 0) - { - var localsSig = new BlobBuilder(); - var encoder = new BlobEncoder(localsSig); - var localsEncoder = encoder.LocalVariableSignature(_currentMethod.AllLocals.Count); - foreach (var local in _currentMethod.AllLocals) - { - local.SignatureBlob.WriteContentTo(localsEncoder.AddVariable().Builder); - } - _currentMethod.Definition.LocalsSignature = _entityRegistry.GetOrCreateStandaloneSignature(localsSig); - } - // Validate that all referenced labels were declared - ValidateLabelReferences(); - _currentMethod = null; - } - else if (context.secDecl() is {} secDecl) - { - var declarativeSecurity = VisitSecDecl(secDecl).Value; - declarativeSecurity?.Parent = _currentTypeDefinition.PeekOrDefault(); - } - else if (context.TYPE() is not null && - context.typeSpec().Length == 1 && - context.customDescr() is { } interfaceAttribute) - { - var currentType = _currentTypeDefinition.PeekOrDefault(); - if (currentType is not null) - { - EntityRegistry.TypeEntity interfaceType = VisitTypeSpec(context.typeSpec()[0]).Value; - EntityRegistry.InterfaceImplementationEntity? implementation = - currentType.InterfaceImplementations.FirstOrDefault( - candidate => candidate.InterfaceType == interfaceType); - if (implementation is null) - { - implementation = - EntityRegistry.CreateUnrecordedInterfaceImplementation(currentType, interfaceType); - currentType.InterfaceImplementations.Add(implementation); - } - - VisitCustomDescr(interfaceAttribute).Value.Owner = implementation; - } - } - else if (context.fieldDecl() is {} fieldDecl) - { - _ = VisitFieldDecl(fieldDecl); - } - else if (context.dataDecl() is { } dataDecl) - { - _ = VisitDataDecl(dataDecl); - } - else if (context.extSourceSpec() is { } extSourceSpec) - { - _ = VisitExtSourceSpec(extSourceSpec); - } - else if (context.languageDecl() is { } languageDecl) - { - _ = VisitLanguageDecl(languageDecl); - } - else if (context.OVERRIDE() is not null) - { - var currentType = _currentTypeDefinition.PeekOrDefault(); - if (currentType is not null) - { - var typeSpecs = context.typeSpec(); - var methodNames = context.methodName(); - var callConventions = context.callConv(); - var returnTypes = context.type(); - var signatureArguments = context.sigArgs(); - var genericArities = context.genArity(); - - int bodySignatureIndex = context.METHOD().Length == 0 ? 0 : 1; - BlobBuilder declarationSignature = BuildMethodReferenceSignature( - callConventions[0], - returnTypes[0], - signatureArguments[0], - genericArities.Length > 0 ? VisitGenArity(genericArities[0]).Value : 0); - BlobBuilder bodySignature = context.METHOD().Length == 0 - ? declarationSignature - : BuildMethodReferenceSignature( - callConventions[bodySignatureIndex], - returnTypes[bodySignatureIndex], - signatureArguments[bodySignatureIndex], - genericArities.Length > bodySignatureIndex - ? VisitGenArity(genericArities[bodySignatureIndex]).Value - : 0); - - EntityRegistry.TypeEntity bodyOwner = VisitTypeSpec(typeSpecs[1]).Value; - string bodyName = VisitMethodName(methodNames[1]).Value; - EntityRegistry.MemberReferenceEntity declaration = - _entityRegistry.CreateLazilyRecordedMemberReference( - VisitTypeSpec(typeSpecs[0]).Value, - VisitMethodName(methodNames[0]).Value, - declarationSignature); - - if (ReferenceEquals(bodyOwner, currentType)) - { - EntityRegistry.MethodDefinitionEntity[] bodyMethods = currentType.Methods - .Where(method => - method.Name == bodyName && - method.MethodSignature is not null && - method.MethodSignature.ContentEquals(bodySignature)) - .Take(2) - .ToArray(); - if (bodyMethods.Length != 1) - { - ReportError( - DiagnosticIds.InvalidMetadataToken, - $"Override body method '{bodyName}' could not be resolved uniquely", - context); - return GrammarResult.SentinelValue.Result; - } - - currentType.MethodImplementations.Add( - EntityRegistry.CreateUnrecordedMethodImplementation(bodyMethods[0], declaration)); - } - else - { - EntityRegistry.MemberReferenceEntity body = - _entityRegistry.CreateLazilyRecordedMemberReference( - bodyOwner, - bodyName, - bodySignature); - currentType.MethodImplementations.Add( - EntityRegistry.CreateUnrecordedMethodImplementation(currentType, body, declaration)); - } - } - } - else if (context.int32() is {} int32) - { - // .pack or .size - string keyword = context.GetChild(0).GetText(); - int value = VisitInt32(int32).Value; - var currentType = _currentTypeDefinition.PeekOrDefault(); - if (currentType is not null) - { - if (keyword == ".pack") - { - currentType.PackingSize = value; - } - else if (keyword == ".size") - { - currentType.ClassSize = value; - } - } - } - else if (context.propHead() is CILParser.PropHeadContext propHead) - { - var property = VisitPropHead(propHead).Value; - var currentType = _currentTypeDefinition.PeekOrDefault(); - if (currentType is not null) - { - currentType.Properties.Add(property); - foreach (var propDecl in context.propDecls().propDecl()) - { - if (propDecl.customAttrDecl() is { } customAttrDecl) - { - var customAttr = VisitCustomAttrDecl(customAttrDecl).Value; - if (customAttr is not null) - { - customAttr.Owner ??= property; - } - } - else if (VisitPropDecl(propDecl).Value is { } accessor) - { - property.Accessors.Add(accessor); - } - } - } - } - else if (context.eventHead() is CILParser.EventHeadContext eventHead) - { - var evt = VisitEventHead(eventHead).Value; - var currentType = _currentTypeDefinition.PeekOrDefault(); - if (currentType is not null) - { - currentType.Events.Add(evt); - foreach (var eventDecl in context.eventDecls().eventDecl()) - { - if (eventDecl.customAttrDecl() is { } customAttrDecl) - { - var customAttr = VisitCustomAttrDecl(customAttrDecl).Value; - if (customAttr is not null) - { - customAttr.Owner ??= evt; - } - } - else if (VisitEventDecl(eventDecl).Value is { } accessor) - { - evt.Accessors.Add(accessor); - } - } - } - } - else if (context.OVERRIDE() is not null) - { - var currentType = _currentTypeDefinition.PeekOrDefault(); - if (currentType is null) - { - throw new UnreachableException(); - } - - CILParser.CallConvContext[] callConvs = context.callConv(); - CILParser.TypeContext[] returnTypes = context.type(); - CILParser.TypeSpecContext[] owners = context.typeSpec(); - CILParser.MethodNameContext[] methodNames = context.methodName(); - CILParser.GenArityContext[] genericArities = context.genArity(); - CILParser.SigArgsContext[] parameterLists = context.sigArgs(); - - EntityRegistry.MemberReferenceEntity declaration; - EntityRegistry.MemberReferenceEntity body; - if (callConvs.Length == 2) - { - declaration = CreateExplicitMethodReference( - callConvs[0], returnTypes[0], owners[0], methodNames[0], genericArities[0], parameterLists[0]); - body = CreateExplicitMethodReference( - callConvs[1], returnTypes[1], owners[1], methodNames[1], genericArities[1], parameterLists[1]); - } - else - { - EntityRegistry.TypeEntity declarationOwner = VisitTypeSpec(owners[0]).Value; - string declarationName = VisitMethodName(methodNames[0]).Value; - EntityRegistry.TypeEntity bodyOwner = VisitTypeSpec(owners[1]).Value; - string bodyName = VisitMethodName(methodNames[1]).Value; - BlobBuilder bodySignature = CreateExplicitMethodSignature( - callConvs[0], returnTypes[0], genericArity: null, parameterLists[0]); - BlobBuilder declarationSignature = new(); - bodySignature.WriteContentTo(declarationSignature); - declaration = _entityRegistry.CreateLazilyRecordedMemberReference( - declarationOwner, declarationName, declarationSignature); - body = _entityRegistry.CreateLazilyRecordedMemberReference( - bodyOwner, bodyName, bodySignature); - } - - currentType.MethodImplementations.Add(EntityRegistry.CreateUnrecordedMethodImplementation(currentType, body, declaration)); - } - else if (isStandaloneCustomAttribute) - { - if (VisitCustomAttrDecl(context.customAttrDecl()[0]).Value is { } customAttr) - { - customAttr.Owner ??= - _pendingClassCustomAttributeOwner ?? - _currentTypeDefinition.PeekOrDefault(); - } - } - else if (context.PARAM() is not null) - { - var customAttrDeclarations = context.customAttrDecl(); - var currentType = _currentTypeDefinition.PeekOrDefault(); - if (currentType is not null && context.TYPE() is not null) - { - EntityRegistry.GenericParameterEntity? param = null; - if (context.int32() is { } int32ctx) - { - int index = VisitInt32(int32ctx).Value; - if (index >= 0 && index < currentType.GenericParameters.Count) - { - param = currentType.GenericParameters[index]; - } - else - { - ReportError( - DiagnosticIds.GenericParameterIndexOutOfRange, - string.Format(DiagnosticMessageTemplates.GenericParameterIndexOutOfRange, index), - context); - } - } - else if (context.dottedName() is { } dn) - { - string name = VisitDottedName(dn).Value; - foreach (var genericParam in currentType.GenericParameters) - { - if (genericParam.Name == name) - { - param = genericParam; - break; - } - } - } - if (param is not null) - { - foreach (var attr in customAttrDeclarations ?? Array.Empty()) - { - var customAttrDecl = VisitCustomAttrDecl(attr).Value; - if (customAttrDecl is not null) - { - customAttrDecl.Owner ??= param; - } - } - _pendingClassCustomAttributeOwner = param; - } - } - else if (currentType is not null && context.CONSTRAINT() is not null) - { - EntityRegistry.GenericParameterEntity? param = null; - if (context.int32() is { } int32ctx) - { - int index = VisitInt32(int32ctx).Value; - if (index >= 0 && index < currentType.GenericParameters.Count) - { - param = currentType.GenericParameters[index]; - } - else - { - ReportError( - DiagnosticIds.GenericParameterIndexOutOfRange, - string.Format(DiagnosticMessageTemplates.GenericParameterIndexOutOfRange, index), - context); - } - } - else if (context.dottedName() is { } dn) - { - string name = VisitDottedName(dn).Value; - foreach (var genericParam in currentType.GenericParameters) - { - if (genericParam.Name == name) - { - param = genericParam; - break; - } - } - } - if (param is not null) - { - var baseType = VisitTypeSpec(context.typeSpec()[0]).Value; - EntityRegistry.GenericParameterConstraintEntity? constraint = - param.Constraints.FirstOrDefault(entity => entity.BaseType == baseType); - if (constraint is null) - { - constraint = EntityRegistry.CreateGenericConstraint(baseType); - constraint.Owner = param; - param.Constraints.Add(constraint); - currentType.GenericParameterConstraints.Add(constraint); - } - foreach (var attr in customAttrDeclarations ?? Array.Empty()) - { - var customAttrDecl = VisitCustomAttrDecl(attr).Value; - if (customAttrDecl is not null) - { - customAttrDecl.Owner ??= constraint; - } - } - _pendingClassCustomAttributeOwner = constraint; - } - } - } - - return GrammarResult.SentinelValue.Result; - } - - private BlobBuilder BuildMethodReferenceSignature( - CILParser.CallConvContext callConvention, - CILParser.TypeContext returnType, - CILParser.SigArgsContext signatureArguments, - int genericArity) - { - var signature = new BlobBuilder(); - byte header = VisitCallConv(callConvention).Value; - if (genericArity > 0) - { - header |= (byte)SignatureAttributes.Generic; - } - - signature.WriteByte(header); - if (genericArity > 0) - { - signature.WriteCompressedInteger(genericArity); - } - - ImmutableArray arguments = VisitSigArgs(signatureArguments).Value; - signature.WriteCompressedInteger(arguments.Count(argument => !argument.IsSentinel)); - VisitType(returnType).Value.WriteContentTo(signature); - foreach (SignatureArg argument in arguments) - { - argument.SignatureBlob.WriteContentTo(signature); - } - - return signature; - } - - public GrammarResult VisitClassDecls(CILParser.ClassDeclsContext context) - { - CILParser.ClassDeclContext[] declarations = context.classDecl(); - foreach (CILParser.ClassDeclContext declaration in declarations) - { - if (declaration.OVERRIDE() is null) - { - VisitClassDecl(declaration); - } - else - { - _pendingClassCustomAttributeOwner = null; - } - } - - foreach (CILParser.ClassDeclContext declaration in declarations) - { - if (declaration.OVERRIDE() is not null) - { - VisitClassDecl(declaration); - } - } - - return GrammarResult.SentinelValue.Result; - } - - - GrammarResult ICILVisitor.VisitClassHead(CILParser.ClassHeadContext context) => VisitClassHead(context); - public GrammarResult.Literal VisitClassHead(CILParser.ClassHeadContext context) - { - string typeFullName = VisitDottedName(context.dottedName()).Value; - int typeFullNameLastDot = typeFullName.LastIndexOf('.'); - // A dot at position 0 is part of the name (e.g., ".GlobalStruct"), not a namespace separator - if (typeFullNameLastDot == 0) - { - typeFullNameLastDot = -1; - } - string typeNS; - if (_currentTypeDefinition.Count != 0) - { - if (typeFullNameLastDot == -1) - { - typeNS = string.Empty; - } - else - { - typeNS = typeFullName.Substring(0, typeFullNameLastDot); - } - } - else - { - if (typeFullNameLastDot == -1) - { - typeNS = _currentNamespace.PeekOrDefault() ?? string.Empty; - } - else - { - typeNS = $"{_currentNamespace.PeekOrDefault()}{typeFullName.Substring(0, typeFullNameLastDot)}"; - } - } - - bool isNewType = false; - - var typeDefinition = _entityRegistry.GetOrCreateTypeDefinition( - _currentTypeDefinition.PeekOrDefault(), - typeNS, - typeFullNameLastDot != -1 - ? typeFullName.Substring(typeFullNameLastDot + 1) - : typeFullName, - (newTypeDef) => - { - isNewType = true; - EntityRegistry.WellKnownBaseType? fallbackBase = _options.NoAutoInherit ? null : EntityRegistry.WellKnownBaseType.System_Object; - bool requireSealed = false; - var classAttrs = context.classAttr(); - newTypeDef.Attributes = classAttrs.Select(VisitClassAttr).Aggregate( - (TypeAttributes)0, - (acc, result) => - { - var (attribute, implicitBase, attrRequireSealed) = result.Value; - if (implicitBase is not null) - { - fallbackBase = implicitBase; - } - if (!attribute.ShouldAppend) - { - requireSealed = attrRequireSealed; - return attribute.Value; - } - requireSealed |= attrRequireSealed; - if (attribute.Value == TypeAttributes.RTSpecialName) - { - // COMPAT: ILASM ignores the rtspecialname directive on a type. - return acc; - } - if ((attribute.Value & TypeAttributes.Interface) != 0) - { - // COMPAT: interface implies abstract - return acc | TypeAttributes.Interface | TypeAttributes.Abstract; - } - // Use the Flag's | operator which handles group masks - // (visibility, layout, string format) correctly. - return acc | attribute; - }); - - - // Two-pass generic parameter processing: - // Pass 1: Register all parameter names (without resolving constraints) - var typarContexts = context.typarsClause()?.typars()?.typar() ?? Array.Empty(); - ReportGenericParameterEncodingErrors(typarContexts); - for (int i = 0; i < typarContexts.Length; i++) - { - var attributes = VisitTyparAttribs(typarContexts[i].typarAttribs()).Value; - var param = EntityRegistry.CreateGenericParameter(attributes, VisitDottedName(typarContexts[i].dottedName()).Value); - param.Owner = newTypeDef; - param.Index = i; - newTypeDef.GenericParameters.Add(param); - } - - // Push the type so that !T references in constraints, extends, and implements can resolve - _currentTypeDefinition.Push(newTypeDef); - - // Pass 2: Resolve constraints (now all params are registered and type is on stack) - for (int i = 0; i < typarContexts.Length; i++) - { - var param = newTypeDef.GenericParameters[i]; - foreach (var constraint in VisitTyBound(typarContexts[i].tyBound()).Value) - { - constraint.Owner = param; - param.Constraints.Add(constraint); - newTypeDef.GenericParameterConstraints.Add(constraint); - } - } - - if (context.extendsClause() is CILParser.ExtendsClauseContext extends) - { - newTypeDef.BaseType = VisitExtendsClause(context.extendsClause()).Value; - } - - if (context.implClause() is CILParser.ImplClauseContext impl) - { - newTypeDef.InterfaceImplementations.AddRange(VisitImplClause(context.implClause()).Value); - } - - _currentTypeDefinition.Pop(); - - // Interfaces should not have an implicit base type - if (newTypeDef.Attributes.HasFlag(TypeAttributes.Interface)) - { - fallbackBase = null; - } - - newTypeDef.BaseType ??= _entityRegistry.ResolveImplicitBaseType(fallbackBase); - - // When the user has provided a type definition for a type that directly inherits - // System.ValueType but has not sealed it, emit a warning and add the 'sealed' modifier. - if (!newTypeDef.Attributes.HasFlag(TypeAttributes.Sealed) && - (requireSealed // COMPAT: when both the sentinel values for 'value' and 'enum' are explicitly - // specified, the sealed modifier is required even though - // the base type isn't System.ValueType. - || _entityRegistry.SystemValueTypeType.Equals(newTypeDef.BaseType))) - { - _diagnostics.Add( - new Diagnostic( - DiagnosticIds.UnsealedValueType, - DiagnosticSeverity.Error, - string.Format(DiagnosticMessageTemplates.UnsealedValueType, newTypeDef.Name), - Location.From(context.dottedName().Stop, _documents))); - newTypeDef.Attributes |= TypeAttributes.Sealed; - } - }); - - if (!isNewType) - { - // Type was forward-referenced. Apply attributes, generic params, - // base type, and interface implementations that were deferred. - var classAttrs = context.classAttr(); - typeDefinition.Attributes = classAttrs.Select(VisitClassAttr).Aggregate( - typeDefinition.Attributes, - (acc, result) => - { - var (attribute, _, _) = result.Value; - if (!attribute.ShouldAppend) - return attribute.Value; - if ((attribute.Value & TypeAttributes.Interface) != 0) - return acc | TypeAttributes.Interface | TypeAttributes.Abstract; - return acc | attribute.Value; - }); - - if (typeDefinition.GenericParameters.Count == 0) - { - // Two-pass generic parameter processing for forward-referenced types - var typarContexts = context.typarsClause()?.typars()?.typar() ?? Array.Empty(); - ReportGenericParameterEncodingErrors(typarContexts); - for (int i = 0; i < typarContexts.Length; i++) - { - var attributes = VisitTyparAttribs(typarContexts[i].typarAttribs()).Value; - var param = EntityRegistry.CreateGenericParameter(attributes, VisitDottedName(typarContexts[i].dottedName()).Value); - param.Owner = typeDefinition; - param.Index = i; - typeDefinition.GenericParameters.Add(param); - } - - _currentTypeDefinition.Push(typeDefinition); - - // Pass 2: Resolve constraints - for (int i = 0; i < typarContexts.Length; i++) - { - var param = typeDefinition.GenericParameters[i]; - foreach (var constraint in VisitTyBound(typarContexts[i].tyBound()).Value) - { - constraint.Owner = param; - param.Constraints.Add(constraint); - typeDefinition.GenericParameterConstraints.Add(constraint); - } - } - } - else - { - _ = context.typarsClause().Accept(this); - _currentTypeDefinition.Push(typeDefinition); - } - - if (context.extendsClause() is CILParser.ExtendsClauseContext extends && typeDefinition.BaseType is null) - { - typeDefinition.BaseType = VisitExtendsClause(extends).Value; - } - else - { - _ = context.extendsClause()?.Accept(this); - } - - if (context.implClause() is CILParser.ImplClauseContext impl) - { - typeDefinition.InterfaceImplementations.AddRange(VisitImplClause(impl).Value); - } - - _currentTypeDefinition.Pop(); - } - - return new(typeDefinition); - } - - GrammarResult ICILVisitor.VisitClassName(CILParser.ClassNameContext context) => VisitClassName(context); - public GrammarResult.Literal VisitClassName(CILParser.ClassNameContext context) - { - if (context.THIS() is not null) - { - if (_currentTypeDefinition.Count == 0) - { - ReportError(DiagnosticIds.ThisOutsideClass, DiagnosticMessageTemplates.ThisOutsideClass, context); - return new(new EntityRegistry.FakeTypeEntity(default(TypeDefinitionHandle))); - } - var thisType = _currentTypeDefinition.Peek(); - return new(thisType); - } - else if (context.BASE() is not null) - { - if (_currentTypeDefinition.Count == 0) - { - ReportError(DiagnosticIds.BaseOutsideClass, DiagnosticMessageTemplates.BaseOutsideClass, context); - return new(new EntityRegistry.FakeTypeEntity(default(TypeDefinitionHandle))); - } - var baseType = _currentTypeDefinition.Peek().BaseType; - if (baseType is null) - { - ReportError(DiagnosticIds.NoBaseType, DiagnosticMessageTemplates.NoBaseType, context); - return new(new EntityRegistry.FakeTypeEntity(default(TypeDefinitionHandle))); - } - return new(baseType); - } - else if (context.NESTER() is not null) - { - if (_currentTypeDefinition.Count < 2) - { - ReportError(DiagnosticIds.NesterOutsideNestedClass, DiagnosticMessageTemplates.NesterOutsideNestedClass, context); - return new(new EntityRegistry.FakeTypeEntity(default(TypeDefinitionHandle))); - } - var nesterType = _currentTypeDefinition.Peek().ContainingType!; - return new(nesterType); - } - else if (context.slashedName() is CILParser.SlashedNameContext slashedName) - { - EntityRegistry.EntityBase? resolutionContext = null; - if (context.dottedName() is CILParser.DottedNameContext dottedAssemblyOrModuleName) - { - if (context.MODULE() is not null) - { - string moduleName = VisitDottedName(dottedAssemblyOrModuleName).Value; - resolutionContext = _entityRegistry.FindModuleReference(moduleName); - if (resolutionContext is null) - { - ReportError(DiagnosticIds.ModuleNotFound, string.Format(DiagnosticMessageTemplates.ModuleNotFound, moduleName), context); - return new(new EntityRegistry.FakeTypeEntity(default(TypeDefinitionHandle))); - } - } - else - { - resolutionContext = _entityRegistry.GetOrCreateAssemblyReference(VisitDottedName(dottedAssemblyOrModuleName).Value, newRef => { }); - } - } - else if (context.mdtoken() is CILParser.MdtokenContext typeRefScope) - { - resolutionContext = VisitMdtoken(typeRefScope).Value; - } - else if (context.PTR() is not null) - { - resolutionContext = new EntityRegistry.FakeTypeEntity(default(ModuleDefinitionHandle)); - } - - if (resolutionContext is not null) - { - EntityRegistry.TypeReferenceEntity typeRef = _entityRegistry.GetOrCreateTypeReference(resolutionContext, VisitSlashedName(slashedName).Value); - return new(typeRef); - } - - Debug.Assert(resolutionContext is null); - - return new(ResolveTypeDef()); - - // Resolve typedef references - EntityRegistry.TypeEntity ResolveTypeDef() - { - TypeName typeName = VisitSlashedName(slashedName).Value; - if (typeName.ContainingTypeName is null) - { - // Check for typedef. - var typedefResult = TryResolveTypedefAsType(typeName.DottedName); - if (typedefResult is not null) - { - return typedefResult; - } - } - - // COMPAT: Before creating a forward-reference TypeDef, check if the type - // matches a well-known corelib type. Native ilasm resolves unqualified - // references to types like System.String as TypeRefs from the corelib. - if (typeName.ContainingTypeName is null) - { - var (ns, nm) = NameHelpers.SplitDottedNameToNamespaceAndName(typeName.DottedName); - if (ns == "System" && nm is "String" or "Object" or "ValueType" or "Enum" - or "Type" or "Array" or "Delegate" or "MulticastDelegate" - or "Exception" or "Attribute") - { - var coreLib = _entityRegistry.GetCoreLibAssemblyReference(); - return _entityRegistry.GetOrCreateTypeReference(coreLib, typeName); - } - } - - Stack containingTypes = new(); - for (TypeName? containingType = typeName; containingType is not null; containingType = containingType.ContainingTypeName) - { - containingTypes.Push(containingType); - } - EntityRegistry.TypeDefinitionEntity? typeDef = null; - while (containingTypes.Count != 0) - { - TypeName containingType = containingTypes.Pop(); - - (string ns, string name) = NameHelpers.SplitDottedNameToNamespaceAndName(containingType.DottedName); - - typeDef = _entityRegistry.GetOrCreateTypeDefinition( - typeDef, - ns, - name, - _ => { }); - } - - return typeDef!; - } - } - else if (context.mdtoken() is CILParser.MdtokenContext typeToken) - { - EntityRegistry.EntityBase resolvedToken = VisitMdtoken(typeToken).Value; - - if (resolvedToken is not EntityRegistry.TypeEntity type) - { - return new(new EntityRegistry.FakeTypeEntity(resolvedToken.Handle)); - } - return new(type); - } - - throw new UnreachableException(); - } - - GrammarResult ICILVisitor.VisitClassSeq(CILParser.ClassSeqContext context) => VisitClassSeq(context); - public GrammarResult.FormattedBlob VisitClassSeq(CILParser.ClassSeqContext context) - { - BlobBuilder objSeqBlob = new(0); - foreach (var item in context.classSeqElement()) - { - objSeqBlob.LinkSuffix(VisitClassSeqElement(item).Value); - } - return new(objSeqBlob); - } - - GrammarResult ICILVisitor.VisitClassSeqElement(CILParser.ClassSeqElementContext context) => VisitClassSeqElement(context); - - public GrammarResult.FormattedBlob VisitClassSeqElement(CILParser.ClassSeqElementContext context) - { - BlobBuilder blob = new(); - if (context.className() is CILParser.ClassNameContext className) - { - if (VisitClassName(className).Value is EntityRegistry.IHasReflectionNotation notation) - { - blob.WriteSerializedString(notation.ReflectionNotation); - } - else - { - blob.WriteSerializedString(""); - } - return new(blob); - } - - blob.WriteSerializedString( - context.SQSTRING() is { } stringNode - ? StringHelpers.ParseQuotedString(stringNode.Symbol.Text) - : null); - return new(blob); - } - public GrammarResult VisitCompControl(CILParser.CompControlContext context) - { - // All compilation control directives that need special handling will be handled - // directly in the token stream before parsing. - // Any that reach here can be ignored. - return GrammarResult.SentinelValue.Result; - } - - GrammarResult ICILVisitor.VisitCompQstring(CILParser.CompQstringContext context) - { - return VisitCompQstring(context); - } - - private static GrammarResult.String VisitCompQstring(CILParser.CompQstringContext context) - { - StringBuilder builder = new(); - foreach (var item in context.QSTRING()) - { - builder.Append(StringHelpers.ParseQuotedString(item.Symbol.Text)); - } - return new(builder.ToString()); - } - - GrammarResult ICILVisitor.VisitCorflags(CILParser.CorflagsContext context) => VisitCorflags(context); - public GrammarResult.Literal VisitCorflags(CILParser.CorflagsContext context) => VisitInt32(context.int32()); - - GrammarResult ICILVisitor.VisitCustomAttrDecl(CILParser.CustomAttrDeclContext context) => VisitCustomAttrDecl(context); - public GrammarResult.Literal VisitCustomAttrDecl(CILParser.CustomAttrDeclContext context) - { - if (ContainsParserError(context)) - { - return new(null); - } - - if (context.dottedName() is { } dottedName) - { - // This is a typedef reference for a custom attribute - string alias = VisitDottedName(dottedName).Value; - var resolved = TryResolveTypedefAsCustomAttribute(alias); - if (resolved is not null) - { - EntityRegistry.CustomAttributeEntity attribute = - _entityRegistry.CreateCustomAttribute(resolved.Value.Constructor, resolved.Value.Value); - attribute.Owner = resolved.Value.Owner; - return new(attribute); - } - // Typedef not found - could report diagnostic here - return new(null); - } - if (context.customDescrWithOwner() is {} descrWithOwner) - { - // Visit the custom attribute descriptor to record it, - // but don't return it as it will already have its owner recorded. - _ = VisitCustomDescrWithOwner(descrWithOwner); - return new(null); - } - if (context.customDescr() is {} descr) - { -#nullable disable // Disable nullability to work around lack of variance. - return VisitCustomDescr(descr); -#nullable restore - } - throw new UnreachableException(); - } - - GrammarResult ICILVisitor.VisitCustomDescrInMethodBody(CILParser.CustomDescrInMethodBodyContext context) => VisitCustomDescrInMethodBody(context); - public GrammarResult.Literal VisitCustomDescrInMethodBody(CILParser.CustomDescrInMethodBodyContext context) - { - if (context.customDescrWithOwner() is {} descrWithOwner) - { - // Visit the custom attribute descriptor to record it, - // but don't return it as it will already have its owner recorded. - _ = VisitCustomDescrWithOwner(descrWithOwner); - return new(null); - } - if (context.customDescr() is {} descr) - { -#nullable disable // Disable nullability to work around lack of variance. - return VisitCustomDescr(descr); -#nullable restore - } - throw new UnreachableException(); - } - - GrammarResult ICILVisitor.VisitCustomBlobArgs(CILParser.CustomBlobArgsContext context) => VisitCustomBlobArgs(context); - public GrammarResult.FormattedBlob VisitCustomBlobArgs(CILParser.CustomBlobArgsContext context) - { - BlobBuilder blob = new(); - foreach (var item in context.serInit()) - { - VisitSerInit(item).Value.WriteContentTo(blob); - } - return new(blob); - } - - private const ushort CustomAttributeBlobFormatVersion = 1; - - GrammarResult ICILVisitor.VisitCustomBlobDescr(CILParser.CustomBlobDescrContext context) => VisitCustomBlobDescr(context); - public GrammarResult.FormattedBlob VisitCustomBlobDescr(CILParser.CustomBlobDescrContext context) - { - var blob = new BlobBuilder(); - // Custom attribute blob prolog is a 2-byte unsigned integer (ECMA-335 II.23.3) - blob.WriteUInt16(CustomAttributeBlobFormatVersion); - VisitCustomBlobArgs(context.customBlobArgs()).Value.WriteContentTo(blob); - VisitCustomBlobNVPairs(context.customBlobNVPairs()).Value.WriteContentTo(blob); - return new(blob); - } - - GrammarResult ICILVisitor.VisitCustomBlobNVPairs(CILParser.CustomBlobNVPairsContext context) => VisitCustomBlobNVPairs(context); - public GrammarResult.FormattedBlob VisitCustomBlobNVPairs(CILParser.CustomBlobNVPairsContext context) - { - var blob = new BlobBuilder(); - var fieldOrProps = context.fieldOrProp(); - var types = context.serializType(); - var names = context.dottedName(); - var values = context.serInit(); - - blob.WriteInt16((short)fieldOrProps.Length); - - for (int i = 0; i < fieldOrProps.Length; i++) - { - var fieldOrProp = fieldOrProps[i].GetText() == "field" ? CustomAttributeNamedArgumentKind.Field : CustomAttributeNamedArgumentKind.Property; - var type = VisitSerializType(types[i]).Value; - var name = VisitDottedName(names[i]).Value; - var value = VisitSerInit(values[i]).Value; - blob.WriteByte((byte)fieldOrProp); - type.WriteContentTo(blob); - blob.WriteSerializedString(name); - value.WriteContentTo(blob); - } - return new(blob); - } - - GrammarResult ICILVisitor.VisitCustomDescr(CILParser.CustomDescrContext context) => VisitCustomDescr(context); - public GrammarResult.Literal VisitCustomDescr(CILParser.CustomDescrContext context) - { - var ctor = VisitCustomType(context.customType()).Value; - BlobBuilder value; - if (context.customBlobDescr() is {} customBlobDescr) - { - value = VisitCustomBlobDescr(customBlobDescr).Value; - } - else if (context.bytes() is {} bytes) - { - value = new(); - value.WriteBytes(VisitBytes(bytes).Value); - } - else if (context.compQstring() is {} str) - { - value = new(); - value.WriteUTF8(VisitCompQstring(str).Value); - // COMPAT: We treat this string as a string-reprensentation of a blob, - // so we don't emit the null terminator. - } - else - { - value = new(); - value.WriteUInt16(CustomAttributeBlobFormatVersion); - value.WriteUInt16(0); - } - - return new(_entityRegistry.CreateCustomAttribute(ctor, value)); - } - - GrammarResult ICILVisitor.VisitCustomDescrWithOwner(CILParser.CustomDescrWithOwnerContext context) => VisitCustomDescrWithOwner(context); - public GrammarResult.Literal VisitCustomDescrWithOwner(CILParser.CustomDescrWithOwnerContext context) - { - var ctor = VisitCustomType(context.customType()).Value; - BlobBuilder value; - if (context.customBlobDescr() is {} customBlobDescr) - { - value = VisitCustomBlobDescr(customBlobDescr).Value; - } - else if (context.bytes() is {} bytes) - { - value = new(); - value.WriteBytes(VisitBytes(bytes).Value); - } - else if (context.compQstring() is {} str) - { - value = new(); - value.WriteUTF8(VisitCompQstring(str).Value); - // COMPAT: We treat this string as a string-reprensentation of a blob, - // so we don't emit the null terminator. - } - else - { - value = new(); - value.WriteUInt16(CustomAttributeBlobFormatVersion); - value.WriteUInt16(0); - } - - var attr = _entityRegistry.CreateCustomAttribute(ctor, value); - - attr.Owner = VisitOwnerType(context.ownerType()).Value; - - return new(attr); - } - - GrammarResult ICILVisitor.VisitCustomType(CILParser.CustomTypeContext context) => VisitCustomType(context); - public GrammarResult.Literal VisitCustomType(CILParser.CustomTypeContext context) => VisitMethodRef(context.methodRef()); - - public GrammarResult VisitDataDecl(CILParser.DataDeclContext context) - { - if (ContainsParserError(context)) - { - return GrammarResult.SentinelValue.Result; - } - - _ = VisitDdHead(context.ddHead()); - _ = VisitDdBody(context.ddBody()); - return GrammarResult.SentinelValue.Result; - } - public GrammarResult VisitDdBody(CILParser.DdBodyContext context) - { - if (context.ddItemList() is CILParser.DdItemListContext ddItemList) - { - _ = VisitDdItemList(ddItemList); - } - else - { - foreach (var item in context.ddItem()) - { - _ = VisitDdItem(item); - } - } - return GrammarResult.SentinelValue.Result; - } - public GrammarResult VisitDdHead(CILParser.DdHeadContext context) - { - _ = VisitTls(context.tls()); - if (context.id() is CILParser.IdContext id) - { - string name = VisitId(id).Value; - if (!_mappedFieldDataNames.ContainsKey(name)) - { - _mappedFieldDataNames.Add(name, _mappedFieldData.Count); - } - } - return GrammarResult.SentinelValue.Result; - } - public GrammarResult VisitDdItem(CILParser.DdItemContext context) - { - if (context.compQstring() is CILParser.CompQstringContext str) - { - var value = VisitCompQstring(str).Value; - _mappedFieldData.WriteUTF16(value); - return GrammarResult.SentinelValue.Result; - } - else if (context.id() is CILParser.IdContext id) - { - string name = VisitId(id).Value; - int pointerSize = VTableFixupSupport.GetPointerSize( - _options.Machine ?? Machine.I386); - _mappedFieldDataReferenceFixups.Add(new DataLabelReference( - name, - _mappedFieldData.Count, - pointerSize, - context)); - _mappedFieldData.ReserveBytes(pointerSize); - return GrammarResult.SentinelValue.Result; - } - else if (context.bytes() is CILParser.BytesContext bytes) - { - _mappedFieldData.WriteBytes(VisitBytes(bytes).Value); - return GrammarResult.SentinelValue.Result; - } - - int itemCount = VisitDdItemCount(context.ddItemCount()).Value; - - if (context.INT8() is not null) - { - _mappedFieldData.WriteBytes(context.int32() is CILParser.Int32Context int32 ? (byte)VisitInt32(int32).Value : (byte)0, itemCount); - } - else if (context.INT16() is not null) - { - for (int i = 0; i < itemCount; i++) - { - _mappedFieldData.WriteInt16(context.int32() is CILParser.Int32Context int32 ? (short)VisitInt32(int32).Value : (short)0); - } - } - else if (context.INT32_() is not null) - { - for (int i = 0; i < itemCount; i++) - { - _mappedFieldData.WriteInt32(context.int32() is CILParser.Int32Context int32 ? VisitInt32(int32).Value : 0); - } - } - else if (context.INT64_() is not null) - { - for (int i = 0; i < itemCount; i++) - { - _mappedFieldData.WriteInt64(context.int64() is CILParser.Int64Context int64 ? VisitInt64(int64).Value : 0); - } - } - else if (context.FLOAT32() is not null) - { - for (int i = 0; i < itemCount; i++) - { - _mappedFieldData.WriteSingle(context.float64() is CILParser.Float64Context float64 ? (float)VisitFloat64(float64).Value : 0); - } - } - else if (context.FLOAT64_() is not null) - { - for (int i = 0; i < itemCount; i++) - { - _mappedFieldData.WriteDouble(context.float64() is CILParser.Float64Context float64 ? VisitFloat64(float64).Value : 0); - } - } - return GrammarResult.SentinelValue.Result; - } - GrammarResult ICILVisitor.VisitDdItemCount(CILParser.DdItemCountContext context) => VisitDdItemCount(context); - public GrammarResult.Literal VisitDdItemCount(CILParser.DdItemCountContext context) => new(context.int32() is CILParser.Int32Context ? VisitInt32(context.int32()).Value : 1); - public GrammarResult VisitDdItemList(CILParser.DdItemListContext context) - { - foreach (var item in context.ddItem()) - { - VisitDdItem(item); - } - return GrammarResult.SentinelValue.Result; - } - - private readonly Stack _currentNamespace = new(); - - private readonly Stack _currentTypeDefinition = new(); - - public GrammarResult VisitDecl(CILParser.DeclContext context) - { - if (context.fieldDecl() is null && context.customAttrDecl() is null) - { - _pendingClassCustomAttributeOwner = null; - } - - bool hasNestedDeclarations = - context.nameSpaceHead() is not null - || context.classHead() is not null - || context.methodHead() is not null; - if (!hasNestedDeclarations && ContainsParserError(context)) - { - return GrammarResult.SentinelValue.Result; - } - - if (context.nameSpaceHead() is CILParser.NameSpaceHeadContext ns) - { - if (ContainsParserError(ns)) - { - return GrammarResult.SentinelValue.Result; - } - - string namespaceName = VisitNameSpaceHead(ns).Value; - string? outer = _currentNamespace.PeekOrDefault(); - _currentNamespace.Push(string.IsNullOrEmpty(outer) ? namespaceName : $"{outer}.{namespaceName}"); - VisitDecls(context.decls()); - _currentNamespace.Pop(); - _pendingClassCustomAttributeOwner = null; - return GrammarResult.SentinelValue.Result; - } - if (context.classHead() is CILParser.ClassHeadContext classHead) - { - if (ContainsParserError(classHead)) - { - return GrammarResult.SentinelValue.Result; - } - - if (context.classDecls() is not CILParser.ClassDeclsContext classDecls) - { - return GrammarResult.SentinelValue.Result; - } - - _currentTypeDefinition.Push(VisitClassHead(classHead).Value); - VisitClassDecls(classDecls); - _currentTypeDefinition.Pop(); - _pendingClassCustomAttributeOwner = null; - return GrammarResult.SentinelValue.Result; - } - if (context.methodHead() is CILParser.MethodHeadContext methodHead) - { - if (ContainsParserError(methodHead)) - { - return GrammarResult.SentinelValue.Result; - } - - if (context.methodDecls() is not CILParser.MethodDeclsContext methodDecls) - { - return GrammarResult.SentinelValue.Result; - } - - _currentMethod = new(VisitMethodHead(methodHead).Value); - VisitMethodDecls(methodDecls); - if (_currentMethod.AllLocals.Count > 0) - { - var localsSig = new BlobBuilder(); - var encoder = new BlobEncoder(localsSig); - var localsEncoder = encoder.LocalVariableSignature(_currentMethod.AllLocals.Count); - foreach (var local in _currentMethod.AllLocals) - { - local.SignatureBlob.WriteContentTo(localsEncoder.AddVariable().Builder); - } - _currentMethod.Definition.LocalsSignature = _entityRegistry.GetOrCreateStandaloneSignature(localsSig); - } - _currentMethod = null; - return GrammarResult.SentinelValue.Result; - } - if (context.fieldDecl() is { } fieldDecl) - { - _ = VisitFieldDecl(fieldDecl); - return GrammarResult.SentinelValue.Result; - } - if (context.dataDecl() is { } dataDecl) - { - _ = VisitDataDecl(dataDecl); - return GrammarResult.SentinelValue.Result; - } - if (context.vtableDecl() is { } vtable) - { - _ = VisitVtableDecl(vtable); - return GrammarResult.SentinelValue.Result; - } - if (context.vtfixupDecl() is { } vtFixup) - { - _ = VisitVtfixupDecl(vtFixup); - return GrammarResult.SentinelValue.Result; - } - if (context.extSourceSpec() is { } extSourceSpec) - { - _ = VisitExtSourceSpec(extSourceSpec); - return GrammarResult.SentinelValue.Result; - } - if (context.fileDecl() is { } fileDecl) - { - _ = VisitFileDecl(fileDecl); - return GrammarResult.SentinelValue.Result; - } - if (context.assemblyBlock() is { } assemblyBlock) - { - _ = VisitAssemblyBlock(assemblyBlock); - return GrammarResult.SentinelValue.Result; - } - if (context.assemblyRefHead() is { } assemblyRef) - { - var asmRef = VisitAssemblyRefHead(assemblyRef).Value; - _currentAssemblyOrRef = asmRef; - foreach (var decl in context.assemblyRefDecls().assemblyRefDecl()) - { - _ = VisitAssemblyRefDecl(decl); - } - _currentAssemblyOrRef = null; - } - if (context.exptypeHead() is { } exptypeHead) - { - var (attrs, dottedName) = VisitExptypeHead(exptypeHead).Value; - (string typeNamespace, string name) = NameHelpers.SplitDottedNameToNamespaceAndName(dottedName); - var (impl, typeDefId, customAttrs) = VisitExptypeDecls(context.exptypeDecls()).Value; - if (impl is null) - { - // COMPAT: Like native ilasm, warn and skip the exported type when implementation is not specified - ReportWarning(DiagnosticIds.MissingExportedTypeImplementation, - string.Format(DiagnosticMessageTemplates.MissingExportedTypeImplementation, dottedName), - exptypeHead); - return GrammarResult.SentinelValue.Result; - } - var exp = _entityRegistry.GetOrCreateExportedType(impl, typeNamespace, name, exp => - { - exp.Attributes = attrs; - exp.TypeDefinitionId = typeDefId; - }); - foreach (var attr in customAttrs) - { - attr.Owner ??= exp; - } - return GrammarResult.SentinelValue.Result; - } - if (context.manifestResHead() is { } manifestResHead) - { - var (name, alias, flags) = VisitManifestResHead(manifestResHead).Value; - var (implementation, offset, attrs) = VisitManifestResDecls(context.manifestResDecls()).Value; - if (implementation is null) - { - offset = (uint)_manifestResources.Count; - byte[] resourceData = _resourceLocator(alias); - if (resourceData is null) - { - ReportError(DiagnosticIds.FileNotFound, - string.Format(DiagnosticMessageTemplates.FileNotFound, alias), - context); - } - else - { - // ECMA-335: Each resource is prefixed with a 4-byte length - _manifestResources.WriteInt32(resourceData.Length); - _manifestResources.WriteBytes(resourceData); - } - } - var res = _entityRegistry.CreateManifestResource(name, offset); - res.Attributes = flags; - res.Implementation = implementation; - foreach (var attr in attrs) - { - attr.Owner ??= res; - } - return GrammarResult.SentinelValue.Result; - } - if (context.moduleHead() is { } moduleHead) - { - if (moduleHead.dottedName() is null) - { - _entityRegistry.Module.Name = null; - } - else if (moduleHead.ChildCount == 2) - { - _entityRegistry.Module.Name = VisitDottedName(moduleHead.dottedName()).Value; - } - else - { - var name = VisitDottedName(moduleHead.dottedName()).Value; - _entityRegistry.GetOrCreateModuleReference(name, _ => { }); - } - return GrammarResult.SentinelValue.Result; - } - if (context.subsystem() is { } subsystem) - { - _subsystem = (Subsystem)VisitSubsystem(subsystem).Value; - } - if (context.corflags() is { } corflags) - { - _corflags = (CorFlags)VisitCorflags(corflags).Value; - } - if (context.alignment() is { } alignment) - { - _alignment = VisitAlignment(alignment).Value; - } - if (context.imagebase() is { } imagebase) - { - _imageBase = VisitImagebase(imagebase).Value; - } - if (context.stackreserve() is { } stackreserve) - { - _stackReserve = VisitStackreserve(stackreserve).Value; - } - if (context.languageDecl() is { } languageDecl) - { - VisitLanguageDecl(languageDecl); - } - if (context.customAttrDecl() is { } topLevelCustomAttr) - { - // Top-level custom attribute owned by the module (matching native ilasm behavior) - if (VisitCustomAttrDecl(topLevelCustomAttr).Value is { } customAttr) - { - customAttr.Owner ??= (EntityRegistry.EntityBase?)_pendingClassCustomAttributeOwner ?? _entityRegistry.Module; - } - } - if (context.secDecl() is { } topSecDecl) - { - var declarativeSecurity = VisitSecDecl(topSecDecl).Value; - declarativeSecurity?.Parent = _entityRegistry.Assembly; - } - if (context.typedefDecl() is { } typedefDecl) - { - VisitTypedefDecl(typedefDecl); - } - if (context.typelist() is { } typelist) - { - foreach (var name in typelist.className()) - { - _ = VisitClassName(name); - } - } - if (context.mscorlib() is { } mscorlib) - { - VisitMscorlib(mscorlib); - } - return GrammarResult.SentinelValue.Result; - } - - public GrammarResult VisitDecls(CILParser.DeclsContext context) - { - foreach (var decl in context.decl()) - { - _ = VisitDecl(decl); - } - return GrammarResult.SentinelValue.Result; - } - - GrammarResult ICILVisitor.VisitDottedName(CILParser.DottedNameContext context) - { - return VisitDottedName(context); - } - - public static GrammarResult.String VisitDottedName(CILParser.DottedNameContext context) - { - if (context.DOTTEDNAME() is not null) - { - return new(context.GetText()); - } - - return new(string.Join( - ".", - context.dottedNamePart().Select(part => - part.SQSTRING() is null - ? part.GetText() - : StringHelpers.ParseQuotedString(part.GetText())))); - } - - GrammarResult ICILVisitor.VisitDottedNamePart(CILParser.DottedNamePartContext context) => throw new UnreachableException(); - GrammarResult ICILVisitor.VisitElementType(CILParser.ElementTypeContext context) => VisitElementType(context); - public GrammarResult.FormattedBlob VisitElementType(CILParser.ElementTypeContext context) - { - BlobBuilder blob = new(5); - if (context.OBJECT() is not null) - { - blob.WriteByte((byte)SignatureTypeCode.Object); - } - else if (context.className() is CILParser.ClassNameContext className) - { - EntityRegistry.TypeEntity typeEntity = VisitClassName(className).Value; - if (context.VALUE() is not null || context.VALUETYPE() is not null) - { - // Check for well-known value types that should use primitive type codes - if (TryGetPrimitiveTypeCode(typeEntity, isValueType: true) is { } vtPrimCode) - { - blob.WriteByte((byte)vtPrimCode); - } - else - { - blob.WriteByte((byte)SignatureTypeKind.ValueType); - blob.WriteTypeEntity(typeEntity); - } - } - else - { - // Check for well-known class types that should use primitive type codes - if (TryGetPrimitiveTypeCode(typeEntity, isValueType: false) is { } clsPrimCode) - { - blob.WriteByte((byte)clsPrimCode); - } - else - { - blob.WriteByte((byte)SignatureTypeKind.Class); - blob.WriteTypeEntity(typeEntity); - } - } - } - else if (context.callConv() is CILParser.CallConvContext callConv) - { - // Emit function pointer signature. - blob.WriteByte((byte)SignatureTypeCode.FunctionPointer); - byte sigCallConv = VisitCallConv(callConv).Value; - blob.WriteByte(sigCallConv); - var signatureArgs = VisitSigArgs(context.sigArgs()).Value; - int numArgs = signatureArgs.Count(arg => !arg.IsSentinel); - blob.WriteCompressedInteger(numArgs); - blob.LinkSuffix(VisitType(context.type()).Value); - foreach (var arg in signatureArgs) - { - blob.LinkSuffix(arg.SignatureBlob); - } - } - else if (context.ELLIPSIS() is not null) - { - blob.WriteByte((byte)SignatureTypeCode.Sentinel); - blob.LinkSuffix(VisitType(context.type()).Value); - } - else if (context.METHOD_TYPE_PARAMETER() is not null) - { - if (context.int32() is CILParser.Int32Context int32) - { - // COMPAT: Always write a reference to a generic method parameter by index - // even if we aren't in a method or the index is out of range. We want to be able to write invalid IL like this. - blob.WriteByte((byte)SignatureTypeCode.GenericMethodParameter); - blob.WriteCompressedInteger(VisitInt32(int32).Value); - } - else - { - string dottedName = VisitDottedName(context.dottedName()).Value; - if (_currentMethod is null) - { - ReportError(DiagnosticIds.MethodTypeParameterOutsideMethod, string.Format(DiagnosticMessageTemplates.MethodTypeParameterOutsideMethod, dottedName), context); - blob.WriteByte((byte)SignatureTypeCode.GenericMethodParameter); - blob.WriteCompressedInteger(0); - } - else - { - blob.WriteByte((byte)SignatureTypeCode.GenericMethodParameter); - bool foundParameter = false; - for (int i = 0; i < _currentMethod.Definition.GenericParameters.Count; i++) - { - EntityRegistry.GenericParameterEntity? genericParameter = _currentMethod.Definition.GenericParameters[i]; - if (genericParameter.Name == dottedName) - { - foundParameter = true; - blob.WriteCompressedInteger(i); - break; - } - } - if (!foundParameter) - { - // BREAK-COMPAT: ILASM would silently emit an invalid signature when a method uses an invalid method type parameter but doesn't have method type parameters. - // The signature used completely invalid undocumented codes (that were really sentinel values for how ilasm later detected errors due to how the parsing model worked with a YACC-based parser) - // and when a method had no type parameters, it didn't run the code to process out these values and emit errors. - // This seems like a scenario that doesn't need to be brought forward. - // Instead, we'll just emit a reference to "generic method parameter" 0 and report an error. - - ReportError(DiagnosticIds.GenericParameterNotFound, string.Format(DiagnosticMessageTemplates.GenericParameterNotFound, dottedName), context); - blob.WriteCompressedInteger(0); - } - } - } - } - else if (context.TYPE_PARAMETER() is not null) - { - if (context.int32() is CILParser.Int32Context int32) - { - // COMPAT: Always write a reference to a generic type parameter by index - // even if we aren't in a type or the index is out of range. We want to be able to write invalid IL like this. - blob.WriteByte((byte)SignatureTypeCode.GenericTypeParameter); - blob.WriteCompressedInteger(VisitInt32(int32).Value); - } - else - { - string dottedName = VisitDottedName(context.dottedName()).Value; - if (_currentTypeDefinition.Count == 0) - { - ReportError(DiagnosticIds.TypeParameterOutsideType, string.Format(DiagnosticMessageTemplates.TypeParameterOutsideType, dottedName), context); - blob.WriteByte((byte)SignatureTypeCode.GenericTypeParameter); - blob.WriteCompressedInteger(0); - } - else - { - blob.WriteByte((byte)SignatureTypeCode.GenericTypeParameter); - bool foundParameter = false; - for (int i = 0; i < _currentTypeDefinition.Peek().GenericParameters.Count; i++) - { - EntityRegistry.GenericParameterEntity? genericParameter = _currentTypeDefinition.Peek().GenericParameters[i]; - if (genericParameter.Name == dottedName) - { - foundParameter = true; - blob.WriteCompressedInteger(i); - break; - } - } - if (!foundParameter) - { - // BREAK-COMPAT: ILASM would silently emit an invalid signature when a type uses an invalid method type parameter but doesn't have any type parameters. - // The signature used completely invalid undocumented codes (that were really sentinel values for how ilasm later detected errors due to how the parsing model worked with a YACC-based parser) - // and when a method had no type parameters, it didn't run the code to process out these values and emit errors. - // This seems like a scenario that doesn't need to be brought forward. - // Instead, we'll just emit a reference to "generic method parameter" 0 and report an error. - - ReportError(DiagnosticIds.GenericParameterNotFound, string.Format(DiagnosticMessageTemplates.GenericParameterNotFound, dottedName), context); - blob.WriteCompressedInteger(0); - } - } - } - } - else if (context.TYPEDREF() is not null) - { - blob.WriteByte((byte)SignatureTypeCode.TypedReference); - } - else if (context.VOID() is not null) - { - blob.WriteByte((byte)SignatureTypeCode.Void); - } - else if (context.nativeInt() is not null) - { - blob.WriteByte((byte)SignatureTypeCode.IntPtr); - } - else if (context.nativeUint() is not null) - { - blob.WriteByte((byte)SignatureTypeCode.UIntPtr); - } - else if (context.simpleType() is CILParser.SimpleTypeContext simpleType) - { - blob.WriteByte((byte)VisitSimpleType(simpleType).Value); - } - else if (context.dottedName() is CILParser.DottedNameContext dottedName) - { - // Typedef reference - resolve and write the type blob - string alias = VisitDottedName(dottedName).Value; - var resolved = TryResolveTypedefAsTypeBlob(alias); - if (resolved is not null) - { - // Copy the content to avoid modifying the stored blob - resolved.WriteContentTo(blob); - } - else - { - ReportError(DiagnosticIds.TypedefNotFound, string.Format(DiagnosticMessageTemplates.TypedefNotFound, alias), context); - } - } - else - { - throw new UnreachableException(); - } - return new(blob); - } - - public GrammarResult VisitErrorNode(IErrorNode node) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - - // esHead is '.line' or '#line' - this is just the keyword, actual parsing is in VisitExtSourceSpec. - public GrammarResult VisitEsHead(CILParser.EsHeadContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - - GrammarResult ICILVisitor.VisitEventAttr(CILParser.EventAttrContext context) => VisitEventAttr(context); - public GrammarResult.Flag VisitEventAttr(CILParser.EventAttrContext context) - { - return context.GetText() switch - { - "specialname" => new(EventAttributes.SpecialName), - "rtspecialname" => new(0), // COMPAT: Ignore - _ => throw new UnreachableException(), - }; - } - - GrammarResult ICILVisitor.VisitEventDecl(CILParser.EventDeclContext context) => VisitEventDecl(context); - public GrammarResult.Literal<(MethodSemanticsAttributes, EntityRegistry.EntityBase)?> VisitEventDecl(CILParser.EventDeclContext context) - { - if (context.ChildCount != 2) - { - return new(null); - } - string accessor = context.GetChild(0).GetText(); - EntityRegistry.EntityBase memberReference = VisitMethodRef(context.methodRef()).Value; - MethodSemanticsAttributes methodSemanticsAttributes = accessor switch - { - ".addon" => MethodSemanticsAttributes.Adder, - ".removeon" => MethodSemanticsAttributes.Remover, - ".fire" => MethodSemanticsAttributes.Raiser, - ".other" => MethodSemanticsAttributes.Other, - _ => throw new UnreachableException(), - }; - return new((methodSemanticsAttributes, memberReference)); - } - - GrammarResult ICILVisitor.VisitEventDecls(CILParser.EventDeclsContext context) => VisitEventDecls(context); - public GrammarResult.Sequence<(MethodSemanticsAttributes, EntityRegistry.EntityBase)> VisitEventDecls(CILParser.EventDeclsContext context) - => new( - context.eventDecl() - .Select(decl => VisitEventDecl(decl).Value) - .Where(decl => decl is not null) - .Select(decl => decl!.Value).ToImmutableArray()); - - GrammarResult ICILVisitor.VisitEventHead(CILParser.EventHeadContext context) => VisitEventHead(context); - public GrammarResult.Literal VisitEventHead(CILParser.EventHeadContext context) - { - string name = VisitDottedName(context.dottedName()).Value; - EventAttributes eventAttributes = context.eventAttr().Select(attr => VisitEventAttr(attr).Value).Aggregate((EventAttributes)0, (a, b) => a | b); - EntityRegistry.TypeEntity? eventType = context.typeSpec() is { } typeSpec - ? VisitTypeSpec(typeSpec).Value - : null; - return new(new EntityRegistry.EventEntity(eventAttributes, eventType, name)); - } - - public GrammarResult VisitExportHead(CILParser.ExportHeadContext context) => throw new NotImplementedException("Obsolete syntax"); - GrammarResult ICILVisitor.VisitExptAttr(CILParser.ExptAttrContext context) => VisitExptAttr(context); - public static GrammarResult.Flag VisitExptAttr(CILParser.ExptAttrContext context) - { - return context.GetText() switch - { - "private" => new(TypeAttributes.NotPublic, TypeAttributes.VisibilityMask), - "public" => new(TypeAttributes.Public, TypeAttributes.VisibilityMask), - "forwarder" => new(TypeAttributes.Forwarder), - "nestedpublic" => new(TypeAttributes.NestedPublic, TypeAttributes.VisibilityMask), - "nestedprivate" => new(TypeAttributes.NestedPrivate, TypeAttributes.VisibilityMask), - "nestedfamily" => new(TypeAttributes.NestedFamily, TypeAttributes.VisibilityMask), - "nestedassembly" => new(TypeAttributes.NestedAssembly, TypeAttributes.VisibilityMask), - "nestedfamandassem" => new(TypeAttributes.NestedFamANDAssem, TypeAttributes.VisibilityMask), - "nestedfamorassem" => new(TypeAttributes.NestedFamORAssem, TypeAttributes.VisibilityMask), - _ => throw new UnreachableException(), - }; - } - - // Type exports and forwarders are implemented via VisitExptypeDecls - public GrammarResult VisitExptypeDecl(CILParser.ExptypeDeclContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - - GrammarResult ICILVisitor.VisitExptypeDecls(CILParser.ExptypeDeclsContext context) => VisitExptypeDecls(context); - public GrammarResult.Literal<(EntityRegistry.EntityBase? implementation, int typedefId, ImmutableArray attrs)> VisitExptypeDecls(CILParser.ExptypeDeclsContext context) - { - // COMPAT: The following order specifies the precedence of the various export kinds. - // File, Assembly, Class (enclosing type), invalid token. - // We'll process through all of the options here and then return the one that is valid. - // We'll also record custom attributes here. - EntityRegistry.EntityBase? implementationEntity = null; - int typedefId = 0; - var attrs = ImmutableArray.CreateBuilder(); - var declarations = context.exptypeDecl(); - for (int i = 0; i < declarations.Length; i++) - { - if (declarations[i].customAttrDecl() is { } attr) - { - if (VisitCustomAttrDecl(attr).Value is EntityRegistry.CustomAttributeEntity customAttribute) - { - attrs.Add(customAttribute); - } - continue; - } - if (declarations[i].mdtoken() is { } mdToken) - { - var entity = VisitMdtoken(mdToken).Value; - if (entity is null or EntityRegistry.FakeTypeEntity) - { - ReportError(DiagnosticIds.InvalidMetadataToken, DiagnosticMessageTemplates.InvalidMetadataToken, declarations[i]); - } - implementationEntity = ResolveBetterEntity(entity); - continue; - } - string kind = declarations[i].GetText(); - if (kind.StartsWith(".file")) - { - string fileName = VisitDottedName(declarations[i].dottedName()).Value; - implementationEntity = _entityRegistry.FindFile(fileName); - if (implementationEntity is null) - { - ReportError(DiagnosticIds.FileNotFound, string.Format(DiagnosticMessageTemplates.FileNotFound, fileName), declarations[i]); - } - } - else if (kind.StartsWith(".assembly")) - { - string assemblyName = VisitDottedName(declarations[i].dottedName()).Value; - implementationEntity = _entityRegistry.FindAssemblyReference(assemblyName); - if (implementationEntity is null) - { - ReportError(DiagnosticIds.AssemblyNotFound, string.Format(DiagnosticMessageTemplates.AssemblyNotFound, assemblyName), declarations[i]); - } - } - else if (kind.StartsWith(".class")) - { - if (declarations[i].int32() is CILParser.Int32Context int32) - { - typedefId = VisitInt32(int32).Value; - } - else - { - _ = VisitSlashedName(declarations[i].slashedName()); - var containing = ResolveExportedType(declarations[i].slashedName()); - if (containing is null) - { - ReportError(DiagnosticIds.ExportedTypeNotFound, string.Format(DiagnosticMessageTemplates.ExportedTypeNotFound, declarations[i].slashedName().GetText()), declarations[i]); - } - else - { - implementationEntity = ResolveBetterEntity(containing); - } - } - } - } - - return new((implementationEntity, typedefId, attrs.ToImmutable())); - - EntityRegistry.EntityBase? ResolveBetterEntity(EntityRegistry.EntityBase? newImplementation) - { - return (implementationEntity, newImplementation) switch - { - (null, _) => newImplementation, - (_, null) => implementationEntity, - (_, EntityRegistry.FileEntity) => newImplementation, - (EntityRegistry.FileEntity, _) => implementationEntity, - (_, EntityRegistry.AssemblyEntity) => newImplementation, - (EntityRegistry.AssemblyEntity, _) => implementationEntity, - (_, EntityRegistry.TypeEntity) => newImplementation, - (EntityRegistry.TypeEntity, _) => implementationEntity, - _ => throw new UnreachableException(), - }; - } - - // Resolve ExportedType reference - EntityRegistry.ExportedTypeEntity? ResolveExportedType(CILParser.SlashedNameContext slashedName) - { - TypeName typeName = VisitSlashedName(slashedName).Value; - if (typeName.ContainingTypeName is null) - { - // Check for typedef - typedefs resolve to TypeEntity, not ExportedTypeEntity - // so we skip the typedef check for exported type resolution - } - Stack containingTypes = new(); - for (TypeName? containingType = typeName; containingType is not null; containingType = containingType.ContainingTypeName) - { - containingTypes.Push(containingType); - } - EntityRegistry.ExportedTypeEntity? exportedType = null; - while (containingTypes.Count != 0) - { - TypeName containingType = containingTypes.Pop(); - - (string ns, string name) = NameHelpers.SplitDottedNameToNamespaceAndName(containingType.DottedName); - - exportedType = _entityRegistry.FindExportedType( - exportedType, - ns, - name); - - if (exportedType is null) - { - ReportError(DiagnosticIds.ExportedTypeNotFound, string.Format(DiagnosticMessageTemplates.ExportedTypeNotFound, containingType.DottedName), slashedName); - return null; - } - } - - return exportedType!; - } - } - GrammarResult ICILVisitor.VisitExptypeHead(CILParser.ExptypeHeadContext context) => VisitExptypeHead(context); - public GrammarResult.Literal<(TypeAttributes attrs, string dottedName)> VisitExptypeHead(CILParser.ExptypeHeadContext context) - { - var attrs = context.exptAttr().Select(VisitExptAttr).Aggregate((TypeAttributes)0, (a, b) => a | b); - return new((attrs, VisitDottedName(context.dottedName()).Value)); - } - GrammarResult ICILVisitor.VisitExtendsClause(CILParser.ExtendsClauseContext context) => VisitExtendsClause(context); - - public GrammarResult.Literal VisitExtendsClause(CILParser.ExtendsClauseContext context) - { - if (context.typeSpec() is CILParser.TypeSpecContext typeSpec) - { - return new(VisitTypeSpec(typeSpec).Value); - } - else - { - return new(null); - } - } - - public GrammarResult VisitExtSourceSpec(CILParser.ExtSourceSpecContext context) - { - // Parse .line directive to extract source location info - // Grammar: esHead int32 (',' int32)? (':' int32 (',' int32)?)? (SQSTRING | QSTRING)? - var int32s = context.int32(); - var sqstring = context.SQSTRING(); - var qstring = context.QSTRING(); - - // Extract line/column info based on number of int32s - int startLine = 0, endLine = 0, startColumn = 0, endColumn = 0; - - if (int32s.Length >= 1) - { - startLine = VisitInt32(int32s[0]).Value; - endLine = startLine; - } - if (int32s.Length >= 2) - { - // Could be endLine or startColumn depending on separator - string contextText = context.GetText(); - if (contextText.Contains(',') && contextText.IndexOf(',') < contextText.IndexOf(':')) - { - // Format: startLine,endLine:... - endLine = VisitInt32(int32s[1]).Value; - } - else - { - // Format: line:column... - startColumn = VisitInt32(int32s[1]).Value; - endColumn = startColumn; - } - } - if (int32s.Length >= 3) - { - startColumn = VisitInt32(int32s[2]).Value; - endColumn = startColumn; - } - if (int32s.Length >= 4) - { - endColumn = VisitInt32(int32s[3]).Value; - } - - // Extract filename if present - string? filePath = null; - if (sqstring is not null) - { - filePath = StringHelpers.ParseQuotedString(sqstring.GetText()); - } - else if (qstring is not null) - { - filePath = StringHelpers.ParseQuotedString(qstring.GetText()); - } - - // Update current document path if specified - if (filePath is not null) - { - _currentDocumentPath = filePath; - } - - // If we're in a method, record the sequence point - if (_currentMethod is not null && _currentDocumentPath is not null) - { - int ilOffset = _currentMethod.Definition.MethodBody.Offset; - _currentMethod.Definition.DebugInfo.DocumentPath ??= _currentDocumentPath; - - // 0xFEEFEE indicates a hidden sequence point - if (startLine == 0xFEEFEE) - { - AddSequencePoint(EntityRegistry.SequencePoint.Hidden(ilOffset)); - } - else - { - if (endLine == startLine && endColumn == startColumn) - { - endColumn++; - } - - AddSequencePoint( - new EntityRegistry.SequencePoint( - ilOffset, - startLine, - startColumn, - endLine, - endColumn)); - } - - void AddSequencePoint(EntityRegistry.SequencePoint sequencePoint) - { - List sequencePoints = - _currentMethod.Definition.DebugInfo.SequencePoints; - if (sequencePoints.Count > 0 && sequencePoints[^1].ILOffset == ilOffset) - { - sequencePoints[^1] = sequencePoint; - } - else - { - sequencePoints.Add(sequencePoint); - } - } - } - - return GrammarResult.SentinelValue.Result; - } - - GrammarResult ICILVisitor.VisitF32seq(CILParser.F32seqContext context) => VisitF32seq(context); - public GrammarResult.FormattedBlob VisitF32seq(CILParser.F32seqContext context) - { - var builder = ImmutableArray.CreateBuilder(context.ChildCount); - - foreach (var item in context.children ?? []) - { - builder.Add((float)(item switch - { - CILParser.Int32Context int32 => VisitInt32(int32).Value, - CILParser.Float64Context float64 => VisitFloat64(float64).Value, - _ => throw new UnreachableException() - })); - } - return new(builder.MoveToImmutable().SerializeSequence()); - } - GrammarResult ICILVisitor.VisitF64seq(CILParser.F64seqContext context) => VisitF64seq(context); - public GrammarResult.FormattedBlob VisitF64seq(CILParser.F64seqContext context) - { - var builder = ImmutableArray.CreateBuilder(context.ChildCount); - - foreach (var item in context.children ?? []) - { - builder.Add((double)(item switch - { - CILParser.Int64Context int64 => VisitInt64(int64).Value, - CILParser.Float64Context float64 => VisitFloat64(float64).Value, - _ => throw new UnreachableException() - })); - } - return new(builder.MoveToImmutable().SerializeSequence()); - } - - public GrammarResult VisitFaultClause(CILParser.FaultClauseContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - - GrammarResult ICILVisitor.VisitFieldAttr(CILParser.FieldAttrContext context) => VisitFieldAttr(context); - public GrammarResult.Flag VisitFieldAttr(CILParser.FieldAttrContext context) - { - if (context.int32() is { } int32) - { - return new((FieldAttributes)VisitInt32(int32).Value, ShouldAppend: false); - } - - return context.GetText() switch - { - "static" => new(FieldAttributes.Static), - "public" => new(FieldAttributes.Public, FieldAttributes.FieldAccessMask), - "private" => new(FieldAttributes.Private, FieldAttributes.FieldAccessMask), - "family" => new(FieldAttributes.Family, FieldAttributes.FieldAccessMask), - "initonly" => new(FieldAttributes.InitOnly), - "rtspecialname" => new(FieldAttributes.RTSpecialName), - "specialname" => new(FieldAttributes.SpecialName), - "assembly" => new(FieldAttributes.Assembly, FieldAttributes.FieldAccessMask), - "famandassem" => new(FieldAttributes.FamANDAssem, FieldAttributes.FieldAccessMask), - "famorassem" => new(FieldAttributes.FamORAssem, FieldAttributes.FieldAccessMask), - "privatescope" => new(FieldAttributes.PrivateScope, FieldAttributes.FieldAccessMask), - "literal" => new(FieldAttributes.Literal), -#pragma warning disable SYSLIB0050 // FieldAttributes.NotSeralized is obsolete - "notserialized" => new(FieldAttributes.NotSerialized), -#pragma warning restore SYSLIB0050 // FieldAttributes.NotSeralized is obsolete - "volatile" => new(0), // COMPAT: volatile is not a field attribute; accepted for compatibility - _ => throw new UnreachableException() - }; - } - GrammarResult ICILVisitor.VisitFieldDecl(CILParser.FieldDeclContext context) => VisitFieldDecl(context); - public GrammarResult VisitFieldDecl(CILParser.FieldDeclContext context) - { - if (ContainsParserError(context)) - { - return GrammarResult.SentinelValue.Result; - } - - var fieldAttrs = context.fieldAttr().Select(VisitFieldAttr).Aggregate((FieldAttributes)0, (a, b) => a | b); - // COMPAT: Native ilasm implicitly adds SpecialName when RTSpecialName is set - if (fieldAttrs.HasFlag(FieldAttributes.RTSpecialName)) - { - fieldAttrs |= FieldAttributes.SpecialName; - } - var fieldType = VisitType(context.type()).Value; - var marshalBlobs = context.marshalBlob(); - var marshalBlob = marshalBlobs.Length > 0 ? VisitMarshalBlob(marshalBlobs[marshalBlobs.Length - 1]).Value : null; - string name = VisitDottedName(context.dottedName()).Value; - var rvaOffset = VisitAtOpt(context.atOpt()).Value; - var fieldOffset = VisitRepeatOpt(context.repeatOpt()).Value; - var constantValue = VisitInitOpt(context.initOpt()).Value; - - var signature = new BlobEncoder(new BlobBuilder()); - _ = signature.Field(); - fieldType.WriteContentTo(signature.Builder); - - var field = EntityRegistry.CreateUnrecordedFieldDefinition(fieldAttrs, _currentTypeDefinition.PeekOrDefault() ?? _entityRegistry.ModuleType, name, signature.Builder); - _pendingClassCustomAttributeOwner = field; - - if (field is not null) - { - field.MarshallingDescriptor = marshalBlob; - field.DataDeclarationName = rvaOffset; - field.Offset = fieldOffset; - if (constantValue is not NoConstantSentinel) - { - field.ConstantValue = constantValue; - field.HasConstant = true; - } - } - - return GrammarResult.SentinelValue.Result; - } - - GrammarResult ICILVisitor.VisitFieldInit(CILParser.FieldInitContext context) => VisitFieldInit(context); - public GrammarResult.Literal VisitFieldInit(CILParser.FieldInitContext context) - { - // fieldInit: fieldSerInit | compQstring | NULLREF; - if (context.NULLREF() is not null) - { - return new(null); - } - if (context.compQstring() is CILParser.CompQstringContext compQstring) - { - return new(VisitCompQstring(compQstring).Value); - } - if (context.fieldSerInit() is CILParser.FieldSerInitContext fieldSerInit) - { - // fieldSerInit returns a blob with type byte prefix - extract the actual value - var blob = VisitFieldSerInit(fieldSerInit).Value; - return new(ExtractConstantFromSerInit(blob)); - } - return new(null); - } - - private static object? ExtractConstantFromSerInit(BlobBuilder blob) - { - var bytes = blob.ToImmutableArray(); - if (bytes.Length == 0) - { - return null; - } - - var typeCode = (SerializationTypeCode)bytes[0]; - var valueBytes = bytes.AsSpan().Slice(1); - - return typeCode switch - { - SerializationTypeCode.Boolean => valueBytes.Length >= 1 && valueBytes[0] != 0, - SerializationTypeCode.Char => valueBytes.Length >= 2 ? BitConverter.ToChar(valueBytes) : '\0', - SerializationTypeCode.SByte => valueBytes.Length >= 1 ? (sbyte)valueBytes[0] : (sbyte)0, - SerializationTypeCode.Byte => valueBytes.Length >= 1 ? valueBytes[0] : (byte)0, - SerializationTypeCode.Int16 => valueBytes.Length >= 2 ? BitConverter.ToInt16(valueBytes) : (short)0, - SerializationTypeCode.UInt16 => valueBytes.Length >= 2 ? BitConverter.ToUInt16(valueBytes) : (ushort)0, - SerializationTypeCode.Int32 => valueBytes.Length >= 4 ? BitConverter.ToInt32(valueBytes) : 0, - SerializationTypeCode.UInt32 => valueBytes.Length >= 4 ? BitConverter.ToUInt32(valueBytes) : 0u, - SerializationTypeCode.Int64 => valueBytes.Length >= 8 ? BitConverter.ToInt64(valueBytes) : 0L, - SerializationTypeCode.UInt64 => valueBytes.Length >= 8 ? BitConverter.ToUInt64(valueBytes) : 0uL, - SerializationTypeCode.Single => valueBytes.Length >= 4 ? BitConverter.ToSingle(valueBytes) : 0f, - SerializationTypeCode.Double => valueBytes.Length >= 8 ? BitConverter.ToDouble(valueBytes) : 0d, - SerializationTypeCode.String => Encoding.Unicode.GetString(valueBytes), - // Type is encoded as a SerString (compressed length followed by UTF-8 type name) - SerializationTypeCode.Type => ExtractSerString(valueBytes), - // SZArray: element type followed by element count followed by elements - // Return the raw bytes for arrays since we can't easily represent them - SerializationTypeCode.SZArray => valueBytes.ToArray(), - // TaggedObject: type tag followed by value - return raw bytes - SerializationTypeCode.TaggedObject => valueBytes.ToArray(), - // Enum: type name (SerString) followed by underlying value - return raw bytes - SerializationTypeCode.Enum => valueBytes.ToArray(), - // For unknown/future type codes, return the raw bytes to preserve the data - _ => bytes.AsSpan().ToArray() - }; - } - - /// - /// Extracts a SerString (compressed length + UTF-8 string) from the given bytes. - /// Returns null if the first byte is 0xFF (null string marker). - /// - private static string? ExtractSerString(ReadOnlySpan bytes) - { - if (bytes.Length == 0) - { - return null; - } - // 0xFF indicates null string - if (bytes[0] == 0xFF) - { - return null; - } - // Decode compressed length - int length; - int bytesRead; - if ((bytes[0] & 0x80) == 0) - { - // 1-byte length - length = bytes[0]; - bytesRead = 1; - } - else if ((bytes[0] & 0xC0) == 0x80) - { - // 2-byte length - if (bytes.Length < 2) return null; - length = ((bytes[0] & 0x3F) << 8) | bytes[1]; - bytesRead = 2; - } - else - { - // 4-byte length - if (bytes.Length < 4) return null; - length = ((bytes[0] & 0x1F) << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3]; - bytesRead = 4; - } - if (bytes.Length < bytesRead + length) - { - return null; - } - return Encoding.UTF8.GetString(bytes.Slice(bytesRead, length)); - } - - public GrammarResult VisitFieldOrProp(CILParser.FieldOrPropContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - - GrammarResult ICILVisitor.VisitFieldRef(CILParser.FieldRefContext context) => VisitFieldRef(context); - public GrammarResult.Literal VisitFieldRef(CILParser.FieldRefContext context) - { - if (context.type() is not CILParser.TypeContext type) - { - // This is a typedef reference for a field member - string alias = VisitDottedName(context.dottedName()).Value; - var resolved = TryResolveTypedefAsMember(alias); - if (resolved is not null) - { - return new(resolved); - } - ReportError(DiagnosticIds.TypedefNotFound, string.Format(DiagnosticMessageTemplates.TypedefNotFound, alias), context); - return new(_entityRegistry.CreateLazilyRecordedMemberReference(_entityRegistry.ModuleType, alias, new BlobBuilder())); - } - - var fieldTypeSig = VisitType(type).Value; - EntityRegistry.TypeEntity definingType = _entityRegistry.ModuleType; - if (context.typeSpec() is CILParser.TypeSpecContext typeSpec) - { - definingType = VisitTypeSpec(typeSpec).Value; - } - - string name = VisitDottedName(context.dottedName()).Value; - - var fieldSig = new BlobBuilder(fieldTypeSig.Count + 1); - fieldSig.WriteByte((byte)SignatureKind.Field); - fieldTypeSig.WriteContentTo(fieldSig); - return new(_entityRegistry.CreateLazilyRecordedMemberReference(definingType, name, fieldSig)); - } - - GrammarResult ICILVisitor.VisitFieldSerInit(CILParser.FieldSerInitContext context) => VisitFieldSerInit(context); - public GrammarResult.FormattedBlob VisitFieldSerInit(CILParser.FieldSerInitContext context) - { - // The max length for the majority of the blobs is 9 bytes. 1 for the type of blob, 8 for the max 64-bit value. - // Byte arrays can be larger, so we handle that case separately. - const int CommonMaxBlobLength = 9; - BlobBuilder builder; - var bytesNode = context.bytes(); - if (bytesNode is not null) - { - var bytesResult = VisitBytes(bytesNode); - // Our blob length is the number of bytes in the byte array + the code for the byte array. - builder = new BlobBuilder(bytesResult.Value.Length + 1); - builder.WriteByte((byte)SerializationTypeCode.String); - builder.WriteBytes(bytesResult.Value); - return new(builder); - } - builder = new BlobBuilder(CommonMaxBlobLength); - - if (ContainsParserError(context) - || context.GetChild(0) is not ITerminalNode typeNode) - { - return new(builder); - } - - int tokenType = typeNode.Symbol.Type; - - builder.WriteByte((byte)GetTypeCodeForToken(tokenType)); - - switch (tokenType) - { - case CILParser.BOOL: - builder.WriteBoolean(VisitTruefalse(context.truefalse()).Value); - break; - case CILParser.INT8: - case CILParser.UINT8: - builder.WriteByte((byte)VisitInt32(context.int32()).Value); - break; - case CILParser.CHAR: - case CILParser.INT16: - case CILParser.UINT16: - builder.WriteInt16((short)VisitInt32(context.int32()).Value); - break; - case CILParser.INT32_: - case CILParser.UINT32: - builder.WriteInt32(VisitInt32(context.int32()).Value); - break; - case CILParser.INT64_: - case CILParser.UINT64: - builder.WriteInt64(VisitInt64(context.int64()).Value); - break; - case CILParser.FLOAT32: - { - if (context.float64() is CILParser.Float64Context float64) - { - string text = float64.GetText(); - if (!text.Contains('.') && - text.IndexOf('e') < 0 && - text.IndexOf('E') < 0 && - ParseIntegerValue(text.AsSpan(), out long rawValue)) - { - builder.WriteSingle(BitConverter.Int32BitsToSingle((int)rawValue)); - } - else - { - builder.WriteSingle((float)VisitFloat64(float64).Value); - } - } - if (context.int32() is CILParser.Int32Context int32) - { - int value = VisitInt32(int32).Value; - builder.WriteSingle(BitConverter.Int32BitsToSingle(value)); - } - break; - } - case CILParser.FLOAT64_: - { - if (context.float64() is CILParser.Float64Context float64) - { - string text = float64.GetText(); - if (!text.Contains('.') && - text.IndexOf('e') < 0 && - text.IndexOf('E') < 0 && - ParseIntegerValue(text.AsSpan(), out long rawValue)) - { - builder.WriteDouble(BitConverter.Int64BitsToDouble(rawValue)); - } - else - { - builder.WriteDouble(VisitFloat64(float64).Value); - } - } - if (context.int64() is CILParser.Int64Context int64) - { - long value = VisitInt64(int64).Value; - builder.WriteDouble(BitConverter.Int64BitsToDouble(value)); - } - break; - } - } - - return new(builder); - } - - GrammarResult ICILVisitor.VisitFileAttr(CILParser.FileAttrContext context) => VisitFileAttr(context); - public GrammarResult.Literal VisitFileAttr(CILParser.FileAttrContext context) - => context.ChildCount != 0 ? new(false) : new(true); - GrammarResult ICILVisitor.VisitFileDecl(CILParser.FileDeclContext context) => VisitFileDecl(context); - public GrammarResult.Literal VisitFileDecl(CILParser.FileDeclContext context) - { - string dottedName = VisitDottedName(context.dottedName()).Value; - ImmutableArray? hash = context.HASH() is not null ? VisitBytes(context.bytes()).Value : null; - var hashBlob = hash is not null ? new BlobBuilder() : null; - hashBlob?.WriteBytes(hash!.Value); - - bool hasMetadata = context.fileAttr().Aggregate(true, (acc, attr) => acc && VisitFileAttr(attr).Value); - bool isEntrypoint = context.fileEntry().Aggregate(false, (acc, attr) => acc || VisitFileEntry(attr).Value); - var entity = _entityRegistry.GetOrCreateFile(dottedName, hasMetadata, hashBlob); - if (isEntrypoint) - { - _entityRegistry.EntryPoint = entity; - } - return new(entity); - } - GrammarResult ICILVisitor.VisitFileEntry(CILParser.FileEntryContext context) => VisitFileEntry(context); - public GrammarResult.Literal VisitFileEntry(CILParser.FileEntryContext context) - => context.ChildCount != 0 ? new(true) : new(false); - - GrammarResult ICILVisitor.VisitFilterClause(CILParser.FilterClauseContext context) => VisitFilterClause(context); - public GrammarResult.Literal VisitFilterClause(CILParser.FilterClauseContext context) - { - if (context.scopeBlock() is CILParser.ScopeBlockContext scopeBlock) - { - LabelHandle start = _currentMethod!.Definition.MethodBody.DefineLabel(); - _currentMethod.Definition.MethodBody.MarkLabel(start); - _ = VisitScopeBlock(scopeBlock); - return new(start); - } - if (context.id() is CILParser.IdContext id) - { - var start = _currentMethod!.Labels.TryGetValue(VisitId(id).Value, out LabelHandle startLabel) ? startLabel : _currentMethod.Labels[VisitId(id).Value] = _currentMethod.Definition.MethodBody.DefineLabel(); - return new(start); - } - if (context.int32() is CILParser.Int32Context offset) - { - var start = _currentMethod!.Definition.MethodBody.DefineLabel(); - _currentMethod.Definition.MethodBody.MarkLabel(start, VisitInt32(offset).Value); - return new(start); - } - throw new UnreachableException(); - } - - public GrammarResult VisitFinallyClause(CILParser.FinallyClauseContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - - GrammarResult ICILVisitor.VisitFloat64(CILParser.Float64Context context) => VisitFloat64(context); - public GrammarResult.Literal VisitFloat64(CILParser.Float64Context context) - { - if (context.FLOAT64() is ITerminalNode float64) - { - string text = float64.Symbol.Text; - bool neg = text.StartsWith('-'); - if (!double.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out double result)) - { - result = neg ? double.MaxValue : double.MinValue; - } - return new(result); - } - else if (context.int32() is CILParser.Int32Context int32) - { - IToken node = int32.INT32().Symbol; - if (!ParseIntegerValue(node.Text.AsSpan(), out long intValue)) - { - _diagnostics.Add(new Diagnostic( - DiagnosticIds.LiteralOutOfRange, - DiagnosticSeverity.Error, - string.Format(DiagnosticMessageTemplates.LiteralOutOfRange, node.Text), - Location.From(node, _documents))); - intValue = 0; - } - - if (context.FLOAT32() is not null) - { - // FLOAT32 '(' int32 ')': hex bits reinterpreted as float32 - return new(BitConverter.Int32BitsToSingle((int)intValue)); - } - // int32 or int32 '.': plain integer or trailing-dot float - return new((double)intValue); - } - else if (context.int64() is CILParser.Int64Context int64) - { - // FLOAT64_ '(' int64 ')': hex bits reinterpreted as float64 - long value = VisitInt64(int64).Value; - return new(BitConverter.Int64BitsToDouble(value)); - } - throw new UnreachableException(); - } - GrammarResult ICILVisitor.VisitGenArity(CILParser.GenArityContext context) => VisitGenArity(context); - public GrammarResult.Literal VisitGenArity(CILParser.GenArityContext context) - => context.genArityNotEmpty() is CILParser.GenArityNotEmptyContext genArity ? VisitGenArityNotEmpty(genArity) : new(0); - - GrammarResult ICILVisitor.VisitGenArityNotEmpty(CILParser.GenArityNotEmptyContext context) => VisitGenArityNotEmpty(context); - public GrammarResult.Literal VisitGenArityNotEmpty(CILParser.GenArityNotEmptyContext context) => VisitInt32(context.int32()); - - GrammarResult ICILVisitor.VisitHandlerBlock(CILParser.HandlerBlockContext context) => VisitHandlerBlock(context); - - public GrammarResult.Literal<(LabelHandle Start, LabelHandle End)> VisitHandlerBlock(CILParser.HandlerBlockContext context) - { - if (context.scopeBlock() is CILParser.ScopeBlockContext scopeBlock) - { - LabelHandle start = _currentMethod!.Definition.MethodBody.DefineLabel(); - _currentMethod.Definition.MethodBody.MarkLabel(start); - _ = VisitScopeBlock(scopeBlock); - LabelHandle end = _currentMethod.Definition.MethodBody.DefineLabel(); - _currentMethod.Definition.MethodBody.MarkLabel(end); - return new((start, end)); - } - var ids = context.id(); - if (ids.Length == 2) - { - var start = _currentMethod!.Labels.TryGetValue(VisitId(ids[0]).Value, out LabelHandle startLabel) ? startLabel : _currentMethod.Labels[VisitId(ids[0]).Value] = _currentMethod.Definition.MethodBody.DefineLabel(); - var end = _currentMethod!.Labels.TryGetValue(VisitId(ids[1]).Value, out LabelHandle endLabel) ? endLabel : _currentMethod.Labels[VisitId(ids[1]).Value] = _currentMethod.Definition.MethodBody.DefineLabel(); - return new((start, end)); - } - var offsets = context.int32(); - if (offsets.Length == 2) - { - var start = _currentMethod!.Definition.MethodBody.DefineLabel(); - var end = _currentMethod.Definition.MethodBody.DefineLabel(); - _currentMethod.Definition.MethodBody.MarkLabel(start, VisitInt32(offsets[0]).Value); - _currentMethod.Definition.MethodBody.MarkLabel(end, VisitInt32(offsets[1]).Value); - return new((start, end)); - } - throw new UnreachableException(); - } - - GrammarResult ICILVisitor.VisitHexbyte(CILParser.HexbyteContext context) - { - return new GrammarResult.Literal(VisitHexbyte(context)); - } - - public static byte VisitHexbyte(CILParser.HexbyteContext context) - { - // hexbyte can be HEXBYTE, INT32, or ID token (due to lexer ambiguity). - // Validate the text is 1-2 hex characters to avoid FormatException - // from non-hex ID tokens or values > 0xFF from longer INT32 tokens. - string text = context.GetText(); - if (text.Length <= 2 && byte.TryParse(text, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out byte value)) - { - return value; - } - // For invalid hex values, mask to byte (matching native ilasm tolerance). - if (int.TryParse(text, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out int intValue)) - { - return (byte)(intValue & 0xFF); - } - return 0; - } - - GrammarResult ICILVisitor.VisitNativeInt(CILParser.NativeIntContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - GrammarResult ICILVisitor.VisitNativeUint(CILParser.NativeUintContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - GrammarResult ICILVisitor.VisitI16seq(CILParser.I16seqContext context) => VisitI16seq(context); - public GrammarResult.FormattedBlob VisitI16seq(CILParser.I16seqContext context) - { - var values = context.int32(); - var builder = ImmutableArray.CreateBuilder(values.Length); - foreach (var value in values) - { - builder.Add((short)VisitInt32(value).Value); - } - return new(builder.MoveToImmutable().SerializeSequence()); - } - GrammarResult ICILVisitor.VisitI32seq(CILParser.I32seqContext context) => VisitI32seq(context); - public GrammarResult.FormattedBlob VisitI32seq(CILParser.I32seqContext context) - { - var values = context.int32(); - var builder = ImmutableArray.CreateBuilder(values.Length); - foreach (var value in values) - { - builder.Add(VisitInt32(value).Value); - } - return new(builder.MoveToImmutable().SerializeSequence()); - } - - GrammarResult ICILVisitor.VisitI8seq(CILParser.I8seqContext context) => VisitI8seq(context); - public GrammarResult.FormattedBlob VisitI8seq(CILParser.I8seqContext context) - { - var values = context.int32(); - var builder = ImmutableArray.CreateBuilder(values.Length); - foreach (var value in values) - { - builder.Add((byte)VisitInt32(value).Value); - } - return new(builder.MoveToImmutable().SerializeSequence()); - } - - GrammarResult ICILVisitor.VisitI64seq(CILParser.I64seqContext context) => VisitI64seq(context); - public GrammarResult.FormattedBlob VisitI64seq(CILParser.I64seqContext context) - { - var values = context.int64(); - var builder = ImmutableArray.CreateBuilder(values.Length); - foreach (var value in values) - { - builder.Add(VisitInt64(value).Value); - } - return new(builder.MoveToImmutable().SerializeSequence()); - } - GrammarResult ICILVisitor.VisitId(CILParser.IdContext context) => VisitId(context); - public static GrammarResult.String VisitId(CILParser.IdContext context) - { - string text = context.GetText(); - if (context.SQSTRING() is not null && text.Length >= 2 && text[0] == '\'') - { - text = text.Substring(1, text.Length - 2); - } - return new GrammarResult.String(text); - } - - GrammarResult ICILVisitor.VisitIidParamIndex(CILParser.IidParamIndexContext context) => VisitIidParamIndex(context); - public GrammarResult.Literal VisitIidParamIndex(CILParser.IidParamIndexContext context) - => context.int32() is CILParser.Int32Context int32 ? new(VisitInt32(int32).Value) : new(null); - - GrammarResult ICILVisitor.VisitImagebase(CILParser.ImagebaseContext context) => VisitImagebase(context); - public GrammarResult.Literal VisitImagebase(CILParser.ImagebaseContext context) => VisitInt64(context.int64()); - - GrammarResult ICILVisitor.VisitImplAttr(ILAssembler.CILParser.ImplAttrContext context) => VisitImplAttr(context); - public GrammarResult.Flag VisitImplAttr(CILParser.ImplAttrContext context) - { - if (context.int32() is CILParser.Int32Context int32) - { - return new((MethodImplAttributes)VisitInt32(int32).Value, ShouldAppend: false); - } - string attribute = context.GetText(); - return attribute switch - { - "native" => new(MethodImplAttributes.Native, MethodImplAttributes.CodeTypeMask), - "cil" or "il" => new(MethodImplAttributes.IL, MethodImplAttributes.CodeTypeMask), - "optil" => new(MethodImplAttributes.OPTIL, MethodImplAttributes.CodeTypeMask), - "managed" => new(MethodImplAttributes.Managed, MethodImplAttributes.ManagedMask), - "unmanaged" => new(MethodImplAttributes.Unmanaged, MethodImplAttributes.ManagedMask), - "forwardref" => new(MethodImplAttributes.ForwardRef), - "preservesig" => new(MethodImplAttributes.PreserveSig), - "runtime" => new(MethodImplAttributes.Runtime, MethodImplAttributes.CodeTypeMask), - "internalcall" => new(MethodImplAttributes.InternalCall), - "synchronized" => new(MethodImplAttributes.Synchronized), - "noinlining" => new(MethodImplAttributes.NoInlining), - "aggressiveinlining" => new(MethodImplAttributes.AggressiveInlining), - "nooptimization" => new(MethodImplAttributes.NoOptimization), - "aggressiveoptimization" => new(MethodImplAttributes.AggressiveOptimization), - "async" => new(MethodImplAttributes.Async), - _ => throw new UnreachableException(), - }; - } - - GrammarResult ICILVisitor.VisitImplClause(CILParser.ImplClauseContext context) => VisitImplClause(context); - public GrammarResult.Sequence VisitImplClause(CILParser.ImplClauseContext context) => context.implList() is {} implList ? VisitImplList(implList) : new(ImmutableArray.Empty); - - GrammarResult ICILVisitor.VisitImplList(CILParser.ImplListContext context) => VisitImplList(context); - public GrammarResult.Sequence VisitImplList(CILParser.ImplListContext context) - { - var builder = ImmutableArray.CreateBuilder(); - foreach (var impl in context.typeSpec()) - { - builder.Add(EntityRegistry.CreateUnrecordedInterfaceImplementation(_currentTypeDefinition.PeekOrDefault()!, VisitTypeSpec(impl).Value)); - } - return new(builder.ToImmutable()); - } - - GrammarResult ICILVisitor.VisitInitOpt(CILParser.InitOptContext context) => VisitInitOpt(context); - public GrammarResult.Literal VisitInitOpt(CILParser.InitOptContext context) - { - if (context.fieldInit() is CILParser.FieldInitContext fieldInit) - { - return VisitFieldInit(fieldInit); - } - // No initializer - return a sentinel indicating no constant - return new(NoConstantSentinel.Instance); - } - - // Sentinel to distinguish "no constant" from "constant is null" - private sealed class NoConstantSentinel - { - public static readonly NoConstantSentinel Instance = new(); - private NoConstantSentinel() { } - } - - public GrammarResult VisitInstr(CILParser.InstrContext context) - { - if (ContainsParserError(context)) - { - return GrammarResult.SentinelValue.Result; - } - - var instrContext = context.GetRuleContext(0); - ILOpCode opcode = ((GrammarResult.Literal)instrContext.Accept(this)).Value; - switch (instrContext.RuleIndex) - { - case CILParser.RULE_instr_brtarget: - { - ParserRuleContext argument = context.GetRuleContext(1); - if (argument is CILParser.IdContext id) - { - string label = VisitId(id).Value; - if (!_currentMethod!.Labels.TryGetValue(label, out var handle)) - { - handle = _currentMethod.Definition.MethodBody.DefineLabel(); - _currentMethod.Labels[label] = handle; - // Track undefined label references for later validation - if (!_currentMethod.UndefinedLabelReferences.ContainsKey(label)) - { - _currentMethod.UndefinedLabelReferences[label] = context; - } - } - _currentMethod.Definition.MethodBody.Branch(opcode, handle); - } - if (argument is CILParser.Int32Context int32) - { - int offset = VisitInt32(int32).Value; - _currentMethod!.Definition.MethodBody.OpCode(opcode); - if (opcode.GetBranchOperandSize() == 1) - { - _currentMethod.Definition.MethodBody.CodeBuilder.WriteSByte(unchecked((sbyte)offset)); - } - else - { - _currentMethod.Definition.MethodBody.CodeBuilder.WriteInt32(offset); - } - } - } - break; - case CILParser.RULE_instr_field: - { - _currentMethod!.Definition.MethodBody.OpCode(opcode); - if (context.mdtoken() is CILParser.MdtokenContext mdtoken) - { - var entity = VisitMdtoken(mdtoken).Value; - if (entity is EntityRegistry.TypeReferenceEntity mdTokenTypeRef) - { - mdTokenTypeRef.RecordBlobToWriteResolvedToken(_currentMethod.Definition.MethodBody.CodeBuilder.ReserveBytes(4)); - } - else - { - _currentMethod.Definition.MethodBody.Token(entity.Handle); - } - } - else - { - var fieldRef = VisitFieldRef(context.fieldRef()).Value; - if (fieldRef is EntityRegistry.MemberReferenceEntity memberRef) - { - memberRef.RecordBlobToWriteResolvedHandle(_currentMethod.Definition.MethodBody.CodeBuilder.ReserveBytes(4)); - } - else - { - _currentMethod.Definition.MethodBody.Token(fieldRef.Handle); - } - } - } - break; - case CILParser.RULE_instr_i: - { - int arg = VisitInt32(context.int32()).Value; - if (opcode == ILOpCode.Ldc_i4 || opcode == ILOpCode.Ldc_i4_s) - { - _currentMethod!.Definition.MethodBody.LoadConstantI4(arg); - } - else - { - _currentMethod!.Definition.MethodBody.OpCode(opcode); - _currentMethod.Definition.MethodBody.CodeBuilder.WriteByte((byte)arg); - } - } - break; - case CILParser.RULE_instr_i8: - Debug.Assert(opcode == ILOpCode.Ldc_i8); - _currentMethod!.Definition.MethodBody.LoadConstantI8(VisitInt64(context.int64()).Value); - break; - case CILParser.RULE_instr_method: - { - if (opcode == ILOpCode.Callvirt || opcode == ILOpCode.Newobj) - { - _expectInstance = true; - } - _currentMethod!.Definition.MethodBody.OpCode(opcode); - var methodRef = VisitMethodRef(context.methodRef()).Value; - if (methodRef is EntityRegistry.MemberReferenceEntity memberRef) - { - memberRef.RecordBlobToWriteResolvedHandle(_currentMethod.Definition.MethodBody.CodeBuilder.ReserveBytes(4)); - } - else - { - _currentMethod.Definition.MethodBody.Token(methodRef.Handle); - } - // Reset the instance flag for the next instruction. - if (opcode == ILOpCode.Callvirt || opcode == ILOpCode.Newobj) - { - _expectInstance = false; - } - } - break; - case CILParser.RULE_instr_none: - _currentMethod!.Definition.MethodBody.OpCode(opcode); - break; - case CILParser.RULE_instr_r: - { - double value; - ParserRuleContext argument = context.GetRuleContext(1); - if (argument is CILParser.Float64Context float64) - { - value = VisitFloat64(float64).Value; - } - else if (argument is CILParser.Int64Context int64) - { - long intValue = VisitInt64(int64).Value; - value = intValue; - } - else if (argument is CILParser.BytesContext bytesContext) - { - var bytes = VisitBytes(bytesContext).Value.ToArray(); - if (bytes.Length >= 8) - { - value = BitConverter.ToDouble(bytes, 0); - } - else if (bytes.Length >= 4) - { - value = BitConverter.ToSingle(bytes, 0); - } - else - { - ReportError(DiagnosticIds.ByteArrayTooShort, DiagnosticMessageTemplates.ByteArrayTooShort, bytesContext); - value = 0.0d; - } - } - else - { - throw new UnreachableException(); - } - if (opcode == ILOpCode.Ldc_r4) - { - _currentMethod!.Definition.MethodBody.LoadConstantR4((float)value); - } - else - { - _currentMethod!.Definition.MethodBody.LoadConstantR8(value); - } - } - break; - case CILParser.RULE_instr_sig: - { - Debug.Assert(opcode == ILOpCode.Calli); - BlobBuilder signature = new(); - byte callConv = VisitCallConv(context.callConv()).Value; - signature.WriteByte(callConv); - var args = VisitSigArgs(context.sigArgs()).Value; - signature.WriteCompressedInteger(args.Count(arg => !arg.IsSentinel)); - // Write return type - VisitType(context.type()).Value.WriteContentTo(signature); - // Write arg signatures - foreach (var arg in args) - { - arg.SignatureBlob.WriteContentTo(signature); - } - _currentMethod!.Definition.MethodBody.OpCode(opcode); - _currentMethod!.Definition.MethodBody.Token(_entityRegistry.GetOrCreateStandaloneSignature(signature).Handle); - } - break; - case CILParser.RULE_instr_string: - Debug.Assert(opcode == ILOpCode.Ldstr); - string str; - if (context.bytes() is CILParser.BytesContext rawBytes) - { - ReadOnlySpan bytes = VisitBytes(rawBytes).Value.AsSpan(); - ReadOnlySpan bytesAsChars = MemoryMarshal.Cast(bytes); - if (!BitConverter.IsLittleEndian) - { - for (int i = 0; i < bytesAsChars.Length; i++) - { - BinaryPrimitives.ReverseEndianness(bytesAsChars[i]); - } - } - str = bytesAsChars.ToString(); - } - else - { - var userString = context.compQstring(); - Debug.Assert(userString is not null); - str = VisitCompQstring(userString!).Value; - if (context.ANSI() is not null) - { - // Emit the string not as a UTF-16 string (as per the spec), but directly as an ANSI string. - // Although the string is marked as ANSI, this always used the UTF-8 code page - // so we can emit this as UTF-8 bytes. - int byteCount = Encoding.UTF8.GetByteCount(str); - // Ensure we have an even number of bytes. - if ((byteCount % 2) != 0) - { - byteCount++; - } - - Span utf8Bytes = new byte[byteCount]; - Encoding.UTF8.GetBytes(str, utf8Bytes); - - str = new string(MemoryMarshal.Cast(utf8Bytes)); - } - } - _currentMethod!.Definition.MethodBody.LoadString(_metadataBuilder.GetOrAddUserString(str)); - break; - case CILParser.RULE_instr_switch: - { - var labels = new List<(LabelHandle Label, int? Offset)>(); - if (context.labels()?.children is { } labelChildren) - { - foreach (var label in labelChildren) - { - if (label is CILParser.IdContext id) - { - string labelName = VisitId(id).Value; - if (!_currentMethod!.Labels.TryGetValue(labelName, out var handle)) - { - handle = _currentMethod.Definition.MethodBody.DefineLabel(); - _currentMethod.Labels[labelName] = handle; - // Track undefined label references for later validation - if (!_currentMethod.UndefinedLabelReferences.ContainsKey(labelName)) - { - _currentMethod.UndefinedLabelReferences[labelName] = context; - } - } - labels.Add((handle, null)); - } - else if (label is CILParser.Int32Context int32) - { - int offset = VisitInt32(int32).Value; - LabelHandle labelHandle = _currentMethod!.Definition.MethodBody.DefineLabel(); - labels.Add((labelHandle, offset)); - } - } - } - if (labels.Count > 0) - { - var switchEncoder = _currentMethod!.Definition.MethodBody.Switch(labels.Count); - foreach (var label in labels) - { - switchEncoder.Branch(label.Label); - } - } - else - { - // Empty switch: emit opcode + 0 count manually - _currentMethod!.Definition.MethodBody.OpCode(ILOpCode.Switch); - _currentMethod.Definition.MethodBody.CodeBuilder.WriteInt32(0); - } - // Now that we've emitted the switch instruction, we can go back and mark the offset-based target labels - foreach (var label in labels) - { - if (label.Offset is int offset) - { - _currentMethod.Definition.MethodBody.MarkLabel(label.Label, _currentMethod.Definition.MethodBody.Offset + offset); - } - } - } - break; - case CILParser.RULE_instr_tok: - _currentMethod!.Definition.MethodBody.OpCode(opcode); - if (context.int32() is { } tokenValue) - { - _currentMethod.Definition.MethodBody.CodeBuilder.WriteInt32(VisitInt32(tokenValue).Value); - break; - } - - var tok = VisitOwnerType(context.ownerType()).Value; - if (tok is EntityRegistry.TypeReferenceEntity tokTypeRef) - { - tokTypeRef.RecordBlobToWriteResolvedToken(_currentMethod.Definition.MethodBody.CodeBuilder.ReserveBytes(4)); - } - else if (tok is EntityRegistry.MemberReferenceEntity tokMemberRef) - { - tokMemberRef.RecordBlobToWriteResolvedHandle(_currentMethod.Definition.MethodBody.CodeBuilder.ReserveBytes(4)); - } - else - { - _currentMethod.Definition.MethodBody.Token(tok.Handle); - } - break; - case CILParser.RULE_instr_type: - { - var arg = VisitTypeSpec(context.typeSpec()).Value; - _currentMethod!.Definition.MethodBody.OpCode(opcode); - if (arg is EntityRegistry.TypeReferenceEntity argTypeRef) - { - argTypeRef.RecordBlobToWriteResolvedToken(_currentMethod.Definition.MethodBody.CodeBuilder.ReserveBytes(4)); - } - else - { - _currentMethod.Definition.MethodBody.Token(arg.Handle); - } - } - break; - case CILParser.RULE_instr_var: - { - string instrName = opcode.ToString(); - bool isShortForm = instrName.EndsWith("_s"); - _currentMethod!.Definition.MethodBody.OpCode(opcode); - if (context.int32() is CILParser.Int32Context int32) - { - int value = VisitInt32(int32).Value; - if (isShortForm) - { - // Emit a byte instead of the int for the short form - _currentMethod.Definition.MethodBody.CodeBuilder.WriteByte((byte)value); - } - else - { - _currentMethod.Definition.MethodBody.CodeBuilder.WriteInt32(value); - } - } - else - { - Debug.Assert(context.id() is not null); - string varName = VisitId(context.id()!).Value; - int? index = null; - if (instrName.Contains("arg")) - { - if (_currentMethod!.ArgumentNames.TryGetValue(varName, out var argIndex)) - { - index = argIndex; - - if (_currentMethod.Definition.SignatureHeader.IsInstance) - { - index++; - } - } - else - { - ReportError(DiagnosticIds.ArgumentNotFound, string.Format(DiagnosticMessageTemplates.ArgumentNotFound, varName), context); - } - } - else - { - for (int i = _currentMethod!.LocalsScopes.Count - 1; i >= 0 ; i--) - { - if (_currentMethod.LocalsScopes[i].TryGetValue(varName, out var localIndex)) - { - index = localIndex; - break; - } - } - if (index is null) - { - ReportError(DiagnosticIds.LocalNotFound, string.Format(DiagnosticMessageTemplates.LocalNotFound, varName), context); - } - } - - index ??= -1; - - if (isShortForm) - { - // Emit a byte instead of the int for the short form - _currentMethod.Definition.MethodBody.CodeBuilder.WriteByte((byte)index.Value); - } - else - { - _currentMethod.Definition.MethodBody.CodeBuilder.WriteInt32(index.Value); - } - } - } - break; - } - return GrammarResult.SentinelValue.Result; - } - - public GrammarResult.Literal VisitInstr_brtarget(CILParser.Instr_brtargetContext context) => new(ParseOpCodeFromToken(((ITerminalNode)context.children[0]).Symbol)); - public GrammarResult.Literal VisitInstr_field(CILParser.Instr_fieldContext context) => new(ParseOpCodeFromToken(((ITerminalNode)context.children[0]).Symbol)); - public GrammarResult.Literal VisitInstr_i(CILParser.Instr_iContext context) => new(ParseOpCodeFromToken(((ITerminalNode)context.children[0]).Symbol)); - public GrammarResult.Literal VisitInstr_i8(CILParser.Instr_i8Context context) => new(ParseOpCodeFromToken(((ITerminalNode)context.children[0]).Symbol)); - public GrammarResult.Literal VisitInstr_method(CILParser.Instr_methodContext context) => new(ParseOpCodeFromToken(((ITerminalNode)context.children[0]).Symbol)); - public GrammarResult.Literal VisitInstr_none(CILParser.Instr_noneContext context) => new(ParseOpCodeFromToken(((ITerminalNode)context.children[0]).Symbol)); - public GrammarResult.Literal VisitInstr_r(CILParser.Instr_rContext context) => new(ParseOpCodeFromToken(((ITerminalNode)context.children[0]).Symbol)); - public GrammarResult.Literal VisitInstr_sig(CILParser.Instr_sigContext context) => new(ParseOpCodeFromToken(((ITerminalNode)context.children[0]).Symbol)); - public GrammarResult.Literal VisitInstr_string(CILParser.Instr_stringContext context) => new(ParseOpCodeFromToken(((ITerminalNode)context.children[0]).Symbol)); - public GrammarResult.Literal VisitInstr_switch(CILParser.Instr_switchContext context) => new(ParseOpCodeFromToken(((ITerminalNode)context.children[0]).Symbol)); - public GrammarResult.Literal VisitInstr_tok(CILParser.Instr_tokContext context) => new(ParseOpCodeFromToken(((ITerminalNode)context.children[0]).Symbol)); - public GrammarResult.Literal VisitInstr_type(CILParser.Instr_typeContext context) => new(ParseOpCodeFromToken(((ITerminalNode)context.children[0]).Symbol)); - public GrammarResult.Literal VisitInstr_var(CILParser.Instr_varContext context) => new(ParseOpCodeFromToken(((ITerminalNode)context.children[0]).Symbol)); - private static ILOpCode ParseOpCodeFromToken(IToken token) - { - string text = token.Text.TrimEnd('.'); - if (text == "unused") - { - // Native ilasm's keyword index uses the last matching opcode.def entry, CEE_UNUSED70. - return ILOpCode.Unused; - } - - string normalized = text.Replace('.', '_'); - - // Handle instruction aliases that don't directly map to ILOpCode enum names - normalized = normalized switch - { - "ldelem_u8" => "ldelem_i8", - "ldind_u8" => "ldind_i8", - "endfault" => "endfinally", - _ => normalized - }; - - return (ILOpCode)Enum.Parse(typeof(ILOpCode), normalized, ignoreCase: true); - } - - GrammarResult ICILVisitor.VisitInstr(CILParser.InstrContext context) => VisitInstr(context); - GrammarResult ICILVisitor.VisitInstr_brtarget(CILParser.Instr_brtargetContext context) => VisitInstr_brtarget(context); - GrammarResult ICILVisitor.VisitInstr_field(CILParser.Instr_fieldContext context) => VisitInstr_field(context); - GrammarResult ICILVisitor.VisitInstr_i(CILParser.Instr_iContext context) => VisitInstr_i(context); - GrammarResult ICILVisitor.VisitInstr_i8(CILParser.Instr_i8Context context) => VisitInstr_i8(context); - GrammarResult ICILVisitor.VisitInstr_method(CILParser.Instr_methodContext context) => VisitInstr_method(context); - GrammarResult ICILVisitor.VisitInstr_none(CILParser.Instr_noneContext context) => VisitInstr_none(context); - GrammarResult ICILVisitor.VisitInstr_r(CILParser.Instr_rContext context) => VisitInstr_r(context); - GrammarResult ICILVisitor.VisitInstr_sig(CILParser.Instr_sigContext context) => VisitInstr_sig(context); - GrammarResult ICILVisitor.VisitInstr_string(CILParser.Instr_stringContext context) => VisitInstr_string(context); - GrammarResult ICILVisitor.VisitInstr_switch(CILParser.Instr_switchContext context) => VisitInstr_switch(context); - GrammarResult ICILVisitor.VisitInstr_tok(CILParser.Instr_tokContext context) => VisitInstr_tok(context); - GrammarResult ICILVisitor.VisitInstr_type(CILParser.Instr_typeContext context) => VisitInstr_type(context); - GrammarResult ICILVisitor.VisitInstr_var(CILParser.Instr_varContext context) => VisitInstr_var(context); - - private static bool ParseIntegerValue(ReadOnlySpan value, out long result) - { - NumberStyles parseStyle = NumberStyles.None; - bool negate = false; - if (value.StartsWith("-".AsSpan())) - { - negate = true; - value = value.Slice(1); - } - - if (value.StartsWith("0x".AsSpan())) - { - parseStyle = NumberStyles.AllowHexSpecifier; - value = value.Slice(2); - } - else if (value.StartsWith("0".AsSpan())) - { - // Octal support isn't built-in, so we'll do it manually. - result = 0; - for (int i = 0; i < value.Length; i++, result *= 8) - { - int digitValue = value[i] - '0'; - if (digitValue < 0 || digitValue > 7) - { - // COMPAT: native ilasm skips invalid digits silently - continue; - } - result += digitValue; - } - if (negate) result = -result; - return true; - } - - bool success = long.TryParse(value.ToString(), parseStyle, CultureInfo.InvariantCulture, out result); - if (!success) - { - // Try parsing as unsigned to handle values like: - // - Decimal overflow with negation: 9223372036854775808 (= -Int64.MinValue) - // - Large unsigned decimal: 18444492274432737280 - if (ulong.TryParse(value.ToString(), parseStyle, CultureInfo.InvariantCulture, out ulong uresult)) - { - result = unchecked((long)uresult); - if (negate) result = unchecked(-result); - return true; - } - // Handle oversized hex values (>64 bits) by truncating to low 64 bits, - // matching native ilasm behavior for values like 0x94188556b24089e8b90c9c61f9f3088 - if (parseStyle == NumberStyles.AllowHexSpecifier && value.Length > 16) - { - var truncated = value.Slice(value.Length - 16); - if (ulong.TryParse(truncated.ToString(), parseStyle, CultureInfo.InvariantCulture, out uresult)) - { - result = unchecked((long)uresult); - if (negate) result = unchecked(-result); - return true; - } - } - return false; - } - - if (negate) result = -result; - return true; - } - - GrammarResult ICILVisitor.VisitInt32(CILParser.Int32Context context) - { - return VisitInt32(context); - } - - public GrammarResult.Literal VisitInt32(CILParser.Int32Context context) - { - IToken node = context.INT32().Symbol; - - ReadOnlySpan value = node.Text.AsSpan(); - - if (!ParseIntegerValue(value, out long num)) - { - _diagnostics.Add(new Diagnostic( - DiagnosticIds.LiteralOutOfRange, - DiagnosticSeverity.Error, - string.Format(DiagnosticMessageTemplates.LiteralOutOfRange, node.Text), - Location.From(node, _documents))); - return new GrammarResult.Literal(0); - } - - return new GrammarResult.Literal((int)num); - } - - - GrammarResult ICILVisitor.VisitInt64(CILParser.Int64Context context) - { - return VisitInt64(context); - } - - public GrammarResult.Literal VisitInt64(CILParser.Int64Context context) - { - IToken node = context.GetChild(0).Symbol; - - ReadOnlySpan value = node.Text.AsSpan(); - - if (!ParseIntegerValue(value, out long num)) - { - _diagnostics.Add(new Diagnostic( - DiagnosticIds.LiteralOutOfRange, - DiagnosticSeverity.Error, - string.Format(DiagnosticMessageTemplates.LiteralOutOfRange, node.Text), - Location.From(node, _documents))); - return new GrammarResult.Literal(0); - } - - return new GrammarResult.Literal(num); - } - - GrammarResult ICILVisitor.VisitIntOrWildcard(CILParser.IntOrWildcardContext context) => VisitIntOrWildcard(context); - public GrammarResult.Literal VisitIntOrWildcard(CILParser.IntOrWildcardContext context) => context.int32() is {} int32 ? new(VisitInt32(int32).Value) : new(null); - - private void ValidateLabelReferences() - { - if (_currentMethod is null) - { - return; - } - - // Report errors for any labels that were referenced but never declared - foreach (var undefinedLabel in _currentMethod.UndefinedLabelReferences) - { - string labelName = undefinedLabel.Key; - ParserRuleContext context = undefinedLabel.Value; - - // Only report if the label was never declared - if (!_currentMethod.DeclaredLabels.Contains(labelName)) - { - ReportError(DiagnosticIds.LabelNotFound, - string.Format(DiagnosticMessageTemplates.LabelNotFound, labelName), - context); - } - } - } - - public GrammarResult VisitLabels(CILParser.LabelsContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - - GrammarResult ICILVisitor.VisitLabelDecl(CILParser.LabelDeclContext context) => VisitLabelDecl(context); - public GrammarResult VisitLabelDecl(CILParser.LabelDeclContext context) - { - var labelId = context.id(); - string labelName = VisitId(labelId).Value; - _currentMethod!.DeclaredLabels.Add(labelName); - if (!_currentMethod!.Labels.TryGetValue(labelName, out var label)) - { - label = _currentMethod.Definition.MethodBody.DefineLabel(); - _currentMethod.Labels[labelName] = label; - } - _currentMethod.Definition.MethodBody.MarkLabel(label); - return GrammarResult.SentinelValue.Result; - } - - public GrammarResult VisitLanguageDecl(CILParser.LanguageDeclContext context) - { - // .language languageString (',' languageString (',' languageString)?)? - // First GUID: language (e.g., C#, VB, IL) - // Second GUID: vendor (optional) - // Third GUID: document type (optional) - var strings = context.languageString(); - if (strings.Length >= 1 && Guid.TryParse(VisitLanguageString(strings[0]).Value, out var languageGuid)) - { - _currentLanguageGuid = languageGuid; - } - if (strings.Length >= 2 && Guid.TryParse(VisitLanguageString(strings[1]).Value, out var vendorGuid)) - { - _currentLanguageVendorGuid = vendorGuid; - } - if (strings.Length >= 3 && Guid.TryParse(VisitLanguageString(strings[2]).Value, out var docTypeGuid)) - { - _currentDocumentTypeGuid = docTypeGuid; - } - return GrammarResult.SentinelValue.Result; - } - - GrammarResult ICILVisitor.VisitLanguageString(CILParser.LanguageStringContext context) => VisitLanguageString(context); - public GrammarResult.String VisitLanguageString(CILParser.LanguageStringContext context) - { - return new(StringHelpers.ParseQuotedString(context.SQSTRING().GetText())); - } - - public GrammarResult VisitManifestResDecl(CILParser.ManifestResDeclContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - GrammarResult ICILVisitor.VisitManifestResDecls(CILParser.ManifestResDeclsContext context) => VisitManifestResDecls(context); - public GrammarResult.Literal<(EntityRegistry.EntityBase? implementation, uint offset, ImmutableArray attributes)> VisitManifestResDecls(CILParser.ManifestResDeclsContext context) - { - EntityRegistry.EntityBase? implementation = null; - uint offset = 0; - var attributes = ImmutableArray.CreateBuilder(); - // COMPAT: Priority order for implementation is the following - // AssemblyRef, File, nil - foreach (var decl in context.manifestResDecl()) - { - if (decl.customAttrDecl() is CILParser.CustomAttrDeclContext customAttrDecl) - { - if (VisitCustomAttrDecl(customAttrDecl).Value is { } attr) - { - attributes.Add(attr); - } - } - string kind = decl.GetChild(0).GetText(); - if (kind == ".file" && implementation is not EntityRegistry.AssemblyReferenceEntity) - { - string fileName = VisitDottedName(decl.dottedName()).Value; - var file = _entityRegistry.FindFile(fileName); - if (file is null) - { - ReportError(DiagnosticIds.FileNotFound, string.Format(DiagnosticMessageTemplates.FileNotFound, fileName), decl); - } - else - { - implementation = file; - offset = (uint)VisitInt32(decl.int32()).Value; - } - } - else if (kind == ".assembly") - { - string assemblyName = VisitDottedName(decl.dottedName()).Value; - implementation = _entityRegistry.GetOrCreateAssemblyReference(assemblyName, _ => { }); - } - } - - return new((implementation, offset, attributes.ToImmutable())); - } - GrammarResult ICILVisitor.VisitManifestResHead(CILParser.ManifestResHeadContext context) => VisitManifestResHead(context); - public GrammarResult.Literal<(string name, string alias, ManifestResourceAttributes attr)> VisitManifestResHead(CILParser.ManifestResHeadContext context) - { - var dottedNames = context.dottedName(); - string name = VisitDottedName(dottedNames[0]).Value; - string alias = dottedNames.Length == 2 ? VisitDottedName(dottedNames[1]).Value : name; - ManifestResourceAttributes attr = 0; - foreach (var attrContext in context.manresAttr()) - { - attr |= VisitManresAttr(attrContext).Value; - } - - return new((name, alias, attr)); - } - - GrammarResult ICILVisitor.VisitManresAttr(CILParser.ManresAttrContext context) => VisitManresAttr(context); - public GrammarResult.Flag VisitManresAttr(CILParser.ManresAttrContext context) - { - return context.GetText() switch - { - "public" => new(ManifestResourceAttributes.Public), - "private" => new(ManifestResourceAttributes.Private), - _ => throw new UnreachableException() - }; - } - - GrammarResult ICILVisitor.VisitMarshalBlob(CILParser.MarshalBlobContext context) => VisitMarshalBlob(context); - public GrammarResult.FormattedBlob VisitMarshalBlob(CILParser.MarshalBlobContext context) - { - if (ContainsParserError(context)) - { - return new(new BlobBuilder()); - } - - var hexBytes = context.hexbyte(); - if (hexBytes.Length > 0) - { - var blob = new BlobBuilder(hexBytes.Length); - foreach (var hb in hexBytes) - { - blob.WriteByte(VisitHexbyte(hb)); - } - return new(blob); - } - - return context.nativeType() is CILParser.NativeTypeContext nativeType - ? VisitNativeType(nativeType) - : new(new BlobBuilder()); - } - - GrammarResult ICILVisitor.VisitMarshalClause(CILParser.MarshalClauseContext context) => VisitMarshalClause(context); - public GrammarResult.FormattedBlob VisitMarshalClause(CILParser.MarshalClauseContext context) - { - if (context.ChildCount == 0) - { - return new(new BlobBuilder(0)); - } - - return VisitMarshalBlob(context.marshalBlob()); - } - - GrammarResult ICILVisitor.VisitMdtoken(ILAssembler.CILParser.MdtokenContext context) => VisitMdtoken(context); - public GrammarResult.Literal VisitMdtoken(CILParser.MdtokenContext context) - { - return new(_entityRegistry.ResolveHandleToEntity(MetadataTokens.EntityHandle(VisitInt32(context.int32()).Value))); - } - - GrammarResult ICILVisitor.VisitMemberRef(CILParser.MemberRefContext context) => VisitMemberRef(context); - public GrammarResult.Literal VisitMemberRef(CILParser.MemberRefContext context) - { - if (context.mdtoken() is CILParser.MdtokenContext mdToken) - { - return VisitMdtoken(mdToken); - } - - if (context.methodRef() is CILParser.MethodRefContext methodRef) - { - return VisitMethodRef(methodRef); - } - if (context.fieldRef() is CILParser.FieldRefContext fieldRef) - { - return VisitFieldRef(fieldRef); - } - - throw new UnreachableException(); - } - - GrammarResult ICILVisitor.VisitMethAttr(CILParser.MethAttrContext context) => VisitMethAttr(context); - public GrammarResult.Flag VisitMethAttr(CILParser.MethAttrContext context) - { - if (context.int32() is CILParser.Int32Context int32) - { - return new((MethodAttributes)VisitInt32(int32).Value, ShouldAppend: false); - } - string attribute = context.GetText(); - return attribute switch - { - "static" => new(MethodAttributes.Static), - "public" => new(MethodAttributes.Public, MethodAttributes.MemberAccessMask), - "private" => new(MethodAttributes.Private, MethodAttributes.MemberAccessMask), - "family" => new(MethodAttributes.Family, MethodAttributes.MemberAccessMask), - "final" => new(MethodAttributes.Final), - "specialname" => new(MethodAttributes.SpecialName), - "virtual" => new(MethodAttributes.Virtual), - "strict" => new(MethodAttributes.CheckAccessOnOverride), - "abstract" => new(MethodAttributes.Abstract), - "assembly" => new(MethodAttributes.Assembly, MethodAttributes.MemberAccessMask), - "famandassem" => new(MethodAttributes.FamANDAssem, MethodAttributes.MemberAccessMask), - "famorassem" => new(MethodAttributes.FamORAssem, MethodAttributes.MemberAccessMask), - "privatescope" => new(MethodAttributes.PrivateScope, MethodAttributes.MemberAccessMask), - "hidebysig" => new(MethodAttributes.HideBySig), - "newslot" => new(MethodAttributes.NewSlot), - "rtspecialname" => new(MethodAttributes.RTSpecialName), - "unmanagedexp" => new(MethodAttributes.UnmanagedExport), - "reqsecobj" => new(MethodAttributes.RequireSecObject), - _ => throw new UnreachableException(), - }; - } - public GrammarResult VisitMethodDecl(CILParser.MethodDeclContext context) - { - Debug.Assert(_currentMethod is not null); - var currentMethod = _currentMethod!; - - if (ContainsParserError(context)) - { - return GrammarResult.SentinelValue.Result; - } - - if (context.EMITBYTE() is not null) - { - currentMethod.Definition.MethodBody.CodeBuilder.WriteByte((byte)VisitInt32(context.GetChild(0)).Value); - } - else if (context.ENTRYPOINT() is not null) - { - _entityRegistry.EntryPoint = currentMethod.Definition; - } - else if (context.ZEROINIT() is not null) - { - currentMethod.Definition.BodyAttributes = MethodBodyAttributes.InitLocals; - } - else if (context.MAXSTACK() is not null) - { - currentMethod.Definition.MaxStack = VisitInt32(context.GetChild(0)).Value; - } - else if (context.LOCALS() is not null) - { - if (context.ChildCount == 3) - { - // init keyword specified - currentMethod.Definition.BodyAttributes = MethodBodyAttributes.InitLocals; - } - Dictionary localsScope; - if (currentMethod.LocalsScopes.Count != 0) - { - localsScope = currentMethod.LocalsScopes[currentMethod.LocalsScopes.Count - 1]; - } - else - { - localsScope = new(); - currentMethod.LocalsScopes.Add(localsScope); - } - var newLocals = VisitSigArgs(context.sigArgs()).Value; - foreach (var loc in newLocals) - { - // BREAK-COMPAT: We don't allow specifying a local's slot via the [in], [out], or [opt] parameter attributes, or the custom int override. - // This only worked in ilasm due to how ilasm reused fields. - // We're only going to support allowing this tool to determine the slot numbers. - // This blocks two different locals in two different scopes from resuing the same slot - // but that is a very rare scenario (even using more than one .locals block in a method in IL is quite rare) - - // If the local is named, add it to our name-lookup dictionary. - // Otherwise, it will only be accessible via its index. - if (loc.Name is not null) - { - localsScope.TryAdd(loc.Name, currentMethod.AllLocals.Count); - } - currentMethod.AllLocals.Add(loc); - } - } - else if (context.labelDecl() is CILParser.LabelDeclContext labelDecl) - { - var labelId = labelDecl.id(); - string labelName = VisitId(labelId).Value; - currentMethod.DeclaredLabels.Add(labelName); - if (!currentMethod.Labels.TryGetValue(labelName, out var label)) - { - label = currentMethod.Definition.MethodBody.DefineLabel(); - currentMethod.Labels[labelName] = label; - } - currentMethod.Definition.MethodBody.MarkLabel(label); - } - else if (context.EXPORT() is not null) - { - // .export [ordinal] or .export [ordinal] as alias - currentMethod.Definition.ExportOrdinal = -1; - currentMethod.Definition.ExportAlias = null; - _exportDirectiveContexts.Remove(currentMethod.Definition); - - int diagnosticCount = _diagnostics.Count; - int ordinal = VisitInt32(context.int32()[0]).Value; - string? alias = context.id() is { } aliasId ? VisitId(aliasId).Value : null; - - if (_diagnostics.Count != diagnosticCount) - { - return GrammarResult.SentinelValue.Result; - } - - if (ordinal <= 0) - { - ReportError( - DiagnosticIds.InvalidExportOrdinal, - string.Format(DiagnosticMessageTemplates.InvalidExportOrdinal, ordinal), - context); - return GrammarResult.SentinelValue.Result; - } - - currentMethod.Definition.ExportOrdinal = ordinal; - currentMethod.Definition.ExportAlias = alias; - _exportDirectiveContexts[currentMethod.Definition] = context; - } - else if (context.VTENTRY() is not null) - { - // .vtentry vtableIndex : slotIndex - currentMethod.Definition.VTableEntry = 0; - currentMethod.Definition.VTableSlot = 0; - _vtableEntryDirectiveContexts.Remove(currentMethod.Definition); - - int diagnosticCount = _diagnostics.Count; - int vtableEntry = VisitInt32(context.int32()[0]).Value; - int vtableSlot = VisitInt32(context.int32()[1]).Value; - if (_diagnostics.Count != diagnosticCount) - { - return GrammarResult.SentinelValue.Result; - } - - currentMethod.Definition.VTableEntry = vtableEntry; - currentMethod.Definition.VTableSlot = vtableSlot; - _vtableEntryDirectiveContexts[currentMethod.Definition] = context; - } - else if (context.OVERRIDE() is not null) - { - BlobBuilder signature = currentMethod.Definition.MethodSignature!; - if (context.callConv() is {} callConv) - { - // We have an explicitly specified signature, so we need to parse it. - signature = new(); - var callConvByte = VisitCallConv(callConv).Value; - var arity = VisitGenArity(context.genArity()).Value; - if (arity > 0) - { - callConvByte |= (byte)SignatureAttributes.Generic; - } - signature.WriteByte(callConvByte); - if (arity > 0) - { - signature.WriteCompressedInteger(arity); - } - var args = VisitSigArgs(context.sigArgs()).Value; - signature.WriteCompressedInteger(args.Length); - VisitType(context.type()).Value.WriteContentTo(signature); - foreach (var arg in args) - { - arg.SignatureBlob.WriteContentTo(signature); - } - } - - var ownerType = VisitTypeSpec(context.typeSpec()).Value; - var methodName = VisitMethodName(context.methodName()).Value; - var methodRef = _entityRegistry.CreateLazilyRecordedMemberReference(ownerType, methodName, signature); - _currentTypeDefinition.PeekOrDefault()!.MethodImplementations.Add(EntityRegistry.CreateUnrecordedMethodImplementation(currentMethod.Definition, methodRef)); - } - else if (context.PARAM() is not null) - { - // BREAK-COMPAT: We require attributes on parameters, generic parameters, and constraints - // to be specified directly after the .param directive, not at any point later in the method. - // This matches the IL outputted by ILDASM, ILSpy, and other tools in the ecosystem. - // Attributes not specified directly after the .param directive are applied to the method itself. - var customAttrDeclarations = context.customAttrDecl(); - if (context.TYPE() is not null) - { - // Type parameters - EntityRegistry.GenericParameterEntity? param = null; - if (context.int32() is { Length: > 0 } int32) - { - int index = VisitInt32(int32[0]).Value; - if (index < 0 || index >= currentMethod.Definition.GenericParameters.Count) - { - ReportError(DiagnosticIds.GenericParameterIndexOutOfRange, - string.Format(DiagnosticMessageTemplates.GenericParameterIndexOutOfRange, index), - context); - return GrammarResult.SentinelValue.Result; - } - param = currentMethod.Definition.GenericParameters[index]; - } - else - { - string name = VisitDottedName(context.dottedName()).Value; - foreach (var genericParam in currentMethod.Definition.GenericParameters) - { - if (genericParam.Name == name) - { - param = genericParam; - break; - } - } - if (param is null) - { - ReportError(DiagnosticIds.UnknownGenericParameter, - string.Format(DiagnosticMessageTemplates.UnknownGenericParameter, name), - context); - return GrammarResult.SentinelValue.Result; - } - } - foreach (var attr in customAttrDeclarations ?? Array.Empty()) - { - var customAttrDecl = VisitCustomAttrDecl(attr).Value; - if (customAttrDecl is not null) - { - customAttrDecl.Owner ??= param; - } - } - } - else if (context.CONSTRAINT() is not null) - { - // constraints - EntityRegistry.GenericParameterEntity? param = null; - if (context.int32() is { Length: > 0 } int32) - { - int index = VisitInt32(int32[0]).Value; - if (index < 0 || index >= currentMethod.Definition.GenericParameters.Count) - { - ReportError(DiagnosticIds.GenericParameterIndexOutOfRange, - string.Format(DiagnosticMessageTemplates.GenericParameterIndexOutOfRange, index), - context); - return GrammarResult.SentinelValue.Result; - } - param = currentMethod.Definition.GenericParameters[index]; - } - else - { - string name = VisitDottedName(context.dottedName()).Value; - foreach (var genericParam in currentMethod.Definition.GenericParameters) - { - if (genericParam.Name == name) - { - param = genericParam; - break; - } - } - if (param is null) - { - ReportError(DiagnosticIds.UnknownGenericParameter, - string.Format(DiagnosticMessageTemplates.UnknownGenericParameter, name), - context); - return GrammarResult.SentinelValue.Result; - } - } - EntityRegistry.GenericParameterConstraintEntity? constraint = null; - var baseType = VisitTypeSpec(context.typeSpec()).Value; - foreach (var constraintEntity in param.Constraints) - { - if (constraintEntity.BaseType == baseType) - { - constraint = constraintEntity; - break; - } - } - if (constraint is null) - { - constraint = EntityRegistry.CreateGenericConstraint(baseType); - constraint.Owner = param; - param.Constraints.Add(constraint); - currentMethod.Definition.GenericParameterConstraints.Add(constraint); - } - foreach (var attr in customAttrDeclarations ?? Array.Empty()) - { - var customAttrDecl = VisitCustomAttrDecl(attr).Value; - if (customAttrDecl is not null) - { - customAttrDecl.Owner ??= constraint; - } - } - } - else - { - // Adding attributes to parameters. - int index = VisitInt32(context.int32()[0]).Value; - if (index < 0 || index >= currentMethod.Definition.Parameters.Count) - { - ReportError(DiagnosticIds.ParameterIndexOutOfRange, - string.Format(DiagnosticMessageTemplates.ParameterIndexOutOfRange, index), - context); - return GrammarResult.SentinelValue.Result; - } - - // Handle initOpt to get the Constant table entry if a constant value is provided. - var constantValue = VisitInitOpt(context.initOpt()).Value; - var param = currentMethod.Definition.Parameters[index]; - if (constantValue is not NoConstantSentinel) - { - param.ConstantValue = constantValue; - param.HasConstant = true; - } - foreach (var attr in customAttrDeclarations ?? Array.Empty()) - { - var customAttrDecl = VisitCustomAttrDecl(attr).Value; - if (customAttrDecl is not null) - { - customAttrDecl.Owner ??= param; - param.HasCustomAttributes = true; - } - } - } - } - else if (context.secDecl() is {} secDecl) - { - var declarativeSecurity = VisitSecDecl(secDecl).Value; - declarativeSecurity?.Parent = currentMethod.Definition; - } - else if (context.customDescrInMethodBody() is {} customDescrInMethod) - { - var customAttr = VisitCustomDescrInMethodBody(customDescrInMethod).Value; - if (customAttr is not null) - { - customAttr.Owner ??= currentMethod.Definition; - } - } - else if (context.GetChild(0) is CILParser.InstrContext instr) - { - _ = VisitInstr(instr); - } - else - { - // Handle other methodDecl alternatives - var child = context.children[0]; - _ = child.Accept(this); - } - return GrammarResult.SentinelValue.Result; - } - - - public GrammarResult VisitMethodDecls(CILParser.MethodDeclsContext context) - { - foreach (var decl in context.methodDecl()) - { - VisitMethodDecl(decl); - } - return GrammarResult.SentinelValue.Result; - } - - GrammarResult ICILVisitor.VisitMethodHead(CILParser.MethodHeadContext context) => VisitMethodHead(context); - public GrammarResult.Literal VisitMethodHead(CILParser.MethodHeadContext context) - { - string name = VisitMethodName(context.methodName()).Value; - var containingType = _currentTypeDefinition.PeekOrDefault() ?? _entityRegistry.ModuleType; - var methodDefinition = EntityRegistry.CreateUnrecordedMethodDefinition(containingType, name); - - BlobBuilder methodSignature = new(); - byte sigHeader = VisitCallConv(context.callConv()).Value; - - // Two-pass generic parameter processing for method params: - // Pass 1: Register all parameter names (without resolving constraints) - _currentMethod = new(methodDefinition); - var typarContexts = context.typarsClause()?.typars()?.typar() ?? Array.Empty(); - ReportGenericParameterEncodingErrors(typarContexts); - for (int i = 0; i < typarContexts.Length; i++) - { - var attributes = VisitTyparAttribs(typarContexts[i].typarAttribs()).Value; - var param = EntityRegistry.CreateGenericParameter(attributes, VisitDottedName(typarContexts[i].dottedName()).Value); - param.Owner = methodDefinition; - param.Index = i; - methodDefinition.GenericParameters.Add(param); - } - if (typarContexts.Length != 0) - { - sigHeader |= (byte)SignatureAttributes.Generic; - } - methodDefinition.MethodAttributes = context.methAttr().Aggregate((MethodAttributes)0, (acc, attr) => acc | VisitMethAttr(attr)); - - // COMPAT: Native ilasm implicitly adds RTSpecialName + SpecialName for .ctor/.cctor methods - if (name is ".ctor" or ".cctor") - { - methodDefinition.MethodAttributes |= MethodAttributes.RTSpecialName | MethodAttributes.SpecialName; - } - // COMPAT: Native ilasm implicitly adds SpecialName when RTSpecialName is set - else if (methodDefinition.MethodAttributes.HasFlag(MethodAttributes.RTSpecialName)) - { - methodDefinition.MethodAttributes |= MethodAttributes.SpecialName; - } - - if (methodDefinition.MethodAttributes.HasFlag(MethodAttributes.Abstract) && !methodDefinition.ContainingType.Attributes.HasFlag(TypeAttributes.Abstract)) - { - ReportWarning(DiagnosticIds.AbstractMethodNotInAbstractType, - string.Format(DiagnosticMessageTemplates.AbstractMethodNotInAbstractType, methodDefinition.Name), - context); - } - - (EntityRegistry.ModuleReferenceEntity Module, string? EntryPoint, MethodImportAttributes Attributes)? pInvokeInformation = null; - foreach (var pInvokeInfo in context.pinvImpl()) - { - var (moduleName, entryPoint, attributes) = VisitPinvImpl(pInvokeInfo).Value; - if (moduleName is null) - { - ReportError(DiagnosticIds.InvalidPInvokeSignature, - DiagnosticMessageTemplates.InvalidPInvokeSignature, - pInvokeInfo); - continue; - } - pInvokeInformation = (_entityRegistry.GetOrCreateModuleReference(moduleName, _ => { }), entryPoint ?? name, attributes); - } - methodDefinition.MethodImportInformation = pInvokeInformation; - - SignatureHeader parsedHeader = new(sigHeader); - if (methodDefinition.MethodAttributes.HasFlag(MethodAttributes.Static) && (parsedHeader.IsInstance || parsedHeader.HasExplicitThis)) - { - // Error on static + instance. - } - // COMPAT: Native ilasm auto-adds instance calling convention for non-static methods in class context - if (!methodDefinition.MethodAttributes.HasFlag(MethodAttributes.Static) - && !parsedHeader.IsInstance - && _currentTypeDefinition.Count > 0) - { - sigHeader |= (byte)SignatureAttributes.Instance; - parsedHeader = new(sigHeader); - } - if (parsedHeader.HasExplicitThis && !parsedHeader.IsInstance) - { - // Warn on explicit-this + non-instance - parsedHeader = new(sigHeader |= (byte)SignatureAttributes.Instance); - } - methodSignature.WriteByte(sigHeader); - if (typarContexts.Length != 0) - { - methodSignature.WriteCompressedInteger(typarContexts.Length); - } - // Pass 2: Resolve constraints (now all params are registered) - for (int i = 0; i < typarContexts.Length; i++) - { - var param = methodDefinition.GenericParameters[i]; - foreach (var constraint in VisitTyBound(typarContexts[i].tyBound()).Value) - { - constraint.Owner = param; - param.Constraints.Add(constraint); - methodDefinition.GenericParameterConstraints.Add(constraint); - } - } - - var args = VisitSigArgs(context.sigArgs()).Value; - methodSignature.WriteCompressedInteger(args.Length); - - SignatureArg returnValue = new(VisitParamAttr(context.paramAttr()).Value, VisitType(context.type()).Value, VisitMarshalClause(context.marshalClause()).Value, null); - - returnValue.SignatureBlob.WriteContentTo(methodSignature); - methodDefinition.Parameters.Add(EntityRegistry.CreateParameter(returnValue.Attributes, returnValue.Name, returnValue.MarshallingDescriptor, 0)); - for (int i = 0; i < args.Length; i++) - { - SignatureArg? arg = args[i]; - arg.SignatureBlob.WriteContentTo(methodSignature); - // COMPAT: Native ilasm auto-generates A_N names for unnamed parameters - string? paramName = arg.Name ?? $"A_{i}"; - methodDefinition.Parameters.Add(EntityRegistry.CreateParameter(arg.Attributes, paramName, arg.MarshallingDescriptor, i + 1)); - } - // We've parsed all signature information. We can reset the current method now (the caller will handle setting/unsetting it for the method body). - _currentMethod = null; - methodDefinition.SignatureHeader = parsedHeader; - methodDefinition.MethodSignature = methodSignature; - - methodDefinition.ImplementationAttributes = context.implAttr().Aggregate((MethodImplAttributes)0, (acc, attr) => acc | VisitImplAttr(attr)); - if (!EntityRegistry.TryAddMethodDefinitionToContainingType(methodDefinition)) - { - ReportError(DiagnosticIds.DuplicateMethod, - DiagnosticMessageTemplates.DuplicateMethod, - context); - } - - return new(methodDefinition); - } - - GrammarResult ICILVisitor.VisitMethodName(CILParser.MethodNameContext context) => VisitMethodName(context); - public GrammarResult.String VisitMethodName(CILParser.MethodNameContext context) - { - IParseTree child = context.GetChild(0); - if (child is ITerminalNode terminal) - { - return new(terminal.Symbol.Text); - } - Debug.Assert(child is CILParser.DottedNameContext); - return (GrammarResult.String)child.Accept(this); - } - - private bool _expectInstance; - private Subsystem _subsystem = Subsystem.WindowsCui; - private CorFlags _corflags = CorFlags.ILOnly; - private int _alignment = 0x200; - private long _imageBase = 0x00400000; - private long _stackReserve; - - GrammarResult ICILVisitor.VisitMethodRef(CILParser.MethodRefContext context) => VisitMethodRef(context); - public GrammarResult.Literal VisitMethodRef(CILParser.MethodRefContext context) - { - if (context.mdtoken() is CILParser.MdtokenContext token) - { - return new(VisitMdtoken(token).Value); - } - if (context.dottedName() is CILParser.DottedNameContext dottedName) - { - // This is a typedef reference for a method member - string alias = VisitDottedName(dottedName).Value; - var resolved = TryResolveTypedefAsMember(alias); - if (resolved is not null) - { - return new(resolved); - } - ReportError(DiagnosticIds.TypedefNotFound, string.Format(DiagnosticMessageTemplates.TypedefNotFound, alias), context); - return new(_entityRegistry.CreateLazilyRecordedMemberReference(_entityRegistry.ModuleType, alias, new BlobBuilder())); - } - BlobBuilder methodRefSignature = new(); - if (context.callConv() is not CILParser.CallConvContext callConvCtx) - { - // Parse error recovery - callConv is missing - return new(_entityRegistry.CreateLazilyRecordedMemberReference(_entityRegistry.ModuleType, "", methodRefSignature)); - } - byte callConv = VisitCallConv(callConvCtx).Value; - EntityRegistry.TypeEntity owner = _entityRegistry.ModuleType; - if (context.typeSpec() is CILParser.TypeSpecContext typeSpec) - { - owner = VisitTypeSpec(typeSpec).Value; - } - string name = VisitMethodName(context.methodName()).Value; - BlobBuilder? methodSpecSignature = null; - int numGenericParameters = 0; - if (context.typeArgs() is CILParser.TypeArgsContext typeArgs) - { - var types = typeArgs.type(); - numGenericParameters = types.Length; - if (types.Length != 0) - { - methodSpecSignature = new(); - methodSpecSignature.WriteByte((byte)SignatureKind.MethodSpecification); - VisitTypeArgs(typeArgs).Value.WriteContentTo(methodSpecSignature); - } - } - else if (context.genArityNotEmpty() is CILParser.GenArityNotEmptyContext genArityNotEmpty) - { - numGenericParameters = VisitGenArityNotEmpty(genArityNotEmpty).Value; - } - if (numGenericParameters != 0) - { - callConv |= (byte)SignatureAttributes.Generic; - } - if (_expectInstance && (callConv & (byte)SignatureAttributes.Instance) == 0) - { - ReportWarning(DiagnosticIds.MissingInstanceCallConv, - DiagnosticMessageTemplates.MissingInstanceCallConv, - context); - callConv |= (byte)SignatureAttributes.Instance; - } - methodRefSignature.WriteByte(callConv); - if (numGenericParameters != 0) - { - methodRefSignature.WriteCompressedInteger(numGenericParameters); - } - var args = VisitSigArgs(context.sigArgs()).Value; - methodRefSignature.WriteCompressedInteger(args.Count(arg => !arg.IsSentinel)); - // Write return type - VisitType(context.type()).Value.WriteContentTo(methodRefSignature); - // Write arg signatures - foreach (var arg in args) - { - arg.SignatureBlob.WriteContentTo(methodRefSignature); - } - - var memberRef = _entityRegistry.CreateLazilyRecordedMemberReference(owner, name, methodRefSignature); - - if (methodSpecSignature is not null) - { - return new(_entityRegistry.GetOrCreateMethodSpecification(memberRef, methodSpecSignature)); - } - - return new(memberRef); - } - - private EntityRegistry.MemberReferenceEntity CreateExplicitMethodReference( - CILParser.CallConvContext callConv, - CILParser.TypeContext returnType, - CILParser.TypeSpecContext owner, - CILParser.MethodNameContext methodName, - CILParser.GenArityContext? genericArity, - CILParser.SigArgsContext parameterList) - { - EntityRegistry.TypeEntity ownerType = VisitTypeSpec(owner).Value; - string name = VisitMethodName(methodName).Value; - return _entityRegistry.CreateLazilyRecordedMemberReference( - ownerType, - name, - CreateExplicitMethodSignature(callConv, returnType, genericArity, parameterList)); - } - - private BlobBuilder CreateExplicitMethodSignature( - CILParser.CallConvContext callConv, - CILParser.TypeContext returnType, - CILParser.GenArityContext? genericArity, - CILParser.SigArgsContext parameterList) - { - BlobBuilder signature = new(); - byte signatureHeader = VisitCallConv(callConv).Value; - int arity = genericArity is null ? 0 : VisitGenArity(genericArity).Value; - if (arity != 0) - { - signatureHeader |= (byte)SignatureAttributes.Generic; - } - - signature.WriteByte(signatureHeader); - if (arity != 0) - { - signature.WriteCompressedInteger(arity); - } - - ImmutableArray parameters = VisitSigArgs(parameterList).Value; - signature.WriteCompressedInteger(parameters.Count(parameter => !parameter.IsSentinel)); - VisitType(returnType).Value.WriteContentTo(signature); - foreach (SignatureArg parameter in parameters) - { - parameter.SignatureBlob.WriteContentTo(signature); - } - - return signature; - } - - public GrammarResult VisitModuleHead(CILParser.ModuleHeadContext context) - { - if (context.ChildCount > 2) - { - _ = _entityRegistry.GetOrCreateModuleReference(VisitDottedName(context.dottedName()).Value, _ => { }); - return GrammarResult.SentinelValue.Result; - } - - if (context.dottedName() is { } moduleName) - { - _entityRegistry.Module.Name = VisitDottedName(moduleName).Value; - } - return GrammarResult.SentinelValue.Result; - } - - // .mscorlib directive indicates the assembly being compiled is mscorlib itself. - // This is currently a no-op; the flag would be used to affect type resolution - // when support for compiling mscorlib is added. - public GrammarResult VisitMscorlib(CILParser.MscorlibContext context) => GrammarResult.SentinelValue.Result; - - GrammarResult ICILVisitor.VisitNameSpaceHead(CILParser.NameSpaceHeadContext context) => VisitNameSpaceHead(context); - - public static GrammarResult.String VisitNameSpaceHead(CILParser.NameSpaceHeadContext context) => VisitDottedName(context.dottedName()); - - GrammarResult ICILVisitor.VisitNameValPair(CILParser.NameValPairContext context) => VisitNameValPair(context); - public GrammarResult.Literal> VisitNameValPair(CILParser.NameValPairContext context) - { - return new(new(VisitCompQstring(context.compQstring()).Value, VisitCaValue(context.caValue()).Value)); - } - - GrammarResult ICILVisitor.VisitNameValPairs(CILParser.NameValPairsContext context) => VisitNameValPairs(context); - public GrammarResult.Sequence> VisitNameValPairs(CILParser.NameValPairsContext context) => new(context.nameValPair().Select(pair => VisitNameValPair(pair).Value).ToImmutableArray()); - - GrammarResult ICILVisitor.VisitNativeType(CILParser.NativeTypeContext context) => VisitNativeType(context); - public GrammarResult.FormattedBlob VisitNativeType(CILParser.NativeTypeContext context) - { - if (context.nativeTypeElement() is not CILParser.NativeTypeElementContext element) - { - return new(new BlobBuilder()); - } - - CILParser.NativeTypeArrayPointerInfoContext[] arrayPointerInfo = context.nativeTypeArrayPointerInfo(); - if (arrayPointerInfo.Length == 0) - { - return VisitNativeTypeElement(element); - } - var prefix = new BlobBuilder(arrayPointerInfo.Length); - var elementType = VisitNativeTypeElement(element).Value; - var suffix = new BlobBuilder(); - - for (int i = arrayPointerInfo.Length - 1; i >= 0; i--) - { - if (arrayPointerInfo[i] is CILParser.PointerNativeTypeContext) - { - ReportWarning(DiagnosticIds.DeprecatedNativeType, - string.Format(DiagnosticMessageTemplates.DeprecatedNativeType, "pointer in array"), - context); - const int NATIVE_TYPE_PTR = 0x10; - prefix.WriteByte(NATIVE_TYPE_PTR); - } - else - { - prefix.WriteByte((byte)UnmanagedType.LPArray); - if (elementType.Count == 0) - { - // We need to have an element type for arrays, - // so write the invalid NATIVE_TYPE_MAX value so we have something parsable. - const int NATIVE_TYPE_MAX = 0x50; - elementType.WriteByte(NATIVE_TYPE_MAX); - } - } - } - - for (int i = 0; i < arrayPointerInfo.Length; i++) - { - if (arrayPointerInfo[i] is CILParser.PointerArrayTypeSizeContext size) - { - suffix.WriteCompressedInteger(0); - suffix.WriteCompressedInteger(VisitInt32(size.int32()).Value); - suffix.WriteCompressedInteger(0); - } - else if (arrayPointerInfo[i] is CILParser.PointerArrayTypeSizeParamIndexContext sizeParamIndex) - { - var ints = sizeParamIndex.int32(); - suffix.WriteCompressedInteger(VisitInt32(ints[1]).Value); - suffix.WriteCompressedInteger(VisitInt32(ints[0]).Value); - suffix.WriteCompressedInteger(1); // Write that the paramIndex parameter was specified - } - else if (arrayPointerInfo[i] is CILParser.PointerArrayTypeParamIndexContext paramIndex) - { - suffix.WriteCompressedInteger(VisitInt32(paramIndex.int32()).Value); - } - } - - prefix.LinkSuffix(elementType); - prefix.LinkSuffix(suffix); - return new(prefix); - } - - GrammarResult ICILVisitor.VisitNativeTypeElement(CILParser.NativeTypeElementContext context) => VisitNativeTypeElement(context); - public GrammarResult.FormattedBlob VisitNativeTypeElement(CILParser.NativeTypeElementContext context) - { - var blob = new BlobBuilder(); - if (context.dottedName() is CILParser.DottedNameContext typedef) - { - // Native type typedefs are not yet fully supported - // For now, report an error and return empty blob - string alias = VisitDottedName(typedef).Value; - ReportError(DiagnosticIds.TypedefNotFound, string.Format(DiagnosticMessageTemplates.TypedefNotFound, alias), context); - return new(blob); - } - - if (context.marshalType is null) - { - if (context.marshalBool is not null) - { - blob.WriteByte((byte)UnmanagedType.VariantBool); - } - else if (context.unsignedMarshalType is not null) - { - blob.WriteByte(context.unsignedMarshalType.Type switch - { - CILParser.INT8 => (byte)UnmanagedType.U1, - CILParser.INT16 => (byte)UnmanagedType.U2, - CILParser.INT32_ => (byte)UnmanagedType.U4, - CILParser.INT64_ => (byte)UnmanagedType.U8, - _ => throw new UnreachableException(), - }); - } - return new(blob); - } - - switch (context.marshalType.Type) - { - case CILParser.CUSTOM: - { - blob.WriteByte((byte)UnmanagedType.CustomMarshaler); - CILParser.CompQstringContext[] strings = context.compQstring(); - if (strings.Length == 4) - { - ReportWarning(DiagnosticIds.DeprecatedCustomMarshaller, - DiagnosticMessageTemplates.DeprecatedCustomMarshaller, - context); - blob.WriteSerializedString(VisitCompQstring(strings[0]).Value); - blob.WriteSerializedString(VisitCompQstring(strings[1]).Value); - blob.WriteSerializedString(VisitCompQstring(strings[2]).Value); - blob.WriteSerializedString(VisitCompQstring(strings[3]).Value); - } - else - { - Debug.Assert(strings.Length == 2); - blob.WriteCompressedInteger(0); - blob.WriteCompressedInteger(0); - blob.WriteSerializedString(VisitCompQstring(strings[0]).Value); - blob.WriteSerializedString(VisitCompQstring(strings[1]).Value); - } - break; - } - case CILParser.SYSSTRING: - blob.WriteByte((byte)UnmanagedType.ByValTStr); - blob.WriteCompressedInteger(VisitInt32(context.int32()).Value); - break; - case CILParser.ARRAY: - blob.WriteByte((byte)UnmanagedType.ByValArray); - blob.WriteCompressedInteger(VisitInt32(context.int32()).Value); - VisitNativeType(context.nativeType()).Value.WriteContentTo(blob); - break; - case CILParser.VARIANT: - ReportWarning(DiagnosticIds.DeprecatedNativeType, - string.Format(DiagnosticMessageTemplates.DeprecatedNativeType, "VARIANT"), - context); - const int NATIVE_TYPE_VARIANT = 0xe; - blob.WriteByte(NATIVE_TYPE_VARIANT); - break; -#pragma warning disable CS0618 // Type or member is obsolete - case CILParser.CURRENCY: - blob.WriteByte((byte)UnmanagedType.Currency); - break; -#pragma warning restore CS0618 // Type or member is obsolete - case CILParser.SYSCHAR: - ReportWarning(DiagnosticIds.DeprecatedNativeType, - string.Format(DiagnosticMessageTemplates.DeprecatedNativeType, "SYSCHAR"), - context); - const int NATIVE_TYPE_SYSCHAR = 0xd; - blob.WriteByte(NATIVE_TYPE_SYSCHAR); - break; - case CILParser.VOID: - ReportWarning(DiagnosticIds.DeprecatedNativeType, - string.Format(DiagnosticMessageTemplates.DeprecatedNativeType, "VOID"), - context); - const int NATIVE_TYPE_VOID = 0x1; - blob.WriteByte(NATIVE_TYPE_VOID); - break; - case CILParser.BOOL: - blob.WriteByte((byte)UnmanagedType.Bool); - break; - case CILParser.INT8: - blob.WriteByte((byte)UnmanagedType.I1); - break; - case CILParser.INT16: - blob.WriteByte((byte)UnmanagedType.I2); - break; - case CILParser.INT32_: - blob.WriteByte((byte)UnmanagedType.I4); - break; - case CILParser.INT64_: - blob.WriteByte((byte)UnmanagedType.I8); - break; - case CILParser.FLOAT32: - blob.WriteByte((byte)UnmanagedType.R4); - break; - case CILParser.FLOAT64_: - blob.WriteByte((byte)UnmanagedType.R8); - break; - case CILParser.ERROR: - blob.WriteByte((byte)UnmanagedType.Error); - break; - case CILParser.UINT8: - blob.WriteByte((byte)UnmanagedType.U1); - break; - case CILParser.UINT16: - blob.WriteByte((byte)UnmanagedType.U2); - break; - case CILParser.UINT32: - blob.WriteByte((byte)UnmanagedType.U4); - break; - case CILParser.UINT64: - blob.WriteByte((byte)UnmanagedType.U8); - break; - case CILParser.DECIMAL: - ReportWarning(DiagnosticIds.DeprecatedNativeType, - string.Format(DiagnosticMessageTemplates.DeprecatedNativeType, "DECIMAL"), - context); - const int NATIVE_TYPE_DECIMAL = 0x11; - blob.WriteByte(NATIVE_TYPE_DECIMAL); - break; - case CILParser.DATE: - ReportWarning(DiagnosticIds.DeprecatedNativeType, - string.Format(DiagnosticMessageTemplates.DeprecatedNativeType, "DATE"), - context); - const int NATIVE_TYPE_DATE = 0x12; - blob.WriteByte(NATIVE_TYPE_DATE); - break; - case CILParser.BSTR: - // Distinguish 'ansi bstr' (AnsiBStr) from plain 'bstr' (BStr) - if (context.ANSI() is not null) - { -#pragma warning disable CS0618 // Type or member is obsolete - blob.WriteByte((byte)UnmanagedType.AnsiBStr); -#pragma warning restore CS0618 - } - else - { - blob.WriteByte((byte)UnmanagedType.BStr); - } - break; - case CILParser.LPSTR: - blob.WriteByte((byte)UnmanagedType.LPStr); - break; - case CILParser.LPWSTR: - blob.WriteByte((byte)UnmanagedType.LPWStr); - break; - case CILParser.LPTSTR: - blob.WriteByte((byte)UnmanagedType.LPTStr); - break; - case CILParser.OBJECTREF: - ReportWarning(DiagnosticIds.DeprecatedNativeType, - string.Format(DiagnosticMessageTemplates.DeprecatedNativeType, "OBJECTREF"), - context); - const int NATIVE_TYPE_OBJECTREF = 0x18; - blob.WriteByte(NATIVE_TYPE_OBJECTREF); - break; - case CILParser.IUNKNOWN: - { - blob.WriteByte((byte)UnmanagedType.IUnknown); - if (VisitIidParamIndex(context.iidParamIndex()) is { Value: int index }) - { - blob.WriteCompressedInteger(index); - } - break; - } - case CILParser.IDISPATCH: - { - blob.WriteByte((byte)UnmanagedType.IDispatch); - if (VisitIidParamIndex(context.iidParamIndex()) is { Value: int index }) - { - blob.WriteCompressedInteger(index); - } - break; - } - case CILParser.STRUCT: - // Distinguish 'nested struct' from plain 'struct' - if (context.GetChild(0)?.GetText() == "nested") - { - ReportWarning(DiagnosticIds.DeprecatedNativeType, - string.Format(DiagnosticMessageTemplates.DeprecatedNativeType, "NESTEDSTRUCT"), - context); - const int NATIVE_TYPE_NESTEDSTRUCT = 0x21; - blob.WriteByte(NATIVE_TYPE_NESTEDSTRUCT); - } - else - { - blob.WriteByte((byte)UnmanagedType.Struct); - } - break; - case CILParser.INTERFACE: - { - blob.WriteByte((byte)UnmanagedType.Interface); - if (VisitIidParamIndex(context.iidParamIndex()) is { Value: int index }) - { - blob.WriteCompressedInteger(index); - } - break; - } - case CILParser.SAFEARRAY: - blob.WriteByte((byte)UnmanagedType.SafeArray); - blob.WriteCompressedInteger((int)VisitVariantType(context.variantType()).Value); - if (context.compQstring() is { Length: 1 } safeArrayCustomType) - { - string str = VisitCompQstring(safeArrayCustomType[0]).Value; - blob.WriteSerializedString(str); - } - else - { - blob.WriteCompressedInteger(0); - } - break; - case CILParser.INT: - blob.WriteByte((byte)UnmanagedType.SysInt); - break; - case CILParser.UINT: - blob.WriteByte((byte)UnmanagedType.SysUInt); - break; -#pragma warning disable CS0618 // Type or member is obsolete - case CILParser.BYVALSTR: - blob.WriteByte((byte)UnmanagedType.VBByRefStr); - break; - case CILParser.TBSTR: - blob.WriteByte((byte)UnmanagedType.TBStr); - break; -#pragma warning restore CS0618 // Type or member is obsolete - case CILParser.METHOD: - blob.WriteByte((byte)UnmanagedType.FunctionPtr); - break; - case CILParser.LPSTRUCT: - blob.WriteByte((byte)UnmanagedType.LPStruct); - break; -#pragma warning disable CS0618 // Type or member is obsolete - case CILParser.ANY: - blob.WriteByte((byte)UnmanagedType.AsAny); - break; -#pragma warning restore CS0618 // Type or member is obsolete - } - - return new(blob); - } - - GrammarResult ICILVisitor.VisitObjSeq(CILParser.ObjSeqContext context) => VisitObjSeq(context); - public GrammarResult.FormattedBlob VisitObjSeq(CILParser.ObjSeqContext context) - { - BlobBuilder objSeqBlob = new(); - foreach (var item in context.serInit()) - { - // Each element in object[] is encoded as FieldOrPropType + value, - // where FieldOrPropType is the concrete type (bool, int32, string, etc.), - // NOT TaggedObject (0x51). The object(...) wrapper is used to explicitly - // box a value but does not change the element's concrete type in the encoding. - // Unwrap any object(...) wrappers to get the actual typed inner element. - CILParser.SerInitContext actualItem = item; - while (actualItem.serInit() is { } inner) - { - actualItem = inner; - } - WriteCustomAttributeFieldOrPropType(objSeqBlob, actualItem); - objSeqBlob.LinkSuffix(VisitSerInit(actualItem).Value); - } - return new(objSeqBlob); - } - - GrammarResult ICILVisitor.VisitOwnerType(CILParser.OwnerTypeContext context) => VisitOwnerType(context); - public GrammarResult.Literal VisitOwnerType(CILParser.OwnerTypeContext context) - { - if (context.memberRef() is CILParser.MemberRefContext memberRef) - { - return VisitMemberRef(memberRef); - } - if (context.typeSpec() is CILParser.TypeSpecContext typeSpec) - { - return new(VisitTypeSpec(typeSpec).Value); - } - throw new UnreachableException(); - } - GrammarResult ICILVisitor.VisitParamAttr(CILParser.ParamAttrContext context) => VisitParamAttr(context); - public GrammarResult.Literal VisitParamAttr(CILParser.ParamAttrContext context) - { - ParameterAttributes attributes = 0; - foreach (var element in context.paramAttrElement()) - { - attributes |= VisitParamAttrElement(element); - } - return new(attributes); - } - - GrammarResult ICILVisitor.VisitParamAttrElement(CILParser.ParamAttrElementContext context) => VisitParamAttrElement(context); - public GrammarResult.Flag VisitParamAttrElement(CILParser.ParamAttrElementContext context) - { - if (context.int32() is CILParser.Int32Context int32) - { - return new((ParameterAttributes)(VisitInt32(int32).Value + 1), ShouldAppend: false); - } - return context switch - { - { @in: not null } => new(ParameterAttributes.In), - { @out: not null } => new(ParameterAttributes.Out), - { opt: not null } => new(ParameterAttributes.Optional), - _ => throw new UnreachableException() - }; - } - - GrammarResult ICILVisitor.VisitPinvAttr(CILParser.PinvAttrContext context) => VisitPinvAttr(context); - public GrammarResult.Flag VisitPinvAttr(CILParser.PinvAttrContext context) - { - if (context.int32() is CILParser.Int32Context int32) - { - return new((MethodImportAttributes)VisitInt32(int32).Value, ShouldAppend: false); - } - switch (context.GetText()) - { - case "nomangle": - return new(MethodImportAttributes.ExactSpelling); - case "ansi": - return new(MethodImportAttributes.CharSetAnsi); - case "unicode": - return new(MethodImportAttributes.CharSetUnicode); - case "autochar": - return new(MethodImportAttributes.CharSetAuto); - case "lasterr": - return new(MethodImportAttributes.SetLastError); - case "winapi": - return new(MethodImportAttributes.CallingConventionWinApi); - case "cdecl": - return new(MethodImportAttributes.CallingConventionCDecl); - case "stdcall": - return new(MethodImportAttributes.CallingConventionStdCall); - case "thiscall": - return new(MethodImportAttributes.CallingConventionThisCall); - case "fastcall": - return new(MethodImportAttributes.CallingConventionFastCall); - case "bestfit:on": - return new(MethodImportAttributes.BestFitMappingEnable); - case "bestfit:off": - return new(MethodImportAttributes.BestFitMappingDisable); - case "charmaperror:on": - return new(MethodImportAttributes.ThrowOnUnmappableCharEnable); - case "charmaperror:off": - return new(MethodImportAttributes.ThrowOnUnmappableCharDisable); - default: - throw new UnreachableException(); - } - } - - GrammarResult ICILVisitor.VisitPinvImpl(CILParser.PinvImplContext context) => VisitPinvImpl(context); - public GrammarResult.Literal<(string? ModuleName, string? EntryPointName, MethodImportAttributes Attributes)> VisitPinvImpl(CILParser.PinvImplContext context) - { - MethodImportAttributes attrs = MethodImportAttributes.None; - foreach (var attr in context.pinvAttr()) - { - attrs |= VisitPinvAttr(attr); - } - var names = context.compQstring(); - string? moduleName = names.Length > 0 ? VisitCompQstring(names[0]).Value : null; - string? entryPointName = names.Length > 1 ? VisitCompQstring(names[1]).Value : null; - return new((moduleName, entryPointName, attrs)); - } - - GrammarResult ICILVisitor.VisitPropAttr(CILParser.PropAttrContext context) => VisitPropAttr(context); - public static GrammarResult.Flag VisitPropAttr(CILParser.PropAttrContext context) - { - return context.GetText() switch - { - "specialname" => new(PropertyAttributes.SpecialName), - "rtspecialname" => new(0), // COMPAT: Ignore - _ => throw new UnreachableException(), - }; - } - - GrammarResult ICILVisitor.VisitPropDecl(CILParser.PropDeclContext context) => VisitPropDecl(context); - public GrammarResult.Literal<(MethodSemanticsAttributes, EntityRegistry.EntityBase)?> VisitPropDecl(CILParser.PropDeclContext context) - { - if (context.ChildCount != 2) - { - return new(null); - } - string accessor = context.GetChild(0).GetText(); - EntityRegistry.EntityBase memberReference = VisitMethodRef(context.methodRef()).Value; - MethodSemanticsAttributes methodSemanticsAttributes = accessor switch - { - ".set" => MethodSemanticsAttributes.Setter, - ".get" => MethodSemanticsAttributes.Getter, - ".other" => MethodSemanticsAttributes.Other, - _ => throw new UnreachableException(), - }; - return new((methodSemanticsAttributes, memberReference)); - } - - GrammarResult ICILVisitor.VisitPropDecls(CILParser.PropDeclsContext context) => VisitPropDecls(context); - public GrammarResult.Sequence<(MethodSemanticsAttributes, EntityRegistry.EntityBase)> VisitPropDecls(CILParser.PropDeclsContext context) - => new( - context.propDecl() - .Select(decl => VisitPropDecl(decl).Value) - .Where(decl => decl is not null) - .Select(decl => decl!.Value).ToImmutableArray()); - - GrammarResult ICILVisitor.VisitPropHead(ILAssembler.CILParser.PropHeadContext context) => VisitPropHead(context); - public GrammarResult.Literal VisitPropHead(CILParser.PropHeadContext context) - { - var propAttrs = context.propAttr().Select(VisitPropAttr).Aggregate((PropertyAttributes)0, (a, b) => a | b); - var name = VisitDottedName(context.dottedName()).Value; - - var signature = new BlobBuilder(); - byte callConv = (byte)(VisitCallConv(context.callConv()).Value | (byte)SignatureKind.Property); - signature.WriteByte(callConv); - var args = VisitSigArgs(context.sigArgs()).Value; - signature.WriteCompressedInteger(args.Length); - VisitType(context.type()).Value.WriteContentTo(signature); - foreach (var arg in args) - { - arg.SignatureBlob.WriteContentTo(signature); - } - - // Handle initOpt to set the Constant table entry if a constant value is provided. - var constantValue = VisitInitOpt(context.initOpt()).Value; - var property = new EntityRegistry.PropertyEntity(propAttrs, signature, name); - if (constantValue is not NoConstantSentinel) - { - property.ConstantValue = constantValue; - property.HasConstant = true; - property.Attributes |= PropertyAttributes.HasDefault; - } - return new(property); - } - - GrammarResult ICILVisitor.VisitRepeatOpt(CILParser.RepeatOptContext context) => VisitRepeatOpt(context); - public GrammarResult.Literal VisitRepeatOpt(CILParser.RepeatOptContext context) => context.int32() is {} int32 ? new(VisitInt32(int32).Value) : new(null); - - public GrammarResult VisitScopeBlock(CILParser.ScopeBlockContext context) - { - int numLocalsScopes = _currentMethod!.LocalsScopes.Count; - _ = VisitMethodDecls(context.methodDecls()); - _currentMethod.LocalsScopes.RemoveRange(numLocalsScopes, _currentMethod.LocalsScopes.Count - numLocalsScopes); - return GrammarResult.SentinelValue.Result; - } - - GrammarResult ICILVisitor.VisitSecAction(CILParser.SecActionContext context) => VisitSecAction(context); - public static GrammarResult.Literal VisitSecAction(CILParser.SecActionContext context) - { - return context.GetText() switch - { - "request" => new(DeclarativeSecurityAction.Request), - "demand" => new(DeclarativeSecurityAction.Demand), - "assert" => new(DeclarativeSecurityAction.Assert), - "deny" => new(DeclarativeSecurityAction.Deny), - "permitonly" => new(DeclarativeSecurityAction.PermitOnly), - "linkcheck" => new(DeclarativeSecurityAction.LinkDemand), - "inheritcheck" => new(DeclarativeSecurityAction.InheritanceDemand), - "reqmin" => new(DeclarativeSecurityAction.RequestMinimum), - "reqopt" => new(DeclarativeSecurityAction.RequestOptional), - "reqrefuse" => new(DeclarativeSecurityAction.RequestRefuse), - "prejitgrant" => new(DeclarativeSecurityAction.PrejitGrant), - "prejitdeny" => new(DeclarativeSecurityAction.PrejitDeny), - "noncasdemand" => new(DeclarativeSecurityAction.NonCasDemand), - "noncaslinkdemand" => new(DeclarativeSecurityAction.NonCasLinkDemand), - "noncasinheritance" => new(DeclarativeSecurityAction.NonCasInheritanceDemand), - _ => throw new UnreachableException() - }; - } - GrammarResult ICILVisitor.VisitSecAttrBlob(CILParser.SecAttrBlobContext context) => VisitSecAttrBlob(context); - public GrammarResult.FormattedBlob VisitSecAttrBlob(CILParser.SecAttrBlobContext context) - { - var blob = new BlobBuilder(); - - string attributeName = string.Empty; - - if (context.typeSpec() is CILParser.TypeSpecContext typeSpec && VisitTypeSpec(typeSpec).Value is EntityRegistry.IHasReflectionNotation reflectionNotation) - { - attributeName = reflectionNotation.ReflectionNotation; - } - else if (context.SQSTRING() is { } sqstring) - { - attributeName = StringHelpers.ParseQuotedString(sqstring.GetText()); - } - - blob.WriteSerializedString(attributeName); - VisitCustomBlobNVPairs(context.customBlobNVPairs()).Value.WriteContentTo(blob); - - return new(blob); - } - - GrammarResult ICILVisitor.VisitSecAttrSetBlob(CILParser.SecAttrSetBlobContext context) => VisitSecAttrSetBlob(context); - public GrammarResult.FormattedBlob VisitSecAttrSetBlob(CILParser.SecAttrSetBlobContext context) - { - BlobBuilder blob = new(); - var secAttributes = context.secAttrBlob(); - blob.WriteByte((byte)'.'); - blob.WriteCompressedInteger(secAttributes.Length); - foreach (var secAttribute in secAttributes) - { - VisitSecAttrBlob(secAttribute).Value.WriteContentTo(blob); - } - return new(blob); - } - - GrammarResult ICILVisitor.VisitSecDecl(CILParser.SecDeclContext context) => VisitSecDecl(context); - public GrammarResult.Literal VisitSecDecl(CILParser.SecDeclContext context) - { - if (ContainsParserError(context)) - { - return new(null); - } - - if (context.PERMISSION() is not null) - { - ReportError(DiagnosticIds.UnsupportedSecurityDeclaration, - DiagnosticMessageTemplates.UnsupportedSecurityDeclaration, - context); - return new(null); - } - DeclarativeSecurityAction action = VisitSecAction(context.secAction()).Value; - BlobBuilder value; - if (context.secAttrSetBlob() is CILParser.SecAttrSetBlobContext setBlob) - { - value = VisitSecAttrSetBlob(setBlob).Value; - } - else if (context.bytes() is CILParser.BytesContext bytes) - { - value = new(); - value.WriteBytes(VisitBytes(bytes).Value); - } - else if (context.compQstring() is CILParser.CompQstringContext str) - { - value = new BlobBuilder(); - value.WriteUTF16(VisitCompQstring(str).Value); - value.WriteUTF16("\0"); - } - else - { - throw new UnreachableException(); - } - return new(_entityRegistry.CreateDeclarativeSecurityAttribute(action, value)); - } - - private bool ContainsParserError(ParserRuleContext context) - => _parserErrorContexts.Contains(context); - - internal abstract record ExceptionClause(LabelHandle Start, LabelHandle End) - { - internal sealed record Catch(EntityRegistry.TypeEntity Type, LabelHandle Start, LabelHandle End) : ExceptionClause(Start, End); - - internal sealed record Filter(LabelHandle FilterStart, LabelHandle Start, LabelHandle End) : ExceptionClause(Start, End); - - internal sealed record Finally(LabelHandle Start, LabelHandle End) : ExceptionClause(Start, End); - - internal sealed record Fault(LabelHandle Start, LabelHandle End) : ExceptionClause(Start, End); - } - - public GrammarResult VisitSehBlock(CILParser.SehBlockContext context) - { - var (tryStart, tryEnd) = VisitTryBlock(context.tryBlock()).Value; - foreach (var clause in VisitSehClauses(context.sehClauses()).Value) - { - switch (clause) - { - case ExceptionClause.Finally finallyClause: - _currentMethod!.Definition.ExceptionRegions.Add(new EntityRegistry.ExceptionRegion.FinallyRegion(tryStart, tryEnd, finallyClause.Start, finallyClause.End)); - break; - case ExceptionClause.Fault faultClause: - _currentMethod!.Definition.ExceptionRegions.Add(new EntityRegistry.ExceptionRegion.FaultRegion(tryStart, tryEnd, faultClause.Start, faultClause.End)); - break; - case ExceptionClause.Catch catchClause: - _currentMethod!.Definition.ExceptionRegions.Add(new EntityRegistry.ExceptionRegion.CatchRegion(tryStart, tryEnd, catchClause.Start, catchClause.End, catchClause.Type)); - break; - case ExceptionClause.Filter filterClause: - _currentMethod!.Definition.ExceptionRegions.Add(new EntityRegistry.ExceptionRegion.FilterRegion(tryStart, tryEnd, filterClause.Start, filterClause.End, filterClause.FilterStart)); - break; - default: - throw new UnreachableException(); - } - } - return GrammarResult.SentinelValue.Result; - } - GrammarResult ICILVisitor.VisitSehClause(CILParser.SehClauseContext context) => VisitSehClause(context); - public GrammarResult.Literal VisitSehClause(CILParser.SehClauseContext context) - { - EntityRegistry.TypeEntity? catchType = context.catchClause() is { } catchClause - ? VisitCatchClause(catchClause).Value - : null; - LabelHandle? filterStart = context.filterClause() is { } filterClause - ? VisitFilterClause(filterClause).Value - : null; - var (start, end) = VisitHandlerBlock(context.handlerBlock()).Value; - - if (context.finallyClause() is not null) - { - return new(new ExceptionClause.Finally(start, end)); - } - if (context.faultClause() is not null) - { - return new(new ExceptionClause.Fault(start, end)); - } - if (catchType is not null) - { - return new(new ExceptionClause.Catch(catchType, start, end)); - } - if (filterStart is not null) - { - return new(new ExceptionClause.Filter(filterStart.Value, start, end)); - } - - throw new UnreachableException(); - } - - GrammarResult ICILVisitor.VisitSehClauses(CILParser.SehClausesContext context) => VisitSehClauses(context); - public GrammarResult.Sequence VisitSehClauses(CILParser.SehClausesContext context) => new(context.sehClause().Select(clause => VisitSehClause(clause).Value).ToImmutableArray()); - - GrammarResult ICILVisitor.VisitSerializType(CILParser.SerializTypeContext context) => VisitSerializType(context); - public GrammarResult.FormattedBlob VisitSerializType(CILParser.SerializTypeContext context) - { - var blob = new BlobBuilder(); - if (context.ARRAY_TYPE_NO_BOUNDS() is not null) - { - blob.WriteByte((byte)SerializationTypeCode.SZArray); - } - VisitSerializTypeElement(context.serializTypeElement()).Value.WriteContentTo(blob); - return new(blob); - } - - GrammarResult ICILVisitor.VisitSerializTypeElement(CILParser.SerializTypeElementContext context) => VisitSerializTypeElement(context); - public GrammarResult.FormattedBlob VisitSerializTypeElement(CILParser.SerializTypeElementContext context) - { - if (context.simpleType() is CILParser.SimpleTypeContext simpleType) - { - BlobBuilder blob = new(1); - blob.WriteByte((byte)VisitSimpleType(simpleType).Value); - return new(blob); - } - if (context.dottedName() is CILParser.DottedNameContext dottedName) - { - // Serialization type typedefs are not yet fully supported - string alias = VisitDottedName(dottedName).Value; - ReportError(DiagnosticIds.TypedefNotFound, string.Format(DiagnosticMessageTemplates.TypedefNotFound, alias), context); - return new(new BlobBuilder(1)); - } - if (context.TYPE() is not null) - { - BlobBuilder blob = new BlobBuilder(1); - blob.WriteByte((byte)SerializationTypeCode.Type); - return new(blob); - } - if (context.OBJECT() is not null) - { - BlobBuilder blob = new BlobBuilder(1); - blob.WriteByte((byte)SerializationTypeCode.TaggedObject); - return new(blob); - } - if (context.ENUM() is not null) - { - BlobBuilder blob = new BlobBuilder(); - blob.WriteByte((byte)SerializationTypeCode.Enum); - if (context.SQSTRING() is ITerminalNode sqString) - { - blob.WriteSerializedString(StringHelpers.ParseQuotedString(sqString.GetText())); - } - else - { - Debug.Assert(context.className() is not null); - blob.WriteSerializedString((VisitClassName(context.className()).Value as EntityRegistry.IHasReflectionNotation)?.ReflectionNotation ?? ""); - } - return new(blob); - } - throw new UnreachableException(); - } - - GrammarResult ICILVisitor.VisitSerInit(CILParser.SerInitContext context) => VisitSerInit(context); - public GrammarResult.FormattedBlob VisitSerInit(CILParser.SerInitContext context) - { - if (context.fieldSerInit() is CILParser.FieldSerInitContext fieldSerInit) - { - if (fieldSerInit.bytes() is not null) - { - ReportError( - DiagnosticIds.InvalidMetadataToken, - "bytearray is not a valid structured custom attribute value", - context); - var invalidValue = new BlobBuilder(); - invalidValue.WriteSerializedString(null); - return new(invalidValue); - } - - ImmutableArray encodedValue = VisitFieldSerInit(fieldSerInit).Value.ToImmutableArray(); - var value = new BlobBuilder(Math.Max(0, encodedValue.Length - 1)); - if (encodedValue.Length > 1) - { - value.WriteBytes(encodedValue.AsSpan().Slice(1).ToArray()); - } - return new(value); - } - - if (context.serInit() is CILParser.SerInitContext serInit) - { - Debug.Assert(context.OBJECT() is not null); - BlobBuilder taggedObjectBlob = new(); - WriteCustomAttributeFieldOrPropType(taggedObjectBlob, serInit); - taggedObjectBlob.LinkSuffix(VisitSerInit(serInit).Value); - return new(taggedObjectBlob); - } - - if (context.int32() is not CILParser.Int32Context arrLength) - { - BlobBuilder blob = new(); - if (context.className() is CILParser.ClassNameContext className) - { - blob.WriteSerializedString(VisitClassName(className).Value is EntityRegistry.IHasReflectionNotation reflection ? reflection.ReflectionNotation : string.Empty); - } - else - { - blob.WriteSerializedString( - context.SQSTRING() is { } stringNode - ? StringHelpers.ParseQuotedString(stringNode.Symbol.Text) - : null); - } - return new(blob); - } - - BlobBuilder arrayHeader = new(sizeof(int)); - arrayHeader.WriteInt32(VisitInt32(arrLength).Value); - var sequenceResult = (GrammarResult.FormattedBlob)Visit(context.GetRuleContext(1)); - arrayHeader.LinkSuffix(sequenceResult.Value); - return new(arrayHeader); - } - - private static void WriteCustomAttributeFieldOrPropType( - BlobBuilder builder, - CILParser.SerInitContext context) - { - int tokenType = context.fieldSerInit() is { } fieldSerInit - ? ((ITerminalNode)fieldSerInit.GetChild(0)).Symbol.Type - : ((ITerminalNode)context.GetChild(0)).Symbol.Type; - if (context.fieldSerInit()?.bytes() is not null) - { - builder.WriteByte((byte)SerializationTypeCode.String); - return; - } - if (context.int32() is not null) - { - builder.WriteByte((byte)SerializationTypeCode.SZArray); - } - - builder.WriteByte((byte)GetTypeCodeForToken(tokenType)); - } - - private static SerializationTypeCode GetTypeCodeForToken(int tokenType) - { - return tokenType switch - { - CILParser.INT8 => SerializationTypeCode.SByte, - CILParser.UINT8 => SerializationTypeCode.Byte, - CILParser.INT16 => SerializationTypeCode.Int16, - CILParser.UINT16 => SerializationTypeCode.UInt16, - CILParser.INT32_ => SerializationTypeCode.Int32, - CILParser.UINT32 => SerializationTypeCode.UInt32, - CILParser.INT64_ => SerializationTypeCode.Int64, - CILParser.UINT64 => SerializationTypeCode.UInt64, - CILParser.FLOAT32 => SerializationTypeCode.Single, - CILParser.FLOAT64_ => SerializationTypeCode.Double, - CILParser.CHAR => SerializationTypeCode.Char, - CILParser.BOOL => SerializationTypeCode.Boolean, - CILParser.STRING => SerializationTypeCode.String, - CILParser.TYPE => SerializationTypeCode.Type, - CILParser.OBJECT => SerializationTypeCode.TaggedObject, - _ => throw new UnreachableException() - }; - } - - /// - /// Checks if a type entity is a well-known corelib type and returns its primitive type code. - /// Native ilasm uses primitive type codes for well-known types like System.String and System.Object - /// in signature blobs instead of class/valuetype TypeRef references. - /// - private static SignatureTypeCode? TryGetPrimitiveTypeCode(EntityRegistry.TypeEntity typeEntity, bool isValueType) - { - if (typeEntity is not EntityRegistry.TypeReferenceEntity typeRef) - { - return null; - } - - string name = typeRef.Name; - string ns = typeRef.Namespace; - - if (ns != "System") - { - return null; - } - - if (isValueType) - { - return name switch - { - "Boolean" => SignatureTypeCode.Boolean, - "Char" => SignatureTypeCode.Char, - "SByte" => SignatureTypeCode.SByte, - "Byte" => SignatureTypeCode.Byte, - "Int16" => SignatureTypeCode.Int16, - "UInt16" => SignatureTypeCode.UInt16, - "Int32" => SignatureTypeCode.Int32, - "UInt32" => SignatureTypeCode.UInt32, - "Int64" => SignatureTypeCode.Int64, - "UInt64" => SignatureTypeCode.UInt64, - "Single" => SignatureTypeCode.Single, - "Double" => SignatureTypeCode.Double, - "IntPtr" => SignatureTypeCode.IntPtr, - "UIntPtr" => SignatureTypeCode.UIntPtr, - "TypedReference" => SignatureTypeCode.TypedReference, - _ => null - }; - } - - return name switch - { - "String" => SignatureTypeCode.String, - "Object" => SignatureTypeCode.Object, - _ => null - }; - } - - GrammarResult ICILVisitor.VisitSigArg(CILParser.SigArgContext context) => VisitSigArg(context); - public GrammarResult.Literal VisitSigArg(CILParser.SigArgContext context) - { - if (context.ELLIPSIS() is not null) - { - return new(SignatureArg.CreateSentinelArgument()); - } - string? name = context.id() is CILParser.IdContext id ? VisitId(id).Value : null; - return new(new SignatureArg( - VisitParamAttr(context.paramAttr()).Value, - VisitType(context.type()).Value, - VisitMarshalClause(context.marshalClause()).Value, - name)); - } - - GrammarResult ICILVisitor.VisitSigArgs(CILParser.SigArgsContext context) => VisitSigArgs(context); - public GrammarResult.Sequence VisitSigArgs(CILParser.SigArgsContext context) => new([.. context.sigArg().Select(arg => VisitSigArg(arg).Value)]); - GrammarResult ICILVisitor.VisitSimpleType(CILParser.SimpleTypeContext context) => VisitSimpleType(context); - public GrammarResult.Literal VisitSimpleType(CILParser.SimpleTypeContext context) - { - // Handle 'unsigned intN' forms (2 children: 'unsigned' + intN keyword) - if (context.ChildCount == 2) - { - return new(context.GetChild(1).Symbol.Type switch - { - CILParser.INT8 => SignatureTypeCode.Byte, - CILParser.INT16 => SignatureTypeCode.UInt16, - CILParser.INT32_ => SignatureTypeCode.UInt32, - CILParser.INT64_ => SignatureTypeCode.UInt64, - _ => throw new UnreachableException() - }); - } - - return new(context.GetChild(0).Symbol.Type switch - { - CILParser.CHAR => SignatureTypeCode.Char, - CILParser.STRING => SignatureTypeCode.String, - CILParser.BOOL => SignatureTypeCode.Boolean, - CILParser.INT8 => SignatureTypeCode.SByte, - CILParser.INT16 => SignatureTypeCode.Int16, - CILParser.INT32_ => SignatureTypeCode.Int32, - CILParser.INT64_ => SignatureTypeCode.Int64, - CILParser.FLOAT32 => SignatureTypeCode.Single, - CILParser.FLOAT64_ => SignatureTypeCode.Double, - CILParser.UINT8 => SignatureTypeCode.Byte, - CILParser.UINT16 => SignatureTypeCode.UInt16, - CILParser.UINT32 => SignatureTypeCode.UInt32, - CILParser.UINT64 => SignatureTypeCode.UInt64, - _ => throw new UnreachableException() - }); - } - - GrammarResult ICILVisitor.VisitSlashedName(CILParser.SlashedNameContext context) - { - return VisitSlashedName(context); - } - - public static GrammarResult.Literal VisitSlashedName(CILParser.SlashedNameContext context) - { - TypeName? currentTypeName = null; - foreach (var item in context.dottedName()) - { - currentTypeName = new TypeName(currentTypeName, VisitDottedName(item).Value); - } - // We'll always have at least one dottedName, so the value here will be non-null - return new(currentTypeName!); - } - - GrammarResult ICILVisitor.VisitSqstringSeq(CILParser.SqstringSeqContext context) => VisitSqstringSeq(context); - - public static GrammarResult.FormattedBlob VisitSqstringSeq(CILParser.SqstringSeqContext context) - { - var strings = ImmutableArray.CreateBuilder(context.ChildCount); - foreach (var child in context.children ?? []) - { - string? str = null; - - if (child is ITerminalNode { Symbol: { Type: CILParser.SQSTRING, Text: string stringValue } }) - { - str = StringHelpers.ParseQuotedString(stringValue); - } - - strings.Add(str); - } - return new(strings.MoveToImmutable().SerializeSequence()); - } - - GrammarResult ICILVisitor.VisitStackreserve(CILParser.StackreserveContext context) => VisitStackreserve(context); - public GrammarResult.Literal VisitStackreserve(CILParser.StackreserveContext context) => VisitInt64(context.int64()); - - GrammarResult ICILVisitor.VisitSubsystem(CILParser.SubsystemContext context) => VisitSubsystem(context); - public GrammarResult.Literal VisitSubsystem(CILParser.SubsystemContext context) => VisitInt32(context.int32()); - - public GrammarResult VisitTerminal(ITerminalNode node) => throw new UnreachableException(); - public GrammarResult VisitTls(CILParser.TlsContext context) - { - if (context.GetText() == "tls") - { - ReportError( - DiagnosticIds.UnsupportedTlsData, - DiagnosticMessageTemplates.UnsupportedTlsData, - context); - } - - return GrammarResult.SentinelValue.Result; - } - - GrammarResult ICILVisitor.VisitTruefalse(CILParser.TruefalseContext context) => VisitTruefalse(context); - - public static GrammarResult.Literal VisitTruefalse(CILParser.TruefalseContext context) - { - return new(bool.Parse(context.GetText())); - } - - GrammarResult ICILVisitor.VisitTryBlock(CILParser.TryBlockContext context) => VisitTryBlock(context); - - public GrammarResult.Literal<(LabelHandle Start, LabelHandle End)> VisitTryBlock(CILParser.TryBlockContext context) - { - if (context.scopeBlock() is CILParser.ScopeBlockContext scopeBlock) - { - LabelHandle start = _currentMethod!.Definition.MethodBody.DefineLabel(); - _currentMethod.Definition.MethodBody.MarkLabel(start); - _ = VisitScopeBlock(scopeBlock); - LabelHandle end = _currentMethod.Definition.MethodBody.DefineLabel(); - _currentMethod.Definition.MethodBody.MarkLabel(end); - return new((start, end)); - } - var ids = context.id(); - if (ids.Length == 2) - { - var start = _currentMethod!.Labels.TryGetValue(VisitId(ids[0]).Value, out LabelHandle startLabel) ? startLabel : _currentMethod.Labels[VisitId(ids[0]).Value] = _currentMethod.Definition.MethodBody.DefineLabel(); - var end = _currentMethod!.Labels.TryGetValue(VisitId(ids[1]).Value, out LabelHandle endLabel) ? endLabel : _currentMethod.Labels[VisitId(ids[1]).Value] = _currentMethod.Definition.MethodBody.DefineLabel(); - return new((start, end)); - } - var offsets = context.int32(); - if (offsets.Length == 2) - { - var start = _currentMethod!.Definition.MethodBody.DefineLabel(); - var end = _currentMethod.Definition.MethodBody.DefineLabel(); - _currentMethod.Definition.MethodBody.MarkLabel(start, VisitInt32(offsets[0]).Value); - _currentMethod.Definition.MethodBody.MarkLabel(end, VisitInt32(offsets[1]).Value); - return new((start, end)); - } - throw new UnreachableException(); - } - - GrammarResult ICILVisitor.VisitTyBound(CILParser.TyBoundContext context) => VisitTyBound(context); - public GrammarResult.Sequence VisitTyBound(CILParser.TyBoundContext? context) - { - // context or typeList can be null when there are no constraints - if (context?.typeList() is not CILParser.TypeListContext typeList) - { - return new(ImmutableArray.Empty); - } - // Filter out null types (from unresolved type parameters) before creating constraints - return new(VisitTypeList(typeList).Value - .Where(t => t is not null) - .Select(EntityRegistry.CreateGenericConstraint) - .ToImmutableArray()); - } - - GrammarResult ICILVisitor.VisitTypar(CILParser.TyparContext context) => VisitTypar(context); - - public GrammarResult.Literal VisitTypar(CILParser.TyparContext context) - { - GenericParameterAttributes attributes = VisitTyparAttribs(context.typarAttribs()).Value; - EntityRegistry.GenericParameterEntity genericParameter = EntityRegistry.CreateGenericParameter(attributes, VisitDottedName(context.dottedName()).Value); - - foreach (var constraint in VisitTyBound(context.tyBound()).Value) - { - genericParameter.Constraints.Add(constraint); - } - - return new(genericParameter); - } - - GrammarResult ICILVisitor.VisitTyparAttrib(CILParser.TyparAttribContext context) => VisitTyparAttrib(context); - public GrammarResult.Flag VisitTyparAttrib(CILParser.TyparAttribContext context) - { - return context switch - { - { covariant: not null } => new(GenericParameterAttributes.Covariant), - { contravariant: not null } => new(GenericParameterAttributes.Contravariant), - { @class: not null } => new(GenericParameterAttributes.ReferenceTypeConstraint), - { valuetype: not null } => new(GenericParameterAttributes.NotNullableValueTypeConstraint), - { byrefLike: not null } => new(GenericParameterAttributes.AllowByRefLike), - { ctor: not null } => new(GenericParameterAttributes.DefaultConstructorConstraint), - { flags: CILParser.Int32Context int32 } => new((GenericParameterAttributes)VisitInt32(int32).Value), - _ => throw new UnreachableException() - }; - } - GrammarResult ICILVisitor.VisitTyparAttribs(CILParser.TyparAttribsContext context) => VisitTyparAttribs(context); - - public GrammarResult.Literal VisitTyparAttribs(CILParser.TyparAttribsContext context) => - new(context.typarAttrib() - .Select(VisitTyparAttrib) - .Aggregate( - (GenericParameterAttributes)0, (agg, attr) => agg | attr)); - - GrammarResult ICILVisitor.VisitTypars(CILParser.TyparsContext context) => VisitTypars(context); - public GrammarResult.Sequence VisitTypars(CILParser.TyparsContext context) - { - CILParser.TyparContext[] typeParameters = context.typar(); - ImmutableArray.Builder builder = ImmutableArray.CreateBuilder(typeParameters.Length); - - foreach (var typeParameter in typeParameters) - { - builder.Add(VisitTypar(typeParameter).Value); - } - return new(builder.MoveToImmutable()); - } - - GrammarResult ICILVisitor.VisitTyparsClause(CILParser.TyparsClauseContext context) => VisitTyparsClause(context); - public GrammarResult.Sequence VisitTyparsClause(CILParser.TyparsClauseContext context) => context.typars() is null ? new(ImmutableArray.Empty) : VisitTypars(context.typars()); - - GrammarResult ICILVisitor.VisitType(CILParser.TypeContext context) => VisitType(context); - public GrammarResult.FormattedBlob VisitType(CILParser.TypeContext context) - { - // These blobs will likely be very small, so use a smaller default size. - const int DefaultSignatureElementBlobSize = 10; - BlobBuilder prefix = new(DefaultSignatureElementBlobSize); - BlobBuilder suffix = new(DefaultSignatureElementBlobSize); - BlobBuilder elementType = VisitElementType(context.elementType()).Value; - - // Prefix blob writes outer modifiers first. - // Suffix blob writes inner modifiers first. - // Since all blobs are prefix blobs and only some have suffix data, - // We will go in reverse order to write the prefixes - // and then go in forward order to write the suffixes. - CILParser.TypeModifiersContext[] typeModifiers = context.typeModifiers(); - for (int i = typeModifiers.Length - 1; i >= 0; i--) - { - CILParser.TypeModifiersContext? modifier = typeModifiers[i]; - switch (modifier) - { - case CILParser.SZArrayModifierContext: - prefix.WriteByte((byte)SignatureTypeCode.SZArray); - break; - case CILParser.ArrayModifierContext: - prefix.WriteByte((byte)SignatureTypeCode.Array); - break; - case CILParser.ByRefModifierContext: - prefix.WriteByte((byte)SignatureTypeCode.ByReference); - break; - case CILParser.PtrModifierContext: - prefix.WriteByte((byte)SignatureTypeCode.Pointer); - break; - case CILParser.PinnedModifierContext: - prefix.WriteByte((byte)SignatureTypeCode.Pinned); - break; - case CILParser.RequiredModifierContext modreq: - prefix.WriteByte((byte)SignatureTypeCode.RequiredModifier); - prefix.WriteTypeEntity(VisitTypeSpec(modreq.typeSpec()).Value); - break; - case CILParser.OptionalModifierContext modopt: - prefix.WriteByte((byte)SignatureTypeCode.OptionalModifier); - prefix.WriteTypeEntity(VisitTypeSpec(modopt.typeSpec()).Value); - break; - case CILParser.GenericArgumentsModifierContext: - prefix.WriteByte((byte)SignatureTypeCode.GenericTypeInstance); - break; - } - } - - foreach (var modifier in typeModifiers) - { - switch (modifier) - { - case CILParser.ArrayModifierContext arr: - var bounds = VisitBounds(arr.bounds()).Value; - suffix.WriteCompressedInteger(bounds.Length); - // Count contiguous sizes from the start (stop at first null) - int numSizes = 0; - for (int bIdx = 0; bIdx < bounds.Length; bIdx++) - { - if (bounds[bIdx].Upper is null) - break; - numSizes++; - } - // Count contiguous lower bounds from the start (stop at first null) - int numLoBounds = 0; - for (int bIdx = 0; bIdx < bounds.Length; bIdx++) - { - if (bounds[bIdx].Lower is null) - break; - numLoBounds++; - } - suffix.WriteCompressedInteger(numSizes); - for (int bIdx = 0; bIdx < numSizes; bIdx++) - { - suffix.WriteCompressedInteger(bounds[bIdx].Upper.GetValueOrDefault()); - } - suffix.WriteCompressedInteger(numLoBounds); - for (int bIdx = 0; bIdx < numLoBounds; bIdx++) - { - suffix.WriteCompressedSignedInteger(bounds[bIdx].Lower.GetValueOrDefault()); - } - break; - case CILParser.GenericArgumentsModifierContext genericArgs: - VisitTypeArgs(genericArgs.typeArgs()).Value.WriteContentTo(suffix); - break; - } - } - - // Work around https://github.com/dotnet/runtime/issues/127243 - // by writing to a separate blob. - BlobBuilder fullBlob = new(elementType.Count + prefix.Count + suffix.Count); - prefix.WriteContentTo(fullBlob); - elementType.WriteContentTo(fullBlob); - suffix.WriteContentTo(fullBlob); - return new(fullBlob); - } - - GrammarResult ICILVisitor.VisitTypeArgs(CILParser.TypeArgsContext context) => VisitTypeArgs(context); - - public GrammarResult.FormattedBlob VisitTypeArgs(CILParser.TypeArgsContext context) - { - BlobBuilder blob = new(4); - var types = context.type(); - blob.WriteCompressedInteger(types.Length); - foreach (var type in types) - { - blob.LinkSuffix(VisitType(type).Value); - } - return new(blob); - } - - public GrammarResult VisitTypedefDecl(CILParser.TypedefDeclContext context) - { - string alias = VisitDottedName(context.dottedName()).Value; - - if (context.type() is CILParser.TypeContext type) - { - // .typedef type as alias - // This creates an alias for a complete type signature (blob) - var typeBlob = VisitType(type).Value; - // Create a copy of the blob to avoid issues with linked BlobBuilders - var copy = new BlobBuilder(typeBlob.Count); - typeBlob.WriteContentTo(copy); - _typedefs[alias] = new TypedefEntry.TypeBlob(copy); - } - else if (context.className() is CILParser.ClassNameContext className) - { - // .typedef className as alias - var typeEntity = VisitClassName(className).Value; - _typedefs[alias] = new TypedefEntry.Type(typeEntity); - } - else if (context.memberRef() is CILParser.MemberRefContext memberRef) - { - // .typedef memberRef as alias - var member = VisitMemberRef(memberRef).Value; - _typedefs[alias] = new TypedefEntry.Member(member); - } - else if (context.customDescr() is CILParser.CustomDescrContext customDescr) - { - // .typedef customDescr as alias - var attr = VisitCustomDescr(customDescr).Value; - if (attr is not null) - { - _typedefs[alias] = new TypedefEntry.CustomAttribute(attr.Constructor, attr.Value, Owner: null); - } - } - else if (context.customDescrWithOwner() is CILParser.CustomDescrWithOwnerContext customDescrWithOwner) - { - // .typedef customDescrWithOwner as alias - var attr = VisitCustomDescrWithOwner(customDescrWithOwner).Value; - if (attr is not null) - { - EntityRegistry.EntityBase? owner = attr.Owner; - attr.Owner = null; - _typedefs[alias] = new TypedefEntry.CustomAttribute(attr.Constructor, attr.Value, owner); - } - } - - return GrammarResult.SentinelValue.Result; - } - - /// - /// Tries to resolve a typedef alias to a type entity. - /// - private EntityRegistry.TypeEntity? TryResolveTypedefAsType(string alias) - { - if (_typedefs.TryGetValue(alias, out var entry) && entry is TypedefEntry.Type typeEntry) - { - return typeEntry.Entity; - } - return null; - } - - /// - /// Tries to resolve a typedef alias to a type blob (complete type signature). - /// - private BlobBuilder? TryResolveTypedefAsTypeBlob(string alias) - { - if (_typedefs.TryGetValue(alias, out var entry)) - { - if (entry is TypedefEntry.TypeBlob blobEntry) - { - return blobEntry.Blob; - } - if (entry is TypedefEntry.Type typeEntry) - { - // Encode the type entity as a CLASS reference for the blob - var blob = new BlobBuilder(5); - blob.WriteByte((byte)SignatureTypeKind.Class); - blob.WriteTypeEntity(typeEntry.Entity); - return blob; - } - } - return null; - } - - /// - /// Tries to resolve a typedef alias to a member reference. - /// - private EntityRegistry.EntityBase? TryResolveTypedefAsMember(string alias) - { - if (_typedefs.TryGetValue(alias, out var entry) && entry is TypedefEntry.Member memberEntry) - { - return memberEntry.Entity; - } - return null; - } - - /// - /// Tries to resolve a typedef alias to a custom attribute. - /// - private (EntityRegistry.EntityBase Constructor, BlobBuilder Value, EntityRegistry.EntityBase? Owner)? TryResolveTypedefAsCustomAttribute(string alias) - { - if (_typedefs.TryGetValue(alias, out var entry) && entry is TypedefEntry.CustomAttribute attrEntry) - { - return (attrEntry.Constructor, attrEntry.Value, attrEntry.Owner); - } - return null; - } - - public GrammarResult VisitTypelist(CILParser.TypelistContext context) - { - foreach (var name in context.className()) - { - // We don't do anything with the class names here. - // We just go through the name resolution process to ensure that the names are valid - // and to provide TypeReference table rows. - _ = VisitClassName(name); - } - return GrammarResult.SentinelValue.Result; - } - - GrammarResult ICILVisitor.VisitTypeList(CILParser.TypeListContext context) => VisitTypeList(context); - public GrammarResult.Sequence VisitTypeList(CILParser.TypeListContext context) - { - CILParser.TypeSpecContext[] bounds = context.typeSpec(); - ImmutableArray.Builder builder = ImmutableArray.CreateBuilder(bounds.Length); - foreach (var typeSpec in bounds) - { - builder.Add(VisitTypeSpec(typeSpec).Value); - } - return new(builder.MoveToImmutable()); - } - - GrammarResult ICILVisitor.VisitTypeSpec(CILParser.TypeSpecContext context) => VisitTypeSpec(context); - public GrammarResult.Literal VisitTypeSpec(CILParser.TypeSpecContext context) - { - if (context.className() is CILParser.ClassNameContext className) - { - return new(VisitClassName(className).Value); - } - else if (context.dottedName() is CILParser.DottedNameContext dottedName) - { - string nameToResolve = VisitDottedName(dottedName).Value; - if (context.MODULE() is not null) - { - EntityRegistry.ModuleReferenceEntity? module = _entityRegistry.FindModuleReference(nameToResolve); - if (module is null) - { - // report error - return new(new EntityRegistry.FakeTypeEntity(MetadataTokens.ModuleReferenceHandle(0))); - } - return new(new EntityRegistry.FakeTypeEntity(module.Handle)); - } - else - { - return new(new EntityRegistry.FakeTypeEntity( - _entityRegistry.GetOrCreateAssemblyReference(nameToResolve, newRef => - { - // Report warning on implicit assembly reference creation. - }).Handle)); - } - } - else - { - Debug.Assert(context.type() != null); - return new(_entityRegistry.GetOrCreateTypeSpec(VisitType(context.type()).Value)); - } - } - - - GrammarResult ICILVisitor.VisitVariantType(CILParser.VariantTypeContext context) => VisitVariantType(context); - public GrammarResult.Literal VisitVariantType(CILParser.VariantTypeContext context) - { - if (context.variantTypeElement() is not CILParser.VariantTypeElementContext element) - { - return new(VarEnum.VT_EMPTY); - } - - VarEnum variant = VisitVariantTypeElement(element).Value; - // The 0th child is the variant element type. - for (int i = 1; i < context.ChildCount; i++) - { - ITerminalNode childToken = (ITerminalNode)context.children[i]; - if (childToken.Symbol.Type == CILParser.ARRAY_TYPE_NO_BOUNDS) - { - variant |= VarEnum.VT_ARRAY; - } - else if (childToken.Symbol.Type == CILParser.VECTOR) - { - variant |= VarEnum.VT_VECTOR; - } - else - { - Debug.Assert(childToken.Symbol.Type == CILParser.REF); - variant |= VarEnum.VT_BYREF; - } - } - return new(variant); - } - - GrammarResult ICILVisitor.VisitVariantTypeElement(CILParser.VariantTypeElementContext context) => VisitVariantTypeElement(context); - public GrammarResult.Literal VisitVariantTypeElement(CILParser.VariantTypeElementContext context) - { - return new(context.GetChild(0).Symbol.Type switch - { - CILParser.VARIANT => VarEnum.VT_VARIANT, - CILParser.CURRENCY => VarEnum.VT_CY, - CILParser.VOID => VarEnum.VT_VOID, - CILParser.BOOL => VarEnum.VT_BOOL, - CILParser.INT8 => VarEnum.VT_I1, - CILParser.INT16 => VarEnum.VT_I2, - CILParser.INT32_ => VarEnum.VT_I4, - CILParser.INT64_ => VarEnum.VT_I8, - CILParser.FLOAT32 => VarEnum.VT_R4, - CILParser.FLOAT64_ => VarEnum.VT_R8, - CILParser.UINT8 => VarEnum.VT_UI1, - CILParser.UINT16 => VarEnum.VT_UI2, - CILParser.UINT32 => VarEnum.VT_UI4, - CILParser.UINT64 => VarEnum.VT_UI8, - CILParser.PTR => VarEnum.VT_PTR, - CILParser.DECIMAL => VarEnum.VT_DECIMAL, - CILParser.DATE => VarEnum.VT_DATE, - CILParser.BSTR => VarEnum.VT_BSTR, - CILParser.LPSTR => VarEnum.VT_LPSTR, - CILParser.LPWSTR => VarEnum.VT_LPWSTR, - CILParser.IUNKNOWN => VarEnum.VT_UNKNOWN, - CILParser.IDISPATCH => VarEnum.VT_DISPATCH, - CILParser.SAFEARRAY => VarEnum.VT_SAFEARRAY, - CILParser.INT => VarEnum.VT_INT, - CILParser.UINT => VarEnum.VT_UINT, - CILParser.ERROR => VarEnum.VT_ERROR, - CILParser.HRESULT => VarEnum.VT_HRESULT, - CILParser.CARRAY => VarEnum.VT_CARRAY, - CILParser.USERDEFINED => VarEnum.VT_USERDEFINED, - CILParser.RECORD => VarEnum.VT_RECORD, - CILParser.FILETIME => VarEnum.VT_FILETIME, - CILParser.BLOB => VarEnum.VT_BLOB, - CILParser.STREAM => VarEnum.VT_STREAM, - CILParser.STORAGE => VarEnum.VT_STORAGE, - CILParser.STREAMED_OBJECT => VarEnum.VT_STREAMED_OBJECT, - CILParser.STORED_OBJECT => VarEnum.VT_STORED_OBJECT, - CILParser.BLOB_OBJECT => VarEnum.VT_BLOB_OBJECT, - CILParser.CF => VarEnum.VT_CF, - CILParser.CLSID => VarEnum.VT_CLSID, - _ => throw new UnreachableException() - }); - } - - public GrammarResult VisitVtableDecl(CILParser.VtableDeclContext context) - { - // Raw .vtable directive with bytes - not commonly used - // For now, we don't support this legacy syntax - throw new NotImplementedException("raw vtable fixups blob (.vtable) not supported - use .vtfixup instead"); - } - - GrammarResult ICILVisitor.VisitVtfixupAttr(CILParser.VtfixupAttrContext context) => VisitVtfixupAttr(context); - public GrammarResult.Literal VisitVtfixupAttr(CILParser.VtfixupAttrContext context) - { - // vtfixupAttr: | vtfixupAttr INT32_ | vtfixupAttr INT64_ | vtfixupAttr 'fromunmanaged' | vtfixupAttr 'callmostderived' | vtfixupAttr 'retainappdomain' - ushort flags = 0; - foreach (var child in context.children ?? []) - { - string text = child.GetText(); - flags |= text switch - { - "int32" => VTableFixupSupport.COR_VTABLE_32BIT, - "int64" => VTableFixupSupport.COR_VTABLE_64BIT, - "fromunmanaged" => VTableFixupSupport.COR_VTABLE_FROM_UNMANAGED, - "callmostderived" => VTableFixupSupport.COR_VTABLE_CALL_MOST_DERIVED, - "retainappdomain" => VTableFixupSupport.COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN, - _ => 0 - }; - } - - return new(flags); - } - - GrammarResult ICILVisitor.VisitVtfixupDecl(CILParser.VtfixupDeclContext context) => VisitVtfixupDecl(context); - public GrammarResult VisitVtfixupDecl(CILParser.VtfixupDeclContext context) - { - // vtfixupDecl: '.vtfixup' '[' int32 ']' vtfixupAttr 'at' id; - int diagnosticCount = _diagnostics.Count; - int slotCount = VisitInt32(context.int32()).Value; - ushort flags = VisitVtfixupAttr(context.vtfixupAttr()).Value; - string dataLabel = VisitId(context.id()).Value; - bool hasValidSlotCount = _diagnostics.Count == diagnosticCount; - - if (hasValidSlotCount && (uint)slotCount > ushort.MaxValue) - { - ReportError( - DiagnosticIds.InvalidVTableSlotCount, - string.Format( - DiagnosticMessageTemplates.InvalidVTableSlotCount, - slotCount, - ushort.MaxValue), - context.int32()); - hasValidSlotCount = false; - } - - _vtableFixups.Add(new VTableFixupDeclaration( - new VTableFixupSupport.VTableFixupEntry(slotCount, flags, dataLabel), - context, - hasValidSlotCount)); - - return GrammarResult.SentinelValue.Result; - } - - GrammarResult ICILVisitor.VisitOptionalModifier(CILParser.OptionalModifierContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - GrammarResult ICILVisitor.VisitSZArrayModifier(CILParser.SZArrayModifierContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - GrammarResult ICILVisitor.VisitRequiredModifier(CILParser.RequiredModifierContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - GrammarResult ICILVisitor.VisitPtrModifier(CILParser.PtrModifierContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - GrammarResult ICILVisitor.VisitPinnedModifier(CILParser.PinnedModifierContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - GrammarResult ICILVisitor.VisitGenericArgumentsModifier(CILParser.GenericArgumentsModifierContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - GrammarResult ICILVisitor.VisitByRefModifier(CILParser.ByRefModifierContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - GrammarResult ICILVisitor.VisitArrayModifier(CILParser.ArrayModifierContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - public GrammarResult VisitNativeTypeArrayPointerInfo(CILParser.NativeTypeArrayPointerInfoContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - public GrammarResult VisitPointerArrayTypeSize(CILParser.PointerArrayTypeSizeContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - public GrammarResult VisitPointerArrayTypeParamIndex(CILParser.PointerArrayTypeParamIndexContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - public GrammarResult VisitPointerNativeType(CILParser.PointerNativeTypeContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - public GrammarResult VisitPointerArrayTypeSizeParamIndex(CILParser.PointerArrayTypeSizeParamIndexContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - public GrammarResult VisitPointerArrayTypeNoSizeData(CILParser.PointerArrayTypeNoSizeDataContext context) => throw new UnreachableException(NodeShouldNeverBeDirectlyVisited); - } -} diff --git a/src/tools/ilasm/src/ILAssembler/Location.cs b/src/tools/ilasm/src/ILAssembler/Location.cs index db5b1b8e64f918..9d0643a65b9943 100644 --- a/src/tools/ilasm/src/ILAssembler/Location.cs +++ b/src/tools/ilasm/src/ILAssembler/Location.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using System; using System.Collections.Generic; @@ -11,7 +10,14 @@ public record Location(SourceSpan Span, SourceText Source) { internal static Location From(Antlr4.Runtime.IToken token, IReadOnlyDictionary sourceDocuments) { - return new Location(GetSourceSpan(token), sourceDocuments[token.TokenSource.InputStream.SourceName]); + string sourceName = + token.TokenSource?.InputStream?.SourceName ?? + token.TokenSource?.SourceName ?? + string.Empty; + SourceText source = sourceDocuments.TryGetValue(sourceName, out SourceText? sourceDocument) + ? sourceDocument + : new SourceText(string.Empty, sourceName); + return new Location(GetSourceSpan(token), source); } internal static SourceSpan GetSourceSpan(Antlr4.Runtime.IToken? token) diff --git a/src/tools/ilasm/src/ILAssembler/StringCharStream.cs b/src/tools/ilasm/src/ILAssembler/StringCharStream.cs new file mode 100644 index 00000000000000..285f0f6440ec81 --- /dev/null +++ b/src/tools/ilasm/src/ILAssembler/StringCharStream.cs @@ -0,0 +1,67 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using Antlr4.Runtime; +using Antlr4.Runtime.Misc; + +namespace ILAssembler; + +internal sealed class StringCharStream : ICharStream +{ + private readonly string _text; + private int _position; + + internal StringCharStream(string text, string? sourceName = null) + { + _text = text; + SourceName = sourceName ?? string.Empty; + } + + public int Index => _position; + + public int Size => _text.Length; + + public string SourceName { get; } + + public void Consume() + { + if (_position >= _text.Length) + { + throw new InvalidOperationException("Cannot consume past the end of the character stream."); + } + + _position++; + } + + public int LA(int i) + { + if (i == 0) + { + return 0; + } + + int offset = i < 0 ? i : i - 1; + int position = _position + offset; + return (uint)position >= (uint)_text.Length ? TokenConstants.EOF : _text[position]; + } + + public int Mark() => -1; + + public void Release(int marker) + { + } + + public void Seek(int index) + { + ArgumentOutOfRangeException.ThrowIfNegative(index); + _position = Math.Min(index, _text.Length); + } + + public string GetText(Interval interval) + { + int start = Math.Max(0, interval.a); + int end = Math.Min(_text.Length - 1, interval.b); + return start > end ? string.Empty : _text.Substring(start, end - start + 1); + } +} diff --git a/src/tools/ilasm/src/ILAssembler/TypeName.cs b/src/tools/ilasm/src/ILAssembler/TypeName.cs deleted file mode 100644 index ba3ac8f943b8ef..00000000000000 --- a/src/tools/ilasm/src/ILAssembler/TypeName.cs +++ /dev/null @@ -1,7 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace ILAssembler -{ - internal sealed record TypeName(TypeName? ContainingTypeName, string DottedName); -} diff --git a/src/tools/ilasm/src/ILAssembler/gen/CIL.g4 b/src/tools/ilasm/src/ILAssembler/gen/CIL.g4 index 23ae4bfa51855c..a78a46d15a926b 100644 --- a/src/tools/ilasm/src/ILAssembler/gen/CIL.g4 +++ b/src/tools/ilasm/src/ILAssembler/gen/CIL.g4 @@ -5,6 +5,14 @@ The .NET Foundation licenses this file to you under the MIT license. grammar CIL; +@parser::header { +#nullable enable annotations +} + +@parser::members { + internal GrammarActions Actions { get; set; } = null!; +} + tokens { IncludedFileEof, SyntheticIncludedFileEof } INT32: '-'? ('0x' [0-9A-Fa-f]+ | [0-9]+); @@ -407,80 +415,168 @@ id: | 'extended' | INSTANCE | SQSTRING; -dottedName: DOTTEDNAME | ((dottedNamePart '.')* dottedNamePart) | SQSTRING; -dottedNamePart: ID | INSTANCE | SQSTRING | DOTTEDNAME | 'volatile'; -compQstring: (QSTRING PLUS)* QSTRING; +dottedName returns [string Value] +locals [CILParser.DottedNameBuilder Builder] +@init {_localctx.Builder = new CILParser.DottedNameBuilder();} +: + direct = DOTTEDNAME {Actions.AddDottedNameToken(_localctx.Builder, $direct);} + | ((part = dottedNamePart {Actions.AddDottedNamePart(_localctx.Builder, $part.Value);} '.')* + tail = dottedNamePart {Actions.AddDottedNamePart(_localctx.Builder, $tail.Value);}) + | quoted = SQSTRING {Actions.AddDottedNameToken(_localctx.Builder, $quoted);} +; +finally {_localctx.Value = Actions.EndDottedName(_localctx.Builder);} + +dottedNamePart returns [string Value] +@init {_localctx.Value = string.Empty;} +@after {_localctx.Value = Actions.ParseDottedNamePart(_localctx.Start);} +: + ID + | INSTANCE + | SQSTRING + | DOTTEDNAME + | 'volatile' +; +compQstring returns [string Value] +locals [System.Text.StringBuilder Builder] +@init {_localctx.Builder = new System.Text.StringBuilder();} +: + (head = QSTRING {Actions.AddComposedStringPart(_localctx.Builder, $head);} PLUS)* + tail = QSTRING {Actions.AddComposedStringPart(_localctx.Builder, $tail);} +; +finally {_localctx.Value = Actions.EndComposedString(_localctx.Builder);} WS: [ \t\r\n] -> skip; SINGLE_LINE_COMMENT: '//' ~[\r\n]* -> skip; COMMENT: '/*' .*? '*/' -> skip; +PERMISSION: '.permission'; +PERMISSIONSET: '.permissionset'; -decls: decl*; +decls +: + decl* +; -decl: +decl +: classHead '{' classDecls '}' | nameSpaceHead '{' decls '}' | methodHead '{' methodDecls '}' | fieldDecl - | dataDecl - | vtableDecl - | vtfixupDecl - | extSourceSpec - | fileDecl - | assemblyBlock - | assemblyRefHead '{' assemblyRefDecls '}' - | exptypeHead '{' exptypeDecls '}' - | manifestResHead '{' manifestResDecls '}' - | moduleHead - | secDecl - | customAttrDecl - | subsystem - | corflags - | alignment - | imagebase - | stackreserve - | languageDecl - | typedefDecl - | compControl + | {Actions.BeginTopLevelDirective();} + data = dataDecl {Actions.ProcessTopLevelDataDeclaration($data.ctx);} + | {Actions.BeginTopLevelDirective();} + vtable = vtableDecl {Actions.ProcessTopLevelVTableDeclaration($vtable.ctx);} + | {Actions.BeginTopLevelDirective();} + vtfixup = vtfixupDecl {Actions.ProcessTopLevelVTableFixupDeclaration($vtfixup.ctx);} + | {Actions.BeginTopLevelDirective();} + source = extSourceSpec {Actions.ProcessTopLevelSourceDirective($source.ctx);} + | {Actions.BeginTopLevelDirective();} + file = fileDecl {Actions.ProcessTopLevelFileDeclaration($file.ctx);} + | {Actions.BeginTopLevelDirective();} + assembly = assemblyBlock {Actions.ProcessTopLevelAssembly($assembly.ctx);} + | {Actions.BeginTopLevelDirective();} + assemblyReference = assemblyRefBlock + {Actions.ProcessTopLevelAssemblyReference($assemblyReference.ctx);} + | {Actions.BeginTopLevelDirective();} + exportedType = exptypeBlock {Actions.ProcessTopLevelExportedType($exportedType.ctx);} + | {Actions.BeginTopLevelDirective();} + resource = manifestResBlock {Actions.ProcessTopLevelManifestResource($resource.ctx);} + | {Actions.BeginTopLevelDirective();} + module = moduleHead + {Actions.ProcessTopLevelModule($module.Value, $module.HasName, $module.IsExternal);} + | {Actions.BeginTopLevelDirective();} + security = secDecl {Actions.ProcessTopLevelSecurityDeclaration($security.ctx);} + | attribute = customAttrDecl {Actions.ProcessTopLevelCustomAttribute($attribute.ctx);} + | {Actions.BeginTopLevelDirective();} subsystem + | {Actions.BeginTopLevelDirective();} corflags + | {Actions.BeginTopLevelDirective();} alignment + | {Actions.BeginTopLevelDirective();} imagebase + | {Actions.BeginTopLevelDirective();} stackreserve + | {Actions.BeginTopLevelDirective();} + language = languageDecl {Actions.ProcessTopLevelLanguageDirective($language.ctx);} + | {Actions.BeginTopLevelDirective();} + typedef = typedefDecl {Actions.ProcessTopLevelTypedef($typedef.ctx);} + | {Actions.BeginTopLevelDirective();} compControl | typelist - | mscorlib; - -subsystem: '.subsystem' int32; - -corflags: '.corflags' int32; - -alignment: '.file' 'alignment' int32; - -imagebase: '.imagebase' int64; - -stackreserve: '.stackreserve' int64; - -assemblyBlock: - '.assembly' asmAttr dottedName '{' assemblyDecls '}'; + | {Actions.BeginTopLevelDirective();} mscorlib; +finally {Actions.EndDeclaration(_localctx);} + +subsystem: + '.subsystem' value = int32 {Actions.ProcessTopLevelSubsystem($value.start);}; + +corflags: + '.corflags' value = int32 {Actions.ProcessTopLevelCorFlags($value.start);}; + +alignment: + '.file' 'alignment' value = int32 {Actions.ProcessTopLevelAlignment($value.start);}; + +imagebase: + '.imagebase' value = int64 {Actions.ProcessTopLevelImageBase($value.start);}; + +stackreserve: + '.stackreserve' value = int64 {Actions.ProcessTopLevelStackReserve($value.start);}; + +assemblyBlock returns [CILParser.AssemblyDefinitionValue? Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + '.assembly' attributes = asmAttr name = dottedName '{' declarations = assemblyDecls '}' + {_localctx.Value = Actions.CreateAssemblyDefinition( + $attributes.Value, + $name.Value, + $declarations.Value);}; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + if (_localctx.HasSyntaxError) + { + _localctx.Value = null; + } +} mscorlib: '.mscorlib'; -languageDecl: - '.language' languageString - | '.language' languageString ',' languageString - | '.language' languageString ',' languageString ',' languageString; - -languageString: SQSTRING; - -typelist: '.typelist' '{' (className)* '}'; +languageDecl returns [CILParser.LanguageDirectiveValue? Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + '.language' language = languageString + {_localctx.Value = Actions.CreateLanguageDirective($language.Value);} + | '.language' language = languageString ',' vendor = languageString + {_localctx.Value = Actions.CreateLanguageDirective($language.Value, $vendor.Value);} + | '.language' language = languageString ',' vendor = languageString ',' documentType = languageString + {_localctx.Value = Actions.CreateLanguageDirective($language.Value, $vendor.Value, $documentType.Value);}; +finally {Actions.EndLanguageDirective(_localctx, _localctx.InitialSyntaxErrorCount);} + +languageString returns [string Value] +@init {_localctx.Value = string.Empty;} +@after {_localctx.Value = Actions.ParseLanguageString(_localctx.Start);} +: + SQSTRING; + +typelist +@init {Actions.BeginTopLevelTypeList();} +: + '.typelist' '{' + (name = className {Actions.ProcessTopLevelTypeListEntry($name.Value);})* + '}' +; int32: INT32; int64: INT64 | INT32; -float64: - FLOAT64 - | int32 '.' /* trailing-dot integer as float (e.g., ldc.r8 1.) */ - | int32 - | FLOAT32 '(' int32 ')' - | FLOAT64_ '(' int64 ')'; +float64 returns [double Value]: + decimal = FLOAT64 {_localctx.Value = Actions.ParseFloatingLiteral($decimal);} + | trailing = int32 '.' {_localctx.Value = Actions.ParseFloatingInteger($trailing.start);} /* trailing-dot integer as float (e.g., ldc.r8 1.) */ + | integer = int32 {_localctx.Value = Actions.ParseFloatingInteger($integer.start);} + | FLOAT32 '(' singleBits = int32 ')' {_localctx.Value = Actions.ParseFloat32Bits($singleBits.start);} + | FLOAT64_ '(' doubleBits = int64 ')' {_localctx.Value = Actions.ParseFloat64Bits($doubleBits.start);}; -intOrWildcard: int32 | PTR; +intOrWildcard returns [int? Value]: + value = int32 {_localctx.Value = Actions.ParseInt32($value.start);} + | PTR {_localctx.Value = null;}; /* This is handled in the PreprocessedTokenSource lexer. We have this in the grammar just for completeness */ compControl: @@ -496,141 +592,383 @@ compControl: /* Aliasing of types, type specs, methods, fields and custom attributes */ -typedefDecl: - '.typedef' type 'as' dottedName - | '.typedef' className 'as' dottedName - | '.typedef' memberRef 'as' dottedName - | '.typedef' customDescr 'as' dottedName - | '.typedef' customDescrWithOwner 'as' dottedName; +typedefDecl returns [CILParser.TypedefDeclarationValue Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init { + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.TypedefDeclarationValue.Error; +} +: + '.typedef' signature = type 'as' alias = dottedName + {_localctx.Value = Actions.CreateTypeSignatureTypedef($signature.Value, $alias.Value);} + | '.typedef' classType = className 'as' alias = dottedName + {_localctx.Value = Actions.CreateClassTypedef($classType.Value, $alias.Value);} + | '.typedef' member = memberRef 'as' alias = dottedName + {_localctx.Value = Actions.CreateMemberTypedef($member.Value, $alias.Value);} + | '.typedef' attribute = customDescr 'as' alias = dottedName + {_localctx.Value = Actions.CreateCustomAttributeTypedefDeclaration( + $attribute.Value, + $attribute.start, + $alias.Value);} + | '.typedef' ownedAttribute = customDescrWithOwner 'as' alias = dottedName + {_localctx.Value = Actions.CreateCustomAttributeTypedefDeclaration( + $ownedAttribute.Value, + $ownedAttribute.start, + $alias.Value);}; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; +} /* Custom attribute declarations */ -customDescr: - '.custom' customType - | '.custom' customType '=' compQstring - | '.custom' customType '=' '{' customBlobDescr '}' - | '.custom' customType '=' '(' bytes ')'; - -customDescrWithOwner: - '.custom' '(' ownerType ')' customType - | '.custom' '(' ownerType ')' customType '=' compQstring - | '.custom' '(' ownerType ')' customType '=' '{' customBlobDescr '}' - | '.custom' '(' ownerType ')' customType '=' '(' bytes ')'; - -customType: methodRef; - -ownerType: typeSpec | memberRef; +customDescr returns [CILParser.CustomAttributeDescriptorValue Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init { + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.CustomAttributeDescriptorValue.Error; +} +: + '.custom' constructor = customType + {_localctx.Value = Actions.CreateDefaultCustomAttribute($constructor.Value);} + | '.custom' constructor = customType '=' stringValue = compQstring + {_localctx.Value = Actions.CreateStringCustomAttribute($constructor.Value, $stringValue.Value);} + | '.custom' constructor = customType '=' '{' structuredValue = customBlobDescr '}' + {_localctx.Value = Actions.CreateStructuredCustomAttribute($constructor.Value, $structuredValue.Value);} + | '.custom' constructor = customType '=' '(' rawValue = bytes ')' + {_localctx.Value = Actions.CreateRawCustomAttribute($constructor.Value, $rawValue.Value);}; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; +} + +customDescrWithOwner returns [CILParser.CustomAttributeDescriptorValue Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init { + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.CustomAttributeDescriptorValue.Error; +} +: + '.custom' '(' owner = ownerType ')' constructor = customType + {_localctx.Value = Actions.CreateDefaultOwnedCustomAttribute($owner.Value, $constructor.Value);} + | '.custom' '(' owner = ownerType ')' constructor = customType '=' stringValue = compQstring + {_localctx.Value = Actions.CreateStringOwnedCustomAttribute($owner.Value, $constructor.Value, $stringValue.Value);} + | '.custom' '(' owner = ownerType ')' constructor = customType '=' '{' structuredValue = customBlobDescr '}' + {_localctx.Value = Actions.CreateStructuredOwnedCustomAttribute($owner.Value, $constructor.Value, $structuredValue.Value);} + | '.custom' '(' owner = ownerType ')' constructor = customType '=' '(' rawValue = bytes ')' + {_localctx.Value = Actions.CreateRawOwnedCustomAttribute($owner.Value, $constructor.Value, $rawValue.Value);}; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; +} + +customType returns [CILParser.MethodReferenceValue Value] +@init {_localctx.Value = CILParser.MethodReferenceValue.Error;} +: + constructor = methodRef {_localctx.Value = Actions.CreateCustomAttributeType($constructor.Value);}; + +ownerType +returns [CILParser.OwnerTypeValue Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init { + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.OwnerTypeValue.Error; +} +: + typeValue = typeSpecOrScope {_localctx.Value = Actions.CreateTypeOwner($typeValue.Value);} + | member = memberRef {_localctx.Value = Actions.CreateMemberOwner($member.Value);} +; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; +} /* Verbal description of custom attribute initialization blob */ -customBlobDescr: customBlobArgs customBlobNVPairs; - -customBlobArgs: (serInit | compControl)*; - -customBlobNVPairs: ( - fieldOrProp serializType dottedName '=' serInit +customBlobDescr returns [CILParser.CustomAttributeBlobValue Value] +@init {_localctx.Value = CILParser.CustomAttributeBlobValue.Error;} +: + arguments = customBlobArgs namedArguments = customBlobNVPairs + {_localctx.Value = Actions.CreateCustomAttributeBlob($arguments.Value, $namedArguments.Value);}; + +customBlobArgs returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + (argument = serInit {_localctx.Builder.Add($argument.Value);} | compControl)* +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +customBlobNVPairs returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + ( + kind = fieldOrProp argumentType = serializType name = dottedName '=' value = serInit + {_localctx.Builder.Add(Actions.CreateCustomBlobNamedArgument( + $kind.Value, + $argumentType.Value, + $name.Value, + $value.Value));} | compControl - )*; - -fieldOrProp: 'field' | 'property'; - -serializType: serializTypeElement (ARRAY_TYPE_NO_BOUNDS)?; - -serializTypeElement: - simpleType - | dottedName /* typedef */ - | TYPE - | OBJECT - | ENUM 'class' SQSTRING - | ENUM className; + )* +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +fieldOrProp returns [byte Value]: + kind = ('field' | 'property') {_localctx.Value = Actions.GetCustomAttributeNamedArgumentKind($kind);}; + +serializType returns [CILParser.SerializationTypeValue Value] +@init {_localctx.Value = CILParser.SerializationTypeValue.Error;} +: + element = serializTypeElement array = ARRAY_TYPE_NO_BOUNDS? + {_localctx.Value = Actions.CreateSerializationType($element.Value, $array);}; + +serializTypeElement returns [CILParser.SerializationTypeValue Value] +@init {_localctx.Value = CILParser.SerializationTypeValue.Error;} +: + primitive = simpleType {_localctx.Value = Actions.CreatePrimitiveSerializationType($primitive.Value);} + | alias = dottedName {_localctx.Value = Actions.CreateSerializationTypeTypedef(_localctx, $alias.Value);} /* typedef */ + | simpleTypeToken = TYPE {_localctx.Value = Actions.CreateSimpleSerializationType($simpleTypeToken);} + | simpleTypeToken = OBJECT {_localctx.Value = Actions.CreateSimpleSerializationType($simpleTypeToken);} + | ENUM 'class' quotedName = SQSTRING {_localctx.Value = Actions.CreateEnumSerializationType($quotedName);} + | ENUM classNameValue = className {_localctx.Value = Actions.CreateEnumSerializationType($classNameValue.Value);}; /* Module declaration */ -moduleHead: - MODULE 'extern' dottedName - | MODULE dottedName - | MODULE; +moduleHead returns [string? Value, bool HasName, bool IsExternal] +@init {_localctx.Value = null;} +: + MODULE 'extern' name = dottedName + {Actions.SetModuleHeader(_localctx, $name.Value, true);} + | MODULE name = dottedName + {Actions.SetModuleHeader(_localctx, $name.Value, false);} + | MODULE + {Actions.SetEmptyModuleHeader(_localctx);}; /* VTable Fixup table declaration */ -vtfixupDecl: '.vtfixup' '[' int32 ']' vtfixupAttr 'at' id; - -vtfixupAttr: - /* EMPTY */ - | vtfixupAttr INT32_ - | vtfixupAttr INT64_ - | vtfixupAttr 'fromunmanaged' - | vtfixupAttr 'callmostderived' - | vtfixupAttr 'retainappdomain'; - -vtableDecl: '.vtable' '=' '(' bytes ')' /* deprecated */; +vtfixupDecl returns [CILParser.VTableFixupValue? Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + '.vtfixup' '[' count = int32 ']' attributes = vtfixupAttr 'at' label = id + {_localctx.Value = Actions.CreateVTableFixup( + $count.start, + $attributes.Value, + $label.start);} +; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + if (_localctx.HasSyntaxError) + { + _localctx.Value = null; + } +} + +vtfixupAttr returns [ushort Value] +@init {_localctx.Value = 0;} +: + (attribute = vtfixupAttrElement + {_localctx.Value = Actions.AddVTableFixupAttribute(_localctx.Value, $attribute.Value);})* + {_localctx.Value = Actions.CompleteVTableFixupAttributes(_localctx.Value);} +; + +vtfixupAttrElement returns [ushort Value] +@after {_localctx.Value = Actions.ParseVTableFixupAttribute(_localctx.Start);} +: + INT32_ + | INT64_ + | 'fromunmanaged' + | 'callmostderived' + | 'retainappdomain'; + +vtableDecl returns [CILParser.RawVTableValue? Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + '.vtable' '=' '(' value = bytes ')' + {_localctx.Value = Actions.CreateRawVTable($value.Value);} /* deprecated */ +; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + if (_localctx.HasSyntaxError) + { + _localctx.Value = null; + } +} /* Namespace and class declaration */ -nameSpaceHead: '.namespace' dottedName; - -classHead: - '.class' classAttr* dottedName typarsClause extendsClause implClause; - - -classAttr: - 'public' - | 'private' - | VALUE - | ENUM - | INTERFACE - | 'sealed' - | 'abstract' - | 'auto' - | 'sequential' - | EXPLICIT - | 'extended' - | ANSI - | 'unicode' - | 'autochar' - | 'import' - | 'serializable' - | 'windowsruntime' - | 'nested' 'public' - | 'nested' 'private' - | 'nested' 'family' - | 'nested' 'assembly' - | 'nested' 'famandassem' - | 'nested' 'famorassem' - | 'beforefieldinit' - | 'specialname' - | 'rtspecialname' - | 'flags' '(' int32 ')'; - -extendsClause: /* EMPTY */ | 'extends' typeSpec; - -implClause: /* EMPTY */ | 'implements' implList; - -classDecls: classDecl*; +nameSpaceHead returns [string Value] +locals [int InitialSyntaxErrorCount] +@init { + Actions.PrepareNamespaceHeader(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = string.Empty; +} +: + '.namespace' name = dottedName {_localctx.Value = $name.Value;} +; +finally {Actions.BeginNamespace(_localctx, _localctx.Value, _localctx.InitialSyntaxErrorCount);} + +classHead returns [CILParser.ClassHeaderValue Value] +locals [int InitialSyntaxErrorCount, CILParser.ClassHeaderBuilder Builder] +@init { + _localctx.Builder = Actions.PrepareClassHeader(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.ClassHeaderValue.Error; +} +: + '.class' + (attribute = classAttr {Actions.AddClassHeaderAttribute(_localctx.Builder, $attribute.Value);})* + name = dottedName genericParameters = typarsClause baseType = extendsClause interfaces = implClause + {_localctx.Value = Actions.CreateClassHeader( + _localctx, + _localctx.Builder, + _localctx.InitialSyntaxErrorCount, + $name.stop, + $name.Value, + $genericParameters.Value, + $baseType.Value, + $interfaces.Value);} +; +finally {Actions.BeginType(_localctx, _localctx.Value);} + + +classAttr returns [CILParser.ClassAttributeValue Value] +@init {_localctx.Value = CILParser.ClassAttributeValue.Empty;} +: + attribute = 'public' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = 'private' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = VALUE {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = ENUM {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = INTERFACE {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = 'sealed' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = 'abstract' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = 'auto' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = 'sequential' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = EXPLICIT {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = 'extended' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = ANSI {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = 'unicode' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = 'autochar' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = 'import' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = 'serializable' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = 'windowsruntime' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | 'nested' visibility = 'public' {_localctx.Value = Actions.CreateNestedClassAttribute($visibility);} + | 'nested' visibility = 'private' {_localctx.Value = Actions.CreateNestedClassAttribute($visibility);} + | 'nested' visibility = 'family' {_localctx.Value = Actions.CreateNestedClassAttribute($visibility);} + | 'nested' visibility = 'assembly' {_localctx.Value = Actions.CreateNestedClassAttribute($visibility);} + | 'nested' visibility = 'famandassem' {_localctx.Value = Actions.CreateNestedClassAttribute($visibility);} + | 'nested' visibility = 'famorassem' {_localctx.Value = Actions.CreateNestedClassAttribute($visibility);} + | attribute = 'beforefieldinit' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = 'specialname' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | attribute = 'rtspecialname' {_localctx.Value = Actions.CreateClassAttribute($attribute);} + | 'flags' '(' flags = int32 ')' {_localctx.Value = Actions.CreateRawClassAttribute($flags.start);}; + +extendsClause returns [CILParser.TypeSpecificationValue? Value] +@init {_localctx.Value = Actions.CreateEmptyClassBase();} +: + /* EMPTY */ + | 'extends' baseType = typeSpec {_localctx.Value = Actions.CreateClassBase($baseType.Value);} +; -implList: (typeSpec ',')* typeSpec; +implClause returns [System.Collections.Immutable.ImmutableArray Value] +@init {_localctx.Value = Actions.CreateEmptyInterfaceList();} +: + /* EMPTY */ + | 'implements' interfaces = implList {_localctx.Value = $interfaces.Value;} +; + +classDecls +: + classDecl* +; + +implList returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + (interfaceType = typeSpec {_localctx.Builder.Add($interfaceType.Value);} ',')* + lastInterfaceType = typeSpec {_localctx.Builder.Add($lastInterfaceType.Value);} +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} /* External source declarations */ -esHead: '.line' | '#line'; - -extSourceSpec: - esHead int32 SQSTRING - | esHead int32 - | esHead int32 ':' int32 SQSTRING - | esHead int32 ':' int32 - | esHead int32 ':' int32 ',' int32 SQSTRING - | esHead int32 ':' int32 ',' int32 - | esHead int32 ',' int32 ':' int32 SQSTRING - | esHead int32 ',' int32 ':' int32 - | esHead int32 ',' int32 ':' int32 ',' int32 SQSTRING - | esHead int32 ',' int32 ':' int32 ',' int32 - | esHead int32 QSTRING; +esHead returns [bool AutoIncrement] +@after {_localctx.AutoIncrement = Actions.IsAutoIncrementSourceDirective(_localctx.Start);} +: + '.line' + | '#line'; + +extSourceSpec returns [CILParser.SourceDirectiveValue? Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + head = esHead line = int32 path = (SQSTRING | QSTRING)? + {_localctx.Value = Actions.CreateSourceLine($head.AutoIncrement, $line.start, $path);} + | head = esHead line = int32 ':' column = int32 path = SQSTRING? + {_localctx.Value = Actions.CreateSourceColumn($head.AutoIncrement, $line.start, $column.start, $path);} + | head = esHead line = int32 ':' startColumn = int32 ',' endColumn = int32 path = SQSTRING? + {_localctx.Value = Actions.CreateSourceColumnRange( + $head.AutoIncrement, + $line.start, + $startColumn.start, + $endColumn.start, + $path);} + | head = esHead startLine = int32 ',' endLine = int32 ':' column = int32 path = SQSTRING? + {_localctx.Value = Actions.CreateSourceLineRange( + $head.AutoIncrement, + $startLine.start, + $endLine.start, + $column.start, + $path);} + | head = esHead startLine = int32 ',' endLine = int32 ':' startColumn = int32 ',' endColumn = int32 + path = SQSTRING? + {_localctx.Value = Actions.CreateSourceRange( + $head.AutoIncrement, + $startLine.start, + $endLine.start, + $startColumn.start, + $endColumn.start, + $path);}; +finally {Actions.EndSourceDirective(_localctx, _localctx.InitialSyntaxErrorCount);} /* Manifest declarations */ -fileDecl: - '.file' fileAttr* dottedName fileEntry HASH '=' '(' bytes ')' fileEntry - | '.file' fileAttr* dottedName fileEntry; - -fileAttr: 'nometadata'; - -fileEntry: /* EMPTY */ | '.entrypoint'; +fileDecl returns [CILParser.FileDeclarationValue? Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount, CILParser.FileDeclarationBuilder Builder] +@init { + _localctx.Builder = new CILParser.FileDeclarationBuilder(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; +} +: + '.file' + (attribute = fileAttr {Actions.AddFileAttribute(_localctx.Builder, $attribute.Value);})* + name = dottedName {Actions.SetFileName(_localctx.Builder, $name.Value);} + entry = fileEntry {Actions.AddFileEntry(_localctx.Builder, $entry.Value);} + (HASH '=' '(' hash = bytes ')' {Actions.SetFileHash(_localctx.Builder, $hash.Value);} + trailingEntry = fileEntry {Actions.AddFileEntry(_localctx.Builder, $trailingEntry.Value);})? +; +finally {Actions.EndFileDeclaration(_localctx, _localctx.Builder, _localctx.InitialSyntaxErrorCount);} + +fileAttr returns [bool Value] +@after {_localctx.Value = Actions.ParseFileAttribute(_localctx.Start);} +: + 'nometadata'; + +fileEntry returns [bool Value] +@init {_localctx.Value = false;} +: + /* EMPTY */ + | entry = '.entrypoint' {_localctx.Value = Actions.ParseFileEntry($entry);}; -asmAttrAny: +asmAttrAny returns [System.Reflection.AssemblyFlags Value, System.Reflection.AssemblyFlags Mask] +@after {Actions.SetAssemblyAttribute(_localctx);} +: 'retargetable' | 'windowsruntime' | 'noplatform' @@ -641,308 +979,493 @@ asmAttrAny: | 'arm' | 'arm64'; -asmAttr: asmAttrAny*; +asmAttr returns [System.Reflection.AssemblyFlags Value] +@init {_localctx.Value = 0;} +: + (attribute = asmAttrAny + {_localctx.Value = Actions.AddAssemblyAttribute( + _localctx.Value, + $attribute.Value, + $attribute.Mask);})*; /* IL instructions and associated definitions */ -instr_none: INSTR_NONE; - -instr_var: INSTR_VAR; - -instr_i: INSTR_I; - -instr_i8: INSTR_I8; - -instr_r: INSTR_R; - -instr_brtarget: INSTR_BRTARGET; - -instr_method: INSTR_METHOD; - -instr_field: INSTR_FIELD; - -instr_type: INSTR_TYPE; - -instr_string: INSTR_STRING; - -instr_sig: INSTR_SIG; - -instr_tok: INSTR_TOK; - -instr_switch: INSTR_SWITCH; - instr: - instr_none - | instr_var int32 - | instr_var id - | instr_i int32 - | instr_i8 int64 - | instr_r float64 - | instr_r int64 - | instr_r '(' bytes ')' - | instr_r 'bytearray' '(' bytes ')' // Support bytearray syntax for floating point instructions - | instr_brtarget int32 - | instr_brtarget id - | instr_method methodRef - | instr_field fieldRef - | instr_field mdtoken - | instr_type typeSpec - | instr_string compQstring - | instr_string ANSI '(' compQstring ')' - | instr_string 'bytearray' '(' bytes ')' - | instr_sig callConv type sigArgs - | instr_tok ownerType /* ownerType ::= memberRef | typeSpec */ - | instr_tok int32 - | instr_switch '(' labels ')' - | instr_switch '()'; - -labels: + simpleInstr + | op = INSTR_METHOD methodOperand = methodRef {Actions.EmitMethodReferenceInstruction($op, $methodOperand.ctx);} + | op = INSTR_FIELD fieldOperand = fieldRef {Actions.EmitFieldReferenceInstruction($op, $fieldOperand.ctx);} + | op = INSTR_FIELD metadataOperand = mdtoken {Actions.EmitMetadataTokenInstruction($op, $metadataOperand.ctx);} + | op = INSTR_TYPE typeOperand = typeSpec {Actions.EmitTypeReferenceInstruction($op, $typeOperand.ctx);} + | op = INSTR_SIG signatureOperand = calliSignature {Actions.EmitCalliInstruction($op, $signatureOperand.ctx);} + | op = INSTR_TOK ownerOperand = ownerType {Actions.EmitOwnerTokenInstruction($op, $ownerOperand.ctx);} +; + +simpleInstr +locals [CILParser.SwitchInstructionBuilder SwitchBuilder] +@after {Actions.CompleteSwitchInstruction(_localctx.SwitchBuilder);} +: + op = INSTR_NONE {Actions.EmitNoOperandInstruction($op);} + | op = INSTR_VAR index = int32 {Actions.EmitVariableIndexInstruction($op, $index.start);} + | op = INSTR_VAR name = id {Actions.EmitVariableNameInstruction($op, $name.start);} + | op = INSTR_I value32 = int32 {Actions.EmitInt32Instruction($op, $value32.start);} + | op = INSTR_I8 value64 = int64 {Actions.EmitInt64Instruction($op, $value64.start);} + | op = INSTR_R value = float64 {Actions.EmitFloatingInstruction($op, $value.Value);} + | op = INSTR_R integerValue = int64 {Actions.EmitFloatingInstruction($op, $integerValue.start);} + | op = INSTR_R '(' rawFloat = bytes ')' {Actions.EmitRawFloatingInstruction($op, $rawFloat.Value, $rawFloat.start);} + | op = INSTR_R 'bytearray' '(' rawFloat = bytes ')' {Actions.EmitRawFloatingInstruction($op, $rawFloat.Value, $rawFloat.start);} + | op = INSTR_BRTARGET offset = int32 {Actions.EmitBranchOffsetInstruction($op, $offset.start);} + | op = INSTR_BRTARGET label = id {Actions.EmitBranchLabelInstruction($op, $label.start);} + | op = INSTR_STRING userString = compQstring {Actions.EmitStringInstruction($op, $userString.Value);} + | op = INSTR_STRING ANSI '(' ansiString = compQstring ')' {Actions.EmitAnsiStringInstruction($op, $ansiString.Value);} + | op = INSTR_STRING 'bytearray' '(' rawString = bytes ')' {Actions.EmitRawStringInstruction($op, $rawString.Value);} + | op = INSTR_TOK rawToken = int32 {Actions.EmitRawTokenInstruction($op, $rawToken.start);} + | op = INSTR_SWITCH {_localctx.SwitchBuilder = Actions.CreateSwitchInstruction($op);} + ('(' labels[_localctx.SwitchBuilder] ')' | '()') +; + +calliSignature +returns [CILParser.CalliSignatureValue Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init { + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.CalliSignatureValue.Error; +} +: + convention = callConv returnType = type arguments = sigArgs + {_localctx.Value = Actions.CreateCalliSignature($convention.Value, $returnType.Value, $arguments.Value);} +; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; +} + +labels [CILParser.SwitchInstructionBuilder Builder]: /* empty */ - | ((id | int32) ',')* (id | int32); - -typeArgs: '<' (type ',')* type '>'; - -bounds: '[' (bound ',')* bound ']'; - -sigArgs: '(' (sigArg ',')* sigArg ')' | '()'; - -sigArg: - ELLIPSIS - | paramAttr type marshalClause id?; + | ((headLabel = id {Actions.AddSwitchLabel($Builder, $headLabel.start);} | headOffset = int32 {Actions.AddSwitchOffset($Builder, $headOffset.start);}) ',')* + (tailLabel = id {Actions.AddSwitchLabel($Builder, $tailLabel.start);} | tailOffset = int32 {Actions.AddSwitchOffset($Builder, $tailOffset.start);}); + +typeArgs returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + '<' (argument = type {_localctx.Builder.Add($argument.Value);} ',')* + lastArgument = type {_localctx.Builder.Add($lastArgument.Value);} '>' +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +bounds returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + '[' (item = bound {_localctx.Builder.Add(Actions.CreateArrayBound($item.ctx));} ',')* + lastItem = bound {_localctx.Builder.Add(Actions.CreateArrayBound($lastItem.ctx));} ']' +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +sigArgs returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + '(' (argument = sigArg {_localctx.Builder.Add($argument.Value);} ',')* + lastArgument = sigArg {_localctx.Builder.Add($lastArgument.Value);} ')' + | '()' +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +sigArg returns [CILParser.SignatureArgumentValue Value] +@init {_localctx.Value = CILParser.SignatureArgumentValue.Error;} +: + ELLIPSIS {_localctx.Value = Actions.CreateSentinelSignatureArgument();} + | attributes = paramAttr argumentType = type marshalling = marshalClause name = id? + {_localctx.Value = Actions.CreateSignatureArgument($attributes.Value, $argumentType.Value, $marshalling.Value, $name.ctx);}; /* Class referencing */ -className: - '[' dottedName ']' slashedName - | '[' mdtoken ']' slashedName - | '[' PTR ']' slashedName - | '[' MODULE dottedName ']' slashedName - | slashedName - | mdtoken - | THIS - | BASE - | NESTER; - -slashedName: (dottedName '/')* dottedName; - -assemblyDecls: assemblyDecl*; - -assemblyDecl: (HASH 'algorithm' int32) | secDecl | asmOrRefDecl; - -typeSpec: - className - | '[' dottedName ']' - | '[' MODULE dottedName ']' - | type; +className returns [CILParser.ClassNameValue Value] +@init {_localctx.Value = CILParser.ClassNameValue.Error;} +: + '[' assemblyName = dottedName ']' typeName = slashedName + {_localctx.Value = Actions.CreateAssemblyQualifiedClassName($assemblyName.Value, $typeName.Value);} + | '[' scopeToken = mdtoken ']' typeName = slashedName + {_localctx.Value = Actions.CreateTokenQualifiedClassName($scopeToken.Value, $typeName.Value);} + | '[' PTR ']' typeName = slashedName + {_localctx.Value = Actions.CreatePointerQualifiedClassName($typeName.Value);} + | '[' MODULE moduleName = dottedName ']' typeName = slashedName + {_localctx.Value = Actions.CreateModuleQualifiedClassName(_localctx.Start, $moduleName.Value, $typeName.Value);} + | typeName = slashedName {_localctx.Value = Actions.CreateUnqualifiedClassName($typeName.Value);} + | typeToken = mdtoken {_localctx.Value = Actions.CreateTokenClassName($typeToken.Value);} + | THIS {_localctx.Value = Actions.CreateThisClassName(_localctx.Start);} + | BASE {_localctx.Value = Actions.CreateBaseClassName(_localctx.Start);} + | NESTER {_localctx.Value = Actions.CreateNesterClassName(_localctx.Start);}; + +slashedName returns [CILParser.TypeName Value] +locals [CILParser.TypeName CurrentName] +: + (part = dottedName {_localctx.CurrentName = Actions.AddSlashedNamePart(_localctx.CurrentName, $part.Value);} '/')* + lastPart = dottedName {_localctx.CurrentName = Actions.AddSlashedNamePart(_localctx.CurrentName, $lastPart.Value);} +; +finally {_localctx.Value = _localctx.CurrentName ?? new CILParser.TypeName(null, string.Empty);} + +assemblyDecls returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + (declaration = assemblyDecl + {if ($declaration.Value is not null) _localctx.Builder.Add($declaration.Value);})* +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +assemblyDecl returns [CILParser.AssemblyDeclarationValue? Value]: + HASH 'algorithm' algorithm = int32 + {_localctx.Value = Actions.CreateAssemblyHashAlgorithmDeclaration($algorithm.start);} + | security = secDecl + {_localctx.Value = Actions.CreateAssemblySecurityDeclaration( + $security.Value, + $security.start);} + | shared = asmOrRefDecl {_localctx.Value = $shared.Value;}; + +typeSpec +returns [CILParser.TypeSpecificationValue Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init { + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.TypeSpecificationValue.Error; +} +: + classType = className {_localctx.Value = Actions.CreateClassTypeSpecification($classType.Value);} + | signatureType = type {_localctx.Value = Actions.CreateSignatureTypeSpecification($signatureType.Value);} +; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; +} + +// A bare scope is an owner, not a type. Keeping it out of typeSpec prevents +// prediction from treating a qualified type name as a following declaration name. +typeSpecOrScope returns [CILParser.TypeSpecificationValue Value] +@init {_localctx.Value = CILParser.TypeSpecificationValue.Error;} +: + typeValue = typeSpec {_localctx.Value = $typeValue.Value;} + | '[' assemblyName = dottedName ']' {_localctx.Value = Actions.CreateAssemblyTypeSpecification($assemblyName.Value);} + | '[' MODULE moduleName = dottedName ']' {_localctx.Value = Actions.CreateModuleTypeSpecification($moduleName.Value);} +; /* Native types for marshaling signatures */ -nativeType: +nativeType returns [CILParser.NativeTypeValue Value] +locals [CILParser.NativeTypeBuilder Builder] +@init {_localctx.Builder = new CILParser.NativeTypeBuilder();} +: /* EMPTY */ - | nativeTypeElement nativeTypeArrayPointerInfo*; - -nativeTypeArrayPointerInfo: - PTR # PointerNativeType - | ARRAY_TYPE_NO_BOUNDS # PointerArrayTypeNoSizeData - | '[' int32 ']' # PointerArrayTypeSize - | '[' int32 PLUS int32 ']' # PointerArrayTypeSizeParamIndex - | '[' PLUS int32 ']' # PointerArrayTypeParamIndex + | element = nativeTypeElement {Actions.SetNativeTypeElement(_localctx.Builder, $element.Value);} + (info = nativeTypeArrayPointerInfo {Actions.AddNativeTypeArrayPointerInfo(_localctx.Builder, $info.Value);})* +; +finally {_localctx.Value = Actions.CreateNativeType(_localctx.Start, _localctx.Builder);} + +nativeTypeArrayPointerInfo returns [CILParser.NativeTypeArrayPointerInfoValue Value] +@init {_localctx.Value = Actions.CreatePointerNativeType();} +: + PTR {_localctx.Value = Actions.CreatePointerNativeType();} # PointerNativeType + | ARRAY_TYPE_NO_BOUNDS {_localctx.Value = Actions.CreatePointerArrayTypeNoSizeData();} # PointerArrayTypeNoSizeData + | '[' size = int32 ']' {_localctx.Value = Actions.CreatePointerArrayTypeSize($size.start);} # PointerArrayTypeSize + | '[' size = int32 PLUS parameterIndex = int32 ']' + {_localctx.Value = Actions.CreatePointerArrayTypeSizeParamIndex($size.start, $parameterIndex.start);} # PointerArrayTypeSizeParamIndex + | '[' PLUS parameterIndex = int32 ']' + {_localctx.Value = Actions.CreatePointerArrayTypeParamIndex($parameterIndex.start);} # PointerArrayTypeParamIndex ; -nativeTypeElement: +nativeTypeElement returns [CILParser.NativeTypeElementValue Value] +@init {_localctx.Value = CILParser.EmptyNativeTypeElementValue.Instance;} +: + /* EMPTY */ {_localctx.Value = Actions.CreateEmptyNativeType();} + | marshalType = CUSTOM '(' guid = compQstring ',' nativeTypeName = compQstring ',' + marshallerType = compQstring ',' cookie = compQstring ')' + {_localctx.Value = Actions.CreateDeprecatedCustomMarshallerNativeType( + _localctx, $guid.Value, $nativeTypeName.Value, $marshallerType.Value, $cookie.Value);} + | marshalType = CUSTOM '(' marshallerType = compQstring ',' cookie = compQstring ')' + {_localctx.Value = Actions.CreateCustomMarshallerNativeType($marshallerType.Value, $cookie.Value);} + | FIXED marshalType = SYSSTRING '[' size = int32 ']' + {_localctx.Value = Actions.CreateFixedSysStringNativeType($size.start);} + | FIXED marshalType = ARRAY '[' size = int32 ']' element = nativeType + {_localctx.Value = Actions.CreateFixedArrayNativeType($size.start, $element.Value);} + | marshalType = VARIANT {_localctx.Value = Actions.CreateDeprecatedNativeType(_localctx, $marshalType);} + | marshalType = CURRENCY {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = SYSCHAR {_localctx.Value = Actions.CreateDeprecatedNativeType(_localctx, $marshalType);} + | marshalType = VOID {_localctx.Value = Actions.CreateDeprecatedNativeType(_localctx, $marshalType);} + | marshalType = BOOL {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = INT8 {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = INT16 {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = INT32_ {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = INT64_ {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = FLOAT32 {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = FLOAT64_ {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = ERROR {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = UINT8 {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = UINT16 {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = UINT32 {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = UINT64 {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = DECIMAL {_localctx.Value = Actions.CreateDeprecatedNativeType(_localctx, $marshalType);} + | marshalType = DATE {_localctx.Value = Actions.CreateDeprecatedNativeType(_localctx, $marshalType);} + | marshalType = BSTR {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = LPSTR {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = LPWSTR {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = LPTSTR {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = OBJECTREF {_localctx.Value = Actions.CreateDeprecatedNativeType(_localctx, $marshalType);} + | marshalType = IUNKNOWN index = iidParamIndex {_localctx.Value = Actions.CreateIidNativeType($marshalType, $index.Value);} + | marshalType = IDISPATCH index = iidParamIndex {_localctx.Value = Actions.CreateIidNativeType($marshalType, $index.Value);} + | marshalType = STRUCT {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = INTERFACE index = iidParamIndex {_localctx.Value = Actions.CreateIidNativeType($marshalType, $index.Value);} + | marshalType = SAFEARRAY variant = variantType + {_localctx.Value = Actions.CreateSafeArrayNativeType($variant.Value, null);} + | marshalType = SAFEARRAY variant = variantType ',' userDefinedType = compQstring + {_localctx.Value = Actions.CreateSafeArrayNativeType($variant.Value, $userDefinedType.Value);} + | marshalType = INT {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = UINT {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | 'unsigned' unsignedMarshalType = INT8 {_localctx.Value = Actions.CreateUnsignedNativeType($unsignedMarshalType);} + | 'unsigned' unsignedMarshalType = INT16 {_localctx.Value = Actions.CreateUnsignedNativeType($unsignedMarshalType);} + | 'unsigned' unsignedMarshalType = INT32_ {_localctx.Value = Actions.CreateUnsignedNativeType($unsignedMarshalType);} + | 'unsigned' unsignedMarshalType = INT64_ {_localctx.Value = Actions.CreateUnsignedNativeType($unsignedMarshalType);} + | 'nested' marshalType = STRUCT {_localctx.Value = Actions.CreateNestedStructNativeType(_localctx);} + | marshalType = BYVALSTR {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | ANSI marshalType = BSTR {_localctx.Value = Actions.CreateAnsiBstrNativeType();} + | marshalType = TBSTR {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | VARIANT marshalBool = BOOL {_localctx.Value = Actions.CreateVariantBoolNativeType();} + | marshalType = METHOD {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | marshalType = LPSTRUCT {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | 'as' marshalType = ANY {_localctx.Value = Actions.CreateSimpleNativeType($marshalType);} + | alias = dottedName {_localctx.Value = Actions.CreateNativeTypeTypedef(_localctx, $alias.Value);} /* typedef */; + +iidParamIndex returns [CILParser.IidParamIndexValue Value] +@init {_localctx.Value = CILParser.IidParamIndexValue.Empty;} +: /* EMPTY */ - | marshalType=CUSTOM '(' compQstring ',' compQstring ',' compQstring ',' compQstring ')' - | marshalType=CUSTOM '(' compQstring ',' compQstring ')' - | FIXED marshalType=SYSSTRING '[' int32 ']' - | FIXED marshalType=ARRAY '[' int32 ']' nativeType - | marshalType=VARIANT - | marshalType=CURRENCY - | marshalType=SYSCHAR - | marshalType=VOID - | marshalType=BOOL - | marshalType=INT8 - | marshalType=INT16 - | marshalType=INT32_ - | marshalType=INT64_ - | marshalType=FLOAT32 - | marshalType=FLOAT64_ - | marshalType=ERROR - | marshalType=UINT8 - | marshalType=UINT16 - | marshalType=UINT32 - | marshalType=UINT64 - | marshalType=DECIMAL - | marshalType=DATE - | marshalType=BSTR - | marshalType=LPSTR - | marshalType=LPWSTR - | marshalType=LPTSTR - | marshalType=OBJECTREF - | marshalType=IUNKNOWN iidParamIndex - | marshalType=IDISPATCH iidParamIndex - | marshalType=STRUCT - | marshalType=INTERFACE iidParamIndex - | marshalType=SAFEARRAY variantType - | marshalType=SAFEARRAY variantType ',' compQstring - | marshalType=INT - | marshalType=UINT - | 'unsigned' unsignedMarshalType=INT8 - | 'unsigned' unsignedMarshalType=INT16 - | 'unsigned' unsignedMarshalType=INT32_ - | 'unsigned' unsignedMarshalType=INT64_ - | 'nested' marshalType=STRUCT - | marshalType=BYVALSTR - | ANSI marshalType=BSTR - | marshalType=TBSTR - | VARIANT marshalBool=BOOL - | marshalType=METHOD - | marshalType=LPSTRUCT - | 'as' marshalType=ANY - | dottedName /* typedef */; - -iidParamIndex: /* EMPTY */ | '(' 'iidparam' '=' int32 ')'; - -variantType: + | '(' 'iidparam' '=' index = int32 ')' {_localctx.Value = Actions.GetIidParamIndex($index.start);}; + +variantType returns [CILParser.VariantTypeValue Value] +locals [CILParser.VariantTypeBuilder Builder] +@init {_localctx.Builder = new CILParser.VariantTypeBuilder();} +: /*EMPTY */ - | variantTypeElement (ARRAY_TYPE_NO_BOUNDS | VECTOR | REF)*; - -variantTypeElement: - NULL - | VARIANT - | CURRENCY - | VOID - | BOOL - | INT8 - | INT16 - | INT32_ - | INT64_ - | FLOAT32 - | FLOAT64_ - | UINT8 - | UINT16 - | UINT32 - | UINT64 - | PTR - | DECIMAL - | DATE - | BSTR - | LPSTR - | LPWSTR - | IUNKNOWN - | IDISPATCH - | SAFEARRAY - | INT - | UINT - | ERROR - | HRESULT - | CARRAY - | USERDEFINED - | RECORD - | FILETIME - | BLOB - | STREAM - | STORAGE - | STREAMED_OBJECT - | STORED_OBJECT - | BLOB_OBJECT - | CF - | CLSID; + | element = variantTypeElement {Actions.SetVariantTypeElement(_localctx.Builder, $element.Value);} + (modifier = (ARRAY_TYPE_NO_BOUNDS | VECTOR | REF) {Actions.AddVariantTypeModifier(_localctx.Builder, $modifier);})* +; +finally {_localctx.Value = Actions.CreateVariantType(_localctx.Builder);} + +variantTypeElement returns [CILParser.VariantTypeElementValue Value] +@init {_localctx.Value = CILParser.VariantTypeElementValue.Error;} +: + value = NULL {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = VARIANT {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = CURRENCY {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = VOID {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = BOOL {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = INT8 {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = INT16 {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = INT32_ {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = INT64_ {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = FLOAT32 {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = FLOAT64_ {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = UINT8 {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = UINT16 {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = UINT32 {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = UINT64 {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = PTR {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = DECIMAL {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = DATE {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = BSTR {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = LPSTR {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = LPWSTR {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = IUNKNOWN {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = IDISPATCH {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = SAFEARRAY {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = INT {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = UINT {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = ERROR {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = HRESULT {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = CARRAY {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = USERDEFINED {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = RECORD {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = FILETIME {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = BLOB {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = STREAM {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = STORAGE {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = STREAMED_OBJECT {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = STORED_OBJECT {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = BLOB_OBJECT {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = CF {_localctx.Value = Actions.GetVariantTypeElement($value);} + | value = CLSID {_localctx.Value = Actions.GetVariantTypeElement($value);}; /* Managed types for signatures */ -type: elementType typeModifiers*; - -typeModifiers: - ARRAY_TYPE_NO_BOUNDS # SZArrayModifier - | '[' ']' # SZArrayModifier - | bounds # ArrayModifier - | REF # ByRefModifier - | PTR # PtrModifier - | 'pinned' # PinnedModifier - | 'modreq' '(' typeSpec ')' # RequiredModifier - | 'modopt' '(' typeSpec ')' # OptionalModifier - | typeArgs # GenericArgumentsModifier; - -elementType: - 'class' className - | OBJECT - | VALUE 'class' className - | VALUETYPE className - | 'method' callConv type PTR sigArgs - | METHOD_TYPE_PARAMETER int32 - | TYPE_PARAMETER int32 - | METHOD_TYPE_PARAMETER dottedName - | TYPE_PARAMETER dottedName - | TYPEDREF - | VOID - | nativeInt - | nativeUint - | simpleType - | dottedName /* typedef */ - | ELLIPSIS type; - -simpleType: - CHAR - | STRING - | BOOL - | INT8 - | INT16 - | INT32_ - | INT64_ - | FLOAT32 - | FLOAT64_ - | UINT8 - | UINT16 - | UINT32 - | UINT64 - | 'unsigned' INT8 - | 'unsigned' INT16 - | 'unsigned' INT32_ - | 'unsigned' INT64_; - -bound: +type returns [CILParser.TypeValue Value] +locals [ + CILParser.ElementTypeValue ElementType, + System.Collections.Immutable.ImmutableArray.Builder Modifiers +] +@init { + _localctx.ElementType = CILParser.ElementTypeValue.Error; + _localctx.Modifiers = System.Collections.Immutable.ImmutableArray.CreateBuilder(); +} +: + element = elementType {_localctx.ElementType = $element.Value;} + (modifier = typeModifiers {_localctx.Modifiers.Add($modifier.Value);})* +; +finally {_localctx.Value = new CILParser.TypeValue(_localctx.ElementType, _localctx.Modifiers.ToImmutable());} + +typeModifiers returns [CILParser.TypeModifierValue Value] +@init {_localctx.Value = CILParser.TypeModifierValue.Error;} +: + ARRAY_TYPE_NO_BOUNDS {_localctx.Value = Actions.CreateSzArrayTypeModifier();} # SZArrayModifier + | '[' ']' {_localctx.Value = Actions.CreateSzArrayTypeModifier();} # SZArrayModifier + | arrayBounds = bounds {_localctx.Value = Actions.CreateArrayTypeModifier($arrayBounds.Value);} # ArrayModifier + | REF {_localctx.Value = Actions.CreateByReferenceTypeModifier();} # ByRefModifier + | PTR {_localctx.Value = Actions.CreatePointerTypeModifier();} # PtrModifier + | 'pinned' {_localctx.Value = Actions.CreatePinnedTypeModifier();} # PinnedModifier + | 'modreq' '(' modifierType = typeSpec ')' {_localctx.Value = Actions.CreateCustomTypeModifier($modifierType.Value, true);} # RequiredModifier + | 'modopt' '(' modifierType = typeSpec ')' {_localctx.Value = Actions.CreateCustomTypeModifier($modifierType.Value, false);} # OptionalModifier + | arguments = typeArgs {_localctx.Value = Actions.CreateGenericArgumentsModifier($arguments.Value);} # GenericArgumentsModifier; + +elementType returns [CILParser.ElementTypeValue Value] +@init {_localctx.Value = CILParser.ElementTypeValue.Error;} +: + 'class' classType = className {_localctx.Value = Actions.CreateClassElementType($classType.Value, false);} + | OBJECT {_localctx.Value = Actions.CreateObjectElementType();} + | VALUE 'class' valueClassType = className {_localctx.Value = Actions.CreateClassElementType($valueClassType.Value, true);} + | VALUETYPE valueType = className {_localctx.Value = Actions.CreateClassElementType($valueType.Value, true);} + | 'method' convention = callConv returnType = type PTR arguments = sigArgs + {_localctx.Value = Actions.CreateFunctionPointerElementType($convention.Value, $returnType.Value, $arguments.Value);} + | METHOD_TYPE_PARAMETER parameterIndex = int32 {_localctx.Value = Actions.CreateIndexedGenericParameterElementType(true, $parameterIndex.start);} + | TYPE_PARAMETER parameterIndex = int32 {_localctx.Value = Actions.CreateIndexedGenericParameterElementType(false, $parameterIndex.start);} + | METHOD_TYPE_PARAMETER parameterName = dottedName {_localctx.Value = Actions.CreateNamedGenericParameterElementType(_localctx.Start, true, $parameterName.Value);} + | TYPE_PARAMETER parameterName = dottedName {_localctx.Value = Actions.CreateNamedGenericParameterElementType(_localctx.Start, false, $parameterName.Value);} + | TYPEDREF {_localctx.Value = Actions.CreateTypedReferenceElementType();} + | VOID {_localctx.Value = Actions.CreateVoidElementType();} + | signedNative = nativeInt {_localctx.Value = Actions.CreatePrimitiveElementType($signedNative.Value);} + | unsignedNative = nativeUint {_localctx.Value = Actions.CreatePrimitiveElementType($unsignedNative.Value);} + | primitive = simpleType {_localctx.Value = Actions.CreatePrimitiveElementType($primitive.Value);} + | alias = dottedName {_localctx.Value = Actions.CreateTypedefElementType(_localctx.Start, $alias.Value);} /* typedef */ + | ELLIPSIS sentinelType = type {_localctx.Value = Actions.CreateSentinelElementType($sentinelType.Value);}; + +simpleType returns [byte Value]: + value = CHAR {_localctx.Value = Actions.GetSimpleType($value, false);} + | value = STRING {_localctx.Value = Actions.GetSimpleType($value, false);} + | value = BOOL {_localctx.Value = Actions.GetSimpleType($value, false);} + | value = INT8 {_localctx.Value = Actions.GetSimpleType($value, false);} + | value = INT16 {_localctx.Value = Actions.GetSimpleType($value, false);} + | value = INT32_ {_localctx.Value = Actions.GetSimpleType($value, false);} + | value = INT64_ {_localctx.Value = Actions.GetSimpleType($value, false);} + | value = FLOAT32 {_localctx.Value = Actions.GetSimpleType($value, false);} + | value = FLOAT64_ {_localctx.Value = Actions.GetSimpleType($value, false);} + | value = UINT8 {_localctx.Value = Actions.GetSimpleType($value, false);} + | value = UINT16 {_localctx.Value = Actions.GetSimpleType($value, false);} + | value = UINT32 {_localctx.Value = Actions.GetSimpleType($value, false);} + | value = UINT64 {_localctx.Value = Actions.GetSimpleType($value, false);} + | 'unsigned' value = INT8 {_localctx.Value = Actions.GetSimpleType($value, true);} + | 'unsigned' value = INT16 {_localctx.Value = Actions.GetSimpleType($value, true);} + | 'unsigned' value = INT32_ {_localctx.Value = Actions.GetSimpleType($value, true);} + | 'unsigned' value = INT64_ {_localctx.Value = Actions.GetSimpleType($value, true);}; + +bound returns [int Lower, int Upper, bool HasLower, bool HasUpper] +@init {Actions.InitializeBound(_localctx);} +: + /* EMPTY */ | ELLIPSIS - | int32 - | int32 ELLIPSIS int32 - | int32 ELLIPSIS; + | size = int32 {Actions.SetBoundSize(_localctx, $size.start);} + | lower = int32 ELLIPSIS upper = int32 {Actions.SetBoundRange(_localctx, $lower.start, $upper.start);} + | lower = int32 ELLIPSIS {Actions.SetBoundLower(_localctx, $lower.start);} +; /* Parser rules for multi-word type tokens that need whitespace handling */ -nativeInt: 'native' INT; -nativeUint: 'native' ('unsigned' INT | UINT); - -/* Security declarations */ -PERMISSION: '.permission'; -PERMISSIONSET: '.permissionset'; - -secDecl: - PERMISSION secAction typeSpec '(' nameValPairs ')' - | PERMISSION secAction typeSpec '=' '{' customBlobDescr '}' - | PERMISSION secAction typeSpec - | PERMISSIONSET secAction '=' 'bytearray'? '(' bytes ')' - | PERMISSIONSET secAction 'bytearray' '(' bytes ')' - | PERMISSIONSET secAction compQstring - | PERMISSIONSET secAction '=' '{' secAttrSetBlob '}'; - -secAttrSetBlob: | (secAttrBlob ',')* secAttrBlob; - -secAttrBlob: - 'class' SQSTRING '=' '{' customBlobNVPairs '}' - | typeSpec '=' '{' customBlobNVPairs '}'; - -nameValPairs: (nameValPair ',')* nameValPair; - -nameValPair: compQstring '=' caValue; +nativeInt returns [byte Value]: + 'native' INT {_localctx.Value = Actions.GetNativeIntType();}; -truefalse: 'true' | 'false'; +nativeUint returns [byte Value]: + 'native' ('unsigned' INT | UINT) {_localctx.Value = Actions.GetNativeUIntType();}; -caValue: - truefalse - | int32 - | INT32_ '(' int32 ')' - | compQstring - | className '(' INT8 ':' int32 ')' - | className '(' INT16 ':' int32 ')' - | className '(' INT32_ ':' int32 ')' - | className '(' int32 ')'; - -secAction: +/* Security declarations */ +secDecl returns [CILParser.SecurityDeclarationValue? Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + PERMISSION action = secAction permissionType = typeSpec '(' pairs = nameValPairs ')' + {_localctx.Value = Actions.CreateNamedPermissionDeclaration( + $action.Value, + $permissionType.Value, + $pairs.Value);} + | PERMISSION action = secAction permissionType = typeSpec '=' '{' structuredValue = customBlobDescr '}' + {_localctx.Value = Actions.CreateStructuredPermissionDeclaration( + $action.Value, + $permissionType.Value, + $structuredValue.Value);} + | PERMISSION action = secAction permissionType = typeSpec + {_localctx.Value = Actions.CreateEmptyPermissionDeclaration($action.Value, $permissionType.Value);} + | PERMISSIONSET action = secAction '=' 'bytearray'? '(' rawValue = bytes ')' + {_localctx.Value = Actions.CreateRawPermissionSetDeclaration($action.Value, $rawValue.Value);} + | PERMISSIONSET action = secAction 'bytearray' '(' rawValue = bytes ')' + {_localctx.Value = Actions.CreateRawPermissionSetDeclaration($action.Value, $rawValue.Value);} + | PERMISSIONSET action = secAction textValue = compQstring + {_localctx.Value = Actions.CreateStringPermissionSetDeclaration($action.Value, $textValue.Value);} + | PERMISSIONSET action = secAction '=' '{' attributes = secAttrSetBlob '}' + {_localctx.Value = Actions.CreateAttributePermissionSetDeclaration($action.Value, $attributes.Value);}; +finally {Actions.EndSecurityDeclaration(_localctx, _localctx.InitialSyntaxErrorCount);} + +secAttrSetBlob returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + /* EMPTY */ + | (attribute = secAttrBlob {_localctx.Builder.Add($attribute.Value);} ',')* + tail = secAttrBlob {_localctx.Builder.Add($tail.Value);} +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +secAttrBlob returns [CILParser.SecurityAttributeValue Value] +@init {_localctx.Value = CILParser.SecurityAttributeValue.Error;} +: + 'class' name = SQSTRING '=' '{' arguments = customBlobNVPairs '}' + {_localctx.Value = Actions.CreateNamedSecurityAttribute($name, $arguments.Value);} + | securityType = typeSpec '=' '{' arguments = customBlobNVPairs '}' + {_localctx.Value = Actions.CreateTypedSecurityAttribute($securityType.Value, $arguments.Value);}; + +nameValPairs returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + (pair = nameValPair {_localctx.Builder.Add($pair.Value);} ',')* + tail = nameValPair {_localctx.Builder.Add($tail.Value);} +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +nameValPair returns [CILParser.SecurityNameValuePairValue Value] +@init {_localctx.Value = CILParser.SecurityNameValuePairValue.Error;} +: + name = compQstring '=' value = caValue + {_localctx.Value = Actions.CreateSecurityNameValuePair($name.Value, $value.Value);}; + +truefalse returns [bool Value] +@after {_localctx.Value = Actions.ParseBoolean(_localctx.Start);} +: + 'true' + | 'false'; + +caValue returns [CILParser.SecurityCaValue Value] +@init {_localctx.Value = CILParser.SecurityCaValue.Error;} +: + booleanValue = truefalse {_localctx.Value = Actions.CreateSecurityBooleanValue($booleanValue.Value);} + | integerValue = int32 {_localctx.Value = Actions.CreateSecurityInt32Value($integerValue.start);} + | INT32_ '(' integerValue = int32 ')' {_localctx.Value = Actions.CreateSecurityInt32Value($integerValue.start);} + | textValue = compQstring {_localctx.Value = Actions.CreateSecurityStringValue($textValue.Value);} + | enumType = className '(' kind = INT8 ':' enumValue = int32 ')' + {_localctx.Value = Actions.CreateSecurityEnumValue($enumType.Value, $kind, $enumValue.start);} + | enumType = className '(' kind = INT16 ':' enumValue = int32 ')' + {_localctx.Value = Actions.CreateSecurityEnumValue($enumType.Value, $kind, $enumValue.start);} + | enumType = className '(' kind = INT32_ ':' enumValue = int32 ')' + {_localctx.Value = Actions.CreateSecurityEnumValue($enumType.Value, $kind, $enumValue.start);} + | enumType = className '(' enumValue = int32 ')' + {_localctx.Value = Actions.CreateSecurityEnumValue($enumType.Value, $enumValue.start);}; + +secAction returns [System.Reflection.DeclarativeSecurityAction Value] +@after {_localctx.Value = Actions.ParseSecurityAction(_localctx.Start);} +: 'request' | 'demand' | 'assert' @@ -960,238 +1483,532 @@ secAction: | 'noncasinheritance'; /* Method referencing */ -methodRef: - callConv type typeSpec '::' methodName typeArgs? sigArgs - | callConv type typeSpec '::' methodName genArityNotEmpty sigArgs - | callConv type methodName typeArgs? sigArgs - | callConv type methodName genArityNotEmpty sigArgs - | mdtoken - | dottedName /* typeDef */; - -callConv: - INSTANCE callConv - | EXPLICIT callConv - | callKind - | 'callconv' '(' int32 ')'; - -callKind: +methodRef +returns [CILParser.MethodReferenceValue Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init { + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.MethodReferenceValue.Error; +} +: + convention = callConv returnType = type owner = typeSpecOrScope '::' name = methodName genericArguments = typeArgs? arguments = sigArgs + {_localctx.Value = Actions.CreateMethodReference(_localctx.Start, $convention.Value, $returnType.Value, $owner.Value, $name.Value, $genericArguments.ctx is null ? null : $genericArguments.Value, null, $arguments.Value);} + | convention = callConv returnType = type owner = typeSpecOrScope '::' name = methodName genericArity = genArityNotEmpty arguments = sigArgs + {_localctx.Value = Actions.CreateMethodReference(_localctx.Start, $convention.Value, $returnType.Value, $owner.Value, $name.Value, null, $genericArity.Value, $arguments.Value);} + | convention = callConv returnType = type name = methodName genericArguments = typeArgs? arguments = sigArgs + {_localctx.Value = Actions.CreateMethodReference(_localctx.Start, $convention.Value, $returnType.Value, null, $name.Value, $genericArguments.ctx is null ? null : $genericArguments.Value, null, $arguments.Value);} + | convention = callConv returnType = type name = methodName genericArity = genArityNotEmpty arguments = sigArgs + {_localctx.Value = Actions.CreateMethodReference(_localctx.Start, $convention.Value, $returnType.Value, null, $name.Value, null, $genericArity.Value, $arguments.Value);} + | token = mdtoken {_localctx.Value = Actions.CreateTokenMethodReference($token.Value);} + | alias = dottedName {_localctx.Value = Actions.CreateTypedefMethodReference(_localctx.Start, $alias.Value);} /* typeDef */ +; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; +} + +callConv returns [byte Value]: + INSTANCE inner = callConv {_localctx.Value = Actions.AddInstanceCallingConvention($inner.Value);} + | EXPLICIT inner = callConv {_localctx.Value = Actions.AddExplicitCallingConvention($inner.Value);} + | kind = callKind {_localctx.Value = $kind.Value;} + | 'callconv' '(' raw = int32 ')' {_localctx.Value = Actions.GetRawCallingConvention($raw.start);}; + +callKind returns [byte Value] +@init {_localctx.Value = Actions.GetDefaultCallingConvention();} +: /* EMPTY */ - | DEFAULT - | VARARG - | UNMANAGED CDECL - | UNMANAGED STDCALL - | UNMANAGED THISCALL - | UNMANAGED FASTCALL - | UNMANAGED; - -mdtoken: 'mdtoken' '(' int32 ')'; - -memberRef: - 'method' methodRef - | 'field' fieldRef - | mdtoken; - -fieldRef: - type typeSpec '::' dottedName - | type dottedName - | dottedName // typedef - ; + | kind = DEFAULT {_localctx.Value = Actions.GetCallingConvention($kind);} + | kind = VARARG {_localctx.Value = Actions.GetCallingConvention($kind);} + | UNMANAGED kind = CDECL {_localctx.Value = Actions.GetCallingConvention($kind);} + | UNMANAGED kind = STDCALL {_localctx.Value = Actions.GetCallingConvention($kind);} + | UNMANAGED kind = THISCALL {_localctx.Value = Actions.GetCallingConvention($kind);} + | UNMANAGED kind = FASTCALL {_localctx.Value = Actions.GetCallingConvention($kind);} + | kind = UNMANAGED {_localctx.Value = Actions.GetCallingConvention($kind);} +; + +mdtoken +returns [int Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + 'mdtoken' '(' token = int32 ')' {_localctx.Value = Actions.ParseInt32($token.start);} +; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; +} + +memberRef returns [CILParser.MemberReferenceValue Value] +@init {_localctx.Value = CILParser.MemberReferenceValue.Error;} +: + 'method' method = methodRef {_localctx.Value = Actions.CreateMethodMemberReference($method.Value);} + | 'field' field = fieldRef {_localctx.Value = Actions.CreateFieldMemberReference($field.Value);} + | token = mdtoken {_localctx.Value = Actions.CreateTokenMemberReference($token.Value);}; + +fieldRef +returns [CILParser.FieldReferenceValue Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init { + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.FieldReferenceValue.Error; +} +: + fieldType = type owner = typeSpecOrScope '::' name = dottedName + {_localctx.Value = Actions.CreateFieldReference($fieldType.Value, $owner.Value, $name.Value);} + | fieldType = type name = dottedName + {_localctx.Value = Actions.CreateFieldReference($fieldType.Value, null, $name.Value);} + | alias = dottedName {_localctx.Value = Actions.CreateTypedefFieldReference(_localctx.Start, $alias.Value);} // typedef +; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; +} /* Generic type parameters declaration */ -typeList: (typeSpec ',')* typeSpec; - -typarsClause: /* EMPTY */ | '<' typars '>'; - -typarAttrib: - covariant = PLUS - | contravariant = '-' - | class = 'class' - | valuetype = VALUETYPE - | byrefLike = 'byreflike' - | ctor = '.ctor' - | 'flags' '(' flags = int32 ')'; - -typarAttribs: typarAttrib*; - -typar: typarAttribs tyBound? dottedName; - -typars: (typar ',')* typar; - -tyBound: '(' typeList ')'; - -genArity: /* EMPTY */ | genArityNotEmpty; - -genArityNotEmpty: '<' '[' int32 ']' '>'; +typeList returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + (item = typeSpec {_localctx.Builder.Add($item.Value);} ',')* + tail = typeSpec {_localctx.Builder.Add($tail.Value);} +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +typarsClause returns [System.Collections.Immutable.ImmutableArray Value] +@init {_localctx.Value = System.Collections.Immutable.ImmutableArray.Empty;} +: + /* EMPTY */ + | '<' parameters = typars '>' {_localctx.Value = $parameters.Value;} +; + +typarAttrib returns [CILParser.AttributeValue Value] +@init {_localctx.Value = CILParser.AttributeValue.Empty;} +: + covariant = PLUS {_localctx.Value = Actions.CreateGenericParameterAttribute($covariant);} + | contravariant = '-' {_localctx.Value = Actions.CreateGenericParameterAttribute($contravariant);} + | class = 'class' {_localctx.Value = Actions.CreateGenericParameterAttribute($class);} + | valuetype = VALUETYPE {_localctx.Value = Actions.CreateGenericParameterAttribute($valuetype);} + | byrefLike = 'byreflike' {_localctx.Value = Actions.CreateGenericParameterAttribute($byrefLike);} + | ctor = '.ctor' {_localctx.Value = Actions.CreateGenericParameterAttribute($ctor);} + | 'flags' '(' flags = int32 ')' {_localctx.Value = Actions.CreateRawGenericParameterAttribute($flags.start);}; + +typarAttribs returns [System.Reflection.GenericParameterAttributes Value] +@init {_localctx.Value = 0;} +: + (attribute = typarAttrib + {_localctx.Value = Actions.AddGenericParameterAttribute(_localctx.Value, $attribute.Value);})* +; + +typar returns [CILParser.GenericParameterDeclarationValue Value] +@init {_localctx.Value = CILParser.GenericParameterDeclarationValue.Error;} +: + attributes = typarAttribs constraints = tyBound? name = dottedName + {_localctx.Value = Actions.CreateGenericParameterDeclaration(_localctx.Start, $attributes.Value, $constraints.ctx, $name.Value);}; + +typars returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + (parameter = typar {_localctx.Builder.Add($parameter.Value);} ',')* + tail = typar {_localctx.Builder.Add($tail.Value);} +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +tyBound returns [System.Collections.Immutable.ImmutableArray Value] +@init {_localctx.Value = System.Collections.Immutable.ImmutableArray.Empty;} +: + '(' constraints = typeList ')' {_localctx.Value = $constraints.Value;}; + +genArity returns [int Value]: + value = genArityNotEmpty? {_localctx.Value = Actions.GetGenericArity($value.ctx);}; + +genArityNotEmpty returns [int Value]: + '<' '[' value = int32 ']' '>' {_localctx.Value = Actions.ParseInt32($value.start);}; /* Class body declarations */ -classDecl: +classDecl +locals [ + CILParser.PropertyBodyValue PropertyBody, + CILParser.EventBodyValue EventBody, + CILParser.CustomAttributeOwnerValue AttributeOwner +] +: methodHead '{' methodDecls '}' | classHead '{' classDecls '}' - | eventHead '{' eventDecls '}' - | propHead '{' propDecls '}' + | eventHeader = eventHead {_localctx.EventBody = Actions.BeginEvent($eventHeader.Value);} + '{' eventDecls[_localctx.EventBody] '}' + | property = propHead {_localctx.PropertyBody = Actions.BeginProperty($property.Value);} + '{' propDecls[_localctx.PropertyBody] '}' | fieldDecl - | dataDecl - | secDecl - | extSourceSpec - | customAttrDecl - | '.size' int32 - | '.pack' int32 - | exportHead '{' exptypeDecls '}' - | OVERRIDE typeSpec '::' methodName 'with' callConv type typeSpec '::' methodName sigArgs - | OVERRIDE 'method' callConv type typeSpec '::' methodName genArity sigArgs 'with' 'method' - callConv type typeSpec '::' methodName genArity sigArgs - | languageDecl - | compControl - | PARAM TYPE '[' int32 ']' customAttrDecl* - | PARAM TYPE dottedName customAttrDecl* - | PARAM CONSTRAINT '[' int32 ']' ',' typeSpec customAttrDecl* - | PARAM CONSTRAINT dottedName ',' typeSpec customAttrDecl* - | '.interfaceimpl' TYPE typeSpec customDescr; + | data = dataDecl {Actions.ProcessClassDataDeclaration($data.ctx);} + | security = secDecl {Actions.ProcessClassSecurityDeclaration($security.ctx);} + | source = extSourceSpec {Actions.ProcessClassSourceDirective($source.ctx);} + | attribute = customAttrDecl {Actions.ProcessClassCustomAttribute($attribute.ctx);} + | '.size' size = int32 {Actions.SetClassSize($size.start);} + | '.pack' packing = int32 {Actions.SetClassPackingSize($packing.start);} + | export = exportHead '{' exportDeclarations = exptypeDecls '}' + {Actions.ProcessClassExport($export.ctx, $exportDeclarations.ctx);} + | OVERRIDE declarationOwner = typeSpecOrScope '::' declarationName = methodName 'with' + bodyConvention = callConv bodyReturnType = type bodyOwner = typeSpecOrScope '::' + bodyName = methodName bodyArguments = sigArgs + {Actions.AddClassMethodOverride( + _localctx, + $declarationOwner.Value, + $declarationName.Value, + $bodyConvention.Value, + $bodyReturnType.Value, + $bodyOwner.Value, + $bodyName.Value, + $bodyArguments.Value);} + | OVERRIDE 'method' + declarationConvention = callConv declarationReturnType = type declarationOwner = typeSpecOrScope '::' + declarationName = methodName declarationArity = genArity declarationArguments = sigArgs + 'with' 'method' + bodyConvention = callConv bodyReturnType = type bodyOwner = typeSpecOrScope '::' + bodyName = methodName bodyArity = genArity bodyArguments = sigArgs + {Actions.AddClassMethodOverride( + _localctx, + $declarationConvention.Value, + $declarationReturnType.Value, + $declarationOwner.Value, + $declarationName.Value, + $declarationArity.Value, + $declarationArguments.Value, + $bodyConvention.Value, + $bodyReturnType.Value, + $bodyOwner.Value, + $bodyName.Value, + $bodyArity.Value, + $bodyArguments.Value);} + | language = languageDecl {Actions.ProcessClassLanguageDirective($language.ctx);} + | compControl {Actions.ProcessClassCompilerControl();} + | PARAM TYPE '[' parameterIndex = int32 ']' + {_localctx.AttributeOwner = Actions.BeginClassGenericParameterDirective(_localctx, $parameterIndex.start);} + (attribute = customAttrDecl {Actions.AddClassGenericDirectiveAttribute(_localctx.AttributeOwner, $attribute.ctx);})* + | PARAM TYPE parameterName = dottedName + {_localctx.AttributeOwner = Actions.BeginClassGenericParameterDirective($parameterName.Value);} + (attribute = customAttrDecl {Actions.AddClassGenericDirectiveAttribute(_localctx.AttributeOwner, $attribute.ctx);})* + | PARAM CONSTRAINT '[' parameterIndex = int32 ']' ',' constraintType = typeSpec + {_localctx.AttributeOwner = Actions.BeginClassGenericConstraintDirective(_localctx, $parameterIndex.start, $constraintType.Value);} + (attribute = customAttrDecl {Actions.AddClassGenericDirectiveAttribute(_localctx.AttributeOwner, $attribute.ctx);})* + | PARAM CONSTRAINT parameterName = dottedName ',' constraintType = typeSpec + {_localctx.AttributeOwner = Actions.BeginClassGenericConstraintDirective($parameterName.Value, $constraintType.Value);} + (attribute = customAttrDecl {Actions.AddClassGenericDirectiveAttribute(_localctx.AttributeOwner, $attribute.ctx);})* + | '.interfaceimpl' TYPE interfaceType = typeSpec interfaceAttribute = customDescr + {Actions.AddInterfaceImplementationAttribute(_localctx, $interfaceType.Value, $interfaceAttribute.ctx);} +; +finally {Actions.EndClassDeclaration(_localctx);} /* Field declaration */ -fieldDecl: - '.field' repeatOpt (fieldAttr | 'marshal' '(' marshalBlob ')')* type dottedName atOpt initOpt; - -fieldAttr: - 'static' - | 'public' - | 'private' - | 'family' - | 'initonly' - | 'rtspecialname' - | 'specialname' - | 'assembly' - | 'famandassem' - | 'famorassem' - | 'privatescope' - | 'literal' - | 'notserialized' - | 'volatile' - | 'flags' '(' int32 ')'; - -atOpt: /* EMPTY */ | 'at' id | 'at' int32; - -initOpt: /* EMPTY */ | '=' fieldInit; - -repeatOpt: /* EMPTY */ | '[' int32 ']'; +fieldDecl returns [CILParser.FieldDeclarationValue Value] +locals [int InitialSyntaxErrorCount, CILParser.FieldDeclarationBuilder Builder] +@init { + _localctx.Builder = Actions.PrepareFieldDeclaration(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.FieldDeclarationValue.Error; +} +@after {Actions.DefineField(_localctx, _localctx.Value);} +: + '.field' offset = repeatOpt + ( + attribute = fieldAttr {Actions.AddFieldAttribute(_localctx.Builder, $attribute.Value);} + | 'marshal' '(' marshalling = marshalBlob ')' {Actions.SetFieldMarshalling(_localctx.Builder, $marshalling.Value);} + )* + fieldType = type name = dottedName data = atOpt initializer = initOpt + {_localctx.Value = Actions.CreateFieldDeclaration( + _localctx, + _localctx.Builder, + _localctx.InitialSyntaxErrorCount, + $offset.ctx, + $fieldType.Value, + $name.Value, + $data.Value, + $initializer.Value);} +; + +fieldAttr returns [CILParser.AttributeValue Value] +@init {_localctx.Value = CILParser.AttributeValue.Empty;} +: + attribute = 'static' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | attribute = 'public' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | attribute = 'private' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | attribute = 'family' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | attribute = 'initonly' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | attribute = 'rtspecialname' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | attribute = 'specialname' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | attribute = 'assembly' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | attribute = 'famandassem' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | attribute = 'famorassem' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | attribute = 'privatescope' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | attribute = 'literal' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | attribute = 'notserialized' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | attribute = 'volatile' {_localctx.Value = Actions.CreateFieldAttribute($attribute);} + | 'flags' '(' flags = int32 ')' {_localctx.Value = Actions.CreateRawFieldAttribute($flags.start);}; + +atOpt returns [string? Value] +@init {_localctx.Value = null;} +: + /* EMPTY */ + | 'at' name = id {_localctx.Value = Actions.GetFieldDataName($name.start);} + | 'at' offset = int32 {_localctx.Value = Actions.GetFieldDataOffset($offset.start);}; + +initOpt returns [CILParser.FieldInitializerValue Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init { + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.FieldInitializerValue.Empty; +} +: + /* EMPTY */ + | '=' initializer = fieldInit {_localctx.Value = $initializer.Value;} +; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; +} + +repeatOpt returns [int Value, bool HasValue]: + /* EMPTY */ + | '[' offset = int32 ']' {Actions.SetFieldOffset(_localctx, $offset.start);}; /* Event declaration */ -eventHead: - '.event' eventAttr* typeSpec dottedName - | '.event' eventAttr* dottedName; - -eventAttr: - 'rtspecialname' - | 'specialname'; - -eventDecls: eventDecl*; - -eventDecl: - '.addon' methodRef - | '.removeon' methodRef - | '.fire' methodRef - | '.other' methodRef - | extSourceSpec - | customAttrDecl - | languageDecl +eventHead returns [CILParser.EventHeaderValue Value] +locals [int InitialSyntaxErrorCount, CILParser.EventHeaderBuilder Builder] +@init { + _localctx.Builder = new CILParser.EventHeaderBuilder(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.EventHeaderValue.Error; +} +: + '.event' + (attribute = eventAttr {Actions.AddEventAttribute(_localctx.Builder, $attribute.Value);})* + eventType = typeSpec name = dottedName + {_localctx.Value = Actions.CreateEventHeader( + _localctx, + _localctx.Builder, + _localctx.InitialSyntaxErrorCount, + $eventType.Value, + $name.Value);} + | '.event' + (attribute = eventAttr {Actions.AddEventAttribute(_localctx.Builder, $attribute.Value);})* + name = dottedName + {_localctx.Value = Actions.CreateEventHeader( + _localctx, + _localctx.Builder, + _localctx.InitialSyntaxErrorCount, + null, + $name.Value);} +; + +eventAttr returns [CILParser.AttributeValue Value] +@init {_localctx.Value = CILParser.AttributeValue.Empty;} +: + attribute = 'rtspecialname' {_localctx.Value = Actions.CreateEventAttribute($attribute);} + | attribute = 'specialname' {_localctx.Value = Actions.CreateEventAttribute($attribute);}; + +eventDecls [CILParser.EventBodyValue Body]: eventDecl[$Body]*; + +eventDecl [CILParser.EventBodyValue Body]: + '.addon' accessor = methodRef {Actions.AddEventAdder($Body, $accessor.Value);} + | '.removeon' accessor = methodRef {Actions.AddEventRemover($Body, $accessor.Value);} + | '.fire' accessor = methodRef {Actions.AddEventRaiser($Body, $accessor.Value);} + | '.other' accessor = methodRef {Actions.AddEventOther($Body, $accessor.Value);} + | source = extSourceSpec {Actions.ProcessEventSourceDirective($Body, $source.ctx);} + | attribute = customAttrDecl {Actions.AddEventCustomAttribute($Body, $attribute.ctx);} + | language = languageDecl {Actions.ProcessEventLanguageDirective($Body, $language.ctx);} | compControl; /* Property declaration */ -propHead: - '.property' propAttr* callConv type dottedName sigArgs initOpt; - -propAttr: - 'rtspecialname' - | 'specialname'; - -propDecls: propDecl*; - -propDecl: - '.set' methodRef - | '.get' methodRef - | '.other' methodRef - | customAttrDecl - | extSourceSpec - | languageDecl +propHead returns [CILParser.PropertyHeaderValue Value] +locals [int InitialSyntaxErrorCount, CILParser.PropertyHeaderBuilder Builder] +@init { + _localctx.Builder = new CILParser.PropertyHeaderBuilder(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.PropertyHeaderValue.Error; +} +: + '.property' + (attribute = propAttr {Actions.AddPropertyAttribute(_localctx.Builder, $attribute.Value);})* + convention = callConv propertyType = type name = dottedName arguments = sigArgs initializer = initOpt + {_localctx.Value = Actions.CreatePropertyHeader( + _localctx, + _localctx.Builder, + _localctx.InitialSyntaxErrorCount, + $convention.Value, + $propertyType.Value, + $name.Value, + $arguments.Value, + $initializer.Value);} +; + +propAttr returns [CILParser.AttributeValue Value] +@init {_localctx.Value = CILParser.AttributeValue.Empty;} +: + attribute = 'rtspecialname' {_localctx.Value = Actions.CreatePropertyAttribute($attribute);} + | attribute = 'specialname' {_localctx.Value = Actions.CreatePropertyAttribute($attribute);}; + +propDecls [CILParser.PropertyBodyValue Body]: propDecl[$Body]*; + +propDecl [CILParser.PropertyBodyValue Body]: + '.set' accessor = methodRef {Actions.AddPropertySetter($Body, $accessor.Value);} + | '.get' accessor = methodRef {Actions.AddPropertyGetter($Body, $accessor.Value);} + | '.other' accessor = methodRef {Actions.AddPropertyOther($Body, $accessor.Value);} + | attribute = customAttrDecl {Actions.AddPropertyCustomAttribute($Body, $attribute.ctx);} + | source = extSourceSpec {Actions.ProcessPropertySourceDirective($Body, $source.ctx);} + | language = languageDecl {Actions.ProcessPropertyLanguageDirective($Body, $language.ctx);} | compControl; /* Method declaration */ -marshalClause: /* EMPTY */ | 'marshal' '(' marshalBlob ')'; - -marshalBlob: nativeType | '{' hexbyte+ '}'; - -paramAttr: paramAttrElement*; - -paramAttrElement: - '[' in = 'in' ']' - | '[' out = 'out' ']' - | '[' opt = 'opt' ']' - | '[' int32 ']'; - -methodHead: - '.method' (methAttr | pinvImpl)* callConv paramAttr type marshalClause methodName typarsClause sigArgs - implAttr*; - -methAttr: 'static' - | 'public' - | 'private' - | 'family' - | 'final' - | 'specialname' - | 'virtual' - | 'strict' - | 'abstract' - | 'assembly' - | 'famandassem' - | 'famorassem' - | 'privatescope' - | 'hidebysig' - | 'newslot' - | 'rtspecialname' - | 'unmanagedexp' - | 'reqsecobj' - | 'flags' '(' int32 ')'; - -pinvImpl: 'pinvokeimpl' '(' (compQstring ('as' compQstring)?)? pinvAttr* ')' | 'pinvokeimpl' '()'; - -pinvAttr: - 'nomangle' - | 'ansi' - | 'unicode' - | 'autochar' - | 'lasterr' - | 'winapi' - | 'cdecl' - | 'stdcall' - | 'thiscall' - | 'fastcall' - | 'bestfit' ':' 'on' - | 'bestfit' ':' 'off' - | 'charmaperror' ':' 'on' - | 'charmaperror' ':' 'off' - | 'flags' '(' int32 ')'; - -methodName: '.ctor' | '.cctor' | dottedName; - -implAttr: - 'native' - | 'cil' - | 'il' - | 'optil' - | 'managed' - | 'unmanaged' - | 'forwardref' - | 'preservesig' - | 'runtime' - | 'internalcall' - | 'synchronized' - | 'noinlining' - | 'aggressiveinlining' - | 'nooptimization' - | 'aggressiveoptimization' - | 'async' - | 'flags' '(' int32 ')'; +marshalClause returns [CILParser.MarshallingDescriptorValue Value] +@init {_localctx.Value = CILParser.MarshallingDescriptorValue.Empty;} +: + /* EMPTY */ {_localctx.Value = Actions.CreateEmptyMarshallingDescriptor();} + | 'marshal' '(' value = marshalBlob ')' {_localctx.Value = Actions.CompleteMarshalClause($value.Value);} +; + +marshalBlob returns [CILParser.MarshallingDescriptorValue Value] +locals [CILParser.MarshalBlobBuilder Builder] +@init {_localctx.Builder = new CILParser.MarshalBlobBuilder();} +: + nativeValue = nativeType {Actions.SetMarshalBlobNativeType(_localctx.Builder, $nativeValue.Value);} + | '{' (rawByte = hexbyte {Actions.AddMarshalBlobByte(_localctx.Builder, $rawByte.Value);})+ '}' +; +finally {_localctx.Value = Actions.CreateMarshallingDescriptor(_localctx.Builder);} + +paramAttr returns [int Value] +@init {_localctx.Value = 0;} +: + (element = paramAttrElement + {_localctx.Value = Actions.AddParameterAttribute( + _localctx.Value, + $element.Value, + $element.ShouldAppend);})* +; + +paramAttrElement returns [int Value, bool ShouldAppend]: + '[' attribute = 'in' ']' {Actions.SetParameterAttributeElement(_localctx, $attribute);} + | '[' attribute = 'out' ']' {Actions.SetParameterAttributeElement(_localctx, $attribute);} + | '[' attribute = 'opt' ']' {Actions.SetParameterAttributeElement(_localctx, $attribute);} + | '[' raw = int32 ']' {Actions.SetRawParameterAttributeElement(_localctx, $raw.start);}; + +methodHead +returns [CILParser.MethodHeaderValue Value] +locals [int InitialSyntaxErrorCount, CILParser.MethodHeaderBuilder Builder] +@init { + _localctx.Builder = Actions.PrepareMethodHeader(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.MethodHeaderValue.Error; +} +@after {Actions.BeginMethod(_localctx, _localctx.Value);} +: + '.method' + ( + attribute = methAttr {Actions.AddMethodAttribute(_localctx.Builder, $attribute.Value);} + | pInvoke = pinvImpl {Actions.AddPInvoke(_localctx.Builder, $pInvoke.Value);} + )* + convention = callConv returnAttributes = paramAttr returnType = type returnMarshalling = marshalClause + name = methodName genericParameters = typarsClause arguments = sigArgs + (implementation = implAttr {Actions.AddMethodImplementationAttribute(_localctx.Builder, $implementation.Value);})* + {_localctx.Value = Actions.CreateMethodHeader( + _localctx, + _localctx.Builder, + _localctx.InitialSyntaxErrorCount, + $convention.Value, + $returnAttributes.Value, + $returnType.Value, + $returnMarshalling.Value, + $name.Value, + $genericParameters.Value, + $arguments.Value);} +; + +methAttr returns [CILParser.AttributeValue Value] +@init {_localctx.Value = CILParser.AttributeValue.Empty;} +: + attribute = 'static' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'public' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'private' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'family' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'final' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'specialname' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'virtual' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'strict' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'abstract' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'assembly' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'famandassem' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'famorassem' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'privatescope' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'hidebysig' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'newslot' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'rtspecialname' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'unmanagedexp' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | attribute = 'reqsecobj' {_localctx.Value = Actions.CreateMethodAttribute($attribute);} + | 'flags' '(' flags = int32 ')' {_localctx.Value = Actions.CreateRawMethodAttribute($flags.start);}; + +pinvImpl returns [CILParser.PInvokeValue Value] +locals [CILParser.PInvokeBuilder Builder] +@init {_localctx.Builder = new CILParser.PInvokeBuilder();} +: + 'pinvokeimpl' '(' + (module = compQstring {Actions.SetPInvokeModule(_localctx.Builder, $module.Value);} + ('as' entryPoint = compQstring {Actions.SetPInvokeEntryPoint(_localctx.Builder, $entryPoint.Value);})?)? + (attribute = pinvAttr {Actions.AddPInvokeAttribute(_localctx.Builder, $attribute.Value);})* + ')' + | 'pinvokeimpl' '()' +; +finally {_localctx.Value = Actions.CreatePInvoke(_localctx.Builder);} + +pinvAttr returns [CILParser.AttributeValue Value] +@init {_localctx.Value = CILParser.AttributeValue.Empty;} +: + attribute = 'nomangle' {_localctx.Value = Actions.CreatePInvokeAttribute($attribute);} + | attribute = 'ansi' {_localctx.Value = Actions.CreatePInvokeAttribute($attribute);} + | attribute = 'unicode' {_localctx.Value = Actions.CreatePInvokeAttribute($attribute);} + | attribute = 'autochar' {_localctx.Value = Actions.CreatePInvokeAttribute($attribute);} + | attribute = 'lasterr' {_localctx.Value = Actions.CreatePInvokeAttribute($attribute);} + | attribute = 'winapi' {_localctx.Value = Actions.CreatePInvokeAttribute($attribute);} + | attribute = 'cdecl' {_localctx.Value = Actions.CreatePInvokeAttribute($attribute);} + | attribute = 'stdcall' {_localctx.Value = Actions.CreatePInvokeAttribute($attribute);} + | attribute = 'thiscall' {_localctx.Value = Actions.CreatePInvokeAttribute($attribute);} + | attribute = 'fastcall' {_localctx.Value = Actions.CreatePInvokeAttribute($attribute);} + | 'bestfit' ':' setting = 'on' {_localctx.Value = Actions.CreateBestFitPInvokeAttribute($setting);} + | 'bestfit' ':' setting = 'off' {_localctx.Value = Actions.CreateBestFitPInvokeAttribute($setting);} + | 'charmaperror' ':' setting = 'on' {_localctx.Value = Actions.CreateCharMapErrorPInvokeAttribute($setting);} + | 'charmaperror' ':' setting = 'off' {_localctx.Value = Actions.CreateCharMapErrorPInvokeAttribute($setting);} + | 'flags' '(' flags = int32 ')' {_localctx.Value = Actions.CreateRawPInvokeAttribute($flags.start);}; + +methodName returns [string Value] +@init {_localctx.Value = string.Empty;} +: + ctorName = '.ctor' {_localctx.Value = Actions.GetMethodName($ctorName);} + | cctorName = '.cctor' {_localctx.Value = Actions.GetMethodName($cctorName);} + | dotted = dottedName {_localctx.Value = $dotted.Value;}; + +implAttr returns [CILParser.AttributeValue Value] +@init {_localctx.Value = CILParser.AttributeValue.Empty;} +: + attribute = 'native' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'cil' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'il' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'optil' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'managed' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'unmanaged' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'forwardref' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'preservesig' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'runtime' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'internalcall' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'synchronized' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'noinlining' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'aggressiveinlining' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'nooptimization' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'aggressiveoptimization' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | attribute = 'async' {_localctx.Value = Actions.CreateMethodImplementationAttribute($attribute);} + | 'flags' '(' flags = int32 ')' {_localctx.Value = Actions.CreateRawMethodImplementationAttribute($flags.start);}; EMITBYTE: '.emitbyte'; MAXSTACK: '.maxstack'; @@ -1202,209 +2019,565 @@ EXPORT: '.export'; OVERRIDE: '.override'; VTENTRY: '.vtentry'; -methodDecls: methodDecl*; +methodDecls +: + methodDecl* +; methodDecl: - instr // MOVED TO TOP - instructions must be matched first! - | EMITBYTE int32 + instr + | EMITBYTE value = int32 {Actions.EmitByte($value.start);} | sehBlock - | MAXSTACK int32 - | LOCALS sigArgs - | LOCALS 'init' sigArgs - | ENTRYPOINT - | ZEROINIT - | dataDecl + | MAXSTACK value = int32 {Actions.SetMaxStack($value.start);} + | ENTRYPOINT {Actions.SetEntryPoint();} + | ZEROINIT {Actions.SetZeroInit();} | labelDecl - | secDecl - | extSourceSpec - | languageDecl - | customDescrInMethodBody // Only customDescr and customDescrWithOwner, NOT bare typedefs - | compControl - | EXPORT '[' int32 ']' - | EXPORT '[' int32 ']' 'as' id - | VTENTRY int32 ':' int32 - | OVERRIDE typeSpec '::' methodName - | OVERRIDE 'method' callConv type typeSpec '::' methodName genArity sigArgs | scopeBlock - | PARAM TYPE '[' int32 ']' customAttrDecl* - | PARAM TYPE dottedName customAttrDecl* - | PARAM CONSTRAINT '[' int32 ']' ',' typeSpec customAttrDecl* - | PARAM CONSTRAINT dottedName ',' typeSpec customAttrDecl* - | PARAM '[' int32 ']' initOpt customAttrDecl*; - -labelDecl: id ':'; - -customDescrInMethodBody: - customDescr - | customDescrWithOwner; - -scopeBlock: '{' methodDecls '}'; + | localsDecl + | declaration = dataDecl {Actions.ProcessMethodDataDeclaration($declaration.ctx);} + | security = secDecl {Actions.ProcessMethodSecurityDeclaration($security.ctx);} + | source = extSourceSpec {Actions.ProcessMethodSourceDirective($source.ctx);} + | language = languageDecl {Actions.ProcessMethodLanguageDirective($language.ctx);} + | attribute = customDescrInMethodBody {Actions.ProcessMethodCustomAttribute($attribute.ctx);} + | compControl + | exportDecl + | vtentryDecl + | overrideDecl + | parameterDecl +; + +localsDecl +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + LOCALS initialize = 'init'? arguments = sigArgs +; +finally {Actions.EndLocalsDirective(_localctx, _localctx.InitialSyntaxErrorCount);} + +exportDecl +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + EXPORT '[' ordinal = int32 ']' ('as' alias = id)? +; +finally {Actions.EndExportDirective(_localctx, _localctx.InitialSyntaxErrorCount);} + +vtentryDecl +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + VTENTRY table = int32 ':' slot = int32 +; +finally {Actions.EndVTableEntryDirective(_localctx, _localctx.InitialSyntaxErrorCount);} + +overrideDecl +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + OVERRIDE owner = typeSpecOrScope '::' name = methodName + | OVERRIDE 'method' convention = callConv returnType = type owner = typeSpecOrScope '::' name = methodName + arity = genArity arguments = sigArgs +; +finally {Actions.EndOverrideDirective(_localctx, _localctx.InitialSyntaxErrorCount);} + +parameterDecl +locals [ + int InitialSyntaxErrorCount, + System.Collections.Immutable.ImmutableArray.Builder Attributes +] +@init { + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Attributes = System.Collections.Immutable.ImmutableArray.CreateBuilder(); +} +: + PARAM TYPE '[' genericIndex = int32 ']' (attribute = customAttrDecl {Actions.AddCustomAttributeApplication(_localctx.Attributes, $attribute.ctx);})* + | PARAM TYPE genericName = dottedName (attribute = customAttrDecl {Actions.AddCustomAttributeApplication(_localctx.Attributes, $attribute.ctx);})* + | PARAM CONSTRAINT '[' constraintIndex = int32 ']' ',' constraintType = typeSpec + (attribute = customAttrDecl {Actions.AddCustomAttributeApplication(_localctx.Attributes, $attribute.ctx);})* + | PARAM CONSTRAINT constraintName = dottedName ',' constraintType = typeSpec + (attribute = customAttrDecl {Actions.AddCustomAttributeApplication(_localctx.Attributes, $attribute.ctx);})* + | PARAM '[' parameterIndex = int32 ']' initializer = initOpt + (attribute = customAttrDecl {Actions.AddCustomAttributeApplication(_localctx.Attributes, $attribute.ctx);})* +; +finally {Actions.EndParameterDirective( + _localctx, + _localctx.Attributes.ToImmutable(), + _localctx.InitialSyntaxErrorCount);} + +labelDecl: + name = id ':' {Actions.DefineLabel($name.start);}; + +customDescrInMethodBody returns [CILParser.CustomAttributeDeclarationValue Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init { + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.CustomAttributeDeclarationValue.Error; +} +: + directAttribute = customDescr {_localctx.Value = Actions.CreateCustomAttributeDeclaration($directAttribute.Value);} + | ownedAttribute = customDescrWithOwner {_localctx.Value = Actions.CreateCustomAttributeDeclaration($ownedAttribute.Value);}; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; +} + +scopeBlock +@init {Actions.BeginScope(_localctx);} +: + '{' methodDecls '}' +; +finally {Actions.EndScope(_localctx);} /* Structured exception handling directives */ -sehBlock: tryBlock sehClauses; - -sehClauses: sehClause+; - -tryBlock: - '.try' scopeBlock - | '.try' id 'to' id - | '.try' int32 'to' int32; - -sehClause: - catchClause handlerBlock - | filterClause handlerBlock - | finallyClause handlerBlock - | faultClause handlerBlock; - -filterClause: - 'filter' scopeBlock - | 'filter' id - | 'filter' int32; - -catchClause: 'catch' typeSpec; +sehBlock +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + tryRange = tryBlock clauses = sehClauses +; +finally {Actions.EndExceptionBlock(_localctx, _localctx.InitialSyntaxErrorCount);} + +sehClauses returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + (clause = sehClause {_localctx.Builder.Add($clause.Value);})+ +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +tryBlock returns [CILParser.ExceptionRangeValue Value] +@init {_localctx.Value = CILParser.ExceptionRangeValue.Invalid;} +: + '.try' body = scopeBlock {_localctx.Value = Actions.CreateScopeExceptionRange($body.ctx);} + | '.try' startLabel = id 'to' endLabel = id + {_localctx.Value = Actions.CreateLabelExceptionRange($startLabel.start, $endLabel.start);} + | '.try' startOffset = int32 'to' endOffset = int32 + {_localctx.Value = Actions.CreateOffsetExceptionRange($startOffset.start, $endOffset.start);}; + +sehClause returns [CILParser.ExceptionClauseValue Value] +@init {_localctx.Value = CILParser.ExceptionClauseValue.Invalid;} +: + caught = catchClause handler = handlerBlock + {_localctx.Value = Actions.CreateCatchExceptionClause($caught.Value, $handler.Value);} + | filtered = filterClause handler = handlerBlock + {_localctx.Value = Actions.CreateFilterExceptionClause($filtered.Value, $handler.Value);} + | finallyClause handler = handlerBlock + {_localctx.Value = Actions.CreateFinallyExceptionClause($handler.Value);} + | faultClause handler = handlerBlock + {_localctx.Value = Actions.CreateFaultExceptionClause($handler.Value);}; + +filterClause returns [CILParser.ExceptionFilterValue Value] +@init {_localctx.Value = CILParser.ExceptionFilterValue.Invalid;} +: + 'filter' body = scopeBlock {_localctx.Value = Actions.CreateScopeFilter($body.ctx);} + | 'filter' label = id {_localctx.Value = Actions.CreateLabelFilter($label.start);} + | 'filter' offset = int32 {_localctx.Value = Actions.CreateOffsetFilter($offset.start);}; + +catchClause +returns [CILParser.CatchTypeValue Value] +locals [int InitialSyntaxErrorCount] +@init { + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.CatchTypeValue.Invalid; +} +: + 'catch' catchType = typeSpec +; +finally {_localctx.Value = Actions.EndCatchClause(_localctx, _localctx.InitialSyntaxErrorCount);} finallyClause: 'finally'; faultClause: 'fault'; -handlerBlock: - scopeBlock - | 'handler' id 'to' id - | 'handler' int32 'to' int32; +handlerBlock returns [CILParser.ExceptionRangeValue Value] +@init {_localctx.Value = CILParser.ExceptionRangeValue.Invalid;} +: + body = scopeBlock {_localctx.Value = Actions.CreateScopeExceptionRange($body.ctx);} + | 'handler' startLabel = id 'to' endLabel = id + {_localctx.Value = Actions.CreateLabelExceptionRange($startLabel.start, $endLabel.start);} + | 'handler' startOffset = int32 'to' endOffset = int32 + {_localctx.Value = Actions.CreateOffsetExceptionRange($startOffset.start, $endOffset.start);}; /* Data declaration */ -dataDecl: ddHead ddBody; - -ddHead: '.data' tls id '=' | '.data' tls; - -tls: /* EMPTY */ | 'tls' | 'cil'; - -ddBody: '{' ddItemList '}' | ddItem+; +dataDecl returns [bool HasSyntaxError] +locals [int InitialSyntaxErrorCount, CILParser.DataDeclarationBuilder Builder] +@init { + _localctx.Builder = Actions.CreateDataDeclaration(_localctx); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; +} +: + ddHead[_localctx.Builder] ddBody[_localctx.Builder] +; +finally {Actions.EndDataDeclaration(_localctx, _localctx.Builder, _localctx.InitialSyntaxErrorCount);} + +ddHead [CILParser.DataDeclarationBuilder Builder]: + '.data' section = tls name = id '=' + {Actions.SetDataDeclarationHeader($Builder, $section.Value, $name.start);} + | '.data' section = tls + {Actions.SetAnonymousDataDeclarationHeader($Builder, $section.Value);}; + +tls returns [byte Value] +@init {_localctx.Value = Actions.GetMappedDataSection();} +: + /* EMPTY */ + | 'tls' {_localctx.Value = Actions.GetTlsDataSection(_localctx);} + | 'cil' {_localctx.Value = Actions.GetCilDataSection();}; -ddItemList: (ddItem ',')* ddItem; +ddBody [CILParser.DataDeclarationBuilder Builder]: + '{' ddItemList[$Builder] '}' | ddItem[$Builder]+; -ddItemCount: /* EMPTY */ | '[' int32 ']'; +ddItemList [CILParser.DataDeclarationBuilder Builder]: + (ddItem[$Builder] ',')* ddItem[$Builder]; -ddItem: - CHAR PTR '(' compQstring ')' - | REF '(' id ')' - | REF id - | 'bytearray' '(' bytes ')' - | FLOAT32 '(' float64 ')' ddItemCount - | FLOAT64_ '(' float64 ')' ddItemCount - | INT64_ '(' int64 ')' ddItemCount - | INT32_ '(' int32 ')' ddItemCount - | INT16 '(' int32 ')' ddItemCount - | INT8 '(' int32 ')' ddItemCount - | FLOAT32 ddItemCount - | FLOAT64_ ddItemCount - | INT64_ ddItemCount - | INT32_ ddItemCount - | INT16 ddItemCount - | INT8 ddItemCount; +ddItemCount [CILParser.DataDeclarationBuilder Builder] returns [int Value] +@init {_localctx.Value = 1;} +: + /* EMPTY */ + | '[' count = int32 ']' {_localctx.Value = Actions.ParseDataItemCount($Builder, $count.start);}; + +ddItem [CILParser.DataDeclarationBuilder Builder]: + CHAR PTR '(' stringValue = compQstring ')' {Actions.AddDataString($Builder, $stringValue.Value);} + | REF '(' target = id ')' {Actions.AddDataReference($Builder, $target.start);} + | REF target = id {Actions.AddDataReference($Builder, $target.start);} + | 'bytearray' '(' byteValue = bytes ')' {Actions.AddDataBytes($Builder, $byteValue.Value);} + | kind = (FLOAT32 | FLOAT64_) '(' floatingValue = float64 ')' count = ddItemCount[$Builder] + {Actions.AddFloatingPointData($Builder, $kind, $floatingValue.Value, $count.Value);} + | kind = INT64_ '(' int64Value = int64 ')' count = ddItemCount[$Builder] + {Actions.AddInt64Data($Builder, $kind, $int64Value.start, $count.Value);} + | kind = (INT32_ | INT16 | INT8) '(' integerValue = int32 ')' count = ddItemCount[$Builder] + {Actions.AddIntegerData($Builder, $kind, $integerValue.start, $count.Value);} + | kind = (FLOAT32 | FLOAT64_ | INT64_ | INT32_ | INT16 | INT8) count = ddItemCount[$Builder] + {Actions.AddZeroData($Builder, $kind, $count.Value);}; /* Default values declaration for fields, parameters and verbal form of CA blob description */ -fieldSerInit: - FLOAT32 '(' float64 ')' - | FLOAT64_ '(' float64 ')' - | FLOAT32 '(' int32 ')' - | FLOAT64_ '(' int64 ')' - | INT64_ '(' int64 ')' - | INT32_ '(' int32 ')' - | INT16 '(' int32 ')' - | INT8 '(' int32 ')' - | UINT64 '(' int64 ')' - | UINT32 '(' int32 ')' - | UINT16 '(' int32 ')' - | UINT8 '(' int32 ')' - | CHAR '(' int32 ')' - | BOOL '(' truefalse ')' - | 'bytearray' '(' bytes ')'; - -bytes: hexbyte*; - -hexbyte: INT32 | ID | HEXBYTE; +fieldSerInit returns [System.Reflection.Metadata.BlobBuilder Value]: + FLOAT32 '(' float32Value = float64 ')' + {_localctx.Value = Actions.CreateFloat32SerializedInitializer($float32Value.ctx, $float32Value.Value);} + | FLOAT64_ '(' float64Value = float64 ')' + {_localctx.Value = Actions.CreateFloat64SerializedInitializer($float64Value.ctx, $float64Value.Value);} + | FLOAT32 '(' float32Bits = int32 ')' + {_localctx.Value = Actions.CreateFloat32BitsSerializedInitializer($float32Bits.start);} + | FLOAT64_ '(' float64Bits = int64 ')' + {_localctx.Value = Actions.CreateFloat64BitsSerializedInitializer($float64Bits.start);} + | int64Type = INT64_ '(' int64Value = int64 ')' + {_localctx.Value = Actions.CreateIntegerSerializedInitializer($int64Type, $int64Value.start);} + | int32Type = INT32_ '(' int32Value = int32 ')' + {_localctx.Value = Actions.CreateIntegerSerializedInitializer($int32Type, $int32Value.start);} + | int16Type = INT16 '(' int16Value = int32 ')' + {_localctx.Value = Actions.CreateIntegerSerializedInitializer($int16Type, $int16Value.start);} + | int8Type = INT8 '(' int8Value = int32 ')' + {_localctx.Value = Actions.CreateIntegerSerializedInitializer($int8Type, $int8Value.start);} + | uint64Type = UINT64 '(' uint64Value = int64 ')' + {_localctx.Value = Actions.CreateIntegerSerializedInitializer($uint64Type, $uint64Value.start);} + | uint32Type = UINT32 '(' uint32Value = int32 ')' + {_localctx.Value = Actions.CreateIntegerSerializedInitializer($uint32Type, $uint32Value.start);} + | uint16Type = UINT16 '(' uint16Value = int32 ')' + {_localctx.Value = Actions.CreateIntegerSerializedInitializer($uint16Type, $uint16Value.start);} + | uint8Type = UINT8 '(' uint8Value = int32 ')' + {_localctx.Value = Actions.CreateIntegerSerializedInitializer($uint8Type, $uint8Value.start);} + | charType = CHAR '(' charValue = int32 ')' + {_localctx.Value = Actions.CreateIntegerSerializedInitializer($charType, $charValue.start);} + | boolType = BOOL '(' boolValue = truefalse ')' + {_localctx.Value = Actions.CreateBooleanSerializedInitializer($boolType, $boolValue.Value);} + | 'bytearray' '(' byteArrayValue = bytes ')' + {_localctx.Value = Actions.CreateByteArraySerializedInitializer($byteArrayValue.Value);}; +finally {_localctx.Value ??= new System.Reflection.Metadata.BlobBuilder();} + +bytes +returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = Actions.CreateByteAccumulator();} +: + (b = hexbyte {Actions.AddByte(_localctx.Builder, $b.Value);})* +; +finally {_localctx.Value = Actions.EndBytes(_localctx.Builder);} + +hexbyte +returns [byte Value] +@after {_localctx.Value = GrammarActions.ParseHexbyte(_localctx.Start);} +: + INT32 + | ID + | HEXBYTE +; /* Field/parameter initialization */ -fieldInit: fieldSerInit | compQstring | NULLREF; +fieldInit returns [CILParser.FieldInitializerValue Value] +@init {_localctx.Value = CILParser.FieldInitializerValue.Empty;} +: + serializedValue = fieldSerInit {_localctx.Value = Actions.CreateFieldInitializer($serializedValue.Value);} + | stringValue = compQstring {_localctx.Value = Actions.CreateFieldInitializer($stringValue.Value);} + | NULLREF {_localctx.Value = Actions.CreateNullFieldInitializer();}; /* Values for verbal form of CA blob description */ -serInit: - fieldSerInit - | STRING '(' NULLREF ')' - | STRING '(' SQSTRING ')' - | TYPE '(' 'class' SQSTRING ')' - | TYPE '(' className ')' - | TYPE '(' NULLREF ')' - | OBJECT '(' serInit ')' - | FLOAT32 '[' int32 ']' '(' f32seq ')' - | FLOAT64_ '[' int32 ']' '(' f64seq ')' - | INT64_ '[' int32 ']' '(' i64seq ')' - | INT32_ '[' int32 ']' '(' i32seq ')' - | INT16 '[' int32 ']' '(' i16seq ')' - | INT8 '[' int32 ']' '(' i8seq ')' - | UINT64 '[' int32 ']' '(' i64seq ')' - | UINT32 '[' int32 ']' '(' i32seq ')' - | UINT16 '[' int32 ']' '(' i16seq ')' - | UINT8 '[' int32 ']' '(' i8seq ')' - | CHAR '[' int32 ']' '(' i16seq ')' - | BOOL '[' int32 ']' '(' boolSeq ')' - | STRING '[' int32 ']' '(' sqstringSeq ')' - | TYPE '[' int32 ']' '(' classSeq ')' - | OBJECT '[' int32 ']' '(' objSeq ')'; - -f32seq: (float64 | int32)*; - -f64seq: (float64 | int64)*; - -i64seq: int64*; - -i32seq: int32*; - -i16seq: int32*; - -i8seq: int32*; - -boolSeq: truefalse*; - -sqstringSeq: (NULLREF | SQSTRING)*; - -classSeq: classSeqElement*; - -classSeqElement: NULLREF | 'class' SQSTRING | className; - -objSeq: serInit*; - -customAttrDecl: - customDescr - | customDescrWithOwner - | dottedName /* typedef */; +serInit returns [CILParser.SerializedInitializerValue Value] +@init {_localctx.Value = CILParser.SerializedInitializerValue.Error;} +: + scalarValue = fieldSerInit + {_localctx.Value = Actions.CreateScalarSerializedValue(_localctx, $scalarValue.ctx, $scalarValue.Value);} + | STRING '(' NULLREF ')' {_localctx.Value = Actions.CreateStringSerializedValue();} + | STRING '(' stringToken = SQSTRING ')' {_localctx.Value = Actions.CreateStringSerializedValue($stringToken);} + | TYPE '(' 'class' typeToken = SQSTRING ')' {_localctx.Value = Actions.CreateTypeSerializedValue($typeToken);} + | TYPE '(' typeName = className ')' {_localctx.Value = Actions.CreateTypeSerializedValue($typeName.Value);} + | TYPE '(' NULLREF ')' {_localctx.Value = Actions.CreateNullTypeSerializedValue();} + | OBJECT '(' objectValue = serInit ')' {_localctx.Value = Actions.CreateObjectSerializedValue($objectValue.Value);} + | f32ElementToken = FLOAT32 '[' f32Length = int32 ']' '(' f32Values = f32seq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($f32ElementToken, $f32Length.start, $f32Values.Value);} + | f64ElementToken = FLOAT64_ '[' f64Length = int32 ']' '(' f64Values = f64seq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($f64ElementToken, $f64Length.start, $f64Values.Value);} + | i64ElementToken = INT64_ '[' i64Length = int32 ']' '(' i64Values = i64seq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($i64ElementToken, $i64Length.start, $i64Values.Value);} + | i32ElementToken = INT32_ '[' i32Length = int32 ']' '(' i32Values = i32seq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($i32ElementToken, $i32Length.start, $i32Values.Value);} + | i16ElementToken = INT16 '[' i16Length = int32 ']' '(' i16Values = i16seq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($i16ElementToken, $i16Length.start, $i16Values.Value);} + | i8ElementToken = INT8 '[' i8Length = int32 ']' '(' i8Values = i8seq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($i8ElementToken, $i8Length.start, $i8Values.Value);} + | u64ElementToken = UINT64 '[' u64Length = int32 ']' '(' u64Values = i64seq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($u64ElementToken, $u64Length.start, $u64Values.Value);} + | u32ElementToken = UINT32 '[' u32Length = int32 ']' '(' u32Values = i32seq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($u32ElementToken, $u32Length.start, $u32Values.Value);} + | u16ElementToken = UINT16 '[' u16Length = int32 ']' '(' u16Values = i16seq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($u16ElementToken, $u16Length.start, $u16Values.Value);} + | u8ElementToken = UINT8 '[' u8Length = int32 ']' '(' u8Values = i8seq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($u8ElementToken, $u8Length.start, $u8Values.Value);} + | charElementToken = CHAR '[' charLength = int32 ']' '(' charValues = i16seq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($charElementToken, $charLength.start, $charValues.Value);} + | boolElementToken = BOOL '[' boolLength = int32 ']' '(' boolValues = boolSeq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($boolElementToken, $boolLength.start, $boolValues.Value);} + | stringElementToken = STRING '[' stringLength = int32 ']' '(' stringValues = sqstringSeq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($stringElementToken, $stringLength.start, $stringValues.Value);} + | typeElementToken = TYPE '[' typeLength = int32 ']' '(' typeValues = classSeq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($typeElementToken, $typeLength.start, $typeValues.Value);} + | objectElementToken = OBJECT '[' objectLength = int32 ']' '(' objectValues = objSeq ')' + {_localctx.Value = Actions.CreateArraySerializedValue($objectElementToken, $objectLength.start, $objectValues.Value);}; + +f32seq returns [System.Reflection.Metadata.BlobBuilder Value] +locals [System.Reflection.Metadata.BlobBuilder Builder] +@init {_localctx.Builder = new System.Reflection.Metadata.BlobBuilder();} +: + (floatingValue = float64 {Actions.AddFloat32SequenceValue(_localctx.Builder, $floatingValue.Value);} + | integerValue = int32 {Actions.AddFloat32SequenceValue(_localctx.Builder, $integerValue.start);})* +; +finally {_localctx.Value = _localctx.Builder;} + +f64seq returns [System.Reflection.Metadata.BlobBuilder Value] +locals [System.Reflection.Metadata.BlobBuilder Builder] +@init {_localctx.Builder = new System.Reflection.Metadata.BlobBuilder();} +: + (floatingValue = float64 {Actions.AddFloat64SequenceValue(_localctx.Builder, $floatingValue.Value);} + | integerValue = int64 {Actions.AddFloat64SequenceValue(_localctx.Builder, $integerValue.start);})* +; +finally {_localctx.Value = _localctx.Builder;} + +i64seq returns [System.Reflection.Metadata.BlobBuilder Value] +locals [System.Reflection.Metadata.BlobBuilder Builder] +@init {_localctx.Builder = new System.Reflection.Metadata.BlobBuilder();} +: + (value = int64 {Actions.AddInt64SequenceValue(_localctx.Builder, $value.start);})* +; +finally {_localctx.Value = _localctx.Builder;} + +i32seq returns [System.Reflection.Metadata.BlobBuilder Value] +locals [System.Reflection.Metadata.BlobBuilder Builder] +@init {_localctx.Builder = new System.Reflection.Metadata.BlobBuilder();} +: + (value = int32 {Actions.AddInt32SequenceValue(_localctx.Builder, $value.start);})* +; +finally {_localctx.Value = _localctx.Builder;} + +i16seq returns [System.Reflection.Metadata.BlobBuilder Value] +locals [System.Reflection.Metadata.BlobBuilder Builder] +@init {_localctx.Builder = new System.Reflection.Metadata.BlobBuilder();} +: + (value = int32 {Actions.AddInt16SequenceValue(_localctx.Builder, $value.start);})* +; +finally {_localctx.Value = _localctx.Builder;} + +i8seq returns [System.Reflection.Metadata.BlobBuilder Value] +locals [System.Reflection.Metadata.BlobBuilder Builder] +@init {_localctx.Builder = new System.Reflection.Metadata.BlobBuilder();} +: + (value = int32 {Actions.AddInt8SequenceValue(_localctx.Builder, $value.start);})* +; +finally {_localctx.Value = _localctx.Builder;} + +boolSeq returns [System.Reflection.Metadata.BlobBuilder Value] +locals [System.Reflection.Metadata.BlobBuilder Builder] +@init {_localctx.Builder = new System.Reflection.Metadata.BlobBuilder();} +: + (value = truefalse {Actions.AddBooleanSequenceValue(_localctx.Builder, $value.Value);})* +; +finally {_localctx.Value = _localctx.Builder;} + +sqstringSeq returns [System.Reflection.Metadata.BlobBuilder Value] +locals [System.Reflection.Metadata.BlobBuilder Builder] +@init {_localctx.Builder = new System.Reflection.Metadata.BlobBuilder();} +: + (nullValue = NULLREF {Actions.AddStringSequenceValue(_localctx.Builder, $nullValue);} + | stringValue = SQSTRING {Actions.AddStringSequenceValue(_localctx.Builder, $stringValue);})* +; +finally {_localctx.Value = _localctx.Builder;} + +classSeq returns [CILParser.SerializedSequenceValue Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + (value = classSeqElement {_localctx.Builder.Add($value.Value);})* +; +finally {_localctx.Value = new CILParser.ClassSerializedSequenceValue(_localctx.Builder.ToImmutable());} + +classSeqElement returns [CILParser.ClassSequenceElementValue Value] +@init {_localctx.Value = CILParser.ClassSequenceElementValue.Error;} +: + NULLREF {_localctx.Value = Actions.CreateNullClassSequenceValue();} + | 'class' quotedValue = SQSTRING {_localctx.Value = Actions.CreateQuotedClassSequenceValue($quotedValue);} + | typeValue = className {_localctx.Value = Actions.CreateClassSequenceValue($typeValue.Value);}; + +objSeq returns [CILParser.SerializedSequenceValue Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + (value = serInit {_localctx.Builder.Add($value.Value);})* +; +finally {_localctx.Value = new CILParser.ObjectSerializedSequenceValue(_localctx.Builder.ToImmutable());} + +customAttrDecl returns [CILParser.CustomAttributeDeclarationValue Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init { + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.CustomAttributeDeclarationValue.Error; +} +: + directAttribute = customDescr {_localctx.Value = Actions.CreateCustomAttributeDeclaration($directAttribute.Value);} + | ownedAttribute = customDescrWithOwner {_localctx.Value = Actions.CreateCustomAttributeDeclaration($ownedAttribute.Value);} + | alias = dottedName {_localctx.Value = Actions.CreateCustomAttributeTypedef($alias.Value);}; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; +} /* Assembly References */ -asmOrRefDecl: - '.publickey' '=' '(' bytes ')' - | '.ver' intOrWildcard ':' intOrWildcard ':' intOrWildcard ':' intOrWildcard - | '.locale' compQstring - | '.locale' '=' '(' bytes ')' - | customAttrDecl +asmOrRefDecl returns [CILParser.AssemblyDeclarationValue? Value]: + '.publickey' '=' '(' key = bytes ')' + {_localctx.Value = Actions.CreateAssemblyPublicKeyDeclaration($key.Value);} + | '.ver' major = intOrWildcard ':' minor = intOrWildcard ':' build = intOrWildcard ':' revision = intOrWildcard + {_localctx.Value = Actions.CreateAssemblyVersionDeclaration( + $major.Value, + $minor.Value, + $build.Value, + $revision.Value);} + | '.locale' locale = compQstring + {_localctx.Value = Actions.CreateAssemblyLocaleDeclaration($locale.Value);} + | '.locale' '=' '(' localeBytes = bytes ')' + {_localctx.Value = Actions.CreateAssemblyLocaleDeclaration($localeBytes.Value);} + | attribute = customAttrDecl + {_localctx.Value = Actions.CreateAssemblyCustomAttributeDeclaration( + $attribute.Value, + $attribute.start);} | compControl; -assemblyRefHead: - '.assembly' 'extern' asmAttr dottedName - | '.assembly' 'extern' asmAttr dottedName 'as' dottedName; - -assemblyRefDecls: assemblyRefDecl*; - -assemblyRefDecl: - '.hash' '=' '(' bytes ')' - | asmOrRefDecl - | '.publickeytoken' '=' '(' bytes ')' - | 'auto'; - -exptypeHead: '.class' 'extern' exptAttr* dottedName; - -exportHead: '.export' exptAttr* dottedName; - -exptAttr: +assemblyRefBlock returns [CILParser.AssemblyReferenceValue? Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + header = assemblyRefHead '{' declarations = assemblyRefDecls '}' + {_localctx.Value = Actions.CreateAssemblyReference( + $header.Value, + $declarations.Value);} +; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + if (_localctx.HasSyntaxError) + { + _localctx.Value = null; + } +} + +assemblyRefHead returns [CILParser.AssemblyReferenceHeaderValue Value] +@init {_localctx.Value = CILParser.AssemblyReferenceHeaderValue.Error;} +: + '.assembly' 'extern' attributes = asmAttr name = dottedName + {_localctx.Value = Actions.CreateAssemblyReferenceHeader( + $attributes.Value, + $name.Value, + $name.Value);} + | '.assembly' 'extern' attributes = asmAttr name = dottedName 'as' alias = dottedName + {_localctx.Value = Actions.CreateAssemblyReferenceHeader( + $attributes.Value, + $name.Value, + $alias.Value);}; + +assemblyRefDecls returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + (declaration = assemblyRefDecl + {if ($declaration.Value is not null) _localctx.Builder.Add($declaration.Value);})* +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +assemblyRefDecl returns [CILParser.AssemblyDeclarationValue? Value]: + '.hash' '=' '(' hash = bytes ')' + {_localctx.Value = Actions.CreateAssemblyReferenceHashDeclaration($hash.Value);} + | shared = asmOrRefDecl {_localctx.Value = $shared.Value;} + | '.publickeytoken' '=' '(' token = bytes ')' + {_localctx.Value = Actions.CreateAssemblyReferencePublicKeyTokenDeclaration($token.Value);} + | 'auto' {_localctx.Value = Actions.CreateAssemblyReferenceAutoDeclaration();}; + +exptypeBlock returns [CILParser.ExportedTypeValue? Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + header = exptypeHead '{' declarations = exptypeDecls '}' + {_localctx.Value = Actions.CreateExportedType( + $header.Value, + $declarations.Value);} +; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + if (_localctx.HasSyntaxError) + { + _localctx.Value = null; + } +} + +exptypeHead returns [CILParser.ExportedTypeHeaderValue Value] +@init {_localctx.Value = CILParser.ExportedTypeHeaderValue.Error;} +: + head = '.class' 'extern' attributes = exptAttrs name = dottedName + {_localctx.Value = Actions.CreateExportedTypeHeader( + $attributes.Value, + $name.Value, + $head);}; + +exportHead returns [CILParser.ExportedTypeHeaderValue Value] +@init {_localctx.Value = CILParser.ExportedTypeHeaderValue.Error;} +: + head = '.export' attributes = exptAttrs name = dottedName + {_localctx.Value = Actions.CreateExportedTypeHeader( + $attributes.Value, + $name.Value, + $head);}; + +exptAttrs returns [System.Reflection.TypeAttributes Value] +@init {_localctx.Value = 0;} +: + (attribute = exptAttr + {_localctx.Value = Actions.AddExportedTypeAttribute( + _localctx.Value, + $attribute.Value, + $attribute.Mask);})* +; + +exptAttr returns [System.Reflection.TypeAttributes Value, System.Reflection.TypeAttributes Mask] +@after {Actions.SetExportedTypeAttribute(_localctx);} +: 'private' | 'public' | 'forwarder' @@ -1415,27 +2588,110 @@ exptAttr: | 'nested' 'famandassem' | 'nested' 'famorassem'; -exptypeDecls: exptypeDecl*; - -exptypeDecl: - '.file' dottedName - | '.class' 'extern' slashedName - | '.assembly' 'extern' dottedName - | mdtoken - | '.class' int32 - | customAttrDecl +exptypeDecls returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + (declaration = exptypeDecl + {if ($declaration.Value is not null) _localctx.Builder.Add($declaration.Value);})* +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +exptypeDecl returns [CILParser.ExportedTypeDeclarationValue? Value]: + location = '.file' name = dottedName + {_localctx.Value = Actions.CreateExportedTypeFileDeclaration( + $name.Value, + $location);} + | location = '.class' 'extern' nestedName = slashedName + {_localctx.Value = Actions.CreateNestedExportedTypeDeclaration( + $nestedName.Value, + $location);} + | location = '.assembly' 'extern' assemblyName = dottedName + {_localctx.Value = Actions.CreateExportedTypeAssemblyDeclaration( + $assemblyName.Value, + $location);} + | token = mdtoken + {_localctx.Value = Actions.CreateExportedTypeMetadataTokenDeclaration( + $token.Value, + $token.start);} + | '.class' typeDefinitionId = int32 + {_localctx.Value = Actions.CreateExportedTypeDefinitionIdDeclaration( + $typeDefinitionId.start);} + | attribute = customAttrDecl + {_localctx.Value = Actions.CreateExportedTypeCustomAttributeDeclaration( + $attribute.Value, + $attribute.start);} | compControl; -manifestResHead: - MRESOURCE manresAttr* dottedName - | MRESOURCE manresAttr* dottedName 'as' dottedName; - -manresAttr: 'public' | 'private'; - -manifestResDecls: manifestResDecl*; - -manifestResDecl: - '.file' dottedName 'at' int32 - | '.assembly' 'extern' dottedName - | customAttrDecl +manifestResBlock returns [CILParser.ManifestResourceValue? Value, bool HasSyntaxError] +locals [int InitialSyntaxErrorCount] +@init {_localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount;} +: + header = manifestResHead '{' declarations = manifestResDecls '}' + {_localctx.Value = Actions.CreateManifestResource( + $header.Value, + $declarations.Value);} +; +finally { + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + if (_localctx.HasSyntaxError) + { + _localctx.Value = null; + } +} + +manifestResHead returns [CILParser.ManifestResourceHeaderValue Value] +@init {_localctx.Value = CILParser.ManifestResourceHeaderValue.Error;} +: + head = MRESOURCE attributes = manresAttrs name = dottedName + {_localctx.Value = Actions.CreateManifestResourceHeader( + $attributes.Value, + $name.Value, + $name.Value, + $head);} + | head = MRESOURCE attributes = manresAttrs name = dottedName 'as' alias = dottedName + {_localctx.Value = Actions.CreateManifestResourceHeader( + $attributes.Value, + $name.Value, + $alias.Value, + $head);}; + +manresAttrs returns [System.Reflection.ManifestResourceAttributes Value] +@init {_localctx.Value = 0;} +: + (attribute = manresAttr + {_localctx.Value = Actions.AddManifestResourceAttribute( + _localctx.Value, + $attribute.Value);})* +; + +manresAttr returns [System.Reflection.ManifestResourceAttributes Value] +@after {_localctx.Value = Actions.ParseManifestResourceAttribute(_localctx.Start);} +: + 'public' + | 'private'; + +manifestResDecls returns [System.Collections.Immutable.ImmutableArray Value] +locals [System.Collections.Immutable.ImmutableArray.Builder Builder] +@init {_localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder();} +: + (declaration = manifestResDecl + {if ($declaration.Value is not null) _localctx.Builder.Add($declaration.Value);})* +; +finally {_localctx.Value = _localctx.Builder.ToImmutable();} + +manifestResDecl returns [CILParser.ManifestResourceDeclarationValue? Value]: + location = '.file' name = dottedName 'at' offset = int32 + {_localctx.Value = Actions.CreateManifestResourceFileDeclaration( + $name.Value, + $offset.start, + $location);} + | '.assembly' 'extern' name = dottedName + {_localctx.Value = Actions.CreateManifestResourceAssemblyDeclaration($name.Value);} + | attribute = customAttrDecl + {_localctx.Value = Actions.CreateManifestResourceCustomAttributeDeclaration( + $attribute.Value, + $attribute.start);} | compControl; diff --git a/src/tools/ilasm/src/ILAssembler/gen/CIL.interp b/src/tools/ilasm/src/ILAssembler/gen/CIL.interp index b6fd2f72c76018..b1ae67acdb35c5 100644 --- a/src/tools/ilasm/src/ILAssembler/gen/CIL.interp +++ b/src/tools/ilasm/src/ILAssembler/gen/CIL.interp @@ -648,6 +648,7 @@ serializTypeElement moduleHead vtfixupDecl vtfixupAttr +vtfixupAttrElement vtableDecl nameSpaceHead classHead @@ -663,20 +664,9 @@ fileAttr fileEntry asmAttrAny asmAttr -instr_none -instr_var -instr_i -instr_i8 -instr_r -instr_brtarget -instr_method -instr_field -instr_type -instr_string -instr_sig -instr_tok -instr_switch instr +simpleInstr +calliSignature labels typeArgs bounds @@ -687,6 +677,7 @@ slashedName assemblyDecls assemblyDecl typeSpec +typeSpecOrScope nativeType nativeTypeArrayPointerInfo nativeTypeElement @@ -749,6 +740,11 @@ methodName implAttr methodDecls methodDecl +localsDecl +exportDecl +vtentryDecl +overrideDecl +parameterDecl labelDecl customDescrInMethodBody scopeBlock @@ -786,19 +782,24 @@ classSeqElement objSeq customAttrDecl asmOrRefDecl +assemblyRefBlock assemblyRefHead assemblyRefDecls assemblyRefDecl +exptypeBlock exptypeHead exportHead +exptAttrs exptAttr exptypeDecls exptypeDecl +manifestResBlock manifestResHead +manresAttrs manresAttr manifestResDecls manifestResDecl atn: -[4, 1, 304, 2876, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 2, 157, 7, 157, 2, 158, 7, 158, 2, 159, 7, 159, 2, 160, 7, 160, 2, 161, 7, 161, 2, 162, 7, 162, 2, 163, 7, 163, 2, 164, 7, 164, 2, 165, 7, 165, 2, 166, 7, 166, 2, 167, 7, 167, 2, 168, 7, 168, 2, 169, 7, 169, 2, 170, 7, 170, 2, 171, 7, 171, 2, 172, 7, 172, 2, 173, 7, 173, 2, 174, 7, 174, 2, 175, 7, 175, 2, 176, 7, 176, 2, 177, 7, 177, 2, 178, 7, 178, 2, 179, 7, 179, 2, 180, 7, 180, 2, 181, 7, 181, 2, 182, 7, 182, 2, 183, 7, 183, 2, 184, 7, 184, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 377, 8, 1, 10, 1, 12, 1, 380, 9, 1, 1, 1, 1, 1, 3, 1, 384, 8, 1, 1, 2, 1, 2, 1, 3, 1, 3, 5, 3, 390, 8, 3, 10, 3, 12, 3, 393, 9, 3, 1, 3, 1, 3, 1, 4, 5, 4, 398, 8, 4, 10, 4, 12, 4, 401, 9, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 453, 8, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 494, 8, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 5, 15, 501, 8, 15, 10, 15, 12, 15, 504, 9, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 527, 8, 18, 1, 19, 1, 19, 3, 19, 531, 8, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 549, 8, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 3, 21, 576, 8, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 599, 8, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 3, 23, 635, 8, 23, 1, 24, 1, 24, 1, 25, 1, 25, 3, 25, 641, 8, 25, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 5, 27, 648, 8, 27, 10, 27, 12, 27, 651, 9, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 5, 28, 660, 8, 28, 10, 28, 12, 28, 663, 9, 28, 1, 29, 1, 29, 1, 30, 1, 30, 3, 30, 669, 8, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 3, 31, 680, 8, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 3, 32, 688, 8, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 709, 8, 34, 10, 34, 12, 34, 712, 9, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 5, 37, 725, 8, 37, 10, 37, 12, 37, 728, 9, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 772, 8, 38, 1, 39, 1, 39, 1, 39, 3, 39, 777, 8, 39, 1, 40, 1, 40, 1, 40, 3, 40, 782, 8, 40, 1, 41, 5, 41, 785, 8, 41, 10, 41, 12, 41, 788, 9, 41, 1, 42, 1, 42, 1, 42, 5, 42, 793, 8, 42, 10, 42, 12, 42, 796, 9, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 3, 44, 873, 8, 44, 1, 45, 1, 45, 5, 45, 877, 8, 45, 10, 45, 12, 45, 880, 9, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 5, 45, 893, 8, 45, 10, 45, 12, 45, 896, 9, 45, 1, 45, 1, 45, 1, 45, 3, 45, 901, 8, 45, 1, 46, 1, 46, 1, 47, 1, 47, 3, 47, 907, 8, 47, 1, 48, 1, 48, 1, 49, 5, 49, 912, 8, 49, 10, 49, 12, 49, 915, 9, 49, 1, 50, 1, 50, 1, 51, 1, 51, 1, 52, 1, 52, 1, 53, 1, 53, 1, 54, 1, 54, 1, 55, 1, 55, 1, 56, 1, 56, 1, 57, 1, 57, 1, 58, 1, 58, 1, 59, 1, 59, 1, 60, 1, 60, 1, 61, 1, 61, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 3, 63, 1025, 8, 63, 1, 64, 1, 64, 1, 64, 3, 64, 1030, 8, 64, 1, 64, 1, 64, 5, 64, 1034, 8, 64, 10, 64, 12, 64, 1037, 9, 64, 1, 64, 1, 64, 3, 64, 1041, 8, 64, 3, 64, 1043, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 1049, 8, 65, 10, 65, 12, 65, 1052, 9, 65, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 1, 66, 5, 66, 1061, 8, 66, 10, 66, 12, 66, 1064, 9, 66, 1, 66, 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 67, 5, 67, 1073, 8, 67, 10, 67, 12, 67, 1076, 9, 67, 1, 67, 1, 67, 1, 67, 1, 67, 3, 67, 1082, 8, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 1089, 8, 68, 3, 68, 1091, 8, 68, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 3, 69, 1118, 8, 69, 1, 70, 1, 70, 1, 70, 5, 70, 1123, 8, 70, 10, 70, 12, 70, 1126, 9, 70, 1, 70, 1, 70, 1, 71, 5, 71, 1131, 8, 71, 10, 71, 12, 71, 1134, 9, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 3, 72, 1141, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 3, 73, 1154, 8, 73, 1, 74, 1, 74, 1, 74, 5, 74, 1159, 8, 74, 10, 74, 12, 74, 1162, 9, 74, 3, 74, 1164, 8, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 3, 75, 1183, 8, 75, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 3, 76, 1277, 8, 76, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 3, 77, 1286, 8, 77, 1, 78, 1, 78, 1, 78, 5, 78, 1291, 8, 78, 10, 78, 12, 78, 1294, 9, 78, 3, 78, 1296, 8, 78, 1, 79, 1, 79, 1, 80, 1, 80, 5, 80, 1302, 8, 80, 10, 80, 12, 80, 1305, 9, 80, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 3, 81, 1325, 8, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 3, 82, 1357, 8, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 3, 83, 1380, 8, 83, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 3, 84, 1392, 8, 84, 1, 85, 1, 85, 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 3, 86, 1401, 8, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 3, 87, 1426, 8, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 3, 87, 1450, 8, 87, 1, 88, 1, 88, 1, 88, 1, 88, 5, 88, 1456, 8, 88, 10, 88, 12, 88, 1459, 9, 88, 1, 88, 3, 88, 1462, 8, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 3, 89, 1477, 8, 89, 1, 90, 1, 90, 1, 90, 5, 90, 1482, 8, 90, 10, 90, 12, 90, 1485, 9, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 3, 93, 1529, 8, 93, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 3, 95, 1539, 8, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 3, 95, 1555, 8, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 3, 95, 1567, 8, 95, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 3, 96, 1579, 8, 96, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 3, 97, 1593, 8, 97, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 3, 99, 1605, 8, 99, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 3, 100, 1616, 8, 100, 1, 101, 1, 101, 1, 101, 5, 101, 1621, 8, 101, 10, 101, 12, 101, 1624, 9, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 3, 102, 1633, 8, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 3, 103, 1646, 8, 103, 1, 104, 5, 104, 1649, 8, 104, 10, 104, 12, 104, 1652, 9, 104, 1, 105, 1, 105, 3, 105, 1656, 8, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 5, 106, 1663, 8, 106, 10, 106, 12, 106, 1666, 9, 106, 1, 106, 1, 106, 1, 107, 1, 107, 1, 107, 1, 107, 1, 108, 1, 108, 3, 108, 1676, 8, 108, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 5, 110, 1757, 8, 110, 10, 110, 12, 110, 1760, 9, 110, 1, 110, 1, 110, 1, 110, 1, 110, 5, 110, 1766, 8, 110, 10, 110, 12, 110, 1769, 9, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 5, 110, 1779, 8, 110, 10, 110, 12, 110, 1782, 9, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 5, 110, 1790, 8, 110, 10, 110, 12, 110, 1793, 9, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 3, 110, 1800, 8, 110, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 5, 111, 1810, 8, 111, 10, 111, 12, 111, 1813, 9, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 3, 112, 1839, 8, 112, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 3, 113, 1846, 8, 113, 1, 114, 1, 114, 1, 114, 3, 114, 1851, 8, 114, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 3, 115, 1858, 8, 115, 1, 116, 1, 116, 5, 116, 1862, 8, 116, 10, 116, 12, 116, 1865, 9, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 5, 116, 1872, 8, 116, 10, 116, 12, 116, 1875, 9, 116, 1, 116, 3, 116, 1878, 8, 116, 1, 117, 1, 117, 1, 118, 5, 118, 1883, 8, 118, 10, 118, 12, 118, 1886, 9, 118, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 3, 119, 1900, 8, 119, 1, 120, 1, 120, 5, 120, 1904, 8, 120, 10, 120, 12, 120, 1907, 9, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 122, 5, 122, 1918, 8, 122, 10, 122, 12, 122, 1921, 9, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 3, 123, 1933, 8, 123, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 3, 124, 1941, 8, 124, 1, 125, 1, 125, 1, 125, 4, 125, 1946, 8, 125, 11, 125, 12, 125, 1947, 1, 125, 1, 125, 3, 125, 1952, 8, 125, 1, 126, 5, 126, 1955, 8, 126, 10, 126, 12, 126, 1958, 9, 126, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 3, 127, 1973, 8, 127, 1, 128, 1, 128, 1, 128, 5, 128, 1978, 8, 128, 10, 128, 12, 128, 1981, 9, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 5, 128, 1991, 8, 128, 10, 128, 12, 128, 1994, 9, 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 3, 129, 2019, 8, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 3, 130, 2026, 8, 130, 3, 130, 2028, 8, 130, 1, 130, 5, 130, 2031, 8, 130, 10, 130, 12, 130, 2034, 9, 130, 1, 130, 1, 130, 1, 130, 3, 130, 2039, 8, 130, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 3, 131, 2068, 8, 131, 1, 132, 1, 132, 1, 132, 3, 132, 2073, 8, 132, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 3, 133, 2096, 8, 133, 1, 134, 5, 134, 2099, 8, 134, 10, 134, 12, 134, 2102, 9, 134, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 5, 135, 2163, 8, 135, 10, 135, 12, 135, 2166, 9, 135, 1, 135, 1, 135, 1, 135, 1, 135, 5, 135, 2172, 8, 135, 10, 135, 12, 135, 2175, 9, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 5, 135, 2185, 8, 135, 10, 135, 12, 135, 2188, 9, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 5, 135, 2196, 8, 135, 10, 135, 12, 135, 2199, 9, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 5, 135, 2207, 8, 135, 10, 135, 12, 135, 2210, 9, 135, 3, 135, 2212, 8, 135, 1, 136, 1, 136, 1, 136, 1, 137, 1, 137, 3, 137, 2219, 8, 137, 1, 138, 1, 138, 1, 138, 1, 138, 1, 139, 1, 139, 1, 139, 1, 140, 4, 140, 2229, 8, 140, 11, 140, 12, 140, 2230, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 3, 141, 2245, 8, 141, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 3, 142, 2259, 8, 142, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 3, 143, 2267, 8, 143, 1, 144, 1, 144, 1, 144, 1, 145, 1, 145, 1, 146, 1, 146, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 3, 147, 2287, 8, 147, 1, 148, 1, 148, 1, 148, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 3, 149, 2299, 8, 149, 1, 150, 1, 150, 1, 150, 3, 150, 2304, 8, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 4, 151, 2311, 8, 151, 11, 151, 12, 151, 2312, 3, 151, 2315, 8, 151, 1, 152, 1, 152, 1, 152, 5, 152, 2320, 8, 152, 10, 152, 12, 152, 2323, 9, 152, 1, 152, 1, 152, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 3, 153, 2332, 8, 153, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 3, 154, 2400, 8, 154, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 3, 155, 2477, 8, 155, 1, 156, 5, 156, 2480, 8, 156, 10, 156, 12, 156, 2483, 9, 156, 1, 157, 1, 157, 1, 158, 1, 158, 1, 158, 3, 158, 2490, 8, 158, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 3, 159, 2640, 8, 159, 1, 160, 1, 160, 5, 160, 2644, 8, 160, 10, 160, 12, 160, 2647, 9, 160, 1, 161, 1, 161, 5, 161, 2651, 8, 161, 10, 161, 12, 161, 2654, 9, 161, 1, 162, 5, 162, 2657, 8, 162, 10, 162, 12, 162, 2660, 9, 162, 1, 163, 5, 163, 2663, 8, 163, 10, 163, 12, 163, 2666, 9, 163, 1, 164, 5, 164, 2669, 8, 164, 10, 164, 12, 164, 2672, 9, 164, 1, 165, 5, 165, 2675, 8, 165, 10, 165, 12, 165, 2678, 9, 165, 1, 166, 5, 166, 2681, 8, 166, 10, 166, 12, 166, 2684, 9, 166, 1, 167, 5, 167, 2687, 8, 167, 10, 167, 12, 167, 2690, 9, 167, 1, 168, 5, 168, 2693, 8, 168, 10, 168, 12, 168, 2696, 9, 168, 1, 169, 1, 169, 1, 169, 1, 169, 3, 169, 2702, 8, 169, 1, 170, 5, 170, 2705, 8, 170, 10, 170, 12, 170, 2708, 9, 170, 1, 171, 1, 171, 1, 171, 3, 171, 2713, 8, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 3, 172, 2740, 8, 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 3, 173, 2754, 8, 173, 1, 174, 5, 174, 2757, 8, 174, 10, 174, 12, 174, 2760, 9, 174, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 3, 175, 2776, 8, 175, 1, 176, 1, 176, 1, 176, 5, 176, 2781, 8, 176, 10, 176, 12, 176, 2784, 9, 176, 1, 176, 1, 176, 1, 177, 1, 177, 5, 177, 2790, 8, 177, 10, 177, 12, 177, 2793, 9, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 3, 178, 2812, 8, 178, 1, 179, 5, 179, 2815, 8, 179, 10, 179, 12, 179, 2818, 9, 179, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 3, 180, 2833, 8, 180, 1, 181, 1, 181, 5, 181, 2837, 8, 181, 10, 181, 12, 181, 2840, 9, 181, 1, 181, 1, 181, 1, 181, 5, 181, 2845, 8, 181, 10, 181, 12, 181, 2848, 9, 181, 1, 181, 1, 181, 1, 181, 1, 181, 3, 181, 2854, 8, 181, 1, 182, 1, 182, 1, 183, 5, 183, 2859, 8, 183, 10, 183, 12, 183, 2862, 9, 183, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 3, 184, 2874, 8, 184, 1, 184, 0, 1, 68, 185, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, 354, 356, 358, 360, 362, 364, 366, 368, 0, 14, 5, 0, 1, 15, 242, 242, 246, 246, 263, 263, 288, 288, 4, 0, 16, 16, 242, 242, 263, 263, 287, 288, 1, 0, 172, 173, 1, 0, 37, 38, 1, 0, 73, 74, 3, 0, 2, 2, 61, 61, 77, 83, 2, 0, 228, 228, 259, 260, 9, 0, 177, 177, 182, 194, 200, 200, 206, 207, 209, 214, 217, 218, 221, 221, 229, 241, 261, 261, 1, 0, 95, 96, 1, 0, 97, 111, 1, 0, 68, 69, 2, 0, 172, 172, 288, 289, 2, 0, 178, 178, 263, 263, 1, 0, 51, 52, 3289, 0, 370, 1, 0, 0, 0, 2, 383, 1, 0, 0, 0, 4, 385, 1, 0, 0, 0, 6, 391, 1, 0, 0, 0, 8, 399, 1, 0, 0, 0, 10, 452, 1, 0, 0, 0, 12, 454, 1, 0, 0, 0, 14, 457, 1, 0, 0, 0, 16, 460, 1, 0, 0, 0, 18, 464, 1, 0, 0, 0, 20, 467, 1, 0, 0, 0, 22, 470, 1, 0, 0, 0, 24, 477, 1, 0, 0, 0, 26, 493, 1, 0, 0, 0, 28, 495, 1, 0, 0, 0, 30, 497, 1, 0, 0, 0, 32, 507, 1, 0, 0, 0, 34, 509, 1, 0, 0, 0, 36, 526, 1, 0, 0, 0, 38, 530, 1, 0, 0, 0, 40, 548, 1, 0, 0, 0, 42, 575, 1, 0, 0, 0, 44, 598, 1, 0, 0, 0, 46, 634, 1, 0, 0, 0, 48, 636, 1, 0, 0, 0, 50, 640, 1, 0, 0, 0, 52, 642, 1, 0, 0, 0, 54, 649, 1, 0, 0, 0, 56, 661, 1, 0, 0, 0, 58, 664, 1, 0, 0, 0, 60, 666, 1, 0, 0, 0, 62, 679, 1, 0, 0, 0, 64, 687, 1, 0, 0, 0, 66, 689, 1, 0, 0, 0, 68, 697, 1, 0, 0, 0, 70, 713, 1, 0, 0, 0, 72, 719, 1, 0, 0, 0, 74, 722, 1, 0, 0, 0, 76, 771, 1, 0, 0, 0, 78, 776, 1, 0, 0, 0, 80, 781, 1, 0, 0, 0, 82, 786, 1, 0, 0, 0, 84, 794, 1, 0, 0, 0, 86, 799, 1, 0, 0, 0, 88, 872, 1, 0, 0, 0, 90, 900, 1, 0, 0, 0, 92, 902, 1, 0, 0, 0, 94, 906, 1, 0, 0, 0, 96, 908, 1, 0, 0, 0, 98, 913, 1, 0, 0, 0, 100, 916, 1, 0, 0, 0, 102, 918, 1, 0, 0, 0, 104, 920, 1, 0, 0, 0, 106, 922, 1, 0, 0, 0, 108, 924, 1, 0, 0, 0, 110, 926, 1, 0, 0, 0, 112, 928, 1, 0, 0, 0, 114, 930, 1, 0, 0, 0, 116, 932, 1, 0, 0, 0, 118, 934, 1, 0, 0, 0, 120, 936, 1, 0, 0, 0, 122, 938, 1, 0, 0, 0, 124, 940, 1, 0, 0, 0, 126, 1024, 1, 0, 0, 0, 128, 1042, 1, 0, 0, 0, 130, 1044, 1, 0, 0, 0, 132, 1056, 1, 0, 0, 0, 134, 1081, 1, 0, 0, 0, 136, 1090, 1, 0, 0, 0, 138, 1117, 1, 0, 0, 0, 140, 1124, 1, 0, 0, 0, 142, 1132, 1, 0, 0, 0, 144, 1140, 1, 0, 0, 0, 146, 1153, 1, 0, 0, 0, 148, 1163, 1, 0, 0, 0, 150, 1182, 1, 0, 0, 0, 152, 1276, 1, 0, 0, 0, 154, 1285, 1, 0, 0, 0, 156, 1295, 1, 0, 0, 0, 158, 1297, 1, 0, 0, 0, 160, 1299, 1, 0, 0, 0, 162, 1324, 1, 0, 0, 0, 164, 1356, 1, 0, 0, 0, 166, 1379, 1, 0, 0, 0, 168, 1391, 1, 0, 0, 0, 170, 1393, 1, 0, 0, 0, 172, 1396, 1, 0, 0, 0, 174, 1449, 1, 0, 0, 0, 176, 1461, 1, 0, 0, 0, 178, 1476, 1, 0, 0, 0, 180, 1483, 1, 0, 0, 0, 182, 1488, 1, 0, 0, 0, 184, 1492, 1, 0, 0, 0, 186, 1528, 1, 0, 0, 0, 188, 1530, 1, 0, 0, 0, 190, 1566, 1, 0, 0, 0, 192, 1578, 1, 0, 0, 0, 194, 1592, 1, 0, 0, 0, 196, 1594, 1, 0, 0, 0, 198, 1604, 1, 0, 0, 0, 200, 1615, 1, 0, 0, 0, 202, 1622, 1, 0, 0, 0, 204, 1632, 1, 0, 0, 0, 206, 1645, 1, 0, 0, 0, 208, 1650, 1, 0, 0, 0, 210, 1653, 1, 0, 0, 0, 212, 1664, 1, 0, 0, 0, 214, 1669, 1, 0, 0, 0, 216, 1675, 1, 0, 0, 0, 218, 1677, 1, 0, 0, 0, 220, 1799, 1, 0, 0, 0, 222, 1801, 1, 0, 0, 0, 224, 1838, 1, 0, 0, 0, 226, 1845, 1, 0, 0, 0, 228, 1850, 1, 0, 0, 0, 230, 1857, 1, 0, 0, 0, 232, 1877, 1, 0, 0, 0, 234, 1879, 1, 0, 0, 0, 236, 1884, 1, 0, 0, 0, 238, 1899, 1, 0, 0, 0, 240, 1901, 1, 0, 0, 0, 242, 1914, 1, 0, 0, 0, 244, 1919, 1, 0, 0, 0, 246, 1932, 1, 0, 0, 0, 248, 1940, 1, 0, 0, 0, 250, 1951, 1, 0, 0, 0, 252, 1956, 1, 0, 0, 0, 254, 1972, 1, 0, 0, 0, 256, 1974, 1, 0, 0, 0, 258, 2018, 1, 0, 0, 0, 260, 2038, 1, 0, 0, 0, 262, 2067, 1, 0, 0, 0, 264, 2072, 1, 0, 0, 0, 266, 2095, 1, 0, 0, 0, 268, 2100, 1, 0, 0, 0, 270, 2211, 1, 0, 0, 0, 272, 2213, 1, 0, 0, 0, 274, 2218, 1, 0, 0, 0, 276, 2220, 1, 0, 0, 0, 278, 2224, 1, 0, 0, 0, 280, 2228, 1, 0, 0, 0, 282, 2244, 1, 0, 0, 0, 284, 2258, 1, 0, 0, 0, 286, 2266, 1, 0, 0, 0, 288, 2268, 1, 0, 0, 0, 290, 2271, 1, 0, 0, 0, 292, 2273, 1, 0, 0, 0, 294, 2286, 1, 0, 0, 0, 296, 2288, 1, 0, 0, 0, 298, 2298, 1, 0, 0, 0, 300, 2303, 1, 0, 0, 0, 302, 2314, 1, 0, 0, 0, 304, 2321, 1, 0, 0, 0, 306, 2331, 1, 0, 0, 0, 308, 2399, 1, 0, 0, 0, 310, 2476, 1, 0, 0, 0, 312, 2481, 1, 0, 0, 0, 314, 2484, 1, 0, 0, 0, 316, 2489, 1, 0, 0, 0, 318, 2639, 1, 0, 0, 0, 320, 2645, 1, 0, 0, 0, 322, 2652, 1, 0, 0, 0, 324, 2658, 1, 0, 0, 0, 326, 2664, 1, 0, 0, 0, 328, 2670, 1, 0, 0, 0, 330, 2676, 1, 0, 0, 0, 332, 2682, 1, 0, 0, 0, 334, 2688, 1, 0, 0, 0, 336, 2694, 1, 0, 0, 0, 338, 2701, 1, 0, 0, 0, 340, 2706, 1, 0, 0, 0, 342, 2712, 1, 0, 0, 0, 344, 2739, 1, 0, 0, 0, 346, 2753, 1, 0, 0, 0, 348, 2758, 1, 0, 0, 0, 350, 2775, 1, 0, 0, 0, 352, 2777, 1, 0, 0, 0, 354, 2787, 1, 0, 0, 0, 356, 2811, 1, 0, 0, 0, 358, 2816, 1, 0, 0, 0, 360, 2832, 1, 0, 0, 0, 362, 2853, 1, 0, 0, 0, 364, 2855, 1, 0, 0, 0, 366, 2860, 1, 0, 0, 0, 368, 2873, 1, 0, 0, 0, 370, 371, 7, 0, 0, 0, 371, 1, 1, 0, 0, 0, 372, 384, 5, 287, 0, 0, 373, 374, 3, 4, 2, 0, 374, 375, 5, 264, 0, 0, 375, 377, 1, 0, 0, 0, 376, 373, 1, 0, 0, 0, 377, 380, 1, 0, 0, 0, 378, 376, 1, 0, 0, 0, 378, 379, 1, 0, 0, 0, 379, 381, 1, 0, 0, 0, 380, 378, 1, 0, 0, 0, 381, 384, 3, 4, 2, 0, 382, 384, 5, 263, 0, 0, 383, 372, 1, 0, 0, 0, 383, 378, 1, 0, 0, 0, 383, 382, 1, 0, 0, 0, 384, 3, 1, 0, 0, 0, 385, 386, 7, 1, 0, 0, 386, 5, 1, 0, 0, 0, 387, 388, 5, 262, 0, 0, 388, 390, 5, 265, 0, 0, 389, 387, 1, 0, 0, 0, 390, 393, 1, 0, 0, 0, 391, 389, 1, 0, 0, 0, 391, 392, 1, 0, 0, 0, 392, 394, 1, 0, 0, 0, 393, 391, 1, 0, 0, 0, 394, 395, 5, 262, 0, 0, 395, 7, 1, 0, 0, 0, 396, 398, 3, 10, 5, 0, 397, 396, 1, 0, 0, 0, 398, 401, 1, 0, 0, 0, 399, 397, 1, 0, 0, 0, 399, 400, 1, 0, 0, 0, 400, 9, 1, 0, 0, 0, 401, 399, 1, 0, 0, 0, 402, 403, 3, 74, 37, 0, 403, 404, 5, 17, 0, 0, 404, 405, 3, 82, 41, 0, 405, 406, 5, 18, 0, 0, 406, 453, 1, 0, 0, 0, 407, 408, 3, 72, 36, 0, 408, 409, 5, 17, 0, 0, 409, 410, 3, 8, 4, 0, 410, 411, 5, 18, 0, 0, 411, 453, 1, 0, 0, 0, 412, 413, 3, 256, 128, 0, 413, 414, 5, 17, 0, 0, 414, 415, 3, 268, 134, 0, 415, 416, 5, 18, 0, 0, 416, 453, 1, 0, 0, 0, 417, 453, 3, 222, 111, 0, 418, 453, 3, 296, 148, 0, 419, 453, 3, 70, 35, 0, 420, 453, 3, 66, 33, 0, 421, 453, 3, 88, 44, 0, 422, 453, 3, 90, 45, 0, 423, 453, 3, 22, 11, 0, 424, 425, 3, 346, 173, 0, 425, 426, 5, 17, 0, 0, 426, 427, 3, 348, 174, 0, 427, 428, 5, 18, 0, 0, 428, 453, 1, 0, 0, 0, 429, 430, 3, 352, 176, 0, 430, 431, 5, 17, 0, 0, 431, 432, 3, 358, 179, 0, 432, 433, 5, 18, 0, 0, 433, 453, 1, 0, 0, 0, 434, 435, 3, 362, 181, 0, 435, 436, 5, 17, 0, 0, 436, 437, 3, 366, 183, 0, 437, 438, 5, 18, 0, 0, 438, 453, 1, 0, 0, 0, 439, 453, 3, 64, 32, 0, 440, 453, 3, 174, 87, 0, 441, 453, 3, 342, 171, 0, 442, 453, 3, 12, 6, 0, 443, 453, 3, 14, 7, 0, 444, 453, 3, 16, 8, 0, 445, 453, 3, 18, 9, 0, 446, 453, 3, 20, 10, 0, 447, 453, 3, 26, 13, 0, 448, 453, 3, 42, 21, 0, 449, 453, 3, 40, 20, 0, 450, 453, 3, 30, 15, 0, 451, 453, 3, 24, 12, 0, 452, 402, 1, 0, 0, 0, 452, 407, 1, 0, 0, 0, 452, 412, 1, 0, 0, 0, 452, 417, 1, 0, 0, 0, 452, 418, 1, 0, 0, 0, 452, 419, 1, 0, 0, 0, 452, 420, 1, 0, 0, 0, 452, 421, 1, 0, 0, 0, 452, 422, 1, 0, 0, 0, 452, 423, 1, 0, 0, 0, 452, 424, 1, 0, 0, 0, 452, 429, 1, 0, 0, 0, 452, 434, 1, 0, 0, 0, 452, 439, 1, 0, 0, 0, 452, 440, 1, 0, 0, 0, 452, 441, 1, 0, 0, 0, 452, 442, 1, 0, 0, 0, 452, 443, 1, 0, 0, 0, 452, 444, 1, 0, 0, 0, 452, 445, 1, 0, 0, 0, 452, 446, 1, 0, 0, 0, 452, 447, 1, 0, 0, 0, 452, 448, 1, 0, 0, 0, 452, 449, 1, 0, 0, 0, 452, 450, 1, 0, 0, 0, 452, 451, 1, 0, 0, 0, 453, 11, 1, 0, 0, 0, 454, 455, 5, 19, 0, 0, 455, 456, 3, 32, 16, 0, 456, 13, 1, 0, 0, 0, 457, 458, 5, 20, 0, 0, 458, 459, 3, 32, 16, 0, 459, 15, 1, 0, 0, 0, 460, 461, 5, 21, 0, 0, 461, 462, 5, 22, 0, 0, 462, 463, 3, 32, 16, 0, 463, 17, 1, 0, 0, 0, 464, 465, 5, 23, 0, 0, 465, 466, 3, 34, 17, 0, 466, 19, 1, 0, 0, 0, 467, 468, 5, 24, 0, 0, 468, 469, 3, 34, 17, 0, 469, 21, 1, 0, 0, 0, 470, 471, 5, 25, 0, 0, 471, 472, 3, 98, 49, 0, 472, 473, 3, 2, 1, 0, 473, 474, 5, 17, 0, 0, 474, 475, 3, 142, 71, 0, 475, 476, 5, 18, 0, 0, 476, 23, 1, 0, 0, 0, 477, 478, 5, 26, 0, 0, 478, 25, 1, 0, 0, 0, 479, 480, 5, 27, 0, 0, 480, 494, 3, 28, 14, 0, 481, 482, 5, 27, 0, 0, 482, 483, 3, 28, 14, 0, 483, 484, 5, 28, 0, 0, 484, 485, 3, 28, 14, 0, 485, 494, 1, 0, 0, 0, 486, 487, 5, 27, 0, 0, 487, 488, 3, 28, 14, 0, 488, 489, 5, 28, 0, 0, 489, 490, 3, 28, 14, 0, 490, 491, 5, 28, 0, 0, 491, 492, 3, 28, 14, 0, 492, 494, 1, 0, 0, 0, 493, 479, 1, 0, 0, 0, 493, 481, 1, 0, 0, 0, 493, 486, 1, 0, 0, 0, 494, 27, 1, 0, 0, 0, 495, 496, 5, 263, 0, 0, 496, 29, 1, 0, 0, 0, 497, 498, 5, 29, 0, 0, 498, 502, 5, 17, 0, 0, 499, 501, 3, 138, 69, 0, 500, 499, 1, 0, 0, 0, 501, 504, 1, 0, 0, 0, 502, 500, 1, 0, 0, 0, 502, 503, 1, 0, 0, 0, 503, 505, 1, 0, 0, 0, 504, 502, 1, 0, 0, 0, 505, 506, 5, 18, 0, 0, 506, 31, 1, 0, 0, 0, 507, 508, 5, 172, 0, 0, 508, 33, 1, 0, 0, 0, 509, 510, 7, 2, 0, 0, 510, 35, 1, 0, 0, 0, 511, 527, 5, 174, 0, 0, 512, 513, 3, 32, 16, 0, 513, 514, 5, 264, 0, 0, 514, 527, 1, 0, 0, 0, 515, 527, 3, 32, 16, 0, 516, 517, 5, 187, 0, 0, 517, 518, 5, 30, 0, 0, 518, 519, 3, 32, 16, 0, 519, 520, 5, 31, 0, 0, 520, 527, 1, 0, 0, 0, 521, 522, 5, 188, 0, 0, 522, 523, 5, 30, 0, 0, 523, 524, 3, 34, 17, 0, 524, 525, 5, 31, 0, 0, 525, 527, 1, 0, 0, 0, 526, 511, 1, 0, 0, 0, 526, 512, 1, 0, 0, 0, 526, 515, 1, 0, 0, 0, 526, 516, 1, 0, 0, 0, 526, 521, 1, 0, 0, 0, 527, 37, 1, 0, 0, 0, 528, 531, 3, 32, 16, 0, 529, 531, 5, 261, 0, 0, 530, 528, 1, 0, 0, 0, 530, 529, 1, 0, 0, 0, 531, 39, 1, 0, 0, 0, 532, 533, 5, 266, 0, 0, 533, 549, 5, 288, 0, 0, 534, 535, 5, 266, 0, 0, 535, 536, 5, 288, 0, 0, 536, 549, 5, 262, 0, 0, 537, 538, 5, 267, 0, 0, 538, 549, 5, 288, 0, 0, 539, 540, 5, 268, 0, 0, 540, 549, 5, 288, 0, 0, 541, 542, 5, 269, 0, 0, 542, 549, 5, 288, 0, 0, 543, 549, 5, 270, 0, 0, 544, 549, 5, 271, 0, 0, 545, 546, 5, 272, 0, 0, 546, 549, 5, 262, 0, 0, 547, 549, 5, 32, 0, 0, 548, 532, 1, 0, 0, 0, 548, 534, 1, 0, 0, 0, 548, 537, 1, 0, 0, 0, 548, 539, 1, 0, 0, 0, 548, 541, 1, 0, 0, 0, 548, 543, 1, 0, 0, 0, 548, 544, 1, 0, 0, 0, 548, 545, 1, 0, 0, 0, 548, 547, 1, 0, 0, 0, 549, 41, 1, 0, 0, 0, 550, 551, 5, 33, 0, 0, 551, 552, 3, 160, 80, 0, 552, 553, 5, 34, 0, 0, 553, 554, 3, 2, 1, 0, 554, 576, 1, 0, 0, 0, 555, 556, 5, 33, 0, 0, 556, 557, 3, 138, 69, 0, 557, 558, 5, 34, 0, 0, 558, 559, 3, 2, 1, 0, 559, 576, 1, 0, 0, 0, 560, 561, 5, 33, 0, 0, 561, 562, 3, 198, 99, 0, 562, 563, 5, 34, 0, 0, 563, 564, 3, 2, 1, 0, 564, 576, 1, 0, 0, 0, 565, 566, 5, 33, 0, 0, 566, 567, 3, 44, 22, 0, 567, 568, 5, 34, 0, 0, 568, 569, 3, 2, 1, 0, 569, 576, 1, 0, 0, 0, 570, 571, 5, 33, 0, 0, 571, 572, 3, 46, 23, 0, 572, 573, 5, 34, 0, 0, 573, 574, 3, 2, 1, 0, 574, 576, 1, 0, 0, 0, 575, 550, 1, 0, 0, 0, 575, 555, 1, 0, 0, 0, 575, 560, 1, 0, 0, 0, 575, 565, 1, 0, 0, 0, 575, 570, 1, 0, 0, 0, 576, 43, 1, 0, 0, 0, 577, 578, 5, 35, 0, 0, 578, 599, 3, 48, 24, 0, 579, 580, 5, 35, 0, 0, 580, 581, 3, 48, 24, 0, 581, 582, 5, 36, 0, 0, 582, 583, 3, 6, 3, 0, 583, 599, 1, 0, 0, 0, 584, 585, 5, 35, 0, 0, 585, 586, 3, 48, 24, 0, 586, 587, 5, 36, 0, 0, 587, 588, 5, 17, 0, 0, 588, 589, 3, 52, 26, 0, 589, 590, 5, 18, 0, 0, 590, 599, 1, 0, 0, 0, 591, 592, 5, 35, 0, 0, 592, 593, 3, 48, 24, 0, 593, 594, 5, 36, 0, 0, 594, 595, 5, 30, 0, 0, 595, 596, 3, 312, 156, 0, 596, 597, 5, 31, 0, 0, 597, 599, 1, 0, 0, 0, 598, 577, 1, 0, 0, 0, 598, 579, 1, 0, 0, 0, 598, 584, 1, 0, 0, 0, 598, 591, 1, 0, 0, 0, 599, 45, 1, 0, 0, 0, 600, 601, 5, 35, 0, 0, 601, 602, 5, 30, 0, 0, 602, 603, 3, 50, 25, 0, 603, 604, 5, 31, 0, 0, 604, 605, 3, 48, 24, 0, 605, 635, 1, 0, 0, 0, 606, 607, 5, 35, 0, 0, 607, 608, 5, 30, 0, 0, 608, 609, 3, 50, 25, 0, 609, 610, 5, 31, 0, 0, 610, 611, 3, 48, 24, 0, 611, 612, 5, 36, 0, 0, 612, 613, 3, 6, 3, 0, 613, 635, 1, 0, 0, 0, 614, 615, 5, 35, 0, 0, 615, 616, 5, 30, 0, 0, 616, 617, 3, 50, 25, 0, 617, 618, 5, 31, 0, 0, 618, 619, 3, 48, 24, 0, 619, 620, 5, 36, 0, 0, 620, 621, 5, 17, 0, 0, 621, 622, 3, 52, 26, 0, 622, 623, 5, 18, 0, 0, 623, 635, 1, 0, 0, 0, 624, 625, 5, 35, 0, 0, 625, 626, 5, 30, 0, 0, 626, 627, 3, 50, 25, 0, 627, 628, 5, 31, 0, 0, 628, 629, 3, 48, 24, 0, 629, 630, 5, 36, 0, 0, 630, 631, 5, 30, 0, 0, 631, 632, 3, 312, 156, 0, 632, 633, 5, 31, 0, 0, 633, 635, 1, 0, 0, 0, 634, 600, 1, 0, 0, 0, 634, 606, 1, 0, 0, 0, 634, 614, 1, 0, 0, 0, 634, 624, 1, 0, 0, 0, 635, 47, 1, 0, 0, 0, 636, 637, 3, 190, 95, 0, 637, 49, 1, 0, 0, 0, 638, 641, 3, 146, 73, 0, 639, 641, 3, 198, 99, 0, 640, 638, 1, 0, 0, 0, 640, 639, 1, 0, 0, 0, 641, 51, 1, 0, 0, 0, 642, 643, 3, 54, 27, 0, 643, 644, 3, 56, 28, 0, 644, 53, 1, 0, 0, 0, 645, 648, 3, 318, 159, 0, 646, 648, 3, 40, 20, 0, 647, 645, 1, 0, 0, 0, 647, 646, 1, 0, 0, 0, 648, 651, 1, 0, 0, 0, 649, 647, 1, 0, 0, 0, 649, 650, 1, 0, 0, 0, 650, 55, 1, 0, 0, 0, 651, 649, 1, 0, 0, 0, 652, 653, 3, 58, 29, 0, 653, 654, 3, 60, 30, 0, 654, 655, 3, 2, 1, 0, 655, 656, 5, 36, 0, 0, 656, 657, 3, 318, 159, 0, 657, 660, 1, 0, 0, 0, 658, 660, 3, 40, 20, 0, 659, 652, 1, 0, 0, 0, 659, 658, 1, 0, 0, 0, 660, 663, 1, 0, 0, 0, 661, 659, 1, 0, 0, 0, 661, 662, 1, 0, 0, 0, 662, 57, 1, 0, 0, 0, 663, 661, 1, 0, 0, 0, 664, 665, 7, 3, 0, 0, 665, 59, 1, 0, 0, 0, 666, 668, 3, 62, 31, 0, 667, 669, 5, 260, 0, 0, 668, 667, 1, 0, 0, 0, 668, 669, 1, 0, 0, 0, 669, 61, 1, 0, 0, 0, 670, 680, 3, 166, 83, 0, 671, 680, 3, 2, 1, 0, 672, 680, 5, 195, 0, 0, 673, 680, 5, 196, 0, 0, 674, 675, 5, 201, 0, 0, 675, 676, 5, 39, 0, 0, 676, 680, 5, 263, 0, 0, 677, 678, 5, 201, 0, 0, 678, 680, 3, 138, 69, 0, 679, 670, 1, 0, 0, 0, 679, 671, 1, 0, 0, 0, 679, 672, 1, 0, 0, 0, 679, 673, 1, 0, 0, 0, 679, 674, 1, 0, 0, 0, 679, 677, 1, 0, 0, 0, 680, 63, 1, 0, 0, 0, 681, 682, 5, 197, 0, 0, 682, 683, 5, 40, 0, 0, 683, 688, 3, 2, 1, 0, 684, 685, 5, 197, 0, 0, 685, 688, 3, 2, 1, 0, 686, 688, 5, 197, 0, 0, 687, 681, 1, 0, 0, 0, 687, 684, 1, 0, 0, 0, 687, 686, 1, 0, 0, 0, 688, 65, 1, 0, 0, 0, 689, 690, 5, 41, 0, 0, 690, 691, 5, 42, 0, 0, 691, 692, 3, 32, 16, 0, 692, 693, 5, 43, 0, 0, 693, 694, 3, 68, 34, 0, 694, 695, 5, 44, 0, 0, 695, 696, 3, 0, 0, 0, 696, 67, 1, 0, 0, 0, 697, 710, 6, 34, -1, 0, 698, 699, 10, 5, 0, 0, 699, 709, 5, 185, 0, 0, 700, 701, 10, 4, 0, 0, 701, 709, 5, 186, 0, 0, 702, 703, 10, 3, 0, 0, 703, 709, 5, 45, 0, 0, 704, 705, 10, 2, 0, 0, 705, 709, 5, 46, 0, 0, 706, 707, 10, 1, 0, 0, 707, 709, 5, 47, 0, 0, 708, 698, 1, 0, 0, 0, 708, 700, 1, 0, 0, 0, 708, 702, 1, 0, 0, 0, 708, 704, 1, 0, 0, 0, 708, 706, 1, 0, 0, 0, 709, 712, 1, 0, 0, 0, 710, 708, 1, 0, 0, 0, 710, 711, 1, 0, 0, 0, 711, 69, 1, 0, 0, 0, 712, 710, 1, 0, 0, 0, 713, 714, 5, 48, 0, 0, 714, 715, 5, 36, 0, 0, 715, 716, 5, 30, 0, 0, 716, 717, 3, 312, 156, 0, 717, 718, 5, 31, 0, 0, 718, 71, 1, 0, 0, 0, 719, 720, 5, 49, 0, 0, 720, 721, 3, 2, 1, 0, 721, 73, 1, 0, 0, 0, 722, 726, 5, 50, 0, 0, 723, 725, 3, 76, 38, 0, 724, 723, 1, 0, 0, 0, 725, 728, 1, 0, 0, 0, 726, 724, 1, 0, 0, 0, 726, 727, 1, 0, 0, 0, 727, 729, 1, 0, 0, 0, 728, 726, 1, 0, 0, 0, 729, 730, 3, 2, 1, 0, 730, 731, 3, 204, 102, 0, 731, 732, 3, 78, 39, 0, 732, 733, 3, 80, 40, 0, 733, 75, 1, 0, 0, 0, 734, 772, 5, 51, 0, 0, 735, 772, 5, 52, 0, 0, 736, 772, 5, 198, 0, 0, 737, 772, 5, 201, 0, 0, 738, 772, 5, 220, 0, 0, 739, 772, 5, 53, 0, 0, 740, 772, 5, 54, 0, 0, 741, 772, 5, 55, 0, 0, 742, 772, 5, 56, 0, 0, 743, 772, 5, 243, 0, 0, 744, 772, 5, 15, 0, 0, 745, 772, 5, 223, 0, 0, 746, 772, 5, 57, 0, 0, 747, 772, 5, 58, 0, 0, 748, 772, 5, 59, 0, 0, 749, 772, 5, 60, 0, 0, 750, 772, 5, 61, 0, 0, 751, 752, 5, 62, 0, 0, 752, 772, 5, 51, 0, 0, 753, 754, 5, 62, 0, 0, 754, 772, 5, 52, 0, 0, 755, 756, 5, 62, 0, 0, 756, 772, 5, 63, 0, 0, 757, 758, 5, 62, 0, 0, 758, 772, 5, 64, 0, 0, 759, 760, 5, 62, 0, 0, 760, 772, 5, 65, 0, 0, 761, 762, 5, 62, 0, 0, 762, 772, 5, 66, 0, 0, 763, 772, 5, 67, 0, 0, 764, 772, 5, 68, 0, 0, 765, 772, 5, 69, 0, 0, 766, 767, 5, 70, 0, 0, 767, 768, 5, 30, 0, 0, 768, 769, 3, 32, 16, 0, 769, 770, 5, 31, 0, 0, 770, 772, 1, 0, 0, 0, 771, 734, 1, 0, 0, 0, 771, 735, 1, 0, 0, 0, 771, 736, 1, 0, 0, 0, 771, 737, 1, 0, 0, 0, 771, 738, 1, 0, 0, 0, 771, 739, 1, 0, 0, 0, 771, 740, 1, 0, 0, 0, 771, 741, 1, 0, 0, 0, 771, 742, 1, 0, 0, 0, 771, 743, 1, 0, 0, 0, 771, 744, 1, 0, 0, 0, 771, 745, 1, 0, 0, 0, 771, 746, 1, 0, 0, 0, 771, 747, 1, 0, 0, 0, 771, 748, 1, 0, 0, 0, 771, 749, 1, 0, 0, 0, 771, 750, 1, 0, 0, 0, 771, 751, 1, 0, 0, 0, 771, 753, 1, 0, 0, 0, 771, 755, 1, 0, 0, 0, 771, 757, 1, 0, 0, 0, 771, 759, 1, 0, 0, 0, 771, 761, 1, 0, 0, 0, 771, 763, 1, 0, 0, 0, 771, 764, 1, 0, 0, 0, 771, 765, 1, 0, 0, 0, 771, 766, 1, 0, 0, 0, 772, 77, 1, 0, 0, 0, 773, 777, 1, 0, 0, 0, 774, 775, 5, 71, 0, 0, 775, 777, 3, 146, 73, 0, 776, 773, 1, 0, 0, 0, 776, 774, 1, 0, 0, 0, 777, 79, 1, 0, 0, 0, 778, 782, 1, 0, 0, 0, 779, 780, 5, 72, 0, 0, 780, 782, 3, 84, 42, 0, 781, 778, 1, 0, 0, 0, 781, 779, 1, 0, 0, 0, 782, 81, 1, 0, 0, 0, 783, 785, 3, 220, 110, 0, 784, 783, 1, 0, 0, 0, 785, 788, 1, 0, 0, 0, 786, 784, 1, 0, 0, 0, 786, 787, 1, 0, 0, 0, 787, 83, 1, 0, 0, 0, 788, 786, 1, 0, 0, 0, 789, 790, 3, 146, 73, 0, 790, 791, 5, 28, 0, 0, 791, 793, 1, 0, 0, 0, 792, 789, 1, 0, 0, 0, 793, 796, 1, 0, 0, 0, 794, 792, 1, 0, 0, 0, 794, 795, 1, 0, 0, 0, 795, 797, 1, 0, 0, 0, 796, 794, 1, 0, 0, 0, 797, 798, 3, 146, 73, 0, 798, 85, 1, 0, 0, 0, 799, 800, 7, 4, 0, 0, 800, 87, 1, 0, 0, 0, 801, 802, 3, 86, 43, 0, 802, 803, 3, 32, 16, 0, 803, 804, 5, 263, 0, 0, 804, 873, 1, 0, 0, 0, 805, 806, 3, 86, 43, 0, 806, 807, 3, 32, 16, 0, 807, 873, 1, 0, 0, 0, 808, 809, 3, 86, 43, 0, 809, 810, 3, 32, 16, 0, 810, 811, 5, 75, 0, 0, 811, 812, 3, 32, 16, 0, 812, 813, 5, 263, 0, 0, 813, 873, 1, 0, 0, 0, 814, 815, 3, 86, 43, 0, 815, 816, 3, 32, 16, 0, 816, 817, 5, 75, 0, 0, 817, 818, 3, 32, 16, 0, 818, 873, 1, 0, 0, 0, 819, 820, 3, 86, 43, 0, 820, 821, 3, 32, 16, 0, 821, 822, 5, 75, 0, 0, 822, 823, 3, 32, 16, 0, 823, 824, 5, 28, 0, 0, 824, 825, 3, 32, 16, 0, 825, 826, 5, 263, 0, 0, 826, 873, 1, 0, 0, 0, 827, 828, 3, 86, 43, 0, 828, 829, 3, 32, 16, 0, 829, 830, 5, 75, 0, 0, 830, 831, 3, 32, 16, 0, 831, 832, 5, 28, 0, 0, 832, 833, 3, 32, 16, 0, 833, 873, 1, 0, 0, 0, 834, 835, 3, 86, 43, 0, 835, 836, 3, 32, 16, 0, 836, 837, 5, 28, 0, 0, 837, 838, 3, 32, 16, 0, 838, 839, 5, 75, 0, 0, 839, 840, 3, 32, 16, 0, 840, 841, 5, 263, 0, 0, 841, 873, 1, 0, 0, 0, 842, 843, 3, 86, 43, 0, 843, 844, 3, 32, 16, 0, 844, 845, 5, 28, 0, 0, 845, 846, 3, 32, 16, 0, 846, 847, 5, 75, 0, 0, 847, 848, 3, 32, 16, 0, 848, 873, 1, 0, 0, 0, 849, 850, 3, 86, 43, 0, 850, 851, 3, 32, 16, 0, 851, 852, 5, 28, 0, 0, 852, 853, 3, 32, 16, 0, 853, 854, 5, 75, 0, 0, 854, 855, 3, 32, 16, 0, 855, 856, 5, 28, 0, 0, 856, 857, 3, 32, 16, 0, 857, 858, 5, 263, 0, 0, 858, 873, 1, 0, 0, 0, 859, 860, 3, 86, 43, 0, 860, 861, 3, 32, 16, 0, 861, 862, 5, 28, 0, 0, 862, 863, 3, 32, 16, 0, 863, 864, 5, 75, 0, 0, 864, 865, 3, 32, 16, 0, 865, 866, 5, 28, 0, 0, 866, 867, 3, 32, 16, 0, 867, 873, 1, 0, 0, 0, 868, 869, 3, 86, 43, 0, 869, 870, 3, 32, 16, 0, 870, 871, 5, 262, 0, 0, 871, 873, 1, 0, 0, 0, 872, 801, 1, 0, 0, 0, 872, 805, 1, 0, 0, 0, 872, 808, 1, 0, 0, 0, 872, 814, 1, 0, 0, 0, 872, 819, 1, 0, 0, 0, 872, 827, 1, 0, 0, 0, 872, 834, 1, 0, 0, 0, 872, 842, 1, 0, 0, 0, 872, 849, 1, 0, 0, 0, 872, 859, 1, 0, 0, 0, 872, 868, 1, 0, 0, 0, 873, 89, 1, 0, 0, 0, 874, 878, 5, 21, 0, 0, 875, 877, 3, 92, 46, 0, 876, 875, 1, 0, 0, 0, 877, 880, 1, 0, 0, 0, 878, 876, 1, 0, 0, 0, 878, 879, 1, 0, 0, 0, 879, 881, 1, 0, 0, 0, 880, 878, 1, 0, 0, 0, 881, 882, 3, 2, 1, 0, 882, 883, 3, 94, 47, 0, 883, 884, 5, 179, 0, 0, 884, 885, 5, 36, 0, 0, 885, 886, 5, 30, 0, 0, 886, 887, 3, 312, 156, 0, 887, 888, 5, 31, 0, 0, 888, 889, 3, 94, 47, 0, 889, 901, 1, 0, 0, 0, 890, 894, 5, 21, 0, 0, 891, 893, 3, 92, 46, 0, 892, 891, 1, 0, 0, 0, 893, 896, 1, 0, 0, 0, 894, 892, 1, 0, 0, 0, 894, 895, 1, 0, 0, 0, 895, 897, 1, 0, 0, 0, 896, 894, 1, 0, 0, 0, 897, 898, 3, 2, 1, 0, 898, 899, 3, 94, 47, 0, 899, 901, 1, 0, 0, 0, 900, 874, 1, 0, 0, 0, 900, 890, 1, 0, 0, 0, 901, 91, 1, 0, 0, 0, 902, 903, 5, 76, 0, 0, 903, 93, 1, 0, 0, 0, 904, 907, 1, 0, 0, 0, 905, 907, 5, 297, 0, 0, 906, 904, 1, 0, 0, 0, 906, 905, 1, 0, 0, 0, 907, 95, 1, 0, 0, 0, 908, 909, 7, 5, 0, 0, 909, 97, 1, 0, 0, 0, 910, 912, 3, 96, 48, 0, 911, 910, 1, 0, 0, 0, 912, 915, 1, 0, 0, 0, 913, 911, 1, 0, 0, 0, 913, 914, 1, 0, 0, 0, 914, 99, 1, 0, 0, 0, 915, 913, 1, 0, 0, 0, 916, 917, 5, 274, 0, 0, 917, 101, 1, 0, 0, 0, 918, 919, 5, 275, 0, 0, 919, 103, 1, 0, 0, 0, 920, 921, 5, 276, 0, 0, 921, 105, 1, 0, 0, 0, 922, 923, 5, 277, 0, 0, 923, 107, 1, 0, 0, 0, 924, 925, 5, 278, 0, 0, 925, 109, 1, 0, 0, 0, 926, 927, 5, 281, 0, 0, 927, 111, 1, 0, 0, 0, 928, 929, 5, 279, 0, 0, 929, 113, 1, 0, 0, 0, 930, 931, 5, 285, 0, 0, 931, 115, 1, 0, 0, 0, 932, 933, 5, 283, 0, 0, 933, 117, 1, 0, 0, 0, 934, 935, 5, 284, 0, 0, 935, 119, 1, 0, 0, 0, 936, 937, 5, 280, 0, 0, 937, 121, 1, 0, 0, 0, 938, 939, 5, 286, 0, 0, 939, 123, 1, 0, 0, 0, 940, 941, 5, 282, 0, 0, 941, 125, 1, 0, 0, 0, 942, 1025, 3, 100, 50, 0, 943, 944, 3, 102, 51, 0, 944, 945, 3, 32, 16, 0, 945, 1025, 1, 0, 0, 0, 946, 947, 3, 102, 51, 0, 947, 948, 3, 0, 0, 0, 948, 1025, 1, 0, 0, 0, 949, 950, 3, 104, 52, 0, 950, 951, 3, 32, 16, 0, 951, 1025, 1, 0, 0, 0, 952, 953, 3, 106, 53, 0, 953, 954, 3, 34, 17, 0, 954, 1025, 1, 0, 0, 0, 955, 956, 3, 108, 54, 0, 956, 957, 3, 36, 18, 0, 957, 1025, 1, 0, 0, 0, 958, 959, 3, 108, 54, 0, 959, 960, 3, 34, 17, 0, 960, 1025, 1, 0, 0, 0, 961, 962, 3, 108, 54, 0, 962, 963, 5, 30, 0, 0, 963, 964, 3, 312, 156, 0, 964, 965, 5, 31, 0, 0, 965, 1025, 1, 0, 0, 0, 966, 967, 3, 108, 54, 0, 967, 968, 5, 84, 0, 0, 968, 969, 5, 30, 0, 0, 969, 970, 3, 312, 156, 0, 970, 971, 5, 31, 0, 0, 971, 1025, 1, 0, 0, 0, 972, 973, 3, 110, 55, 0, 973, 974, 3, 32, 16, 0, 974, 1025, 1, 0, 0, 0, 975, 976, 3, 110, 55, 0, 976, 977, 3, 0, 0, 0, 977, 1025, 1, 0, 0, 0, 978, 979, 3, 112, 56, 0, 979, 980, 3, 190, 95, 0, 980, 1025, 1, 0, 0, 0, 981, 982, 3, 114, 57, 0, 982, 983, 3, 200, 100, 0, 983, 1025, 1, 0, 0, 0, 984, 985, 3, 114, 57, 0, 985, 986, 3, 196, 98, 0, 986, 1025, 1, 0, 0, 0, 987, 988, 3, 116, 58, 0, 988, 989, 3, 146, 73, 0, 989, 1025, 1, 0, 0, 0, 990, 991, 3, 118, 59, 0, 991, 992, 3, 6, 3, 0, 992, 1025, 1, 0, 0, 0, 993, 994, 3, 118, 59, 0, 994, 995, 5, 223, 0, 0, 995, 996, 5, 30, 0, 0, 996, 997, 3, 6, 3, 0, 997, 998, 5, 31, 0, 0, 998, 1025, 1, 0, 0, 0, 999, 1000, 3, 118, 59, 0, 1000, 1001, 5, 84, 0, 0, 1001, 1002, 5, 30, 0, 0, 1002, 1003, 3, 312, 156, 0, 1003, 1004, 5, 31, 0, 0, 1004, 1025, 1, 0, 0, 0, 1005, 1006, 3, 120, 60, 0, 1006, 1007, 3, 192, 96, 0, 1007, 1008, 3, 160, 80, 0, 1008, 1009, 3, 134, 67, 0, 1009, 1025, 1, 0, 0, 0, 1010, 1011, 3, 122, 61, 0, 1011, 1012, 3, 50, 25, 0, 1012, 1025, 1, 0, 0, 0, 1013, 1014, 3, 122, 61, 0, 1014, 1015, 3, 32, 16, 0, 1015, 1025, 1, 0, 0, 0, 1016, 1017, 3, 124, 62, 0, 1017, 1018, 5, 30, 0, 0, 1018, 1019, 3, 128, 64, 0, 1019, 1020, 5, 31, 0, 0, 1020, 1025, 1, 0, 0, 0, 1021, 1022, 3, 124, 62, 0, 1022, 1023, 5, 85, 0, 0, 1023, 1025, 1, 0, 0, 0, 1024, 942, 1, 0, 0, 0, 1024, 943, 1, 0, 0, 0, 1024, 946, 1, 0, 0, 0, 1024, 949, 1, 0, 0, 0, 1024, 952, 1, 0, 0, 0, 1024, 955, 1, 0, 0, 0, 1024, 958, 1, 0, 0, 0, 1024, 961, 1, 0, 0, 0, 1024, 966, 1, 0, 0, 0, 1024, 972, 1, 0, 0, 0, 1024, 975, 1, 0, 0, 0, 1024, 978, 1, 0, 0, 0, 1024, 981, 1, 0, 0, 0, 1024, 984, 1, 0, 0, 0, 1024, 987, 1, 0, 0, 0, 1024, 990, 1, 0, 0, 0, 1024, 993, 1, 0, 0, 0, 1024, 999, 1, 0, 0, 0, 1024, 1005, 1, 0, 0, 0, 1024, 1010, 1, 0, 0, 0, 1024, 1013, 1, 0, 0, 0, 1024, 1016, 1, 0, 0, 0, 1024, 1021, 1, 0, 0, 0, 1025, 127, 1, 0, 0, 0, 1026, 1043, 1, 0, 0, 0, 1027, 1030, 3, 0, 0, 0, 1028, 1030, 3, 32, 16, 0, 1029, 1027, 1, 0, 0, 0, 1029, 1028, 1, 0, 0, 0, 1030, 1031, 1, 0, 0, 0, 1031, 1032, 5, 28, 0, 0, 1032, 1034, 1, 0, 0, 0, 1033, 1029, 1, 0, 0, 0, 1034, 1037, 1, 0, 0, 0, 1035, 1033, 1, 0, 0, 0, 1035, 1036, 1, 0, 0, 0, 1036, 1040, 1, 0, 0, 0, 1037, 1035, 1, 0, 0, 0, 1038, 1041, 3, 0, 0, 0, 1039, 1041, 3, 32, 16, 0, 1040, 1038, 1, 0, 0, 0, 1040, 1039, 1, 0, 0, 0, 1041, 1043, 1, 0, 0, 0, 1042, 1026, 1, 0, 0, 0, 1042, 1035, 1, 0, 0, 0, 1043, 129, 1, 0, 0, 0, 1044, 1050, 5, 86, 0, 0, 1045, 1046, 3, 160, 80, 0, 1046, 1047, 5, 28, 0, 0, 1047, 1049, 1, 0, 0, 0, 1048, 1045, 1, 0, 0, 0, 1049, 1052, 1, 0, 0, 0, 1050, 1048, 1, 0, 0, 0, 1050, 1051, 1, 0, 0, 0, 1051, 1053, 1, 0, 0, 0, 1052, 1050, 1, 0, 0, 0, 1053, 1054, 3, 160, 80, 0, 1054, 1055, 5, 87, 0, 0, 1055, 131, 1, 0, 0, 0, 1056, 1062, 5, 42, 0, 0, 1057, 1058, 3, 168, 84, 0, 1058, 1059, 5, 28, 0, 0, 1059, 1061, 1, 0, 0, 0, 1060, 1057, 1, 0, 0, 0, 1061, 1064, 1, 0, 0, 0, 1062, 1060, 1, 0, 0, 0, 1062, 1063, 1, 0, 0, 0, 1063, 1065, 1, 0, 0, 0, 1064, 1062, 1, 0, 0, 0, 1065, 1066, 3, 168, 84, 0, 1066, 1067, 5, 43, 0, 0, 1067, 133, 1, 0, 0, 0, 1068, 1074, 5, 30, 0, 0, 1069, 1070, 3, 136, 68, 0, 1070, 1071, 5, 28, 0, 0, 1071, 1073, 1, 0, 0, 0, 1072, 1069, 1, 0, 0, 0, 1073, 1076, 1, 0, 0, 0, 1074, 1072, 1, 0, 0, 0, 1074, 1075, 1, 0, 0, 0, 1075, 1077, 1, 0, 0, 0, 1076, 1074, 1, 0, 0, 0, 1077, 1078, 3, 136, 68, 0, 1078, 1079, 5, 31, 0, 0, 1079, 1082, 1, 0, 0, 0, 1080, 1082, 5, 85, 0, 0, 1081, 1068, 1, 0, 0, 0, 1081, 1080, 1, 0, 0, 0, 1082, 135, 1, 0, 0, 0, 1083, 1091, 5, 176, 0, 0, 1084, 1085, 3, 252, 126, 0, 1085, 1086, 3, 160, 80, 0, 1086, 1088, 3, 248, 124, 0, 1087, 1089, 3, 0, 0, 0, 1088, 1087, 1, 0, 0, 0, 1088, 1089, 1, 0, 0, 0, 1089, 1091, 1, 0, 0, 0, 1090, 1083, 1, 0, 0, 0, 1090, 1084, 1, 0, 0, 0, 1091, 137, 1, 0, 0, 0, 1092, 1093, 5, 42, 0, 0, 1093, 1094, 3, 2, 1, 0, 1094, 1095, 5, 43, 0, 0, 1095, 1096, 3, 140, 70, 0, 1096, 1118, 1, 0, 0, 0, 1097, 1098, 5, 42, 0, 0, 1098, 1099, 3, 196, 98, 0, 1099, 1100, 5, 43, 0, 0, 1100, 1101, 3, 140, 70, 0, 1101, 1118, 1, 0, 0, 0, 1102, 1103, 5, 42, 0, 0, 1103, 1104, 5, 261, 0, 0, 1104, 1105, 5, 43, 0, 0, 1105, 1118, 3, 140, 70, 0, 1106, 1107, 5, 42, 0, 0, 1107, 1108, 5, 197, 0, 0, 1108, 1109, 3, 2, 1, 0, 1109, 1110, 5, 43, 0, 0, 1110, 1111, 3, 140, 70, 0, 1111, 1118, 1, 0, 0, 0, 1112, 1118, 3, 140, 70, 0, 1113, 1118, 3, 196, 98, 0, 1114, 1118, 5, 256, 0, 0, 1115, 1118, 5, 257, 0, 0, 1116, 1118, 5, 258, 0, 0, 1117, 1092, 1, 0, 0, 0, 1117, 1097, 1, 0, 0, 0, 1117, 1102, 1, 0, 0, 0, 1117, 1106, 1, 0, 0, 0, 1117, 1112, 1, 0, 0, 0, 1117, 1113, 1, 0, 0, 0, 1117, 1114, 1, 0, 0, 0, 1117, 1115, 1, 0, 0, 0, 1117, 1116, 1, 0, 0, 0, 1118, 139, 1, 0, 0, 0, 1119, 1120, 3, 2, 1, 0, 1120, 1121, 5, 88, 0, 0, 1121, 1123, 1, 0, 0, 0, 1122, 1119, 1, 0, 0, 0, 1123, 1126, 1, 0, 0, 0, 1124, 1122, 1, 0, 0, 0, 1124, 1125, 1, 0, 0, 0, 1125, 1127, 1, 0, 0, 0, 1126, 1124, 1, 0, 0, 0, 1127, 1128, 3, 2, 1, 0, 1128, 141, 1, 0, 0, 0, 1129, 1131, 3, 144, 72, 0, 1130, 1129, 1, 0, 0, 0, 1131, 1134, 1, 0, 0, 0, 1132, 1130, 1, 0, 0, 0, 1132, 1133, 1, 0, 0, 0, 1133, 143, 1, 0, 0, 0, 1134, 1132, 1, 0, 0, 0, 1135, 1136, 5, 179, 0, 0, 1136, 1137, 5, 89, 0, 0, 1137, 1141, 3, 32, 16, 0, 1138, 1141, 3, 174, 87, 0, 1139, 1141, 3, 344, 172, 0, 1140, 1135, 1, 0, 0, 0, 1140, 1138, 1, 0, 0, 0, 1140, 1139, 1, 0, 0, 0, 1141, 145, 1, 0, 0, 0, 1142, 1154, 3, 138, 69, 0, 1143, 1144, 5, 42, 0, 0, 1144, 1145, 3, 2, 1, 0, 1145, 1146, 5, 43, 0, 0, 1146, 1154, 1, 0, 0, 0, 1147, 1148, 5, 42, 0, 0, 1148, 1149, 5, 197, 0, 0, 1149, 1150, 3, 2, 1, 0, 1150, 1151, 5, 43, 0, 0, 1151, 1154, 1, 0, 0, 0, 1152, 1154, 3, 160, 80, 0, 1153, 1142, 1, 0, 0, 0, 1153, 1143, 1, 0, 0, 0, 1153, 1147, 1, 0, 0, 0, 1153, 1152, 1, 0, 0, 0, 1154, 147, 1, 0, 0, 0, 1155, 1164, 1, 0, 0, 0, 1156, 1160, 3, 152, 76, 0, 1157, 1159, 3, 150, 75, 0, 1158, 1157, 1, 0, 0, 0, 1159, 1162, 1, 0, 0, 0, 1160, 1158, 1, 0, 0, 0, 1160, 1161, 1, 0, 0, 0, 1161, 1164, 1, 0, 0, 0, 1162, 1160, 1, 0, 0, 0, 1163, 1155, 1, 0, 0, 0, 1163, 1156, 1, 0, 0, 0, 1164, 149, 1, 0, 0, 0, 1165, 1183, 5, 261, 0, 0, 1166, 1183, 5, 260, 0, 0, 1167, 1168, 5, 42, 0, 0, 1168, 1169, 3, 32, 16, 0, 1169, 1170, 5, 43, 0, 0, 1170, 1183, 1, 0, 0, 0, 1171, 1172, 5, 42, 0, 0, 1172, 1173, 3, 32, 16, 0, 1173, 1174, 5, 265, 0, 0, 1174, 1175, 3, 32, 16, 0, 1175, 1176, 5, 43, 0, 0, 1176, 1183, 1, 0, 0, 0, 1177, 1178, 5, 42, 0, 0, 1178, 1179, 5, 265, 0, 0, 1179, 1180, 3, 32, 16, 0, 1180, 1181, 5, 43, 0, 0, 1181, 1183, 1, 0, 0, 0, 1182, 1165, 1, 0, 0, 0, 1182, 1166, 1, 0, 0, 0, 1182, 1167, 1, 0, 0, 0, 1182, 1171, 1, 0, 0, 0, 1182, 1177, 1, 0, 0, 0, 1183, 151, 1, 0, 0, 0, 1184, 1277, 1, 0, 0, 0, 1185, 1186, 5, 202, 0, 0, 1186, 1187, 5, 30, 0, 0, 1187, 1188, 3, 6, 3, 0, 1188, 1189, 5, 28, 0, 0, 1189, 1190, 3, 6, 3, 0, 1190, 1191, 5, 28, 0, 0, 1191, 1192, 3, 6, 3, 0, 1192, 1193, 5, 28, 0, 0, 1193, 1194, 3, 6, 3, 0, 1194, 1195, 5, 31, 0, 0, 1195, 1277, 1, 0, 0, 0, 1196, 1197, 5, 202, 0, 0, 1197, 1198, 5, 30, 0, 0, 1198, 1199, 3, 6, 3, 0, 1199, 1200, 5, 28, 0, 0, 1200, 1201, 3, 6, 3, 0, 1201, 1202, 5, 31, 0, 0, 1202, 1277, 1, 0, 0, 0, 1203, 1204, 5, 203, 0, 0, 1204, 1205, 5, 204, 0, 0, 1205, 1206, 5, 42, 0, 0, 1206, 1207, 3, 32, 16, 0, 1207, 1208, 5, 43, 0, 0, 1208, 1277, 1, 0, 0, 0, 1209, 1210, 5, 203, 0, 0, 1210, 1211, 5, 205, 0, 0, 1211, 1212, 5, 42, 0, 0, 1212, 1213, 3, 32, 16, 0, 1213, 1214, 5, 43, 0, 0, 1214, 1215, 3, 148, 74, 0, 1215, 1277, 1, 0, 0, 0, 1216, 1277, 5, 206, 0, 0, 1217, 1277, 5, 207, 0, 0, 1218, 1277, 5, 208, 0, 0, 1219, 1277, 5, 200, 0, 0, 1220, 1277, 5, 182, 0, 0, 1221, 1277, 5, 183, 0, 0, 1222, 1277, 5, 184, 0, 0, 1223, 1277, 5, 185, 0, 0, 1224, 1277, 5, 186, 0, 0, 1225, 1277, 5, 187, 0, 0, 1226, 1277, 5, 188, 0, 0, 1227, 1277, 5, 209, 0, 0, 1228, 1277, 5, 189, 0, 0, 1229, 1277, 5, 190, 0, 0, 1230, 1277, 5, 191, 0, 0, 1231, 1277, 5, 192, 0, 0, 1232, 1277, 5, 210, 0, 0, 1233, 1277, 5, 211, 0, 0, 1234, 1277, 5, 212, 0, 0, 1235, 1277, 5, 213, 0, 0, 1236, 1277, 5, 214, 0, 0, 1237, 1277, 5, 215, 0, 0, 1238, 1277, 5, 216, 0, 0, 1239, 1240, 5, 217, 0, 0, 1240, 1277, 3, 154, 77, 0, 1241, 1242, 5, 218, 0, 0, 1242, 1277, 3, 154, 77, 0, 1243, 1277, 5, 219, 0, 0, 1244, 1245, 5, 220, 0, 0, 1245, 1277, 3, 154, 77, 0, 1246, 1247, 5, 221, 0, 0, 1247, 1277, 3, 156, 78, 0, 1248, 1249, 5, 221, 0, 0, 1249, 1250, 3, 156, 78, 0, 1250, 1251, 5, 28, 0, 0, 1251, 1252, 3, 6, 3, 0, 1252, 1277, 1, 0, 0, 0, 1253, 1277, 5, 193, 0, 0, 1254, 1277, 5, 194, 0, 0, 1255, 1256, 5, 90, 0, 0, 1256, 1277, 5, 183, 0, 0, 1257, 1258, 5, 90, 0, 0, 1258, 1277, 5, 184, 0, 0, 1259, 1260, 5, 90, 0, 0, 1260, 1277, 5, 185, 0, 0, 1261, 1262, 5, 90, 0, 0, 1262, 1277, 5, 186, 0, 0, 1263, 1264, 5, 62, 0, 0, 1264, 1277, 5, 219, 0, 0, 1265, 1277, 5, 222, 0, 0, 1266, 1267, 5, 223, 0, 0, 1267, 1277, 5, 212, 0, 0, 1268, 1277, 5, 224, 0, 0, 1269, 1270, 5, 206, 0, 0, 1270, 1277, 5, 182, 0, 0, 1271, 1277, 5, 225, 0, 0, 1272, 1277, 5, 227, 0, 0, 1273, 1274, 5, 34, 0, 0, 1274, 1277, 5, 226, 0, 0, 1275, 1277, 3, 2, 1, 0, 1276, 1184, 1, 0, 0, 0, 1276, 1185, 1, 0, 0, 0, 1276, 1196, 1, 0, 0, 0, 1276, 1203, 1, 0, 0, 0, 1276, 1209, 1, 0, 0, 0, 1276, 1216, 1, 0, 0, 0, 1276, 1217, 1, 0, 0, 0, 1276, 1218, 1, 0, 0, 0, 1276, 1219, 1, 0, 0, 0, 1276, 1220, 1, 0, 0, 0, 1276, 1221, 1, 0, 0, 0, 1276, 1222, 1, 0, 0, 0, 1276, 1223, 1, 0, 0, 0, 1276, 1224, 1, 0, 0, 0, 1276, 1225, 1, 0, 0, 0, 1276, 1226, 1, 0, 0, 0, 1276, 1227, 1, 0, 0, 0, 1276, 1228, 1, 0, 0, 0, 1276, 1229, 1, 0, 0, 0, 1276, 1230, 1, 0, 0, 0, 1276, 1231, 1, 0, 0, 0, 1276, 1232, 1, 0, 0, 0, 1276, 1233, 1, 0, 0, 0, 1276, 1234, 1, 0, 0, 0, 1276, 1235, 1, 0, 0, 0, 1276, 1236, 1, 0, 0, 0, 1276, 1237, 1, 0, 0, 0, 1276, 1238, 1, 0, 0, 0, 1276, 1239, 1, 0, 0, 0, 1276, 1241, 1, 0, 0, 0, 1276, 1243, 1, 0, 0, 0, 1276, 1244, 1, 0, 0, 0, 1276, 1246, 1, 0, 0, 0, 1276, 1248, 1, 0, 0, 0, 1276, 1253, 1, 0, 0, 0, 1276, 1254, 1, 0, 0, 0, 1276, 1255, 1, 0, 0, 0, 1276, 1257, 1, 0, 0, 0, 1276, 1259, 1, 0, 0, 0, 1276, 1261, 1, 0, 0, 0, 1276, 1263, 1, 0, 0, 0, 1276, 1265, 1, 0, 0, 0, 1276, 1266, 1, 0, 0, 0, 1276, 1268, 1, 0, 0, 0, 1276, 1269, 1, 0, 0, 0, 1276, 1271, 1, 0, 0, 0, 1276, 1272, 1, 0, 0, 0, 1276, 1273, 1, 0, 0, 0, 1276, 1275, 1, 0, 0, 0, 1277, 153, 1, 0, 0, 0, 1278, 1286, 1, 0, 0, 0, 1279, 1280, 5, 30, 0, 0, 1280, 1281, 5, 91, 0, 0, 1281, 1282, 5, 36, 0, 0, 1282, 1283, 3, 32, 16, 0, 1283, 1284, 5, 31, 0, 0, 1284, 1286, 1, 0, 0, 0, 1285, 1278, 1, 0, 0, 0, 1285, 1279, 1, 0, 0, 0, 1286, 155, 1, 0, 0, 0, 1287, 1296, 1, 0, 0, 0, 1288, 1292, 3, 158, 79, 0, 1289, 1291, 7, 6, 0, 0, 1290, 1289, 1, 0, 0, 0, 1291, 1294, 1, 0, 0, 0, 1292, 1290, 1, 0, 0, 0, 1292, 1293, 1, 0, 0, 0, 1293, 1296, 1, 0, 0, 0, 1294, 1292, 1, 0, 0, 0, 1295, 1287, 1, 0, 0, 0, 1295, 1288, 1, 0, 0, 0, 1296, 157, 1, 0, 0, 0, 1297, 1298, 7, 7, 0, 0, 1298, 159, 1, 0, 0, 0, 1299, 1303, 3, 164, 82, 0, 1300, 1302, 3, 162, 81, 0, 1301, 1300, 1, 0, 0, 0, 1302, 1305, 1, 0, 0, 0, 1303, 1301, 1, 0, 0, 0, 1303, 1304, 1, 0, 0, 0, 1304, 161, 1, 0, 0, 0, 1305, 1303, 1, 0, 0, 0, 1306, 1325, 5, 260, 0, 0, 1307, 1308, 5, 42, 0, 0, 1308, 1325, 5, 43, 0, 0, 1309, 1325, 3, 132, 66, 0, 1310, 1325, 5, 259, 0, 0, 1311, 1325, 5, 261, 0, 0, 1312, 1325, 5, 92, 0, 0, 1313, 1314, 5, 93, 0, 0, 1314, 1315, 5, 30, 0, 0, 1315, 1316, 3, 146, 73, 0, 1316, 1317, 5, 31, 0, 0, 1317, 1325, 1, 0, 0, 0, 1318, 1319, 5, 94, 0, 0, 1319, 1320, 5, 30, 0, 0, 1320, 1321, 3, 146, 73, 0, 1321, 1322, 5, 31, 0, 0, 1322, 1325, 1, 0, 0, 0, 1323, 1325, 3, 130, 65, 0, 1324, 1306, 1, 0, 0, 0, 1324, 1307, 1, 0, 0, 0, 1324, 1309, 1, 0, 0, 0, 1324, 1310, 1, 0, 0, 0, 1324, 1311, 1, 0, 0, 0, 1324, 1312, 1, 0, 0, 0, 1324, 1313, 1, 0, 0, 0, 1324, 1318, 1, 0, 0, 0, 1324, 1323, 1, 0, 0, 0, 1325, 163, 1, 0, 0, 0, 1326, 1327, 5, 39, 0, 0, 1327, 1357, 3, 138, 69, 0, 1328, 1357, 5, 196, 0, 0, 1329, 1330, 5, 198, 0, 0, 1330, 1331, 5, 39, 0, 0, 1331, 1357, 3, 138, 69, 0, 1332, 1333, 5, 199, 0, 0, 1333, 1357, 3, 138, 69, 0, 1334, 1335, 5, 225, 0, 0, 1335, 1336, 3, 192, 96, 0, 1336, 1337, 3, 160, 80, 0, 1337, 1338, 5, 261, 0, 0, 1338, 1339, 3, 134, 67, 0, 1339, 1357, 1, 0, 0, 0, 1340, 1341, 5, 252, 0, 0, 1341, 1357, 3, 32, 16, 0, 1342, 1343, 5, 251, 0, 0, 1343, 1357, 3, 32, 16, 0, 1344, 1345, 5, 252, 0, 0, 1345, 1357, 3, 2, 1, 0, 1346, 1347, 5, 251, 0, 0, 1347, 1357, 3, 2, 1, 0, 1348, 1357, 5, 253, 0, 0, 1349, 1357, 5, 200, 0, 0, 1350, 1357, 3, 170, 85, 0, 1351, 1357, 3, 172, 86, 0, 1352, 1357, 3, 166, 83, 0, 1353, 1357, 3, 2, 1, 0, 1354, 1355, 5, 176, 0, 0, 1355, 1357, 3, 160, 80, 0, 1356, 1326, 1, 0, 0, 0, 1356, 1328, 1, 0, 0, 0, 1356, 1329, 1, 0, 0, 0, 1356, 1332, 1, 0, 0, 0, 1356, 1334, 1, 0, 0, 0, 1356, 1340, 1, 0, 0, 0, 1356, 1342, 1, 0, 0, 0, 1356, 1344, 1, 0, 0, 0, 1356, 1346, 1, 0, 0, 0, 1356, 1348, 1, 0, 0, 0, 1356, 1349, 1, 0, 0, 0, 1356, 1350, 1, 0, 0, 0, 1356, 1351, 1, 0, 0, 0, 1356, 1352, 1, 0, 0, 0, 1356, 1353, 1, 0, 0, 0, 1356, 1354, 1, 0, 0, 0, 1357, 165, 1, 0, 0, 0, 1358, 1380, 5, 180, 0, 0, 1359, 1380, 5, 181, 0, 0, 1360, 1380, 5, 182, 0, 0, 1361, 1380, 5, 183, 0, 0, 1362, 1380, 5, 184, 0, 0, 1363, 1380, 5, 185, 0, 0, 1364, 1380, 5, 186, 0, 0, 1365, 1380, 5, 187, 0, 0, 1366, 1380, 5, 188, 0, 0, 1367, 1380, 5, 189, 0, 0, 1368, 1380, 5, 190, 0, 0, 1369, 1380, 5, 191, 0, 0, 1370, 1380, 5, 192, 0, 0, 1371, 1372, 5, 90, 0, 0, 1372, 1380, 5, 183, 0, 0, 1373, 1374, 5, 90, 0, 0, 1374, 1380, 5, 184, 0, 0, 1375, 1376, 5, 90, 0, 0, 1376, 1380, 5, 185, 0, 0, 1377, 1378, 5, 90, 0, 0, 1378, 1380, 5, 186, 0, 0, 1379, 1358, 1, 0, 0, 0, 1379, 1359, 1, 0, 0, 0, 1379, 1360, 1, 0, 0, 0, 1379, 1361, 1, 0, 0, 0, 1379, 1362, 1, 0, 0, 0, 1379, 1363, 1, 0, 0, 0, 1379, 1364, 1, 0, 0, 0, 1379, 1365, 1, 0, 0, 0, 1379, 1366, 1, 0, 0, 0, 1379, 1367, 1, 0, 0, 0, 1379, 1368, 1, 0, 0, 0, 1379, 1369, 1, 0, 0, 0, 1379, 1370, 1, 0, 0, 0, 1379, 1371, 1, 0, 0, 0, 1379, 1373, 1, 0, 0, 0, 1379, 1375, 1, 0, 0, 0, 1379, 1377, 1, 0, 0, 0, 1380, 167, 1, 0, 0, 0, 1381, 1392, 1, 0, 0, 0, 1382, 1392, 5, 176, 0, 0, 1383, 1392, 3, 32, 16, 0, 1384, 1385, 3, 32, 16, 0, 1385, 1386, 5, 176, 0, 0, 1386, 1387, 3, 32, 16, 0, 1387, 1392, 1, 0, 0, 0, 1388, 1389, 3, 32, 16, 0, 1389, 1390, 5, 176, 0, 0, 1390, 1392, 1, 0, 0, 0, 1391, 1381, 1, 0, 0, 0, 1391, 1382, 1, 0, 0, 0, 1391, 1383, 1, 0, 0, 0, 1391, 1384, 1, 0, 0, 0, 1391, 1388, 1, 0, 0, 0, 1392, 169, 1, 0, 0, 0, 1393, 1394, 5, 1, 0, 0, 1394, 1395, 5, 193, 0, 0, 1395, 171, 1, 0, 0, 0, 1396, 1400, 5, 1, 0, 0, 1397, 1398, 5, 90, 0, 0, 1398, 1401, 5, 193, 0, 0, 1399, 1401, 5, 194, 0, 0, 1400, 1397, 1, 0, 0, 0, 1400, 1399, 1, 0, 0, 0, 1401, 173, 1, 0, 0, 0, 1402, 1403, 5, 293, 0, 0, 1403, 1404, 3, 188, 94, 0, 1404, 1405, 3, 146, 73, 0, 1405, 1406, 5, 30, 0, 0, 1406, 1407, 3, 180, 90, 0, 1407, 1408, 5, 31, 0, 0, 1408, 1450, 1, 0, 0, 0, 1409, 1410, 5, 293, 0, 0, 1410, 1411, 3, 188, 94, 0, 1411, 1412, 3, 146, 73, 0, 1412, 1413, 5, 36, 0, 0, 1413, 1414, 5, 17, 0, 0, 1414, 1415, 3, 52, 26, 0, 1415, 1416, 5, 18, 0, 0, 1416, 1450, 1, 0, 0, 0, 1417, 1418, 5, 293, 0, 0, 1418, 1419, 3, 188, 94, 0, 1419, 1420, 3, 146, 73, 0, 1420, 1450, 1, 0, 0, 0, 1421, 1422, 5, 294, 0, 0, 1422, 1423, 3, 188, 94, 0, 1423, 1425, 5, 36, 0, 0, 1424, 1426, 5, 84, 0, 0, 1425, 1424, 1, 0, 0, 0, 1425, 1426, 1, 0, 0, 0, 1426, 1427, 1, 0, 0, 0, 1427, 1428, 5, 30, 0, 0, 1428, 1429, 3, 312, 156, 0, 1429, 1430, 5, 31, 0, 0, 1430, 1450, 1, 0, 0, 0, 1431, 1432, 5, 294, 0, 0, 1432, 1433, 3, 188, 94, 0, 1433, 1434, 5, 84, 0, 0, 1434, 1435, 5, 30, 0, 0, 1435, 1436, 3, 312, 156, 0, 1436, 1437, 5, 31, 0, 0, 1437, 1450, 1, 0, 0, 0, 1438, 1439, 5, 294, 0, 0, 1439, 1440, 3, 188, 94, 0, 1440, 1441, 3, 6, 3, 0, 1441, 1450, 1, 0, 0, 0, 1442, 1443, 5, 294, 0, 0, 1443, 1444, 3, 188, 94, 0, 1444, 1445, 5, 36, 0, 0, 1445, 1446, 5, 17, 0, 0, 1446, 1447, 3, 176, 88, 0, 1447, 1448, 5, 18, 0, 0, 1448, 1450, 1, 0, 0, 0, 1449, 1402, 1, 0, 0, 0, 1449, 1409, 1, 0, 0, 0, 1449, 1417, 1, 0, 0, 0, 1449, 1421, 1, 0, 0, 0, 1449, 1431, 1, 0, 0, 0, 1449, 1438, 1, 0, 0, 0, 1449, 1442, 1, 0, 0, 0, 1450, 175, 1, 0, 0, 0, 1451, 1462, 1, 0, 0, 0, 1452, 1453, 3, 178, 89, 0, 1453, 1454, 5, 28, 0, 0, 1454, 1456, 1, 0, 0, 0, 1455, 1452, 1, 0, 0, 0, 1456, 1459, 1, 0, 0, 0, 1457, 1455, 1, 0, 0, 0, 1457, 1458, 1, 0, 0, 0, 1458, 1460, 1, 0, 0, 0, 1459, 1457, 1, 0, 0, 0, 1460, 1462, 3, 178, 89, 0, 1461, 1451, 1, 0, 0, 0, 1461, 1457, 1, 0, 0, 0, 1462, 177, 1, 0, 0, 0, 1463, 1464, 5, 39, 0, 0, 1464, 1465, 5, 263, 0, 0, 1465, 1466, 5, 36, 0, 0, 1466, 1467, 5, 17, 0, 0, 1467, 1468, 3, 56, 28, 0, 1468, 1469, 5, 18, 0, 0, 1469, 1477, 1, 0, 0, 0, 1470, 1471, 3, 146, 73, 0, 1471, 1472, 5, 36, 0, 0, 1472, 1473, 5, 17, 0, 0, 1473, 1474, 3, 56, 28, 0, 1474, 1475, 5, 18, 0, 0, 1475, 1477, 1, 0, 0, 0, 1476, 1463, 1, 0, 0, 0, 1476, 1470, 1, 0, 0, 0, 1477, 179, 1, 0, 0, 0, 1478, 1479, 3, 182, 91, 0, 1479, 1480, 5, 28, 0, 0, 1480, 1482, 1, 0, 0, 0, 1481, 1478, 1, 0, 0, 0, 1482, 1485, 1, 0, 0, 0, 1483, 1481, 1, 0, 0, 0, 1483, 1484, 1, 0, 0, 0, 1484, 1486, 1, 0, 0, 0, 1485, 1483, 1, 0, 0, 0, 1486, 1487, 3, 182, 91, 0, 1487, 181, 1, 0, 0, 0, 1488, 1489, 3, 6, 3, 0, 1489, 1490, 5, 36, 0, 0, 1490, 1491, 3, 186, 93, 0, 1491, 183, 1, 0, 0, 0, 1492, 1493, 7, 8, 0, 0, 1493, 185, 1, 0, 0, 0, 1494, 1529, 3, 184, 92, 0, 1495, 1529, 3, 32, 16, 0, 1496, 1497, 5, 185, 0, 0, 1497, 1498, 5, 30, 0, 0, 1498, 1499, 3, 32, 16, 0, 1499, 1500, 5, 31, 0, 0, 1500, 1529, 1, 0, 0, 0, 1501, 1529, 3, 6, 3, 0, 1502, 1503, 3, 138, 69, 0, 1503, 1504, 5, 30, 0, 0, 1504, 1505, 5, 183, 0, 0, 1505, 1506, 5, 75, 0, 0, 1506, 1507, 3, 32, 16, 0, 1507, 1508, 5, 31, 0, 0, 1508, 1529, 1, 0, 0, 0, 1509, 1510, 3, 138, 69, 0, 1510, 1511, 5, 30, 0, 0, 1511, 1512, 5, 184, 0, 0, 1512, 1513, 5, 75, 0, 0, 1513, 1514, 3, 32, 16, 0, 1514, 1515, 5, 31, 0, 0, 1515, 1529, 1, 0, 0, 0, 1516, 1517, 3, 138, 69, 0, 1517, 1518, 5, 30, 0, 0, 1518, 1519, 5, 185, 0, 0, 1519, 1520, 5, 75, 0, 0, 1520, 1521, 3, 32, 16, 0, 1521, 1522, 5, 31, 0, 0, 1522, 1529, 1, 0, 0, 0, 1523, 1524, 3, 138, 69, 0, 1524, 1525, 5, 30, 0, 0, 1525, 1526, 3, 32, 16, 0, 1526, 1527, 5, 31, 0, 0, 1527, 1529, 1, 0, 0, 0, 1528, 1494, 1, 0, 0, 0, 1528, 1495, 1, 0, 0, 0, 1528, 1496, 1, 0, 0, 0, 1528, 1501, 1, 0, 0, 0, 1528, 1502, 1, 0, 0, 0, 1528, 1509, 1, 0, 0, 0, 1528, 1516, 1, 0, 0, 0, 1528, 1523, 1, 0, 0, 0, 1529, 187, 1, 0, 0, 0, 1530, 1531, 7, 9, 0, 0, 1531, 189, 1, 0, 0, 0, 1532, 1533, 3, 192, 96, 0, 1533, 1534, 3, 160, 80, 0, 1534, 1535, 3, 146, 73, 0, 1535, 1536, 5, 175, 0, 0, 1536, 1538, 3, 264, 132, 0, 1537, 1539, 3, 130, 65, 0, 1538, 1537, 1, 0, 0, 0, 1538, 1539, 1, 0, 0, 0, 1539, 1540, 1, 0, 0, 0, 1540, 1541, 3, 134, 67, 0, 1541, 1567, 1, 0, 0, 0, 1542, 1543, 3, 192, 96, 0, 1543, 1544, 3, 160, 80, 0, 1544, 1545, 3, 146, 73, 0, 1545, 1546, 5, 175, 0, 0, 1546, 1547, 3, 264, 132, 0, 1547, 1548, 3, 218, 109, 0, 1548, 1549, 3, 134, 67, 0, 1549, 1567, 1, 0, 0, 0, 1550, 1551, 3, 192, 96, 0, 1551, 1552, 3, 160, 80, 0, 1552, 1554, 3, 264, 132, 0, 1553, 1555, 3, 130, 65, 0, 1554, 1553, 1, 0, 0, 0, 1554, 1555, 1, 0, 0, 0, 1555, 1556, 1, 0, 0, 0, 1556, 1557, 3, 134, 67, 0, 1557, 1567, 1, 0, 0, 0, 1558, 1559, 3, 192, 96, 0, 1559, 1560, 3, 160, 80, 0, 1560, 1561, 3, 264, 132, 0, 1561, 1562, 3, 218, 109, 0, 1562, 1563, 3, 134, 67, 0, 1563, 1567, 1, 0, 0, 0, 1564, 1567, 3, 196, 98, 0, 1565, 1567, 3, 2, 1, 0, 1566, 1532, 1, 0, 0, 0, 1566, 1542, 1, 0, 0, 0, 1566, 1550, 1, 0, 0, 0, 1566, 1558, 1, 0, 0, 0, 1566, 1564, 1, 0, 0, 0, 1566, 1565, 1, 0, 0, 0, 1567, 191, 1, 0, 0, 0, 1568, 1569, 5, 242, 0, 0, 1569, 1579, 3, 192, 96, 0, 1570, 1571, 5, 243, 0, 0, 1571, 1579, 3, 192, 96, 0, 1572, 1579, 3, 194, 97, 0, 1573, 1574, 5, 112, 0, 0, 1574, 1575, 5, 30, 0, 0, 1575, 1576, 3, 32, 16, 0, 1576, 1577, 5, 31, 0, 0, 1577, 1579, 1, 0, 0, 0, 1578, 1568, 1, 0, 0, 0, 1578, 1570, 1, 0, 0, 0, 1578, 1572, 1, 0, 0, 0, 1578, 1573, 1, 0, 0, 0, 1579, 193, 1, 0, 0, 0, 1580, 1593, 1, 0, 0, 0, 1581, 1593, 5, 244, 0, 0, 1582, 1593, 5, 245, 0, 0, 1583, 1584, 5, 246, 0, 0, 1584, 1593, 5, 247, 0, 0, 1585, 1586, 5, 246, 0, 0, 1586, 1593, 5, 248, 0, 0, 1587, 1588, 5, 246, 0, 0, 1588, 1593, 5, 249, 0, 0, 1589, 1590, 5, 246, 0, 0, 1590, 1593, 5, 250, 0, 0, 1591, 1593, 5, 246, 0, 0, 1592, 1580, 1, 0, 0, 0, 1592, 1581, 1, 0, 0, 0, 1592, 1582, 1, 0, 0, 0, 1592, 1583, 1, 0, 0, 0, 1592, 1585, 1, 0, 0, 0, 1592, 1587, 1, 0, 0, 0, 1592, 1589, 1, 0, 0, 0, 1592, 1591, 1, 0, 0, 0, 1593, 195, 1, 0, 0, 0, 1594, 1595, 5, 113, 0, 0, 1595, 1596, 5, 30, 0, 0, 1596, 1597, 3, 32, 16, 0, 1597, 1598, 5, 31, 0, 0, 1598, 197, 1, 0, 0, 0, 1599, 1600, 5, 225, 0, 0, 1600, 1605, 3, 190, 95, 0, 1601, 1602, 5, 37, 0, 0, 1602, 1605, 3, 200, 100, 0, 1603, 1605, 3, 196, 98, 0, 1604, 1599, 1, 0, 0, 0, 1604, 1601, 1, 0, 0, 0, 1604, 1603, 1, 0, 0, 0, 1605, 199, 1, 0, 0, 0, 1606, 1607, 3, 160, 80, 0, 1607, 1608, 3, 146, 73, 0, 1608, 1609, 5, 175, 0, 0, 1609, 1610, 3, 2, 1, 0, 1610, 1616, 1, 0, 0, 0, 1611, 1612, 3, 160, 80, 0, 1612, 1613, 3, 2, 1, 0, 1613, 1616, 1, 0, 0, 0, 1614, 1616, 3, 2, 1, 0, 1615, 1606, 1, 0, 0, 0, 1615, 1611, 1, 0, 0, 0, 1615, 1614, 1, 0, 0, 0, 1616, 201, 1, 0, 0, 0, 1617, 1618, 3, 146, 73, 0, 1618, 1619, 5, 28, 0, 0, 1619, 1621, 1, 0, 0, 0, 1620, 1617, 1, 0, 0, 0, 1621, 1624, 1, 0, 0, 0, 1622, 1620, 1, 0, 0, 0, 1622, 1623, 1, 0, 0, 0, 1623, 1625, 1, 0, 0, 0, 1624, 1622, 1, 0, 0, 0, 1625, 1626, 3, 146, 73, 0, 1626, 203, 1, 0, 0, 0, 1627, 1633, 1, 0, 0, 0, 1628, 1629, 5, 86, 0, 0, 1629, 1630, 3, 212, 106, 0, 1630, 1631, 5, 87, 0, 0, 1631, 1633, 1, 0, 0, 0, 1632, 1627, 1, 0, 0, 0, 1632, 1628, 1, 0, 0, 0, 1633, 205, 1, 0, 0, 0, 1634, 1646, 5, 265, 0, 0, 1635, 1646, 5, 114, 0, 0, 1636, 1646, 5, 39, 0, 0, 1637, 1646, 5, 199, 0, 0, 1638, 1646, 5, 115, 0, 0, 1639, 1646, 5, 116, 0, 0, 1640, 1641, 5, 70, 0, 0, 1641, 1642, 5, 30, 0, 0, 1642, 1643, 3, 32, 16, 0, 1643, 1644, 5, 31, 0, 0, 1644, 1646, 1, 0, 0, 0, 1645, 1634, 1, 0, 0, 0, 1645, 1635, 1, 0, 0, 0, 1645, 1636, 1, 0, 0, 0, 1645, 1637, 1, 0, 0, 0, 1645, 1638, 1, 0, 0, 0, 1645, 1639, 1, 0, 0, 0, 1645, 1640, 1, 0, 0, 0, 1646, 207, 1, 0, 0, 0, 1647, 1649, 3, 206, 103, 0, 1648, 1647, 1, 0, 0, 0, 1649, 1652, 1, 0, 0, 0, 1650, 1648, 1, 0, 0, 0, 1650, 1651, 1, 0, 0, 0, 1651, 209, 1, 0, 0, 0, 1652, 1650, 1, 0, 0, 0, 1653, 1655, 3, 208, 104, 0, 1654, 1656, 3, 214, 107, 0, 1655, 1654, 1, 0, 0, 0, 1655, 1656, 1, 0, 0, 0, 1656, 1657, 1, 0, 0, 0, 1657, 1658, 3, 2, 1, 0, 1658, 211, 1, 0, 0, 0, 1659, 1660, 3, 210, 105, 0, 1660, 1661, 5, 28, 0, 0, 1661, 1663, 1, 0, 0, 0, 1662, 1659, 1, 0, 0, 0, 1663, 1666, 1, 0, 0, 0, 1664, 1662, 1, 0, 0, 0, 1664, 1665, 1, 0, 0, 0, 1665, 1667, 1, 0, 0, 0, 1666, 1664, 1, 0, 0, 0, 1667, 1668, 3, 210, 105, 0, 1668, 213, 1, 0, 0, 0, 1669, 1670, 5, 30, 0, 0, 1670, 1671, 3, 202, 101, 0, 1671, 1672, 5, 31, 0, 0, 1672, 215, 1, 0, 0, 0, 1673, 1676, 1, 0, 0, 0, 1674, 1676, 3, 218, 109, 0, 1675, 1673, 1, 0, 0, 0, 1675, 1674, 1, 0, 0, 0, 1676, 217, 1, 0, 0, 0, 1677, 1678, 5, 86, 0, 0, 1678, 1679, 5, 42, 0, 0, 1679, 1680, 3, 32, 16, 0, 1680, 1681, 5, 43, 0, 0, 1681, 1682, 5, 87, 0, 0, 1682, 219, 1, 0, 0, 0, 1683, 1684, 3, 256, 128, 0, 1684, 1685, 5, 17, 0, 0, 1685, 1686, 3, 268, 134, 0, 1686, 1687, 5, 18, 0, 0, 1687, 1800, 1, 0, 0, 0, 1688, 1689, 3, 74, 37, 0, 1689, 1690, 5, 17, 0, 0, 1690, 1691, 3, 82, 41, 0, 1691, 1692, 5, 18, 0, 0, 1692, 1800, 1, 0, 0, 0, 1693, 1694, 3, 232, 116, 0, 1694, 1695, 5, 17, 0, 0, 1695, 1696, 3, 236, 118, 0, 1696, 1697, 5, 18, 0, 0, 1697, 1800, 1, 0, 0, 0, 1698, 1699, 3, 240, 120, 0, 1699, 1700, 5, 17, 0, 0, 1700, 1701, 3, 244, 122, 0, 1701, 1702, 5, 18, 0, 0, 1702, 1800, 1, 0, 0, 0, 1703, 1800, 3, 222, 111, 0, 1704, 1800, 3, 296, 148, 0, 1705, 1800, 3, 174, 87, 0, 1706, 1800, 3, 88, 44, 0, 1707, 1800, 3, 342, 171, 0, 1708, 1709, 5, 117, 0, 0, 1709, 1800, 3, 32, 16, 0, 1710, 1711, 5, 118, 0, 0, 1711, 1800, 3, 32, 16, 0, 1712, 1713, 3, 354, 177, 0, 1713, 1714, 5, 17, 0, 0, 1714, 1715, 3, 358, 179, 0, 1715, 1716, 5, 18, 0, 0, 1716, 1800, 1, 0, 0, 0, 1717, 1718, 5, 301, 0, 0, 1718, 1719, 3, 146, 73, 0, 1719, 1720, 5, 175, 0, 0, 1720, 1721, 3, 264, 132, 0, 1721, 1722, 5, 119, 0, 0, 1722, 1723, 3, 192, 96, 0, 1723, 1724, 3, 160, 80, 0, 1724, 1725, 3, 146, 73, 0, 1725, 1726, 5, 175, 0, 0, 1726, 1727, 3, 264, 132, 0, 1727, 1728, 3, 134, 67, 0, 1728, 1800, 1, 0, 0, 0, 1729, 1730, 5, 301, 0, 0, 1730, 1731, 5, 225, 0, 0, 1731, 1732, 3, 192, 96, 0, 1732, 1733, 3, 160, 80, 0, 1733, 1734, 3, 146, 73, 0, 1734, 1735, 5, 175, 0, 0, 1735, 1736, 3, 264, 132, 0, 1736, 1737, 3, 216, 108, 0, 1737, 1738, 3, 134, 67, 0, 1738, 1739, 5, 119, 0, 0, 1739, 1740, 5, 225, 0, 0, 1740, 1741, 3, 192, 96, 0, 1741, 1742, 3, 160, 80, 0, 1742, 1743, 3, 146, 73, 0, 1743, 1744, 5, 175, 0, 0, 1744, 1745, 3, 264, 132, 0, 1745, 1746, 3, 216, 108, 0, 1746, 1747, 3, 134, 67, 0, 1747, 1800, 1, 0, 0, 0, 1748, 1800, 3, 26, 13, 0, 1749, 1800, 3, 40, 20, 0, 1750, 1751, 5, 254, 0, 0, 1751, 1752, 5, 195, 0, 0, 1752, 1753, 5, 42, 0, 0, 1753, 1754, 3, 32, 16, 0, 1754, 1758, 5, 43, 0, 0, 1755, 1757, 3, 342, 171, 0, 1756, 1755, 1, 0, 0, 0, 1757, 1760, 1, 0, 0, 0, 1758, 1756, 1, 0, 0, 0, 1758, 1759, 1, 0, 0, 0, 1759, 1800, 1, 0, 0, 0, 1760, 1758, 1, 0, 0, 0, 1761, 1762, 5, 254, 0, 0, 1762, 1763, 5, 195, 0, 0, 1763, 1767, 3, 2, 1, 0, 1764, 1766, 3, 342, 171, 0, 1765, 1764, 1, 0, 0, 0, 1766, 1769, 1, 0, 0, 0, 1767, 1765, 1, 0, 0, 0, 1767, 1768, 1, 0, 0, 0, 1768, 1800, 1, 0, 0, 0, 1769, 1767, 1, 0, 0, 0, 1770, 1771, 5, 254, 0, 0, 1771, 1772, 5, 255, 0, 0, 1772, 1773, 5, 42, 0, 0, 1773, 1774, 3, 32, 16, 0, 1774, 1775, 5, 43, 0, 0, 1775, 1776, 5, 28, 0, 0, 1776, 1780, 3, 146, 73, 0, 1777, 1779, 3, 342, 171, 0, 1778, 1777, 1, 0, 0, 0, 1779, 1782, 1, 0, 0, 0, 1780, 1778, 1, 0, 0, 0, 1780, 1781, 1, 0, 0, 0, 1781, 1800, 1, 0, 0, 0, 1782, 1780, 1, 0, 0, 0, 1783, 1784, 5, 254, 0, 0, 1784, 1785, 5, 255, 0, 0, 1785, 1786, 3, 2, 1, 0, 1786, 1787, 5, 28, 0, 0, 1787, 1791, 3, 146, 73, 0, 1788, 1790, 3, 342, 171, 0, 1789, 1788, 1, 0, 0, 0, 1790, 1793, 1, 0, 0, 0, 1791, 1789, 1, 0, 0, 0, 1791, 1792, 1, 0, 0, 0, 1792, 1800, 1, 0, 0, 0, 1793, 1791, 1, 0, 0, 0, 1794, 1795, 5, 120, 0, 0, 1795, 1796, 5, 195, 0, 0, 1796, 1797, 3, 146, 73, 0, 1797, 1798, 3, 44, 22, 0, 1798, 1800, 1, 0, 0, 0, 1799, 1683, 1, 0, 0, 0, 1799, 1688, 1, 0, 0, 0, 1799, 1693, 1, 0, 0, 0, 1799, 1698, 1, 0, 0, 0, 1799, 1703, 1, 0, 0, 0, 1799, 1704, 1, 0, 0, 0, 1799, 1705, 1, 0, 0, 0, 1799, 1706, 1, 0, 0, 0, 1799, 1707, 1, 0, 0, 0, 1799, 1708, 1, 0, 0, 0, 1799, 1710, 1, 0, 0, 0, 1799, 1712, 1, 0, 0, 0, 1799, 1717, 1, 0, 0, 0, 1799, 1729, 1, 0, 0, 0, 1799, 1748, 1, 0, 0, 0, 1799, 1749, 1, 0, 0, 0, 1799, 1750, 1, 0, 0, 0, 1799, 1761, 1, 0, 0, 0, 1799, 1770, 1, 0, 0, 0, 1799, 1783, 1, 0, 0, 0, 1799, 1794, 1, 0, 0, 0, 1800, 221, 1, 0, 0, 0, 1801, 1802, 5, 121, 0, 0, 1802, 1811, 3, 230, 115, 0, 1803, 1810, 3, 224, 112, 0, 1804, 1805, 5, 122, 0, 0, 1805, 1806, 5, 30, 0, 0, 1806, 1807, 3, 250, 125, 0, 1807, 1808, 5, 31, 0, 0, 1808, 1810, 1, 0, 0, 0, 1809, 1803, 1, 0, 0, 0, 1809, 1804, 1, 0, 0, 0, 1810, 1813, 1, 0, 0, 0, 1811, 1809, 1, 0, 0, 0, 1811, 1812, 1, 0, 0, 0, 1812, 1814, 1, 0, 0, 0, 1813, 1811, 1, 0, 0, 0, 1814, 1815, 3, 160, 80, 0, 1815, 1816, 3, 2, 1, 0, 1816, 1817, 3, 226, 113, 0, 1817, 1818, 3, 228, 114, 0, 1818, 223, 1, 0, 0, 0, 1819, 1839, 5, 123, 0, 0, 1820, 1839, 5, 51, 0, 0, 1821, 1839, 5, 52, 0, 0, 1822, 1839, 5, 63, 0, 0, 1823, 1839, 5, 124, 0, 0, 1824, 1839, 5, 69, 0, 0, 1825, 1839, 5, 68, 0, 0, 1826, 1839, 5, 64, 0, 0, 1827, 1839, 5, 65, 0, 0, 1828, 1839, 5, 66, 0, 0, 1829, 1839, 5, 125, 0, 0, 1830, 1839, 5, 126, 0, 0, 1831, 1839, 5, 127, 0, 0, 1832, 1839, 5, 16, 0, 0, 1833, 1834, 5, 70, 0, 0, 1834, 1835, 5, 30, 0, 0, 1835, 1836, 3, 32, 16, 0, 1836, 1837, 5, 31, 0, 0, 1837, 1839, 1, 0, 0, 0, 1838, 1819, 1, 0, 0, 0, 1838, 1820, 1, 0, 0, 0, 1838, 1821, 1, 0, 0, 0, 1838, 1822, 1, 0, 0, 0, 1838, 1823, 1, 0, 0, 0, 1838, 1824, 1, 0, 0, 0, 1838, 1825, 1, 0, 0, 0, 1838, 1826, 1, 0, 0, 0, 1838, 1827, 1, 0, 0, 0, 1838, 1828, 1, 0, 0, 0, 1838, 1829, 1, 0, 0, 0, 1838, 1830, 1, 0, 0, 0, 1838, 1831, 1, 0, 0, 0, 1838, 1832, 1, 0, 0, 0, 1838, 1833, 1, 0, 0, 0, 1839, 225, 1, 0, 0, 0, 1840, 1846, 1, 0, 0, 0, 1841, 1842, 5, 44, 0, 0, 1842, 1846, 3, 0, 0, 0, 1843, 1844, 5, 44, 0, 0, 1844, 1846, 3, 32, 16, 0, 1845, 1840, 1, 0, 0, 0, 1845, 1841, 1, 0, 0, 0, 1845, 1843, 1, 0, 0, 0, 1846, 227, 1, 0, 0, 0, 1847, 1851, 1, 0, 0, 0, 1848, 1849, 5, 36, 0, 0, 1849, 1851, 3, 316, 158, 0, 1850, 1847, 1, 0, 0, 0, 1850, 1848, 1, 0, 0, 0, 1851, 229, 1, 0, 0, 0, 1852, 1858, 1, 0, 0, 0, 1853, 1854, 5, 42, 0, 0, 1854, 1855, 3, 32, 16, 0, 1855, 1856, 5, 43, 0, 0, 1856, 1858, 1, 0, 0, 0, 1857, 1852, 1, 0, 0, 0, 1857, 1853, 1, 0, 0, 0, 1858, 231, 1, 0, 0, 0, 1859, 1863, 5, 128, 0, 0, 1860, 1862, 3, 234, 117, 0, 1861, 1860, 1, 0, 0, 0, 1862, 1865, 1, 0, 0, 0, 1863, 1861, 1, 0, 0, 0, 1863, 1864, 1, 0, 0, 0, 1864, 1866, 1, 0, 0, 0, 1865, 1863, 1, 0, 0, 0, 1866, 1867, 3, 146, 73, 0, 1867, 1868, 3, 2, 1, 0, 1868, 1878, 1, 0, 0, 0, 1869, 1873, 5, 128, 0, 0, 1870, 1872, 3, 234, 117, 0, 1871, 1870, 1, 0, 0, 0, 1872, 1875, 1, 0, 0, 0, 1873, 1871, 1, 0, 0, 0, 1873, 1874, 1, 0, 0, 0, 1874, 1876, 1, 0, 0, 0, 1875, 1873, 1, 0, 0, 0, 1876, 1878, 3, 2, 1, 0, 1877, 1859, 1, 0, 0, 0, 1877, 1869, 1, 0, 0, 0, 1878, 233, 1, 0, 0, 0, 1879, 1880, 7, 10, 0, 0, 1880, 235, 1, 0, 0, 0, 1881, 1883, 3, 238, 119, 0, 1882, 1881, 1, 0, 0, 0, 1883, 1886, 1, 0, 0, 0, 1884, 1882, 1, 0, 0, 0, 1884, 1885, 1, 0, 0, 0, 1885, 237, 1, 0, 0, 0, 1886, 1884, 1, 0, 0, 0, 1887, 1888, 5, 129, 0, 0, 1888, 1900, 3, 190, 95, 0, 1889, 1890, 5, 130, 0, 0, 1890, 1900, 3, 190, 95, 0, 1891, 1892, 5, 131, 0, 0, 1892, 1900, 3, 190, 95, 0, 1893, 1894, 5, 132, 0, 0, 1894, 1900, 3, 190, 95, 0, 1895, 1900, 3, 88, 44, 0, 1896, 1900, 3, 342, 171, 0, 1897, 1900, 3, 26, 13, 0, 1898, 1900, 3, 40, 20, 0, 1899, 1887, 1, 0, 0, 0, 1899, 1889, 1, 0, 0, 0, 1899, 1891, 1, 0, 0, 0, 1899, 1893, 1, 0, 0, 0, 1899, 1895, 1, 0, 0, 0, 1899, 1896, 1, 0, 0, 0, 1899, 1897, 1, 0, 0, 0, 1899, 1898, 1, 0, 0, 0, 1900, 239, 1, 0, 0, 0, 1901, 1905, 5, 133, 0, 0, 1902, 1904, 3, 242, 121, 0, 1903, 1902, 1, 0, 0, 0, 1904, 1907, 1, 0, 0, 0, 1905, 1903, 1, 0, 0, 0, 1905, 1906, 1, 0, 0, 0, 1906, 1908, 1, 0, 0, 0, 1907, 1905, 1, 0, 0, 0, 1908, 1909, 3, 192, 96, 0, 1909, 1910, 3, 160, 80, 0, 1910, 1911, 3, 2, 1, 0, 1911, 1912, 3, 134, 67, 0, 1912, 1913, 3, 228, 114, 0, 1913, 241, 1, 0, 0, 0, 1914, 1915, 7, 10, 0, 0, 1915, 243, 1, 0, 0, 0, 1916, 1918, 3, 246, 123, 0, 1917, 1916, 1, 0, 0, 0, 1918, 1921, 1, 0, 0, 0, 1919, 1917, 1, 0, 0, 0, 1919, 1920, 1, 0, 0, 0, 1920, 245, 1, 0, 0, 0, 1921, 1919, 1, 0, 0, 0, 1922, 1923, 5, 134, 0, 0, 1923, 1933, 3, 190, 95, 0, 1924, 1925, 5, 135, 0, 0, 1925, 1933, 3, 190, 95, 0, 1926, 1927, 5, 132, 0, 0, 1927, 1933, 3, 190, 95, 0, 1928, 1933, 3, 342, 171, 0, 1929, 1933, 3, 88, 44, 0, 1930, 1933, 3, 26, 13, 0, 1931, 1933, 3, 40, 20, 0, 1932, 1922, 1, 0, 0, 0, 1932, 1924, 1, 0, 0, 0, 1932, 1926, 1, 0, 0, 0, 1932, 1928, 1, 0, 0, 0, 1932, 1929, 1, 0, 0, 0, 1932, 1930, 1, 0, 0, 0, 1932, 1931, 1, 0, 0, 0, 1933, 247, 1, 0, 0, 0, 1934, 1941, 1, 0, 0, 0, 1935, 1936, 5, 122, 0, 0, 1936, 1937, 5, 30, 0, 0, 1937, 1938, 3, 250, 125, 0, 1938, 1939, 5, 31, 0, 0, 1939, 1941, 1, 0, 0, 0, 1940, 1934, 1, 0, 0, 0, 1940, 1935, 1, 0, 0, 0, 1941, 249, 1, 0, 0, 0, 1942, 1952, 3, 148, 74, 0, 1943, 1945, 5, 17, 0, 0, 1944, 1946, 3, 314, 157, 0, 1945, 1944, 1, 0, 0, 0, 1946, 1947, 1, 0, 0, 0, 1947, 1945, 1, 0, 0, 0, 1947, 1948, 1, 0, 0, 0, 1948, 1949, 1, 0, 0, 0, 1949, 1950, 5, 18, 0, 0, 1950, 1952, 1, 0, 0, 0, 1951, 1942, 1, 0, 0, 0, 1951, 1943, 1, 0, 0, 0, 1952, 251, 1, 0, 0, 0, 1953, 1955, 3, 254, 127, 0, 1954, 1953, 1, 0, 0, 0, 1955, 1958, 1, 0, 0, 0, 1956, 1954, 1, 0, 0, 0, 1956, 1957, 1, 0, 0, 0, 1957, 253, 1, 0, 0, 0, 1958, 1956, 1, 0, 0, 0, 1959, 1960, 5, 42, 0, 0, 1960, 1961, 5, 136, 0, 0, 1961, 1973, 5, 43, 0, 0, 1962, 1963, 5, 42, 0, 0, 1963, 1964, 5, 137, 0, 0, 1964, 1973, 5, 43, 0, 0, 1965, 1966, 5, 42, 0, 0, 1966, 1967, 5, 138, 0, 0, 1967, 1973, 5, 43, 0, 0, 1968, 1969, 5, 42, 0, 0, 1969, 1970, 3, 32, 16, 0, 1970, 1971, 5, 43, 0, 0, 1971, 1973, 1, 0, 0, 0, 1972, 1959, 1, 0, 0, 0, 1972, 1962, 1, 0, 0, 0, 1972, 1965, 1, 0, 0, 0, 1972, 1968, 1, 0, 0, 0, 1973, 255, 1, 0, 0, 0, 1974, 1979, 5, 139, 0, 0, 1975, 1978, 3, 258, 129, 0, 1976, 1978, 3, 260, 130, 0, 1977, 1975, 1, 0, 0, 0, 1977, 1976, 1, 0, 0, 0, 1978, 1981, 1, 0, 0, 0, 1979, 1977, 1, 0, 0, 0, 1979, 1980, 1, 0, 0, 0, 1980, 1982, 1, 0, 0, 0, 1981, 1979, 1, 0, 0, 0, 1982, 1983, 3, 192, 96, 0, 1983, 1984, 3, 252, 126, 0, 1984, 1985, 3, 160, 80, 0, 1985, 1986, 3, 248, 124, 0, 1986, 1987, 3, 264, 132, 0, 1987, 1988, 3, 204, 102, 0, 1988, 1992, 3, 134, 67, 0, 1989, 1991, 3, 266, 133, 0, 1990, 1989, 1, 0, 0, 0, 1991, 1994, 1, 0, 0, 0, 1992, 1990, 1, 0, 0, 0, 1992, 1993, 1, 0, 0, 0, 1993, 257, 1, 0, 0, 0, 1994, 1992, 1, 0, 0, 0, 1995, 2019, 5, 123, 0, 0, 1996, 2019, 5, 51, 0, 0, 1997, 2019, 5, 52, 0, 0, 1998, 2019, 5, 63, 0, 0, 1999, 2019, 5, 140, 0, 0, 2000, 2019, 5, 68, 0, 0, 2001, 2019, 5, 141, 0, 0, 2002, 2019, 5, 142, 0, 0, 2003, 2019, 5, 54, 0, 0, 2004, 2019, 5, 64, 0, 0, 2005, 2019, 5, 65, 0, 0, 2006, 2019, 5, 66, 0, 0, 2007, 2019, 5, 125, 0, 0, 2008, 2019, 5, 143, 0, 0, 2009, 2019, 5, 144, 0, 0, 2010, 2019, 5, 69, 0, 0, 2011, 2019, 5, 145, 0, 0, 2012, 2019, 5, 146, 0, 0, 2013, 2014, 5, 70, 0, 0, 2014, 2015, 5, 30, 0, 0, 2015, 2016, 3, 32, 16, 0, 2016, 2017, 5, 31, 0, 0, 2017, 2019, 1, 0, 0, 0, 2018, 1995, 1, 0, 0, 0, 2018, 1996, 1, 0, 0, 0, 2018, 1997, 1, 0, 0, 0, 2018, 1998, 1, 0, 0, 0, 2018, 1999, 1, 0, 0, 0, 2018, 2000, 1, 0, 0, 0, 2018, 2001, 1, 0, 0, 0, 2018, 2002, 1, 0, 0, 0, 2018, 2003, 1, 0, 0, 0, 2018, 2004, 1, 0, 0, 0, 2018, 2005, 1, 0, 0, 0, 2018, 2006, 1, 0, 0, 0, 2018, 2007, 1, 0, 0, 0, 2018, 2008, 1, 0, 0, 0, 2018, 2009, 1, 0, 0, 0, 2018, 2010, 1, 0, 0, 0, 2018, 2011, 1, 0, 0, 0, 2018, 2012, 1, 0, 0, 0, 2018, 2013, 1, 0, 0, 0, 2019, 259, 1, 0, 0, 0, 2020, 2021, 5, 147, 0, 0, 2021, 2027, 5, 30, 0, 0, 2022, 2025, 3, 6, 3, 0, 2023, 2024, 5, 34, 0, 0, 2024, 2026, 3, 6, 3, 0, 2025, 2023, 1, 0, 0, 0, 2025, 2026, 1, 0, 0, 0, 2026, 2028, 1, 0, 0, 0, 2027, 2022, 1, 0, 0, 0, 2027, 2028, 1, 0, 0, 0, 2028, 2032, 1, 0, 0, 0, 2029, 2031, 3, 262, 131, 0, 2030, 2029, 1, 0, 0, 0, 2031, 2034, 1, 0, 0, 0, 2032, 2030, 1, 0, 0, 0, 2032, 2033, 1, 0, 0, 0, 2033, 2035, 1, 0, 0, 0, 2034, 2032, 1, 0, 0, 0, 2035, 2039, 5, 31, 0, 0, 2036, 2037, 5, 147, 0, 0, 2037, 2039, 5, 85, 0, 0, 2038, 2020, 1, 0, 0, 0, 2038, 2036, 1, 0, 0, 0, 2039, 261, 1, 0, 0, 0, 2040, 2068, 5, 148, 0, 0, 2041, 2068, 5, 223, 0, 0, 2042, 2068, 5, 57, 0, 0, 2043, 2068, 5, 58, 0, 0, 2044, 2068, 5, 149, 0, 0, 2045, 2068, 5, 150, 0, 0, 2046, 2068, 5, 247, 0, 0, 2047, 2068, 5, 248, 0, 0, 2048, 2068, 5, 249, 0, 0, 2049, 2068, 5, 250, 0, 0, 2050, 2051, 5, 151, 0, 0, 2051, 2052, 5, 75, 0, 0, 2052, 2068, 5, 152, 0, 0, 2053, 2054, 5, 151, 0, 0, 2054, 2055, 5, 75, 0, 0, 2055, 2068, 5, 153, 0, 0, 2056, 2057, 5, 154, 0, 0, 2057, 2058, 5, 75, 0, 0, 2058, 2068, 5, 152, 0, 0, 2059, 2060, 5, 154, 0, 0, 2060, 2061, 5, 75, 0, 0, 2061, 2068, 5, 153, 0, 0, 2062, 2063, 5, 70, 0, 0, 2063, 2064, 5, 30, 0, 0, 2064, 2065, 3, 32, 16, 0, 2065, 2066, 5, 31, 0, 0, 2066, 2068, 1, 0, 0, 0, 2067, 2040, 1, 0, 0, 0, 2067, 2041, 1, 0, 0, 0, 2067, 2042, 1, 0, 0, 0, 2067, 2043, 1, 0, 0, 0, 2067, 2044, 1, 0, 0, 0, 2067, 2045, 1, 0, 0, 0, 2067, 2046, 1, 0, 0, 0, 2067, 2047, 1, 0, 0, 0, 2067, 2048, 1, 0, 0, 0, 2067, 2049, 1, 0, 0, 0, 2067, 2050, 1, 0, 0, 0, 2067, 2053, 1, 0, 0, 0, 2067, 2056, 1, 0, 0, 0, 2067, 2059, 1, 0, 0, 0, 2067, 2062, 1, 0, 0, 0, 2068, 263, 1, 0, 0, 0, 2069, 2073, 5, 116, 0, 0, 2070, 2073, 5, 155, 0, 0, 2071, 2073, 3, 2, 1, 0, 2072, 2069, 1, 0, 0, 0, 2072, 2070, 1, 0, 0, 0, 2072, 2071, 1, 0, 0, 0, 2073, 265, 1, 0, 0, 0, 2074, 2096, 5, 1, 0, 0, 2075, 2096, 5, 2, 0, 0, 2076, 2096, 5, 156, 0, 0, 2077, 2096, 5, 3, 0, 0, 2078, 2096, 5, 4, 0, 0, 2079, 2096, 5, 246, 0, 0, 2080, 2096, 5, 5, 0, 0, 2081, 2096, 5, 6, 0, 0, 2082, 2096, 5, 7, 0, 0, 2083, 2096, 5, 8, 0, 0, 2084, 2096, 5, 9, 0, 0, 2085, 2096, 5, 10, 0, 0, 2086, 2096, 5, 11, 0, 0, 2087, 2096, 5, 12, 0, 0, 2088, 2096, 5, 13, 0, 0, 2089, 2096, 5, 14, 0, 0, 2090, 2091, 5, 70, 0, 0, 2091, 2092, 5, 30, 0, 0, 2092, 2093, 3, 32, 16, 0, 2093, 2094, 5, 31, 0, 0, 2094, 2096, 1, 0, 0, 0, 2095, 2074, 1, 0, 0, 0, 2095, 2075, 1, 0, 0, 0, 2095, 2076, 1, 0, 0, 0, 2095, 2077, 1, 0, 0, 0, 2095, 2078, 1, 0, 0, 0, 2095, 2079, 1, 0, 0, 0, 2095, 2080, 1, 0, 0, 0, 2095, 2081, 1, 0, 0, 0, 2095, 2082, 1, 0, 0, 0, 2095, 2083, 1, 0, 0, 0, 2095, 2084, 1, 0, 0, 0, 2095, 2085, 1, 0, 0, 0, 2095, 2086, 1, 0, 0, 0, 2095, 2087, 1, 0, 0, 0, 2095, 2088, 1, 0, 0, 0, 2095, 2089, 1, 0, 0, 0, 2095, 2090, 1, 0, 0, 0, 2096, 267, 1, 0, 0, 0, 2097, 2099, 3, 270, 135, 0, 2098, 2097, 1, 0, 0, 0, 2099, 2102, 1, 0, 0, 0, 2100, 2098, 1, 0, 0, 0, 2100, 2101, 1, 0, 0, 0, 2101, 269, 1, 0, 0, 0, 2102, 2100, 1, 0, 0, 0, 2103, 2212, 3, 126, 63, 0, 2104, 2105, 5, 295, 0, 0, 2105, 2212, 3, 32, 16, 0, 2106, 2212, 3, 278, 139, 0, 2107, 2108, 5, 296, 0, 0, 2108, 2212, 3, 32, 16, 0, 2109, 2110, 5, 299, 0, 0, 2110, 2212, 3, 134, 67, 0, 2111, 2112, 5, 299, 0, 0, 2112, 2113, 5, 157, 0, 0, 2113, 2212, 3, 134, 67, 0, 2114, 2212, 5, 297, 0, 0, 2115, 2212, 5, 298, 0, 0, 2116, 2212, 3, 296, 148, 0, 2117, 2212, 3, 272, 136, 0, 2118, 2212, 3, 174, 87, 0, 2119, 2212, 3, 88, 44, 0, 2120, 2212, 3, 26, 13, 0, 2121, 2212, 3, 274, 137, 0, 2122, 2212, 3, 40, 20, 0, 2123, 2124, 5, 300, 0, 0, 2124, 2125, 5, 42, 0, 0, 2125, 2126, 3, 32, 16, 0, 2126, 2127, 5, 43, 0, 0, 2127, 2212, 1, 0, 0, 0, 2128, 2129, 5, 300, 0, 0, 2129, 2130, 5, 42, 0, 0, 2130, 2131, 3, 32, 16, 0, 2131, 2132, 5, 43, 0, 0, 2132, 2133, 5, 34, 0, 0, 2133, 2134, 3, 0, 0, 0, 2134, 2212, 1, 0, 0, 0, 2135, 2136, 5, 302, 0, 0, 2136, 2137, 3, 32, 16, 0, 2137, 2138, 5, 75, 0, 0, 2138, 2139, 3, 32, 16, 0, 2139, 2212, 1, 0, 0, 0, 2140, 2141, 5, 301, 0, 0, 2141, 2142, 3, 146, 73, 0, 2142, 2143, 5, 175, 0, 0, 2143, 2144, 3, 264, 132, 0, 2144, 2212, 1, 0, 0, 0, 2145, 2146, 5, 301, 0, 0, 2146, 2147, 5, 225, 0, 0, 2147, 2148, 3, 192, 96, 0, 2148, 2149, 3, 160, 80, 0, 2149, 2150, 3, 146, 73, 0, 2150, 2151, 5, 175, 0, 0, 2151, 2152, 3, 264, 132, 0, 2152, 2153, 3, 216, 108, 0, 2153, 2154, 3, 134, 67, 0, 2154, 2212, 1, 0, 0, 0, 2155, 2212, 3, 276, 138, 0, 2156, 2157, 5, 254, 0, 0, 2157, 2158, 5, 195, 0, 0, 2158, 2159, 5, 42, 0, 0, 2159, 2160, 3, 32, 16, 0, 2160, 2164, 5, 43, 0, 0, 2161, 2163, 3, 342, 171, 0, 2162, 2161, 1, 0, 0, 0, 2163, 2166, 1, 0, 0, 0, 2164, 2162, 1, 0, 0, 0, 2164, 2165, 1, 0, 0, 0, 2165, 2212, 1, 0, 0, 0, 2166, 2164, 1, 0, 0, 0, 2167, 2168, 5, 254, 0, 0, 2168, 2169, 5, 195, 0, 0, 2169, 2173, 3, 2, 1, 0, 2170, 2172, 3, 342, 171, 0, 2171, 2170, 1, 0, 0, 0, 2172, 2175, 1, 0, 0, 0, 2173, 2171, 1, 0, 0, 0, 2173, 2174, 1, 0, 0, 0, 2174, 2212, 1, 0, 0, 0, 2175, 2173, 1, 0, 0, 0, 2176, 2177, 5, 254, 0, 0, 2177, 2178, 5, 255, 0, 0, 2178, 2179, 5, 42, 0, 0, 2179, 2180, 3, 32, 16, 0, 2180, 2181, 5, 43, 0, 0, 2181, 2182, 5, 28, 0, 0, 2182, 2186, 3, 146, 73, 0, 2183, 2185, 3, 342, 171, 0, 2184, 2183, 1, 0, 0, 0, 2185, 2188, 1, 0, 0, 0, 2186, 2184, 1, 0, 0, 0, 2186, 2187, 1, 0, 0, 0, 2187, 2212, 1, 0, 0, 0, 2188, 2186, 1, 0, 0, 0, 2189, 2190, 5, 254, 0, 0, 2190, 2191, 5, 255, 0, 0, 2191, 2192, 3, 2, 1, 0, 2192, 2193, 5, 28, 0, 0, 2193, 2197, 3, 146, 73, 0, 2194, 2196, 3, 342, 171, 0, 2195, 2194, 1, 0, 0, 0, 2196, 2199, 1, 0, 0, 0, 2197, 2195, 1, 0, 0, 0, 2197, 2198, 1, 0, 0, 0, 2198, 2212, 1, 0, 0, 0, 2199, 2197, 1, 0, 0, 0, 2200, 2201, 5, 254, 0, 0, 2201, 2202, 5, 42, 0, 0, 2202, 2203, 3, 32, 16, 0, 2203, 2204, 5, 43, 0, 0, 2204, 2208, 3, 228, 114, 0, 2205, 2207, 3, 342, 171, 0, 2206, 2205, 1, 0, 0, 0, 2207, 2210, 1, 0, 0, 0, 2208, 2206, 1, 0, 0, 0, 2208, 2209, 1, 0, 0, 0, 2209, 2212, 1, 0, 0, 0, 2210, 2208, 1, 0, 0, 0, 2211, 2103, 1, 0, 0, 0, 2211, 2104, 1, 0, 0, 0, 2211, 2106, 1, 0, 0, 0, 2211, 2107, 1, 0, 0, 0, 2211, 2109, 1, 0, 0, 0, 2211, 2111, 1, 0, 0, 0, 2211, 2114, 1, 0, 0, 0, 2211, 2115, 1, 0, 0, 0, 2211, 2116, 1, 0, 0, 0, 2211, 2117, 1, 0, 0, 0, 2211, 2118, 1, 0, 0, 0, 2211, 2119, 1, 0, 0, 0, 2211, 2120, 1, 0, 0, 0, 2211, 2121, 1, 0, 0, 0, 2211, 2122, 1, 0, 0, 0, 2211, 2123, 1, 0, 0, 0, 2211, 2128, 1, 0, 0, 0, 2211, 2135, 1, 0, 0, 0, 2211, 2140, 1, 0, 0, 0, 2211, 2145, 1, 0, 0, 0, 2211, 2155, 1, 0, 0, 0, 2211, 2156, 1, 0, 0, 0, 2211, 2167, 1, 0, 0, 0, 2211, 2176, 1, 0, 0, 0, 2211, 2189, 1, 0, 0, 0, 2211, 2200, 1, 0, 0, 0, 2212, 271, 1, 0, 0, 0, 2213, 2214, 3, 0, 0, 0, 2214, 2215, 5, 75, 0, 0, 2215, 273, 1, 0, 0, 0, 2216, 2219, 3, 44, 22, 0, 2217, 2219, 3, 46, 23, 0, 2218, 2216, 1, 0, 0, 0, 2218, 2217, 1, 0, 0, 0, 2219, 275, 1, 0, 0, 0, 2220, 2221, 5, 17, 0, 0, 2221, 2222, 3, 268, 134, 0, 2222, 2223, 5, 18, 0, 0, 2223, 277, 1, 0, 0, 0, 2224, 2225, 3, 282, 141, 0, 2225, 2226, 3, 280, 140, 0, 2226, 279, 1, 0, 0, 0, 2227, 2229, 3, 284, 142, 0, 2228, 2227, 1, 0, 0, 0, 2229, 2230, 1, 0, 0, 0, 2230, 2228, 1, 0, 0, 0, 2230, 2231, 1, 0, 0, 0, 2231, 281, 1, 0, 0, 0, 2232, 2233, 5, 158, 0, 0, 2233, 2245, 3, 276, 138, 0, 2234, 2235, 5, 158, 0, 0, 2235, 2236, 3, 0, 0, 0, 2236, 2237, 5, 159, 0, 0, 2237, 2238, 3, 0, 0, 0, 2238, 2245, 1, 0, 0, 0, 2239, 2240, 5, 158, 0, 0, 2240, 2241, 3, 32, 16, 0, 2241, 2242, 5, 159, 0, 0, 2242, 2243, 3, 32, 16, 0, 2243, 2245, 1, 0, 0, 0, 2244, 2232, 1, 0, 0, 0, 2244, 2234, 1, 0, 0, 0, 2244, 2239, 1, 0, 0, 0, 2245, 283, 1, 0, 0, 0, 2246, 2247, 3, 288, 144, 0, 2247, 2248, 3, 294, 147, 0, 2248, 2259, 1, 0, 0, 0, 2249, 2250, 3, 286, 143, 0, 2250, 2251, 3, 294, 147, 0, 2251, 2259, 1, 0, 0, 0, 2252, 2253, 3, 290, 145, 0, 2253, 2254, 3, 294, 147, 0, 2254, 2259, 1, 0, 0, 0, 2255, 2256, 3, 292, 146, 0, 2256, 2257, 3, 294, 147, 0, 2257, 2259, 1, 0, 0, 0, 2258, 2246, 1, 0, 0, 0, 2258, 2249, 1, 0, 0, 0, 2258, 2252, 1, 0, 0, 0, 2258, 2255, 1, 0, 0, 0, 2259, 285, 1, 0, 0, 0, 2260, 2261, 5, 160, 0, 0, 2261, 2267, 3, 276, 138, 0, 2262, 2263, 5, 160, 0, 0, 2263, 2267, 3, 0, 0, 0, 2264, 2265, 5, 160, 0, 0, 2265, 2267, 3, 32, 16, 0, 2266, 2260, 1, 0, 0, 0, 2266, 2262, 1, 0, 0, 0, 2266, 2264, 1, 0, 0, 0, 2267, 287, 1, 0, 0, 0, 2268, 2269, 5, 161, 0, 0, 2269, 2270, 3, 146, 73, 0, 2270, 289, 1, 0, 0, 0, 2271, 2272, 5, 162, 0, 0, 2272, 291, 1, 0, 0, 0, 2273, 2274, 5, 163, 0, 0, 2274, 293, 1, 0, 0, 0, 2275, 2287, 3, 276, 138, 0, 2276, 2277, 5, 164, 0, 0, 2277, 2278, 3, 0, 0, 0, 2278, 2279, 5, 159, 0, 0, 2279, 2280, 3, 0, 0, 0, 2280, 2287, 1, 0, 0, 0, 2281, 2282, 5, 164, 0, 0, 2282, 2283, 3, 32, 16, 0, 2283, 2284, 5, 159, 0, 0, 2284, 2285, 3, 32, 16, 0, 2285, 2287, 1, 0, 0, 0, 2286, 2275, 1, 0, 0, 0, 2286, 2276, 1, 0, 0, 0, 2286, 2281, 1, 0, 0, 0, 2287, 295, 1, 0, 0, 0, 2288, 2289, 3, 298, 149, 0, 2289, 2290, 3, 302, 151, 0, 2290, 297, 1, 0, 0, 0, 2291, 2292, 5, 165, 0, 0, 2292, 2293, 3, 300, 150, 0, 2293, 2294, 3, 0, 0, 0, 2294, 2295, 5, 36, 0, 0, 2295, 2299, 1, 0, 0, 0, 2296, 2297, 5, 165, 0, 0, 2297, 2299, 3, 300, 150, 0, 2298, 2291, 1, 0, 0, 0, 2298, 2296, 1, 0, 0, 0, 2299, 299, 1, 0, 0, 0, 2300, 2304, 1, 0, 0, 0, 2301, 2304, 5, 166, 0, 0, 2302, 2304, 5, 2, 0, 0, 2303, 2300, 1, 0, 0, 0, 2303, 2301, 1, 0, 0, 0, 2303, 2302, 1, 0, 0, 0, 2304, 301, 1, 0, 0, 0, 2305, 2306, 5, 17, 0, 0, 2306, 2307, 3, 304, 152, 0, 2307, 2308, 5, 18, 0, 0, 2308, 2315, 1, 0, 0, 0, 2309, 2311, 3, 308, 154, 0, 2310, 2309, 1, 0, 0, 0, 2311, 2312, 1, 0, 0, 0, 2312, 2310, 1, 0, 0, 0, 2312, 2313, 1, 0, 0, 0, 2313, 2315, 1, 0, 0, 0, 2314, 2305, 1, 0, 0, 0, 2314, 2310, 1, 0, 0, 0, 2315, 303, 1, 0, 0, 0, 2316, 2317, 3, 308, 154, 0, 2317, 2318, 5, 28, 0, 0, 2318, 2320, 1, 0, 0, 0, 2319, 2316, 1, 0, 0, 0, 2320, 2323, 1, 0, 0, 0, 2321, 2319, 1, 0, 0, 0, 2321, 2322, 1, 0, 0, 0, 2322, 2324, 1, 0, 0, 0, 2323, 2321, 1, 0, 0, 0, 2324, 2325, 3, 308, 154, 0, 2325, 305, 1, 0, 0, 0, 2326, 2332, 1, 0, 0, 0, 2327, 2328, 5, 42, 0, 0, 2328, 2329, 3, 32, 16, 0, 2329, 2330, 5, 43, 0, 0, 2330, 2332, 1, 0, 0, 0, 2331, 2326, 1, 0, 0, 0, 2331, 2327, 1, 0, 0, 0, 2332, 307, 1, 0, 0, 0, 2333, 2334, 5, 180, 0, 0, 2334, 2335, 5, 261, 0, 0, 2335, 2336, 5, 30, 0, 0, 2336, 2337, 3, 6, 3, 0, 2337, 2338, 5, 31, 0, 0, 2338, 2400, 1, 0, 0, 0, 2339, 2340, 5, 259, 0, 0, 2340, 2341, 5, 30, 0, 0, 2341, 2342, 3, 0, 0, 0, 2342, 2343, 5, 31, 0, 0, 2343, 2400, 1, 0, 0, 0, 2344, 2345, 5, 259, 0, 0, 2345, 2400, 3, 0, 0, 0, 2346, 2347, 5, 84, 0, 0, 2347, 2348, 5, 30, 0, 0, 2348, 2349, 3, 312, 156, 0, 2349, 2350, 5, 31, 0, 0, 2350, 2400, 1, 0, 0, 0, 2351, 2352, 5, 187, 0, 0, 2352, 2353, 5, 30, 0, 0, 2353, 2354, 3, 36, 18, 0, 2354, 2355, 5, 31, 0, 0, 2355, 2356, 3, 306, 153, 0, 2356, 2400, 1, 0, 0, 0, 2357, 2358, 5, 188, 0, 0, 2358, 2359, 5, 30, 0, 0, 2359, 2360, 3, 36, 18, 0, 2360, 2361, 5, 31, 0, 0, 2361, 2362, 3, 306, 153, 0, 2362, 2400, 1, 0, 0, 0, 2363, 2364, 5, 186, 0, 0, 2364, 2365, 5, 30, 0, 0, 2365, 2366, 3, 34, 17, 0, 2366, 2367, 5, 31, 0, 0, 2367, 2368, 3, 306, 153, 0, 2368, 2400, 1, 0, 0, 0, 2369, 2370, 5, 185, 0, 0, 2370, 2371, 5, 30, 0, 0, 2371, 2372, 3, 32, 16, 0, 2372, 2373, 5, 31, 0, 0, 2373, 2374, 3, 306, 153, 0, 2374, 2400, 1, 0, 0, 0, 2375, 2376, 5, 184, 0, 0, 2376, 2377, 5, 30, 0, 0, 2377, 2378, 3, 32, 16, 0, 2378, 2379, 5, 31, 0, 0, 2379, 2380, 3, 306, 153, 0, 2380, 2400, 1, 0, 0, 0, 2381, 2382, 5, 183, 0, 0, 2382, 2383, 5, 30, 0, 0, 2383, 2384, 3, 32, 16, 0, 2384, 2385, 5, 31, 0, 0, 2385, 2386, 3, 306, 153, 0, 2386, 2400, 1, 0, 0, 0, 2387, 2388, 5, 187, 0, 0, 2388, 2400, 3, 306, 153, 0, 2389, 2390, 5, 188, 0, 0, 2390, 2400, 3, 306, 153, 0, 2391, 2392, 5, 186, 0, 0, 2392, 2400, 3, 306, 153, 0, 2393, 2394, 5, 185, 0, 0, 2394, 2400, 3, 306, 153, 0, 2395, 2396, 5, 184, 0, 0, 2396, 2400, 3, 306, 153, 0, 2397, 2398, 5, 183, 0, 0, 2398, 2400, 3, 306, 153, 0, 2399, 2333, 1, 0, 0, 0, 2399, 2339, 1, 0, 0, 0, 2399, 2344, 1, 0, 0, 0, 2399, 2346, 1, 0, 0, 0, 2399, 2351, 1, 0, 0, 0, 2399, 2357, 1, 0, 0, 0, 2399, 2363, 1, 0, 0, 0, 2399, 2369, 1, 0, 0, 0, 2399, 2375, 1, 0, 0, 0, 2399, 2381, 1, 0, 0, 0, 2399, 2387, 1, 0, 0, 0, 2399, 2389, 1, 0, 0, 0, 2399, 2391, 1, 0, 0, 0, 2399, 2393, 1, 0, 0, 0, 2399, 2395, 1, 0, 0, 0, 2399, 2397, 1, 0, 0, 0, 2400, 309, 1, 0, 0, 0, 2401, 2402, 5, 187, 0, 0, 2402, 2403, 5, 30, 0, 0, 2403, 2404, 3, 36, 18, 0, 2404, 2405, 5, 31, 0, 0, 2405, 2477, 1, 0, 0, 0, 2406, 2407, 5, 188, 0, 0, 2407, 2408, 5, 30, 0, 0, 2408, 2409, 3, 36, 18, 0, 2409, 2410, 5, 31, 0, 0, 2410, 2477, 1, 0, 0, 0, 2411, 2412, 5, 187, 0, 0, 2412, 2413, 5, 30, 0, 0, 2413, 2414, 3, 32, 16, 0, 2414, 2415, 5, 31, 0, 0, 2415, 2477, 1, 0, 0, 0, 2416, 2417, 5, 188, 0, 0, 2417, 2418, 5, 30, 0, 0, 2418, 2419, 3, 34, 17, 0, 2419, 2420, 5, 31, 0, 0, 2420, 2477, 1, 0, 0, 0, 2421, 2422, 5, 186, 0, 0, 2422, 2423, 5, 30, 0, 0, 2423, 2424, 3, 34, 17, 0, 2424, 2425, 5, 31, 0, 0, 2425, 2477, 1, 0, 0, 0, 2426, 2427, 5, 185, 0, 0, 2427, 2428, 5, 30, 0, 0, 2428, 2429, 3, 32, 16, 0, 2429, 2430, 5, 31, 0, 0, 2430, 2477, 1, 0, 0, 0, 2431, 2432, 5, 184, 0, 0, 2432, 2433, 5, 30, 0, 0, 2433, 2434, 3, 32, 16, 0, 2434, 2435, 5, 31, 0, 0, 2435, 2477, 1, 0, 0, 0, 2436, 2437, 5, 183, 0, 0, 2437, 2438, 5, 30, 0, 0, 2438, 2439, 3, 32, 16, 0, 2439, 2440, 5, 31, 0, 0, 2440, 2477, 1, 0, 0, 0, 2441, 2442, 5, 192, 0, 0, 2442, 2443, 5, 30, 0, 0, 2443, 2444, 3, 34, 17, 0, 2444, 2445, 5, 31, 0, 0, 2445, 2477, 1, 0, 0, 0, 2446, 2447, 5, 191, 0, 0, 2447, 2448, 5, 30, 0, 0, 2448, 2449, 3, 32, 16, 0, 2449, 2450, 5, 31, 0, 0, 2450, 2477, 1, 0, 0, 0, 2451, 2452, 5, 190, 0, 0, 2452, 2453, 5, 30, 0, 0, 2453, 2454, 3, 32, 16, 0, 2454, 2455, 5, 31, 0, 0, 2455, 2477, 1, 0, 0, 0, 2456, 2457, 5, 189, 0, 0, 2457, 2458, 5, 30, 0, 0, 2458, 2459, 3, 32, 16, 0, 2459, 2460, 5, 31, 0, 0, 2460, 2477, 1, 0, 0, 0, 2461, 2462, 5, 180, 0, 0, 2462, 2463, 5, 30, 0, 0, 2463, 2464, 3, 32, 16, 0, 2464, 2465, 5, 31, 0, 0, 2465, 2477, 1, 0, 0, 0, 2466, 2467, 5, 182, 0, 0, 2467, 2468, 5, 30, 0, 0, 2468, 2469, 3, 184, 92, 0, 2469, 2470, 5, 31, 0, 0, 2470, 2477, 1, 0, 0, 0, 2471, 2472, 5, 84, 0, 0, 2472, 2473, 5, 30, 0, 0, 2473, 2474, 3, 312, 156, 0, 2474, 2475, 5, 31, 0, 0, 2475, 2477, 1, 0, 0, 0, 2476, 2401, 1, 0, 0, 0, 2476, 2406, 1, 0, 0, 0, 2476, 2411, 1, 0, 0, 0, 2476, 2416, 1, 0, 0, 0, 2476, 2421, 1, 0, 0, 0, 2476, 2426, 1, 0, 0, 0, 2476, 2431, 1, 0, 0, 0, 2476, 2436, 1, 0, 0, 0, 2476, 2441, 1, 0, 0, 0, 2476, 2446, 1, 0, 0, 0, 2476, 2451, 1, 0, 0, 0, 2476, 2456, 1, 0, 0, 0, 2476, 2461, 1, 0, 0, 0, 2476, 2466, 1, 0, 0, 0, 2476, 2471, 1, 0, 0, 0, 2477, 311, 1, 0, 0, 0, 2478, 2480, 3, 314, 157, 0, 2479, 2478, 1, 0, 0, 0, 2480, 2483, 1, 0, 0, 0, 2481, 2479, 1, 0, 0, 0, 2481, 2482, 1, 0, 0, 0, 2482, 313, 1, 0, 0, 0, 2483, 2481, 1, 0, 0, 0, 2484, 2485, 7, 11, 0, 0, 2485, 315, 1, 0, 0, 0, 2486, 2490, 3, 310, 155, 0, 2487, 2490, 3, 6, 3, 0, 2488, 2490, 5, 178, 0, 0, 2489, 2486, 1, 0, 0, 0, 2489, 2487, 1, 0, 0, 0, 2489, 2488, 1, 0, 0, 0, 2490, 317, 1, 0, 0, 0, 2491, 2640, 3, 310, 155, 0, 2492, 2493, 5, 181, 0, 0, 2493, 2494, 5, 30, 0, 0, 2494, 2495, 5, 178, 0, 0, 2495, 2640, 5, 31, 0, 0, 2496, 2497, 5, 181, 0, 0, 2497, 2498, 5, 30, 0, 0, 2498, 2499, 5, 263, 0, 0, 2499, 2640, 5, 31, 0, 0, 2500, 2501, 5, 195, 0, 0, 2501, 2502, 5, 30, 0, 0, 2502, 2503, 5, 39, 0, 0, 2503, 2504, 5, 263, 0, 0, 2504, 2640, 5, 31, 0, 0, 2505, 2506, 5, 195, 0, 0, 2506, 2507, 5, 30, 0, 0, 2507, 2508, 3, 138, 69, 0, 2508, 2509, 5, 31, 0, 0, 2509, 2640, 1, 0, 0, 0, 2510, 2511, 5, 195, 0, 0, 2511, 2512, 5, 30, 0, 0, 2512, 2513, 5, 178, 0, 0, 2513, 2640, 5, 31, 0, 0, 2514, 2515, 5, 196, 0, 0, 2515, 2516, 5, 30, 0, 0, 2516, 2517, 3, 318, 159, 0, 2517, 2518, 5, 31, 0, 0, 2518, 2640, 1, 0, 0, 0, 2519, 2520, 5, 187, 0, 0, 2520, 2521, 5, 42, 0, 0, 2521, 2522, 3, 32, 16, 0, 2522, 2523, 5, 43, 0, 0, 2523, 2524, 5, 30, 0, 0, 2524, 2525, 3, 320, 160, 0, 2525, 2526, 5, 31, 0, 0, 2526, 2640, 1, 0, 0, 0, 2527, 2528, 5, 188, 0, 0, 2528, 2529, 5, 42, 0, 0, 2529, 2530, 3, 32, 16, 0, 2530, 2531, 5, 43, 0, 0, 2531, 2532, 5, 30, 0, 0, 2532, 2533, 3, 322, 161, 0, 2533, 2534, 5, 31, 0, 0, 2534, 2640, 1, 0, 0, 0, 2535, 2536, 5, 186, 0, 0, 2536, 2537, 5, 42, 0, 0, 2537, 2538, 3, 32, 16, 0, 2538, 2539, 5, 43, 0, 0, 2539, 2540, 5, 30, 0, 0, 2540, 2541, 3, 324, 162, 0, 2541, 2542, 5, 31, 0, 0, 2542, 2640, 1, 0, 0, 0, 2543, 2544, 5, 185, 0, 0, 2544, 2545, 5, 42, 0, 0, 2545, 2546, 3, 32, 16, 0, 2546, 2547, 5, 43, 0, 0, 2547, 2548, 5, 30, 0, 0, 2548, 2549, 3, 326, 163, 0, 2549, 2550, 5, 31, 0, 0, 2550, 2640, 1, 0, 0, 0, 2551, 2552, 5, 184, 0, 0, 2552, 2553, 5, 42, 0, 0, 2553, 2554, 3, 32, 16, 0, 2554, 2555, 5, 43, 0, 0, 2555, 2556, 5, 30, 0, 0, 2556, 2557, 3, 328, 164, 0, 2557, 2558, 5, 31, 0, 0, 2558, 2640, 1, 0, 0, 0, 2559, 2560, 5, 183, 0, 0, 2560, 2561, 5, 42, 0, 0, 2561, 2562, 3, 32, 16, 0, 2562, 2563, 5, 43, 0, 0, 2563, 2564, 5, 30, 0, 0, 2564, 2565, 3, 330, 165, 0, 2565, 2566, 5, 31, 0, 0, 2566, 2640, 1, 0, 0, 0, 2567, 2568, 5, 192, 0, 0, 2568, 2569, 5, 42, 0, 0, 2569, 2570, 3, 32, 16, 0, 2570, 2571, 5, 43, 0, 0, 2571, 2572, 5, 30, 0, 0, 2572, 2573, 3, 324, 162, 0, 2573, 2574, 5, 31, 0, 0, 2574, 2640, 1, 0, 0, 0, 2575, 2576, 5, 191, 0, 0, 2576, 2577, 5, 42, 0, 0, 2577, 2578, 3, 32, 16, 0, 2578, 2579, 5, 43, 0, 0, 2579, 2580, 5, 30, 0, 0, 2580, 2581, 3, 326, 163, 0, 2581, 2582, 5, 31, 0, 0, 2582, 2640, 1, 0, 0, 0, 2583, 2584, 5, 190, 0, 0, 2584, 2585, 5, 42, 0, 0, 2585, 2586, 3, 32, 16, 0, 2586, 2587, 5, 43, 0, 0, 2587, 2588, 5, 30, 0, 0, 2588, 2589, 3, 328, 164, 0, 2589, 2590, 5, 31, 0, 0, 2590, 2640, 1, 0, 0, 0, 2591, 2592, 5, 189, 0, 0, 2592, 2593, 5, 42, 0, 0, 2593, 2594, 3, 32, 16, 0, 2594, 2595, 5, 43, 0, 0, 2595, 2596, 5, 30, 0, 0, 2596, 2597, 3, 330, 165, 0, 2597, 2598, 5, 31, 0, 0, 2598, 2640, 1, 0, 0, 0, 2599, 2600, 5, 180, 0, 0, 2600, 2601, 5, 42, 0, 0, 2601, 2602, 3, 32, 16, 0, 2602, 2603, 5, 43, 0, 0, 2603, 2604, 5, 30, 0, 0, 2604, 2605, 3, 328, 164, 0, 2605, 2606, 5, 31, 0, 0, 2606, 2640, 1, 0, 0, 0, 2607, 2608, 5, 182, 0, 0, 2608, 2609, 5, 42, 0, 0, 2609, 2610, 3, 32, 16, 0, 2610, 2611, 5, 43, 0, 0, 2611, 2612, 5, 30, 0, 0, 2612, 2613, 3, 332, 166, 0, 2613, 2614, 5, 31, 0, 0, 2614, 2640, 1, 0, 0, 0, 2615, 2616, 5, 181, 0, 0, 2616, 2617, 5, 42, 0, 0, 2617, 2618, 3, 32, 16, 0, 2618, 2619, 5, 43, 0, 0, 2619, 2620, 5, 30, 0, 0, 2620, 2621, 3, 334, 167, 0, 2621, 2622, 5, 31, 0, 0, 2622, 2640, 1, 0, 0, 0, 2623, 2624, 5, 195, 0, 0, 2624, 2625, 5, 42, 0, 0, 2625, 2626, 3, 32, 16, 0, 2626, 2627, 5, 43, 0, 0, 2627, 2628, 5, 30, 0, 0, 2628, 2629, 3, 336, 168, 0, 2629, 2630, 5, 31, 0, 0, 2630, 2640, 1, 0, 0, 0, 2631, 2632, 5, 196, 0, 0, 2632, 2633, 5, 42, 0, 0, 2633, 2634, 3, 32, 16, 0, 2634, 2635, 5, 43, 0, 0, 2635, 2636, 5, 30, 0, 0, 2636, 2637, 3, 340, 170, 0, 2637, 2638, 5, 31, 0, 0, 2638, 2640, 1, 0, 0, 0, 2639, 2491, 1, 0, 0, 0, 2639, 2492, 1, 0, 0, 0, 2639, 2496, 1, 0, 0, 0, 2639, 2500, 1, 0, 0, 0, 2639, 2505, 1, 0, 0, 0, 2639, 2510, 1, 0, 0, 0, 2639, 2514, 1, 0, 0, 0, 2639, 2519, 1, 0, 0, 0, 2639, 2527, 1, 0, 0, 0, 2639, 2535, 1, 0, 0, 0, 2639, 2543, 1, 0, 0, 0, 2639, 2551, 1, 0, 0, 0, 2639, 2559, 1, 0, 0, 0, 2639, 2567, 1, 0, 0, 0, 2639, 2575, 1, 0, 0, 0, 2639, 2583, 1, 0, 0, 0, 2639, 2591, 1, 0, 0, 0, 2639, 2599, 1, 0, 0, 0, 2639, 2607, 1, 0, 0, 0, 2639, 2615, 1, 0, 0, 0, 2639, 2623, 1, 0, 0, 0, 2639, 2631, 1, 0, 0, 0, 2640, 319, 1, 0, 0, 0, 2641, 2644, 3, 36, 18, 0, 2642, 2644, 3, 32, 16, 0, 2643, 2641, 1, 0, 0, 0, 2643, 2642, 1, 0, 0, 0, 2644, 2647, 1, 0, 0, 0, 2645, 2643, 1, 0, 0, 0, 2645, 2646, 1, 0, 0, 0, 2646, 321, 1, 0, 0, 0, 2647, 2645, 1, 0, 0, 0, 2648, 2651, 3, 36, 18, 0, 2649, 2651, 3, 34, 17, 0, 2650, 2648, 1, 0, 0, 0, 2650, 2649, 1, 0, 0, 0, 2651, 2654, 1, 0, 0, 0, 2652, 2650, 1, 0, 0, 0, 2652, 2653, 1, 0, 0, 0, 2653, 323, 1, 0, 0, 0, 2654, 2652, 1, 0, 0, 0, 2655, 2657, 3, 34, 17, 0, 2656, 2655, 1, 0, 0, 0, 2657, 2660, 1, 0, 0, 0, 2658, 2656, 1, 0, 0, 0, 2658, 2659, 1, 0, 0, 0, 2659, 325, 1, 0, 0, 0, 2660, 2658, 1, 0, 0, 0, 2661, 2663, 3, 32, 16, 0, 2662, 2661, 1, 0, 0, 0, 2663, 2666, 1, 0, 0, 0, 2664, 2662, 1, 0, 0, 0, 2664, 2665, 1, 0, 0, 0, 2665, 327, 1, 0, 0, 0, 2666, 2664, 1, 0, 0, 0, 2667, 2669, 3, 32, 16, 0, 2668, 2667, 1, 0, 0, 0, 2669, 2672, 1, 0, 0, 0, 2670, 2668, 1, 0, 0, 0, 2670, 2671, 1, 0, 0, 0, 2671, 329, 1, 0, 0, 0, 2672, 2670, 1, 0, 0, 0, 2673, 2675, 3, 32, 16, 0, 2674, 2673, 1, 0, 0, 0, 2675, 2678, 1, 0, 0, 0, 2676, 2674, 1, 0, 0, 0, 2676, 2677, 1, 0, 0, 0, 2677, 331, 1, 0, 0, 0, 2678, 2676, 1, 0, 0, 0, 2679, 2681, 3, 184, 92, 0, 2680, 2679, 1, 0, 0, 0, 2681, 2684, 1, 0, 0, 0, 2682, 2680, 1, 0, 0, 0, 2682, 2683, 1, 0, 0, 0, 2683, 333, 1, 0, 0, 0, 2684, 2682, 1, 0, 0, 0, 2685, 2687, 7, 12, 0, 0, 2686, 2685, 1, 0, 0, 0, 2687, 2690, 1, 0, 0, 0, 2688, 2686, 1, 0, 0, 0, 2688, 2689, 1, 0, 0, 0, 2689, 335, 1, 0, 0, 0, 2690, 2688, 1, 0, 0, 0, 2691, 2693, 3, 338, 169, 0, 2692, 2691, 1, 0, 0, 0, 2693, 2696, 1, 0, 0, 0, 2694, 2692, 1, 0, 0, 0, 2694, 2695, 1, 0, 0, 0, 2695, 337, 1, 0, 0, 0, 2696, 2694, 1, 0, 0, 0, 2697, 2702, 5, 178, 0, 0, 2698, 2699, 5, 39, 0, 0, 2699, 2702, 5, 263, 0, 0, 2700, 2702, 3, 138, 69, 0, 2701, 2697, 1, 0, 0, 0, 2701, 2698, 1, 0, 0, 0, 2701, 2700, 1, 0, 0, 0, 2702, 339, 1, 0, 0, 0, 2703, 2705, 3, 318, 159, 0, 2704, 2703, 1, 0, 0, 0, 2705, 2708, 1, 0, 0, 0, 2706, 2704, 1, 0, 0, 0, 2706, 2707, 1, 0, 0, 0, 2707, 341, 1, 0, 0, 0, 2708, 2706, 1, 0, 0, 0, 2709, 2713, 3, 44, 22, 0, 2710, 2713, 3, 46, 23, 0, 2711, 2713, 3, 2, 1, 0, 2712, 2709, 1, 0, 0, 0, 2712, 2710, 1, 0, 0, 0, 2712, 2711, 1, 0, 0, 0, 2713, 343, 1, 0, 0, 0, 2714, 2715, 5, 167, 0, 0, 2715, 2716, 5, 36, 0, 0, 2716, 2717, 5, 30, 0, 0, 2717, 2718, 3, 312, 156, 0, 2718, 2719, 5, 31, 0, 0, 2719, 2740, 1, 0, 0, 0, 2720, 2721, 5, 168, 0, 0, 2721, 2722, 3, 38, 19, 0, 2722, 2723, 5, 75, 0, 0, 2723, 2724, 3, 38, 19, 0, 2724, 2725, 5, 75, 0, 0, 2725, 2726, 3, 38, 19, 0, 2726, 2727, 5, 75, 0, 0, 2727, 2728, 3, 38, 19, 0, 2728, 2740, 1, 0, 0, 0, 2729, 2730, 5, 169, 0, 0, 2730, 2740, 3, 6, 3, 0, 2731, 2732, 5, 169, 0, 0, 2732, 2733, 5, 36, 0, 0, 2733, 2734, 5, 30, 0, 0, 2734, 2735, 3, 312, 156, 0, 2735, 2736, 5, 31, 0, 0, 2736, 2740, 1, 0, 0, 0, 2737, 2740, 3, 342, 171, 0, 2738, 2740, 3, 40, 20, 0, 2739, 2714, 1, 0, 0, 0, 2739, 2720, 1, 0, 0, 0, 2739, 2729, 1, 0, 0, 0, 2739, 2731, 1, 0, 0, 0, 2739, 2737, 1, 0, 0, 0, 2739, 2738, 1, 0, 0, 0, 2740, 345, 1, 0, 0, 0, 2741, 2742, 5, 25, 0, 0, 2742, 2743, 5, 40, 0, 0, 2743, 2744, 3, 98, 49, 0, 2744, 2745, 3, 2, 1, 0, 2745, 2754, 1, 0, 0, 0, 2746, 2747, 5, 25, 0, 0, 2747, 2748, 5, 40, 0, 0, 2748, 2749, 3, 98, 49, 0, 2749, 2750, 3, 2, 1, 0, 2750, 2751, 5, 34, 0, 0, 2751, 2752, 3, 2, 1, 0, 2752, 2754, 1, 0, 0, 0, 2753, 2741, 1, 0, 0, 0, 2753, 2746, 1, 0, 0, 0, 2754, 347, 1, 0, 0, 0, 2755, 2757, 3, 350, 175, 0, 2756, 2755, 1, 0, 0, 0, 2757, 2760, 1, 0, 0, 0, 2758, 2756, 1, 0, 0, 0, 2758, 2759, 1, 0, 0, 0, 2759, 349, 1, 0, 0, 0, 2760, 2758, 1, 0, 0, 0, 2761, 2762, 5, 179, 0, 0, 2762, 2763, 5, 36, 0, 0, 2763, 2764, 5, 30, 0, 0, 2764, 2765, 3, 312, 156, 0, 2765, 2766, 5, 31, 0, 0, 2766, 2776, 1, 0, 0, 0, 2767, 2776, 3, 344, 172, 0, 2768, 2769, 5, 170, 0, 0, 2769, 2770, 5, 36, 0, 0, 2770, 2771, 5, 30, 0, 0, 2771, 2772, 3, 312, 156, 0, 2772, 2773, 5, 31, 0, 0, 2773, 2776, 1, 0, 0, 0, 2774, 2776, 5, 55, 0, 0, 2775, 2761, 1, 0, 0, 0, 2775, 2767, 1, 0, 0, 0, 2775, 2768, 1, 0, 0, 0, 2775, 2774, 1, 0, 0, 0, 2776, 351, 1, 0, 0, 0, 2777, 2778, 5, 50, 0, 0, 2778, 2782, 5, 40, 0, 0, 2779, 2781, 3, 356, 178, 0, 2780, 2779, 1, 0, 0, 0, 2781, 2784, 1, 0, 0, 0, 2782, 2780, 1, 0, 0, 0, 2782, 2783, 1, 0, 0, 0, 2783, 2785, 1, 0, 0, 0, 2784, 2782, 1, 0, 0, 0, 2785, 2786, 3, 2, 1, 0, 2786, 353, 1, 0, 0, 0, 2787, 2791, 5, 300, 0, 0, 2788, 2790, 3, 356, 178, 0, 2789, 2788, 1, 0, 0, 0, 2790, 2793, 1, 0, 0, 0, 2791, 2789, 1, 0, 0, 0, 2791, 2792, 1, 0, 0, 0, 2792, 2794, 1, 0, 0, 0, 2793, 2791, 1, 0, 0, 0, 2794, 2795, 3, 2, 1, 0, 2795, 355, 1, 0, 0, 0, 2796, 2812, 5, 52, 0, 0, 2797, 2812, 5, 51, 0, 0, 2798, 2812, 5, 171, 0, 0, 2799, 2800, 5, 62, 0, 0, 2800, 2812, 5, 51, 0, 0, 2801, 2802, 5, 62, 0, 0, 2802, 2812, 5, 52, 0, 0, 2803, 2804, 5, 62, 0, 0, 2804, 2812, 5, 63, 0, 0, 2805, 2806, 5, 62, 0, 0, 2806, 2812, 5, 64, 0, 0, 2807, 2808, 5, 62, 0, 0, 2808, 2812, 5, 65, 0, 0, 2809, 2810, 5, 62, 0, 0, 2810, 2812, 5, 66, 0, 0, 2811, 2796, 1, 0, 0, 0, 2811, 2797, 1, 0, 0, 0, 2811, 2798, 1, 0, 0, 0, 2811, 2799, 1, 0, 0, 0, 2811, 2801, 1, 0, 0, 0, 2811, 2803, 1, 0, 0, 0, 2811, 2805, 1, 0, 0, 0, 2811, 2807, 1, 0, 0, 0, 2811, 2809, 1, 0, 0, 0, 2812, 357, 1, 0, 0, 0, 2813, 2815, 3, 360, 180, 0, 2814, 2813, 1, 0, 0, 0, 2815, 2818, 1, 0, 0, 0, 2816, 2814, 1, 0, 0, 0, 2816, 2817, 1, 0, 0, 0, 2817, 359, 1, 0, 0, 0, 2818, 2816, 1, 0, 0, 0, 2819, 2820, 5, 21, 0, 0, 2820, 2833, 3, 2, 1, 0, 2821, 2822, 5, 50, 0, 0, 2822, 2823, 5, 40, 0, 0, 2823, 2833, 3, 140, 70, 0, 2824, 2825, 5, 25, 0, 0, 2825, 2826, 5, 40, 0, 0, 2826, 2833, 3, 2, 1, 0, 2827, 2833, 3, 196, 98, 0, 2828, 2829, 5, 50, 0, 0, 2829, 2833, 3, 32, 16, 0, 2830, 2833, 3, 342, 171, 0, 2831, 2833, 3, 40, 20, 0, 2832, 2819, 1, 0, 0, 0, 2832, 2821, 1, 0, 0, 0, 2832, 2824, 1, 0, 0, 0, 2832, 2827, 1, 0, 0, 0, 2832, 2828, 1, 0, 0, 0, 2832, 2830, 1, 0, 0, 0, 2832, 2831, 1, 0, 0, 0, 2833, 361, 1, 0, 0, 0, 2834, 2838, 5, 273, 0, 0, 2835, 2837, 3, 364, 182, 0, 2836, 2835, 1, 0, 0, 0, 2837, 2840, 1, 0, 0, 0, 2838, 2836, 1, 0, 0, 0, 2838, 2839, 1, 0, 0, 0, 2839, 2841, 1, 0, 0, 0, 2840, 2838, 1, 0, 0, 0, 2841, 2854, 3, 2, 1, 0, 2842, 2846, 5, 273, 0, 0, 2843, 2845, 3, 364, 182, 0, 2844, 2843, 1, 0, 0, 0, 2845, 2848, 1, 0, 0, 0, 2846, 2844, 1, 0, 0, 0, 2846, 2847, 1, 0, 0, 0, 2847, 2849, 1, 0, 0, 0, 2848, 2846, 1, 0, 0, 0, 2849, 2850, 3, 2, 1, 0, 2850, 2851, 5, 34, 0, 0, 2851, 2852, 3, 2, 1, 0, 2852, 2854, 1, 0, 0, 0, 2853, 2834, 1, 0, 0, 0, 2853, 2842, 1, 0, 0, 0, 2854, 363, 1, 0, 0, 0, 2855, 2856, 7, 13, 0, 0, 2856, 365, 1, 0, 0, 0, 2857, 2859, 3, 368, 184, 0, 2858, 2857, 1, 0, 0, 0, 2859, 2862, 1, 0, 0, 0, 2860, 2858, 1, 0, 0, 0, 2860, 2861, 1, 0, 0, 0, 2861, 367, 1, 0, 0, 0, 2862, 2860, 1, 0, 0, 0, 2863, 2864, 5, 21, 0, 0, 2864, 2865, 3, 2, 1, 0, 2865, 2866, 5, 44, 0, 0, 2866, 2867, 3, 32, 16, 0, 2867, 2874, 1, 0, 0, 0, 2868, 2869, 5, 25, 0, 0, 2869, 2870, 5, 40, 0, 0, 2870, 2874, 3, 2, 1, 0, 2871, 2874, 3, 342, 171, 0, 2872, 2874, 3, 40, 20, 0, 2873, 2863, 1, 0, 0, 0, 2873, 2868, 1, 0, 0, 0, 2873, 2871, 1, 0, 0, 0, 2873, 2872, 1, 0, 0, 0, 2874, 369, 1, 0, 0, 0, 172, 378, 383, 391, 399, 452, 493, 502, 526, 530, 548, 575, 598, 634, 640, 647, 649, 659, 661, 668, 679, 687, 708, 710, 726, 771, 776, 781, 786, 794, 872, 878, 894, 900, 906, 913, 1024, 1029, 1035, 1040, 1042, 1050, 1062, 1074, 1081, 1088, 1090, 1117, 1124, 1132, 1140, 1153, 1160, 1163, 1182, 1276, 1285, 1292, 1295, 1303, 1324, 1356, 1379, 1391, 1400, 1425, 1449, 1457, 1461, 1476, 1483, 1528, 1538, 1554, 1566, 1578, 1592, 1604, 1615, 1622, 1632, 1645, 1650, 1655, 1664, 1675, 1758, 1767, 1780, 1791, 1799, 1809, 1811, 1838, 1845, 1850, 1857, 1863, 1873, 1877, 1884, 1899, 1905, 1919, 1932, 1940, 1947, 1951, 1956, 1972, 1977, 1979, 1992, 2018, 2025, 2027, 2032, 2038, 2067, 2072, 2095, 2100, 2164, 2173, 2186, 2197, 2208, 2211, 2218, 2230, 2244, 2258, 2266, 2286, 2298, 2303, 2312, 2314, 2321, 2331, 2399, 2476, 2481, 2489, 2639, 2643, 2645, 2650, 2652, 2658, 2664, 2670, 2676, 2682, 2688, 2694, 2701, 2706, 2712, 2739, 2753, 2758, 2775, 2782, 2791, 2811, 2816, 2832, 2838, 2846, 2853, 2860, 2873] \ No newline at end of file +[4, 1, 304, 3699, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 2, 157, 7, 157, 2, 158, 7, 158, 2, 159, 7, 159, 2, 160, 7, 160, 2, 161, 7, 161, 2, 162, 7, 162, 2, 163, 7, 163, 2, 164, 7, 164, 2, 165, 7, 165, 2, 166, 7, 166, 2, 167, 7, 167, 2, 168, 7, 168, 2, 169, 7, 169, 2, 170, 7, 170, 2, 171, 7, 171, 2, 172, 7, 172, 2, 173, 7, 173, 2, 174, 7, 174, 2, 175, 7, 175, 2, 176, 7, 176, 2, 177, 7, 177, 2, 178, 7, 178, 2, 179, 7, 179, 2, 180, 7, 180, 2, 181, 7, 181, 2, 182, 7, 182, 2, 183, 7, 183, 2, 184, 7, 184, 2, 185, 7, 185, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 381, 8, 1, 10, 1, 12, 1, 384, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 391, 8, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 5, 3, 398, 8, 3, 10, 3, 12, 3, 401, 9, 3, 1, 3, 1, 3, 1, 3, 1, 4, 5, 4, 407, 8, 4, 10, 4, 12, 4, 410, 9, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 498, 8, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 549, 8, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 558, 8, 15, 10, 15, 12, 15, 561, 9, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 590, 8, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 3, 19, 597, 8, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 615, 8, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 3, 21, 647, 8, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 675, 8, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 3, 23, 715, 8, 23, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 3, 25, 726, 8, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 5, 27, 736, 8, 27, 10, 27, 12, 27, 739, 9, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 5, 28, 749, 8, 28, 10, 28, 12, 28, 752, 9, 28, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 3, 30, 759, 8, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 3, 31, 781, 8, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 3, 32, 794, 8, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 5, 34, 808, 8, 34, 10, 34, 12, 34, 811, 9, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 5, 38, 832, 8, 38, 10, 38, 12, 38, 835, 9, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 3, 39, 907, 8, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 3, 40, 914, 8, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 921, 8, 41, 1, 42, 5, 42, 924, 8, 42, 10, 42, 12, 42, 927, 9, 42, 1, 43, 1, 43, 1, 43, 1, 43, 5, 43, 933, 8, 43, 10, 43, 12, 43, 936, 9, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 3, 45, 946, 8, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 3, 45, 955, 8, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 3, 45, 966, 8, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 3, 45, 977, 8, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 3, 45, 990, 8, 45, 1, 45, 1, 45, 3, 45, 994, 8, 45, 1, 46, 1, 46, 1, 46, 1, 46, 5, 46, 1000, 8, 46, 10, 46, 12, 46, 1003, 9, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 3, 46, 1018, 8, 46, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 3, 48, 1025, 8, 48, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 5, 50, 1032, 8, 50, 10, 50, 12, 50, 1035, 9, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 3, 51, 1062, 8, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 1140, 8, 52, 3, 52, 1142, 8, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 3, 54, 1156, 8, 54, 1, 54, 1, 54, 5, 54, 1160, 8, 54, 10, 54, 12, 54, 1163, 9, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 3, 54, 1171, 8, 54, 3, 54, 1173, 8, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 5, 55, 1180, 8, 55, 10, 55, 12, 55, 1183, 9, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 5, 56, 1194, 8, 56, 10, 56, 12, 56, 1197, 9, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 5, 57, 1208, 8, 57, 10, 57, 12, 57, 1211, 9, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 3, 57, 1218, 8, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 3, 58, 1226, 8, 58, 1, 58, 1, 58, 3, 58, 1230, 8, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 3, 59, 1269, 8, 59, 1, 60, 1, 60, 1, 60, 1, 60, 5, 60, 1275, 8, 60, 10, 60, 12, 60, 1278, 9, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 5, 61, 1286, 8, 61, 10, 61, 12, 61, 1289, 9, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 3, 62, 1302, 8, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 3, 63, 1310, 8, 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 3, 64, 1326, 8, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 5, 65, 1334, 8, 65, 10, 65, 12, 65, 1337, 9, 65, 3, 65, 1339, 8, 65, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 3, 66, 1363, 8, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 3, 67, 1510, 8, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 3, 68, 1520, 8, 68, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 5, 69, 1527, 8, 69, 10, 69, 12, 69, 1530, 9, 69, 3, 69, 1532, 8, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 3, 70, 1614, 8, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 5, 71, 1621, 8, 71, 10, 71, 12, 71, 1624, 9, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 3, 72, 1655, 8, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 3, 73, 1715, 8, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 3, 74, 1755, 8, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 3, 75, 1771, 8, 75, 1, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 77, 3, 77, 1781, 8, 77, 1, 77, 1, 77, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 3, 78, 1811, 8, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 3, 78, 1839, 8, 78, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 5, 79, 1846, 8, 79, 10, 79, 12, 79, 1849, 9, 79, 1, 79, 1, 79, 1, 79, 3, 79, 1854, 8, 79, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 3, 80, 1871, 8, 80, 1, 81, 1, 81, 1, 81, 1, 81, 5, 81, 1877, 8, 81, 10, 81, 12, 81, 1880, 9, 81, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 3, 84, 1937, 8, 84, 1, 85, 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 3, 86, 1947, 8, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 3, 86, 1965, 8, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 3, 86, 1983, 8, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 3, 87, 2002, 8, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 3, 88, 2023, 8, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 3, 90, 2042, 8, 90, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 3, 91, 2057, 8, 91, 1, 92, 1, 92, 1, 92, 1, 92, 5, 92, 2063, 8, 92, 10, 92, 12, 92, 2066, 9, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 3, 93, 2077, 8, 93, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 3, 94, 2097, 8, 94, 1, 95, 1, 95, 1, 95, 5, 95, 2102, 8, 95, 10, 95, 12, 95, 2105, 9, 95, 1, 96, 1, 96, 3, 96, 2109, 8, 96, 1, 96, 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 97, 5, 97, 2118, 8, 97, 10, 97, 12, 97, 2121, 9, 97, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 99, 3, 99, 2132, 8, 99, 1, 99, 1, 99, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 5, 101, 2240, 8, 101, 10, 101, 12, 101, 2243, 9, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 5, 101, 2252, 8, 101, 10, 101, 12, 101, 2255, 9, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 5, 101, 2268, 8, 101, 10, 101, 12, 101, 2271, 9, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 5, 101, 2282, 8, 101, 10, 101, 12, 101, 2285, 9, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 3, 101, 2293, 8, 101, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 5, 102, 2306, 8, 102, 10, 102, 12, 102, 2309, 9, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 3, 103, 2351, 8, 103, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 3, 104, 2362, 8, 104, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 3, 105, 2369, 8, 105, 1, 106, 1, 106, 1, 106, 1, 106, 1, 106, 1, 106, 3, 106, 2377, 8, 106, 1, 107, 1, 107, 1, 107, 1, 107, 5, 107, 2383, 8, 107, 10, 107, 12, 107, 2386, 9, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 5, 107, 2396, 8, 107, 10, 107, 12, 107, 2399, 9, 107, 1, 107, 1, 107, 1, 107, 3, 107, 2404, 8, 107, 1, 108, 1, 108, 1, 108, 1, 108, 3, 108, 2410, 8, 108, 1, 109, 5, 109, 2413, 8, 109, 10, 109, 12, 109, 2416, 9, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 3, 110, 2444, 8, 110, 1, 111, 1, 111, 1, 111, 1, 111, 5, 111, 2450, 8, 111, 10, 111, 12, 111, 2453, 9, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 112, 3, 112, 2466, 8, 112, 1, 113, 5, 113, 2469, 8, 113, 10, 113, 12, 113, 2472, 9, 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 3, 114, 2496, 8, 114, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 3, 115, 2505, 8, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 4, 116, 2514, 8, 116, 11, 116, 12, 116, 2515, 1, 116, 1, 116, 3, 116, 2520, 8, 116, 1, 117, 1, 117, 1, 117, 5, 117, 2525, 8, 117, 10, 117, 12, 117, 2528, 9, 117, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 3, 118, 2547, 8, 118, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 5, 119, 2556, 8, 119, 10, 119, 12, 119, 2559, 9, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 5, 119, 2571, 8, 119, 10, 119, 12, 119, 2574, 9, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 3, 120, 2620, 8, 120, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 3, 121, 2630, 8, 121, 3, 121, 2632, 8, 121, 1, 121, 1, 121, 1, 121, 5, 121, 2637, 8, 121, 10, 121, 12, 121, 2640, 9, 121, 1, 121, 1, 121, 1, 121, 3, 121, 2645, 8, 121, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 3, 122, 2689, 8, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 3, 123, 2698, 8, 123, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 3, 124, 2738, 8, 124, 1, 125, 5, 125, 2741, 8, 125, 10, 125, 12, 125, 2744, 9, 125, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 3, 126, 2783, 8, 126, 1, 127, 1, 127, 3, 127, 2787, 8, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 3, 128, 2797, 8, 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 3, 130, 2819, 8, 130, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 5, 131, 2829, 8, 131, 10, 131, 12, 131, 2832, 9, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 5, 131, 2840, 8, 131, 10, 131, 12, 131, 2843, 9, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 5, 131, 2855, 8, 131, 10, 131, 12, 131, 2858, 9, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 5, 131, 2868, 8, 131, 10, 131, 12, 131, 2871, 9, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 5, 131, 2881, 8, 131, 10, 131, 12, 131, 2884, 9, 131, 3, 131, 2886, 8, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 3, 133, 2898, 8, 133, 1, 134, 1, 134, 1, 134, 1, 134, 1, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, 136, 4, 136, 2910, 8, 136, 11, 136, 12, 136, 2911, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 3, 137, 2930, 8, 137, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 3, 138, 2948, 8, 138, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 3, 139, 2962, 8, 139, 1, 140, 1, 140, 1, 140, 1, 141, 1, 141, 1, 142, 1, 142, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 3, 143, 2986, 8, 143, 1, 144, 1, 144, 1, 144, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 3, 145, 3001, 8, 145, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 3, 146, 3008, 8, 146, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 4, 147, 3015, 8, 147, 11, 147, 12, 147, 3016, 3, 147, 3019, 8, 147, 1, 148, 1, 148, 1, 148, 5, 148, 3024, 8, 148, 10, 148, 12, 148, 3027, 9, 148, 1, 148, 1, 148, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 3, 149, 3037, 8, 149, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 3, 150, 3087, 8, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 3, 151, 3179, 8, 151, 1, 152, 1, 152, 1, 152, 5, 152, 3184, 8, 152, 10, 152, 12, 152, 3187, 9, 152, 1, 153, 1, 153, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 3, 154, 3199, 8, 154, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 3, 155, 3372, 8, 155, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 5, 156, 3380, 8, 156, 10, 156, 12, 156, 3383, 9, 156, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 5, 157, 3391, 8, 157, 10, 157, 12, 157, 3394, 9, 157, 1, 158, 1, 158, 1, 158, 5, 158, 3399, 8, 158, 10, 158, 12, 158, 3402, 9, 158, 1, 159, 1, 159, 1, 159, 5, 159, 3407, 8, 159, 10, 159, 12, 159, 3410, 9, 159, 1, 160, 1, 160, 1, 160, 5, 160, 3415, 8, 160, 10, 160, 12, 160, 3418, 9, 160, 1, 161, 1, 161, 1, 161, 5, 161, 3423, 8, 161, 10, 161, 12, 161, 3426, 9, 161, 1, 162, 1, 162, 1, 162, 5, 162, 3431, 8, 162, 10, 162, 12, 162, 3434, 9, 162, 1, 163, 1, 163, 1, 163, 1, 163, 5, 163, 3440, 8, 163, 10, 163, 12, 163, 3443, 9, 163, 1, 164, 1, 164, 1, 164, 5, 164, 3448, 8, 164, 10, 164, 12, 164, 3451, 9, 164, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 3, 165, 3461, 8, 165, 1, 166, 1, 166, 1, 166, 5, 166, 3466, 8, 166, 10, 166, 12, 166, 3469, 9, 166, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 3, 167, 3480, 8, 167, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 3, 168, 3514, 8, 168, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 3, 170, 3536, 8, 170, 1, 171, 1, 171, 1, 171, 5, 171, 3541, 8, 171, 10, 171, 12, 171, 3544, 9, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 3, 172, 3565, 8, 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 176, 1, 176, 1, 176, 5, 176, 3587, 8, 176, 10, 176, 12, 176, 3590, 9, 176, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 3, 177, 3607, 8, 177, 1, 178, 1, 178, 1, 178, 5, 178, 3612, 8, 178, 10, 178, 12, 178, 3615, 9, 178, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 3, 179, 3642, 8, 179, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 3, 181, 3662, 8, 181, 1, 182, 1, 182, 1, 182, 5, 182, 3667, 8, 182, 10, 182, 12, 182, 3670, 9, 182, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 5, 184, 3677, 8, 184, 10, 184, 12, 184, 3680, 9, 184, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 3, 185, 3697, 8, 185, 1, 185, 0, 0, 186, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, 354, 356, 358, 360, 362, 364, 366, 368, 370, 0, 16, 5, 0, 1, 15, 242, 242, 246, 246, 263, 263, 288, 288, 4, 0, 16, 16, 242, 242, 263, 263, 287, 288, 1, 0, 172, 173, 1, 0, 37, 38, 2, 0, 45, 47, 185, 186, 1, 0, 73, 74, 1, 0, 262, 263, 3, 0, 2, 2, 61, 61, 77, 83, 2, 0, 228, 228, 259, 260, 1, 0, 95, 96, 1, 0, 97, 111, 1, 0, 187, 188, 1, 0, 183, 185, 1, 0, 183, 188, 2, 0, 172, 172, 288, 289, 1, 0, 51, 52, 4137, 0, 372, 1, 0, 0, 0, 2, 390, 1, 0, 0, 0, 4, 392, 1, 0, 0, 0, 6, 399, 1, 0, 0, 0, 8, 408, 1, 0, 0, 0, 10, 497, 1, 0, 0, 0, 12, 499, 1, 0, 0, 0, 14, 503, 1, 0, 0, 0, 16, 507, 1, 0, 0, 0, 18, 512, 1, 0, 0, 0, 20, 516, 1, 0, 0, 0, 22, 520, 1, 0, 0, 0, 24, 528, 1, 0, 0, 0, 26, 548, 1, 0, 0, 0, 28, 550, 1, 0, 0, 0, 30, 552, 1, 0, 0, 0, 32, 564, 1, 0, 0, 0, 34, 566, 1, 0, 0, 0, 36, 589, 1, 0, 0, 0, 38, 596, 1, 0, 0, 0, 40, 614, 1, 0, 0, 0, 42, 646, 1, 0, 0, 0, 44, 674, 1, 0, 0, 0, 46, 714, 1, 0, 0, 0, 48, 716, 1, 0, 0, 0, 50, 725, 1, 0, 0, 0, 52, 727, 1, 0, 0, 0, 54, 737, 1, 0, 0, 0, 56, 750, 1, 0, 0, 0, 58, 753, 1, 0, 0, 0, 60, 756, 1, 0, 0, 0, 62, 780, 1, 0, 0, 0, 64, 793, 1, 0, 0, 0, 66, 795, 1, 0, 0, 0, 68, 809, 1, 0, 0, 0, 70, 814, 1, 0, 0, 0, 72, 816, 1, 0, 0, 0, 74, 823, 1, 0, 0, 0, 76, 827, 1, 0, 0, 0, 78, 906, 1, 0, 0, 0, 80, 913, 1, 0, 0, 0, 82, 920, 1, 0, 0, 0, 84, 925, 1, 0, 0, 0, 86, 934, 1, 0, 0, 0, 88, 940, 1, 0, 0, 0, 90, 993, 1, 0, 0, 0, 92, 995, 1, 0, 0, 0, 94, 1019, 1, 0, 0, 0, 96, 1024, 1, 0, 0, 0, 98, 1026, 1, 0, 0, 0, 100, 1033, 1, 0, 0, 0, 102, 1061, 1, 0, 0, 0, 104, 1141, 1, 0, 0, 0, 106, 1143, 1, 0, 0, 0, 108, 1172, 1, 0, 0, 0, 110, 1174, 1, 0, 0, 0, 112, 1188, 1, 0, 0, 0, 114, 1217, 1, 0, 0, 0, 116, 1229, 1, 0, 0, 0, 118, 1268, 1, 0, 0, 0, 120, 1276, 1, 0, 0, 0, 122, 1287, 1, 0, 0, 0, 124, 1301, 1, 0, 0, 0, 126, 1309, 1, 0, 0, 0, 128, 1325, 1, 0, 0, 0, 130, 1338, 1, 0, 0, 0, 132, 1362, 1, 0, 0, 0, 134, 1509, 1, 0, 0, 0, 136, 1519, 1, 0, 0, 0, 138, 1531, 1, 0, 0, 0, 140, 1613, 1, 0, 0, 0, 142, 1615, 1, 0, 0, 0, 144, 1654, 1, 0, 0, 0, 146, 1714, 1, 0, 0, 0, 148, 1754, 1, 0, 0, 0, 150, 1770, 1, 0, 0, 0, 152, 1772, 1, 0, 0, 0, 154, 1776, 1, 0, 0, 0, 156, 1838, 1, 0, 0, 0, 158, 1853, 1, 0, 0, 0, 160, 1870, 1, 0, 0, 0, 162, 1878, 1, 0, 0, 0, 164, 1884, 1, 0, 0, 0, 166, 1889, 1, 0, 0, 0, 168, 1936, 1, 0, 0, 0, 170, 1938, 1, 0, 0, 0, 172, 1982, 1, 0, 0, 0, 174, 2001, 1, 0, 0, 0, 176, 2022, 1, 0, 0, 0, 178, 2024, 1, 0, 0, 0, 180, 2041, 1, 0, 0, 0, 182, 2056, 1, 0, 0, 0, 184, 2064, 1, 0, 0, 0, 186, 2076, 1, 0, 0, 0, 188, 2096, 1, 0, 0, 0, 190, 2103, 1, 0, 0, 0, 192, 2106, 1, 0, 0, 0, 194, 2119, 1, 0, 0, 0, 196, 2125, 1, 0, 0, 0, 198, 2131, 1, 0, 0, 0, 200, 2135, 1, 0, 0, 0, 202, 2292, 1, 0, 0, 0, 204, 2294, 1, 0, 0, 0, 206, 2350, 1, 0, 0, 0, 208, 2361, 1, 0, 0, 0, 210, 2368, 1, 0, 0, 0, 212, 2376, 1, 0, 0, 0, 214, 2403, 1, 0, 0, 0, 216, 2409, 1, 0, 0, 0, 218, 2414, 1, 0, 0, 0, 220, 2443, 1, 0, 0, 0, 222, 2445, 1, 0, 0, 0, 224, 2465, 1, 0, 0, 0, 226, 2470, 1, 0, 0, 0, 228, 2495, 1, 0, 0, 0, 230, 2504, 1, 0, 0, 0, 232, 2519, 1, 0, 0, 0, 234, 2526, 1, 0, 0, 0, 236, 2546, 1, 0, 0, 0, 238, 2548, 1, 0, 0, 0, 240, 2619, 1, 0, 0, 0, 242, 2644, 1, 0, 0, 0, 244, 2688, 1, 0, 0, 0, 246, 2697, 1, 0, 0, 0, 248, 2737, 1, 0, 0, 0, 250, 2742, 1, 0, 0, 0, 252, 2782, 1, 0, 0, 0, 254, 2784, 1, 0, 0, 0, 256, 2790, 1, 0, 0, 0, 258, 2798, 1, 0, 0, 0, 260, 2818, 1, 0, 0, 0, 262, 2885, 1, 0, 0, 0, 264, 2887, 1, 0, 0, 0, 266, 2897, 1, 0, 0, 0, 268, 2899, 1, 0, 0, 0, 270, 2903, 1, 0, 0, 0, 272, 2909, 1, 0, 0, 0, 274, 2929, 1, 0, 0, 0, 276, 2947, 1, 0, 0, 0, 278, 2961, 1, 0, 0, 0, 280, 2963, 1, 0, 0, 0, 282, 2966, 1, 0, 0, 0, 284, 2968, 1, 0, 0, 0, 286, 2985, 1, 0, 0, 0, 288, 2987, 1, 0, 0, 0, 290, 3000, 1, 0, 0, 0, 292, 3007, 1, 0, 0, 0, 294, 3018, 1, 0, 0, 0, 296, 3025, 1, 0, 0, 0, 298, 3036, 1, 0, 0, 0, 300, 3086, 1, 0, 0, 0, 302, 3178, 1, 0, 0, 0, 304, 3185, 1, 0, 0, 0, 306, 3188, 1, 0, 0, 0, 308, 3198, 1, 0, 0, 0, 310, 3371, 1, 0, 0, 0, 312, 3381, 1, 0, 0, 0, 314, 3392, 1, 0, 0, 0, 316, 3400, 1, 0, 0, 0, 318, 3408, 1, 0, 0, 0, 320, 3416, 1, 0, 0, 0, 322, 3424, 1, 0, 0, 0, 324, 3432, 1, 0, 0, 0, 326, 3441, 1, 0, 0, 0, 328, 3449, 1, 0, 0, 0, 330, 3460, 1, 0, 0, 0, 332, 3467, 1, 0, 0, 0, 334, 3479, 1, 0, 0, 0, 336, 3513, 1, 0, 0, 0, 338, 3515, 1, 0, 0, 0, 340, 3535, 1, 0, 0, 0, 342, 3542, 1, 0, 0, 0, 344, 3564, 1, 0, 0, 0, 346, 3566, 1, 0, 0, 0, 348, 3572, 1, 0, 0, 0, 350, 3578, 1, 0, 0, 0, 352, 3588, 1, 0, 0, 0, 354, 3606, 1, 0, 0, 0, 356, 3613, 1, 0, 0, 0, 358, 3641, 1, 0, 0, 0, 360, 3643, 1, 0, 0, 0, 362, 3661, 1, 0, 0, 0, 364, 3668, 1, 0, 0, 0, 366, 3671, 1, 0, 0, 0, 368, 3678, 1, 0, 0, 0, 370, 3696, 1, 0, 0, 0, 372, 373, 7, 0, 0, 0, 373, 1, 1, 0, 0, 0, 374, 375, 5, 287, 0, 0, 375, 391, 6, 1, -1, 0, 376, 377, 3, 4, 2, 0, 377, 378, 6, 1, -1, 0, 378, 379, 5, 264, 0, 0, 379, 381, 1, 0, 0, 0, 380, 376, 1, 0, 0, 0, 381, 384, 1, 0, 0, 0, 382, 380, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, 385, 1, 0, 0, 0, 384, 382, 1, 0, 0, 0, 385, 386, 3, 4, 2, 0, 386, 387, 6, 1, -1, 0, 387, 391, 1, 0, 0, 0, 388, 389, 5, 263, 0, 0, 389, 391, 6, 1, -1, 0, 390, 374, 1, 0, 0, 0, 390, 382, 1, 0, 0, 0, 390, 388, 1, 0, 0, 0, 391, 3, 1, 0, 0, 0, 392, 393, 7, 1, 0, 0, 393, 5, 1, 0, 0, 0, 394, 395, 5, 262, 0, 0, 395, 396, 6, 3, -1, 0, 396, 398, 5, 265, 0, 0, 397, 394, 1, 0, 0, 0, 398, 401, 1, 0, 0, 0, 399, 397, 1, 0, 0, 0, 399, 400, 1, 0, 0, 0, 400, 402, 1, 0, 0, 0, 401, 399, 1, 0, 0, 0, 402, 403, 5, 262, 0, 0, 403, 404, 6, 3, -1, 0, 404, 7, 1, 0, 0, 0, 405, 407, 3, 10, 5, 0, 406, 405, 1, 0, 0, 0, 407, 410, 1, 0, 0, 0, 408, 406, 1, 0, 0, 0, 408, 409, 1, 0, 0, 0, 409, 9, 1, 0, 0, 0, 410, 408, 1, 0, 0, 0, 411, 412, 3, 76, 38, 0, 412, 413, 5, 17, 0, 0, 413, 414, 3, 84, 42, 0, 414, 415, 5, 18, 0, 0, 415, 498, 1, 0, 0, 0, 416, 417, 3, 74, 37, 0, 417, 418, 5, 17, 0, 0, 418, 419, 3, 8, 4, 0, 419, 420, 5, 18, 0, 0, 420, 498, 1, 0, 0, 0, 421, 422, 3, 238, 119, 0, 422, 423, 5, 17, 0, 0, 423, 424, 3, 250, 125, 0, 424, 425, 5, 18, 0, 0, 425, 498, 1, 0, 0, 0, 426, 498, 3, 204, 102, 0, 427, 428, 6, 5, -1, 0, 428, 429, 3, 288, 144, 0, 429, 430, 6, 5, -1, 0, 430, 498, 1, 0, 0, 0, 431, 432, 6, 5, -1, 0, 432, 433, 3, 72, 36, 0, 433, 434, 6, 5, -1, 0, 434, 498, 1, 0, 0, 0, 435, 436, 6, 5, -1, 0, 436, 437, 3, 66, 33, 0, 437, 438, 6, 5, -1, 0, 438, 498, 1, 0, 0, 0, 439, 440, 6, 5, -1, 0, 440, 441, 3, 90, 45, 0, 441, 442, 6, 5, -1, 0, 442, 498, 1, 0, 0, 0, 443, 444, 6, 5, -1, 0, 444, 445, 3, 92, 46, 0, 445, 446, 6, 5, -1, 0, 446, 498, 1, 0, 0, 0, 447, 448, 6, 5, -1, 0, 448, 449, 3, 22, 11, 0, 449, 450, 6, 5, -1, 0, 450, 498, 1, 0, 0, 0, 451, 452, 6, 5, -1, 0, 452, 453, 3, 338, 169, 0, 453, 454, 6, 5, -1, 0, 454, 498, 1, 0, 0, 0, 455, 456, 6, 5, -1, 0, 456, 457, 3, 346, 173, 0, 457, 458, 6, 5, -1, 0, 458, 498, 1, 0, 0, 0, 459, 460, 6, 5, -1, 0, 460, 461, 3, 360, 180, 0, 461, 462, 6, 5, -1, 0, 462, 498, 1, 0, 0, 0, 463, 464, 6, 5, -1, 0, 464, 465, 3, 64, 32, 0, 465, 466, 6, 5, -1, 0, 466, 498, 1, 0, 0, 0, 467, 468, 6, 5, -1, 0, 468, 469, 3, 156, 78, 0, 469, 470, 6, 5, -1, 0, 470, 498, 1, 0, 0, 0, 471, 472, 3, 334, 167, 0, 472, 473, 6, 5, -1, 0, 473, 498, 1, 0, 0, 0, 474, 475, 6, 5, -1, 0, 475, 498, 3, 12, 6, 0, 476, 477, 6, 5, -1, 0, 477, 498, 3, 14, 7, 0, 478, 479, 6, 5, -1, 0, 479, 498, 3, 16, 8, 0, 480, 481, 6, 5, -1, 0, 481, 498, 3, 18, 9, 0, 482, 483, 6, 5, -1, 0, 483, 498, 3, 20, 10, 0, 484, 485, 6, 5, -1, 0, 485, 486, 3, 26, 13, 0, 486, 487, 6, 5, -1, 0, 487, 498, 1, 0, 0, 0, 488, 489, 6, 5, -1, 0, 489, 490, 3, 42, 21, 0, 490, 491, 6, 5, -1, 0, 491, 498, 1, 0, 0, 0, 492, 493, 6, 5, -1, 0, 493, 498, 3, 40, 20, 0, 494, 498, 3, 30, 15, 0, 495, 496, 6, 5, -1, 0, 496, 498, 3, 24, 12, 0, 497, 411, 1, 0, 0, 0, 497, 416, 1, 0, 0, 0, 497, 421, 1, 0, 0, 0, 497, 426, 1, 0, 0, 0, 497, 427, 1, 0, 0, 0, 497, 431, 1, 0, 0, 0, 497, 435, 1, 0, 0, 0, 497, 439, 1, 0, 0, 0, 497, 443, 1, 0, 0, 0, 497, 447, 1, 0, 0, 0, 497, 451, 1, 0, 0, 0, 497, 455, 1, 0, 0, 0, 497, 459, 1, 0, 0, 0, 497, 463, 1, 0, 0, 0, 497, 467, 1, 0, 0, 0, 497, 471, 1, 0, 0, 0, 497, 474, 1, 0, 0, 0, 497, 476, 1, 0, 0, 0, 497, 478, 1, 0, 0, 0, 497, 480, 1, 0, 0, 0, 497, 482, 1, 0, 0, 0, 497, 484, 1, 0, 0, 0, 497, 488, 1, 0, 0, 0, 497, 492, 1, 0, 0, 0, 497, 494, 1, 0, 0, 0, 497, 495, 1, 0, 0, 0, 498, 11, 1, 0, 0, 0, 499, 500, 5, 19, 0, 0, 500, 501, 3, 32, 16, 0, 501, 502, 6, 6, -1, 0, 502, 13, 1, 0, 0, 0, 503, 504, 5, 20, 0, 0, 504, 505, 3, 32, 16, 0, 505, 506, 6, 7, -1, 0, 506, 15, 1, 0, 0, 0, 507, 508, 5, 21, 0, 0, 508, 509, 5, 22, 0, 0, 509, 510, 3, 32, 16, 0, 510, 511, 6, 8, -1, 0, 511, 17, 1, 0, 0, 0, 512, 513, 5, 23, 0, 0, 513, 514, 3, 34, 17, 0, 514, 515, 6, 9, -1, 0, 515, 19, 1, 0, 0, 0, 516, 517, 5, 24, 0, 0, 517, 518, 3, 34, 17, 0, 518, 519, 6, 10, -1, 0, 519, 21, 1, 0, 0, 0, 520, 521, 5, 25, 0, 0, 521, 522, 3, 100, 50, 0, 522, 523, 3, 2, 1, 0, 523, 524, 5, 17, 0, 0, 524, 525, 3, 122, 61, 0, 525, 526, 5, 18, 0, 0, 526, 527, 6, 11, -1, 0, 527, 23, 1, 0, 0, 0, 528, 529, 5, 26, 0, 0, 529, 25, 1, 0, 0, 0, 530, 531, 5, 27, 0, 0, 531, 532, 3, 28, 14, 0, 532, 533, 6, 13, -1, 0, 533, 549, 1, 0, 0, 0, 534, 535, 5, 27, 0, 0, 535, 536, 3, 28, 14, 0, 536, 537, 5, 28, 0, 0, 537, 538, 3, 28, 14, 0, 538, 539, 6, 13, -1, 0, 539, 549, 1, 0, 0, 0, 540, 541, 5, 27, 0, 0, 541, 542, 3, 28, 14, 0, 542, 543, 5, 28, 0, 0, 543, 544, 3, 28, 14, 0, 544, 545, 5, 28, 0, 0, 545, 546, 3, 28, 14, 0, 546, 547, 6, 13, -1, 0, 547, 549, 1, 0, 0, 0, 548, 530, 1, 0, 0, 0, 548, 534, 1, 0, 0, 0, 548, 540, 1, 0, 0, 0, 549, 27, 1, 0, 0, 0, 550, 551, 5, 263, 0, 0, 551, 29, 1, 0, 0, 0, 552, 553, 5, 29, 0, 0, 553, 559, 5, 17, 0, 0, 554, 555, 3, 118, 59, 0, 555, 556, 6, 15, -1, 0, 556, 558, 1, 0, 0, 0, 557, 554, 1, 0, 0, 0, 558, 561, 1, 0, 0, 0, 559, 557, 1, 0, 0, 0, 559, 560, 1, 0, 0, 0, 560, 562, 1, 0, 0, 0, 561, 559, 1, 0, 0, 0, 562, 563, 5, 18, 0, 0, 563, 31, 1, 0, 0, 0, 564, 565, 5, 172, 0, 0, 565, 33, 1, 0, 0, 0, 566, 567, 7, 2, 0, 0, 567, 35, 1, 0, 0, 0, 568, 569, 5, 174, 0, 0, 569, 590, 6, 18, -1, 0, 570, 571, 3, 32, 16, 0, 571, 572, 5, 264, 0, 0, 572, 573, 6, 18, -1, 0, 573, 590, 1, 0, 0, 0, 574, 575, 3, 32, 16, 0, 575, 576, 6, 18, -1, 0, 576, 590, 1, 0, 0, 0, 577, 578, 5, 187, 0, 0, 578, 579, 5, 30, 0, 0, 579, 580, 3, 32, 16, 0, 580, 581, 5, 31, 0, 0, 581, 582, 6, 18, -1, 0, 582, 590, 1, 0, 0, 0, 583, 584, 5, 188, 0, 0, 584, 585, 5, 30, 0, 0, 585, 586, 3, 34, 17, 0, 586, 587, 5, 31, 0, 0, 587, 588, 6, 18, -1, 0, 588, 590, 1, 0, 0, 0, 589, 568, 1, 0, 0, 0, 589, 570, 1, 0, 0, 0, 589, 574, 1, 0, 0, 0, 589, 577, 1, 0, 0, 0, 589, 583, 1, 0, 0, 0, 590, 37, 1, 0, 0, 0, 591, 592, 3, 32, 16, 0, 592, 593, 6, 19, -1, 0, 593, 597, 1, 0, 0, 0, 594, 595, 5, 261, 0, 0, 595, 597, 6, 19, -1, 0, 596, 591, 1, 0, 0, 0, 596, 594, 1, 0, 0, 0, 597, 39, 1, 0, 0, 0, 598, 599, 5, 266, 0, 0, 599, 615, 5, 288, 0, 0, 600, 601, 5, 266, 0, 0, 601, 602, 5, 288, 0, 0, 602, 615, 5, 262, 0, 0, 603, 604, 5, 267, 0, 0, 604, 615, 5, 288, 0, 0, 605, 606, 5, 268, 0, 0, 606, 615, 5, 288, 0, 0, 607, 608, 5, 269, 0, 0, 608, 615, 5, 288, 0, 0, 609, 615, 5, 270, 0, 0, 610, 615, 5, 271, 0, 0, 611, 612, 5, 272, 0, 0, 612, 615, 5, 262, 0, 0, 613, 615, 5, 32, 0, 0, 614, 598, 1, 0, 0, 0, 614, 600, 1, 0, 0, 0, 614, 603, 1, 0, 0, 0, 614, 605, 1, 0, 0, 0, 614, 607, 1, 0, 0, 0, 614, 609, 1, 0, 0, 0, 614, 610, 1, 0, 0, 0, 614, 611, 1, 0, 0, 0, 614, 613, 1, 0, 0, 0, 615, 41, 1, 0, 0, 0, 616, 617, 5, 33, 0, 0, 617, 618, 3, 142, 71, 0, 618, 619, 5, 34, 0, 0, 619, 620, 3, 2, 1, 0, 620, 621, 6, 21, -1, 0, 621, 647, 1, 0, 0, 0, 622, 623, 5, 33, 0, 0, 623, 624, 3, 118, 59, 0, 624, 625, 5, 34, 0, 0, 625, 626, 3, 2, 1, 0, 626, 627, 6, 21, -1, 0, 627, 647, 1, 0, 0, 0, 628, 629, 5, 33, 0, 0, 629, 630, 3, 180, 90, 0, 630, 631, 5, 34, 0, 0, 631, 632, 3, 2, 1, 0, 632, 633, 6, 21, -1, 0, 633, 647, 1, 0, 0, 0, 634, 635, 5, 33, 0, 0, 635, 636, 3, 44, 22, 0, 636, 637, 5, 34, 0, 0, 637, 638, 3, 2, 1, 0, 638, 639, 6, 21, -1, 0, 639, 647, 1, 0, 0, 0, 640, 641, 5, 33, 0, 0, 641, 642, 3, 46, 23, 0, 642, 643, 5, 34, 0, 0, 643, 644, 3, 2, 1, 0, 644, 645, 6, 21, -1, 0, 645, 647, 1, 0, 0, 0, 646, 616, 1, 0, 0, 0, 646, 622, 1, 0, 0, 0, 646, 628, 1, 0, 0, 0, 646, 634, 1, 0, 0, 0, 646, 640, 1, 0, 0, 0, 647, 43, 1, 0, 0, 0, 648, 649, 5, 35, 0, 0, 649, 650, 3, 48, 24, 0, 650, 651, 6, 22, -1, 0, 651, 675, 1, 0, 0, 0, 652, 653, 5, 35, 0, 0, 653, 654, 3, 48, 24, 0, 654, 655, 5, 36, 0, 0, 655, 656, 3, 6, 3, 0, 656, 657, 6, 22, -1, 0, 657, 675, 1, 0, 0, 0, 658, 659, 5, 35, 0, 0, 659, 660, 3, 48, 24, 0, 660, 661, 5, 36, 0, 0, 661, 662, 5, 17, 0, 0, 662, 663, 3, 52, 26, 0, 663, 664, 5, 18, 0, 0, 664, 665, 6, 22, -1, 0, 665, 675, 1, 0, 0, 0, 666, 667, 5, 35, 0, 0, 667, 668, 3, 48, 24, 0, 668, 669, 5, 36, 0, 0, 669, 670, 5, 30, 0, 0, 670, 671, 3, 304, 152, 0, 671, 672, 5, 31, 0, 0, 672, 673, 6, 22, -1, 0, 673, 675, 1, 0, 0, 0, 674, 648, 1, 0, 0, 0, 674, 652, 1, 0, 0, 0, 674, 658, 1, 0, 0, 0, 674, 666, 1, 0, 0, 0, 675, 45, 1, 0, 0, 0, 676, 677, 5, 35, 0, 0, 677, 678, 5, 30, 0, 0, 678, 679, 3, 50, 25, 0, 679, 680, 5, 31, 0, 0, 680, 681, 3, 48, 24, 0, 681, 682, 6, 23, -1, 0, 682, 715, 1, 0, 0, 0, 683, 684, 5, 35, 0, 0, 684, 685, 5, 30, 0, 0, 685, 686, 3, 50, 25, 0, 686, 687, 5, 31, 0, 0, 687, 688, 3, 48, 24, 0, 688, 689, 5, 36, 0, 0, 689, 690, 3, 6, 3, 0, 690, 691, 6, 23, -1, 0, 691, 715, 1, 0, 0, 0, 692, 693, 5, 35, 0, 0, 693, 694, 5, 30, 0, 0, 694, 695, 3, 50, 25, 0, 695, 696, 5, 31, 0, 0, 696, 697, 3, 48, 24, 0, 697, 698, 5, 36, 0, 0, 698, 699, 5, 17, 0, 0, 699, 700, 3, 52, 26, 0, 700, 701, 5, 18, 0, 0, 701, 702, 6, 23, -1, 0, 702, 715, 1, 0, 0, 0, 703, 704, 5, 35, 0, 0, 704, 705, 5, 30, 0, 0, 705, 706, 3, 50, 25, 0, 706, 707, 5, 31, 0, 0, 707, 708, 3, 48, 24, 0, 708, 709, 5, 36, 0, 0, 709, 710, 5, 30, 0, 0, 710, 711, 3, 304, 152, 0, 711, 712, 5, 31, 0, 0, 712, 713, 6, 23, -1, 0, 713, 715, 1, 0, 0, 0, 714, 676, 1, 0, 0, 0, 714, 683, 1, 0, 0, 0, 714, 692, 1, 0, 0, 0, 714, 703, 1, 0, 0, 0, 715, 47, 1, 0, 0, 0, 716, 717, 3, 172, 86, 0, 717, 718, 6, 24, -1, 0, 718, 49, 1, 0, 0, 0, 719, 720, 3, 128, 64, 0, 720, 721, 6, 25, -1, 0, 721, 726, 1, 0, 0, 0, 722, 723, 3, 180, 90, 0, 723, 724, 6, 25, -1, 0, 724, 726, 1, 0, 0, 0, 725, 719, 1, 0, 0, 0, 725, 722, 1, 0, 0, 0, 726, 51, 1, 0, 0, 0, 727, 728, 3, 54, 27, 0, 728, 729, 3, 56, 28, 0, 729, 730, 6, 26, -1, 0, 730, 53, 1, 0, 0, 0, 731, 732, 3, 310, 155, 0, 732, 733, 6, 27, -1, 0, 733, 736, 1, 0, 0, 0, 734, 736, 3, 40, 20, 0, 735, 731, 1, 0, 0, 0, 735, 734, 1, 0, 0, 0, 736, 739, 1, 0, 0, 0, 737, 735, 1, 0, 0, 0, 737, 738, 1, 0, 0, 0, 738, 55, 1, 0, 0, 0, 739, 737, 1, 0, 0, 0, 740, 741, 3, 58, 29, 0, 741, 742, 3, 60, 30, 0, 742, 743, 3, 2, 1, 0, 743, 744, 5, 36, 0, 0, 744, 745, 3, 310, 155, 0, 745, 746, 6, 28, -1, 0, 746, 749, 1, 0, 0, 0, 747, 749, 3, 40, 20, 0, 748, 740, 1, 0, 0, 0, 748, 747, 1, 0, 0, 0, 749, 752, 1, 0, 0, 0, 750, 748, 1, 0, 0, 0, 750, 751, 1, 0, 0, 0, 751, 57, 1, 0, 0, 0, 752, 750, 1, 0, 0, 0, 753, 754, 7, 3, 0, 0, 754, 755, 6, 29, -1, 0, 755, 59, 1, 0, 0, 0, 756, 758, 3, 62, 31, 0, 757, 759, 5, 260, 0, 0, 758, 757, 1, 0, 0, 0, 758, 759, 1, 0, 0, 0, 759, 760, 1, 0, 0, 0, 760, 761, 6, 30, -1, 0, 761, 61, 1, 0, 0, 0, 762, 763, 3, 148, 74, 0, 763, 764, 6, 31, -1, 0, 764, 781, 1, 0, 0, 0, 765, 766, 3, 2, 1, 0, 766, 767, 6, 31, -1, 0, 767, 781, 1, 0, 0, 0, 768, 769, 5, 195, 0, 0, 769, 781, 6, 31, -1, 0, 770, 771, 5, 196, 0, 0, 771, 781, 6, 31, -1, 0, 772, 773, 5, 201, 0, 0, 773, 774, 5, 39, 0, 0, 774, 775, 5, 263, 0, 0, 775, 781, 6, 31, -1, 0, 776, 777, 5, 201, 0, 0, 777, 778, 3, 118, 59, 0, 778, 779, 6, 31, -1, 0, 779, 781, 1, 0, 0, 0, 780, 762, 1, 0, 0, 0, 780, 765, 1, 0, 0, 0, 780, 768, 1, 0, 0, 0, 780, 770, 1, 0, 0, 0, 780, 772, 1, 0, 0, 0, 780, 776, 1, 0, 0, 0, 781, 63, 1, 0, 0, 0, 782, 783, 5, 197, 0, 0, 783, 784, 5, 40, 0, 0, 784, 785, 3, 2, 1, 0, 785, 786, 6, 32, -1, 0, 786, 794, 1, 0, 0, 0, 787, 788, 5, 197, 0, 0, 788, 789, 3, 2, 1, 0, 789, 790, 6, 32, -1, 0, 790, 794, 1, 0, 0, 0, 791, 792, 5, 197, 0, 0, 792, 794, 6, 32, -1, 0, 793, 782, 1, 0, 0, 0, 793, 787, 1, 0, 0, 0, 793, 791, 1, 0, 0, 0, 794, 65, 1, 0, 0, 0, 795, 796, 5, 41, 0, 0, 796, 797, 5, 42, 0, 0, 797, 798, 3, 32, 16, 0, 798, 799, 5, 43, 0, 0, 799, 800, 3, 68, 34, 0, 800, 801, 5, 44, 0, 0, 801, 802, 3, 0, 0, 0, 802, 803, 6, 33, -1, 0, 803, 67, 1, 0, 0, 0, 804, 805, 3, 70, 35, 0, 805, 806, 6, 34, -1, 0, 806, 808, 1, 0, 0, 0, 807, 804, 1, 0, 0, 0, 808, 811, 1, 0, 0, 0, 809, 807, 1, 0, 0, 0, 809, 810, 1, 0, 0, 0, 810, 812, 1, 0, 0, 0, 811, 809, 1, 0, 0, 0, 812, 813, 6, 34, -1, 0, 813, 69, 1, 0, 0, 0, 814, 815, 7, 4, 0, 0, 815, 71, 1, 0, 0, 0, 816, 817, 5, 48, 0, 0, 817, 818, 5, 36, 0, 0, 818, 819, 5, 30, 0, 0, 819, 820, 3, 304, 152, 0, 820, 821, 5, 31, 0, 0, 821, 822, 6, 36, -1, 0, 822, 73, 1, 0, 0, 0, 823, 824, 5, 49, 0, 0, 824, 825, 3, 2, 1, 0, 825, 826, 6, 37, -1, 0, 826, 75, 1, 0, 0, 0, 827, 833, 5, 50, 0, 0, 828, 829, 3, 78, 39, 0, 829, 830, 6, 38, -1, 0, 830, 832, 1, 0, 0, 0, 831, 828, 1, 0, 0, 0, 832, 835, 1, 0, 0, 0, 833, 831, 1, 0, 0, 0, 833, 834, 1, 0, 0, 0, 834, 836, 1, 0, 0, 0, 835, 833, 1, 0, 0, 0, 836, 837, 3, 2, 1, 0, 837, 838, 3, 186, 93, 0, 838, 839, 3, 80, 40, 0, 839, 840, 3, 82, 41, 0, 840, 841, 6, 38, -1, 0, 841, 77, 1, 0, 0, 0, 842, 843, 5, 51, 0, 0, 843, 907, 6, 39, -1, 0, 844, 845, 5, 52, 0, 0, 845, 907, 6, 39, -1, 0, 846, 847, 5, 198, 0, 0, 847, 907, 6, 39, -1, 0, 848, 849, 5, 201, 0, 0, 849, 907, 6, 39, -1, 0, 850, 851, 5, 220, 0, 0, 851, 907, 6, 39, -1, 0, 852, 853, 5, 53, 0, 0, 853, 907, 6, 39, -1, 0, 854, 855, 5, 54, 0, 0, 855, 907, 6, 39, -1, 0, 856, 857, 5, 55, 0, 0, 857, 907, 6, 39, -1, 0, 858, 859, 5, 56, 0, 0, 859, 907, 6, 39, -1, 0, 860, 861, 5, 243, 0, 0, 861, 907, 6, 39, -1, 0, 862, 863, 5, 15, 0, 0, 863, 907, 6, 39, -1, 0, 864, 865, 5, 223, 0, 0, 865, 907, 6, 39, -1, 0, 866, 867, 5, 57, 0, 0, 867, 907, 6, 39, -1, 0, 868, 869, 5, 58, 0, 0, 869, 907, 6, 39, -1, 0, 870, 871, 5, 59, 0, 0, 871, 907, 6, 39, -1, 0, 872, 873, 5, 60, 0, 0, 873, 907, 6, 39, -1, 0, 874, 875, 5, 61, 0, 0, 875, 907, 6, 39, -1, 0, 876, 877, 5, 62, 0, 0, 877, 878, 5, 51, 0, 0, 878, 907, 6, 39, -1, 0, 879, 880, 5, 62, 0, 0, 880, 881, 5, 52, 0, 0, 881, 907, 6, 39, -1, 0, 882, 883, 5, 62, 0, 0, 883, 884, 5, 63, 0, 0, 884, 907, 6, 39, -1, 0, 885, 886, 5, 62, 0, 0, 886, 887, 5, 64, 0, 0, 887, 907, 6, 39, -1, 0, 888, 889, 5, 62, 0, 0, 889, 890, 5, 65, 0, 0, 890, 907, 6, 39, -1, 0, 891, 892, 5, 62, 0, 0, 892, 893, 5, 66, 0, 0, 893, 907, 6, 39, -1, 0, 894, 895, 5, 67, 0, 0, 895, 907, 6, 39, -1, 0, 896, 897, 5, 68, 0, 0, 897, 907, 6, 39, -1, 0, 898, 899, 5, 69, 0, 0, 899, 907, 6, 39, -1, 0, 900, 901, 5, 70, 0, 0, 901, 902, 5, 30, 0, 0, 902, 903, 3, 32, 16, 0, 903, 904, 5, 31, 0, 0, 904, 905, 6, 39, -1, 0, 905, 907, 1, 0, 0, 0, 906, 842, 1, 0, 0, 0, 906, 844, 1, 0, 0, 0, 906, 846, 1, 0, 0, 0, 906, 848, 1, 0, 0, 0, 906, 850, 1, 0, 0, 0, 906, 852, 1, 0, 0, 0, 906, 854, 1, 0, 0, 0, 906, 856, 1, 0, 0, 0, 906, 858, 1, 0, 0, 0, 906, 860, 1, 0, 0, 0, 906, 862, 1, 0, 0, 0, 906, 864, 1, 0, 0, 0, 906, 866, 1, 0, 0, 0, 906, 868, 1, 0, 0, 0, 906, 870, 1, 0, 0, 0, 906, 872, 1, 0, 0, 0, 906, 874, 1, 0, 0, 0, 906, 876, 1, 0, 0, 0, 906, 879, 1, 0, 0, 0, 906, 882, 1, 0, 0, 0, 906, 885, 1, 0, 0, 0, 906, 888, 1, 0, 0, 0, 906, 891, 1, 0, 0, 0, 906, 894, 1, 0, 0, 0, 906, 896, 1, 0, 0, 0, 906, 898, 1, 0, 0, 0, 906, 900, 1, 0, 0, 0, 907, 79, 1, 0, 0, 0, 908, 914, 1, 0, 0, 0, 909, 910, 5, 71, 0, 0, 910, 911, 3, 126, 63, 0, 911, 912, 6, 40, -1, 0, 912, 914, 1, 0, 0, 0, 913, 908, 1, 0, 0, 0, 913, 909, 1, 0, 0, 0, 914, 81, 1, 0, 0, 0, 915, 921, 1, 0, 0, 0, 916, 917, 5, 72, 0, 0, 917, 918, 3, 86, 43, 0, 918, 919, 6, 41, -1, 0, 919, 921, 1, 0, 0, 0, 920, 915, 1, 0, 0, 0, 920, 916, 1, 0, 0, 0, 921, 83, 1, 0, 0, 0, 922, 924, 3, 202, 101, 0, 923, 922, 1, 0, 0, 0, 924, 927, 1, 0, 0, 0, 925, 923, 1, 0, 0, 0, 925, 926, 1, 0, 0, 0, 926, 85, 1, 0, 0, 0, 927, 925, 1, 0, 0, 0, 928, 929, 3, 126, 63, 0, 929, 930, 6, 43, -1, 0, 930, 931, 5, 28, 0, 0, 931, 933, 1, 0, 0, 0, 932, 928, 1, 0, 0, 0, 933, 936, 1, 0, 0, 0, 934, 932, 1, 0, 0, 0, 934, 935, 1, 0, 0, 0, 935, 937, 1, 0, 0, 0, 936, 934, 1, 0, 0, 0, 937, 938, 3, 126, 63, 0, 938, 939, 6, 43, -1, 0, 939, 87, 1, 0, 0, 0, 940, 941, 7, 5, 0, 0, 941, 89, 1, 0, 0, 0, 942, 943, 3, 88, 44, 0, 943, 945, 3, 32, 16, 0, 944, 946, 7, 6, 0, 0, 945, 944, 1, 0, 0, 0, 945, 946, 1, 0, 0, 0, 946, 947, 1, 0, 0, 0, 947, 948, 6, 45, -1, 0, 948, 994, 1, 0, 0, 0, 949, 950, 3, 88, 44, 0, 950, 951, 3, 32, 16, 0, 951, 952, 5, 75, 0, 0, 952, 954, 3, 32, 16, 0, 953, 955, 5, 263, 0, 0, 954, 953, 1, 0, 0, 0, 954, 955, 1, 0, 0, 0, 955, 956, 1, 0, 0, 0, 956, 957, 6, 45, -1, 0, 957, 994, 1, 0, 0, 0, 958, 959, 3, 88, 44, 0, 959, 960, 3, 32, 16, 0, 960, 961, 5, 75, 0, 0, 961, 962, 3, 32, 16, 0, 962, 963, 5, 28, 0, 0, 963, 965, 3, 32, 16, 0, 964, 966, 5, 263, 0, 0, 965, 964, 1, 0, 0, 0, 965, 966, 1, 0, 0, 0, 966, 967, 1, 0, 0, 0, 967, 968, 6, 45, -1, 0, 968, 994, 1, 0, 0, 0, 969, 970, 3, 88, 44, 0, 970, 971, 3, 32, 16, 0, 971, 972, 5, 28, 0, 0, 972, 973, 3, 32, 16, 0, 973, 974, 5, 75, 0, 0, 974, 976, 3, 32, 16, 0, 975, 977, 5, 263, 0, 0, 976, 975, 1, 0, 0, 0, 976, 977, 1, 0, 0, 0, 977, 978, 1, 0, 0, 0, 978, 979, 6, 45, -1, 0, 979, 994, 1, 0, 0, 0, 980, 981, 3, 88, 44, 0, 981, 982, 3, 32, 16, 0, 982, 983, 5, 28, 0, 0, 983, 984, 3, 32, 16, 0, 984, 985, 5, 75, 0, 0, 985, 986, 3, 32, 16, 0, 986, 987, 5, 28, 0, 0, 987, 989, 3, 32, 16, 0, 988, 990, 5, 263, 0, 0, 989, 988, 1, 0, 0, 0, 989, 990, 1, 0, 0, 0, 990, 991, 1, 0, 0, 0, 991, 992, 6, 45, -1, 0, 992, 994, 1, 0, 0, 0, 993, 942, 1, 0, 0, 0, 993, 949, 1, 0, 0, 0, 993, 958, 1, 0, 0, 0, 993, 969, 1, 0, 0, 0, 993, 980, 1, 0, 0, 0, 994, 91, 1, 0, 0, 0, 995, 1001, 5, 21, 0, 0, 996, 997, 3, 94, 47, 0, 997, 998, 6, 46, -1, 0, 998, 1000, 1, 0, 0, 0, 999, 996, 1, 0, 0, 0, 1000, 1003, 1, 0, 0, 0, 1001, 999, 1, 0, 0, 0, 1001, 1002, 1, 0, 0, 0, 1002, 1004, 1, 0, 0, 0, 1003, 1001, 1, 0, 0, 0, 1004, 1005, 3, 2, 1, 0, 1005, 1006, 6, 46, -1, 0, 1006, 1007, 3, 96, 48, 0, 1007, 1017, 6, 46, -1, 0, 1008, 1009, 5, 179, 0, 0, 1009, 1010, 5, 36, 0, 0, 1010, 1011, 5, 30, 0, 0, 1011, 1012, 3, 304, 152, 0, 1012, 1013, 5, 31, 0, 0, 1013, 1014, 6, 46, -1, 0, 1014, 1015, 3, 96, 48, 0, 1015, 1016, 6, 46, -1, 0, 1016, 1018, 1, 0, 0, 0, 1017, 1008, 1, 0, 0, 0, 1017, 1018, 1, 0, 0, 0, 1018, 93, 1, 0, 0, 0, 1019, 1020, 5, 76, 0, 0, 1020, 95, 1, 0, 0, 0, 1021, 1025, 1, 0, 0, 0, 1022, 1023, 5, 297, 0, 0, 1023, 1025, 6, 48, -1, 0, 1024, 1021, 1, 0, 0, 0, 1024, 1022, 1, 0, 0, 0, 1025, 97, 1, 0, 0, 0, 1026, 1027, 7, 7, 0, 0, 1027, 99, 1, 0, 0, 0, 1028, 1029, 3, 98, 49, 0, 1029, 1030, 6, 50, -1, 0, 1030, 1032, 1, 0, 0, 0, 1031, 1028, 1, 0, 0, 0, 1032, 1035, 1, 0, 0, 0, 1033, 1031, 1, 0, 0, 0, 1033, 1034, 1, 0, 0, 0, 1034, 101, 1, 0, 0, 0, 1035, 1033, 1, 0, 0, 0, 1036, 1062, 3, 104, 52, 0, 1037, 1038, 5, 279, 0, 0, 1038, 1039, 3, 172, 86, 0, 1039, 1040, 6, 51, -1, 0, 1040, 1062, 1, 0, 0, 0, 1041, 1042, 5, 285, 0, 0, 1042, 1043, 3, 182, 91, 0, 1043, 1044, 6, 51, -1, 0, 1044, 1062, 1, 0, 0, 0, 1045, 1046, 5, 285, 0, 0, 1046, 1047, 3, 178, 89, 0, 1047, 1048, 6, 51, -1, 0, 1048, 1062, 1, 0, 0, 0, 1049, 1050, 5, 283, 0, 0, 1050, 1051, 3, 126, 63, 0, 1051, 1052, 6, 51, -1, 0, 1052, 1062, 1, 0, 0, 0, 1053, 1054, 5, 280, 0, 0, 1054, 1055, 3, 106, 53, 0, 1055, 1056, 6, 51, -1, 0, 1056, 1062, 1, 0, 0, 0, 1057, 1058, 5, 286, 0, 0, 1058, 1059, 3, 50, 25, 0, 1059, 1060, 6, 51, -1, 0, 1060, 1062, 1, 0, 0, 0, 1061, 1036, 1, 0, 0, 0, 1061, 1037, 1, 0, 0, 0, 1061, 1041, 1, 0, 0, 0, 1061, 1045, 1, 0, 0, 0, 1061, 1049, 1, 0, 0, 0, 1061, 1053, 1, 0, 0, 0, 1061, 1057, 1, 0, 0, 0, 1062, 103, 1, 0, 0, 0, 1063, 1064, 5, 274, 0, 0, 1064, 1142, 6, 52, -1, 0, 1065, 1066, 5, 275, 0, 0, 1066, 1067, 3, 32, 16, 0, 1067, 1068, 6, 52, -1, 0, 1068, 1142, 1, 0, 0, 0, 1069, 1070, 5, 275, 0, 0, 1070, 1071, 3, 0, 0, 0, 1071, 1072, 6, 52, -1, 0, 1072, 1142, 1, 0, 0, 0, 1073, 1074, 5, 276, 0, 0, 1074, 1075, 3, 32, 16, 0, 1075, 1076, 6, 52, -1, 0, 1076, 1142, 1, 0, 0, 0, 1077, 1078, 5, 277, 0, 0, 1078, 1079, 3, 34, 17, 0, 1079, 1080, 6, 52, -1, 0, 1080, 1142, 1, 0, 0, 0, 1081, 1082, 5, 278, 0, 0, 1082, 1083, 3, 36, 18, 0, 1083, 1084, 6, 52, -1, 0, 1084, 1142, 1, 0, 0, 0, 1085, 1086, 5, 278, 0, 0, 1086, 1087, 3, 34, 17, 0, 1087, 1088, 6, 52, -1, 0, 1088, 1142, 1, 0, 0, 0, 1089, 1090, 5, 278, 0, 0, 1090, 1091, 5, 30, 0, 0, 1091, 1092, 3, 304, 152, 0, 1092, 1093, 5, 31, 0, 0, 1093, 1094, 6, 52, -1, 0, 1094, 1142, 1, 0, 0, 0, 1095, 1096, 5, 278, 0, 0, 1096, 1097, 5, 84, 0, 0, 1097, 1098, 5, 30, 0, 0, 1098, 1099, 3, 304, 152, 0, 1099, 1100, 5, 31, 0, 0, 1100, 1101, 6, 52, -1, 0, 1101, 1142, 1, 0, 0, 0, 1102, 1103, 5, 281, 0, 0, 1103, 1104, 3, 32, 16, 0, 1104, 1105, 6, 52, -1, 0, 1105, 1142, 1, 0, 0, 0, 1106, 1107, 5, 281, 0, 0, 1107, 1108, 3, 0, 0, 0, 1108, 1109, 6, 52, -1, 0, 1109, 1142, 1, 0, 0, 0, 1110, 1111, 5, 284, 0, 0, 1111, 1112, 3, 6, 3, 0, 1112, 1113, 6, 52, -1, 0, 1113, 1142, 1, 0, 0, 0, 1114, 1115, 5, 284, 0, 0, 1115, 1116, 5, 223, 0, 0, 1116, 1117, 5, 30, 0, 0, 1117, 1118, 3, 6, 3, 0, 1118, 1119, 5, 31, 0, 0, 1119, 1120, 6, 52, -1, 0, 1120, 1142, 1, 0, 0, 0, 1121, 1122, 5, 284, 0, 0, 1122, 1123, 5, 84, 0, 0, 1123, 1124, 5, 30, 0, 0, 1124, 1125, 3, 304, 152, 0, 1125, 1126, 5, 31, 0, 0, 1126, 1127, 6, 52, -1, 0, 1127, 1142, 1, 0, 0, 0, 1128, 1129, 5, 286, 0, 0, 1129, 1130, 3, 32, 16, 0, 1130, 1131, 6, 52, -1, 0, 1131, 1142, 1, 0, 0, 0, 1132, 1133, 5, 282, 0, 0, 1133, 1139, 6, 52, -1, 0, 1134, 1135, 5, 30, 0, 0, 1135, 1136, 3, 108, 54, 0, 1136, 1137, 5, 31, 0, 0, 1137, 1140, 1, 0, 0, 0, 1138, 1140, 5, 85, 0, 0, 1139, 1134, 1, 0, 0, 0, 1139, 1138, 1, 0, 0, 0, 1140, 1142, 1, 0, 0, 0, 1141, 1063, 1, 0, 0, 0, 1141, 1065, 1, 0, 0, 0, 1141, 1069, 1, 0, 0, 0, 1141, 1073, 1, 0, 0, 0, 1141, 1077, 1, 0, 0, 0, 1141, 1081, 1, 0, 0, 0, 1141, 1085, 1, 0, 0, 0, 1141, 1089, 1, 0, 0, 0, 1141, 1095, 1, 0, 0, 0, 1141, 1102, 1, 0, 0, 0, 1141, 1106, 1, 0, 0, 0, 1141, 1110, 1, 0, 0, 0, 1141, 1114, 1, 0, 0, 0, 1141, 1121, 1, 0, 0, 0, 1141, 1128, 1, 0, 0, 0, 1141, 1132, 1, 0, 0, 0, 1142, 105, 1, 0, 0, 0, 1143, 1144, 3, 174, 87, 0, 1144, 1145, 3, 142, 71, 0, 1145, 1146, 3, 114, 57, 0, 1146, 1147, 6, 53, -1, 0, 1147, 107, 1, 0, 0, 0, 1148, 1173, 1, 0, 0, 0, 1149, 1150, 3, 0, 0, 0, 1150, 1151, 6, 54, -1, 0, 1151, 1156, 1, 0, 0, 0, 1152, 1153, 3, 32, 16, 0, 1153, 1154, 6, 54, -1, 0, 1154, 1156, 1, 0, 0, 0, 1155, 1149, 1, 0, 0, 0, 1155, 1152, 1, 0, 0, 0, 1156, 1157, 1, 0, 0, 0, 1157, 1158, 5, 28, 0, 0, 1158, 1160, 1, 0, 0, 0, 1159, 1155, 1, 0, 0, 0, 1160, 1163, 1, 0, 0, 0, 1161, 1159, 1, 0, 0, 0, 1161, 1162, 1, 0, 0, 0, 1162, 1170, 1, 0, 0, 0, 1163, 1161, 1, 0, 0, 0, 1164, 1165, 3, 0, 0, 0, 1165, 1166, 6, 54, -1, 0, 1166, 1171, 1, 0, 0, 0, 1167, 1168, 3, 32, 16, 0, 1168, 1169, 6, 54, -1, 0, 1169, 1171, 1, 0, 0, 0, 1170, 1164, 1, 0, 0, 0, 1170, 1167, 1, 0, 0, 0, 1171, 1173, 1, 0, 0, 0, 1172, 1148, 1, 0, 0, 0, 1172, 1161, 1, 0, 0, 0, 1173, 109, 1, 0, 0, 0, 1174, 1181, 5, 86, 0, 0, 1175, 1176, 3, 142, 71, 0, 1176, 1177, 6, 55, -1, 0, 1177, 1178, 5, 28, 0, 0, 1178, 1180, 1, 0, 0, 0, 1179, 1175, 1, 0, 0, 0, 1180, 1183, 1, 0, 0, 0, 1181, 1179, 1, 0, 0, 0, 1181, 1182, 1, 0, 0, 0, 1182, 1184, 1, 0, 0, 0, 1183, 1181, 1, 0, 0, 0, 1184, 1185, 3, 142, 71, 0, 1185, 1186, 6, 55, -1, 0, 1186, 1187, 5, 87, 0, 0, 1187, 111, 1, 0, 0, 0, 1188, 1195, 5, 42, 0, 0, 1189, 1190, 3, 150, 75, 0, 1190, 1191, 6, 56, -1, 0, 1191, 1192, 5, 28, 0, 0, 1192, 1194, 1, 0, 0, 0, 1193, 1189, 1, 0, 0, 0, 1194, 1197, 1, 0, 0, 0, 1195, 1193, 1, 0, 0, 0, 1195, 1196, 1, 0, 0, 0, 1196, 1198, 1, 0, 0, 0, 1197, 1195, 1, 0, 0, 0, 1198, 1199, 3, 150, 75, 0, 1199, 1200, 6, 56, -1, 0, 1200, 1201, 5, 43, 0, 0, 1201, 113, 1, 0, 0, 0, 1202, 1209, 5, 30, 0, 0, 1203, 1204, 3, 116, 58, 0, 1204, 1205, 6, 57, -1, 0, 1205, 1206, 5, 28, 0, 0, 1206, 1208, 1, 0, 0, 0, 1207, 1203, 1, 0, 0, 0, 1208, 1211, 1, 0, 0, 0, 1209, 1207, 1, 0, 0, 0, 1209, 1210, 1, 0, 0, 0, 1210, 1212, 1, 0, 0, 0, 1211, 1209, 1, 0, 0, 0, 1212, 1213, 3, 116, 58, 0, 1213, 1214, 6, 57, -1, 0, 1214, 1215, 5, 31, 0, 0, 1215, 1218, 1, 0, 0, 0, 1216, 1218, 5, 85, 0, 0, 1217, 1202, 1, 0, 0, 0, 1217, 1216, 1, 0, 0, 0, 1218, 115, 1, 0, 0, 0, 1219, 1220, 5, 176, 0, 0, 1220, 1230, 6, 58, -1, 0, 1221, 1222, 3, 234, 117, 0, 1222, 1223, 3, 142, 71, 0, 1223, 1225, 3, 230, 115, 0, 1224, 1226, 3, 0, 0, 0, 1225, 1224, 1, 0, 0, 0, 1225, 1226, 1, 0, 0, 0, 1226, 1227, 1, 0, 0, 0, 1227, 1228, 6, 58, -1, 0, 1228, 1230, 1, 0, 0, 0, 1229, 1219, 1, 0, 0, 0, 1229, 1221, 1, 0, 0, 0, 1230, 117, 1, 0, 0, 0, 1231, 1232, 5, 42, 0, 0, 1232, 1233, 3, 2, 1, 0, 1233, 1234, 5, 43, 0, 0, 1234, 1235, 3, 120, 60, 0, 1235, 1236, 6, 59, -1, 0, 1236, 1269, 1, 0, 0, 0, 1237, 1238, 5, 42, 0, 0, 1238, 1239, 3, 178, 89, 0, 1239, 1240, 5, 43, 0, 0, 1240, 1241, 3, 120, 60, 0, 1241, 1242, 6, 59, -1, 0, 1242, 1269, 1, 0, 0, 0, 1243, 1244, 5, 42, 0, 0, 1244, 1245, 5, 261, 0, 0, 1245, 1246, 5, 43, 0, 0, 1246, 1247, 3, 120, 60, 0, 1247, 1248, 6, 59, -1, 0, 1248, 1269, 1, 0, 0, 0, 1249, 1250, 5, 42, 0, 0, 1250, 1251, 5, 197, 0, 0, 1251, 1252, 3, 2, 1, 0, 1252, 1253, 5, 43, 0, 0, 1253, 1254, 3, 120, 60, 0, 1254, 1255, 6, 59, -1, 0, 1255, 1269, 1, 0, 0, 0, 1256, 1257, 3, 120, 60, 0, 1257, 1258, 6, 59, -1, 0, 1258, 1269, 1, 0, 0, 0, 1259, 1260, 3, 178, 89, 0, 1260, 1261, 6, 59, -1, 0, 1261, 1269, 1, 0, 0, 0, 1262, 1263, 5, 256, 0, 0, 1263, 1269, 6, 59, -1, 0, 1264, 1265, 5, 257, 0, 0, 1265, 1269, 6, 59, -1, 0, 1266, 1267, 5, 258, 0, 0, 1267, 1269, 6, 59, -1, 0, 1268, 1231, 1, 0, 0, 0, 1268, 1237, 1, 0, 0, 0, 1268, 1243, 1, 0, 0, 0, 1268, 1249, 1, 0, 0, 0, 1268, 1256, 1, 0, 0, 0, 1268, 1259, 1, 0, 0, 0, 1268, 1262, 1, 0, 0, 0, 1268, 1264, 1, 0, 0, 0, 1268, 1266, 1, 0, 0, 0, 1269, 119, 1, 0, 0, 0, 1270, 1271, 3, 2, 1, 0, 1271, 1272, 6, 60, -1, 0, 1272, 1273, 5, 88, 0, 0, 1273, 1275, 1, 0, 0, 0, 1274, 1270, 1, 0, 0, 0, 1275, 1278, 1, 0, 0, 0, 1276, 1274, 1, 0, 0, 0, 1276, 1277, 1, 0, 0, 0, 1277, 1279, 1, 0, 0, 0, 1278, 1276, 1, 0, 0, 0, 1279, 1280, 3, 2, 1, 0, 1280, 1281, 6, 60, -1, 0, 1281, 121, 1, 0, 0, 0, 1282, 1283, 3, 124, 62, 0, 1283, 1284, 6, 61, -1, 0, 1284, 1286, 1, 0, 0, 0, 1285, 1282, 1, 0, 0, 0, 1286, 1289, 1, 0, 0, 0, 1287, 1285, 1, 0, 0, 0, 1287, 1288, 1, 0, 0, 0, 1288, 123, 1, 0, 0, 0, 1289, 1287, 1, 0, 0, 0, 1290, 1291, 5, 179, 0, 0, 1291, 1292, 5, 89, 0, 0, 1292, 1293, 3, 32, 16, 0, 1293, 1294, 6, 62, -1, 0, 1294, 1302, 1, 0, 0, 0, 1295, 1296, 3, 156, 78, 0, 1296, 1297, 6, 62, -1, 0, 1297, 1302, 1, 0, 0, 0, 1298, 1299, 3, 336, 168, 0, 1299, 1300, 6, 62, -1, 0, 1300, 1302, 1, 0, 0, 0, 1301, 1290, 1, 0, 0, 0, 1301, 1295, 1, 0, 0, 0, 1301, 1298, 1, 0, 0, 0, 1302, 125, 1, 0, 0, 0, 1303, 1304, 3, 118, 59, 0, 1304, 1305, 6, 63, -1, 0, 1305, 1310, 1, 0, 0, 0, 1306, 1307, 3, 142, 71, 0, 1307, 1308, 6, 63, -1, 0, 1308, 1310, 1, 0, 0, 0, 1309, 1303, 1, 0, 0, 0, 1309, 1306, 1, 0, 0, 0, 1310, 127, 1, 0, 0, 0, 1311, 1312, 3, 126, 63, 0, 1312, 1313, 6, 64, -1, 0, 1313, 1326, 1, 0, 0, 0, 1314, 1315, 5, 42, 0, 0, 1315, 1316, 3, 2, 1, 0, 1316, 1317, 5, 43, 0, 0, 1317, 1318, 6, 64, -1, 0, 1318, 1326, 1, 0, 0, 0, 1319, 1320, 5, 42, 0, 0, 1320, 1321, 5, 197, 0, 0, 1321, 1322, 3, 2, 1, 0, 1322, 1323, 5, 43, 0, 0, 1323, 1324, 6, 64, -1, 0, 1324, 1326, 1, 0, 0, 0, 1325, 1311, 1, 0, 0, 0, 1325, 1314, 1, 0, 0, 0, 1325, 1319, 1, 0, 0, 0, 1326, 129, 1, 0, 0, 0, 1327, 1339, 1, 0, 0, 0, 1328, 1329, 3, 134, 67, 0, 1329, 1335, 6, 65, -1, 0, 1330, 1331, 3, 132, 66, 0, 1331, 1332, 6, 65, -1, 0, 1332, 1334, 1, 0, 0, 0, 1333, 1330, 1, 0, 0, 0, 1334, 1337, 1, 0, 0, 0, 1335, 1333, 1, 0, 0, 0, 1335, 1336, 1, 0, 0, 0, 1336, 1339, 1, 0, 0, 0, 1337, 1335, 1, 0, 0, 0, 1338, 1327, 1, 0, 0, 0, 1338, 1328, 1, 0, 0, 0, 1339, 131, 1, 0, 0, 0, 1340, 1341, 5, 261, 0, 0, 1341, 1363, 6, 66, -1, 0, 1342, 1343, 5, 260, 0, 0, 1343, 1363, 6, 66, -1, 0, 1344, 1345, 5, 42, 0, 0, 1345, 1346, 3, 32, 16, 0, 1346, 1347, 5, 43, 0, 0, 1347, 1348, 6, 66, -1, 0, 1348, 1363, 1, 0, 0, 0, 1349, 1350, 5, 42, 0, 0, 1350, 1351, 3, 32, 16, 0, 1351, 1352, 5, 265, 0, 0, 1352, 1353, 3, 32, 16, 0, 1353, 1354, 5, 43, 0, 0, 1354, 1355, 6, 66, -1, 0, 1355, 1363, 1, 0, 0, 0, 1356, 1357, 5, 42, 0, 0, 1357, 1358, 5, 265, 0, 0, 1358, 1359, 3, 32, 16, 0, 1359, 1360, 5, 43, 0, 0, 1360, 1361, 6, 66, -1, 0, 1361, 1363, 1, 0, 0, 0, 1362, 1340, 1, 0, 0, 0, 1362, 1342, 1, 0, 0, 0, 1362, 1344, 1, 0, 0, 0, 1362, 1349, 1, 0, 0, 0, 1362, 1356, 1, 0, 0, 0, 1363, 133, 1, 0, 0, 0, 1364, 1510, 6, 67, -1, 0, 1365, 1366, 5, 202, 0, 0, 1366, 1367, 5, 30, 0, 0, 1367, 1368, 3, 6, 3, 0, 1368, 1369, 5, 28, 0, 0, 1369, 1370, 3, 6, 3, 0, 1370, 1371, 5, 28, 0, 0, 1371, 1372, 3, 6, 3, 0, 1372, 1373, 5, 28, 0, 0, 1373, 1374, 3, 6, 3, 0, 1374, 1375, 5, 31, 0, 0, 1375, 1376, 6, 67, -1, 0, 1376, 1510, 1, 0, 0, 0, 1377, 1378, 5, 202, 0, 0, 1378, 1379, 5, 30, 0, 0, 1379, 1380, 3, 6, 3, 0, 1380, 1381, 5, 28, 0, 0, 1381, 1382, 3, 6, 3, 0, 1382, 1383, 5, 31, 0, 0, 1383, 1384, 6, 67, -1, 0, 1384, 1510, 1, 0, 0, 0, 1385, 1386, 5, 203, 0, 0, 1386, 1387, 5, 204, 0, 0, 1387, 1388, 5, 42, 0, 0, 1388, 1389, 3, 32, 16, 0, 1389, 1390, 5, 43, 0, 0, 1390, 1391, 6, 67, -1, 0, 1391, 1510, 1, 0, 0, 0, 1392, 1393, 5, 203, 0, 0, 1393, 1394, 5, 205, 0, 0, 1394, 1395, 5, 42, 0, 0, 1395, 1396, 3, 32, 16, 0, 1396, 1397, 5, 43, 0, 0, 1397, 1398, 3, 130, 65, 0, 1398, 1399, 6, 67, -1, 0, 1399, 1510, 1, 0, 0, 0, 1400, 1401, 5, 206, 0, 0, 1401, 1510, 6, 67, -1, 0, 1402, 1403, 5, 207, 0, 0, 1403, 1510, 6, 67, -1, 0, 1404, 1405, 5, 208, 0, 0, 1405, 1510, 6, 67, -1, 0, 1406, 1407, 5, 200, 0, 0, 1407, 1510, 6, 67, -1, 0, 1408, 1409, 5, 182, 0, 0, 1409, 1510, 6, 67, -1, 0, 1410, 1411, 5, 183, 0, 0, 1411, 1510, 6, 67, -1, 0, 1412, 1413, 5, 184, 0, 0, 1413, 1510, 6, 67, -1, 0, 1414, 1415, 5, 185, 0, 0, 1415, 1510, 6, 67, -1, 0, 1416, 1417, 5, 186, 0, 0, 1417, 1510, 6, 67, -1, 0, 1418, 1419, 5, 187, 0, 0, 1419, 1510, 6, 67, -1, 0, 1420, 1421, 5, 188, 0, 0, 1421, 1510, 6, 67, -1, 0, 1422, 1423, 5, 209, 0, 0, 1423, 1510, 6, 67, -1, 0, 1424, 1425, 5, 189, 0, 0, 1425, 1510, 6, 67, -1, 0, 1426, 1427, 5, 190, 0, 0, 1427, 1510, 6, 67, -1, 0, 1428, 1429, 5, 191, 0, 0, 1429, 1510, 6, 67, -1, 0, 1430, 1431, 5, 192, 0, 0, 1431, 1510, 6, 67, -1, 0, 1432, 1433, 5, 210, 0, 0, 1433, 1510, 6, 67, -1, 0, 1434, 1435, 5, 211, 0, 0, 1435, 1510, 6, 67, -1, 0, 1436, 1437, 5, 212, 0, 0, 1437, 1510, 6, 67, -1, 0, 1438, 1439, 5, 213, 0, 0, 1439, 1510, 6, 67, -1, 0, 1440, 1441, 5, 214, 0, 0, 1441, 1510, 6, 67, -1, 0, 1442, 1443, 5, 215, 0, 0, 1443, 1510, 6, 67, -1, 0, 1444, 1445, 5, 216, 0, 0, 1445, 1510, 6, 67, -1, 0, 1446, 1447, 5, 217, 0, 0, 1447, 1448, 3, 136, 68, 0, 1448, 1449, 6, 67, -1, 0, 1449, 1510, 1, 0, 0, 0, 1450, 1451, 5, 218, 0, 0, 1451, 1452, 3, 136, 68, 0, 1452, 1453, 6, 67, -1, 0, 1453, 1510, 1, 0, 0, 0, 1454, 1455, 5, 219, 0, 0, 1455, 1510, 6, 67, -1, 0, 1456, 1457, 5, 220, 0, 0, 1457, 1458, 3, 136, 68, 0, 1458, 1459, 6, 67, -1, 0, 1459, 1510, 1, 0, 0, 0, 1460, 1461, 5, 221, 0, 0, 1461, 1462, 3, 138, 69, 0, 1462, 1463, 6, 67, -1, 0, 1463, 1510, 1, 0, 0, 0, 1464, 1465, 5, 221, 0, 0, 1465, 1466, 3, 138, 69, 0, 1466, 1467, 5, 28, 0, 0, 1467, 1468, 3, 6, 3, 0, 1468, 1469, 6, 67, -1, 0, 1469, 1510, 1, 0, 0, 0, 1470, 1471, 5, 193, 0, 0, 1471, 1510, 6, 67, -1, 0, 1472, 1473, 5, 194, 0, 0, 1473, 1510, 6, 67, -1, 0, 1474, 1475, 5, 90, 0, 0, 1475, 1476, 5, 183, 0, 0, 1476, 1510, 6, 67, -1, 0, 1477, 1478, 5, 90, 0, 0, 1478, 1479, 5, 184, 0, 0, 1479, 1510, 6, 67, -1, 0, 1480, 1481, 5, 90, 0, 0, 1481, 1482, 5, 185, 0, 0, 1482, 1510, 6, 67, -1, 0, 1483, 1484, 5, 90, 0, 0, 1484, 1485, 5, 186, 0, 0, 1485, 1510, 6, 67, -1, 0, 1486, 1487, 5, 62, 0, 0, 1487, 1488, 5, 219, 0, 0, 1488, 1510, 6, 67, -1, 0, 1489, 1490, 5, 222, 0, 0, 1490, 1510, 6, 67, -1, 0, 1491, 1492, 5, 223, 0, 0, 1492, 1493, 5, 212, 0, 0, 1493, 1510, 6, 67, -1, 0, 1494, 1495, 5, 224, 0, 0, 1495, 1510, 6, 67, -1, 0, 1496, 1497, 5, 206, 0, 0, 1497, 1498, 5, 182, 0, 0, 1498, 1510, 6, 67, -1, 0, 1499, 1500, 5, 225, 0, 0, 1500, 1510, 6, 67, -1, 0, 1501, 1502, 5, 227, 0, 0, 1502, 1510, 6, 67, -1, 0, 1503, 1504, 5, 34, 0, 0, 1504, 1505, 5, 226, 0, 0, 1505, 1510, 6, 67, -1, 0, 1506, 1507, 3, 2, 1, 0, 1507, 1508, 6, 67, -1, 0, 1508, 1510, 1, 0, 0, 0, 1509, 1364, 1, 0, 0, 0, 1509, 1365, 1, 0, 0, 0, 1509, 1377, 1, 0, 0, 0, 1509, 1385, 1, 0, 0, 0, 1509, 1392, 1, 0, 0, 0, 1509, 1400, 1, 0, 0, 0, 1509, 1402, 1, 0, 0, 0, 1509, 1404, 1, 0, 0, 0, 1509, 1406, 1, 0, 0, 0, 1509, 1408, 1, 0, 0, 0, 1509, 1410, 1, 0, 0, 0, 1509, 1412, 1, 0, 0, 0, 1509, 1414, 1, 0, 0, 0, 1509, 1416, 1, 0, 0, 0, 1509, 1418, 1, 0, 0, 0, 1509, 1420, 1, 0, 0, 0, 1509, 1422, 1, 0, 0, 0, 1509, 1424, 1, 0, 0, 0, 1509, 1426, 1, 0, 0, 0, 1509, 1428, 1, 0, 0, 0, 1509, 1430, 1, 0, 0, 0, 1509, 1432, 1, 0, 0, 0, 1509, 1434, 1, 0, 0, 0, 1509, 1436, 1, 0, 0, 0, 1509, 1438, 1, 0, 0, 0, 1509, 1440, 1, 0, 0, 0, 1509, 1442, 1, 0, 0, 0, 1509, 1444, 1, 0, 0, 0, 1509, 1446, 1, 0, 0, 0, 1509, 1450, 1, 0, 0, 0, 1509, 1454, 1, 0, 0, 0, 1509, 1456, 1, 0, 0, 0, 1509, 1460, 1, 0, 0, 0, 1509, 1464, 1, 0, 0, 0, 1509, 1470, 1, 0, 0, 0, 1509, 1472, 1, 0, 0, 0, 1509, 1474, 1, 0, 0, 0, 1509, 1477, 1, 0, 0, 0, 1509, 1480, 1, 0, 0, 0, 1509, 1483, 1, 0, 0, 0, 1509, 1486, 1, 0, 0, 0, 1509, 1489, 1, 0, 0, 0, 1509, 1491, 1, 0, 0, 0, 1509, 1494, 1, 0, 0, 0, 1509, 1496, 1, 0, 0, 0, 1509, 1499, 1, 0, 0, 0, 1509, 1501, 1, 0, 0, 0, 1509, 1503, 1, 0, 0, 0, 1509, 1506, 1, 0, 0, 0, 1510, 135, 1, 0, 0, 0, 1511, 1520, 1, 0, 0, 0, 1512, 1513, 5, 30, 0, 0, 1513, 1514, 5, 91, 0, 0, 1514, 1515, 5, 36, 0, 0, 1515, 1516, 3, 32, 16, 0, 1516, 1517, 5, 31, 0, 0, 1517, 1518, 6, 68, -1, 0, 1518, 1520, 1, 0, 0, 0, 1519, 1511, 1, 0, 0, 0, 1519, 1512, 1, 0, 0, 0, 1520, 137, 1, 0, 0, 0, 1521, 1532, 1, 0, 0, 0, 1522, 1523, 3, 140, 70, 0, 1523, 1528, 6, 69, -1, 0, 1524, 1525, 7, 8, 0, 0, 1525, 1527, 6, 69, -1, 0, 1526, 1524, 1, 0, 0, 0, 1527, 1530, 1, 0, 0, 0, 1528, 1526, 1, 0, 0, 0, 1528, 1529, 1, 0, 0, 0, 1529, 1532, 1, 0, 0, 0, 1530, 1528, 1, 0, 0, 0, 1531, 1521, 1, 0, 0, 0, 1531, 1522, 1, 0, 0, 0, 1532, 139, 1, 0, 0, 0, 1533, 1534, 5, 177, 0, 0, 1534, 1614, 6, 70, -1, 0, 1535, 1536, 5, 206, 0, 0, 1536, 1614, 6, 70, -1, 0, 1537, 1538, 5, 207, 0, 0, 1538, 1614, 6, 70, -1, 0, 1539, 1540, 5, 200, 0, 0, 1540, 1614, 6, 70, -1, 0, 1541, 1542, 5, 182, 0, 0, 1542, 1614, 6, 70, -1, 0, 1543, 1544, 5, 183, 0, 0, 1544, 1614, 6, 70, -1, 0, 1545, 1546, 5, 184, 0, 0, 1546, 1614, 6, 70, -1, 0, 1547, 1548, 5, 185, 0, 0, 1548, 1614, 6, 70, -1, 0, 1549, 1550, 5, 186, 0, 0, 1550, 1614, 6, 70, -1, 0, 1551, 1552, 5, 187, 0, 0, 1552, 1614, 6, 70, -1, 0, 1553, 1554, 5, 188, 0, 0, 1554, 1614, 6, 70, -1, 0, 1555, 1556, 5, 189, 0, 0, 1556, 1614, 6, 70, -1, 0, 1557, 1558, 5, 190, 0, 0, 1558, 1614, 6, 70, -1, 0, 1559, 1560, 5, 191, 0, 0, 1560, 1614, 6, 70, -1, 0, 1561, 1562, 5, 192, 0, 0, 1562, 1614, 6, 70, -1, 0, 1563, 1564, 5, 261, 0, 0, 1564, 1614, 6, 70, -1, 0, 1565, 1566, 5, 210, 0, 0, 1566, 1614, 6, 70, -1, 0, 1567, 1568, 5, 211, 0, 0, 1568, 1614, 6, 70, -1, 0, 1569, 1570, 5, 212, 0, 0, 1570, 1614, 6, 70, -1, 0, 1571, 1572, 5, 213, 0, 0, 1572, 1614, 6, 70, -1, 0, 1573, 1574, 5, 214, 0, 0, 1574, 1614, 6, 70, -1, 0, 1575, 1576, 5, 217, 0, 0, 1576, 1614, 6, 70, -1, 0, 1577, 1578, 5, 218, 0, 0, 1578, 1614, 6, 70, -1, 0, 1579, 1580, 5, 221, 0, 0, 1580, 1614, 6, 70, -1, 0, 1581, 1582, 5, 193, 0, 0, 1582, 1614, 6, 70, -1, 0, 1583, 1584, 5, 194, 0, 0, 1584, 1614, 6, 70, -1, 0, 1585, 1586, 5, 209, 0, 0, 1586, 1614, 6, 70, -1, 0, 1587, 1588, 5, 229, 0, 0, 1588, 1614, 6, 70, -1, 0, 1589, 1590, 5, 230, 0, 0, 1590, 1614, 6, 70, -1, 0, 1591, 1592, 5, 231, 0, 0, 1592, 1614, 6, 70, -1, 0, 1593, 1594, 5, 232, 0, 0, 1594, 1614, 6, 70, -1, 0, 1595, 1596, 5, 233, 0, 0, 1596, 1614, 6, 70, -1, 0, 1597, 1598, 5, 234, 0, 0, 1598, 1614, 6, 70, -1, 0, 1599, 1600, 5, 235, 0, 0, 1600, 1614, 6, 70, -1, 0, 1601, 1602, 5, 236, 0, 0, 1602, 1614, 6, 70, -1, 0, 1603, 1604, 5, 237, 0, 0, 1604, 1614, 6, 70, -1, 0, 1605, 1606, 5, 238, 0, 0, 1606, 1614, 6, 70, -1, 0, 1607, 1608, 5, 239, 0, 0, 1608, 1614, 6, 70, -1, 0, 1609, 1610, 5, 240, 0, 0, 1610, 1614, 6, 70, -1, 0, 1611, 1612, 5, 241, 0, 0, 1612, 1614, 6, 70, -1, 0, 1613, 1533, 1, 0, 0, 0, 1613, 1535, 1, 0, 0, 0, 1613, 1537, 1, 0, 0, 0, 1613, 1539, 1, 0, 0, 0, 1613, 1541, 1, 0, 0, 0, 1613, 1543, 1, 0, 0, 0, 1613, 1545, 1, 0, 0, 0, 1613, 1547, 1, 0, 0, 0, 1613, 1549, 1, 0, 0, 0, 1613, 1551, 1, 0, 0, 0, 1613, 1553, 1, 0, 0, 0, 1613, 1555, 1, 0, 0, 0, 1613, 1557, 1, 0, 0, 0, 1613, 1559, 1, 0, 0, 0, 1613, 1561, 1, 0, 0, 0, 1613, 1563, 1, 0, 0, 0, 1613, 1565, 1, 0, 0, 0, 1613, 1567, 1, 0, 0, 0, 1613, 1569, 1, 0, 0, 0, 1613, 1571, 1, 0, 0, 0, 1613, 1573, 1, 0, 0, 0, 1613, 1575, 1, 0, 0, 0, 1613, 1577, 1, 0, 0, 0, 1613, 1579, 1, 0, 0, 0, 1613, 1581, 1, 0, 0, 0, 1613, 1583, 1, 0, 0, 0, 1613, 1585, 1, 0, 0, 0, 1613, 1587, 1, 0, 0, 0, 1613, 1589, 1, 0, 0, 0, 1613, 1591, 1, 0, 0, 0, 1613, 1593, 1, 0, 0, 0, 1613, 1595, 1, 0, 0, 0, 1613, 1597, 1, 0, 0, 0, 1613, 1599, 1, 0, 0, 0, 1613, 1601, 1, 0, 0, 0, 1613, 1603, 1, 0, 0, 0, 1613, 1605, 1, 0, 0, 0, 1613, 1607, 1, 0, 0, 0, 1613, 1609, 1, 0, 0, 0, 1613, 1611, 1, 0, 0, 0, 1614, 141, 1, 0, 0, 0, 1615, 1616, 3, 146, 73, 0, 1616, 1622, 6, 71, -1, 0, 1617, 1618, 3, 144, 72, 0, 1618, 1619, 6, 71, -1, 0, 1619, 1621, 1, 0, 0, 0, 1620, 1617, 1, 0, 0, 0, 1621, 1624, 1, 0, 0, 0, 1622, 1620, 1, 0, 0, 0, 1622, 1623, 1, 0, 0, 0, 1623, 143, 1, 0, 0, 0, 1624, 1622, 1, 0, 0, 0, 1625, 1626, 5, 260, 0, 0, 1626, 1655, 6, 72, -1, 0, 1627, 1628, 5, 42, 0, 0, 1628, 1629, 5, 43, 0, 0, 1629, 1655, 6, 72, -1, 0, 1630, 1631, 3, 112, 56, 0, 1631, 1632, 6, 72, -1, 0, 1632, 1655, 1, 0, 0, 0, 1633, 1634, 5, 259, 0, 0, 1634, 1655, 6, 72, -1, 0, 1635, 1636, 5, 261, 0, 0, 1636, 1655, 6, 72, -1, 0, 1637, 1638, 5, 92, 0, 0, 1638, 1655, 6, 72, -1, 0, 1639, 1640, 5, 93, 0, 0, 1640, 1641, 5, 30, 0, 0, 1641, 1642, 3, 126, 63, 0, 1642, 1643, 5, 31, 0, 0, 1643, 1644, 6, 72, -1, 0, 1644, 1655, 1, 0, 0, 0, 1645, 1646, 5, 94, 0, 0, 1646, 1647, 5, 30, 0, 0, 1647, 1648, 3, 126, 63, 0, 1648, 1649, 5, 31, 0, 0, 1649, 1650, 6, 72, -1, 0, 1650, 1655, 1, 0, 0, 0, 1651, 1652, 3, 110, 55, 0, 1652, 1653, 6, 72, -1, 0, 1653, 1655, 1, 0, 0, 0, 1654, 1625, 1, 0, 0, 0, 1654, 1627, 1, 0, 0, 0, 1654, 1630, 1, 0, 0, 0, 1654, 1633, 1, 0, 0, 0, 1654, 1635, 1, 0, 0, 0, 1654, 1637, 1, 0, 0, 0, 1654, 1639, 1, 0, 0, 0, 1654, 1645, 1, 0, 0, 0, 1654, 1651, 1, 0, 0, 0, 1655, 145, 1, 0, 0, 0, 1656, 1657, 5, 39, 0, 0, 1657, 1658, 3, 118, 59, 0, 1658, 1659, 6, 73, -1, 0, 1659, 1715, 1, 0, 0, 0, 1660, 1661, 5, 196, 0, 0, 1661, 1715, 6, 73, -1, 0, 1662, 1663, 5, 198, 0, 0, 1663, 1664, 5, 39, 0, 0, 1664, 1665, 3, 118, 59, 0, 1665, 1666, 6, 73, -1, 0, 1666, 1715, 1, 0, 0, 0, 1667, 1668, 5, 199, 0, 0, 1668, 1669, 3, 118, 59, 0, 1669, 1670, 6, 73, -1, 0, 1670, 1715, 1, 0, 0, 0, 1671, 1672, 5, 225, 0, 0, 1672, 1673, 3, 174, 87, 0, 1673, 1674, 3, 142, 71, 0, 1674, 1675, 5, 261, 0, 0, 1675, 1676, 3, 114, 57, 0, 1676, 1677, 6, 73, -1, 0, 1677, 1715, 1, 0, 0, 0, 1678, 1679, 5, 252, 0, 0, 1679, 1680, 3, 32, 16, 0, 1680, 1681, 6, 73, -1, 0, 1681, 1715, 1, 0, 0, 0, 1682, 1683, 5, 251, 0, 0, 1683, 1684, 3, 32, 16, 0, 1684, 1685, 6, 73, -1, 0, 1685, 1715, 1, 0, 0, 0, 1686, 1687, 5, 252, 0, 0, 1687, 1688, 3, 2, 1, 0, 1688, 1689, 6, 73, -1, 0, 1689, 1715, 1, 0, 0, 0, 1690, 1691, 5, 251, 0, 0, 1691, 1692, 3, 2, 1, 0, 1692, 1693, 6, 73, -1, 0, 1693, 1715, 1, 0, 0, 0, 1694, 1695, 5, 253, 0, 0, 1695, 1715, 6, 73, -1, 0, 1696, 1697, 5, 200, 0, 0, 1697, 1715, 6, 73, -1, 0, 1698, 1699, 3, 152, 76, 0, 1699, 1700, 6, 73, -1, 0, 1700, 1715, 1, 0, 0, 0, 1701, 1702, 3, 154, 77, 0, 1702, 1703, 6, 73, -1, 0, 1703, 1715, 1, 0, 0, 0, 1704, 1705, 3, 148, 74, 0, 1705, 1706, 6, 73, -1, 0, 1706, 1715, 1, 0, 0, 0, 1707, 1708, 3, 2, 1, 0, 1708, 1709, 6, 73, -1, 0, 1709, 1715, 1, 0, 0, 0, 1710, 1711, 5, 176, 0, 0, 1711, 1712, 3, 142, 71, 0, 1712, 1713, 6, 73, -1, 0, 1713, 1715, 1, 0, 0, 0, 1714, 1656, 1, 0, 0, 0, 1714, 1660, 1, 0, 0, 0, 1714, 1662, 1, 0, 0, 0, 1714, 1667, 1, 0, 0, 0, 1714, 1671, 1, 0, 0, 0, 1714, 1678, 1, 0, 0, 0, 1714, 1682, 1, 0, 0, 0, 1714, 1686, 1, 0, 0, 0, 1714, 1690, 1, 0, 0, 0, 1714, 1694, 1, 0, 0, 0, 1714, 1696, 1, 0, 0, 0, 1714, 1698, 1, 0, 0, 0, 1714, 1701, 1, 0, 0, 0, 1714, 1704, 1, 0, 0, 0, 1714, 1707, 1, 0, 0, 0, 1714, 1710, 1, 0, 0, 0, 1715, 147, 1, 0, 0, 0, 1716, 1717, 5, 180, 0, 0, 1717, 1755, 6, 74, -1, 0, 1718, 1719, 5, 181, 0, 0, 1719, 1755, 6, 74, -1, 0, 1720, 1721, 5, 182, 0, 0, 1721, 1755, 6, 74, -1, 0, 1722, 1723, 5, 183, 0, 0, 1723, 1755, 6, 74, -1, 0, 1724, 1725, 5, 184, 0, 0, 1725, 1755, 6, 74, -1, 0, 1726, 1727, 5, 185, 0, 0, 1727, 1755, 6, 74, -1, 0, 1728, 1729, 5, 186, 0, 0, 1729, 1755, 6, 74, -1, 0, 1730, 1731, 5, 187, 0, 0, 1731, 1755, 6, 74, -1, 0, 1732, 1733, 5, 188, 0, 0, 1733, 1755, 6, 74, -1, 0, 1734, 1735, 5, 189, 0, 0, 1735, 1755, 6, 74, -1, 0, 1736, 1737, 5, 190, 0, 0, 1737, 1755, 6, 74, -1, 0, 1738, 1739, 5, 191, 0, 0, 1739, 1755, 6, 74, -1, 0, 1740, 1741, 5, 192, 0, 0, 1741, 1755, 6, 74, -1, 0, 1742, 1743, 5, 90, 0, 0, 1743, 1744, 5, 183, 0, 0, 1744, 1755, 6, 74, -1, 0, 1745, 1746, 5, 90, 0, 0, 1746, 1747, 5, 184, 0, 0, 1747, 1755, 6, 74, -1, 0, 1748, 1749, 5, 90, 0, 0, 1749, 1750, 5, 185, 0, 0, 1750, 1755, 6, 74, -1, 0, 1751, 1752, 5, 90, 0, 0, 1752, 1753, 5, 186, 0, 0, 1753, 1755, 6, 74, -1, 0, 1754, 1716, 1, 0, 0, 0, 1754, 1718, 1, 0, 0, 0, 1754, 1720, 1, 0, 0, 0, 1754, 1722, 1, 0, 0, 0, 1754, 1724, 1, 0, 0, 0, 1754, 1726, 1, 0, 0, 0, 1754, 1728, 1, 0, 0, 0, 1754, 1730, 1, 0, 0, 0, 1754, 1732, 1, 0, 0, 0, 1754, 1734, 1, 0, 0, 0, 1754, 1736, 1, 0, 0, 0, 1754, 1738, 1, 0, 0, 0, 1754, 1740, 1, 0, 0, 0, 1754, 1742, 1, 0, 0, 0, 1754, 1745, 1, 0, 0, 0, 1754, 1748, 1, 0, 0, 0, 1754, 1751, 1, 0, 0, 0, 1755, 149, 1, 0, 0, 0, 1756, 1771, 1, 0, 0, 0, 1757, 1771, 5, 176, 0, 0, 1758, 1759, 3, 32, 16, 0, 1759, 1760, 6, 75, -1, 0, 1760, 1771, 1, 0, 0, 0, 1761, 1762, 3, 32, 16, 0, 1762, 1763, 5, 176, 0, 0, 1763, 1764, 3, 32, 16, 0, 1764, 1765, 6, 75, -1, 0, 1765, 1771, 1, 0, 0, 0, 1766, 1767, 3, 32, 16, 0, 1767, 1768, 5, 176, 0, 0, 1768, 1769, 6, 75, -1, 0, 1769, 1771, 1, 0, 0, 0, 1770, 1756, 1, 0, 0, 0, 1770, 1757, 1, 0, 0, 0, 1770, 1758, 1, 0, 0, 0, 1770, 1761, 1, 0, 0, 0, 1770, 1766, 1, 0, 0, 0, 1771, 151, 1, 0, 0, 0, 1772, 1773, 5, 1, 0, 0, 1773, 1774, 5, 193, 0, 0, 1774, 1775, 6, 76, -1, 0, 1775, 153, 1, 0, 0, 0, 1776, 1780, 5, 1, 0, 0, 1777, 1778, 5, 90, 0, 0, 1778, 1781, 5, 193, 0, 0, 1779, 1781, 5, 194, 0, 0, 1780, 1777, 1, 0, 0, 0, 1780, 1779, 1, 0, 0, 0, 1781, 1782, 1, 0, 0, 0, 1782, 1783, 6, 77, -1, 0, 1783, 155, 1, 0, 0, 0, 1784, 1785, 5, 293, 0, 0, 1785, 1786, 3, 170, 85, 0, 1786, 1787, 3, 126, 63, 0, 1787, 1788, 5, 30, 0, 0, 1788, 1789, 3, 162, 81, 0, 1789, 1790, 5, 31, 0, 0, 1790, 1791, 6, 78, -1, 0, 1791, 1839, 1, 0, 0, 0, 1792, 1793, 5, 293, 0, 0, 1793, 1794, 3, 170, 85, 0, 1794, 1795, 3, 126, 63, 0, 1795, 1796, 5, 36, 0, 0, 1796, 1797, 5, 17, 0, 0, 1797, 1798, 3, 52, 26, 0, 1798, 1799, 5, 18, 0, 0, 1799, 1800, 6, 78, -1, 0, 1800, 1839, 1, 0, 0, 0, 1801, 1802, 5, 293, 0, 0, 1802, 1803, 3, 170, 85, 0, 1803, 1804, 3, 126, 63, 0, 1804, 1805, 6, 78, -1, 0, 1805, 1839, 1, 0, 0, 0, 1806, 1807, 5, 294, 0, 0, 1807, 1808, 3, 170, 85, 0, 1808, 1810, 5, 36, 0, 0, 1809, 1811, 5, 84, 0, 0, 1810, 1809, 1, 0, 0, 0, 1810, 1811, 1, 0, 0, 0, 1811, 1812, 1, 0, 0, 0, 1812, 1813, 5, 30, 0, 0, 1813, 1814, 3, 304, 152, 0, 1814, 1815, 5, 31, 0, 0, 1815, 1816, 6, 78, -1, 0, 1816, 1839, 1, 0, 0, 0, 1817, 1818, 5, 294, 0, 0, 1818, 1819, 3, 170, 85, 0, 1819, 1820, 5, 84, 0, 0, 1820, 1821, 5, 30, 0, 0, 1821, 1822, 3, 304, 152, 0, 1822, 1823, 5, 31, 0, 0, 1823, 1824, 6, 78, -1, 0, 1824, 1839, 1, 0, 0, 0, 1825, 1826, 5, 294, 0, 0, 1826, 1827, 3, 170, 85, 0, 1827, 1828, 3, 6, 3, 0, 1828, 1829, 6, 78, -1, 0, 1829, 1839, 1, 0, 0, 0, 1830, 1831, 5, 294, 0, 0, 1831, 1832, 3, 170, 85, 0, 1832, 1833, 5, 36, 0, 0, 1833, 1834, 5, 17, 0, 0, 1834, 1835, 3, 158, 79, 0, 1835, 1836, 5, 18, 0, 0, 1836, 1837, 6, 78, -1, 0, 1837, 1839, 1, 0, 0, 0, 1838, 1784, 1, 0, 0, 0, 1838, 1792, 1, 0, 0, 0, 1838, 1801, 1, 0, 0, 0, 1838, 1806, 1, 0, 0, 0, 1838, 1817, 1, 0, 0, 0, 1838, 1825, 1, 0, 0, 0, 1838, 1830, 1, 0, 0, 0, 1839, 157, 1, 0, 0, 0, 1840, 1854, 1, 0, 0, 0, 1841, 1842, 3, 160, 80, 0, 1842, 1843, 6, 79, -1, 0, 1843, 1844, 5, 28, 0, 0, 1844, 1846, 1, 0, 0, 0, 1845, 1841, 1, 0, 0, 0, 1846, 1849, 1, 0, 0, 0, 1847, 1845, 1, 0, 0, 0, 1847, 1848, 1, 0, 0, 0, 1848, 1850, 1, 0, 0, 0, 1849, 1847, 1, 0, 0, 0, 1850, 1851, 3, 160, 80, 0, 1851, 1852, 6, 79, -1, 0, 1852, 1854, 1, 0, 0, 0, 1853, 1840, 1, 0, 0, 0, 1853, 1847, 1, 0, 0, 0, 1854, 159, 1, 0, 0, 0, 1855, 1856, 5, 39, 0, 0, 1856, 1857, 5, 263, 0, 0, 1857, 1858, 5, 36, 0, 0, 1858, 1859, 5, 17, 0, 0, 1859, 1860, 3, 56, 28, 0, 1860, 1861, 5, 18, 0, 0, 1861, 1862, 6, 80, -1, 0, 1862, 1871, 1, 0, 0, 0, 1863, 1864, 3, 126, 63, 0, 1864, 1865, 5, 36, 0, 0, 1865, 1866, 5, 17, 0, 0, 1866, 1867, 3, 56, 28, 0, 1867, 1868, 5, 18, 0, 0, 1868, 1869, 6, 80, -1, 0, 1869, 1871, 1, 0, 0, 0, 1870, 1855, 1, 0, 0, 0, 1870, 1863, 1, 0, 0, 0, 1871, 161, 1, 0, 0, 0, 1872, 1873, 3, 164, 82, 0, 1873, 1874, 6, 81, -1, 0, 1874, 1875, 5, 28, 0, 0, 1875, 1877, 1, 0, 0, 0, 1876, 1872, 1, 0, 0, 0, 1877, 1880, 1, 0, 0, 0, 1878, 1876, 1, 0, 0, 0, 1878, 1879, 1, 0, 0, 0, 1879, 1881, 1, 0, 0, 0, 1880, 1878, 1, 0, 0, 0, 1881, 1882, 3, 164, 82, 0, 1882, 1883, 6, 81, -1, 0, 1883, 163, 1, 0, 0, 0, 1884, 1885, 3, 6, 3, 0, 1885, 1886, 5, 36, 0, 0, 1886, 1887, 3, 168, 84, 0, 1887, 1888, 6, 82, -1, 0, 1888, 165, 1, 0, 0, 0, 1889, 1890, 7, 9, 0, 0, 1890, 167, 1, 0, 0, 0, 1891, 1892, 3, 166, 83, 0, 1892, 1893, 6, 84, -1, 0, 1893, 1937, 1, 0, 0, 0, 1894, 1895, 3, 32, 16, 0, 1895, 1896, 6, 84, -1, 0, 1896, 1937, 1, 0, 0, 0, 1897, 1898, 5, 185, 0, 0, 1898, 1899, 5, 30, 0, 0, 1899, 1900, 3, 32, 16, 0, 1900, 1901, 5, 31, 0, 0, 1901, 1902, 6, 84, -1, 0, 1902, 1937, 1, 0, 0, 0, 1903, 1904, 3, 6, 3, 0, 1904, 1905, 6, 84, -1, 0, 1905, 1937, 1, 0, 0, 0, 1906, 1907, 3, 118, 59, 0, 1907, 1908, 5, 30, 0, 0, 1908, 1909, 5, 183, 0, 0, 1909, 1910, 5, 75, 0, 0, 1910, 1911, 3, 32, 16, 0, 1911, 1912, 5, 31, 0, 0, 1912, 1913, 6, 84, -1, 0, 1913, 1937, 1, 0, 0, 0, 1914, 1915, 3, 118, 59, 0, 1915, 1916, 5, 30, 0, 0, 1916, 1917, 5, 184, 0, 0, 1917, 1918, 5, 75, 0, 0, 1918, 1919, 3, 32, 16, 0, 1919, 1920, 5, 31, 0, 0, 1920, 1921, 6, 84, -1, 0, 1921, 1937, 1, 0, 0, 0, 1922, 1923, 3, 118, 59, 0, 1923, 1924, 5, 30, 0, 0, 1924, 1925, 5, 185, 0, 0, 1925, 1926, 5, 75, 0, 0, 1926, 1927, 3, 32, 16, 0, 1927, 1928, 5, 31, 0, 0, 1928, 1929, 6, 84, -1, 0, 1929, 1937, 1, 0, 0, 0, 1930, 1931, 3, 118, 59, 0, 1931, 1932, 5, 30, 0, 0, 1932, 1933, 3, 32, 16, 0, 1933, 1934, 5, 31, 0, 0, 1934, 1935, 6, 84, -1, 0, 1935, 1937, 1, 0, 0, 0, 1936, 1891, 1, 0, 0, 0, 1936, 1894, 1, 0, 0, 0, 1936, 1897, 1, 0, 0, 0, 1936, 1903, 1, 0, 0, 0, 1936, 1906, 1, 0, 0, 0, 1936, 1914, 1, 0, 0, 0, 1936, 1922, 1, 0, 0, 0, 1936, 1930, 1, 0, 0, 0, 1937, 169, 1, 0, 0, 0, 1938, 1939, 7, 10, 0, 0, 1939, 171, 1, 0, 0, 0, 1940, 1941, 3, 174, 87, 0, 1941, 1942, 3, 142, 71, 0, 1942, 1943, 3, 128, 64, 0, 1943, 1944, 5, 175, 0, 0, 1944, 1946, 3, 246, 123, 0, 1945, 1947, 3, 110, 55, 0, 1946, 1945, 1, 0, 0, 0, 1946, 1947, 1, 0, 0, 0, 1947, 1948, 1, 0, 0, 0, 1948, 1949, 3, 114, 57, 0, 1949, 1950, 6, 86, -1, 0, 1950, 1983, 1, 0, 0, 0, 1951, 1952, 3, 174, 87, 0, 1952, 1953, 3, 142, 71, 0, 1953, 1954, 3, 128, 64, 0, 1954, 1955, 5, 175, 0, 0, 1955, 1956, 3, 246, 123, 0, 1956, 1957, 3, 200, 100, 0, 1957, 1958, 3, 114, 57, 0, 1958, 1959, 6, 86, -1, 0, 1959, 1983, 1, 0, 0, 0, 1960, 1961, 3, 174, 87, 0, 1961, 1962, 3, 142, 71, 0, 1962, 1964, 3, 246, 123, 0, 1963, 1965, 3, 110, 55, 0, 1964, 1963, 1, 0, 0, 0, 1964, 1965, 1, 0, 0, 0, 1965, 1966, 1, 0, 0, 0, 1966, 1967, 3, 114, 57, 0, 1967, 1968, 6, 86, -1, 0, 1968, 1983, 1, 0, 0, 0, 1969, 1970, 3, 174, 87, 0, 1970, 1971, 3, 142, 71, 0, 1971, 1972, 3, 246, 123, 0, 1972, 1973, 3, 200, 100, 0, 1973, 1974, 3, 114, 57, 0, 1974, 1975, 6, 86, -1, 0, 1975, 1983, 1, 0, 0, 0, 1976, 1977, 3, 178, 89, 0, 1977, 1978, 6, 86, -1, 0, 1978, 1983, 1, 0, 0, 0, 1979, 1980, 3, 2, 1, 0, 1980, 1981, 6, 86, -1, 0, 1981, 1983, 1, 0, 0, 0, 1982, 1940, 1, 0, 0, 0, 1982, 1951, 1, 0, 0, 0, 1982, 1960, 1, 0, 0, 0, 1982, 1969, 1, 0, 0, 0, 1982, 1976, 1, 0, 0, 0, 1982, 1979, 1, 0, 0, 0, 1983, 173, 1, 0, 0, 0, 1984, 1985, 5, 242, 0, 0, 1985, 1986, 3, 174, 87, 0, 1986, 1987, 6, 87, -1, 0, 1987, 2002, 1, 0, 0, 0, 1988, 1989, 5, 243, 0, 0, 1989, 1990, 3, 174, 87, 0, 1990, 1991, 6, 87, -1, 0, 1991, 2002, 1, 0, 0, 0, 1992, 1993, 3, 176, 88, 0, 1993, 1994, 6, 87, -1, 0, 1994, 2002, 1, 0, 0, 0, 1995, 1996, 5, 112, 0, 0, 1996, 1997, 5, 30, 0, 0, 1997, 1998, 3, 32, 16, 0, 1998, 1999, 5, 31, 0, 0, 1999, 2000, 6, 87, -1, 0, 2000, 2002, 1, 0, 0, 0, 2001, 1984, 1, 0, 0, 0, 2001, 1988, 1, 0, 0, 0, 2001, 1992, 1, 0, 0, 0, 2001, 1995, 1, 0, 0, 0, 2002, 175, 1, 0, 0, 0, 2003, 2023, 1, 0, 0, 0, 2004, 2005, 5, 244, 0, 0, 2005, 2023, 6, 88, -1, 0, 2006, 2007, 5, 245, 0, 0, 2007, 2023, 6, 88, -1, 0, 2008, 2009, 5, 246, 0, 0, 2009, 2010, 5, 247, 0, 0, 2010, 2023, 6, 88, -1, 0, 2011, 2012, 5, 246, 0, 0, 2012, 2013, 5, 248, 0, 0, 2013, 2023, 6, 88, -1, 0, 2014, 2015, 5, 246, 0, 0, 2015, 2016, 5, 249, 0, 0, 2016, 2023, 6, 88, -1, 0, 2017, 2018, 5, 246, 0, 0, 2018, 2019, 5, 250, 0, 0, 2019, 2023, 6, 88, -1, 0, 2020, 2021, 5, 246, 0, 0, 2021, 2023, 6, 88, -1, 0, 2022, 2003, 1, 0, 0, 0, 2022, 2004, 1, 0, 0, 0, 2022, 2006, 1, 0, 0, 0, 2022, 2008, 1, 0, 0, 0, 2022, 2011, 1, 0, 0, 0, 2022, 2014, 1, 0, 0, 0, 2022, 2017, 1, 0, 0, 0, 2022, 2020, 1, 0, 0, 0, 2023, 177, 1, 0, 0, 0, 2024, 2025, 5, 113, 0, 0, 2025, 2026, 5, 30, 0, 0, 2026, 2027, 3, 32, 16, 0, 2027, 2028, 5, 31, 0, 0, 2028, 2029, 6, 89, -1, 0, 2029, 179, 1, 0, 0, 0, 2030, 2031, 5, 225, 0, 0, 2031, 2032, 3, 172, 86, 0, 2032, 2033, 6, 90, -1, 0, 2033, 2042, 1, 0, 0, 0, 2034, 2035, 5, 37, 0, 0, 2035, 2036, 3, 182, 91, 0, 2036, 2037, 6, 90, -1, 0, 2037, 2042, 1, 0, 0, 0, 2038, 2039, 3, 178, 89, 0, 2039, 2040, 6, 90, -1, 0, 2040, 2042, 1, 0, 0, 0, 2041, 2030, 1, 0, 0, 0, 2041, 2034, 1, 0, 0, 0, 2041, 2038, 1, 0, 0, 0, 2042, 181, 1, 0, 0, 0, 2043, 2044, 3, 142, 71, 0, 2044, 2045, 3, 128, 64, 0, 2045, 2046, 5, 175, 0, 0, 2046, 2047, 3, 2, 1, 0, 2047, 2048, 6, 91, -1, 0, 2048, 2057, 1, 0, 0, 0, 2049, 2050, 3, 142, 71, 0, 2050, 2051, 3, 2, 1, 0, 2051, 2052, 6, 91, -1, 0, 2052, 2057, 1, 0, 0, 0, 2053, 2054, 3, 2, 1, 0, 2054, 2055, 6, 91, -1, 0, 2055, 2057, 1, 0, 0, 0, 2056, 2043, 1, 0, 0, 0, 2056, 2049, 1, 0, 0, 0, 2056, 2053, 1, 0, 0, 0, 2057, 183, 1, 0, 0, 0, 2058, 2059, 3, 126, 63, 0, 2059, 2060, 6, 92, -1, 0, 2060, 2061, 5, 28, 0, 0, 2061, 2063, 1, 0, 0, 0, 2062, 2058, 1, 0, 0, 0, 2063, 2066, 1, 0, 0, 0, 2064, 2062, 1, 0, 0, 0, 2064, 2065, 1, 0, 0, 0, 2065, 2067, 1, 0, 0, 0, 2066, 2064, 1, 0, 0, 0, 2067, 2068, 3, 126, 63, 0, 2068, 2069, 6, 92, -1, 0, 2069, 185, 1, 0, 0, 0, 2070, 2077, 1, 0, 0, 0, 2071, 2072, 5, 86, 0, 0, 2072, 2073, 3, 194, 97, 0, 2073, 2074, 5, 87, 0, 0, 2074, 2075, 6, 93, -1, 0, 2075, 2077, 1, 0, 0, 0, 2076, 2070, 1, 0, 0, 0, 2076, 2071, 1, 0, 0, 0, 2077, 187, 1, 0, 0, 0, 2078, 2079, 5, 265, 0, 0, 2079, 2097, 6, 94, -1, 0, 2080, 2081, 5, 114, 0, 0, 2081, 2097, 6, 94, -1, 0, 2082, 2083, 5, 39, 0, 0, 2083, 2097, 6, 94, -1, 0, 2084, 2085, 5, 199, 0, 0, 2085, 2097, 6, 94, -1, 0, 2086, 2087, 5, 115, 0, 0, 2087, 2097, 6, 94, -1, 0, 2088, 2089, 5, 116, 0, 0, 2089, 2097, 6, 94, -1, 0, 2090, 2091, 5, 70, 0, 0, 2091, 2092, 5, 30, 0, 0, 2092, 2093, 3, 32, 16, 0, 2093, 2094, 5, 31, 0, 0, 2094, 2095, 6, 94, -1, 0, 2095, 2097, 1, 0, 0, 0, 2096, 2078, 1, 0, 0, 0, 2096, 2080, 1, 0, 0, 0, 2096, 2082, 1, 0, 0, 0, 2096, 2084, 1, 0, 0, 0, 2096, 2086, 1, 0, 0, 0, 2096, 2088, 1, 0, 0, 0, 2096, 2090, 1, 0, 0, 0, 2097, 189, 1, 0, 0, 0, 2098, 2099, 3, 188, 94, 0, 2099, 2100, 6, 95, -1, 0, 2100, 2102, 1, 0, 0, 0, 2101, 2098, 1, 0, 0, 0, 2102, 2105, 1, 0, 0, 0, 2103, 2101, 1, 0, 0, 0, 2103, 2104, 1, 0, 0, 0, 2104, 191, 1, 0, 0, 0, 2105, 2103, 1, 0, 0, 0, 2106, 2108, 3, 190, 95, 0, 2107, 2109, 3, 196, 98, 0, 2108, 2107, 1, 0, 0, 0, 2108, 2109, 1, 0, 0, 0, 2109, 2110, 1, 0, 0, 0, 2110, 2111, 3, 2, 1, 0, 2111, 2112, 6, 96, -1, 0, 2112, 193, 1, 0, 0, 0, 2113, 2114, 3, 192, 96, 0, 2114, 2115, 6, 97, -1, 0, 2115, 2116, 5, 28, 0, 0, 2116, 2118, 1, 0, 0, 0, 2117, 2113, 1, 0, 0, 0, 2118, 2121, 1, 0, 0, 0, 2119, 2117, 1, 0, 0, 0, 2119, 2120, 1, 0, 0, 0, 2120, 2122, 1, 0, 0, 0, 2121, 2119, 1, 0, 0, 0, 2122, 2123, 3, 192, 96, 0, 2123, 2124, 6, 97, -1, 0, 2124, 195, 1, 0, 0, 0, 2125, 2126, 5, 30, 0, 0, 2126, 2127, 3, 184, 92, 0, 2127, 2128, 5, 31, 0, 0, 2128, 2129, 6, 98, -1, 0, 2129, 197, 1, 0, 0, 0, 2130, 2132, 3, 200, 100, 0, 2131, 2130, 1, 0, 0, 0, 2131, 2132, 1, 0, 0, 0, 2132, 2133, 1, 0, 0, 0, 2133, 2134, 6, 99, -1, 0, 2134, 199, 1, 0, 0, 0, 2135, 2136, 5, 86, 0, 0, 2136, 2137, 5, 42, 0, 0, 2137, 2138, 3, 32, 16, 0, 2138, 2139, 5, 43, 0, 0, 2139, 2140, 5, 87, 0, 0, 2140, 2141, 6, 100, -1, 0, 2141, 201, 1, 0, 0, 0, 2142, 2143, 3, 238, 119, 0, 2143, 2144, 5, 17, 0, 0, 2144, 2145, 3, 250, 125, 0, 2145, 2146, 5, 18, 0, 0, 2146, 2293, 1, 0, 0, 0, 2147, 2148, 3, 76, 38, 0, 2148, 2149, 5, 17, 0, 0, 2149, 2150, 3, 84, 42, 0, 2150, 2151, 5, 18, 0, 0, 2151, 2293, 1, 0, 0, 0, 2152, 2153, 3, 214, 107, 0, 2153, 2154, 6, 101, -1, 0, 2154, 2155, 5, 17, 0, 0, 2155, 2156, 3, 218, 109, 0, 2156, 2157, 5, 18, 0, 0, 2157, 2293, 1, 0, 0, 0, 2158, 2159, 3, 222, 111, 0, 2159, 2160, 6, 101, -1, 0, 2160, 2161, 5, 17, 0, 0, 2161, 2162, 3, 226, 113, 0, 2162, 2163, 5, 18, 0, 0, 2163, 2293, 1, 0, 0, 0, 2164, 2293, 3, 204, 102, 0, 2165, 2166, 3, 288, 144, 0, 2166, 2167, 6, 101, -1, 0, 2167, 2293, 1, 0, 0, 0, 2168, 2169, 3, 156, 78, 0, 2169, 2170, 6, 101, -1, 0, 2170, 2293, 1, 0, 0, 0, 2171, 2172, 3, 90, 45, 0, 2172, 2173, 6, 101, -1, 0, 2173, 2293, 1, 0, 0, 0, 2174, 2175, 3, 334, 167, 0, 2175, 2176, 6, 101, -1, 0, 2176, 2293, 1, 0, 0, 0, 2177, 2178, 5, 117, 0, 0, 2178, 2179, 3, 32, 16, 0, 2179, 2180, 6, 101, -1, 0, 2180, 2293, 1, 0, 0, 0, 2181, 2182, 5, 118, 0, 0, 2182, 2183, 3, 32, 16, 0, 2183, 2184, 6, 101, -1, 0, 2184, 2293, 1, 0, 0, 0, 2185, 2186, 3, 350, 175, 0, 2186, 2187, 5, 17, 0, 0, 2187, 2188, 3, 356, 178, 0, 2188, 2189, 5, 18, 0, 0, 2189, 2190, 6, 101, -1, 0, 2190, 2293, 1, 0, 0, 0, 2191, 2192, 5, 301, 0, 0, 2192, 2193, 3, 128, 64, 0, 2193, 2194, 5, 175, 0, 0, 2194, 2195, 3, 246, 123, 0, 2195, 2196, 5, 119, 0, 0, 2196, 2197, 3, 174, 87, 0, 2197, 2198, 3, 142, 71, 0, 2198, 2199, 3, 128, 64, 0, 2199, 2200, 5, 175, 0, 0, 2200, 2201, 3, 246, 123, 0, 2201, 2202, 3, 114, 57, 0, 2202, 2203, 6, 101, -1, 0, 2203, 2293, 1, 0, 0, 0, 2204, 2205, 5, 301, 0, 0, 2205, 2206, 5, 225, 0, 0, 2206, 2207, 3, 174, 87, 0, 2207, 2208, 3, 142, 71, 0, 2208, 2209, 3, 128, 64, 0, 2209, 2210, 5, 175, 0, 0, 2210, 2211, 3, 246, 123, 0, 2211, 2212, 3, 198, 99, 0, 2212, 2213, 3, 114, 57, 0, 2213, 2214, 5, 119, 0, 0, 2214, 2215, 5, 225, 0, 0, 2215, 2216, 3, 174, 87, 0, 2216, 2217, 3, 142, 71, 0, 2217, 2218, 3, 128, 64, 0, 2218, 2219, 5, 175, 0, 0, 2219, 2220, 3, 246, 123, 0, 2220, 2221, 3, 198, 99, 0, 2221, 2222, 3, 114, 57, 0, 2222, 2223, 6, 101, -1, 0, 2223, 2293, 1, 0, 0, 0, 2224, 2225, 3, 26, 13, 0, 2225, 2226, 6, 101, -1, 0, 2226, 2293, 1, 0, 0, 0, 2227, 2228, 3, 40, 20, 0, 2228, 2229, 6, 101, -1, 0, 2229, 2293, 1, 0, 0, 0, 2230, 2231, 5, 254, 0, 0, 2231, 2232, 5, 195, 0, 0, 2232, 2233, 5, 42, 0, 0, 2233, 2234, 3, 32, 16, 0, 2234, 2235, 5, 43, 0, 0, 2235, 2241, 6, 101, -1, 0, 2236, 2237, 3, 334, 167, 0, 2237, 2238, 6, 101, -1, 0, 2238, 2240, 1, 0, 0, 0, 2239, 2236, 1, 0, 0, 0, 2240, 2243, 1, 0, 0, 0, 2241, 2239, 1, 0, 0, 0, 2241, 2242, 1, 0, 0, 0, 2242, 2293, 1, 0, 0, 0, 2243, 2241, 1, 0, 0, 0, 2244, 2245, 5, 254, 0, 0, 2245, 2246, 5, 195, 0, 0, 2246, 2247, 3, 2, 1, 0, 2247, 2253, 6, 101, -1, 0, 2248, 2249, 3, 334, 167, 0, 2249, 2250, 6, 101, -1, 0, 2250, 2252, 1, 0, 0, 0, 2251, 2248, 1, 0, 0, 0, 2252, 2255, 1, 0, 0, 0, 2253, 2251, 1, 0, 0, 0, 2253, 2254, 1, 0, 0, 0, 2254, 2293, 1, 0, 0, 0, 2255, 2253, 1, 0, 0, 0, 2256, 2257, 5, 254, 0, 0, 2257, 2258, 5, 255, 0, 0, 2258, 2259, 5, 42, 0, 0, 2259, 2260, 3, 32, 16, 0, 2260, 2261, 5, 43, 0, 0, 2261, 2262, 5, 28, 0, 0, 2262, 2263, 3, 126, 63, 0, 2263, 2269, 6, 101, -1, 0, 2264, 2265, 3, 334, 167, 0, 2265, 2266, 6, 101, -1, 0, 2266, 2268, 1, 0, 0, 0, 2267, 2264, 1, 0, 0, 0, 2268, 2271, 1, 0, 0, 0, 2269, 2267, 1, 0, 0, 0, 2269, 2270, 1, 0, 0, 0, 2270, 2293, 1, 0, 0, 0, 2271, 2269, 1, 0, 0, 0, 2272, 2273, 5, 254, 0, 0, 2273, 2274, 5, 255, 0, 0, 2274, 2275, 3, 2, 1, 0, 2275, 2276, 5, 28, 0, 0, 2276, 2277, 3, 126, 63, 0, 2277, 2283, 6, 101, -1, 0, 2278, 2279, 3, 334, 167, 0, 2279, 2280, 6, 101, -1, 0, 2280, 2282, 1, 0, 0, 0, 2281, 2278, 1, 0, 0, 0, 2282, 2285, 1, 0, 0, 0, 2283, 2281, 1, 0, 0, 0, 2283, 2284, 1, 0, 0, 0, 2284, 2293, 1, 0, 0, 0, 2285, 2283, 1, 0, 0, 0, 2286, 2287, 5, 120, 0, 0, 2287, 2288, 5, 195, 0, 0, 2288, 2289, 3, 126, 63, 0, 2289, 2290, 3, 44, 22, 0, 2290, 2291, 6, 101, -1, 0, 2291, 2293, 1, 0, 0, 0, 2292, 2142, 1, 0, 0, 0, 2292, 2147, 1, 0, 0, 0, 2292, 2152, 1, 0, 0, 0, 2292, 2158, 1, 0, 0, 0, 2292, 2164, 1, 0, 0, 0, 2292, 2165, 1, 0, 0, 0, 2292, 2168, 1, 0, 0, 0, 2292, 2171, 1, 0, 0, 0, 2292, 2174, 1, 0, 0, 0, 2292, 2177, 1, 0, 0, 0, 2292, 2181, 1, 0, 0, 0, 2292, 2185, 1, 0, 0, 0, 2292, 2191, 1, 0, 0, 0, 2292, 2204, 1, 0, 0, 0, 2292, 2224, 1, 0, 0, 0, 2292, 2227, 1, 0, 0, 0, 2292, 2230, 1, 0, 0, 0, 2292, 2244, 1, 0, 0, 0, 2292, 2256, 1, 0, 0, 0, 2292, 2272, 1, 0, 0, 0, 2292, 2286, 1, 0, 0, 0, 2293, 203, 1, 0, 0, 0, 2294, 2295, 5, 121, 0, 0, 2295, 2307, 3, 212, 106, 0, 2296, 2297, 3, 206, 103, 0, 2297, 2298, 6, 102, -1, 0, 2298, 2306, 1, 0, 0, 0, 2299, 2300, 5, 122, 0, 0, 2300, 2301, 5, 30, 0, 0, 2301, 2302, 3, 232, 116, 0, 2302, 2303, 5, 31, 0, 0, 2303, 2304, 6, 102, -1, 0, 2304, 2306, 1, 0, 0, 0, 2305, 2296, 1, 0, 0, 0, 2305, 2299, 1, 0, 0, 0, 2306, 2309, 1, 0, 0, 0, 2307, 2305, 1, 0, 0, 0, 2307, 2308, 1, 0, 0, 0, 2308, 2310, 1, 0, 0, 0, 2309, 2307, 1, 0, 0, 0, 2310, 2311, 3, 142, 71, 0, 2311, 2312, 3, 2, 1, 0, 2312, 2313, 3, 208, 104, 0, 2313, 2314, 3, 210, 105, 0, 2314, 2315, 6, 102, -1, 0, 2315, 205, 1, 0, 0, 0, 2316, 2317, 5, 123, 0, 0, 2317, 2351, 6, 103, -1, 0, 2318, 2319, 5, 51, 0, 0, 2319, 2351, 6, 103, -1, 0, 2320, 2321, 5, 52, 0, 0, 2321, 2351, 6, 103, -1, 0, 2322, 2323, 5, 63, 0, 0, 2323, 2351, 6, 103, -1, 0, 2324, 2325, 5, 124, 0, 0, 2325, 2351, 6, 103, -1, 0, 2326, 2327, 5, 69, 0, 0, 2327, 2351, 6, 103, -1, 0, 2328, 2329, 5, 68, 0, 0, 2329, 2351, 6, 103, -1, 0, 2330, 2331, 5, 64, 0, 0, 2331, 2351, 6, 103, -1, 0, 2332, 2333, 5, 65, 0, 0, 2333, 2351, 6, 103, -1, 0, 2334, 2335, 5, 66, 0, 0, 2335, 2351, 6, 103, -1, 0, 2336, 2337, 5, 125, 0, 0, 2337, 2351, 6, 103, -1, 0, 2338, 2339, 5, 126, 0, 0, 2339, 2351, 6, 103, -1, 0, 2340, 2341, 5, 127, 0, 0, 2341, 2351, 6, 103, -1, 0, 2342, 2343, 5, 16, 0, 0, 2343, 2351, 6, 103, -1, 0, 2344, 2345, 5, 70, 0, 0, 2345, 2346, 5, 30, 0, 0, 2346, 2347, 3, 32, 16, 0, 2347, 2348, 5, 31, 0, 0, 2348, 2349, 6, 103, -1, 0, 2349, 2351, 1, 0, 0, 0, 2350, 2316, 1, 0, 0, 0, 2350, 2318, 1, 0, 0, 0, 2350, 2320, 1, 0, 0, 0, 2350, 2322, 1, 0, 0, 0, 2350, 2324, 1, 0, 0, 0, 2350, 2326, 1, 0, 0, 0, 2350, 2328, 1, 0, 0, 0, 2350, 2330, 1, 0, 0, 0, 2350, 2332, 1, 0, 0, 0, 2350, 2334, 1, 0, 0, 0, 2350, 2336, 1, 0, 0, 0, 2350, 2338, 1, 0, 0, 0, 2350, 2340, 1, 0, 0, 0, 2350, 2342, 1, 0, 0, 0, 2350, 2344, 1, 0, 0, 0, 2351, 207, 1, 0, 0, 0, 2352, 2362, 1, 0, 0, 0, 2353, 2354, 5, 44, 0, 0, 2354, 2355, 3, 0, 0, 0, 2355, 2356, 6, 104, -1, 0, 2356, 2362, 1, 0, 0, 0, 2357, 2358, 5, 44, 0, 0, 2358, 2359, 3, 32, 16, 0, 2359, 2360, 6, 104, -1, 0, 2360, 2362, 1, 0, 0, 0, 2361, 2352, 1, 0, 0, 0, 2361, 2353, 1, 0, 0, 0, 2361, 2357, 1, 0, 0, 0, 2362, 209, 1, 0, 0, 0, 2363, 2369, 1, 0, 0, 0, 2364, 2365, 5, 36, 0, 0, 2365, 2366, 3, 308, 154, 0, 2366, 2367, 6, 105, -1, 0, 2367, 2369, 1, 0, 0, 0, 2368, 2363, 1, 0, 0, 0, 2368, 2364, 1, 0, 0, 0, 2369, 211, 1, 0, 0, 0, 2370, 2377, 1, 0, 0, 0, 2371, 2372, 5, 42, 0, 0, 2372, 2373, 3, 32, 16, 0, 2373, 2374, 5, 43, 0, 0, 2374, 2375, 6, 106, -1, 0, 2375, 2377, 1, 0, 0, 0, 2376, 2370, 1, 0, 0, 0, 2376, 2371, 1, 0, 0, 0, 2377, 213, 1, 0, 0, 0, 2378, 2384, 5, 128, 0, 0, 2379, 2380, 3, 216, 108, 0, 2380, 2381, 6, 107, -1, 0, 2381, 2383, 1, 0, 0, 0, 2382, 2379, 1, 0, 0, 0, 2383, 2386, 1, 0, 0, 0, 2384, 2382, 1, 0, 0, 0, 2384, 2385, 1, 0, 0, 0, 2385, 2387, 1, 0, 0, 0, 2386, 2384, 1, 0, 0, 0, 2387, 2388, 3, 126, 63, 0, 2388, 2389, 3, 2, 1, 0, 2389, 2390, 6, 107, -1, 0, 2390, 2404, 1, 0, 0, 0, 2391, 2397, 5, 128, 0, 0, 2392, 2393, 3, 216, 108, 0, 2393, 2394, 6, 107, -1, 0, 2394, 2396, 1, 0, 0, 0, 2395, 2392, 1, 0, 0, 0, 2396, 2399, 1, 0, 0, 0, 2397, 2395, 1, 0, 0, 0, 2397, 2398, 1, 0, 0, 0, 2398, 2400, 1, 0, 0, 0, 2399, 2397, 1, 0, 0, 0, 2400, 2401, 3, 2, 1, 0, 2401, 2402, 6, 107, -1, 0, 2402, 2404, 1, 0, 0, 0, 2403, 2378, 1, 0, 0, 0, 2403, 2391, 1, 0, 0, 0, 2404, 215, 1, 0, 0, 0, 2405, 2406, 5, 69, 0, 0, 2406, 2410, 6, 108, -1, 0, 2407, 2408, 5, 68, 0, 0, 2408, 2410, 6, 108, -1, 0, 2409, 2405, 1, 0, 0, 0, 2409, 2407, 1, 0, 0, 0, 2410, 217, 1, 0, 0, 0, 2411, 2413, 3, 220, 110, 0, 2412, 2411, 1, 0, 0, 0, 2413, 2416, 1, 0, 0, 0, 2414, 2412, 1, 0, 0, 0, 2414, 2415, 1, 0, 0, 0, 2415, 219, 1, 0, 0, 0, 2416, 2414, 1, 0, 0, 0, 2417, 2418, 5, 129, 0, 0, 2418, 2419, 3, 172, 86, 0, 2419, 2420, 6, 110, -1, 0, 2420, 2444, 1, 0, 0, 0, 2421, 2422, 5, 130, 0, 0, 2422, 2423, 3, 172, 86, 0, 2423, 2424, 6, 110, -1, 0, 2424, 2444, 1, 0, 0, 0, 2425, 2426, 5, 131, 0, 0, 2426, 2427, 3, 172, 86, 0, 2427, 2428, 6, 110, -1, 0, 2428, 2444, 1, 0, 0, 0, 2429, 2430, 5, 132, 0, 0, 2430, 2431, 3, 172, 86, 0, 2431, 2432, 6, 110, -1, 0, 2432, 2444, 1, 0, 0, 0, 2433, 2434, 3, 90, 45, 0, 2434, 2435, 6, 110, -1, 0, 2435, 2444, 1, 0, 0, 0, 2436, 2437, 3, 334, 167, 0, 2437, 2438, 6, 110, -1, 0, 2438, 2444, 1, 0, 0, 0, 2439, 2440, 3, 26, 13, 0, 2440, 2441, 6, 110, -1, 0, 2441, 2444, 1, 0, 0, 0, 2442, 2444, 3, 40, 20, 0, 2443, 2417, 1, 0, 0, 0, 2443, 2421, 1, 0, 0, 0, 2443, 2425, 1, 0, 0, 0, 2443, 2429, 1, 0, 0, 0, 2443, 2433, 1, 0, 0, 0, 2443, 2436, 1, 0, 0, 0, 2443, 2439, 1, 0, 0, 0, 2443, 2442, 1, 0, 0, 0, 2444, 221, 1, 0, 0, 0, 2445, 2451, 5, 133, 0, 0, 2446, 2447, 3, 224, 112, 0, 2447, 2448, 6, 111, -1, 0, 2448, 2450, 1, 0, 0, 0, 2449, 2446, 1, 0, 0, 0, 2450, 2453, 1, 0, 0, 0, 2451, 2449, 1, 0, 0, 0, 2451, 2452, 1, 0, 0, 0, 2452, 2454, 1, 0, 0, 0, 2453, 2451, 1, 0, 0, 0, 2454, 2455, 3, 174, 87, 0, 2455, 2456, 3, 142, 71, 0, 2456, 2457, 3, 2, 1, 0, 2457, 2458, 3, 114, 57, 0, 2458, 2459, 3, 210, 105, 0, 2459, 2460, 6, 111, -1, 0, 2460, 223, 1, 0, 0, 0, 2461, 2462, 5, 69, 0, 0, 2462, 2466, 6, 112, -1, 0, 2463, 2464, 5, 68, 0, 0, 2464, 2466, 6, 112, -1, 0, 2465, 2461, 1, 0, 0, 0, 2465, 2463, 1, 0, 0, 0, 2466, 225, 1, 0, 0, 0, 2467, 2469, 3, 228, 114, 0, 2468, 2467, 1, 0, 0, 0, 2469, 2472, 1, 0, 0, 0, 2470, 2468, 1, 0, 0, 0, 2470, 2471, 1, 0, 0, 0, 2471, 227, 1, 0, 0, 0, 2472, 2470, 1, 0, 0, 0, 2473, 2474, 5, 134, 0, 0, 2474, 2475, 3, 172, 86, 0, 2475, 2476, 6, 114, -1, 0, 2476, 2496, 1, 0, 0, 0, 2477, 2478, 5, 135, 0, 0, 2478, 2479, 3, 172, 86, 0, 2479, 2480, 6, 114, -1, 0, 2480, 2496, 1, 0, 0, 0, 2481, 2482, 5, 132, 0, 0, 2482, 2483, 3, 172, 86, 0, 2483, 2484, 6, 114, -1, 0, 2484, 2496, 1, 0, 0, 0, 2485, 2486, 3, 334, 167, 0, 2486, 2487, 6, 114, -1, 0, 2487, 2496, 1, 0, 0, 0, 2488, 2489, 3, 90, 45, 0, 2489, 2490, 6, 114, -1, 0, 2490, 2496, 1, 0, 0, 0, 2491, 2492, 3, 26, 13, 0, 2492, 2493, 6, 114, -1, 0, 2493, 2496, 1, 0, 0, 0, 2494, 2496, 3, 40, 20, 0, 2495, 2473, 1, 0, 0, 0, 2495, 2477, 1, 0, 0, 0, 2495, 2481, 1, 0, 0, 0, 2495, 2485, 1, 0, 0, 0, 2495, 2488, 1, 0, 0, 0, 2495, 2491, 1, 0, 0, 0, 2495, 2494, 1, 0, 0, 0, 2496, 229, 1, 0, 0, 0, 2497, 2505, 6, 115, -1, 0, 2498, 2499, 5, 122, 0, 0, 2499, 2500, 5, 30, 0, 0, 2500, 2501, 3, 232, 116, 0, 2501, 2502, 5, 31, 0, 0, 2502, 2503, 6, 115, -1, 0, 2503, 2505, 1, 0, 0, 0, 2504, 2497, 1, 0, 0, 0, 2504, 2498, 1, 0, 0, 0, 2505, 231, 1, 0, 0, 0, 2506, 2507, 3, 130, 65, 0, 2507, 2508, 6, 116, -1, 0, 2508, 2520, 1, 0, 0, 0, 2509, 2513, 5, 17, 0, 0, 2510, 2511, 3, 306, 153, 0, 2511, 2512, 6, 116, -1, 0, 2512, 2514, 1, 0, 0, 0, 2513, 2510, 1, 0, 0, 0, 2514, 2515, 1, 0, 0, 0, 2515, 2513, 1, 0, 0, 0, 2515, 2516, 1, 0, 0, 0, 2516, 2517, 1, 0, 0, 0, 2517, 2518, 5, 18, 0, 0, 2518, 2520, 1, 0, 0, 0, 2519, 2506, 1, 0, 0, 0, 2519, 2509, 1, 0, 0, 0, 2520, 233, 1, 0, 0, 0, 2521, 2522, 3, 236, 118, 0, 2522, 2523, 6, 117, -1, 0, 2523, 2525, 1, 0, 0, 0, 2524, 2521, 1, 0, 0, 0, 2525, 2528, 1, 0, 0, 0, 2526, 2524, 1, 0, 0, 0, 2526, 2527, 1, 0, 0, 0, 2527, 235, 1, 0, 0, 0, 2528, 2526, 1, 0, 0, 0, 2529, 2530, 5, 42, 0, 0, 2530, 2531, 5, 136, 0, 0, 2531, 2532, 5, 43, 0, 0, 2532, 2547, 6, 118, -1, 0, 2533, 2534, 5, 42, 0, 0, 2534, 2535, 5, 137, 0, 0, 2535, 2536, 5, 43, 0, 0, 2536, 2547, 6, 118, -1, 0, 2537, 2538, 5, 42, 0, 0, 2538, 2539, 5, 138, 0, 0, 2539, 2540, 5, 43, 0, 0, 2540, 2547, 6, 118, -1, 0, 2541, 2542, 5, 42, 0, 0, 2542, 2543, 3, 32, 16, 0, 2543, 2544, 5, 43, 0, 0, 2544, 2545, 6, 118, -1, 0, 2545, 2547, 1, 0, 0, 0, 2546, 2529, 1, 0, 0, 0, 2546, 2533, 1, 0, 0, 0, 2546, 2537, 1, 0, 0, 0, 2546, 2541, 1, 0, 0, 0, 2547, 237, 1, 0, 0, 0, 2548, 2557, 5, 139, 0, 0, 2549, 2550, 3, 240, 120, 0, 2550, 2551, 6, 119, -1, 0, 2551, 2556, 1, 0, 0, 0, 2552, 2553, 3, 242, 121, 0, 2553, 2554, 6, 119, -1, 0, 2554, 2556, 1, 0, 0, 0, 2555, 2549, 1, 0, 0, 0, 2555, 2552, 1, 0, 0, 0, 2556, 2559, 1, 0, 0, 0, 2557, 2555, 1, 0, 0, 0, 2557, 2558, 1, 0, 0, 0, 2558, 2560, 1, 0, 0, 0, 2559, 2557, 1, 0, 0, 0, 2560, 2561, 3, 174, 87, 0, 2561, 2562, 3, 234, 117, 0, 2562, 2563, 3, 142, 71, 0, 2563, 2564, 3, 230, 115, 0, 2564, 2565, 3, 246, 123, 0, 2565, 2566, 3, 186, 93, 0, 2566, 2572, 3, 114, 57, 0, 2567, 2568, 3, 248, 124, 0, 2568, 2569, 6, 119, -1, 0, 2569, 2571, 1, 0, 0, 0, 2570, 2567, 1, 0, 0, 0, 2571, 2574, 1, 0, 0, 0, 2572, 2570, 1, 0, 0, 0, 2572, 2573, 1, 0, 0, 0, 2573, 2575, 1, 0, 0, 0, 2574, 2572, 1, 0, 0, 0, 2575, 2576, 6, 119, -1, 0, 2576, 239, 1, 0, 0, 0, 2577, 2578, 5, 123, 0, 0, 2578, 2620, 6, 120, -1, 0, 2579, 2580, 5, 51, 0, 0, 2580, 2620, 6, 120, -1, 0, 2581, 2582, 5, 52, 0, 0, 2582, 2620, 6, 120, -1, 0, 2583, 2584, 5, 63, 0, 0, 2584, 2620, 6, 120, -1, 0, 2585, 2586, 5, 140, 0, 0, 2586, 2620, 6, 120, -1, 0, 2587, 2588, 5, 68, 0, 0, 2588, 2620, 6, 120, -1, 0, 2589, 2590, 5, 141, 0, 0, 2590, 2620, 6, 120, -1, 0, 2591, 2592, 5, 142, 0, 0, 2592, 2620, 6, 120, -1, 0, 2593, 2594, 5, 54, 0, 0, 2594, 2620, 6, 120, -1, 0, 2595, 2596, 5, 64, 0, 0, 2596, 2620, 6, 120, -1, 0, 2597, 2598, 5, 65, 0, 0, 2598, 2620, 6, 120, -1, 0, 2599, 2600, 5, 66, 0, 0, 2600, 2620, 6, 120, -1, 0, 2601, 2602, 5, 125, 0, 0, 2602, 2620, 6, 120, -1, 0, 2603, 2604, 5, 143, 0, 0, 2604, 2620, 6, 120, -1, 0, 2605, 2606, 5, 144, 0, 0, 2606, 2620, 6, 120, -1, 0, 2607, 2608, 5, 69, 0, 0, 2608, 2620, 6, 120, -1, 0, 2609, 2610, 5, 145, 0, 0, 2610, 2620, 6, 120, -1, 0, 2611, 2612, 5, 146, 0, 0, 2612, 2620, 6, 120, -1, 0, 2613, 2614, 5, 70, 0, 0, 2614, 2615, 5, 30, 0, 0, 2615, 2616, 3, 32, 16, 0, 2616, 2617, 5, 31, 0, 0, 2617, 2618, 6, 120, -1, 0, 2618, 2620, 1, 0, 0, 0, 2619, 2577, 1, 0, 0, 0, 2619, 2579, 1, 0, 0, 0, 2619, 2581, 1, 0, 0, 0, 2619, 2583, 1, 0, 0, 0, 2619, 2585, 1, 0, 0, 0, 2619, 2587, 1, 0, 0, 0, 2619, 2589, 1, 0, 0, 0, 2619, 2591, 1, 0, 0, 0, 2619, 2593, 1, 0, 0, 0, 2619, 2595, 1, 0, 0, 0, 2619, 2597, 1, 0, 0, 0, 2619, 2599, 1, 0, 0, 0, 2619, 2601, 1, 0, 0, 0, 2619, 2603, 1, 0, 0, 0, 2619, 2605, 1, 0, 0, 0, 2619, 2607, 1, 0, 0, 0, 2619, 2609, 1, 0, 0, 0, 2619, 2611, 1, 0, 0, 0, 2619, 2613, 1, 0, 0, 0, 2620, 241, 1, 0, 0, 0, 2621, 2622, 5, 147, 0, 0, 2622, 2631, 5, 30, 0, 0, 2623, 2624, 3, 6, 3, 0, 2624, 2629, 6, 121, -1, 0, 2625, 2626, 5, 34, 0, 0, 2626, 2627, 3, 6, 3, 0, 2627, 2628, 6, 121, -1, 0, 2628, 2630, 1, 0, 0, 0, 2629, 2625, 1, 0, 0, 0, 2629, 2630, 1, 0, 0, 0, 2630, 2632, 1, 0, 0, 0, 2631, 2623, 1, 0, 0, 0, 2631, 2632, 1, 0, 0, 0, 2632, 2638, 1, 0, 0, 0, 2633, 2634, 3, 244, 122, 0, 2634, 2635, 6, 121, -1, 0, 2635, 2637, 1, 0, 0, 0, 2636, 2633, 1, 0, 0, 0, 2637, 2640, 1, 0, 0, 0, 2638, 2636, 1, 0, 0, 0, 2638, 2639, 1, 0, 0, 0, 2639, 2641, 1, 0, 0, 0, 2640, 2638, 1, 0, 0, 0, 2641, 2645, 5, 31, 0, 0, 2642, 2643, 5, 147, 0, 0, 2643, 2645, 5, 85, 0, 0, 2644, 2621, 1, 0, 0, 0, 2644, 2642, 1, 0, 0, 0, 2645, 243, 1, 0, 0, 0, 2646, 2647, 5, 148, 0, 0, 2647, 2689, 6, 122, -1, 0, 2648, 2649, 5, 223, 0, 0, 2649, 2689, 6, 122, -1, 0, 2650, 2651, 5, 57, 0, 0, 2651, 2689, 6, 122, -1, 0, 2652, 2653, 5, 58, 0, 0, 2653, 2689, 6, 122, -1, 0, 2654, 2655, 5, 149, 0, 0, 2655, 2689, 6, 122, -1, 0, 2656, 2657, 5, 150, 0, 0, 2657, 2689, 6, 122, -1, 0, 2658, 2659, 5, 247, 0, 0, 2659, 2689, 6, 122, -1, 0, 2660, 2661, 5, 248, 0, 0, 2661, 2689, 6, 122, -1, 0, 2662, 2663, 5, 249, 0, 0, 2663, 2689, 6, 122, -1, 0, 2664, 2665, 5, 250, 0, 0, 2665, 2689, 6, 122, -1, 0, 2666, 2667, 5, 151, 0, 0, 2667, 2668, 5, 75, 0, 0, 2668, 2669, 5, 152, 0, 0, 2669, 2689, 6, 122, -1, 0, 2670, 2671, 5, 151, 0, 0, 2671, 2672, 5, 75, 0, 0, 2672, 2673, 5, 153, 0, 0, 2673, 2689, 6, 122, -1, 0, 2674, 2675, 5, 154, 0, 0, 2675, 2676, 5, 75, 0, 0, 2676, 2677, 5, 152, 0, 0, 2677, 2689, 6, 122, -1, 0, 2678, 2679, 5, 154, 0, 0, 2679, 2680, 5, 75, 0, 0, 2680, 2681, 5, 153, 0, 0, 2681, 2689, 6, 122, -1, 0, 2682, 2683, 5, 70, 0, 0, 2683, 2684, 5, 30, 0, 0, 2684, 2685, 3, 32, 16, 0, 2685, 2686, 5, 31, 0, 0, 2686, 2687, 6, 122, -1, 0, 2687, 2689, 1, 0, 0, 0, 2688, 2646, 1, 0, 0, 0, 2688, 2648, 1, 0, 0, 0, 2688, 2650, 1, 0, 0, 0, 2688, 2652, 1, 0, 0, 0, 2688, 2654, 1, 0, 0, 0, 2688, 2656, 1, 0, 0, 0, 2688, 2658, 1, 0, 0, 0, 2688, 2660, 1, 0, 0, 0, 2688, 2662, 1, 0, 0, 0, 2688, 2664, 1, 0, 0, 0, 2688, 2666, 1, 0, 0, 0, 2688, 2670, 1, 0, 0, 0, 2688, 2674, 1, 0, 0, 0, 2688, 2678, 1, 0, 0, 0, 2688, 2682, 1, 0, 0, 0, 2689, 245, 1, 0, 0, 0, 2690, 2691, 5, 116, 0, 0, 2691, 2698, 6, 123, -1, 0, 2692, 2693, 5, 155, 0, 0, 2693, 2698, 6, 123, -1, 0, 2694, 2695, 3, 2, 1, 0, 2695, 2696, 6, 123, -1, 0, 2696, 2698, 1, 0, 0, 0, 2697, 2690, 1, 0, 0, 0, 2697, 2692, 1, 0, 0, 0, 2697, 2694, 1, 0, 0, 0, 2698, 247, 1, 0, 0, 0, 2699, 2700, 5, 1, 0, 0, 2700, 2738, 6, 124, -1, 0, 2701, 2702, 5, 2, 0, 0, 2702, 2738, 6, 124, -1, 0, 2703, 2704, 5, 156, 0, 0, 2704, 2738, 6, 124, -1, 0, 2705, 2706, 5, 3, 0, 0, 2706, 2738, 6, 124, -1, 0, 2707, 2708, 5, 4, 0, 0, 2708, 2738, 6, 124, -1, 0, 2709, 2710, 5, 246, 0, 0, 2710, 2738, 6, 124, -1, 0, 2711, 2712, 5, 5, 0, 0, 2712, 2738, 6, 124, -1, 0, 2713, 2714, 5, 6, 0, 0, 2714, 2738, 6, 124, -1, 0, 2715, 2716, 5, 7, 0, 0, 2716, 2738, 6, 124, -1, 0, 2717, 2718, 5, 8, 0, 0, 2718, 2738, 6, 124, -1, 0, 2719, 2720, 5, 9, 0, 0, 2720, 2738, 6, 124, -1, 0, 2721, 2722, 5, 10, 0, 0, 2722, 2738, 6, 124, -1, 0, 2723, 2724, 5, 11, 0, 0, 2724, 2738, 6, 124, -1, 0, 2725, 2726, 5, 12, 0, 0, 2726, 2738, 6, 124, -1, 0, 2727, 2728, 5, 13, 0, 0, 2728, 2738, 6, 124, -1, 0, 2729, 2730, 5, 14, 0, 0, 2730, 2738, 6, 124, -1, 0, 2731, 2732, 5, 70, 0, 0, 2732, 2733, 5, 30, 0, 0, 2733, 2734, 3, 32, 16, 0, 2734, 2735, 5, 31, 0, 0, 2735, 2736, 6, 124, -1, 0, 2736, 2738, 1, 0, 0, 0, 2737, 2699, 1, 0, 0, 0, 2737, 2701, 1, 0, 0, 0, 2737, 2703, 1, 0, 0, 0, 2737, 2705, 1, 0, 0, 0, 2737, 2707, 1, 0, 0, 0, 2737, 2709, 1, 0, 0, 0, 2737, 2711, 1, 0, 0, 0, 2737, 2713, 1, 0, 0, 0, 2737, 2715, 1, 0, 0, 0, 2737, 2717, 1, 0, 0, 0, 2737, 2719, 1, 0, 0, 0, 2737, 2721, 1, 0, 0, 0, 2737, 2723, 1, 0, 0, 0, 2737, 2725, 1, 0, 0, 0, 2737, 2727, 1, 0, 0, 0, 2737, 2729, 1, 0, 0, 0, 2737, 2731, 1, 0, 0, 0, 2738, 249, 1, 0, 0, 0, 2739, 2741, 3, 252, 126, 0, 2740, 2739, 1, 0, 0, 0, 2741, 2744, 1, 0, 0, 0, 2742, 2740, 1, 0, 0, 0, 2742, 2743, 1, 0, 0, 0, 2743, 251, 1, 0, 0, 0, 2744, 2742, 1, 0, 0, 0, 2745, 2783, 3, 102, 51, 0, 2746, 2747, 5, 295, 0, 0, 2747, 2748, 3, 32, 16, 0, 2748, 2749, 6, 126, -1, 0, 2749, 2783, 1, 0, 0, 0, 2750, 2783, 3, 270, 135, 0, 2751, 2752, 5, 296, 0, 0, 2752, 2753, 3, 32, 16, 0, 2753, 2754, 6, 126, -1, 0, 2754, 2783, 1, 0, 0, 0, 2755, 2756, 5, 297, 0, 0, 2756, 2783, 6, 126, -1, 0, 2757, 2758, 5, 298, 0, 0, 2758, 2783, 6, 126, -1, 0, 2759, 2783, 3, 264, 132, 0, 2760, 2783, 3, 268, 134, 0, 2761, 2783, 3, 254, 127, 0, 2762, 2763, 3, 288, 144, 0, 2763, 2764, 6, 126, -1, 0, 2764, 2783, 1, 0, 0, 0, 2765, 2766, 3, 156, 78, 0, 2766, 2767, 6, 126, -1, 0, 2767, 2783, 1, 0, 0, 0, 2768, 2769, 3, 90, 45, 0, 2769, 2770, 6, 126, -1, 0, 2770, 2783, 1, 0, 0, 0, 2771, 2772, 3, 26, 13, 0, 2772, 2773, 6, 126, -1, 0, 2773, 2783, 1, 0, 0, 0, 2774, 2775, 3, 266, 133, 0, 2775, 2776, 6, 126, -1, 0, 2776, 2783, 1, 0, 0, 0, 2777, 2783, 3, 40, 20, 0, 2778, 2783, 3, 256, 128, 0, 2779, 2783, 3, 258, 129, 0, 2780, 2783, 3, 260, 130, 0, 2781, 2783, 3, 262, 131, 0, 2782, 2745, 1, 0, 0, 0, 2782, 2746, 1, 0, 0, 0, 2782, 2750, 1, 0, 0, 0, 2782, 2751, 1, 0, 0, 0, 2782, 2755, 1, 0, 0, 0, 2782, 2757, 1, 0, 0, 0, 2782, 2759, 1, 0, 0, 0, 2782, 2760, 1, 0, 0, 0, 2782, 2761, 1, 0, 0, 0, 2782, 2762, 1, 0, 0, 0, 2782, 2765, 1, 0, 0, 0, 2782, 2768, 1, 0, 0, 0, 2782, 2771, 1, 0, 0, 0, 2782, 2774, 1, 0, 0, 0, 2782, 2777, 1, 0, 0, 0, 2782, 2778, 1, 0, 0, 0, 2782, 2779, 1, 0, 0, 0, 2782, 2780, 1, 0, 0, 0, 2782, 2781, 1, 0, 0, 0, 2783, 253, 1, 0, 0, 0, 2784, 2786, 5, 299, 0, 0, 2785, 2787, 5, 157, 0, 0, 2786, 2785, 1, 0, 0, 0, 2786, 2787, 1, 0, 0, 0, 2787, 2788, 1, 0, 0, 0, 2788, 2789, 3, 114, 57, 0, 2789, 255, 1, 0, 0, 0, 2790, 2791, 5, 300, 0, 0, 2791, 2792, 5, 42, 0, 0, 2792, 2793, 3, 32, 16, 0, 2793, 2796, 5, 43, 0, 0, 2794, 2795, 5, 34, 0, 0, 2795, 2797, 3, 0, 0, 0, 2796, 2794, 1, 0, 0, 0, 2796, 2797, 1, 0, 0, 0, 2797, 257, 1, 0, 0, 0, 2798, 2799, 5, 302, 0, 0, 2799, 2800, 3, 32, 16, 0, 2800, 2801, 5, 75, 0, 0, 2801, 2802, 3, 32, 16, 0, 2802, 259, 1, 0, 0, 0, 2803, 2804, 5, 301, 0, 0, 2804, 2805, 3, 128, 64, 0, 2805, 2806, 5, 175, 0, 0, 2806, 2807, 3, 246, 123, 0, 2807, 2819, 1, 0, 0, 0, 2808, 2809, 5, 301, 0, 0, 2809, 2810, 5, 225, 0, 0, 2810, 2811, 3, 174, 87, 0, 2811, 2812, 3, 142, 71, 0, 2812, 2813, 3, 128, 64, 0, 2813, 2814, 5, 175, 0, 0, 2814, 2815, 3, 246, 123, 0, 2815, 2816, 3, 198, 99, 0, 2816, 2817, 3, 114, 57, 0, 2817, 2819, 1, 0, 0, 0, 2818, 2803, 1, 0, 0, 0, 2818, 2808, 1, 0, 0, 0, 2819, 261, 1, 0, 0, 0, 2820, 2821, 5, 254, 0, 0, 2821, 2822, 5, 195, 0, 0, 2822, 2823, 5, 42, 0, 0, 2823, 2824, 3, 32, 16, 0, 2824, 2830, 5, 43, 0, 0, 2825, 2826, 3, 334, 167, 0, 2826, 2827, 6, 131, -1, 0, 2827, 2829, 1, 0, 0, 0, 2828, 2825, 1, 0, 0, 0, 2829, 2832, 1, 0, 0, 0, 2830, 2828, 1, 0, 0, 0, 2830, 2831, 1, 0, 0, 0, 2831, 2886, 1, 0, 0, 0, 2832, 2830, 1, 0, 0, 0, 2833, 2834, 5, 254, 0, 0, 2834, 2835, 5, 195, 0, 0, 2835, 2841, 3, 2, 1, 0, 2836, 2837, 3, 334, 167, 0, 2837, 2838, 6, 131, -1, 0, 2838, 2840, 1, 0, 0, 0, 2839, 2836, 1, 0, 0, 0, 2840, 2843, 1, 0, 0, 0, 2841, 2839, 1, 0, 0, 0, 2841, 2842, 1, 0, 0, 0, 2842, 2886, 1, 0, 0, 0, 2843, 2841, 1, 0, 0, 0, 2844, 2845, 5, 254, 0, 0, 2845, 2846, 5, 255, 0, 0, 2846, 2847, 5, 42, 0, 0, 2847, 2848, 3, 32, 16, 0, 2848, 2849, 5, 43, 0, 0, 2849, 2850, 5, 28, 0, 0, 2850, 2856, 3, 126, 63, 0, 2851, 2852, 3, 334, 167, 0, 2852, 2853, 6, 131, -1, 0, 2853, 2855, 1, 0, 0, 0, 2854, 2851, 1, 0, 0, 0, 2855, 2858, 1, 0, 0, 0, 2856, 2854, 1, 0, 0, 0, 2856, 2857, 1, 0, 0, 0, 2857, 2886, 1, 0, 0, 0, 2858, 2856, 1, 0, 0, 0, 2859, 2860, 5, 254, 0, 0, 2860, 2861, 5, 255, 0, 0, 2861, 2862, 3, 2, 1, 0, 2862, 2863, 5, 28, 0, 0, 2863, 2869, 3, 126, 63, 0, 2864, 2865, 3, 334, 167, 0, 2865, 2866, 6, 131, -1, 0, 2866, 2868, 1, 0, 0, 0, 2867, 2864, 1, 0, 0, 0, 2868, 2871, 1, 0, 0, 0, 2869, 2867, 1, 0, 0, 0, 2869, 2870, 1, 0, 0, 0, 2870, 2886, 1, 0, 0, 0, 2871, 2869, 1, 0, 0, 0, 2872, 2873, 5, 254, 0, 0, 2873, 2874, 5, 42, 0, 0, 2874, 2875, 3, 32, 16, 0, 2875, 2876, 5, 43, 0, 0, 2876, 2882, 3, 210, 105, 0, 2877, 2878, 3, 334, 167, 0, 2878, 2879, 6, 131, -1, 0, 2879, 2881, 1, 0, 0, 0, 2880, 2877, 1, 0, 0, 0, 2881, 2884, 1, 0, 0, 0, 2882, 2880, 1, 0, 0, 0, 2882, 2883, 1, 0, 0, 0, 2883, 2886, 1, 0, 0, 0, 2884, 2882, 1, 0, 0, 0, 2885, 2820, 1, 0, 0, 0, 2885, 2833, 1, 0, 0, 0, 2885, 2844, 1, 0, 0, 0, 2885, 2859, 1, 0, 0, 0, 2885, 2872, 1, 0, 0, 0, 2886, 263, 1, 0, 0, 0, 2887, 2888, 3, 0, 0, 0, 2888, 2889, 5, 75, 0, 0, 2889, 2890, 6, 132, -1, 0, 2890, 265, 1, 0, 0, 0, 2891, 2892, 3, 44, 22, 0, 2892, 2893, 6, 133, -1, 0, 2893, 2898, 1, 0, 0, 0, 2894, 2895, 3, 46, 23, 0, 2895, 2896, 6, 133, -1, 0, 2896, 2898, 1, 0, 0, 0, 2897, 2891, 1, 0, 0, 0, 2897, 2894, 1, 0, 0, 0, 2898, 267, 1, 0, 0, 0, 2899, 2900, 5, 17, 0, 0, 2900, 2901, 3, 250, 125, 0, 2901, 2902, 5, 18, 0, 0, 2902, 269, 1, 0, 0, 0, 2903, 2904, 3, 274, 137, 0, 2904, 2905, 3, 272, 136, 0, 2905, 271, 1, 0, 0, 0, 2906, 2907, 3, 276, 138, 0, 2907, 2908, 6, 136, -1, 0, 2908, 2910, 1, 0, 0, 0, 2909, 2906, 1, 0, 0, 0, 2910, 2911, 1, 0, 0, 0, 2911, 2909, 1, 0, 0, 0, 2911, 2912, 1, 0, 0, 0, 2912, 273, 1, 0, 0, 0, 2913, 2914, 5, 158, 0, 0, 2914, 2915, 3, 268, 134, 0, 2915, 2916, 6, 137, -1, 0, 2916, 2930, 1, 0, 0, 0, 2917, 2918, 5, 158, 0, 0, 2918, 2919, 3, 0, 0, 0, 2919, 2920, 5, 159, 0, 0, 2920, 2921, 3, 0, 0, 0, 2921, 2922, 6, 137, -1, 0, 2922, 2930, 1, 0, 0, 0, 2923, 2924, 5, 158, 0, 0, 2924, 2925, 3, 32, 16, 0, 2925, 2926, 5, 159, 0, 0, 2926, 2927, 3, 32, 16, 0, 2927, 2928, 6, 137, -1, 0, 2928, 2930, 1, 0, 0, 0, 2929, 2913, 1, 0, 0, 0, 2929, 2917, 1, 0, 0, 0, 2929, 2923, 1, 0, 0, 0, 2930, 275, 1, 0, 0, 0, 2931, 2932, 3, 280, 140, 0, 2932, 2933, 3, 286, 143, 0, 2933, 2934, 6, 138, -1, 0, 2934, 2948, 1, 0, 0, 0, 2935, 2936, 3, 278, 139, 0, 2936, 2937, 3, 286, 143, 0, 2937, 2938, 6, 138, -1, 0, 2938, 2948, 1, 0, 0, 0, 2939, 2940, 3, 282, 141, 0, 2940, 2941, 3, 286, 143, 0, 2941, 2942, 6, 138, -1, 0, 2942, 2948, 1, 0, 0, 0, 2943, 2944, 3, 284, 142, 0, 2944, 2945, 3, 286, 143, 0, 2945, 2946, 6, 138, -1, 0, 2946, 2948, 1, 0, 0, 0, 2947, 2931, 1, 0, 0, 0, 2947, 2935, 1, 0, 0, 0, 2947, 2939, 1, 0, 0, 0, 2947, 2943, 1, 0, 0, 0, 2948, 277, 1, 0, 0, 0, 2949, 2950, 5, 160, 0, 0, 2950, 2951, 3, 268, 134, 0, 2951, 2952, 6, 139, -1, 0, 2952, 2962, 1, 0, 0, 0, 2953, 2954, 5, 160, 0, 0, 2954, 2955, 3, 0, 0, 0, 2955, 2956, 6, 139, -1, 0, 2956, 2962, 1, 0, 0, 0, 2957, 2958, 5, 160, 0, 0, 2958, 2959, 3, 32, 16, 0, 2959, 2960, 6, 139, -1, 0, 2960, 2962, 1, 0, 0, 0, 2961, 2949, 1, 0, 0, 0, 2961, 2953, 1, 0, 0, 0, 2961, 2957, 1, 0, 0, 0, 2962, 279, 1, 0, 0, 0, 2963, 2964, 5, 161, 0, 0, 2964, 2965, 3, 126, 63, 0, 2965, 281, 1, 0, 0, 0, 2966, 2967, 5, 162, 0, 0, 2967, 283, 1, 0, 0, 0, 2968, 2969, 5, 163, 0, 0, 2969, 285, 1, 0, 0, 0, 2970, 2971, 3, 268, 134, 0, 2971, 2972, 6, 143, -1, 0, 2972, 2986, 1, 0, 0, 0, 2973, 2974, 5, 164, 0, 0, 2974, 2975, 3, 0, 0, 0, 2975, 2976, 5, 159, 0, 0, 2976, 2977, 3, 0, 0, 0, 2977, 2978, 6, 143, -1, 0, 2978, 2986, 1, 0, 0, 0, 2979, 2980, 5, 164, 0, 0, 2980, 2981, 3, 32, 16, 0, 2981, 2982, 5, 159, 0, 0, 2982, 2983, 3, 32, 16, 0, 2983, 2984, 6, 143, -1, 0, 2984, 2986, 1, 0, 0, 0, 2985, 2970, 1, 0, 0, 0, 2985, 2973, 1, 0, 0, 0, 2985, 2979, 1, 0, 0, 0, 2986, 287, 1, 0, 0, 0, 2987, 2988, 3, 290, 145, 0, 2988, 2989, 3, 294, 147, 0, 2989, 289, 1, 0, 0, 0, 2990, 2991, 5, 165, 0, 0, 2991, 2992, 3, 292, 146, 0, 2992, 2993, 3, 0, 0, 0, 2993, 2994, 5, 36, 0, 0, 2994, 2995, 6, 145, -1, 0, 2995, 3001, 1, 0, 0, 0, 2996, 2997, 5, 165, 0, 0, 2997, 2998, 3, 292, 146, 0, 2998, 2999, 6, 145, -1, 0, 2999, 3001, 1, 0, 0, 0, 3000, 2990, 1, 0, 0, 0, 3000, 2996, 1, 0, 0, 0, 3001, 291, 1, 0, 0, 0, 3002, 3008, 1, 0, 0, 0, 3003, 3004, 5, 166, 0, 0, 3004, 3008, 6, 146, -1, 0, 3005, 3006, 5, 2, 0, 0, 3006, 3008, 6, 146, -1, 0, 3007, 3002, 1, 0, 0, 0, 3007, 3003, 1, 0, 0, 0, 3007, 3005, 1, 0, 0, 0, 3008, 293, 1, 0, 0, 0, 3009, 3010, 5, 17, 0, 0, 3010, 3011, 3, 296, 148, 0, 3011, 3012, 5, 18, 0, 0, 3012, 3019, 1, 0, 0, 0, 3013, 3015, 3, 300, 150, 0, 3014, 3013, 1, 0, 0, 0, 3015, 3016, 1, 0, 0, 0, 3016, 3014, 1, 0, 0, 0, 3016, 3017, 1, 0, 0, 0, 3017, 3019, 1, 0, 0, 0, 3018, 3009, 1, 0, 0, 0, 3018, 3014, 1, 0, 0, 0, 3019, 295, 1, 0, 0, 0, 3020, 3021, 3, 300, 150, 0, 3021, 3022, 5, 28, 0, 0, 3022, 3024, 1, 0, 0, 0, 3023, 3020, 1, 0, 0, 0, 3024, 3027, 1, 0, 0, 0, 3025, 3023, 1, 0, 0, 0, 3025, 3026, 1, 0, 0, 0, 3026, 3028, 1, 0, 0, 0, 3027, 3025, 1, 0, 0, 0, 3028, 3029, 3, 300, 150, 0, 3029, 297, 1, 0, 0, 0, 3030, 3037, 1, 0, 0, 0, 3031, 3032, 5, 42, 0, 0, 3032, 3033, 3, 32, 16, 0, 3033, 3034, 5, 43, 0, 0, 3034, 3035, 6, 149, -1, 0, 3035, 3037, 1, 0, 0, 0, 3036, 3030, 1, 0, 0, 0, 3036, 3031, 1, 0, 0, 0, 3037, 299, 1, 0, 0, 0, 3038, 3039, 5, 180, 0, 0, 3039, 3040, 5, 261, 0, 0, 3040, 3041, 5, 30, 0, 0, 3041, 3042, 3, 6, 3, 0, 3042, 3043, 5, 31, 0, 0, 3043, 3044, 6, 150, -1, 0, 3044, 3087, 1, 0, 0, 0, 3045, 3046, 5, 259, 0, 0, 3046, 3047, 5, 30, 0, 0, 3047, 3048, 3, 0, 0, 0, 3048, 3049, 5, 31, 0, 0, 3049, 3050, 6, 150, -1, 0, 3050, 3087, 1, 0, 0, 0, 3051, 3052, 5, 259, 0, 0, 3052, 3053, 3, 0, 0, 0, 3053, 3054, 6, 150, -1, 0, 3054, 3087, 1, 0, 0, 0, 3055, 3056, 5, 84, 0, 0, 3056, 3057, 5, 30, 0, 0, 3057, 3058, 3, 304, 152, 0, 3058, 3059, 5, 31, 0, 0, 3059, 3060, 6, 150, -1, 0, 3060, 3087, 1, 0, 0, 0, 3061, 3062, 7, 11, 0, 0, 3062, 3063, 5, 30, 0, 0, 3063, 3064, 3, 36, 18, 0, 3064, 3065, 5, 31, 0, 0, 3065, 3066, 3, 298, 149, 0, 3066, 3067, 6, 150, -1, 0, 3067, 3087, 1, 0, 0, 0, 3068, 3069, 5, 186, 0, 0, 3069, 3070, 5, 30, 0, 0, 3070, 3071, 3, 34, 17, 0, 3071, 3072, 5, 31, 0, 0, 3072, 3073, 3, 298, 149, 0, 3073, 3074, 6, 150, -1, 0, 3074, 3087, 1, 0, 0, 0, 3075, 3076, 7, 12, 0, 0, 3076, 3077, 5, 30, 0, 0, 3077, 3078, 3, 32, 16, 0, 3078, 3079, 5, 31, 0, 0, 3079, 3080, 3, 298, 149, 0, 3080, 3081, 6, 150, -1, 0, 3081, 3087, 1, 0, 0, 0, 3082, 3083, 7, 13, 0, 0, 3083, 3084, 3, 298, 149, 0, 3084, 3085, 6, 150, -1, 0, 3085, 3087, 1, 0, 0, 0, 3086, 3038, 1, 0, 0, 0, 3086, 3045, 1, 0, 0, 0, 3086, 3051, 1, 0, 0, 0, 3086, 3055, 1, 0, 0, 0, 3086, 3061, 1, 0, 0, 0, 3086, 3068, 1, 0, 0, 0, 3086, 3075, 1, 0, 0, 0, 3086, 3082, 1, 0, 0, 0, 3087, 301, 1, 0, 0, 0, 3088, 3089, 5, 187, 0, 0, 3089, 3090, 5, 30, 0, 0, 3090, 3091, 3, 36, 18, 0, 3091, 3092, 5, 31, 0, 0, 3092, 3093, 6, 151, -1, 0, 3093, 3179, 1, 0, 0, 0, 3094, 3095, 5, 188, 0, 0, 3095, 3096, 5, 30, 0, 0, 3096, 3097, 3, 36, 18, 0, 3097, 3098, 5, 31, 0, 0, 3098, 3099, 6, 151, -1, 0, 3099, 3179, 1, 0, 0, 0, 3100, 3101, 5, 187, 0, 0, 3101, 3102, 5, 30, 0, 0, 3102, 3103, 3, 32, 16, 0, 3103, 3104, 5, 31, 0, 0, 3104, 3105, 6, 151, -1, 0, 3105, 3179, 1, 0, 0, 0, 3106, 3107, 5, 188, 0, 0, 3107, 3108, 5, 30, 0, 0, 3108, 3109, 3, 34, 17, 0, 3109, 3110, 5, 31, 0, 0, 3110, 3111, 6, 151, -1, 0, 3111, 3179, 1, 0, 0, 0, 3112, 3113, 5, 186, 0, 0, 3113, 3114, 5, 30, 0, 0, 3114, 3115, 3, 34, 17, 0, 3115, 3116, 5, 31, 0, 0, 3116, 3117, 6, 151, -1, 0, 3117, 3179, 1, 0, 0, 0, 3118, 3119, 5, 185, 0, 0, 3119, 3120, 5, 30, 0, 0, 3120, 3121, 3, 32, 16, 0, 3121, 3122, 5, 31, 0, 0, 3122, 3123, 6, 151, -1, 0, 3123, 3179, 1, 0, 0, 0, 3124, 3125, 5, 184, 0, 0, 3125, 3126, 5, 30, 0, 0, 3126, 3127, 3, 32, 16, 0, 3127, 3128, 5, 31, 0, 0, 3128, 3129, 6, 151, -1, 0, 3129, 3179, 1, 0, 0, 0, 3130, 3131, 5, 183, 0, 0, 3131, 3132, 5, 30, 0, 0, 3132, 3133, 3, 32, 16, 0, 3133, 3134, 5, 31, 0, 0, 3134, 3135, 6, 151, -1, 0, 3135, 3179, 1, 0, 0, 0, 3136, 3137, 5, 192, 0, 0, 3137, 3138, 5, 30, 0, 0, 3138, 3139, 3, 34, 17, 0, 3139, 3140, 5, 31, 0, 0, 3140, 3141, 6, 151, -1, 0, 3141, 3179, 1, 0, 0, 0, 3142, 3143, 5, 191, 0, 0, 3143, 3144, 5, 30, 0, 0, 3144, 3145, 3, 32, 16, 0, 3145, 3146, 5, 31, 0, 0, 3146, 3147, 6, 151, -1, 0, 3147, 3179, 1, 0, 0, 0, 3148, 3149, 5, 190, 0, 0, 3149, 3150, 5, 30, 0, 0, 3150, 3151, 3, 32, 16, 0, 3151, 3152, 5, 31, 0, 0, 3152, 3153, 6, 151, -1, 0, 3153, 3179, 1, 0, 0, 0, 3154, 3155, 5, 189, 0, 0, 3155, 3156, 5, 30, 0, 0, 3156, 3157, 3, 32, 16, 0, 3157, 3158, 5, 31, 0, 0, 3158, 3159, 6, 151, -1, 0, 3159, 3179, 1, 0, 0, 0, 3160, 3161, 5, 180, 0, 0, 3161, 3162, 5, 30, 0, 0, 3162, 3163, 3, 32, 16, 0, 3163, 3164, 5, 31, 0, 0, 3164, 3165, 6, 151, -1, 0, 3165, 3179, 1, 0, 0, 0, 3166, 3167, 5, 182, 0, 0, 3167, 3168, 5, 30, 0, 0, 3168, 3169, 3, 166, 83, 0, 3169, 3170, 5, 31, 0, 0, 3170, 3171, 6, 151, -1, 0, 3171, 3179, 1, 0, 0, 0, 3172, 3173, 5, 84, 0, 0, 3173, 3174, 5, 30, 0, 0, 3174, 3175, 3, 304, 152, 0, 3175, 3176, 5, 31, 0, 0, 3176, 3177, 6, 151, -1, 0, 3177, 3179, 1, 0, 0, 0, 3178, 3088, 1, 0, 0, 0, 3178, 3094, 1, 0, 0, 0, 3178, 3100, 1, 0, 0, 0, 3178, 3106, 1, 0, 0, 0, 3178, 3112, 1, 0, 0, 0, 3178, 3118, 1, 0, 0, 0, 3178, 3124, 1, 0, 0, 0, 3178, 3130, 1, 0, 0, 0, 3178, 3136, 1, 0, 0, 0, 3178, 3142, 1, 0, 0, 0, 3178, 3148, 1, 0, 0, 0, 3178, 3154, 1, 0, 0, 0, 3178, 3160, 1, 0, 0, 0, 3178, 3166, 1, 0, 0, 0, 3178, 3172, 1, 0, 0, 0, 3179, 303, 1, 0, 0, 0, 3180, 3181, 3, 306, 153, 0, 3181, 3182, 6, 152, -1, 0, 3182, 3184, 1, 0, 0, 0, 3183, 3180, 1, 0, 0, 0, 3184, 3187, 1, 0, 0, 0, 3185, 3183, 1, 0, 0, 0, 3185, 3186, 1, 0, 0, 0, 3186, 305, 1, 0, 0, 0, 3187, 3185, 1, 0, 0, 0, 3188, 3189, 7, 14, 0, 0, 3189, 307, 1, 0, 0, 0, 3190, 3191, 3, 302, 151, 0, 3191, 3192, 6, 154, -1, 0, 3192, 3199, 1, 0, 0, 0, 3193, 3194, 3, 6, 3, 0, 3194, 3195, 6, 154, -1, 0, 3195, 3199, 1, 0, 0, 0, 3196, 3197, 5, 178, 0, 0, 3197, 3199, 6, 154, -1, 0, 3198, 3190, 1, 0, 0, 0, 3198, 3193, 1, 0, 0, 0, 3198, 3196, 1, 0, 0, 0, 3199, 309, 1, 0, 0, 0, 3200, 3201, 3, 302, 151, 0, 3201, 3202, 6, 155, -1, 0, 3202, 3372, 1, 0, 0, 0, 3203, 3204, 5, 181, 0, 0, 3204, 3205, 5, 30, 0, 0, 3205, 3206, 5, 178, 0, 0, 3206, 3207, 5, 31, 0, 0, 3207, 3372, 6, 155, -1, 0, 3208, 3209, 5, 181, 0, 0, 3209, 3210, 5, 30, 0, 0, 3210, 3211, 5, 263, 0, 0, 3211, 3212, 5, 31, 0, 0, 3212, 3372, 6, 155, -1, 0, 3213, 3214, 5, 195, 0, 0, 3214, 3215, 5, 30, 0, 0, 3215, 3216, 5, 39, 0, 0, 3216, 3217, 5, 263, 0, 0, 3217, 3218, 5, 31, 0, 0, 3218, 3372, 6, 155, -1, 0, 3219, 3220, 5, 195, 0, 0, 3220, 3221, 5, 30, 0, 0, 3221, 3222, 3, 118, 59, 0, 3222, 3223, 5, 31, 0, 0, 3223, 3224, 6, 155, -1, 0, 3224, 3372, 1, 0, 0, 0, 3225, 3226, 5, 195, 0, 0, 3226, 3227, 5, 30, 0, 0, 3227, 3228, 5, 178, 0, 0, 3228, 3229, 5, 31, 0, 0, 3229, 3372, 6, 155, -1, 0, 3230, 3231, 5, 196, 0, 0, 3231, 3232, 5, 30, 0, 0, 3232, 3233, 3, 310, 155, 0, 3233, 3234, 5, 31, 0, 0, 3234, 3235, 6, 155, -1, 0, 3235, 3372, 1, 0, 0, 0, 3236, 3237, 5, 187, 0, 0, 3237, 3238, 5, 42, 0, 0, 3238, 3239, 3, 32, 16, 0, 3239, 3240, 5, 43, 0, 0, 3240, 3241, 5, 30, 0, 0, 3241, 3242, 3, 312, 156, 0, 3242, 3243, 5, 31, 0, 0, 3243, 3244, 6, 155, -1, 0, 3244, 3372, 1, 0, 0, 0, 3245, 3246, 5, 188, 0, 0, 3246, 3247, 5, 42, 0, 0, 3247, 3248, 3, 32, 16, 0, 3248, 3249, 5, 43, 0, 0, 3249, 3250, 5, 30, 0, 0, 3250, 3251, 3, 314, 157, 0, 3251, 3252, 5, 31, 0, 0, 3252, 3253, 6, 155, -1, 0, 3253, 3372, 1, 0, 0, 0, 3254, 3255, 5, 186, 0, 0, 3255, 3256, 5, 42, 0, 0, 3256, 3257, 3, 32, 16, 0, 3257, 3258, 5, 43, 0, 0, 3258, 3259, 5, 30, 0, 0, 3259, 3260, 3, 316, 158, 0, 3260, 3261, 5, 31, 0, 0, 3261, 3262, 6, 155, -1, 0, 3262, 3372, 1, 0, 0, 0, 3263, 3264, 5, 185, 0, 0, 3264, 3265, 5, 42, 0, 0, 3265, 3266, 3, 32, 16, 0, 3266, 3267, 5, 43, 0, 0, 3267, 3268, 5, 30, 0, 0, 3268, 3269, 3, 318, 159, 0, 3269, 3270, 5, 31, 0, 0, 3270, 3271, 6, 155, -1, 0, 3271, 3372, 1, 0, 0, 0, 3272, 3273, 5, 184, 0, 0, 3273, 3274, 5, 42, 0, 0, 3274, 3275, 3, 32, 16, 0, 3275, 3276, 5, 43, 0, 0, 3276, 3277, 5, 30, 0, 0, 3277, 3278, 3, 320, 160, 0, 3278, 3279, 5, 31, 0, 0, 3279, 3280, 6, 155, -1, 0, 3280, 3372, 1, 0, 0, 0, 3281, 3282, 5, 183, 0, 0, 3282, 3283, 5, 42, 0, 0, 3283, 3284, 3, 32, 16, 0, 3284, 3285, 5, 43, 0, 0, 3285, 3286, 5, 30, 0, 0, 3286, 3287, 3, 322, 161, 0, 3287, 3288, 5, 31, 0, 0, 3288, 3289, 6, 155, -1, 0, 3289, 3372, 1, 0, 0, 0, 3290, 3291, 5, 192, 0, 0, 3291, 3292, 5, 42, 0, 0, 3292, 3293, 3, 32, 16, 0, 3293, 3294, 5, 43, 0, 0, 3294, 3295, 5, 30, 0, 0, 3295, 3296, 3, 316, 158, 0, 3296, 3297, 5, 31, 0, 0, 3297, 3298, 6, 155, -1, 0, 3298, 3372, 1, 0, 0, 0, 3299, 3300, 5, 191, 0, 0, 3300, 3301, 5, 42, 0, 0, 3301, 3302, 3, 32, 16, 0, 3302, 3303, 5, 43, 0, 0, 3303, 3304, 5, 30, 0, 0, 3304, 3305, 3, 318, 159, 0, 3305, 3306, 5, 31, 0, 0, 3306, 3307, 6, 155, -1, 0, 3307, 3372, 1, 0, 0, 0, 3308, 3309, 5, 190, 0, 0, 3309, 3310, 5, 42, 0, 0, 3310, 3311, 3, 32, 16, 0, 3311, 3312, 5, 43, 0, 0, 3312, 3313, 5, 30, 0, 0, 3313, 3314, 3, 320, 160, 0, 3314, 3315, 5, 31, 0, 0, 3315, 3316, 6, 155, -1, 0, 3316, 3372, 1, 0, 0, 0, 3317, 3318, 5, 189, 0, 0, 3318, 3319, 5, 42, 0, 0, 3319, 3320, 3, 32, 16, 0, 3320, 3321, 5, 43, 0, 0, 3321, 3322, 5, 30, 0, 0, 3322, 3323, 3, 322, 161, 0, 3323, 3324, 5, 31, 0, 0, 3324, 3325, 6, 155, -1, 0, 3325, 3372, 1, 0, 0, 0, 3326, 3327, 5, 180, 0, 0, 3327, 3328, 5, 42, 0, 0, 3328, 3329, 3, 32, 16, 0, 3329, 3330, 5, 43, 0, 0, 3330, 3331, 5, 30, 0, 0, 3331, 3332, 3, 320, 160, 0, 3332, 3333, 5, 31, 0, 0, 3333, 3334, 6, 155, -1, 0, 3334, 3372, 1, 0, 0, 0, 3335, 3336, 5, 182, 0, 0, 3336, 3337, 5, 42, 0, 0, 3337, 3338, 3, 32, 16, 0, 3338, 3339, 5, 43, 0, 0, 3339, 3340, 5, 30, 0, 0, 3340, 3341, 3, 324, 162, 0, 3341, 3342, 5, 31, 0, 0, 3342, 3343, 6, 155, -1, 0, 3343, 3372, 1, 0, 0, 0, 3344, 3345, 5, 181, 0, 0, 3345, 3346, 5, 42, 0, 0, 3346, 3347, 3, 32, 16, 0, 3347, 3348, 5, 43, 0, 0, 3348, 3349, 5, 30, 0, 0, 3349, 3350, 3, 326, 163, 0, 3350, 3351, 5, 31, 0, 0, 3351, 3352, 6, 155, -1, 0, 3352, 3372, 1, 0, 0, 0, 3353, 3354, 5, 195, 0, 0, 3354, 3355, 5, 42, 0, 0, 3355, 3356, 3, 32, 16, 0, 3356, 3357, 5, 43, 0, 0, 3357, 3358, 5, 30, 0, 0, 3358, 3359, 3, 328, 164, 0, 3359, 3360, 5, 31, 0, 0, 3360, 3361, 6, 155, -1, 0, 3361, 3372, 1, 0, 0, 0, 3362, 3363, 5, 196, 0, 0, 3363, 3364, 5, 42, 0, 0, 3364, 3365, 3, 32, 16, 0, 3365, 3366, 5, 43, 0, 0, 3366, 3367, 5, 30, 0, 0, 3367, 3368, 3, 332, 166, 0, 3368, 3369, 5, 31, 0, 0, 3369, 3370, 6, 155, -1, 0, 3370, 3372, 1, 0, 0, 0, 3371, 3200, 1, 0, 0, 0, 3371, 3203, 1, 0, 0, 0, 3371, 3208, 1, 0, 0, 0, 3371, 3213, 1, 0, 0, 0, 3371, 3219, 1, 0, 0, 0, 3371, 3225, 1, 0, 0, 0, 3371, 3230, 1, 0, 0, 0, 3371, 3236, 1, 0, 0, 0, 3371, 3245, 1, 0, 0, 0, 3371, 3254, 1, 0, 0, 0, 3371, 3263, 1, 0, 0, 0, 3371, 3272, 1, 0, 0, 0, 3371, 3281, 1, 0, 0, 0, 3371, 3290, 1, 0, 0, 0, 3371, 3299, 1, 0, 0, 0, 3371, 3308, 1, 0, 0, 0, 3371, 3317, 1, 0, 0, 0, 3371, 3326, 1, 0, 0, 0, 3371, 3335, 1, 0, 0, 0, 3371, 3344, 1, 0, 0, 0, 3371, 3353, 1, 0, 0, 0, 3371, 3362, 1, 0, 0, 0, 3372, 311, 1, 0, 0, 0, 3373, 3374, 3, 36, 18, 0, 3374, 3375, 6, 156, -1, 0, 3375, 3380, 1, 0, 0, 0, 3376, 3377, 3, 32, 16, 0, 3377, 3378, 6, 156, -1, 0, 3378, 3380, 1, 0, 0, 0, 3379, 3373, 1, 0, 0, 0, 3379, 3376, 1, 0, 0, 0, 3380, 3383, 1, 0, 0, 0, 3381, 3379, 1, 0, 0, 0, 3381, 3382, 1, 0, 0, 0, 3382, 313, 1, 0, 0, 0, 3383, 3381, 1, 0, 0, 0, 3384, 3385, 3, 36, 18, 0, 3385, 3386, 6, 157, -1, 0, 3386, 3391, 1, 0, 0, 0, 3387, 3388, 3, 34, 17, 0, 3388, 3389, 6, 157, -1, 0, 3389, 3391, 1, 0, 0, 0, 3390, 3384, 1, 0, 0, 0, 3390, 3387, 1, 0, 0, 0, 3391, 3394, 1, 0, 0, 0, 3392, 3390, 1, 0, 0, 0, 3392, 3393, 1, 0, 0, 0, 3393, 315, 1, 0, 0, 0, 3394, 3392, 1, 0, 0, 0, 3395, 3396, 3, 34, 17, 0, 3396, 3397, 6, 158, -1, 0, 3397, 3399, 1, 0, 0, 0, 3398, 3395, 1, 0, 0, 0, 3399, 3402, 1, 0, 0, 0, 3400, 3398, 1, 0, 0, 0, 3400, 3401, 1, 0, 0, 0, 3401, 317, 1, 0, 0, 0, 3402, 3400, 1, 0, 0, 0, 3403, 3404, 3, 32, 16, 0, 3404, 3405, 6, 159, -1, 0, 3405, 3407, 1, 0, 0, 0, 3406, 3403, 1, 0, 0, 0, 3407, 3410, 1, 0, 0, 0, 3408, 3406, 1, 0, 0, 0, 3408, 3409, 1, 0, 0, 0, 3409, 319, 1, 0, 0, 0, 3410, 3408, 1, 0, 0, 0, 3411, 3412, 3, 32, 16, 0, 3412, 3413, 6, 160, -1, 0, 3413, 3415, 1, 0, 0, 0, 3414, 3411, 1, 0, 0, 0, 3415, 3418, 1, 0, 0, 0, 3416, 3414, 1, 0, 0, 0, 3416, 3417, 1, 0, 0, 0, 3417, 321, 1, 0, 0, 0, 3418, 3416, 1, 0, 0, 0, 3419, 3420, 3, 32, 16, 0, 3420, 3421, 6, 161, -1, 0, 3421, 3423, 1, 0, 0, 0, 3422, 3419, 1, 0, 0, 0, 3423, 3426, 1, 0, 0, 0, 3424, 3422, 1, 0, 0, 0, 3424, 3425, 1, 0, 0, 0, 3425, 323, 1, 0, 0, 0, 3426, 3424, 1, 0, 0, 0, 3427, 3428, 3, 166, 83, 0, 3428, 3429, 6, 162, -1, 0, 3429, 3431, 1, 0, 0, 0, 3430, 3427, 1, 0, 0, 0, 3431, 3434, 1, 0, 0, 0, 3432, 3430, 1, 0, 0, 0, 3432, 3433, 1, 0, 0, 0, 3433, 325, 1, 0, 0, 0, 3434, 3432, 1, 0, 0, 0, 3435, 3436, 5, 178, 0, 0, 3436, 3440, 6, 163, -1, 0, 3437, 3438, 5, 263, 0, 0, 3438, 3440, 6, 163, -1, 0, 3439, 3435, 1, 0, 0, 0, 3439, 3437, 1, 0, 0, 0, 3440, 3443, 1, 0, 0, 0, 3441, 3439, 1, 0, 0, 0, 3441, 3442, 1, 0, 0, 0, 3442, 327, 1, 0, 0, 0, 3443, 3441, 1, 0, 0, 0, 3444, 3445, 3, 330, 165, 0, 3445, 3446, 6, 164, -1, 0, 3446, 3448, 1, 0, 0, 0, 3447, 3444, 1, 0, 0, 0, 3448, 3451, 1, 0, 0, 0, 3449, 3447, 1, 0, 0, 0, 3449, 3450, 1, 0, 0, 0, 3450, 329, 1, 0, 0, 0, 3451, 3449, 1, 0, 0, 0, 3452, 3453, 5, 178, 0, 0, 3453, 3461, 6, 165, -1, 0, 3454, 3455, 5, 39, 0, 0, 3455, 3456, 5, 263, 0, 0, 3456, 3461, 6, 165, -1, 0, 3457, 3458, 3, 118, 59, 0, 3458, 3459, 6, 165, -1, 0, 3459, 3461, 1, 0, 0, 0, 3460, 3452, 1, 0, 0, 0, 3460, 3454, 1, 0, 0, 0, 3460, 3457, 1, 0, 0, 0, 3461, 331, 1, 0, 0, 0, 3462, 3463, 3, 310, 155, 0, 3463, 3464, 6, 166, -1, 0, 3464, 3466, 1, 0, 0, 0, 3465, 3462, 1, 0, 0, 0, 3466, 3469, 1, 0, 0, 0, 3467, 3465, 1, 0, 0, 0, 3467, 3468, 1, 0, 0, 0, 3468, 333, 1, 0, 0, 0, 3469, 3467, 1, 0, 0, 0, 3470, 3471, 3, 44, 22, 0, 3471, 3472, 6, 167, -1, 0, 3472, 3480, 1, 0, 0, 0, 3473, 3474, 3, 46, 23, 0, 3474, 3475, 6, 167, -1, 0, 3475, 3480, 1, 0, 0, 0, 3476, 3477, 3, 2, 1, 0, 3477, 3478, 6, 167, -1, 0, 3478, 3480, 1, 0, 0, 0, 3479, 3470, 1, 0, 0, 0, 3479, 3473, 1, 0, 0, 0, 3479, 3476, 1, 0, 0, 0, 3480, 335, 1, 0, 0, 0, 3481, 3482, 5, 167, 0, 0, 3482, 3483, 5, 36, 0, 0, 3483, 3484, 5, 30, 0, 0, 3484, 3485, 3, 304, 152, 0, 3485, 3486, 5, 31, 0, 0, 3486, 3487, 6, 168, -1, 0, 3487, 3514, 1, 0, 0, 0, 3488, 3489, 5, 168, 0, 0, 3489, 3490, 3, 38, 19, 0, 3490, 3491, 5, 75, 0, 0, 3491, 3492, 3, 38, 19, 0, 3492, 3493, 5, 75, 0, 0, 3493, 3494, 3, 38, 19, 0, 3494, 3495, 5, 75, 0, 0, 3495, 3496, 3, 38, 19, 0, 3496, 3497, 6, 168, -1, 0, 3497, 3514, 1, 0, 0, 0, 3498, 3499, 5, 169, 0, 0, 3499, 3500, 3, 6, 3, 0, 3500, 3501, 6, 168, -1, 0, 3501, 3514, 1, 0, 0, 0, 3502, 3503, 5, 169, 0, 0, 3503, 3504, 5, 36, 0, 0, 3504, 3505, 5, 30, 0, 0, 3505, 3506, 3, 304, 152, 0, 3506, 3507, 5, 31, 0, 0, 3507, 3508, 6, 168, -1, 0, 3508, 3514, 1, 0, 0, 0, 3509, 3510, 3, 334, 167, 0, 3510, 3511, 6, 168, -1, 0, 3511, 3514, 1, 0, 0, 0, 3512, 3514, 3, 40, 20, 0, 3513, 3481, 1, 0, 0, 0, 3513, 3488, 1, 0, 0, 0, 3513, 3498, 1, 0, 0, 0, 3513, 3502, 1, 0, 0, 0, 3513, 3509, 1, 0, 0, 0, 3513, 3512, 1, 0, 0, 0, 3514, 337, 1, 0, 0, 0, 3515, 3516, 3, 340, 170, 0, 3516, 3517, 5, 17, 0, 0, 3517, 3518, 3, 342, 171, 0, 3518, 3519, 5, 18, 0, 0, 3519, 3520, 6, 169, -1, 0, 3520, 339, 1, 0, 0, 0, 3521, 3522, 5, 25, 0, 0, 3522, 3523, 5, 40, 0, 0, 3523, 3524, 3, 100, 50, 0, 3524, 3525, 3, 2, 1, 0, 3525, 3526, 6, 170, -1, 0, 3526, 3536, 1, 0, 0, 0, 3527, 3528, 5, 25, 0, 0, 3528, 3529, 5, 40, 0, 0, 3529, 3530, 3, 100, 50, 0, 3530, 3531, 3, 2, 1, 0, 3531, 3532, 5, 34, 0, 0, 3532, 3533, 3, 2, 1, 0, 3533, 3534, 6, 170, -1, 0, 3534, 3536, 1, 0, 0, 0, 3535, 3521, 1, 0, 0, 0, 3535, 3527, 1, 0, 0, 0, 3536, 341, 1, 0, 0, 0, 3537, 3538, 3, 344, 172, 0, 3538, 3539, 6, 171, -1, 0, 3539, 3541, 1, 0, 0, 0, 3540, 3537, 1, 0, 0, 0, 3541, 3544, 1, 0, 0, 0, 3542, 3540, 1, 0, 0, 0, 3542, 3543, 1, 0, 0, 0, 3543, 343, 1, 0, 0, 0, 3544, 3542, 1, 0, 0, 0, 3545, 3546, 5, 179, 0, 0, 3546, 3547, 5, 36, 0, 0, 3547, 3548, 5, 30, 0, 0, 3548, 3549, 3, 304, 152, 0, 3549, 3550, 5, 31, 0, 0, 3550, 3551, 6, 172, -1, 0, 3551, 3565, 1, 0, 0, 0, 3552, 3553, 3, 336, 168, 0, 3553, 3554, 6, 172, -1, 0, 3554, 3565, 1, 0, 0, 0, 3555, 3556, 5, 170, 0, 0, 3556, 3557, 5, 36, 0, 0, 3557, 3558, 5, 30, 0, 0, 3558, 3559, 3, 304, 152, 0, 3559, 3560, 5, 31, 0, 0, 3560, 3561, 6, 172, -1, 0, 3561, 3565, 1, 0, 0, 0, 3562, 3563, 5, 55, 0, 0, 3563, 3565, 6, 172, -1, 0, 3564, 3545, 1, 0, 0, 0, 3564, 3552, 1, 0, 0, 0, 3564, 3555, 1, 0, 0, 0, 3564, 3562, 1, 0, 0, 0, 3565, 345, 1, 0, 0, 0, 3566, 3567, 3, 348, 174, 0, 3567, 3568, 5, 17, 0, 0, 3568, 3569, 3, 356, 178, 0, 3569, 3570, 5, 18, 0, 0, 3570, 3571, 6, 173, -1, 0, 3571, 347, 1, 0, 0, 0, 3572, 3573, 5, 50, 0, 0, 3573, 3574, 5, 40, 0, 0, 3574, 3575, 3, 352, 176, 0, 3575, 3576, 3, 2, 1, 0, 3576, 3577, 6, 174, -1, 0, 3577, 349, 1, 0, 0, 0, 3578, 3579, 5, 300, 0, 0, 3579, 3580, 3, 352, 176, 0, 3580, 3581, 3, 2, 1, 0, 3581, 3582, 6, 175, -1, 0, 3582, 351, 1, 0, 0, 0, 3583, 3584, 3, 354, 177, 0, 3584, 3585, 6, 176, -1, 0, 3585, 3587, 1, 0, 0, 0, 3586, 3583, 1, 0, 0, 0, 3587, 3590, 1, 0, 0, 0, 3588, 3586, 1, 0, 0, 0, 3588, 3589, 1, 0, 0, 0, 3589, 353, 1, 0, 0, 0, 3590, 3588, 1, 0, 0, 0, 3591, 3607, 5, 52, 0, 0, 3592, 3607, 5, 51, 0, 0, 3593, 3607, 5, 171, 0, 0, 3594, 3595, 5, 62, 0, 0, 3595, 3607, 5, 51, 0, 0, 3596, 3597, 5, 62, 0, 0, 3597, 3607, 5, 52, 0, 0, 3598, 3599, 5, 62, 0, 0, 3599, 3607, 5, 63, 0, 0, 3600, 3601, 5, 62, 0, 0, 3601, 3607, 5, 64, 0, 0, 3602, 3603, 5, 62, 0, 0, 3603, 3607, 5, 65, 0, 0, 3604, 3605, 5, 62, 0, 0, 3605, 3607, 5, 66, 0, 0, 3606, 3591, 1, 0, 0, 0, 3606, 3592, 1, 0, 0, 0, 3606, 3593, 1, 0, 0, 0, 3606, 3594, 1, 0, 0, 0, 3606, 3596, 1, 0, 0, 0, 3606, 3598, 1, 0, 0, 0, 3606, 3600, 1, 0, 0, 0, 3606, 3602, 1, 0, 0, 0, 3606, 3604, 1, 0, 0, 0, 3607, 355, 1, 0, 0, 0, 3608, 3609, 3, 358, 179, 0, 3609, 3610, 6, 178, -1, 0, 3610, 3612, 1, 0, 0, 0, 3611, 3608, 1, 0, 0, 0, 3612, 3615, 1, 0, 0, 0, 3613, 3611, 1, 0, 0, 0, 3613, 3614, 1, 0, 0, 0, 3614, 357, 1, 0, 0, 0, 3615, 3613, 1, 0, 0, 0, 3616, 3617, 5, 21, 0, 0, 3617, 3618, 3, 2, 1, 0, 3618, 3619, 6, 179, -1, 0, 3619, 3642, 1, 0, 0, 0, 3620, 3621, 5, 50, 0, 0, 3621, 3622, 5, 40, 0, 0, 3622, 3623, 3, 120, 60, 0, 3623, 3624, 6, 179, -1, 0, 3624, 3642, 1, 0, 0, 0, 3625, 3626, 5, 25, 0, 0, 3626, 3627, 5, 40, 0, 0, 3627, 3628, 3, 2, 1, 0, 3628, 3629, 6, 179, -1, 0, 3629, 3642, 1, 0, 0, 0, 3630, 3631, 3, 178, 89, 0, 3631, 3632, 6, 179, -1, 0, 3632, 3642, 1, 0, 0, 0, 3633, 3634, 5, 50, 0, 0, 3634, 3635, 3, 32, 16, 0, 3635, 3636, 6, 179, -1, 0, 3636, 3642, 1, 0, 0, 0, 3637, 3638, 3, 334, 167, 0, 3638, 3639, 6, 179, -1, 0, 3639, 3642, 1, 0, 0, 0, 3640, 3642, 3, 40, 20, 0, 3641, 3616, 1, 0, 0, 0, 3641, 3620, 1, 0, 0, 0, 3641, 3625, 1, 0, 0, 0, 3641, 3630, 1, 0, 0, 0, 3641, 3633, 1, 0, 0, 0, 3641, 3637, 1, 0, 0, 0, 3641, 3640, 1, 0, 0, 0, 3642, 359, 1, 0, 0, 0, 3643, 3644, 3, 362, 181, 0, 3644, 3645, 5, 17, 0, 0, 3645, 3646, 3, 368, 184, 0, 3646, 3647, 5, 18, 0, 0, 3647, 3648, 6, 180, -1, 0, 3648, 361, 1, 0, 0, 0, 3649, 3650, 5, 273, 0, 0, 3650, 3651, 3, 364, 182, 0, 3651, 3652, 3, 2, 1, 0, 3652, 3653, 6, 181, -1, 0, 3653, 3662, 1, 0, 0, 0, 3654, 3655, 5, 273, 0, 0, 3655, 3656, 3, 364, 182, 0, 3656, 3657, 3, 2, 1, 0, 3657, 3658, 5, 34, 0, 0, 3658, 3659, 3, 2, 1, 0, 3659, 3660, 6, 181, -1, 0, 3660, 3662, 1, 0, 0, 0, 3661, 3649, 1, 0, 0, 0, 3661, 3654, 1, 0, 0, 0, 3662, 363, 1, 0, 0, 0, 3663, 3664, 3, 366, 183, 0, 3664, 3665, 6, 182, -1, 0, 3665, 3667, 1, 0, 0, 0, 3666, 3663, 1, 0, 0, 0, 3667, 3670, 1, 0, 0, 0, 3668, 3666, 1, 0, 0, 0, 3668, 3669, 1, 0, 0, 0, 3669, 365, 1, 0, 0, 0, 3670, 3668, 1, 0, 0, 0, 3671, 3672, 7, 15, 0, 0, 3672, 367, 1, 0, 0, 0, 3673, 3674, 3, 370, 185, 0, 3674, 3675, 6, 184, -1, 0, 3675, 3677, 1, 0, 0, 0, 3676, 3673, 1, 0, 0, 0, 3677, 3680, 1, 0, 0, 0, 3678, 3676, 1, 0, 0, 0, 3678, 3679, 1, 0, 0, 0, 3679, 369, 1, 0, 0, 0, 3680, 3678, 1, 0, 0, 0, 3681, 3682, 5, 21, 0, 0, 3682, 3683, 3, 2, 1, 0, 3683, 3684, 5, 44, 0, 0, 3684, 3685, 3, 32, 16, 0, 3685, 3686, 6, 185, -1, 0, 3686, 3697, 1, 0, 0, 0, 3687, 3688, 5, 25, 0, 0, 3688, 3689, 5, 40, 0, 0, 3689, 3690, 3, 2, 1, 0, 3690, 3691, 6, 185, -1, 0, 3691, 3697, 1, 0, 0, 0, 3692, 3693, 3, 334, 167, 0, 3693, 3694, 6, 185, -1, 0, 3694, 3697, 1, 0, 0, 0, 3695, 3697, 3, 40, 20, 0, 3696, 3681, 1, 0, 0, 0, 3696, 3687, 1, 0, 0, 0, 3696, 3692, 1, 0, 0, 0, 3696, 3695, 1, 0, 0, 0, 3697, 371, 1, 0, 0, 0, 184, 382, 390, 399, 408, 497, 548, 559, 589, 596, 614, 646, 674, 714, 725, 735, 737, 748, 750, 758, 780, 793, 809, 833, 906, 913, 920, 925, 934, 945, 954, 965, 976, 989, 993, 1001, 1017, 1024, 1033, 1061, 1139, 1141, 1155, 1161, 1170, 1172, 1181, 1195, 1209, 1217, 1225, 1229, 1268, 1276, 1287, 1301, 1309, 1325, 1335, 1338, 1362, 1509, 1519, 1528, 1531, 1613, 1622, 1654, 1714, 1754, 1770, 1780, 1810, 1838, 1847, 1853, 1870, 1878, 1936, 1946, 1964, 1982, 2001, 2022, 2041, 2056, 2064, 2076, 2096, 2103, 2108, 2119, 2131, 2241, 2253, 2269, 2283, 2292, 2305, 2307, 2350, 2361, 2368, 2376, 2384, 2397, 2403, 2409, 2414, 2443, 2451, 2465, 2470, 2495, 2504, 2515, 2519, 2526, 2546, 2555, 2557, 2572, 2619, 2629, 2631, 2638, 2644, 2688, 2697, 2737, 2742, 2782, 2786, 2796, 2818, 2830, 2841, 2856, 2869, 2882, 2885, 2897, 2911, 2929, 2947, 2961, 2985, 3000, 3007, 3016, 3018, 3025, 3036, 3086, 3178, 3185, 3198, 3371, 3379, 3381, 3390, 3392, 3400, 3408, 3416, 3424, 3432, 3439, 3441, 3449, 3460, 3467, 3479, 3513, 3535, 3542, 3564, 3588, 3606, 3613, 3641, 3661, 3668, 3678, 3696] \ No newline at end of file diff --git a/src/tools/ilasm/src/ILAssembler/gen/CILBaseVisitor.cs b/src/tools/ilasm/src/ILAssembler/gen/CILBaseVisitor.cs deleted file mode 100644 index c63f1eb59ad7f8..00000000000000 --- a/src/tools/ilasm/src/ILAssembler/gen/CILBaseVisitor.cs +++ /dev/null @@ -1,2012 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// ANTLR Version: 4.13.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -// Generated from CIL.g4 by ANTLR 4.13.1 - -// Unreachable code detected -#pragma warning disable 0162 -// The variable '...' is assigned but its value is never used -#pragma warning disable 0219 -// Missing XML comment for publicly visible type or member '...' -#pragma warning disable 1591 -// Ambiguous reference in cref attribute -#pragma warning disable 419 - -namespace ILAssembler { -using Antlr4.Runtime.Misc; -using Antlr4.Runtime.Tree; -using IToken = Antlr4.Runtime.IToken; -using ParserRuleContext = Antlr4.Runtime.ParserRuleContext; - -/// -/// This class provides an empty implementation of , -/// which can be extended to create a visitor which only needs to handle a subset -/// of the available methods. -/// -/// The return type of the visit operation. -[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.1")] -[System.Diagnostics.DebuggerNonUserCode] -[System.CLSCompliant(false)] -public partial class CILBaseVisitor : AbstractParseTreeVisitor, ICILVisitor { - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitId([NotNull] CILParser.IdContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitDottedName([NotNull] CILParser.DottedNameContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitDottedNamePart([NotNull] CILParser.DottedNamePartContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCompQstring([NotNull] CILParser.CompQstringContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitDecls([NotNull] CILParser.DeclsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitDecl([NotNull] CILParser.DeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSubsystem([NotNull] CILParser.SubsystemContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCorflags([NotNull] CILParser.CorflagsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitAlignment([NotNull] CILParser.AlignmentContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitImagebase([NotNull] CILParser.ImagebaseContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitStackreserve([NotNull] CILParser.StackreserveContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitAssemblyBlock([NotNull] CILParser.AssemblyBlockContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitMscorlib([NotNull] CILParser.MscorlibContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitLanguageDecl([NotNull] CILParser.LanguageDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitLanguageString([NotNull] CILParser.LanguageStringContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTypelist([NotNull] CILParser.TypelistContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInt32([NotNull] CILParser.Int32Context context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInt64([NotNull] CILParser.Int64Context context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitFloat64([NotNull] CILParser.Float64Context context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitIntOrWildcard([NotNull] CILParser.IntOrWildcardContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCompControl([NotNull] CILParser.CompControlContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTypedefDecl([NotNull] CILParser.TypedefDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCustomDescr([NotNull] CILParser.CustomDescrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCustomDescrWithOwner([NotNull] CILParser.CustomDescrWithOwnerContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCustomType([NotNull] CILParser.CustomTypeContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitOwnerType([NotNull] CILParser.OwnerTypeContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCustomBlobDescr([NotNull] CILParser.CustomBlobDescrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCustomBlobArgs([NotNull] CILParser.CustomBlobArgsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCustomBlobNVPairs([NotNull] CILParser.CustomBlobNVPairsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitFieldOrProp([NotNull] CILParser.FieldOrPropContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSerializType([NotNull] CILParser.SerializTypeContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSerializTypeElement([NotNull] CILParser.SerializTypeElementContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitModuleHead([NotNull] CILParser.ModuleHeadContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitVtfixupDecl([NotNull] CILParser.VtfixupDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitVtfixupAttr([NotNull] CILParser.VtfixupAttrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitVtableDecl([NotNull] CILParser.VtableDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitNameSpaceHead([NotNull] CILParser.NameSpaceHeadContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitClassHead([NotNull] CILParser.ClassHeadContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitClassAttr([NotNull] CILParser.ClassAttrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitExtendsClause([NotNull] CILParser.ExtendsClauseContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitImplClause([NotNull] CILParser.ImplClauseContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitClassDecls([NotNull] CILParser.ClassDeclsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitImplList([NotNull] CILParser.ImplListContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitEsHead([NotNull] CILParser.EsHeadContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitExtSourceSpec([NotNull] CILParser.ExtSourceSpecContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitFileDecl([NotNull] CILParser.FileDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitFileAttr([NotNull] CILParser.FileAttrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitFileEntry([NotNull] CILParser.FileEntryContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitAsmAttrAny([NotNull] CILParser.AsmAttrAnyContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitAsmAttr([NotNull] CILParser.AsmAttrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr_none([NotNull] CILParser.Instr_noneContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr_var([NotNull] CILParser.Instr_varContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr_i([NotNull] CILParser.Instr_iContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr_i8([NotNull] CILParser.Instr_i8Context context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr_r([NotNull] CILParser.Instr_rContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr_brtarget([NotNull] CILParser.Instr_brtargetContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr_method([NotNull] CILParser.Instr_methodContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr_field([NotNull] CILParser.Instr_fieldContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr_type([NotNull] CILParser.Instr_typeContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr_string([NotNull] CILParser.Instr_stringContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr_sig([NotNull] CILParser.Instr_sigContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr_tok([NotNull] CILParser.Instr_tokContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr_switch([NotNull] CILParser.Instr_switchContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInstr([NotNull] CILParser.InstrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitLabels([NotNull] CILParser.LabelsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTypeArgs([NotNull] CILParser.TypeArgsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitBounds([NotNull] CILParser.BoundsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSigArgs([NotNull] CILParser.SigArgsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSigArg([NotNull] CILParser.SigArgContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitClassName([NotNull] CILParser.ClassNameContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSlashedName([NotNull] CILParser.SlashedNameContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitAssemblyDecls([NotNull] CILParser.AssemblyDeclsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitAssemblyDecl([NotNull] CILParser.AssemblyDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTypeSpec([NotNull] CILParser.TypeSpecContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitNativeType([NotNull] CILParser.NativeTypeContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by the PointerNativeType - /// labeled alternative in . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitPointerNativeType([NotNull] CILParser.PointerNativeTypeContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by the PointerArrayTypeNoSizeData - /// labeled alternative in . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitPointerArrayTypeNoSizeData([NotNull] CILParser.PointerArrayTypeNoSizeDataContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by the PointerArrayTypeSize - /// labeled alternative in . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitPointerArrayTypeSize([NotNull] CILParser.PointerArrayTypeSizeContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by the PointerArrayTypeSizeParamIndex - /// labeled alternative in . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitPointerArrayTypeSizeParamIndex([NotNull] CILParser.PointerArrayTypeSizeParamIndexContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by the PointerArrayTypeParamIndex - /// labeled alternative in . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitPointerArrayTypeParamIndex([NotNull] CILParser.PointerArrayTypeParamIndexContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitNativeTypeElement([NotNull] CILParser.NativeTypeElementContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitIidParamIndex([NotNull] CILParser.IidParamIndexContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitVariantType([NotNull] CILParser.VariantTypeContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitVariantTypeElement([NotNull] CILParser.VariantTypeElementContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitType([NotNull] CILParser.TypeContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by the SZArrayModifier - /// labeled alternative in . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSZArrayModifier([NotNull] CILParser.SZArrayModifierContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by the ArrayModifier - /// labeled alternative in . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitArrayModifier([NotNull] CILParser.ArrayModifierContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by the ByRefModifier - /// labeled alternative in . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitByRefModifier([NotNull] CILParser.ByRefModifierContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by the PtrModifier - /// labeled alternative in . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitPtrModifier([NotNull] CILParser.PtrModifierContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by the PinnedModifier - /// labeled alternative in . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitPinnedModifier([NotNull] CILParser.PinnedModifierContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by the RequiredModifier - /// labeled alternative in . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitRequiredModifier([NotNull] CILParser.RequiredModifierContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by the OptionalModifier - /// labeled alternative in . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitOptionalModifier([NotNull] CILParser.OptionalModifierContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by the GenericArgumentsModifier - /// labeled alternative in . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitGenericArgumentsModifier([NotNull] CILParser.GenericArgumentsModifierContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitElementType([NotNull] CILParser.ElementTypeContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSimpleType([NotNull] CILParser.SimpleTypeContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitBound([NotNull] CILParser.BoundContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitNativeInt([NotNull] CILParser.NativeIntContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitNativeUint([NotNull] CILParser.NativeUintContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSecDecl([NotNull] CILParser.SecDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSecAttrSetBlob([NotNull] CILParser.SecAttrSetBlobContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSecAttrBlob([NotNull] CILParser.SecAttrBlobContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitNameValPairs([NotNull] CILParser.NameValPairsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitNameValPair([NotNull] CILParser.NameValPairContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTruefalse([NotNull] CILParser.TruefalseContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCaValue([NotNull] CILParser.CaValueContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSecAction([NotNull] CILParser.SecActionContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitMethodRef([NotNull] CILParser.MethodRefContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCallConv([NotNull] CILParser.CallConvContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCallKind([NotNull] CILParser.CallKindContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitMdtoken([NotNull] CILParser.MdtokenContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitMemberRef([NotNull] CILParser.MemberRefContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitFieldRef([NotNull] CILParser.FieldRefContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTypeList([NotNull] CILParser.TypeListContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTyparsClause([NotNull] CILParser.TyparsClauseContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTyparAttrib([NotNull] CILParser.TyparAttribContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTyparAttribs([NotNull] CILParser.TyparAttribsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTypar([NotNull] CILParser.TyparContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTypars([NotNull] CILParser.TyparsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTyBound([NotNull] CILParser.TyBoundContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitGenArity([NotNull] CILParser.GenArityContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitGenArityNotEmpty([NotNull] CILParser.GenArityNotEmptyContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitClassDecl([NotNull] CILParser.ClassDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitFieldDecl([NotNull] CILParser.FieldDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitFieldAttr([NotNull] CILParser.FieldAttrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitAtOpt([NotNull] CILParser.AtOptContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitInitOpt([NotNull] CILParser.InitOptContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitRepeatOpt([NotNull] CILParser.RepeatOptContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitEventHead([NotNull] CILParser.EventHeadContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitEventAttr([NotNull] CILParser.EventAttrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitEventDecls([NotNull] CILParser.EventDeclsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitEventDecl([NotNull] CILParser.EventDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitPropHead([NotNull] CILParser.PropHeadContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitPropAttr([NotNull] CILParser.PropAttrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitPropDecls([NotNull] CILParser.PropDeclsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitPropDecl([NotNull] CILParser.PropDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitMarshalClause([NotNull] CILParser.MarshalClauseContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitMarshalBlob([NotNull] CILParser.MarshalBlobContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitParamAttr([NotNull] CILParser.ParamAttrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitParamAttrElement([NotNull] CILParser.ParamAttrElementContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitMethodHead([NotNull] CILParser.MethodHeadContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitMethAttr([NotNull] CILParser.MethAttrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitPinvImpl([NotNull] CILParser.PinvImplContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitPinvAttr([NotNull] CILParser.PinvAttrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitMethodName([NotNull] CILParser.MethodNameContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitImplAttr([NotNull] CILParser.ImplAttrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitMethodDecls([NotNull] CILParser.MethodDeclsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitMethodDecl([NotNull] CILParser.MethodDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitLabelDecl([NotNull] CILParser.LabelDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCustomDescrInMethodBody([NotNull] CILParser.CustomDescrInMethodBodyContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitScopeBlock([NotNull] CILParser.ScopeBlockContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSehBlock([NotNull] CILParser.SehBlockContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSehClauses([NotNull] CILParser.SehClausesContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTryBlock([NotNull] CILParser.TryBlockContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSehClause([NotNull] CILParser.SehClauseContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitFilterClause([NotNull] CILParser.FilterClauseContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCatchClause([NotNull] CILParser.CatchClauseContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitFinallyClause([NotNull] CILParser.FinallyClauseContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitFaultClause([NotNull] CILParser.FaultClauseContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitHandlerBlock([NotNull] CILParser.HandlerBlockContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitDataDecl([NotNull] CILParser.DataDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitDdHead([NotNull] CILParser.DdHeadContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitTls([NotNull] CILParser.TlsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitDdBody([NotNull] CILParser.DdBodyContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitDdItemList([NotNull] CILParser.DdItemListContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitDdItemCount([NotNull] CILParser.DdItemCountContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitDdItem([NotNull] CILParser.DdItemContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitFieldSerInit([NotNull] CILParser.FieldSerInitContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitBytes([NotNull] CILParser.BytesContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitHexbyte([NotNull] CILParser.HexbyteContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitFieldInit([NotNull] CILParser.FieldInitContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSerInit([NotNull] CILParser.SerInitContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitF32seq([NotNull] CILParser.F32seqContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitF64seq([NotNull] CILParser.F64seqContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitI64seq([NotNull] CILParser.I64seqContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitI32seq([NotNull] CILParser.I32seqContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitI16seq([NotNull] CILParser.I16seqContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitI8seq([NotNull] CILParser.I8seqContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitBoolSeq([NotNull] CILParser.BoolSeqContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitSqstringSeq([NotNull] CILParser.SqstringSeqContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitClassSeq([NotNull] CILParser.ClassSeqContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitClassSeqElement([NotNull] CILParser.ClassSeqElementContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitObjSeq([NotNull] CILParser.ObjSeqContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitCustomAttrDecl([NotNull] CILParser.CustomAttrDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitAsmOrRefDecl([NotNull] CILParser.AsmOrRefDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitAssemblyRefHead([NotNull] CILParser.AssemblyRefHeadContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitAssemblyRefDecls([NotNull] CILParser.AssemblyRefDeclsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitAssemblyRefDecl([NotNull] CILParser.AssemblyRefDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitExptypeHead([NotNull] CILParser.ExptypeHeadContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitExportHead([NotNull] CILParser.ExportHeadContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitExptAttr([NotNull] CILParser.ExptAttrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitExptypeDecls([NotNull] CILParser.ExptypeDeclsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitExptypeDecl([NotNull] CILParser.ExptypeDeclContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitManifestResHead([NotNull] CILParser.ManifestResHeadContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitManresAttr([NotNull] CILParser.ManresAttrContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitManifestResDecls([NotNull] CILParser.ManifestResDeclsContext context) { return VisitChildren(context); } - /// - /// Visit a parse tree produced by . - /// - /// The default implementation returns the result of calling - /// on . - /// - /// - /// The parse tree. - /// The visitor result. - public virtual Result VisitManifestResDecl([NotNull] CILParser.ManifestResDeclContext context) { return VisitChildren(context); } -} -} // namespace ILAssembler diff --git a/src/tools/ilasm/src/ILAssembler/gen/CILLexer.cs b/src/tools/ilasm/src/ILAssembler/gen/CILLexer.cs index 3310518e31dce7..f7e4ca5d1ac2fb 100644 --- a/src/tools/ilasm/src/ILAssembler/gen/CILLexer.cs +++ b/src/tools/ilasm/src/ILAssembler/gen/CILLexer.cs @@ -34,54 +34,54 @@ public partial class CILLexer : Lexer { protected static DFA[] decisionToDFA; protected static PredictionContextCache sharedContextCache = new PredictionContextCache(); public const int - T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9, - T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17, - T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24, - T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31, - T__31=32, T__32=33, T__33=34, T__34=35, T__35=36, T__36=37, T__37=38, - T__38=39, T__39=40, T__40=41, T__41=42, T__42=43, T__43=44, T__44=45, - T__45=46, T__46=47, T__47=48, T__48=49, T__49=50, T__50=51, T__51=52, - T__52=53, T__53=54, T__54=55, T__55=56, T__56=57, T__57=58, T__58=59, - T__59=60, T__60=61, T__61=62, T__62=63, T__63=64, T__64=65, T__65=66, - T__66=67, T__67=68, T__68=69, T__69=70, T__70=71, T__71=72, T__72=73, - T__73=74, T__74=75, T__75=76, T__76=77, T__77=78, T__78=79, T__79=80, - T__80=81, T__81=82, T__82=83, T__83=84, T__84=85, T__85=86, T__86=87, - T__87=88, T__88=89, T__89=90, T__90=91, T__91=92, T__92=93, T__93=94, - T__94=95, T__95=96, T__96=97, T__97=98, T__98=99, T__99=100, T__100=101, - T__101=102, T__102=103, T__103=104, T__104=105, T__105=106, T__106=107, - T__107=108, T__108=109, T__109=110, T__110=111, T__111=112, T__112=113, - T__113=114, T__114=115, T__115=116, T__116=117, T__117=118, T__118=119, - T__119=120, T__120=121, T__121=122, T__122=123, T__123=124, T__124=125, - T__125=126, T__126=127, T__127=128, T__128=129, T__129=130, T__130=131, - T__131=132, T__132=133, T__133=134, T__134=135, T__135=136, T__136=137, - T__137=138, T__138=139, T__139=140, T__140=141, T__141=142, T__142=143, - T__143=144, T__144=145, T__145=146, T__146=147, T__147=148, T__148=149, - T__149=150, T__150=151, T__151=152, T__152=153, T__153=154, T__154=155, - T__155=156, T__156=157, T__157=158, T__158=159, T__159=160, T__160=161, - T__161=162, T__162=163, T__163=164, T__164=165, T__165=166, T__166=167, - T__167=168, T__168=169, T__169=170, T__170=171, INT32=172, INT64=173, - FLOAT64=174, DCOLON=175, ELLIPSIS=176, NULL=177, NULLREF=178, HASH=179, - CHAR=180, STRING=181, BOOL=182, INT8=183, INT16=184, INT32_=185, INT64_=186, - FLOAT32=187, FLOAT64_=188, UINT8=189, UINT16=190, UINT32=191, UINT64=192, - INT=193, UINT=194, TYPE=195, OBJECT=196, MODULE=197, VALUE=198, VALUETYPE=199, - VOID=200, ENUM=201, CUSTOM=202, FIXED=203, SYSSTRING=204, ARRAY=205, VARIANT=206, - CURRENCY=207, SYSCHAR=208, ERROR=209, DECIMAL=210, DATE=211, BSTR=212, - LPSTR=213, LPWSTR=214, LPTSTR=215, OBJECTREF=216, IUNKNOWN=217, IDISPATCH=218, - STRUCT=219, INTERFACE=220, SAFEARRAY=221, BYVALSTR=222, ANSI=223, TBSTR=224, - METHOD=225, ANY=226, LPSTRUCT=227, VECTOR=228, HRESULT=229, CARRAY=230, - USERDEFINED=231, RECORD=232, FILETIME=233, BLOB=234, STREAM=235, STORAGE=236, - STREAMED_OBJECT=237, STORED_OBJECT=238, BLOB_OBJECT=239, CF=240, CLSID=241, - INSTANCE=242, EXPLICIT=243, DEFAULT=244, VARARG=245, UNMANAGED=246, CDECL=247, - STDCALL=248, THISCALL=249, FASTCALL=250, TYPE_PARAMETER=251, METHOD_TYPE_PARAMETER=252, - TYPEDREF=253, PARAM=254, CONSTRAINT=255, THIS=256, BASE=257, NESTER=258, - REF=259, ARRAY_TYPE_NO_BOUNDS=260, PTR=261, QSTRING=262, SQSTRING=263, - DOT=264, PLUS=265, PP_DEFINE=266, PP_UNDEF=267, PP_IFDEF=268, PP_IFNDEF=269, - PP_ELSE=270, PP_ENDIF=271, PP_INCLUDE=272, MRESOURCE=273, INSTR_NONE=274, - INSTR_VAR=275, INSTR_I=276, INSTR_I8=277, INSTR_R=278, INSTR_METHOD=279, - INSTR_SIG=280, INSTR_BRTARGET=281, INSTR_SWITCH=282, INSTR_TYPE=283, INSTR_STRING=284, - INSTR_FIELD=285, INSTR_TOK=286, DOTTEDNAME=287, ID=288, HEXBYTE=289, WS=290, - SINGLE_LINE_COMMENT=291, COMMENT=292, PERMISSION=293, PERMISSIONSET=294, - EMITBYTE=295, MAXSTACK=296, ENTRYPOINT=297, ZEROINIT=298, LOCALS=299, + T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9, + T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17, + T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24, + T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31, + T__31=32, T__32=33, T__33=34, T__34=35, T__35=36, T__36=37, T__37=38, + T__38=39, T__39=40, T__40=41, T__41=42, T__42=43, T__43=44, T__44=45, + T__45=46, T__46=47, T__47=48, T__48=49, T__49=50, T__50=51, T__51=52, + T__52=53, T__53=54, T__54=55, T__55=56, T__56=57, T__57=58, T__58=59, + T__59=60, T__60=61, T__61=62, T__62=63, T__63=64, T__64=65, T__65=66, + T__66=67, T__67=68, T__68=69, T__69=70, T__70=71, T__71=72, T__72=73, + T__73=74, T__74=75, T__75=76, T__76=77, T__77=78, T__78=79, T__79=80, + T__80=81, T__81=82, T__82=83, T__83=84, T__84=85, T__85=86, T__86=87, + T__87=88, T__88=89, T__89=90, T__90=91, T__91=92, T__92=93, T__93=94, + T__94=95, T__95=96, T__96=97, T__97=98, T__98=99, T__99=100, T__100=101, + T__101=102, T__102=103, T__103=104, T__104=105, T__105=106, T__106=107, + T__107=108, T__108=109, T__109=110, T__110=111, T__111=112, T__112=113, + T__113=114, T__114=115, T__115=116, T__116=117, T__117=118, T__118=119, + T__119=120, T__120=121, T__121=122, T__122=123, T__123=124, T__124=125, + T__125=126, T__126=127, T__127=128, T__128=129, T__129=130, T__130=131, + T__131=132, T__132=133, T__133=134, T__134=135, T__135=136, T__136=137, + T__137=138, T__138=139, T__139=140, T__140=141, T__141=142, T__142=143, + T__143=144, T__144=145, T__145=146, T__146=147, T__147=148, T__148=149, + T__149=150, T__150=151, T__151=152, T__152=153, T__153=154, T__154=155, + T__155=156, T__156=157, T__157=158, T__158=159, T__159=160, T__160=161, + T__161=162, T__162=163, T__163=164, T__164=165, T__165=166, T__166=167, + T__167=168, T__168=169, T__169=170, T__170=171, INT32=172, INT64=173, + FLOAT64=174, DCOLON=175, ELLIPSIS=176, NULL=177, NULLREF=178, HASH=179, + CHAR=180, STRING=181, BOOL=182, INT8=183, INT16=184, INT32_=185, INT64_=186, + FLOAT32=187, FLOAT64_=188, UINT8=189, UINT16=190, UINT32=191, UINT64=192, + INT=193, UINT=194, TYPE=195, OBJECT=196, MODULE=197, VALUE=198, VALUETYPE=199, + VOID=200, ENUM=201, CUSTOM=202, FIXED=203, SYSSTRING=204, ARRAY=205, VARIANT=206, + CURRENCY=207, SYSCHAR=208, ERROR=209, DECIMAL=210, DATE=211, BSTR=212, + LPSTR=213, LPWSTR=214, LPTSTR=215, OBJECTREF=216, IUNKNOWN=217, IDISPATCH=218, + STRUCT=219, INTERFACE=220, SAFEARRAY=221, BYVALSTR=222, ANSI=223, TBSTR=224, + METHOD=225, ANY=226, LPSTRUCT=227, VECTOR=228, HRESULT=229, CARRAY=230, + USERDEFINED=231, RECORD=232, FILETIME=233, BLOB=234, STREAM=235, STORAGE=236, + STREAMED_OBJECT=237, STORED_OBJECT=238, BLOB_OBJECT=239, CF=240, CLSID=241, + INSTANCE=242, EXPLICIT=243, DEFAULT=244, VARARG=245, UNMANAGED=246, CDECL=247, + STDCALL=248, THISCALL=249, FASTCALL=250, TYPE_PARAMETER=251, METHOD_TYPE_PARAMETER=252, + TYPEDREF=253, PARAM=254, CONSTRAINT=255, THIS=256, BASE=257, NESTER=258, + REF=259, ARRAY_TYPE_NO_BOUNDS=260, PTR=261, QSTRING=262, SQSTRING=263, + DOT=264, PLUS=265, PP_DEFINE=266, PP_UNDEF=267, PP_IFDEF=268, PP_IFNDEF=269, + PP_ELSE=270, PP_ENDIF=271, PP_INCLUDE=272, MRESOURCE=273, INSTR_NONE=274, + INSTR_VAR=275, INSTR_I=276, INSTR_I8=277, INSTR_R=278, INSTR_METHOD=279, + INSTR_SIG=280, INSTR_BRTARGET=281, INSTR_SWITCH=282, INSTR_TYPE=283, INSTR_STRING=284, + INSTR_FIELD=285, INSTR_TOK=286, DOTTEDNAME=287, ID=288, HEXBYTE=289, WS=290, + SINGLE_LINE_COMMENT=291, COMMENT=292, PERMISSION=293, PERMISSIONSET=294, + EMITBYTE=295, MAXSTACK=296, ENTRYPOINT=297, ZEROINIT=298, LOCALS=299, EXPORT=300, OVERRIDE=301, VTENTRY=302; public static string[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" @@ -92,48 +92,48 @@ public const int }; public static readonly string[] ruleNames = { - "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8", - "T__9", "T__10", "T__11", "T__12", "T__13", "T__14", "T__15", "T__16", - "T__17", "T__18", "T__19", "T__20", "T__21", "T__22", "T__23", "T__24", - "T__25", "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", "T__32", - "T__33", "T__34", "T__35", "T__36", "T__37", "T__38", "T__39", "T__40", - "T__41", "T__42", "T__43", "T__44", "T__45", "T__46", "T__47", "T__48", - "T__49", "T__50", "T__51", "T__52", "T__53", "T__54", "T__55", "T__56", - "T__57", "T__58", "T__59", "T__60", "T__61", "T__62", "T__63", "T__64", - "T__65", "T__66", "T__67", "T__68", "T__69", "T__70", "T__71", "T__72", - "T__73", "T__74", "T__75", "T__76", "T__77", "T__78", "T__79", "T__80", - "T__81", "T__82", "T__83", "T__84", "T__85", "T__86", "T__87", "T__88", - "T__89", "T__90", "T__91", "T__92", "T__93", "T__94", "T__95", "T__96", - "T__97", "T__98", "T__99", "T__100", "T__101", "T__102", "T__103", "T__104", - "T__105", "T__106", "T__107", "T__108", "T__109", "T__110", "T__111", - "T__112", "T__113", "T__114", "T__115", "T__116", "T__117", "T__118", - "T__119", "T__120", "T__121", "T__122", "T__123", "T__124", "T__125", - "T__126", "T__127", "T__128", "T__129", "T__130", "T__131", "T__132", - "T__133", "T__134", "T__135", "T__136", "T__137", "T__138", "T__139", - "T__140", "T__141", "T__142", "T__143", "T__144", "T__145", "T__146", - "T__147", "T__148", "T__149", "T__150", "T__151", "T__152", "T__153", - "T__154", "T__155", "T__156", "T__157", "T__158", "T__159", "T__160", - "T__161", "T__162", "T__163", "T__164", "T__165", "T__166", "T__167", - "T__168", "T__169", "T__170", "INT32", "INT64", "FLOAT64", "DCOLON", "ELLIPSIS", - "NULL", "NULLREF", "HASH", "CHAR", "STRING", "BOOL", "INT8", "INT16", - "INT32_", "INT64_", "FLOAT32", "FLOAT64_", "UNSIGNED", "UINT8", "UINT16", - "UINT32", "UINT64", "INT", "UINT", "TYPE", "OBJECT", "MODULE", "VALUE", - "VALUETYPE", "VOID", "ENUM", "CUSTOM", "FIXED", "SYSSTRING", "ARRAY", - "VARIANT", "CURRENCY", "SYSCHAR", "ERROR", "DECIMAL", "DATE", "BSTR", - "LPSTR", "LPWSTR", "LPTSTR", "OBJECTREF", "IUNKNOWN", "IDISPATCH", "STRUCT", - "INTERFACE", "SAFEARRAY", "BYVALSTR", "ANSI", "TBSTR", "METHOD", "ANY", - "LPSTRUCT", "VECTOR", "HRESULT", "CARRAY", "USERDEFINED", "RECORD", "FILETIME", - "BLOB", "STREAM", "STORAGE", "STREAMED_OBJECT", "STORED_OBJECT", "BLOB_OBJECT", - "CF", "CLSID", "INSTANCE", "EXPLICIT", "DEFAULT", "VARARG", "UNMANAGED", - "CDECL", "STDCALL", "THISCALL", "FASTCALL", "TYPE_PARAMETER", "METHOD_TYPE_PARAMETER", - "TYPEDREF", "PARAM", "CONSTRAINT", "THIS", "BASE", "NESTER", "REF", "ARRAY_TYPE_NO_BOUNDS", - "PTR", "ESC_SEQ", "QSTRING", "SQSTRING", "DOT", "PLUS", "PP_DEFINE", "PP_UNDEF", - "PP_IFDEF", "PP_IFNDEF", "PP_ELSE", "PP_ENDIF", "PP_INCLUDE", "MRESOURCE", - "INSTR_NONE", "INSTR_VAR", "INSTR_I", "INSTR_I8", "INSTR_R", "INSTR_METHOD", - "INSTR_SIG", "INSTR_BRTARGET", "INSTR_SWITCH", "INSTR_TYPE", "INSTR_STRING", - "INSTR_FIELD", "INSTR_TOK", "IDSTART", "IDCONT", "DOTTEDNAME", "ID", "HEXBYTE", - "WS", "SINGLE_LINE_COMMENT", "COMMENT", "PERMISSION", "PERMISSIONSET", - "EMITBYTE", "MAXSTACK", "ENTRYPOINT", "ZEROINIT", "LOCALS", "EXPORT", + "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8", + "T__9", "T__10", "T__11", "T__12", "T__13", "T__14", "T__15", "T__16", + "T__17", "T__18", "T__19", "T__20", "T__21", "T__22", "T__23", "T__24", + "T__25", "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", "T__32", + "T__33", "T__34", "T__35", "T__36", "T__37", "T__38", "T__39", "T__40", + "T__41", "T__42", "T__43", "T__44", "T__45", "T__46", "T__47", "T__48", + "T__49", "T__50", "T__51", "T__52", "T__53", "T__54", "T__55", "T__56", + "T__57", "T__58", "T__59", "T__60", "T__61", "T__62", "T__63", "T__64", + "T__65", "T__66", "T__67", "T__68", "T__69", "T__70", "T__71", "T__72", + "T__73", "T__74", "T__75", "T__76", "T__77", "T__78", "T__79", "T__80", + "T__81", "T__82", "T__83", "T__84", "T__85", "T__86", "T__87", "T__88", + "T__89", "T__90", "T__91", "T__92", "T__93", "T__94", "T__95", "T__96", + "T__97", "T__98", "T__99", "T__100", "T__101", "T__102", "T__103", "T__104", + "T__105", "T__106", "T__107", "T__108", "T__109", "T__110", "T__111", + "T__112", "T__113", "T__114", "T__115", "T__116", "T__117", "T__118", + "T__119", "T__120", "T__121", "T__122", "T__123", "T__124", "T__125", + "T__126", "T__127", "T__128", "T__129", "T__130", "T__131", "T__132", + "T__133", "T__134", "T__135", "T__136", "T__137", "T__138", "T__139", + "T__140", "T__141", "T__142", "T__143", "T__144", "T__145", "T__146", + "T__147", "T__148", "T__149", "T__150", "T__151", "T__152", "T__153", + "T__154", "T__155", "T__156", "T__157", "T__158", "T__159", "T__160", + "T__161", "T__162", "T__163", "T__164", "T__165", "T__166", "T__167", + "T__168", "T__169", "T__170", "INT32", "INT64", "FLOAT64", "DCOLON", "ELLIPSIS", + "NULL", "NULLREF", "HASH", "CHAR", "STRING", "BOOL", "INT8", "INT16", + "INT32_", "INT64_", "FLOAT32", "FLOAT64_", "UNSIGNED", "UINT8", "UINT16", + "UINT32", "UINT64", "INT", "UINT", "TYPE", "OBJECT", "MODULE", "VALUE", + "VALUETYPE", "VOID", "ENUM", "CUSTOM", "FIXED", "SYSSTRING", "ARRAY", + "VARIANT", "CURRENCY", "SYSCHAR", "ERROR", "DECIMAL", "DATE", "BSTR", + "LPSTR", "LPWSTR", "LPTSTR", "OBJECTREF", "IUNKNOWN", "IDISPATCH", "STRUCT", + "INTERFACE", "SAFEARRAY", "BYVALSTR", "ANSI", "TBSTR", "METHOD", "ANY", + "LPSTRUCT", "VECTOR", "HRESULT", "CARRAY", "USERDEFINED", "RECORD", "FILETIME", + "BLOB", "STREAM", "STORAGE", "STREAMED_OBJECT", "STORED_OBJECT", "BLOB_OBJECT", + "CF", "CLSID", "INSTANCE", "EXPLICIT", "DEFAULT", "VARARG", "UNMANAGED", + "CDECL", "STDCALL", "THISCALL", "FASTCALL", "TYPE_PARAMETER", "METHOD_TYPE_PARAMETER", + "TYPEDREF", "PARAM", "CONSTRAINT", "THIS", "BASE", "NESTER", "REF", "ARRAY_TYPE_NO_BOUNDS", + "PTR", "ESC_SEQ", "QSTRING", "SQSTRING", "DOT", "PLUS", "PP_DEFINE", "PP_UNDEF", + "PP_IFDEF", "PP_IFNDEF", "PP_ELSE", "PP_ENDIF", "PP_INCLUDE", "MRESOURCE", + "INSTR_NONE", "INSTR_VAR", "INSTR_I", "INSTR_I8", "INSTR_R", "INSTR_METHOD", + "INSTR_SIG", "INSTR_BRTARGET", "INSTR_SWITCH", "INSTR_TYPE", "INSTR_STRING", + "INSTR_FIELD", "INSTR_TOK", "IDSTART", "IDCONT", "DOTTEDNAME", "ID", "HEXBYTE", + "WS", "SINGLE_LINE_COMMENT", "COMMENT", "PERMISSION", "PERMISSIONSET", + "EMITBYTE", "MAXSTACK", "ENTRYPOINT", "ZEROINIT", "LOCALS", "EXPORT", "OVERRIDE", "VTENTRY" }; @@ -148,91 +148,91 @@ public CILLexer(ICharStream input, TextWriter output, TextWriter errorOutput) } private static readonly string[] _LiteralNames = { - null, "'native'", "'cil'", "'optil'", "'managed'", "'forwardref'", "'preservesig'", - "'runtime'", "'internalcall'", "'synchronized'", "'noinlining'", "'aggressiveinlining'", - "'nooptimization'", "'aggressiveoptimization'", "'async'", "'extended'", - "'volatile'", "'{'", "'}'", "'.subsystem'", "'.corflags'", "'.file'", - "'alignment'", "'.imagebase'", "'.stackreserve'", "'.assembly'", "'.mscorlib'", - "'.language'", "','", "'.typelist'", "'('", "')'", "';'", "'.typedef'", - "'as'", "'.custom'", "'='", "'field'", "'property'", "'class'", "'extern'", - "'.vtfixup'", "'['", "']'", "'at'", "'fromunmanaged'", "'callmostderived'", - "'retainappdomain'", "'.vtable'", "'.namespace'", "'.class'", "'public'", - "'private'", "'sealed'", "'abstract'", "'auto'", "'sequential'", "'unicode'", - "'autochar'", "'import'", "'serializable'", "'windowsruntime'", "'nested'", - "'family'", "'assembly'", "'famandassem'", "'famorassem'", "'beforefieldinit'", - "'specialname'", "'rtspecialname'", "'flags'", "'extends'", "'implements'", - "'.line'", "'#line'", "':'", "'nometadata'", "'retargetable'", "'noplatform'", - "'legacy library'", "'x86'", "'amd64'", "'arm'", "'arm64'", "'bytearray'", - "'()'", "'<'", "'>'", "'/'", "'algorithm'", "'unsigned'", "'iidparam'", - "'pinned'", "'modreq'", "'modopt'", "'true'", "'false'", "'request'", - "'demand'", "'assert'", "'deny'", "'permitonly'", "'linkcheck'", "'inheritcheck'", - "'reqmin'", "'reqopt'", "'reqrefuse'", "'prejitgrant'", "'prejitdeny'", - "'noncasdemand'", "'noncaslinkdemand'", "'noncasinheritance'", "'callconv'", - "'mdtoken'", "'-'", "'byreflike'", "'.ctor'", "'.size'", "'.pack'", "'with'", - "'.interfaceimpl'", "'.field'", "'marshal'", "'static'", "'initonly'", - "'privatescope'", "'literal'", "'notserialized'", "'.event'", "'.addon'", - "'.removeon'", "'.fire'", "'.other'", "'.property'", "'.set'", "'.get'", - "'in'", "'out'", "'opt'", "'.method'", "'final'", "'virtual'", "'strict'", - "'hidebysig'", "'newslot'", "'unmanagedexp'", "'reqsecobj'", "'pinvokeimpl'", - "'nomangle'", "'lasterr'", "'winapi'", "'bestfit'", "'on'", "'off'", "'charmaperror'", - "'.cctor'", "'il'", "'init'", "'.try'", "'to'", "'filter'", "'catch'", - "'finally'", "'fault'", "'handler'", "'.data'", "'tls'", "'.publickey'", - "'.ver'", "'.locale'", "'.publickeytoken'", "'forwarder'", null, null, - null, "'::'", "'...'", "'null'", "'nullref'", "'.hash'", null, "'string'", - "'bool'", "'int8'", "'int16'", "'int32'", "'int64'", "'float32'", "'float64'", - "'uint8'", "'uint16'", "'uint32'", "'uint64'", "'int'", "'uint'", "'type'", - "'object'", "'.module'", "'value'", "'valuetype'", "'void'", "'enum'", - "'custom'", "'fixed'", "'sysstring'", "'array'", "'variant'", "'currency'", - "'syschar'", "'error'", "'decimal'", "'date'", "'bstr'", "'lpstr'", "'lpwstr'", - "'lptstr'", "'objectref'", "'iunknown'", "'idispatch'", "'struct'", "'interface'", - "'safearray'", "'byvalstr'", "'ansi'", "'tbstr'", "'method'", "'any'", - "'lpstruct'", "'vector'", "'hresult'", "'carray'", "'userdefined'", "'record'", - "'filetime'", "'blob'", "'stream'", "'storage'", "'streamed_object'", - "'stored_object'", "'blob_object'", "'cf'", "'clsid'", "'instance'", "'explicit'", - "'default'", "'vararg'", "'unmanaged'", "'cdecl'", "'stdcall'", "'thiscall'", - "'fastcall'", "'!'", null, null, "'.param'", "'constraint'", "'.this'", - "'.base'", "'.nester'", "'&'", null, "'*'", null, null, "'.'", "'+'", - "'#define'", "'#undef'", "'#ifdef'", "'#ifndef'", "'#else'", "'#endif'", - "'#include'", "'.mresource'", null, null, null, "'ldc.i8'", null, null, - "'calli'", null, "'switch'", null, "'ldstr'", null, "'ldtoken'", null, - null, null, null, null, null, "'.permission'", "'.permissionset'", "'.emitbyte'", - "'.maxstack'", "'.entrypoint'", "'.zeroinit'", "'.locals'", "'.export'", + null, "'native'", "'cil'", "'optil'", "'managed'", "'forwardref'", "'preservesig'", + "'runtime'", "'internalcall'", "'synchronized'", "'noinlining'", "'aggressiveinlining'", + "'nooptimization'", "'aggressiveoptimization'", "'async'", "'extended'", + "'volatile'", "'{'", "'}'", "'.subsystem'", "'.corflags'", "'.file'", + "'alignment'", "'.imagebase'", "'.stackreserve'", "'.assembly'", "'.mscorlib'", + "'.language'", "','", "'.typelist'", "'('", "')'", "';'", "'.typedef'", + "'as'", "'.custom'", "'='", "'field'", "'property'", "'class'", "'extern'", + "'.vtfixup'", "'['", "']'", "'at'", "'fromunmanaged'", "'callmostderived'", + "'retainappdomain'", "'.vtable'", "'.namespace'", "'.class'", "'public'", + "'private'", "'sealed'", "'abstract'", "'auto'", "'sequential'", "'unicode'", + "'autochar'", "'import'", "'serializable'", "'windowsruntime'", "'nested'", + "'family'", "'assembly'", "'famandassem'", "'famorassem'", "'beforefieldinit'", + "'specialname'", "'rtspecialname'", "'flags'", "'extends'", "'implements'", + "'.line'", "'#line'", "':'", "'nometadata'", "'retargetable'", "'noplatform'", + "'legacy library'", "'x86'", "'amd64'", "'arm'", "'arm64'", "'bytearray'", + "'()'", "'<'", "'>'", "'/'", "'algorithm'", "'unsigned'", "'iidparam'", + "'pinned'", "'modreq'", "'modopt'", "'true'", "'false'", "'request'", + "'demand'", "'assert'", "'deny'", "'permitonly'", "'linkcheck'", "'inheritcheck'", + "'reqmin'", "'reqopt'", "'reqrefuse'", "'prejitgrant'", "'prejitdeny'", + "'noncasdemand'", "'noncaslinkdemand'", "'noncasinheritance'", "'callconv'", + "'mdtoken'", "'-'", "'byreflike'", "'.ctor'", "'.size'", "'.pack'", "'with'", + "'.interfaceimpl'", "'.field'", "'marshal'", "'static'", "'initonly'", + "'privatescope'", "'literal'", "'notserialized'", "'.event'", "'.addon'", + "'.removeon'", "'.fire'", "'.other'", "'.property'", "'.set'", "'.get'", + "'in'", "'out'", "'opt'", "'.method'", "'final'", "'virtual'", "'strict'", + "'hidebysig'", "'newslot'", "'unmanagedexp'", "'reqsecobj'", "'pinvokeimpl'", + "'nomangle'", "'lasterr'", "'winapi'", "'bestfit'", "'on'", "'off'", "'charmaperror'", + "'.cctor'", "'il'", "'init'", "'.try'", "'to'", "'filter'", "'catch'", + "'finally'", "'fault'", "'handler'", "'.data'", "'tls'", "'.publickey'", + "'.ver'", "'.locale'", "'.publickeytoken'", "'forwarder'", null, null, + null, "'::'", "'...'", "'null'", "'nullref'", "'.hash'", null, "'string'", + "'bool'", "'int8'", "'int16'", "'int32'", "'int64'", "'float32'", "'float64'", + "'uint8'", "'uint16'", "'uint32'", "'uint64'", "'int'", "'uint'", "'type'", + "'object'", "'.module'", "'value'", "'valuetype'", "'void'", "'enum'", + "'custom'", "'fixed'", "'sysstring'", "'array'", "'variant'", "'currency'", + "'syschar'", "'error'", "'decimal'", "'date'", "'bstr'", "'lpstr'", "'lpwstr'", + "'lptstr'", "'objectref'", "'iunknown'", "'idispatch'", "'struct'", "'interface'", + "'safearray'", "'byvalstr'", "'ansi'", "'tbstr'", "'method'", "'any'", + "'lpstruct'", "'vector'", "'hresult'", "'carray'", "'userdefined'", "'record'", + "'filetime'", "'blob'", "'stream'", "'storage'", "'streamed_object'", + "'stored_object'", "'blob_object'", "'cf'", "'clsid'", "'instance'", "'explicit'", + "'default'", "'vararg'", "'unmanaged'", "'cdecl'", "'stdcall'", "'thiscall'", + "'fastcall'", "'!'", null, null, "'.param'", "'constraint'", "'.this'", + "'.base'", "'.nester'", "'&'", null, "'*'", null, null, "'.'", "'+'", + "'#define'", "'#undef'", "'#ifdef'", "'#ifndef'", "'#else'", "'#endif'", + "'#include'", "'.mresource'", null, null, null, "'ldc.i8'", null, null, + "'calli'", null, "'switch'", null, "'ldstr'", null, "'ldtoken'", null, + null, null, null, null, null, "'.permission'", "'.permissionset'", "'.emitbyte'", + "'.maxstack'", "'.entrypoint'", "'.zeroinit'", "'.locals'", "'.export'", "'.override'", "'.vtentry'" }; private static readonly string[] _SymbolicNames = { - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, "INT32", "INT64", "FLOAT64", "DCOLON", "ELLIPSIS", - "NULL", "NULLREF", "HASH", "CHAR", "STRING", "BOOL", "INT8", "INT16", - "INT32_", "INT64_", "FLOAT32", "FLOAT64_", "UINT8", "UINT16", "UINT32", - "UINT64", "INT", "UINT", "TYPE", "OBJECT", "MODULE", "VALUE", "VALUETYPE", - "VOID", "ENUM", "CUSTOM", "FIXED", "SYSSTRING", "ARRAY", "VARIANT", "CURRENCY", - "SYSCHAR", "ERROR", "DECIMAL", "DATE", "BSTR", "LPSTR", "LPWSTR", "LPTSTR", - "OBJECTREF", "IUNKNOWN", "IDISPATCH", "STRUCT", "INTERFACE", "SAFEARRAY", - "BYVALSTR", "ANSI", "TBSTR", "METHOD", "ANY", "LPSTRUCT", "VECTOR", "HRESULT", - "CARRAY", "USERDEFINED", "RECORD", "FILETIME", "BLOB", "STREAM", "STORAGE", - "STREAMED_OBJECT", "STORED_OBJECT", "BLOB_OBJECT", "CF", "CLSID", "INSTANCE", - "EXPLICIT", "DEFAULT", "VARARG", "UNMANAGED", "CDECL", "STDCALL", "THISCALL", - "FASTCALL", "TYPE_PARAMETER", "METHOD_TYPE_PARAMETER", "TYPEDREF", "PARAM", - "CONSTRAINT", "THIS", "BASE", "NESTER", "REF", "ARRAY_TYPE_NO_BOUNDS", - "PTR", "QSTRING", "SQSTRING", "DOT", "PLUS", "PP_DEFINE", "PP_UNDEF", - "PP_IFDEF", "PP_IFNDEF", "PP_ELSE", "PP_ENDIF", "PP_INCLUDE", "MRESOURCE", - "INSTR_NONE", "INSTR_VAR", "INSTR_I", "INSTR_I8", "INSTR_R", "INSTR_METHOD", - "INSTR_SIG", "INSTR_BRTARGET", "INSTR_SWITCH", "INSTR_TYPE", "INSTR_STRING", - "INSTR_FIELD", "INSTR_TOK", "DOTTEDNAME", "ID", "HEXBYTE", "WS", "SINGLE_LINE_COMMENT", - "COMMENT", "PERMISSION", "PERMISSIONSET", "EMITBYTE", "MAXSTACK", "ENTRYPOINT", + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, "INT32", "INT64", "FLOAT64", "DCOLON", "ELLIPSIS", + "NULL", "NULLREF", "HASH", "CHAR", "STRING", "BOOL", "INT8", "INT16", + "INT32_", "INT64_", "FLOAT32", "FLOAT64_", "UINT8", "UINT16", "UINT32", + "UINT64", "INT", "UINT", "TYPE", "OBJECT", "MODULE", "VALUE", "VALUETYPE", + "VOID", "ENUM", "CUSTOM", "FIXED", "SYSSTRING", "ARRAY", "VARIANT", "CURRENCY", + "SYSCHAR", "ERROR", "DECIMAL", "DATE", "BSTR", "LPSTR", "LPWSTR", "LPTSTR", + "OBJECTREF", "IUNKNOWN", "IDISPATCH", "STRUCT", "INTERFACE", "SAFEARRAY", + "BYVALSTR", "ANSI", "TBSTR", "METHOD", "ANY", "LPSTRUCT", "VECTOR", "HRESULT", + "CARRAY", "USERDEFINED", "RECORD", "FILETIME", "BLOB", "STREAM", "STORAGE", + "STREAMED_OBJECT", "STORED_OBJECT", "BLOB_OBJECT", "CF", "CLSID", "INSTANCE", + "EXPLICIT", "DEFAULT", "VARARG", "UNMANAGED", "CDECL", "STDCALL", "THISCALL", + "FASTCALL", "TYPE_PARAMETER", "METHOD_TYPE_PARAMETER", "TYPEDREF", "PARAM", + "CONSTRAINT", "THIS", "BASE", "NESTER", "REF", "ARRAY_TYPE_NO_BOUNDS", + "PTR", "QSTRING", "SQSTRING", "DOT", "PLUS", "PP_DEFINE", "PP_UNDEF", + "PP_IFDEF", "PP_IFNDEF", "PP_ELSE", "PP_ENDIF", "PP_INCLUDE", "MRESOURCE", + "INSTR_NONE", "INSTR_VAR", "INSTR_I", "INSTR_I8", "INSTR_R", "INSTR_METHOD", + "INSTR_SIG", "INSTR_BRTARGET", "INSTR_SWITCH", "INSTR_TYPE", "INSTR_STRING", + "INSTR_FIELD", "INSTR_TOK", "DOTTEDNAME", "ID", "HEXBYTE", "WS", "SINGLE_LINE_COMMENT", + "COMMENT", "PERMISSION", "PERMISSIONSET", "EMITBYTE", "MAXSTACK", "ENTRYPOINT", "ZEROINIT", "LOCALS", "EXPORT", "OVERRIDE", "VTENTRY" }; public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames); diff --git a/src/tools/ilasm/src/ILAssembler/gen/CILParser.cs b/src/tools/ilasm/src/ILAssembler/gen/CILParser.cs index 161163a56f1c43..e7203e63fdb6b7 100644 --- a/src/tools/ilasm/src/ILAssembler/gen/CILParser.cs +++ b/src/tools/ilasm/src/ILAssembler/gen/CILParser.cs @@ -20,6 +20,9 @@ #pragma warning disable 419 namespace ILAssembler { + +#nullable enable annotations + using System; using System.IO; using System.Text; @@ -37,232 +40,233 @@ public partial class CILParser : Parser { protected static DFA[] decisionToDFA; protected static PredictionContextCache sharedContextCache = new PredictionContextCache(); public const int - T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9, - T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17, - T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24, - T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31, - T__31=32, T__32=33, T__33=34, T__34=35, T__35=36, T__36=37, T__37=38, - T__38=39, T__39=40, T__40=41, T__41=42, T__42=43, T__43=44, T__44=45, - T__45=46, T__46=47, T__47=48, T__48=49, T__49=50, T__50=51, T__51=52, - T__52=53, T__53=54, T__54=55, T__55=56, T__56=57, T__57=58, T__58=59, - T__59=60, T__60=61, T__61=62, T__62=63, T__63=64, T__64=65, T__65=66, - T__66=67, T__67=68, T__68=69, T__69=70, T__70=71, T__71=72, T__72=73, - T__73=74, T__74=75, T__75=76, T__76=77, T__77=78, T__78=79, T__79=80, - T__80=81, T__81=82, T__82=83, T__83=84, T__84=85, T__85=86, T__86=87, - T__87=88, T__88=89, T__89=90, T__90=91, T__91=92, T__92=93, T__93=94, - T__94=95, T__95=96, T__96=97, T__97=98, T__98=99, T__99=100, T__100=101, - T__101=102, T__102=103, T__103=104, T__104=105, T__105=106, T__106=107, - T__107=108, T__108=109, T__109=110, T__110=111, T__111=112, T__112=113, - T__113=114, T__114=115, T__115=116, T__116=117, T__117=118, T__118=119, - T__119=120, T__120=121, T__121=122, T__122=123, T__123=124, T__124=125, - T__125=126, T__126=127, T__127=128, T__128=129, T__129=130, T__130=131, - T__131=132, T__132=133, T__133=134, T__134=135, T__135=136, T__136=137, - T__137=138, T__138=139, T__139=140, T__140=141, T__141=142, T__142=143, - T__143=144, T__144=145, T__145=146, T__146=147, T__147=148, T__148=149, - T__149=150, T__150=151, T__151=152, T__152=153, T__153=154, T__154=155, - T__155=156, T__156=157, T__157=158, T__158=159, T__159=160, T__160=161, - T__161=162, T__162=163, T__163=164, T__164=165, T__165=166, T__166=167, - T__167=168, T__168=169, T__169=170, T__170=171, INT32=172, INT64=173, - FLOAT64=174, DCOLON=175, ELLIPSIS=176, NULL=177, NULLREF=178, HASH=179, - CHAR=180, STRING=181, BOOL=182, INT8=183, INT16=184, INT32_=185, INT64_=186, - FLOAT32=187, FLOAT64_=188, UINT8=189, UINT16=190, UINT32=191, UINT64=192, - INT=193, UINT=194, TYPE=195, OBJECT=196, MODULE=197, VALUE=198, VALUETYPE=199, - VOID=200, ENUM=201, CUSTOM=202, FIXED=203, SYSSTRING=204, ARRAY=205, VARIANT=206, - CURRENCY=207, SYSCHAR=208, ERROR=209, DECIMAL=210, DATE=211, BSTR=212, - LPSTR=213, LPWSTR=214, LPTSTR=215, OBJECTREF=216, IUNKNOWN=217, IDISPATCH=218, - STRUCT=219, INTERFACE=220, SAFEARRAY=221, BYVALSTR=222, ANSI=223, TBSTR=224, - METHOD=225, ANY=226, LPSTRUCT=227, VECTOR=228, HRESULT=229, CARRAY=230, - USERDEFINED=231, RECORD=232, FILETIME=233, BLOB=234, STREAM=235, STORAGE=236, - STREAMED_OBJECT=237, STORED_OBJECT=238, BLOB_OBJECT=239, CF=240, CLSID=241, - INSTANCE=242, EXPLICIT=243, DEFAULT=244, VARARG=245, UNMANAGED=246, CDECL=247, - STDCALL=248, THISCALL=249, FASTCALL=250, TYPE_PARAMETER=251, METHOD_TYPE_PARAMETER=252, - TYPEDREF=253, PARAM=254, CONSTRAINT=255, THIS=256, BASE=257, NESTER=258, - REF=259, ARRAY_TYPE_NO_BOUNDS=260, PTR=261, QSTRING=262, SQSTRING=263, - DOT=264, PLUS=265, PP_DEFINE=266, PP_UNDEF=267, PP_IFDEF=268, PP_IFNDEF=269, - PP_ELSE=270, PP_ENDIF=271, PP_INCLUDE=272, MRESOURCE=273, INSTR_NONE=274, - INSTR_VAR=275, INSTR_I=276, INSTR_I8=277, INSTR_R=278, INSTR_METHOD=279, - INSTR_SIG=280, INSTR_BRTARGET=281, INSTR_SWITCH=282, INSTR_TYPE=283, INSTR_STRING=284, - INSTR_FIELD=285, INSTR_TOK=286, DOTTEDNAME=287, ID=288, HEXBYTE=289, WS=290, - SINGLE_LINE_COMMENT=291, COMMENT=292, PERMISSION=293, PERMISSIONSET=294, - EMITBYTE=295, MAXSTACK=296, ENTRYPOINT=297, ZEROINIT=298, LOCALS=299, + T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9, + T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17, + T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24, + T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31, + T__31=32, T__32=33, T__33=34, T__34=35, T__35=36, T__36=37, T__37=38, + T__38=39, T__39=40, T__40=41, T__41=42, T__42=43, T__43=44, T__44=45, + T__45=46, T__46=47, T__47=48, T__48=49, T__49=50, T__50=51, T__51=52, + T__52=53, T__53=54, T__54=55, T__55=56, T__56=57, T__57=58, T__58=59, + T__59=60, T__60=61, T__61=62, T__62=63, T__63=64, T__64=65, T__65=66, + T__66=67, T__67=68, T__68=69, T__69=70, T__70=71, T__71=72, T__72=73, + T__73=74, T__74=75, T__75=76, T__76=77, T__77=78, T__78=79, T__79=80, + T__80=81, T__81=82, T__82=83, T__83=84, T__84=85, T__85=86, T__86=87, + T__87=88, T__88=89, T__89=90, T__90=91, T__91=92, T__92=93, T__93=94, + T__94=95, T__95=96, T__96=97, T__97=98, T__98=99, T__99=100, T__100=101, + T__101=102, T__102=103, T__103=104, T__104=105, T__105=106, T__106=107, + T__107=108, T__108=109, T__109=110, T__110=111, T__111=112, T__112=113, + T__113=114, T__114=115, T__115=116, T__116=117, T__117=118, T__118=119, + T__119=120, T__120=121, T__121=122, T__122=123, T__123=124, T__124=125, + T__125=126, T__126=127, T__127=128, T__128=129, T__129=130, T__130=131, + T__131=132, T__132=133, T__133=134, T__134=135, T__135=136, T__136=137, + T__137=138, T__138=139, T__139=140, T__140=141, T__141=142, T__142=143, + T__143=144, T__144=145, T__145=146, T__146=147, T__147=148, T__148=149, + T__149=150, T__150=151, T__151=152, T__152=153, T__153=154, T__154=155, + T__155=156, T__156=157, T__157=158, T__158=159, T__159=160, T__160=161, + T__161=162, T__162=163, T__163=164, T__164=165, T__165=166, T__166=167, + T__167=168, T__168=169, T__169=170, T__170=171, INT32=172, INT64=173, + FLOAT64=174, DCOLON=175, ELLIPSIS=176, NULL=177, NULLREF=178, HASH=179, + CHAR=180, STRING=181, BOOL=182, INT8=183, INT16=184, INT32_=185, INT64_=186, + FLOAT32=187, FLOAT64_=188, UINT8=189, UINT16=190, UINT32=191, UINT64=192, + INT=193, UINT=194, TYPE=195, OBJECT=196, MODULE=197, VALUE=198, VALUETYPE=199, + VOID=200, ENUM=201, CUSTOM=202, FIXED=203, SYSSTRING=204, ARRAY=205, VARIANT=206, + CURRENCY=207, SYSCHAR=208, ERROR=209, DECIMAL=210, DATE=211, BSTR=212, + LPSTR=213, LPWSTR=214, LPTSTR=215, OBJECTREF=216, IUNKNOWN=217, IDISPATCH=218, + STRUCT=219, INTERFACE=220, SAFEARRAY=221, BYVALSTR=222, ANSI=223, TBSTR=224, + METHOD=225, ANY=226, LPSTRUCT=227, VECTOR=228, HRESULT=229, CARRAY=230, + USERDEFINED=231, RECORD=232, FILETIME=233, BLOB=234, STREAM=235, STORAGE=236, + STREAMED_OBJECT=237, STORED_OBJECT=238, BLOB_OBJECT=239, CF=240, CLSID=241, + INSTANCE=242, EXPLICIT=243, DEFAULT=244, VARARG=245, UNMANAGED=246, CDECL=247, + STDCALL=248, THISCALL=249, FASTCALL=250, TYPE_PARAMETER=251, METHOD_TYPE_PARAMETER=252, + TYPEDREF=253, PARAM=254, CONSTRAINT=255, THIS=256, BASE=257, NESTER=258, + REF=259, ARRAY_TYPE_NO_BOUNDS=260, PTR=261, QSTRING=262, SQSTRING=263, + DOT=264, PLUS=265, PP_DEFINE=266, PP_UNDEF=267, PP_IFDEF=268, PP_IFNDEF=269, + PP_ELSE=270, PP_ENDIF=271, PP_INCLUDE=272, MRESOURCE=273, INSTR_NONE=274, + INSTR_VAR=275, INSTR_I=276, INSTR_I8=277, INSTR_R=278, INSTR_METHOD=279, + INSTR_SIG=280, INSTR_BRTARGET=281, INSTR_SWITCH=282, INSTR_TYPE=283, INSTR_STRING=284, + INSTR_FIELD=285, INSTR_TOK=286, DOTTEDNAME=287, ID=288, HEXBYTE=289, WS=290, + SINGLE_LINE_COMMENT=291, COMMENT=292, PERMISSION=293, PERMISSIONSET=294, + EMITBYTE=295, MAXSTACK=296, ENTRYPOINT=297, ZEROINIT=298, LOCALS=299, EXPORT=300, OVERRIDE=301, VTENTRY=302, IncludedFileEof=303, SyntheticIncludedFileEof=304; public const int - RULE_id = 0, RULE_dottedName = 1, RULE_dottedNamePart = 2, RULE_compQstring = 3, - RULE_decls = 4, RULE_decl = 5, RULE_subsystem = 6, RULE_corflags = 7, - RULE_alignment = 8, RULE_imagebase = 9, RULE_stackreserve = 10, RULE_assemblyBlock = 11, - RULE_mscorlib = 12, RULE_languageDecl = 13, RULE_languageString = 14, - RULE_typelist = 15, RULE_int32 = 16, RULE_int64 = 17, RULE_float64 = 18, - RULE_intOrWildcard = 19, RULE_compControl = 20, RULE_typedefDecl = 21, - RULE_customDescr = 22, RULE_customDescrWithOwner = 23, RULE_customType = 24, - RULE_ownerType = 25, RULE_customBlobDescr = 26, RULE_customBlobArgs = 27, - RULE_customBlobNVPairs = 28, RULE_fieldOrProp = 29, RULE_serializType = 30, - RULE_serializTypeElement = 31, RULE_moduleHead = 32, RULE_vtfixupDecl = 33, - RULE_vtfixupAttr = 34, RULE_vtableDecl = 35, RULE_nameSpaceHead = 36, - RULE_classHead = 37, RULE_classAttr = 38, RULE_extendsClause = 39, RULE_implClause = 40, - RULE_classDecls = 41, RULE_implList = 42, RULE_esHead = 43, RULE_extSourceSpec = 44, - RULE_fileDecl = 45, RULE_fileAttr = 46, RULE_fileEntry = 47, RULE_asmAttrAny = 48, - RULE_asmAttr = 49, RULE_instr_none = 50, RULE_instr_var = 51, RULE_instr_i = 52, - RULE_instr_i8 = 53, RULE_instr_r = 54, RULE_instr_brtarget = 55, RULE_instr_method = 56, - RULE_instr_field = 57, RULE_instr_type = 58, RULE_instr_string = 59, RULE_instr_sig = 60, - RULE_instr_tok = 61, RULE_instr_switch = 62, RULE_instr = 63, RULE_labels = 64, - RULE_typeArgs = 65, RULE_bounds = 66, RULE_sigArgs = 67, RULE_sigArg = 68, - RULE_className = 69, RULE_slashedName = 70, RULE_assemblyDecls = 71, RULE_assemblyDecl = 72, - RULE_typeSpec = 73, RULE_nativeType = 74, RULE_nativeTypeArrayPointerInfo = 75, - RULE_nativeTypeElement = 76, RULE_iidParamIndex = 77, RULE_variantType = 78, - RULE_variantTypeElement = 79, RULE_type = 80, RULE_typeModifiers = 81, - RULE_elementType = 82, RULE_simpleType = 83, RULE_bound = 84, RULE_nativeInt = 85, - RULE_nativeUint = 86, RULE_secDecl = 87, RULE_secAttrSetBlob = 88, RULE_secAttrBlob = 89, - RULE_nameValPairs = 90, RULE_nameValPair = 91, RULE_truefalse = 92, RULE_caValue = 93, - RULE_secAction = 94, RULE_methodRef = 95, RULE_callConv = 96, RULE_callKind = 97, - RULE_mdtoken = 98, RULE_memberRef = 99, RULE_fieldRef = 100, RULE_typeList = 101, - RULE_typarsClause = 102, RULE_typarAttrib = 103, RULE_typarAttribs = 104, - RULE_typar = 105, RULE_typars = 106, RULE_tyBound = 107, RULE_genArity = 108, - RULE_genArityNotEmpty = 109, RULE_classDecl = 110, RULE_fieldDecl = 111, - RULE_fieldAttr = 112, RULE_atOpt = 113, RULE_initOpt = 114, RULE_repeatOpt = 115, - RULE_eventHead = 116, RULE_eventAttr = 117, RULE_eventDecls = 118, RULE_eventDecl = 119, - RULE_propHead = 120, RULE_propAttr = 121, RULE_propDecls = 122, RULE_propDecl = 123, - RULE_marshalClause = 124, RULE_marshalBlob = 125, RULE_paramAttr = 126, - RULE_paramAttrElement = 127, RULE_methodHead = 128, RULE_methAttr = 129, - RULE_pinvImpl = 130, RULE_pinvAttr = 131, RULE_methodName = 132, RULE_implAttr = 133, - RULE_methodDecls = 134, RULE_methodDecl = 135, RULE_labelDecl = 136, RULE_customDescrInMethodBody = 137, - RULE_scopeBlock = 138, RULE_sehBlock = 139, RULE_sehClauses = 140, RULE_tryBlock = 141, - RULE_sehClause = 142, RULE_filterClause = 143, RULE_catchClause = 144, - RULE_finallyClause = 145, RULE_faultClause = 146, RULE_handlerBlock = 147, - RULE_dataDecl = 148, RULE_ddHead = 149, RULE_tls = 150, RULE_ddBody = 151, - RULE_ddItemList = 152, RULE_ddItemCount = 153, RULE_ddItem = 154, RULE_fieldSerInit = 155, - RULE_bytes = 156, RULE_hexbyte = 157, RULE_fieldInit = 158, RULE_serInit = 159, - RULE_f32seq = 160, RULE_f64seq = 161, RULE_i64seq = 162, RULE_i32seq = 163, - RULE_i16seq = 164, RULE_i8seq = 165, RULE_boolSeq = 166, RULE_sqstringSeq = 167, - RULE_classSeq = 168, RULE_classSeqElement = 169, RULE_objSeq = 170, RULE_customAttrDecl = 171, - RULE_asmOrRefDecl = 172, RULE_assemblyRefHead = 173, RULE_assemblyRefDecls = 174, - RULE_assemblyRefDecl = 175, RULE_exptypeHead = 176, RULE_exportHead = 177, - RULE_exptAttr = 178, RULE_exptypeDecls = 179, RULE_exptypeDecl = 180, - RULE_manifestResHead = 181, RULE_manresAttr = 182, RULE_manifestResDecls = 183, - RULE_manifestResDecl = 184; + RULE_id = 0, RULE_dottedName = 1, RULE_dottedNamePart = 2, RULE_compQstring = 3, + RULE_decls = 4, RULE_decl = 5, RULE_subsystem = 6, RULE_corflags = 7, + RULE_alignment = 8, RULE_imagebase = 9, RULE_stackreserve = 10, RULE_assemblyBlock = 11, + RULE_mscorlib = 12, RULE_languageDecl = 13, RULE_languageString = 14, + RULE_typelist = 15, RULE_int32 = 16, RULE_int64 = 17, RULE_float64 = 18, + RULE_intOrWildcard = 19, RULE_compControl = 20, RULE_typedefDecl = 21, + RULE_customDescr = 22, RULE_customDescrWithOwner = 23, RULE_customType = 24, + RULE_ownerType = 25, RULE_customBlobDescr = 26, RULE_customBlobArgs = 27, + RULE_customBlobNVPairs = 28, RULE_fieldOrProp = 29, RULE_serializType = 30, + RULE_serializTypeElement = 31, RULE_moduleHead = 32, RULE_vtfixupDecl = 33, + RULE_vtfixupAttr = 34, RULE_vtfixupAttrElement = 35, RULE_vtableDecl = 36, + RULE_nameSpaceHead = 37, RULE_classHead = 38, RULE_classAttr = 39, RULE_extendsClause = 40, + RULE_implClause = 41, RULE_classDecls = 42, RULE_implList = 43, RULE_esHead = 44, + RULE_extSourceSpec = 45, RULE_fileDecl = 46, RULE_fileAttr = 47, RULE_fileEntry = 48, + RULE_asmAttrAny = 49, RULE_asmAttr = 50, RULE_instr = 51, RULE_simpleInstr = 52, + RULE_calliSignature = 53, RULE_labels = 54, RULE_typeArgs = 55, RULE_bounds = 56, + RULE_sigArgs = 57, RULE_sigArg = 58, RULE_className = 59, RULE_slashedName = 60, + RULE_assemblyDecls = 61, RULE_assemblyDecl = 62, RULE_typeSpec = 63, RULE_typeSpecOrScope = 64, + RULE_nativeType = 65, RULE_nativeTypeArrayPointerInfo = 66, RULE_nativeTypeElement = 67, + RULE_iidParamIndex = 68, RULE_variantType = 69, RULE_variantTypeElement = 70, + RULE_type = 71, RULE_typeModifiers = 72, RULE_elementType = 73, RULE_simpleType = 74, + RULE_bound = 75, RULE_nativeInt = 76, RULE_nativeUint = 77, RULE_secDecl = 78, + RULE_secAttrSetBlob = 79, RULE_secAttrBlob = 80, RULE_nameValPairs = 81, + RULE_nameValPair = 82, RULE_truefalse = 83, RULE_caValue = 84, RULE_secAction = 85, + RULE_methodRef = 86, RULE_callConv = 87, RULE_callKind = 88, RULE_mdtoken = 89, + RULE_memberRef = 90, RULE_fieldRef = 91, RULE_typeList = 92, RULE_typarsClause = 93, + RULE_typarAttrib = 94, RULE_typarAttribs = 95, RULE_typar = 96, RULE_typars = 97, + RULE_tyBound = 98, RULE_genArity = 99, RULE_genArityNotEmpty = 100, RULE_classDecl = 101, + RULE_fieldDecl = 102, RULE_fieldAttr = 103, RULE_atOpt = 104, RULE_initOpt = 105, + RULE_repeatOpt = 106, RULE_eventHead = 107, RULE_eventAttr = 108, RULE_eventDecls = 109, + RULE_eventDecl = 110, RULE_propHead = 111, RULE_propAttr = 112, RULE_propDecls = 113, + RULE_propDecl = 114, RULE_marshalClause = 115, RULE_marshalBlob = 116, + RULE_paramAttr = 117, RULE_paramAttrElement = 118, RULE_methodHead = 119, + RULE_methAttr = 120, RULE_pinvImpl = 121, RULE_pinvAttr = 122, RULE_methodName = 123, + RULE_implAttr = 124, RULE_methodDecls = 125, RULE_methodDecl = 126, RULE_localsDecl = 127, + RULE_exportDecl = 128, RULE_vtentryDecl = 129, RULE_overrideDecl = 130, + RULE_parameterDecl = 131, RULE_labelDecl = 132, RULE_customDescrInMethodBody = 133, + RULE_scopeBlock = 134, RULE_sehBlock = 135, RULE_sehClauses = 136, RULE_tryBlock = 137, + RULE_sehClause = 138, RULE_filterClause = 139, RULE_catchClause = 140, + RULE_finallyClause = 141, RULE_faultClause = 142, RULE_handlerBlock = 143, + RULE_dataDecl = 144, RULE_ddHead = 145, RULE_tls = 146, RULE_ddBody = 147, + RULE_ddItemList = 148, RULE_ddItemCount = 149, RULE_ddItem = 150, RULE_fieldSerInit = 151, + RULE_bytes = 152, RULE_hexbyte = 153, RULE_fieldInit = 154, RULE_serInit = 155, + RULE_f32seq = 156, RULE_f64seq = 157, RULE_i64seq = 158, RULE_i32seq = 159, + RULE_i16seq = 160, RULE_i8seq = 161, RULE_boolSeq = 162, RULE_sqstringSeq = 163, + RULE_classSeq = 164, RULE_classSeqElement = 165, RULE_objSeq = 166, RULE_customAttrDecl = 167, + RULE_asmOrRefDecl = 168, RULE_assemblyRefBlock = 169, RULE_assemblyRefHead = 170, + RULE_assemblyRefDecls = 171, RULE_assemblyRefDecl = 172, RULE_exptypeBlock = 173, + RULE_exptypeHead = 174, RULE_exportHead = 175, RULE_exptAttrs = 176, RULE_exptAttr = 177, + RULE_exptypeDecls = 178, RULE_exptypeDecl = 179, RULE_manifestResBlock = 180, + RULE_manifestResHead = 181, RULE_manresAttrs = 182, RULE_manresAttr = 183, + RULE_manifestResDecls = 184, RULE_manifestResDecl = 185; public static readonly string[] ruleNames = { - "id", "dottedName", "dottedNamePart", "compQstring", "decls", "decl", - "subsystem", "corflags", "alignment", "imagebase", "stackreserve", "assemblyBlock", - "mscorlib", "languageDecl", "languageString", "typelist", "int32", "int64", - "float64", "intOrWildcard", "compControl", "typedefDecl", "customDescr", - "customDescrWithOwner", "customType", "ownerType", "customBlobDescr", - "customBlobArgs", "customBlobNVPairs", "fieldOrProp", "serializType", - "serializTypeElement", "moduleHead", "vtfixupDecl", "vtfixupAttr", "vtableDecl", - "nameSpaceHead", "classHead", "classAttr", "extendsClause", "implClause", - "classDecls", "implList", "esHead", "extSourceSpec", "fileDecl", "fileAttr", - "fileEntry", "asmAttrAny", "asmAttr", "instr_none", "instr_var", "instr_i", - "instr_i8", "instr_r", "instr_brtarget", "instr_method", "instr_field", - "instr_type", "instr_string", "instr_sig", "instr_tok", "instr_switch", - "instr", "labels", "typeArgs", "bounds", "sigArgs", "sigArg", "className", - "slashedName", "assemblyDecls", "assemblyDecl", "typeSpec", "nativeType", - "nativeTypeArrayPointerInfo", "nativeTypeElement", "iidParamIndex", "variantType", - "variantTypeElement", "type", "typeModifiers", "elementType", "simpleType", - "bound", "nativeInt", "nativeUint", "secDecl", "secAttrSetBlob", "secAttrBlob", - "nameValPairs", "nameValPair", "truefalse", "caValue", "secAction", "methodRef", - "callConv", "callKind", "mdtoken", "memberRef", "fieldRef", "typeList", - "typarsClause", "typarAttrib", "typarAttribs", "typar", "typars", "tyBound", - "genArity", "genArityNotEmpty", "classDecl", "fieldDecl", "fieldAttr", - "atOpt", "initOpt", "repeatOpt", "eventHead", "eventAttr", "eventDecls", - "eventDecl", "propHead", "propAttr", "propDecls", "propDecl", "marshalClause", - "marshalBlob", "paramAttr", "paramAttrElement", "methodHead", "methAttr", - "pinvImpl", "pinvAttr", "methodName", "implAttr", "methodDecls", "methodDecl", - "labelDecl", "customDescrInMethodBody", "scopeBlock", "sehBlock", "sehClauses", - "tryBlock", "sehClause", "filterClause", "catchClause", "finallyClause", - "faultClause", "handlerBlock", "dataDecl", "ddHead", "tls", "ddBody", - "ddItemList", "ddItemCount", "ddItem", "fieldSerInit", "bytes", "hexbyte", - "fieldInit", "serInit", "f32seq", "f64seq", "i64seq", "i32seq", "i16seq", - "i8seq", "boolSeq", "sqstringSeq", "classSeq", "classSeqElement", "objSeq", - "customAttrDecl", "asmOrRefDecl", "assemblyRefHead", "assemblyRefDecls", - "assemblyRefDecl", "exptypeHead", "exportHead", "exptAttr", "exptypeDecls", - "exptypeDecl", "manifestResHead", "manresAttr", "manifestResDecls", "manifestResDecl" + "id", "dottedName", "dottedNamePart", "compQstring", "decls", "decl", + "subsystem", "corflags", "alignment", "imagebase", "stackreserve", "assemblyBlock", + "mscorlib", "languageDecl", "languageString", "typelist", "int32", "int64", + "float64", "intOrWildcard", "compControl", "typedefDecl", "customDescr", + "customDescrWithOwner", "customType", "ownerType", "customBlobDescr", + "customBlobArgs", "customBlobNVPairs", "fieldOrProp", "serializType", + "serializTypeElement", "moduleHead", "vtfixupDecl", "vtfixupAttr", "vtfixupAttrElement", + "vtableDecl", "nameSpaceHead", "classHead", "classAttr", "extendsClause", + "implClause", "classDecls", "implList", "esHead", "extSourceSpec", "fileDecl", + "fileAttr", "fileEntry", "asmAttrAny", "asmAttr", "instr", "simpleInstr", + "calliSignature", "labels", "typeArgs", "bounds", "sigArgs", "sigArg", + "className", "slashedName", "assemblyDecls", "assemblyDecl", "typeSpec", + "typeSpecOrScope", "nativeType", "nativeTypeArrayPointerInfo", "nativeTypeElement", + "iidParamIndex", "variantType", "variantTypeElement", "type", "typeModifiers", + "elementType", "simpleType", "bound", "nativeInt", "nativeUint", "secDecl", + "secAttrSetBlob", "secAttrBlob", "nameValPairs", "nameValPair", "truefalse", + "caValue", "secAction", "methodRef", "callConv", "callKind", "mdtoken", + "memberRef", "fieldRef", "typeList", "typarsClause", "typarAttrib", "typarAttribs", + "typar", "typars", "tyBound", "genArity", "genArityNotEmpty", "classDecl", + "fieldDecl", "fieldAttr", "atOpt", "initOpt", "repeatOpt", "eventHead", + "eventAttr", "eventDecls", "eventDecl", "propHead", "propAttr", "propDecls", + "propDecl", "marshalClause", "marshalBlob", "paramAttr", "paramAttrElement", + "methodHead", "methAttr", "pinvImpl", "pinvAttr", "methodName", "implAttr", + "methodDecls", "methodDecl", "localsDecl", "exportDecl", "vtentryDecl", + "overrideDecl", "parameterDecl", "labelDecl", "customDescrInMethodBody", + "scopeBlock", "sehBlock", "sehClauses", "tryBlock", "sehClause", "filterClause", + "catchClause", "finallyClause", "faultClause", "handlerBlock", "dataDecl", + "ddHead", "tls", "ddBody", "ddItemList", "ddItemCount", "ddItem", "fieldSerInit", + "bytes", "hexbyte", "fieldInit", "serInit", "f32seq", "f64seq", "i64seq", + "i32seq", "i16seq", "i8seq", "boolSeq", "sqstringSeq", "classSeq", "classSeqElement", + "objSeq", "customAttrDecl", "asmOrRefDecl", "assemblyRefBlock", "assemblyRefHead", + "assemblyRefDecls", "assemblyRefDecl", "exptypeBlock", "exptypeHead", + "exportHead", "exptAttrs", "exptAttr", "exptypeDecls", "exptypeDecl", + "manifestResBlock", "manifestResHead", "manresAttrs", "manresAttr", "manifestResDecls", + "manifestResDecl" }; private static readonly string[] _LiteralNames = { - null, "'native'", "'cil'", "'optil'", "'managed'", "'forwardref'", "'preservesig'", - "'runtime'", "'internalcall'", "'synchronized'", "'noinlining'", "'aggressiveinlining'", - "'nooptimization'", "'aggressiveoptimization'", "'async'", "'extended'", - "'volatile'", "'{'", "'}'", "'.subsystem'", "'.corflags'", "'.file'", - "'alignment'", "'.imagebase'", "'.stackreserve'", "'.assembly'", "'.mscorlib'", - "'.language'", "','", "'.typelist'", "'('", "')'", "';'", "'.typedef'", - "'as'", "'.custom'", "'='", "'field'", "'property'", "'class'", "'extern'", - "'.vtfixup'", "'['", "']'", "'at'", "'fromunmanaged'", "'callmostderived'", - "'retainappdomain'", "'.vtable'", "'.namespace'", "'.class'", "'public'", - "'private'", "'sealed'", "'abstract'", "'auto'", "'sequential'", "'unicode'", - "'autochar'", "'import'", "'serializable'", "'windowsruntime'", "'nested'", - "'family'", "'assembly'", "'famandassem'", "'famorassem'", "'beforefieldinit'", - "'specialname'", "'rtspecialname'", "'flags'", "'extends'", "'implements'", - "'.line'", "'#line'", "':'", "'nometadata'", "'retargetable'", "'noplatform'", - "'legacy library'", "'x86'", "'amd64'", "'arm'", "'arm64'", "'bytearray'", - "'()'", "'<'", "'>'", "'/'", "'algorithm'", "'unsigned'", "'iidparam'", - "'pinned'", "'modreq'", "'modopt'", "'true'", "'false'", "'request'", - "'demand'", "'assert'", "'deny'", "'permitonly'", "'linkcheck'", "'inheritcheck'", - "'reqmin'", "'reqopt'", "'reqrefuse'", "'prejitgrant'", "'prejitdeny'", - "'noncasdemand'", "'noncaslinkdemand'", "'noncasinheritance'", "'callconv'", - "'mdtoken'", "'-'", "'byreflike'", "'.ctor'", "'.size'", "'.pack'", "'with'", - "'.interfaceimpl'", "'.field'", "'marshal'", "'static'", "'initonly'", - "'privatescope'", "'literal'", "'notserialized'", "'.event'", "'.addon'", - "'.removeon'", "'.fire'", "'.other'", "'.property'", "'.set'", "'.get'", - "'in'", "'out'", "'opt'", "'.method'", "'final'", "'virtual'", "'strict'", - "'hidebysig'", "'newslot'", "'unmanagedexp'", "'reqsecobj'", "'pinvokeimpl'", - "'nomangle'", "'lasterr'", "'winapi'", "'bestfit'", "'on'", "'off'", "'charmaperror'", - "'.cctor'", "'il'", "'init'", "'.try'", "'to'", "'filter'", "'catch'", - "'finally'", "'fault'", "'handler'", "'.data'", "'tls'", "'.publickey'", - "'.ver'", "'.locale'", "'.publickeytoken'", "'forwarder'", null, null, - null, "'::'", "'...'", "'null'", "'nullref'", "'.hash'", null, "'string'", - "'bool'", "'int8'", "'int16'", "'int32'", "'int64'", "'float32'", "'float64'", - "'uint8'", "'uint16'", "'uint32'", "'uint64'", "'int'", "'uint'", "'type'", - "'object'", "'.module'", "'value'", "'valuetype'", "'void'", "'enum'", - "'custom'", "'fixed'", "'sysstring'", "'array'", "'variant'", "'currency'", - "'syschar'", "'error'", "'decimal'", "'date'", "'bstr'", "'lpstr'", "'lpwstr'", - "'lptstr'", "'objectref'", "'iunknown'", "'idispatch'", "'struct'", "'interface'", - "'safearray'", "'byvalstr'", "'ansi'", "'tbstr'", "'method'", "'any'", - "'lpstruct'", "'vector'", "'hresult'", "'carray'", "'userdefined'", "'record'", - "'filetime'", "'blob'", "'stream'", "'storage'", "'streamed_object'", - "'stored_object'", "'blob_object'", "'cf'", "'clsid'", "'instance'", "'explicit'", - "'default'", "'vararg'", "'unmanaged'", "'cdecl'", "'stdcall'", "'thiscall'", - "'fastcall'", "'!'", null, null, "'.param'", "'constraint'", "'.this'", - "'.base'", "'.nester'", "'&'", null, "'*'", null, null, "'.'", "'+'", - "'#define'", "'#undef'", "'#ifdef'", "'#ifndef'", "'#else'", "'#endif'", - "'#include'", "'.mresource'", null, null, null, "'ldc.i8'", null, null, - "'calli'", null, "'switch'", null, "'ldstr'", null, "'ldtoken'", null, - null, null, null, null, null, "'.permission'", "'.permissionset'", "'.emitbyte'", - "'.maxstack'", "'.entrypoint'", "'.zeroinit'", "'.locals'", "'.export'", + null, "'native'", "'cil'", "'optil'", "'managed'", "'forwardref'", "'preservesig'", + "'runtime'", "'internalcall'", "'synchronized'", "'noinlining'", "'aggressiveinlining'", + "'nooptimization'", "'aggressiveoptimization'", "'async'", "'extended'", + "'volatile'", "'{'", "'}'", "'.subsystem'", "'.corflags'", "'.file'", + "'alignment'", "'.imagebase'", "'.stackreserve'", "'.assembly'", "'.mscorlib'", + "'.language'", "','", "'.typelist'", "'('", "')'", "';'", "'.typedef'", + "'as'", "'.custom'", "'='", "'field'", "'property'", "'class'", "'extern'", + "'.vtfixup'", "'['", "']'", "'at'", "'fromunmanaged'", "'callmostderived'", + "'retainappdomain'", "'.vtable'", "'.namespace'", "'.class'", "'public'", + "'private'", "'sealed'", "'abstract'", "'auto'", "'sequential'", "'unicode'", + "'autochar'", "'import'", "'serializable'", "'windowsruntime'", "'nested'", + "'family'", "'assembly'", "'famandassem'", "'famorassem'", "'beforefieldinit'", + "'specialname'", "'rtspecialname'", "'flags'", "'extends'", "'implements'", + "'.line'", "'#line'", "':'", "'nometadata'", "'retargetable'", "'noplatform'", + "'legacy library'", "'x86'", "'amd64'", "'arm'", "'arm64'", "'bytearray'", + "'()'", "'<'", "'>'", "'/'", "'algorithm'", "'unsigned'", "'iidparam'", + "'pinned'", "'modreq'", "'modopt'", "'true'", "'false'", "'request'", + "'demand'", "'assert'", "'deny'", "'permitonly'", "'linkcheck'", "'inheritcheck'", + "'reqmin'", "'reqopt'", "'reqrefuse'", "'prejitgrant'", "'prejitdeny'", + "'noncasdemand'", "'noncaslinkdemand'", "'noncasinheritance'", "'callconv'", + "'mdtoken'", "'-'", "'byreflike'", "'.ctor'", "'.size'", "'.pack'", "'with'", + "'.interfaceimpl'", "'.field'", "'marshal'", "'static'", "'initonly'", + "'privatescope'", "'literal'", "'notserialized'", "'.event'", "'.addon'", + "'.removeon'", "'.fire'", "'.other'", "'.property'", "'.set'", "'.get'", + "'in'", "'out'", "'opt'", "'.method'", "'final'", "'virtual'", "'strict'", + "'hidebysig'", "'newslot'", "'unmanagedexp'", "'reqsecobj'", "'pinvokeimpl'", + "'nomangle'", "'lasterr'", "'winapi'", "'bestfit'", "'on'", "'off'", "'charmaperror'", + "'.cctor'", "'il'", "'init'", "'.try'", "'to'", "'filter'", "'catch'", + "'finally'", "'fault'", "'handler'", "'.data'", "'tls'", "'.publickey'", + "'.ver'", "'.locale'", "'.publickeytoken'", "'forwarder'", null, null, + null, "'::'", "'...'", "'null'", "'nullref'", "'.hash'", null, "'string'", + "'bool'", "'int8'", "'int16'", "'int32'", "'int64'", "'float32'", "'float64'", + "'uint8'", "'uint16'", "'uint32'", "'uint64'", "'int'", "'uint'", "'type'", + "'object'", "'.module'", "'value'", "'valuetype'", "'void'", "'enum'", + "'custom'", "'fixed'", "'sysstring'", "'array'", "'variant'", "'currency'", + "'syschar'", "'error'", "'decimal'", "'date'", "'bstr'", "'lpstr'", "'lpwstr'", + "'lptstr'", "'objectref'", "'iunknown'", "'idispatch'", "'struct'", "'interface'", + "'safearray'", "'byvalstr'", "'ansi'", "'tbstr'", "'method'", "'any'", + "'lpstruct'", "'vector'", "'hresult'", "'carray'", "'userdefined'", "'record'", + "'filetime'", "'blob'", "'stream'", "'storage'", "'streamed_object'", + "'stored_object'", "'blob_object'", "'cf'", "'clsid'", "'instance'", "'explicit'", + "'default'", "'vararg'", "'unmanaged'", "'cdecl'", "'stdcall'", "'thiscall'", + "'fastcall'", "'!'", null, null, "'.param'", "'constraint'", "'.this'", + "'.base'", "'.nester'", "'&'", null, "'*'", null, null, "'.'", "'+'", + "'#define'", "'#undef'", "'#ifdef'", "'#ifndef'", "'#else'", "'#endif'", + "'#include'", "'.mresource'", null, null, null, "'ldc.i8'", null, null, + "'calli'", null, "'switch'", null, "'ldstr'", null, "'ldtoken'", null, + null, null, null, null, null, "'.permission'", "'.permissionset'", "'.emitbyte'", + "'.maxstack'", "'.entrypoint'", "'.zeroinit'", "'.locals'", "'.export'", "'.override'", "'.vtentry'" }; private static readonly string[] _SymbolicNames = { - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, "INT32", "INT64", "FLOAT64", "DCOLON", "ELLIPSIS", - "NULL", "NULLREF", "HASH", "CHAR", "STRING", "BOOL", "INT8", "INT16", - "INT32_", "INT64_", "FLOAT32", "FLOAT64_", "UINT8", "UINT16", "UINT32", - "UINT64", "INT", "UINT", "TYPE", "OBJECT", "MODULE", "VALUE", "VALUETYPE", - "VOID", "ENUM", "CUSTOM", "FIXED", "SYSSTRING", "ARRAY", "VARIANT", "CURRENCY", - "SYSCHAR", "ERROR", "DECIMAL", "DATE", "BSTR", "LPSTR", "LPWSTR", "LPTSTR", - "OBJECTREF", "IUNKNOWN", "IDISPATCH", "STRUCT", "INTERFACE", "SAFEARRAY", - "BYVALSTR", "ANSI", "TBSTR", "METHOD", "ANY", "LPSTRUCT", "VECTOR", "HRESULT", - "CARRAY", "USERDEFINED", "RECORD", "FILETIME", "BLOB", "STREAM", "STORAGE", - "STREAMED_OBJECT", "STORED_OBJECT", "BLOB_OBJECT", "CF", "CLSID", "INSTANCE", - "EXPLICIT", "DEFAULT", "VARARG", "UNMANAGED", "CDECL", "STDCALL", "THISCALL", - "FASTCALL", "TYPE_PARAMETER", "METHOD_TYPE_PARAMETER", "TYPEDREF", "PARAM", - "CONSTRAINT", "THIS", "BASE", "NESTER", "REF", "ARRAY_TYPE_NO_BOUNDS", - "PTR", "QSTRING", "SQSTRING", "DOT", "PLUS", "PP_DEFINE", "PP_UNDEF", - "PP_IFDEF", "PP_IFNDEF", "PP_ELSE", "PP_ENDIF", "PP_INCLUDE", "MRESOURCE", - "INSTR_NONE", "INSTR_VAR", "INSTR_I", "INSTR_I8", "INSTR_R", "INSTR_METHOD", - "INSTR_SIG", "INSTR_BRTARGET", "INSTR_SWITCH", "INSTR_TYPE", "INSTR_STRING", - "INSTR_FIELD", "INSTR_TOK", "DOTTEDNAME", "ID", "HEXBYTE", "WS", "SINGLE_LINE_COMMENT", - "COMMENT", "PERMISSION", "PERMISSIONSET", "EMITBYTE", "MAXSTACK", "ENTRYPOINT", - "ZEROINIT", "LOCALS", "EXPORT", "OVERRIDE", "VTENTRY", "IncludedFileEof", + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, "INT32", "INT64", "FLOAT64", "DCOLON", "ELLIPSIS", + "NULL", "NULLREF", "HASH", "CHAR", "STRING", "BOOL", "INT8", "INT16", + "INT32_", "INT64_", "FLOAT32", "FLOAT64_", "UINT8", "UINT16", "UINT32", + "UINT64", "INT", "UINT", "TYPE", "OBJECT", "MODULE", "VALUE", "VALUETYPE", + "VOID", "ENUM", "CUSTOM", "FIXED", "SYSSTRING", "ARRAY", "VARIANT", "CURRENCY", + "SYSCHAR", "ERROR", "DECIMAL", "DATE", "BSTR", "LPSTR", "LPWSTR", "LPTSTR", + "OBJECTREF", "IUNKNOWN", "IDISPATCH", "STRUCT", "INTERFACE", "SAFEARRAY", + "BYVALSTR", "ANSI", "TBSTR", "METHOD", "ANY", "LPSTRUCT", "VECTOR", "HRESULT", + "CARRAY", "USERDEFINED", "RECORD", "FILETIME", "BLOB", "STREAM", "STORAGE", + "STREAMED_OBJECT", "STORED_OBJECT", "BLOB_OBJECT", "CF", "CLSID", "INSTANCE", + "EXPLICIT", "DEFAULT", "VARARG", "UNMANAGED", "CDECL", "STDCALL", "THISCALL", + "FASTCALL", "TYPE_PARAMETER", "METHOD_TYPE_PARAMETER", "TYPEDREF", "PARAM", + "CONSTRAINT", "THIS", "BASE", "NESTER", "REF", "ARRAY_TYPE_NO_BOUNDS", + "PTR", "QSTRING", "SQSTRING", "DOT", "PLUS", "PP_DEFINE", "PP_UNDEF", + "PP_IFDEF", "PP_IFNDEF", "PP_ELSE", "PP_ENDIF", "PP_INCLUDE", "MRESOURCE", + "INSTR_NONE", "INSTR_VAR", "INSTR_I", "INSTR_I8", "INSTR_R", "INSTR_METHOD", + "INSTR_SIG", "INSTR_BRTARGET", "INSTR_SWITCH", "INSTR_TYPE", "INSTR_STRING", + "INSTR_FIELD", "INSTR_TOK", "DOTTEDNAME", "ID", "HEXBYTE", "WS", "SINGLE_LINE_COMMENT", + "COMMENT", "PERMISSION", "PERMISSIONSET", "EMITBYTE", "MAXSTACK", "ENTRYPOINT", + "ZEROINIT", "LOCALS", "EXPORT", "OVERRIDE", "VTENTRY", "IncludedFileEof", "SyntheticIncludedFileEof" }; public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames); @@ -289,6 +293,9 @@ static CILParser() { } } + + internal GrammarActions Actions { get; set; } = null!; + public CILParser(ITokenStream input) : this(input, Console.Out, Console.Error) { } public CILParser(ITokenStream input, TextWriter output, TextWriter errorOutput) @@ -307,12 +314,6 @@ public IdContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_id; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitId(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -323,7 +324,7 @@ public IdContext id() { try { EnterOuterAlt(_localctx, 1); { - State = 370; + State = 372; _la = TokenStream.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 65534L) != 0) || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 70368746274833L) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -346,6 +347,12 @@ public IdContext id() { } public partial class DottedNameContext : ParserRuleContext { + public string Value; + public CILParser.DottedNameBuilder Builder; + public IToken direct; + public DottedNamePartContext part; + public DottedNamePartContext tail; + public IToken quoted; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DOTTEDNAME() { return GetToken(CILParser.DOTTEDNAME, 0); } [System.Diagnostics.DebuggerNonUserCode] public DottedNamePartContext[] dottedNamePart() { return GetRuleContexts(); @@ -363,62 +370,61 @@ public DottedNameContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_dottedName; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitDottedName(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public DottedNameContext dottedName() { DottedNameContext _localctx = new DottedNameContext(Context, State); EnterRule(_localctx, 2, RULE_dottedName); + _localctx.Builder = new CILParser.DottedNameBuilder(); try { int _alt; - State = 383; + State = 390; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,1,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 372; - Match(DOTTEDNAME); + State = 374; + _localctx.direct = Match(DOTTEDNAME); + Actions.AddDottedNameToken(_localctx.Builder, _localctx.direct); } break; case 2: EnterOuterAlt(_localctx, 2); { { - State = 378; + State = 382; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,0,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 373; - dottedNamePart(); - State = 374; + State = 376; + _localctx.part = dottedNamePart(); + Actions.AddDottedNamePart(_localctx.Builder, _localctx.part.Value); + State = 378; Match(DOT); } - } + } } - State = 380; + State = 384; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,0,Context); } - State = 381; - dottedNamePart(); + State = 385; + _localctx.tail = dottedNamePart(); + Actions.AddDottedNamePart(_localctx.Builder, _localctx.tail.Value); } } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 382; - Match(SQSTRING); + State = 388; + _localctx.quoted = Match(SQSTRING); + Actions.AddDottedNameToken(_localctx.Builder, _localctx.quoted); } break; } @@ -429,12 +435,14 @@ public DottedNameContext dottedName() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = Actions.EndDottedName(_localctx.Builder); ExitRule(); } return _localctx; } public partial class DottedNamePartContext : ParserRuleContext { + public string Value; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ID() { return GetToken(CILParser.ID, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTANCE() { return GetToken(CILParser.INSTANCE, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SQSTRING() { return GetToken(CILParser.SQSTRING, 0); } @@ -444,23 +452,18 @@ public DottedNamePartContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_dottedNamePart; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitDottedNamePart(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public DottedNamePartContext dottedNamePart() { DottedNamePartContext _localctx = new DottedNamePartContext(Context, State); EnterRule(_localctx, 4, RULE_dottedNamePart); + _localctx.Value = string.Empty; int _la; try { EnterOuterAlt(_localctx, 1); { - State = 385; + State = 392; _la = TokenStream.LA(1); if ( !(_la==T__15 || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 105553118363649L) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -470,6 +473,8 @@ public DottedNamePartContext dottedNamePart() { Consume(); } } + Context.Stop = TokenStream.LT(-1); + _localctx.Value = Actions.ParseDottedNamePart(_localctx.Start); } catch (RecognitionException re) { _localctx.exception = re; @@ -483,6 +488,10 @@ public DottedNamePartContext dottedNamePart() { } public partial class CompQstringContext : ParserRuleContext { + public string Value; + public System.Text.StringBuilder Builder; + public IToken head; + public IToken tail; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] QSTRING() { return GetTokens(CILParser.QSTRING); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode QSTRING(int i) { return GetToken(CILParser.QSTRING, i); @@ -496,42 +505,39 @@ public CompQstringContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_compQstring; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCompQstring(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public CompQstringContext compQstring() { CompQstringContext _localctx = new CompQstringContext(Context, State); EnterRule(_localctx, 6, RULE_compQstring); + _localctx.Builder = new System.Text.StringBuilder(); try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 391; + State = 399; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,2,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 387; - Match(QSTRING); - State = 388; + State = 394; + _localctx.head = Match(QSTRING); + Actions.AddComposedStringPart(_localctx.Builder, _localctx.head); + State = 396; Match(PLUS); } - } + } } - State = 393; + State = 401; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,2,Context); } - State = 394; - Match(QSTRING); + State = 402; + _localctx.tail = Match(QSTRING); + Actions.AddComposedStringPart(_localctx.Builder, _localctx.tail); } } catch (RecognitionException re) { @@ -540,6 +546,7 @@ public CompQstringContext compQstring() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = Actions.EndComposedString(_localctx.Builder); ExitRule(); } return _localctx; @@ -557,12 +564,6 @@ public DeclsContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_decls; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitDecls(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -573,17 +574,17 @@ public DeclsContext decls() { try { EnterOuterAlt(_localctx, 1); { - State = 399; + State = 408; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 1972571905523712L) != 0) || ((((_la - 73)) & ~0x3f) == 0 && ((1L << (_la - 73)) & 281474976710659L) != 0) || ((((_la - 139)) & ~0x3f) == 0 && ((1L << (_la - 139)) & 288230376218820609L) != 0) || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 6860956837609473L) != 0)) { { { - State = 396; + State = 405; decl(); } } - State = 401; + State = 410; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -601,6 +602,20 @@ public DeclsContext decls() { } public partial class DeclContext : ParserRuleContext { + public DataDeclContext data; + public VtableDeclContext vtable; + public VtfixupDeclContext vtfixup; + public ExtSourceSpecContext source; + public FileDeclContext file; + public AssemblyBlockContext assembly; + public AssemblyRefBlockContext assemblyReference; + public ExptypeBlockContext exportedType; + public ManifestResBlockContext resource; + public ModuleHeadContext module; + public SecDeclContext security; + public CustomAttrDeclContext attribute; + public LanguageDeclContext language; + public TypedefDeclContext typedef; [System.Diagnostics.DebuggerNonUserCode] public ClassHeadContext classHead() { return GetRuleContext(0); } @@ -640,23 +655,14 @@ [System.Diagnostics.DebuggerNonUserCode] public FileDeclContext fileDecl() { [System.Diagnostics.DebuggerNonUserCode] public AssemblyBlockContext assemblyBlock() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public AssemblyRefHeadContext assemblyRefHead() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public AssemblyRefDeclsContext assemblyRefDecls() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ExptypeHeadContext exptypeHead() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ExptypeDeclsContext exptypeDecls() { - return GetRuleContext(0); + [System.Diagnostics.DebuggerNonUserCode] public AssemblyRefBlockContext assemblyRefBlock() { + return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ManifestResHeadContext manifestResHead() { - return GetRuleContext(0); + [System.Diagnostics.DebuggerNonUserCode] public ExptypeBlockContext exptypeBlock() { + return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ManifestResDeclsContext manifestResDecls() { - return GetRuleContext(0); + [System.Diagnostics.DebuggerNonUserCode] public ManifestResBlockContext manifestResBlock() { + return GetRuleContext(0); } [System.Diagnostics.DebuggerNonUserCode] public ModuleHeadContext moduleHead() { return GetRuleContext(0); @@ -702,12 +708,6 @@ public DeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_decl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -715,224 +715,240 @@ public DeclContext decl() { DeclContext _localctx = new DeclContext(Context, State); EnterRule(_localctx, 10, RULE_decl); try { - State = 452; + State = 497; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,4,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 402; + State = 411; classHead(); - State = 403; + State = 412; Match(T__16); - State = 404; + State = 413; classDecls(); - State = 405; + State = 414; Match(T__17); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 407; + State = 416; nameSpaceHead(); - State = 408; + State = 417; Match(T__16); - State = 409; + State = 418; decls(); - State = 410; + State = 419; Match(T__17); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 412; + State = 421; methodHead(); - State = 413; + State = 422; Match(T__16); - State = 414; + State = 423; methodDecls(); - State = 415; + State = 424; Match(T__17); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 417; + State = 426; fieldDecl(); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 418; - dataDecl(); + Actions.BeginTopLevelDirective(); + State = 428; + _localctx.data = dataDecl(); + Actions.ProcessTopLevelDataDeclaration(_localctx.data); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 419; - vtableDecl(); + Actions.BeginTopLevelDirective(); + State = 432; + _localctx.vtable = vtableDecl(); + Actions.ProcessTopLevelVTableDeclaration(_localctx.vtable); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 420; - vtfixupDecl(); + Actions.BeginTopLevelDirective(); + State = 436; + _localctx.vtfixup = vtfixupDecl(); + Actions.ProcessTopLevelVTableFixupDeclaration(_localctx.vtfixup); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 421; - extSourceSpec(); + Actions.BeginTopLevelDirective(); + State = 440; + _localctx.source = extSourceSpec(); + Actions.ProcessTopLevelSourceDirective(_localctx.source); } break; case 9: EnterOuterAlt(_localctx, 9); { - State = 422; - fileDecl(); + Actions.BeginTopLevelDirective(); + State = 444; + _localctx.file = fileDecl(); + Actions.ProcessTopLevelFileDeclaration(_localctx.file); } break; case 10: EnterOuterAlt(_localctx, 10); { - State = 423; - assemblyBlock(); + Actions.BeginTopLevelDirective(); + State = 448; + _localctx.assembly = assemblyBlock(); + Actions.ProcessTopLevelAssembly(_localctx.assembly); } break; case 11: EnterOuterAlt(_localctx, 11); { - State = 424; - assemblyRefHead(); - State = 425; - Match(T__16); - State = 426; - assemblyRefDecls(); - State = 427; - Match(T__17); + Actions.BeginTopLevelDirective(); + State = 452; + _localctx.assemblyReference = assemblyRefBlock(); + Actions.ProcessTopLevelAssemblyReference(_localctx.assemblyReference); } break; case 12: EnterOuterAlt(_localctx, 12); { - State = 429; - exptypeHead(); - State = 430; - Match(T__16); - State = 431; - exptypeDecls(); - State = 432; - Match(T__17); + Actions.BeginTopLevelDirective(); + State = 456; + _localctx.exportedType = exptypeBlock(); + Actions.ProcessTopLevelExportedType(_localctx.exportedType); } break; case 13: EnterOuterAlt(_localctx, 13); { - State = 434; - manifestResHead(); - State = 435; - Match(T__16); - State = 436; - manifestResDecls(); - State = 437; - Match(T__17); + Actions.BeginTopLevelDirective(); + State = 460; + _localctx.resource = manifestResBlock(); + Actions.ProcessTopLevelManifestResource(_localctx.resource); } break; case 14: EnterOuterAlt(_localctx, 14); { - State = 439; - moduleHead(); + Actions.BeginTopLevelDirective(); + State = 464; + _localctx.module = moduleHead(); + Actions.ProcessTopLevelModule(_localctx.module.Value, _localctx.module.HasName, _localctx.module.IsExternal); } break; case 15: EnterOuterAlt(_localctx, 15); { - State = 440; - secDecl(); + Actions.BeginTopLevelDirective(); + State = 468; + _localctx.security = secDecl(); + Actions.ProcessTopLevelSecurityDeclaration(_localctx.security); } break; case 16: EnterOuterAlt(_localctx, 16); { - State = 441; - customAttrDecl(); + State = 471; + _localctx.attribute = customAttrDecl(); + Actions.ProcessTopLevelCustomAttribute(_localctx.attribute); } break; case 17: EnterOuterAlt(_localctx, 17); { - State = 442; + Actions.BeginTopLevelDirective(); + State = 475; subsystem(); } break; case 18: EnterOuterAlt(_localctx, 18); { - State = 443; + Actions.BeginTopLevelDirective(); + State = 477; corflags(); } break; case 19: EnterOuterAlt(_localctx, 19); { - State = 444; + Actions.BeginTopLevelDirective(); + State = 479; alignment(); } break; case 20: EnterOuterAlt(_localctx, 20); { - State = 445; + Actions.BeginTopLevelDirective(); + State = 481; imagebase(); } break; case 21: EnterOuterAlt(_localctx, 21); { - State = 446; + Actions.BeginTopLevelDirective(); + State = 483; stackreserve(); } break; case 22: EnterOuterAlt(_localctx, 22); { - State = 447; - languageDecl(); + Actions.BeginTopLevelDirective(); + State = 485; + _localctx.language = languageDecl(); + Actions.ProcessTopLevelLanguageDirective(_localctx.language); } break; case 23: EnterOuterAlt(_localctx, 23); { - State = 448; - typedefDecl(); + Actions.BeginTopLevelDirective(); + State = 489; + _localctx.typedef = typedefDecl(); + Actions.ProcessTopLevelTypedef(_localctx.typedef); } break; case 24: EnterOuterAlt(_localctx, 24); { - State = 449; + Actions.BeginTopLevelDirective(); + State = 493; compControl(); } break; case 25: EnterOuterAlt(_localctx, 25); { - State = 450; + State = 494; typelist(); } break; case 26: EnterOuterAlt(_localctx, 26); { - State = 451; + Actions.BeginTopLevelDirective(); + State = 496; mscorlib(); } break; @@ -944,12 +960,14 @@ public DeclContext decl() { ErrorHandler.Recover(this, re); } finally { + Actions.EndDeclaration(_localctx); ExitRule(); } return _localctx; } public partial class SubsystemContext : ParserRuleContext { + public Int32Context value; [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } @@ -958,12 +976,6 @@ public SubsystemContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_subsystem; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSubsystem(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -973,10 +985,11 @@ public SubsystemContext subsystem() { try { EnterOuterAlt(_localctx, 1); { - State = 454; + State = 499; Match(T__18); - State = 455; - int32(); + State = 500; + _localctx.value = int32(); + Actions.ProcessTopLevelSubsystem((_localctx.value!=null?(_localctx.value.Start):null)); } } catch (RecognitionException re) { @@ -991,6 +1004,7 @@ public SubsystemContext subsystem() { } public partial class CorflagsContext : ParserRuleContext { + public Int32Context value; [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } @@ -999,12 +1013,6 @@ public CorflagsContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_corflags; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCorflags(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -1014,10 +1022,11 @@ public CorflagsContext corflags() { try { EnterOuterAlt(_localctx, 1); { - State = 457; + State = 503; Match(T__19); - State = 458; - int32(); + State = 504; + _localctx.value = int32(); + Actions.ProcessTopLevelCorFlags((_localctx.value!=null?(_localctx.value.Start):null)); } } catch (RecognitionException re) { @@ -1032,6 +1041,7 @@ public CorflagsContext corflags() { } public partial class AlignmentContext : ParserRuleContext { + public Int32Context value; [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } @@ -1040,12 +1050,6 @@ public AlignmentContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_alignment; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitAlignment(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -1055,12 +1059,13 @@ public AlignmentContext alignment() { try { EnterOuterAlt(_localctx, 1); { - State = 460; + State = 507; Match(T__20); - State = 461; + State = 508; Match(T__21); - State = 462; - int32(); + State = 509; + _localctx.value = int32(); + Actions.ProcessTopLevelAlignment((_localctx.value!=null?(_localctx.value.Start):null)); } } catch (RecognitionException re) { @@ -1075,6 +1080,7 @@ public AlignmentContext alignment() { } public partial class ImagebaseContext : ParserRuleContext { + public Int64Context value; [System.Diagnostics.DebuggerNonUserCode] public Int64Context int64() { return GetRuleContext(0); } @@ -1083,12 +1089,6 @@ public ImagebaseContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_imagebase; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitImagebase(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -1098,10 +1098,11 @@ public ImagebaseContext imagebase() { try { EnterOuterAlt(_localctx, 1); { - State = 464; + State = 512; Match(T__22); - State = 465; - int64(); + State = 513; + _localctx.value = int64(); + Actions.ProcessTopLevelImageBase((_localctx.value!=null?(_localctx.value.Start):null)); } } catch (RecognitionException re) { @@ -1116,6 +1117,7 @@ public ImagebaseContext imagebase() { } public partial class StackreserveContext : ParserRuleContext { + public Int64Context value; [System.Diagnostics.DebuggerNonUserCode] public Int64Context int64() { return GetRuleContext(0); } @@ -1124,12 +1126,6 @@ public StackreserveContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_stackreserve; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitStackreserve(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -1139,10 +1135,11 @@ public StackreserveContext stackreserve() { try { EnterOuterAlt(_localctx, 1); { - State = 467; + State = 516; Match(T__23); - State = 468; - int64(); + State = 517; + _localctx.value = int64(); + Actions.ProcessTopLevelStackReserve((_localctx.value!=null?(_localctx.value.Start):null)); } } catch (RecognitionException re) { @@ -1157,6 +1154,12 @@ public StackreserveContext stackreserve() { } public partial class AssemblyBlockContext : ParserRuleContext { + public CILParser.AssemblyDefinitionValue? Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public AsmAttrContext attributes; + public DottedNameContext name; + public AssemblyDeclsContext declarations; [System.Diagnostics.DebuggerNonUserCode] public AsmAttrContext asmAttr() { return GetRuleContext(0); } @@ -1171,33 +1174,32 @@ public AssemblyBlockContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_assemblyBlock; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitAssemblyBlock(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public AssemblyBlockContext assemblyBlock() { AssemblyBlockContext _localctx = new AssemblyBlockContext(Context, State); EnterRule(_localctx, 22, RULE_assemblyBlock); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; try { EnterOuterAlt(_localctx, 1); { - State = 470; + State = 520; Match(T__24); - State = 471; - asmAttr(); - State = 472; - dottedName(); - State = 473; + State = 521; + _localctx.attributes = asmAttr(); + State = 522; + _localctx.name = dottedName(); + State = 523; Match(T__16); - State = 474; - assemblyDecls(); - State = 475; + State = 524; + _localctx.declarations = assemblyDecls(); + State = 525; Match(T__17); + _localctx.Value = Actions.CreateAssemblyDefinition( + _localctx.attributes.Value, + _localctx.name.Value, + _localctx.declarations.Value); } } catch (RecognitionException re) { @@ -1206,6 +1208,15 @@ public AssemblyBlockContext assemblyBlock() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + if (_localctx.HasSyntaxError) + { + _localctx.Value = null; + } + ExitRule(); } return _localctx; @@ -1217,12 +1228,6 @@ public MscorlibContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_mscorlib; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitMscorlib(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -1232,7 +1237,7 @@ public MscorlibContext mscorlib() { try { EnterOuterAlt(_localctx, 1); { - State = 477; + State = 528; Match(T__25); } } @@ -1248,6 +1253,12 @@ public MscorlibContext mscorlib() { } public partial class LanguageDeclContext : ParserRuleContext { + public CILParser.LanguageDirectiveValue? Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public LanguageStringContext language; + public LanguageStringContext vendor; + public LanguageStringContext documentType; [System.Diagnostics.DebuggerNonUserCode] public LanguageStringContext[] languageString() { return GetRuleContexts(); } @@ -1259,59 +1270,57 @@ public LanguageDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_languageDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitLanguageDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public LanguageDeclContext languageDecl() { LanguageDeclContext _localctx = new LanguageDeclContext(Context, State); EnterRule(_localctx, 26, RULE_languageDecl); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; try { - State = 493; + State = 548; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,5,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 479; + State = 530; Match(T__26); - State = 480; - languageString(); + State = 531; + _localctx.language = languageString(); + _localctx.Value = Actions.CreateLanguageDirective(_localctx.language.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 481; + State = 534; Match(T__26); - State = 482; - languageString(); - State = 483; + State = 535; + _localctx.language = languageString(); + State = 536; Match(T__27); - State = 484; - languageString(); + State = 537; + _localctx.vendor = languageString(); + _localctx.Value = Actions.CreateLanguageDirective(_localctx.language.Value, _localctx.vendor.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 486; + State = 540; Match(T__26); - State = 487; - languageString(); - State = 488; + State = 541; + _localctx.language = languageString(); + State = 542; Match(T__27); - State = 489; - languageString(); - State = 490; + State = 543; + _localctx.vendor = languageString(); + State = 544; Match(T__27); - State = 491; - languageString(); + State = 545; + _localctx.documentType = languageString(); + _localctx.Value = Actions.CreateLanguageDirective(_localctx.language.Value, _localctx.vendor.Value, _localctx.documentType.Value); } break; } @@ -1322,36 +1331,35 @@ public LanguageDeclContext languageDecl() { ErrorHandler.Recover(this, re); } finally { + Actions.EndLanguageDirective(_localctx, _localctx.InitialSyntaxErrorCount); ExitRule(); } return _localctx; } public partial class LanguageStringContext : ParserRuleContext { + public string Value; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SQSTRING() { return GetToken(CILParser.SQSTRING, 0); } public LanguageStringContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_languageString; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitLanguageString(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public LanguageStringContext languageString() { LanguageStringContext _localctx = new LanguageStringContext(Context, State); EnterRule(_localctx, 28, RULE_languageString); + _localctx.Value = string.Empty; try { EnterOuterAlt(_localctx, 1); { - State = 495; + State = 550; Match(SQSTRING); } + Context.Stop = TokenStream.LT(-1); + _localctx.Value = Actions.ParseLanguageString(_localctx.Start); } catch (RecognitionException re) { _localctx.exception = re; @@ -1365,6 +1373,7 @@ public LanguageStringContext languageString() { } public partial class TypelistContext : ParserRuleContext { + public ClassNameContext name; [System.Diagnostics.DebuggerNonUserCode] public ClassNameContext[] className() { return GetRuleContexts(); } @@ -1376,41 +1385,37 @@ public TypelistContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_typelist; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTypelist(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TypelistContext typelist() { TypelistContext _localctx = new TypelistContext(Context, State); EnterRule(_localctx, 30, RULE_typelist); + Actions.BeginTopLevelTypeList(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 497; + State = 552; Match(T__28); - State = 498; + State = 553; Match(T__16); - State = 502; + State = 559; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==T__15 || _la==T__41 || _la==T__112 || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 105553118478337L) != 0)) { { { - State = 499; - className(); + State = 554; + _localctx.name = className(); + Actions.ProcessTopLevelTypeListEntry(_localctx.name.Value); } } - State = 504; + State = 561; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 505; + State = 562; Match(T__17); } } @@ -1432,12 +1437,6 @@ public Int32Context(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_int32; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInt32(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -1447,7 +1446,7 @@ public Int32Context int32() { try { EnterOuterAlt(_localctx, 1); { - State = 507; + State = 564; Match(INT32); } } @@ -1470,12 +1469,6 @@ public Int64Context(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_int64; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInt64(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -1486,7 +1479,7 @@ public Int64Context int64() { try { EnterOuterAlt(_localctx, 1); { - State = 509; + State = 566; _la = TokenStream.LA(1); if ( !(_la==INT32 || _la==INT64) ) { ErrorHandler.RecoverInline(this); @@ -1509,11 +1502,17 @@ public Int64Context int64() { } public partial class Float64Context : ParserRuleContext { + public double Value; + public IToken @decimal; + public Int32Context trailing; + public Int32Context integer; + public Int32Context singleBits; + public Int64Context doubleBits; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOAT64() { return GetToken(CILParser.FLOAT64, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DOT() { return GetToken(CILParser.DOT, 0); } [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DOT() { return GetToken(CILParser.DOT, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOAT32() { return GetToken(CILParser.FLOAT32, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOAT64_() { return GetToken(CILParser.FLOAT64_, 0); } [System.Diagnostics.DebuggerNonUserCode] public Int64Context int64() { @@ -1524,12 +1523,6 @@ public Float64Context(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_float64; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitFloat64(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -1537,56 +1530,61 @@ public Float64Context float64() { Float64Context _localctx = new Float64Context(Context, State); EnterRule(_localctx, 36, RULE_float64); try { - State = 526; + State = 589; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,7,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 511; - Match(FLOAT64); + State = 568; + _localctx.@decimal = Match(FLOAT64); + _localctx.Value = Actions.ParseFloatingLiteral(_localctx.@decimal); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 512; - int32(); - State = 513; + State = 570; + _localctx.trailing = int32(); + State = 571; Match(DOT); + _localctx.Value = Actions.ParseFloatingInteger((_localctx.trailing!=null?(_localctx.trailing.Start):null)); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 515; - int32(); + State = 574; + _localctx.integer = int32(); + _localctx.Value = Actions.ParseFloatingInteger((_localctx.integer!=null?(_localctx.integer.Start):null)); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 516; + State = 577; Match(FLOAT32); - State = 517; + State = 578; Match(T__29); - State = 518; - int32(); - State = 519; + State = 579; + _localctx.singleBits = int32(); + State = 580; Match(T__30); + _localctx.Value = Actions.ParseFloat32Bits((_localctx.singleBits!=null?(_localctx.singleBits.Start):null)); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 521; + State = 583; Match(FLOAT64_); - State = 522; + State = 584; Match(T__29); - State = 523; - int64(); - State = 524; + State = 585; + _localctx.doubleBits = int64(); + State = 586; Match(T__30); + _localctx.Value = Actions.ParseFloat64Bits((_localctx.doubleBits!=null?(_localctx.doubleBits.Start):null)); } break; } @@ -1603,6 +1601,8 @@ public Float64Context float64() { } public partial class IntOrWildcardContext : ParserRuleContext { + public int? Value; + public Int32Context value; [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } @@ -1612,12 +1612,6 @@ public IntOrWildcardContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_intOrWildcard; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitIntOrWildcard(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -1625,21 +1619,23 @@ public IntOrWildcardContext intOrWildcard() { IntOrWildcardContext _localctx = new IntOrWildcardContext(Context, State); EnterRule(_localctx, 38, RULE_intOrWildcard); try { - State = 530; + State = 596; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case INT32: EnterOuterAlt(_localctx, 1); { - State = 528; - int32(); + State = 591; + _localctx.value = int32(); + _localctx.Value = Actions.ParseInt32((_localctx.value!=null?(_localctx.value.Start):null)); } break; case PTR: EnterOuterAlt(_localctx, 2); { - State = 529; + State = 594; Match(PTR); + _localctx.Value = null; } break; default: @@ -1672,12 +1668,6 @@ public CompControlContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_compControl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCompControl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -1685,83 +1675,83 @@ public CompControlContext compControl() { CompControlContext _localctx = new CompControlContext(Context, State); EnterRule(_localctx, 40, RULE_compControl); try { - State = 548; + State = 614; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,9,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 532; + State = 598; Match(PP_DEFINE); - State = 533; + State = 599; Match(ID); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 534; + State = 600; Match(PP_DEFINE); - State = 535; + State = 601; Match(ID); - State = 536; + State = 602; Match(QSTRING); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 537; + State = 603; Match(PP_UNDEF); - State = 538; + State = 604; Match(ID); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 539; + State = 605; Match(PP_IFDEF); - State = 540; + State = 606; Match(ID); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 541; + State = 607; Match(PP_IFNDEF); - State = 542; + State = 608; Match(ID); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 543; + State = 609; Match(PP_ELSE); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 544; + State = 610; Match(PP_ENDIF); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 545; + State = 611; Match(PP_INCLUDE); - State = 546; + State = 612; Match(QSTRING); } break; case 9: EnterOuterAlt(_localctx, 9); { - State = 547; + State = 613; Match(T__31); } break; @@ -1779,6 +1769,15 @@ public CompControlContext compControl() { } public partial class TypedefDeclContext : ParserRuleContext { + public CILParser.TypedefDeclarationValue Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public TypeContext signature; + public DottedNameContext alias; + public ClassNameContext classType; + public MemberRefContext member; + public CustomDescrContext attribute; + public CustomDescrWithOwnerContext ownedAttribute; [System.Diagnostics.DebuggerNonUserCode] public TypeContext type() { return GetRuleContext(0); } @@ -1802,85 +1801,94 @@ public TypedefDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_typedefDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTypedefDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TypedefDeclContext typedefDecl() { TypedefDeclContext _localctx = new TypedefDeclContext(Context, State); EnterRule(_localctx, 42, RULE_typedefDecl); + + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.TypedefDeclarationValue.Error; + try { - State = 575; + State = 646; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,10,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 550; + State = 616; Match(T__32); - State = 551; - type(); - State = 552; + State = 617; + _localctx.signature = type(); + State = 618; Match(T__33); - State = 553; - dottedName(); + State = 619; + _localctx.alias = dottedName(); + _localctx.Value = Actions.CreateTypeSignatureTypedef(_localctx.signature.Value, _localctx.alias.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 555; + State = 622; Match(T__32); - State = 556; - className(); - State = 557; + State = 623; + _localctx.classType = className(); + State = 624; Match(T__33); - State = 558; - dottedName(); + State = 625; + _localctx.alias = dottedName(); + _localctx.Value = Actions.CreateClassTypedef(_localctx.classType.Value, _localctx.alias.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 560; + State = 628; Match(T__32); - State = 561; - memberRef(); - State = 562; + State = 629; + _localctx.member = memberRef(); + State = 630; Match(T__33); - State = 563; - dottedName(); + State = 631; + _localctx.alias = dottedName(); + _localctx.Value = Actions.CreateMemberTypedef(_localctx.member.Value, _localctx.alias.Value); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 565; + State = 634; Match(T__32); - State = 566; - customDescr(); - State = 567; + State = 635; + _localctx.attribute = customDescr(); + State = 636; Match(T__33); - State = 568; - dottedName(); + State = 637; + _localctx.alias = dottedName(); + _localctx.Value = Actions.CreateCustomAttributeTypedefDeclaration( + _localctx.attribute.Value, + (_localctx.attribute!=null?(_localctx.attribute.Start):null), + _localctx.alias.Value); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 570; + State = 640; Match(T__32); - State = 571; - customDescrWithOwner(); - State = 572; + State = 641; + _localctx.ownedAttribute = customDescrWithOwner(); + State = 642; Match(T__33); - State = 573; - dottedName(); + State = 643; + _localctx.alias = dottedName(); + _localctx.Value = Actions.CreateCustomAttributeTypedefDeclaration( + _localctx.ownedAttribute.Value, + (_localctx.ownedAttribute!=null?(_localctx.ownedAttribute.Start):null), + _localctx.alias.Value); } break; } @@ -1891,12 +1899,24 @@ public TypedefDeclContext typedefDecl() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + ExitRule(); } return _localctx; } public partial class CustomDescrContext : ParserRuleContext { + public CILParser.CustomAttributeDescriptorValue Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public CustomTypeContext constructor; + public CompQstringContext stringValue; + public CustomBlobDescrContext structuredValue; + public BytesContext rawValue; [System.Diagnostics.DebuggerNonUserCode] public CustomTypeContext customType() { return GetRuleContext(0); } @@ -1914,76 +1934,78 @@ public CustomDescrContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_customDescr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCustomDescr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public CustomDescrContext customDescr() { CustomDescrContext _localctx = new CustomDescrContext(Context, State); EnterRule(_localctx, 44, RULE_customDescr); + + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.CustomAttributeDescriptorValue.Error; + try { - State = 598; + State = 674; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,11,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 577; + State = 648; Match(T__34); - State = 578; - customType(); + State = 649; + _localctx.constructor = customType(); + _localctx.Value = Actions.CreateDefaultCustomAttribute(_localctx.constructor.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 579; + State = 652; Match(T__34); - State = 580; - customType(); - State = 581; + State = 653; + _localctx.constructor = customType(); + State = 654; Match(T__35); - State = 582; - compQstring(); + State = 655; + _localctx.stringValue = compQstring(); + _localctx.Value = Actions.CreateStringCustomAttribute(_localctx.constructor.Value, _localctx.stringValue.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 584; + State = 658; Match(T__34); - State = 585; - customType(); - State = 586; + State = 659; + _localctx.constructor = customType(); + State = 660; Match(T__35); - State = 587; + State = 661; Match(T__16); - State = 588; - customBlobDescr(); - State = 589; + State = 662; + _localctx.structuredValue = customBlobDescr(); + State = 663; Match(T__17); + _localctx.Value = Actions.CreateStructuredCustomAttribute(_localctx.constructor.Value, _localctx.structuredValue.Value); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 591; + State = 666; Match(T__34); - State = 592; - customType(); - State = 593; + State = 667; + _localctx.constructor = customType(); + State = 668; Match(T__35); - State = 594; + State = 669; Match(T__29); - State = 595; - bytes(); - State = 596; + State = 670; + _localctx.rawValue = bytes(); + State = 671; Match(T__30); + _localctx.Value = Actions.CreateRawCustomAttribute(_localctx.constructor.Value, _localctx.rawValue.Value); } break; } @@ -1994,12 +2016,25 @@ public CustomDescrContext customDescr() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + ExitRule(); } return _localctx; } public partial class CustomDescrWithOwnerContext : ParserRuleContext { + public CILParser.CustomAttributeDescriptorValue Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public OwnerTypeContext owner; + public CustomTypeContext constructor; + public CompQstringContext stringValue; + public CustomBlobDescrContext structuredValue; + public BytesContext rawValue; [System.Diagnostics.DebuggerNonUserCode] public OwnerTypeContext ownerType() { return GetRuleContext(0); } @@ -2020,100 +2055,102 @@ public CustomDescrWithOwnerContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_customDescrWithOwner; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCustomDescrWithOwner(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public CustomDescrWithOwnerContext customDescrWithOwner() { CustomDescrWithOwnerContext _localctx = new CustomDescrWithOwnerContext(Context, State); EnterRule(_localctx, 46, RULE_customDescrWithOwner); + + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.CustomAttributeDescriptorValue.Error; + try { - State = 634; + State = 714; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,12,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 600; + State = 676; Match(T__34); - State = 601; + State = 677; Match(T__29); - State = 602; - ownerType(); - State = 603; + State = 678; + _localctx.owner = ownerType(); + State = 679; Match(T__30); - State = 604; - customType(); + State = 680; + _localctx.constructor = customType(); + _localctx.Value = Actions.CreateDefaultOwnedCustomAttribute(_localctx.owner.Value, _localctx.constructor.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 606; + State = 683; Match(T__34); - State = 607; + State = 684; Match(T__29); - State = 608; - ownerType(); - State = 609; + State = 685; + _localctx.owner = ownerType(); + State = 686; Match(T__30); - State = 610; - customType(); - State = 611; + State = 687; + _localctx.constructor = customType(); + State = 688; Match(T__35); - State = 612; - compQstring(); + State = 689; + _localctx.stringValue = compQstring(); + _localctx.Value = Actions.CreateStringOwnedCustomAttribute(_localctx.owner.Value, _localctx.constructor.Value, _localctx.stringValue.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 614; + State = 692; Match(T__34); - State = 615; + State = 693; Match(T__29); - State = 616; - ownerType(); - State = 617; + State = 694; + _localctx.owner = ownerType(); + State = 695; Match(T__30); - State = 618; - customType(); - State = 619; + State = 696; + _localctx.constructor = customType(); + State = 697; Match(T__35); - State = 620; + State = 698; Match(T__16); - State = 621; - customBlobDescr(); - State = 622; + State = 699; + _localctx.structuredValue = customBlobDescr(); + State = 700; Match(T__17); + _localctx.Value = Actions.CreateStructuredOwnedCustomAttribute(_localctx.owner.Value, _localctx.constructor.Value, _localctx.structuredValue.Value); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 624; + State = 703; Match(T__34); - State = 625; + State = 704; Match(T__29); - State = 626; - ownerType(); - State = 627; + State = 705; + _localctx.owner = ownerType(); + State = 706; Match(T__30); - State = 628; - customType(); - State = 629; + State = 707; + _localctx.constructor = customType(); + State = 708; Match(T__35); - State = 630; + State = 709; Match(T__29); - State = 631; - bytes(); - State = 632; + State = 710; + _localctx.rawValue = bytes(); + State = 711; Match(T__30); + _localctx.Value = Actions.CreateRawOwnedCustomAttribute(_localctx.owner.Value, _localctx.constructor.Value, _localctx.rawValue.Value); } break; } @@ -2124,12 +2161,19 @@ public CustomDescrWithOwnerContext customDescrWithOwner() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + ExitRule(); } return _localctx; } public partial class CustomTypeContext : ParserRuleContext { + public CILParser.MethodReferenceValue Value; + public MethodRefContext constructor; [System.Diagnostics.DebuggerNonUserCode] public MethodRefContext methodRef() { return GetRuleContext(0); } @@ -2138,23 +2182,19 @@ public CustomTypeContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_customType; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCustomType(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public CustomTypeContext customType() { CustomTypeContext _localctx = new CustomTypeContext(Context, State); EnterRule(_localctx, 48, RULE_customType); + _localctx.Value = CILParser.MethodReferenceValue.Error; try { EnterOuterAlt(_localctx, 1); { - State = 636; - methodRef(); + State = 716; + _localctx.constructor = methodRef(); + _localctx.Value = Actions.CreateCustomAttributeType(_localctx.constructor.Value); } } catch (RecognitionException re) { @@ -2169,8 +2209,13 @@ public CustomTypeContext customType() { } public partial class OwnerTypeContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { - return GetRuleContext(0); + public CILParser.OwnerTypeValue Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public TypeSpecOrScopeContext typeValue; + public MemberRefContext member; + [System.Diagnostics.DebuggerNonUserCode] public TypeSpecOrScopeContext typeSpecOrScope() { + return GetRuleContext(0); } [System.Diagnostics.DebuggerNonUserCode] public MemberRefContext memberRef() { return GetRuleContext(0); @@ -2180,34 +2225,34 @@ public OwnerTypeContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_ownerType; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitOwnerType(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public OwnerTypeContext ownerType() { OwnerTypeContext _localctx = new OwnerTypeContext(Context, State); EnterRule(_localctx, 50, RULE_ownerType); + + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.OwnerTypeValue.Error; + try { - State = 640; + State = 725; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,13,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 638; - typeSpec(); + State = 719; + _localctx.typeValue = typeSpecOrScope(); + _localctx.Value = Actions.CreateTypeOwner(_localctx.typeValue.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 639; - memberRef(); + State = 722; + _localctx.member = memberRef(); + _localctx.Value = Actions.CreateMemberOwner(_localctx.member.Value); } break; } @@ -2218,12 +2263,20 @@ public OwnerTypeContext ownerType() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + ExitRule(); } return _localctx; } public partial class CustomBlobDescrContext : ParserRuleContext { + public CILParser.CustomAttributeBlobValue Value; + public CustomBlobArgsContext arguments; + public CustomBlobNVPairsContext namedArguments; [System.Diagnostics.DebuggerNonUserCode] public CustomBlobArgsContext customBlobArgs() { return GetRuleContext(0); } @@ -2235,25 +2288,21 @@ public CustomBlobDescrContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_customBlobDescr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCustomBlobDescr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public CustomBlobDescrContext customBlobDescr() { CustomBlobDescrContext _localctx = new CustomBlobDescrContext(Context, State); EnterRule(_localctx, 52, RULE_customBlobDescr); + _localctx.Value = CILParser.CustomAttributeBlobValue.Error; try { EnterOuterAlt(_localctx, 1); { - State = 642; - customBlobArgs(); - State = 643; - customBlobNVPairs(); + State = 727; + _localctx.arguments = customBlobArgs(); + State = 728; + _localctx.namedArguments = customBlobNVPairs(); + _localctx.Value = Actions.CreateCustomAttributeBlob(_localctx.arguments.Value, _localctx.namedArguments.Value); } } catch (RecognitionException re) { @@ -2268,46 +2317,44 @@ public CustomBlobDescrContext customBlobDescr() { } public partial class CustomBlobArgsContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public SerInitContext[] serInit() { - return GetRuleContexts(); - } - [System.Diagnostics.DebuggerNonUserCode] public SerInitContext serInit(int i) { - return GetRuleContext(i); - } + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public SerInitContext argument; [System.Diagnostics.DebuggerNonUserCode] public CompControlContext[] compControl() { return GetRuleContexts(); } [System.Diagnostics.DebuggerNonUserCode] public CompControlContext compControl(int i) { return GetRuleContext(i); } + [System.Diagnostics.DebuggerNonUserCode] public SerInitContext[] serInit() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public SerInitContext serInit(int i) { + return GetRuleContext(i); + } public CustomBlobArgsContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_customBlobArgs; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCustomBlobArgs(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public CustomBlobArgsContext customBlobArgs() { CustomBlobArgsContext _localctx = new CustomBlobArgsContext(Context, State); EnterRule(_localctx, 54, RULE_customBlobArgs); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 649; + State = 737; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,15,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { - State = 647; + State = 735; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__83: @@ -2327,8 +2374,9 @@ public CustomBlobArgsContext customBlobArgs() { case TYPE: case OBJECT: { - State = 645; - serInit(); + State = 731; + _localctx.argument = serInit(); + _localctx.Builder.Add(_localctx.argument.Value); } break; case T__31: @@ -2340,16 +2388,16 @@ public CustomBlobArgsContext customBlobArgs() { case PP_ENDIF: case PP_INCLUDE: { - State = 646; + State = 734; compControl(); } break; default: throw new NoViableAltException(this); } - } + } } - State = 651; + State = 739; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,15,Context); } @@ -2361,12 +2409,25 @@ public CustomBlobArgsContext customBlobArgs() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } public partial class CustomBlobNVPairsContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public FieldOrPropContext kind; + public SerializTypeContext argumentType; + public DottedNameContext name; + public SerInitContext value; + [System.Diagnostics.DebuggerNonUserCode] public CompControlContext[] compControl() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public CompControlContext compControl(int i) { + return GetRuleContext(i); + } [System.Diagnostics.DebuggerNonUserCode] public FieldOrPropContext[] fieldOrProp() { return GetRuleContexts(); } @@ -2391,54 +2452,48 @@ [System.Diagnostics.DebuggerNonUserCode] public SerInitContext[] serInit() { [System.Diagnostics.DebuggerNonUserCode] public SerInitContext serInit(int i) { return GetRuleContext(i); } - [System.Diagnostics.DebuggerNonUserCode] public CompControlContext[] compControl() { - return GetRuleContexts(); - } - [System.Diagnostics.DebuggerNonUserCode] public CompControlContext compControl(int i) { - return GetRuleContext(i); - } public CustomBlobNVPairsContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_customBlobNVPairs; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCustomBlobNVPairs(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public CustomBlobNVPairsContext customBlobNVPairs() { CustomBlobNVPairsContext _localctx = new CustomBlobNVPairsContext(Context, State); EnterRule(_localctx, 56, RULE_customBlobNVPairs); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 661; + State = 750; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 416611827712L) != 0) || ((((_la - 266)) & ~0x3f) == 0 && ((1L << (_la - 266)) & 127L) != 0)) { { - State = 659; + State = 748; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__36: case T__37: { - State = 652; - fieldOrProp(); - State = 653; - serializType(); - State = 654; - dottedName(); - State = 655; + State = 740; + _localctx.kind = fieldOrProp(); + State = 741; + _localctx.argumentType = serializType(); + State = 742; + _localctx.name = dottedName(); + State = 743; Match(T__35); - State = 656; - serInit(); + State = 744; + _localctx.value = serInit(); + _localctx.Builder.Add(Actions.CreateCustomBlobNamedArgument( + _localctx.kind.Value, + _localctx.argumentType.Value, + _localctx.name.Value, + _localctx.value.Value)); } break; case T__31: @@ -2450,7 +2505,7 @@ public CustomBlobNVPairsContext customBlobNVPairs() { case PP_ENDIF: case PP_INCLUDE: { - State = 658; + State = 747; compControl(); } break; @@ -2458,7 +2513,7 @@ public CustomBlobNVPairsContext customBlobNVPairs() { throw new NoViableAltException(this); } } - State = 663; + State = 752; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -2470,23 +2525,20 @@ public CustomBlobNVPairsContext customBlobNVPairs() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } public partial class FieldOrPropContext : ParserRuleContext { + public byte Value; + public IToken kind; public FieldOrPropContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_fieldOrProp; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitFieldOrProp(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] @@ -2497,15 +2549,17 @@ public FieldOrPropContext fieldOrProp() { try { EnterOuterAlt(_localctx, 1); { - State = 664; + State = 753; + _localctx.kind = TokenStream.LT(1); _la = TokenStream.LA(1); if ( !(_la==T__36 || _la==T__37) ) { - ErrorHandler.RecoverInline(this); + _localctx.kind = ErrorHandler.RecoverInline(this); } else { ErrorHandler.ReportMatch(this); Consume(); } + _localctx.Value = Actions.GetCustomAttributeNamedArgumentKind(_localctx.kind); } } catch (RecognitionException re) { @@ -2520,6 +2574,9 @@ public FieldOrPropContext fieldOrProp() { } public partial class SerializTypeContext : ParserRuleContext { + public CILParser.SerializationTypeValue Value; + public SerializTypeElementContext element; + public IToken array; [System.Diagnostics.DebuggerNonUserCode] public SerializTypeElementContext serializTypeElement() { return GetRuleContext(0); } @@ -2529,34 +2586,30 @@ public SerializTypeContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_serializType; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSerializType(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public SerializTypeContext serializType() { SerializTypeContext _localctx = new SerializTypeContext(Context, State); EnterRule(_localctx, 60, RULE_serializType); + _localctx.Value = CILParser.SerializationTypeValue.Error; int _la; try { EnterOuterAlt(_localctx, 1); { - State = 666; - serializTypeElement(); - State = 668; + State = 756; + _localctx.element = serializTypeElement(); + State = 758; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==ARRAY_TYPE_NO_BOUNDS) { { - State = 667; - Match(ARRAY_TYPE_NO_BOUNDS); + State = 757; + _localctx.array = Match(ARRAY_TYPE_NO_BOUNDS); } } + _localctx.Value = Actions.CreateSerializationType(_localctx.element.Value, _localctx.array); } } catch (RecognitionException re) { @@ -2571,6 +2624,12 @@ public SerializTypeContext serializType() { } public partial class SerializTypeElementContext : ParserRuleContext { + public CILParser.SerializationTypeValue Value; + public SimpleTypeContext primitive; + public DottedNameContext alias; + public IToken simpleTypeToken; + public IToken quotedName; + public ClassNameContext classNameValue; [System.Diagnostics.DebuggerNonUserCode] public SimpleTypeContext simpleType() { return GetRuleContext(0); } @@ -2589,68 +2648,69 @@ public SerializTypeElementContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_serializTypeElement; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSerializTypeElement(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public SerializTypeElementContext serializTypeElement() { SerializTypeElementContext _localctx = new SerializTypeElementContext(Context, State); EnterRule(_localctx, 62, RULE_serializTypeElement); + _localctx.Value = CILParser.SerializationTypeValue.Error; try { - State = 679; + State = 780; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,19,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 670; - simpleType(); + State = 762; + _localctx.primitive = simpleType(); + _localctx.Value = Actions.CreatePrimitiveSerializationType(_localctx.primitive.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 671; - dottedName(); + State = 765; + _localctx.alias = dottedName(); + _localctx.Value = Actions.CreateSerializationTypeTypedef(_localctx, _localctx.alias.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 672; - Match(TYPE); + State = 768; + _localctx.simpleTypeToken = Match(TYPE); + _localctx.Value = Actions.CreateSimpleSerializationType(_localctx.simpleTypeToken); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 673; - Match(OBJECT); + State = 770; + _localctx.simpleTypeToken = Match(OBJECT); + _localctx.Value = Actions.CreateSimpleSerializationType(_localctx.simpleTypeToken); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 674; + State = 772; Match(ENUM); - State = 675; + State = 773; Match(T__38); - State = 676; - Match(SQSTRING); + State = 774; + _localctx.quotedName = Match(SQSTRING); + _localctx.Value = Actions.CreateEnumSerializationType(_localctx.quotedName); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 677; + State = 776; Match(ENUM); - State = 678; - className(); + State = 777; + _localctx.classNameValue = className(); + _localctx.Value = Actions.CreateEnumSerializationType(_localctx.classNameValue.Value); } break; } @@ -2667,6 +2727,10 @@ public SerializTypeElementContext serializTypeElement() { } public partial class ModuleHeadContext : ParserRuleContext { + public string? Value; + public bool HasName; + public bool IsExternal; + public DottedNameContext name; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode MODULE() { return GetToken(CILParser.MODULE, 0); } [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { return GetRuleContext(0); @@ -2676,47 +2740,45 @@ public ModuleHeadContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_moduleHead; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitModuleHead(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ModuleHeadContext moduleHead() { ModuleHeadContext _localctx = new ModuleHeadContext(Context, State); EnterRule(_localctx, 64, RULE_moduleHead); + _localctx.Value = null; try { - State = 687; + State = 793; ErrorHandler.Sync(this); switch ( Interpreter.AdaptivePredict(TokenStream,20,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 681; + State = 782; Match(MODULE); - State = 682; + State = 783; Match(T__39); - State = 683; - dottedName(); + State = 784; + _localctx.name = dottedName(); + Actions.SetModuleHeader(_localctx, _localctx.name.Value, true); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 684; + State = 787; Match(MODULE); - State = 685; - dottedName(); + State = 788; + _localctx.name = dottedName(); + Actions.SetModuleHeader(_localctx, _localctx.name.Value, false); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 686; + State = 791; Match(MODULE); + Actions.SetEmptyModuleHeader(_localctx); } break; } @@ -2733,6 +2795,12 @@ public ModuleHeadContext moduleHead() { } public partial class VtfixupDeclContext : ParserRuleContext { + public CILParser.VTableFixupValue? Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public Int32Context count; + public VtfixupAttrContext attributes; + public IdContext label; [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } @@ -2747,35 +2815,34 @@ public VtfixupDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_vtfixupDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitVtfixupDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public VtfixupDeclContext vtfixupDecl() { VtfixupDeclContext _localctx = new VtfixupDeclContext(Context, State); EnterRule(_localctx, 66, RULE_vtfixupDecl); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; try { EnterOuterAlt(_localctx, 1); { - State = 689; + State = 795; Match(T__40); - State = 690; + State = 796; Match(T__41); - State = 691; - int32(); - State = 692; + State = 797; + _localctx.count = int32(); + State = 798; Match(T__42); - State = 693; - vtfixupAttr(0); - State = 694; + State = 799; + _localctx.attributes = vtfixupAttr(); + State = 800; Match(T__43); - State = 695; - id(); + State = 801; + _localctx.label = id(); + _localctx.Value = Actions.CreateVTableFixup( + (_localctx.count!=null?(_localctx.count.Start):null), + _localctx.attributes.Value, + (_localctx.label!=null?(_localctx.label.Start):null)); } } catch (RecognitionException re) { @@ -2784,119 +2851,105 @@ public VtfixupDeclContext vtfixupDecl() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + if (_localctx.HasSyntaxError) + { + _localctx.Value = null; + } + ExitRule(); } return _localctx; } public partial class VtfixupAttrContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public VtfixupAttrContext vtfixupAttr() { - return GetRuleContext(0); + public ushort Value; + public VtfixupAttrElementContext attribute; + [System.Diagnostics.DebuggerNonUserCode] public VtfixupAttrElementContext[] vtfixupAttrElement() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public VtfixupAttrElementContext vtfixupAttrElement(int i) { + return GetRuleContext(i); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT32_() { return GetToken(CILParser.INT32_, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT64_() { return GetToken(CILParser.INT64_, 0); } public VtfixupAttrContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_vtfixupAttr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitVtfixupAttr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public VtfixupAttrContext vtfixupAttr() { - return vtfixupAttr(0); - } - - private VtfixupAttrContext vtfixupAttr(int _p) { - ParserRuleContext _parentctx = Context; - int _parentState = State; - VtfixupAttrContext _localctx = new VtfixupAttrContext(Context, _parentState); - VtfixupAttrContext _prevctx = _localctx; - int _startState = 68; - EnterRecursionRule(_localctx, 68, RULE_vtfixupAttr, _p); + VtfixupAttrContext _localctx = new VtfixupAttrContext(Context, State); + EnterRule(_localctx, 68, RULE_vtfixupAttr); + _localctx.Value = 0; + int _la; try { - int _alt; EnterOuterAlt(_localctx, 1); { - { - } - Context.Stop = TokenStream.LT(-1); - State = 710; + State = 809; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,22,Context); - while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - if ( ParseListeners!=null ) - TriggerExitRuleEvent(); - _prevctx = _localctx; - { - State = 708; - ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,21,Context) ) { - case 1: - { - _localctx = new VtfixupAttrContext(_parentctx, _parentState); - PushNewRecursionContext(_localctx, _startState, RULE_vtfixupAttr); - State = 698; - if (!(Precpred(Context, 5))) throw new FailedPredicateException(this, "Precpred(Context, 5)"); - State = 699; - Match(INT32_); - } - break; - case 2: - { - _localctx = new VtfixupAttrContext(_parentctx, _parentState); - PushNewRecursionContext(_localctx, _startState, RULE_vtfixupAttr); - State = 700; - if (!(Precpred(Context, 4))) throw new FailedPredicateException(this, "Precpred(Context, 4)"); - State = 701; - Match(INT64_); - } - break; - case 3: - { - _localctx = new VtfixupAttrContext(_parentctx, _parentState); - PushNewRecursionContext(_localctx, _startState, RULE_vtfixupAttr); - State = 702; - if (!(Precpred(Context, 3))) throw new FailedPredicateException(this, "Precpred(Context, 3)"); - State = 703; - Match(T__44); - } - break; - case 4: - { - _localctx = new VtfixupAttrContext(_parentctx, _parentState); - PushNewRecursionContext(_localctx, _startState, RULE_vtfixupAttr); - State = 704; - if (!(Precpred(Context, 2))) throw new FailedPredicateException(this, "Precpred(Context, 2)"); - State = 705; - Match(T__45); - } - break; - case 5: - { - _localctx = new VtfixupAttrContext(_parentctx, _parentState); - PushNewRecursionContext(_localctx, _startState, RULE_vtfixupAttr); - State = 706; - if (!(Precpred(Context, 1))) throw new FailedPredicateException(this, "Precpred(Context, 1)"); - State = 707; - Match(T__46); - } - break; - } - } + _la = TokenStream.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 246290604621824L) != 0) || _la==INT32_ || _la==INT64_) { + { + { + State = 804; + _localctx.attribute = vtfixupAttrElement(); + _localctx.Value = Actions.AddVTableFixupAttribute(_localctx.Value, _localctx.attribute.Value); + } } - State = 712; + State = 811; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,22,Context); + _la = TokenStream.LA(1); + } + _localctx.Value = Actions.CompleteVTableFixupAttributes(_localctx.Value); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class VtfixupAttrElementContext : ParserRuleContext { + public ushort Value; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT32_() { return GetToken(CILParser.INT32_, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT64_() { return GetToken(CILParser.INT64_, 0); } + public VtfixupAttrElementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_vtfixupAttrElement; } } + } + + [RuleVersion(0)] + public VtfixupAttrElementContext vtfixupAttrElement() { + VtfixupAttrElementContext _localctx = new VtfixupAttrElementContext(Context, State); + EnterRule(_localctx, 70, RULE_vtfixupAttrElement); + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 814; + _la = TokenStream.LA(1); + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 246290604621824L) != 0) || _la==INT32_ || _la==INT64_) ) { + ErrorHandler.RecoverInline(this); + } + else { + ErrorHandler.ReportMatch(this); + Consume(); } } + Context.Stop = TokenStream.LT(-1); + _localctx.Value = Actions.ParseVTableFixupAttribute(_localctx.Start); } catch (RecognitionException re) { _localctx.exception = re; @@ -2904,12 +2957,16 @@ private VtfixupAttrContext vtfixupAttr(int _p) { ErrorHandler.Recover(this, re); } finally { - UnrollRecursionContexts(_parentctx); + ExitRule(); } return _localctx; } public partial class VtableDeclContext : ParserRuleContext { + public CILParser.RawVTableValue? Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public BytesContext value; [System.Diagnostics.DebuggerNonUserCode] public BytesContext bytes() { return GetRuleContext(0); } @@ -2918,31 +2975,27 @@ public VtableDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_vtableDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitVtableDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public VtableDeclContext vtableDecl() { VtableDeclContext _localctx = new VtableDeclContext(Context, State); - EnterRule(_localctx, 70, RULE_vtableDecl); + EnterRule(_localctx, 72, RULE_vtableDecl); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; try { EnterOuterAlt(_localctx, 1); { - State = 713; + State = 816; Match(T__47); - State = 714; + State = 817; Match(T__35); - State = 715; + State = 818; Match(T__29); - State = 716; - bytes(); - State = 717; + State = 819; + _localctx.value = bytes(); + State = 820; Match(T__30); + _localctx.Value = Actions.CreateRawVTable(_localctx.value.Value); } } catch (RecognitionException re) { @@ -2951,12 +3004,24 @@ public VtableDeclContext vtableDecl() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + if (_localctx.HasSyntaxError) + { + _localctx.Value = null; + } + ExitRule(); } return _localctx; } public partial class NameSpaceHeadContext : ParserRuleContext { + public string Value; + public int InitialSyntaxErrorCount; + public DottedNameContext name; [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { return GetRuleContext(0); } @@ -2965,25 +3030,25 @@ public NameSpaceHeadContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_nameSpaceHead; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitNameSpaceHead(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public NameSpaceHeadContext nameSpaceHead() { NameSpaceHeadContext _localctx = new NameSpaceHeadContext(Context, State); - EnterRule(_localctx, 72, RULE_nameSpaceHead); + EnterRule(_localctx, 74, RULE_nameSpaceHead); + + Actions.PrepareNamespaceHeader(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = string.Empty; + try { EnterOuterAlt(_localctx, 1); { - State = 719; + State = 823; Match(T__48); - State = 720; - dottedName(); + State = 824; + _localctx.name = dottedName(); + _localctx.Value = _localctx.name.Value; } } catch (RecognitionException re) { @@ -2992,12 +3057,21 @@ public NameSpaceHeadContext nameSpaceHead() { ErrorHandler.Recover(this, re); } finally { + Actions.BeginNamespace(_localctx, _localctx.Value, _localctx.InitialSyntaxErrorCount); ExitRule(); } return _localctx; } public partial class ClassHeadContext : ParserRuleContext { + public CILParser.ClassHeaderValue Value; + public int InitialSyntaxErrorCount; + public CILParser.ClassHeaderBuilder Builder; + public ClassAttrContext attribute; + public DottedNameContext name; + public TyparsClauseContext genericParameters; + public ExtendsClauseContext baseType; + public ImplClauseContext interfaces; [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { return GetRuleContext(0); } @@ -3021,46 +3095,55 @@ public ClassHeadContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_classHead; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitClassHead(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ClassHeadContext classHead() { ClassHeadContext _localctx = new ClassHeadContext(Context, State); - EnterRule(_localctx, 74, RULE_classHead); + EnterRule(_localctx, 76, RULE_classHead); + + _localctx.Builder = Actions.PrepareClassHeader(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.ClassHeaderValue.Error; + int _la; try { EnterOuterAlt(_localctx, 1); { - State = 722; + State = 827; Match(T__49); - State = 726; + State = 833; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (((((_la - 15)) & ~0x3f) == 0 && ((1L << (_la - 15)) & 67835400667791361L) != 0) || ((((_la - 198)) & ~0x3f) == 0 && ((1L << (_la - 198)) & 35184409837577L) != 0)) { { { - State = 723; - classAttr(); + State = 828; + _localctx.attribute = classAttr(); + Actions.AddClassHeaderAttribute(_localctx.Builder, _localctx.attribute.Value); } } - State = 728; + State = 835; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 729; - dottedName(); - State = 730; - typarsClause(); - State = 731; - extendsClause(); - State = 732; - implClause(); + State = 836; + _localctx.name = dottedName(); + State = 837; + _localctx.genericParameters = typarsClause(); + State = 838; + _localctx.baseType = extendsClause(); + State = 839; + _localctx.interfaces = implClause(); + _localctx.Value = Actions.CreateClassHeader( + _localctx, + _localctx.Builder, + _localctx.InitialSyntaxErrorCount, + (_localctx.name!=null?(_localctx.name.Stop):null), + _localctx.name.Value, + _localctx.genericParameters.Value, + _localctx.baseType.Value, + _localctx.interfaces.Value); } } catch (RecognitionException re) { @@ -3069,12 +3152,17 @@ public ClassHeadContext classHead() { ErrorHandler.Recover(this, re); } finally { + Actions.BeginType(_localctx, _localctx.Value); ExitRule(); } return _localctx; } public partial class ClassAttrContext : ParserRuleContext { + public CILParser.ClassAttributeValue Value; + public IToken attribute; + public IToken visibility; + public Int32Context flags; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VALUE() { return GetToken(CILParser.VALUE, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ENUM() { return GetToken(CILParser.ENUM, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INTERFACE() { return GetToken(CILParser.INTERFACE, 0); } @@ -3088,227 +3176,249 @@ public ClassAttrContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_classAttr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitClassAttr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ClassAttrContext classAttr() { ClassAttrContext _localctx = new ClassAttrContext(Context, State); - EnterRule(_localctx, 76, RULE_classAttr); + EnterRule(_localctx, 78, RULE_classAttr); + _localctx.Value = CILParser.ClassAttributeValue.Empty; try { - State = 771; + State = 906; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,24,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,23,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 734; - Match(T__50); + State = 842; + _localctx.attribute = Match(T__50); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 735; - Match(T__51); + State = 844; + _localctx.attribute = Match(T__51); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 736; - Match(VALUE); + State = 846; + _localctx.attribute = Match(VALUE); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 737; - Match(ENUM); + State = 848; + _localctx.attribute = Match(ENUM); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 738; - Match(INTERFACE); + State = 850; + _localctx.attribute = Match(INTERFACE); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 739; - Match(T__52); + State = 852; + _localctx.attribute = Match(T__52); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 740; - Match(T__53); + State = 854; + _localctx.attribute = Match(T__53); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 741; - Match(T__54); + State = 856; + _localctx.attribute = Match(T__54); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 9: EnterOuterAlt(_localctx, 9); { - State = 742; - Match(T__55); + State = 858; + _localctx.attribute = Match(T__55); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 10: EnterOuterAlt(_localctx, 10); { - State = 743; - Match(EXPLICIT); + State = 860; + _localctx.attribute = Match(EXPLICIT); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 11: EnterOuterAlt(_localctx, 11); { - State = 744; - Match(T__14); + State = 862; + _localctx.attribute = Match(T__14); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 12: EnterOuterAlt(_localctx, 12); { - State = 745; - Match(ANSI); + State = 864; + _localctx.attribute = Match(ANSI); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 13: EnterOuterAlt(_localctx, 13); { - State = 746; - Match(T__56); + State = 866; + _localctx.attribute = Match(T__56); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 14: EnterOuterAlt(_localctx, 14); { - State = 747; - Match(T__57); + State = 868; + _localctx.attribute = Match(T__57); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 15: EnterOuterAlt(_localctx, 15); { - State = 748; - Match(T__58); + State = 870; + _localctx.attribute = Match(T__58); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 16: EnterOuterAlt(_localctx, 16); { - State = 749; - Match(T__59); + State = 872; + _localctx.attribute = Match(T__59); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 17: EnterOuterAlt(_localctx, 17); { - State = 750; - Match(T__60); + State = 874; + _localctx.attribute = Match(T__60); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 18: EnterOuterAlt(_localctx, 18); { - State = 751; + State = 876; Match(T__61); - State = 752; - Match(T__50); + State = 877; + _localctx.visibility = Match(T__50); + _localctx.Value = Actions.CreateNestedClassAttribute(_localctx.visibility); } break; case 19: EnterOuterAlt(_localctx, 19); { - State = 753; + State = 879; Match(T__61); - State = 754; - Match(T__51); + State = 880; + _localctx.visibility = Match(T__51); + _localctx.Value = Actions.CreateNestedClassAttribute(_localctx.visibility); } break; case 20: EnterOuterAlt(_localctx, 20); { - State = 755; + State = 882; Match(T__61); - State = 756; - Match(T__62); + State = 883; + _localctx.visibility = Match(T__62); + _localctx.Value = Actions.CreateNestedClassAttribute(_localctx.visibility); } break; case 21: EnterOuterAlt(_localctx, 21); { - State = 757; + State = 885; Match(T__61); - State = 758; - Match(T__63); + State = 886; + _localctx.visibility = Match(T__63); + _localctx.Value = Actions.CreateNestedClassAttribute(_localctx.visibility); } break; case 22: EnterOuterAlt(_localctx, 22); { - State = 759; + State = 888; Match(T__61); - State = 760; - Match(T__64); + State = 889; + _localctx.visibility = Match(T__64); + _localctx.Value = Actions.CreateNestedClassAttribute(_localctx.visibility); } break; case 23: EnterOuterAlt(_localctx, 23); { - State = 761; + State = 891; Match(T__61); - State = 762; - Match(T__65); + State = 892; + _localctx.visibility = Match(T__65); + _localctx.Value = Actions.CreateNestedClassAttribute(_localctx.visibility); } break; case 24: EnterOuterAlt(_localctx, 24); { - State = 763; - Match(T__66); + State = 894; + _localctx.attribute = Match(T__66); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 25: EnterOuterAlt(_localctx, 25); { - State = 764; - Match(T__67); + State = 896; + _localctx.attribute = Match(T__67); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 26: EnterOuterAlt(_localctx, 26); { - State = 765; - Match(T__68); + State = 898; + _localctx.attribute = Match(T__68); + _localctx.Value = Actions.CreateClassAttribute(_localctx.attribute); } break; case 27: EnterOuterAlt(_localctx, 27); { - State = 766; + State = 900; Match(T__69); - State = 767; + State = 901; Match(T__29); - State = 768; - int32(); - State = 769; + State = 902; + _localctx.flags = int32(); + State = 903; Match(T__30); + _localctx.Value = Actions.CreateRawClassAttribute((_localctx.flags!=null?(_localctx.flags.Start):null)); } break; } @@ -3325,6 +3435,8 @@ public ClassAttrContext classAttr() { } public partial class ExtendsClauseContext : ParserRuleContext { + public CILParser.TypeSpecificationValue? Value; + public TypeSpecContext baseType; [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { return GetRuleContext(0); } @@ -3333,20 +3445,15 @@ public ExtendsClauseContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_extendsClause; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitExtendsClause(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ExtendsClauseContext extendsClause() { ExtendsClauseContext _localctx = new ExtendsClauseContext(Context, State); - EnterRule(_localctx, 78, RULE_extendsClause); + EnterRule(_localctx, 80, RULE_extendsClause); + _localctx.Value = Actions.CreateEmptyClassBase(); try { - State = 776; + State = 913; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__16: @@ -3358,10 +3465,11 @@ public ExtendsClauseContext extendsClause() { case T__70: EnterOuterAlt(_localctx, 2); { - State = 774; + State = 909; Match(T__70); - State = 775; - typeSpec(); + State = 910; + _localctx.baseType = typeSpec(); + _localctx.Value = Actions.CreateClassBase(_localctx.baseType.Value); } break; default: @@ -3380,6 +3488,8 @@ public ExtendsClauseContext extendsClause() { } public partial class ImplClauseContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public ImplListContext interfaces; [System.Diagnostics.DebuggerNonUserCode] public ImplListContext implList() { return GetRuleContext(0); } @@ -3388,20 +3498,15 @@ public ImplClauseContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_implClause; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitImplClause(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ImplClauseContext implClause() { ImplClauseContext _localctx = new ImplClauseContext(Context, State); - EnterRule(_localctx, 80, RULE_implClause); + EnterRule(_localctx, 82, RULE_implClause); + _localctx.Value = Actions.CreateEmptyInterfaceList(); try { - State = 781; + State = 920; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__16: @@ -3412,10 +3517,11 @@ public ImplClauseContext implClause() { case T__71: EnterOuterAlt(_localctx, 2); { - State = 779; + State = 916; Match(T__71); - State = 780; - implList(); + State = 917; + _localctx.interfaces = implList(); + _localctx.Value = _localctx.interfaces.Value; } break; default: @@ -3445,33 +3551,27 @@ public ClassDeclsContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_classDecls; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitClassDecls(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ClassDeclsContext classDecls() { ClassDeclsContext _localctx = new ClassDeclsContext(Context, State); - EnterRule(_localctx, 82, RULE_classDecls); + EnterRule(_localctx, 84, RULE_classDecls); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 786; + State = 925; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (((((_la - 16)) & ~0x3f) == 0 && ((1L << (_la - 16)) & 432345581408028673L) != 0) || ((((_la - 117)) & ~0x3f) == 0 && ((1L << (_la - 117)) & 281474980972571L) != 0) || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 871552083145265153L) != 0)) { { { - State = 783; + State = 922; classDecl(); } } - State = 788; + State = 927; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -3489,6 +3589,10 @@ public ClassDeclsContext classDecls() { } public partial class ImplListContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public TypeSpecContext interfaceType; + public TypeSpecContext lastInterfaceType; [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext[] typeSpec() { return GetRuleContexts(); } @@ -3500,42 +3604,39 @@ public ImplListContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_implList; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitImplList(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ImplListContext implList() { ImplListContext _localctx = new ImplListContext(Context, State); - EnterRule(_localctx, 84, RULE_implList); + EnterRule(_localctx, 86, RULE_implList); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 794; + State = 934; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,28,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,27,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 789; - typeSpec(); - State = 790; + State = 928; + _localctx.interfaceType = typeSpec(); + _localctx.Builder.Add(_localctx.interfaceType.Value); + State = 930; Match(T__27); } - } + } } - State = 796; + State = 936; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,28,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,27,Context); } - State = 797; - typeSpec(); + State = 937; + _localctx.lastInterfaceType = typeSpec(); + _localctx.Builder.Add(_localctx.lastInterfaceType.Value); } } catch (RecognitionException re) { @@ -3544,34 +3645,30 @@ public ImplListContext implList() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } public partial class EsHeadContext : ParserRuleContext { + public bool AutoIncrement; public EsHeadContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_esHead; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitEsHead(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public EsHeadContext esHead() { EsHeadContext _localctx = new EsHeadContext(Context, State); - EnterRule(_localctx, 86, RULE_esHead); + EnterRule(_localctx, 88, RULE_esHead); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 799; + State = 940; _la = TokenStream.LA(1); if ( !(_la==T__72 || _la==T__73) ) { ErrorHandler.RecoverInline(this); @@ -3581,6 +3678,8 @@ public EsHeadContext esHead() { Consume(); } } + Context.Stop = TokenStream.LT(-1); + _localctx.AutoIncrement = Actions.IsAutoIncrementSourceDirective(_localctx.Start); } catch (RecognitionException re) { _localctx.exception = re; @@ -3594,6 +3693,17 @@ public EsHeadContext esHead() { } public partial class ExtSourceSpecContext : ParserRuleContext { + public CILParser.SourceDirectiveValue? Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public EsHeadContext head; + public Int32Context line; + public IToken path; + public Int32Context column; + public Int32Context startColumn; + public Int32Context endColumn; + public Int32Context startLine; + public Int32Context endLine; [System.Diagnostics.DebuggerNonUserCode] public EsHeadContext esHead() { return GetRuleContext(0); } @@ -3610,195 +3720,172 @@ public ExtSourceSpecContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_extSourceSpec; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitExtSourceSpec(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ExtSourceSpecContext extSourceSpec() { ExtSourceSpecContext _localctx = new ExtSourceSpecContext(Context, State); - EnterRule(_localctx, 88, RULE_extSourceSpec); + EnterRule(_localctx, 90, RULE_extSourceSpec); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + int _la; try { - State = 872; + State = 993; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,29,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,33,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 801; - esHead(); - State = 802; - int32(); - State = 803; - Match(SQSTRING); + State = 942; + _localctx.head = esHead(); + State = 943; + _localctx.line = int32(); + State = 945; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,28,Context) ) { + case 1: + { + State = 944; + _localctx.path = TokenStream.LT(1); + _la = TokenStream.LA(1); + if ( !(_la==QSTRING || _la==SQSTRING) ) { + _localctx.path = ErrorHandler.RecoverInline(this); + } + else { + ErrorHandler.ReportMatch(this); + Consume(); + } + } + break; + } + _localctx.Value = Actions.CreateSourceLine(_localctx.head.AutoIncrement, (_localctx.line!=null?(_localctx.line.Start):null), _localctx.path); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 805; - esHead(); - State = 806; - int32(); + State = 949; + _localctx.head = esHead(); + State = 950; + _localctx.line = int32(); + State = 951; + Match(T__74); + State = 952; + _localctx.column = int32(); + State = 954; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,29,Context) ) { + case 1: + { + State = 953; + _localctx.path = Match(SQSTRING); + } + break; + } + _localctx.Value = Actions.CreateSourceColumn(_localctx.head.AutoIncrement, (_localctx.line!=null?(_localctx.line.Start):null), (_localctx.column!=null?(_localctx.column.Start):null), _localctx.path); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 808; - esHead(); - State = 809; - int32(); - State = 810; + State = 958; + _localctx.head = esHead(); + State = 959; + _localctx.line = int32(); + State = 960; Match(T__74); - State = 811; - int32(); - State = 812; - Match(SQSTRING); + State = 961; + _localctx.startColumn = int32(); + State = 962; + Match(T__27); + State = 963; + _localctx.endColumn = int32(); + State = 965; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,30,Context) ) { + case 1: + { + State = 964; + _localctx.path = Match(SQSTRING); + } + break; + } + _localctx.Value = Actions.CreateSourceColumnRange( + _localctx.head.AutoIncrement, + (_localctx.line!=null?(_localctx.line.Start):null), + (_localctx.startColumn!=null?(_localctx.startColumn.Start):null), + (_localctx.endColumn!=null?(_localctx.endColumn.Start):null), + _localctx.path); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 814; - esHead(); - State = 815; - int32(); - State = 816; + State = 969; + _localctx.head = esHead(); + State = 970; + _localctx.startLine = int32(); + State = 971; + Match(T__27); + State = 972; + _localctx.endLine = int32(); + State = 973; Match(T__74); - State = 817; - int32(); + State = 974; + _localctx.column = int32(); + State = 976; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,31,Context) ) { + case 1: + { + State = 975; + _localctx.path = Match(SQSTRING); + } + break; + } + _localctx.Value = Actions.CreateSourceLineRange( + _localctx.head.AutoIncrement, + (_localctx.startLine!=null?(_localctx.startLine.Start):null), + (_localctx.endLine!=null?(_localctx.endLine.Start):null), + (_localctx.column!=null?(_localctx.column.Start):null), + _localctx.path); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 819; - esHead(); - State = 820; - int32(); - State = 821; + State = 980; + _localctx.head = esHead(); + State = 981; + _localctx.startLine = int32(); + State = 982; + Match(T__27); + State = 983; + _localctx.endLine = int32(); + State = 984; Match(T__74); - State = 822; - int32(); - State = 823; + State = 985; + _localctx.startColumn = int32(); + State = 986; Match(T__27); - State = 824; - int32(); - State = 825; - Match(SQSTRING); - } - break; - case 6: - EnterOuterAlt(_localctx, 6); - { - State = 827; - esHead(); - State = 828; - int32(); - State = 829; - Match(T__74); - State = 830; - int32(); - State = 831; - Match(T__27); - State = 832; - int32(); - } - break; - case 7: - EnterOuterAlt(_localctx, 7); - { - State = 834; - esHead(); - State = 835; - int32(); - State = 836; - Match(T__27); - State = 837; - int32(); - State = 838; - Match(T__74); - State = 839; - int32(); - State = 840; - Match(SQSTRING); - } - break; - case 8: - EnterOuterAlt(_localctx, 8); - { - State = 842; - esHead(); - State = 843; - int32(); - State = 844; - Match(T__27); - State = 845; - int32(); - State = 846; - Match(T__74); - State = 847; - int32(); - } - break; - case 9: - EnterOuterAlt(_localctx, 9); - { - State = 849; - esHead(); - State = 850; - int32(); - State = 851; - Match(T__27); - State = 852; - int32(); - State = 853; - Match(T__74); - State = 854; - int32(); - State = 855; - Match(T__27); - State = 856; - int32(); - State = 857; - Match(SQSTRING); - } - break; - case 10: - EnterOuterAlt(_localctx, 10); - { - State = 859; - esHead(); - State = 860; - int32(); - State = 861; - Match(T__27); - State = 862; - int32(); - State = 863; - Match(T__74); - State = 864; - int32(); - State = 865; - Match(T__27); - State = 866; - int32(); + State = 987; + _localctx.endColumn = int32(); + State = 989; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,32,Context) ) { + case 1: + { + State = 988; + _localctx.path = Match(SQSTRING); + } + break; } - break; - case 11: - EnterOuterAlt(_localctx, 11); - { - State = 868; - esHead(); - State = 869; - int32(); - State = 870; - Match(QSTRING); + _localctx.Value = Actions.CreateSourceRange( + _localctx.head.AutoIncrement, + (_localctx.startLine!=null?(_localctx.startLine.Start):null), + (_localctx.endLine!=null?(_localctx.endLine.Start):null), + (_localctx.startColumn!=null?(_localctx.startColumn.Start):null), + (_localctx.endColumn!=null?(_localctx.endColumn.Start):null), + _localctx.path); } break; } @@ -3809,12 +3896,22 @@ public ExtSourceSpecContext extSourceSpec() { ErrorHandler.Recover(this, re); } finally { + Actions.EndSourceDirective(_localctx, _localctx.InitialSyntaxErrorCount); ExitRule(); } return _localctx; } public partial class FileDeclContext : ParserRuleContext { + public CILParser.FileDeclarationValue? Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public CILParser.FileDeclarationBuilder Builder; + public FileAttrContext attribute; + public DottedNameContext name; + public FileEntryContext entry; + public BytesContext hash; + public FileEntryContext trailingEntry; [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { return GetRuleContext(0); } @@ -3825,99 +3922,79 @@ [System.Diagnostics.DebuggerNonUserCode] public FileEntryContext fileEntry(int i return GetRuleContext(i); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode HASH() { return GetToken(CILParser.HASH, 0); } - [System.Diagnostics.DebuggerNonUserCode] public BytesContext bytes() { - return GetRuleContext(0); - } [System.Diagnostics.DebuggerNonUserCode] public FileAttrContext[] fileAttr() { return GetRuleContexts(); } [System.Diagnostics.DebuggerNonUserCode] public FileAttrContext fileAttr(int i) { return GetRuleContext(i); } + [System.Diagnostics.DebuggerNonUserCode] public BytesContext bytes() { + return GetRuleContext(0); + } public FileDeclContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_fileDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitFileDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public FileDeclContext fileDecl() { FileDeclContext _localctx = new FileDeclContext(Context, State); - EnterRule(_localctx, 90, RULE_fileDecl); + EnterRule(_localctx, 92, RULE_fileDecl); + + _localctx.Builder = new CILParser.FileDeclarationBuilder(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + int _la; try { - State = 900; + EnterOuterAlt(_localctx, 1); + { + State = 995; + Match(T__20); + State = 1001; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,32,Context) ) { - case 1: - EnterOuterAlt(_localctx, 1); + _la = TokenStream.LA(1); + while (_la==T__75) { { - State = 874; - Match(T__20); - State = 878; + { + State = 996; + _localctx.attribute = fileAttr(); + Actions.AddFileAttribute(_localctx.Builder, _localctx.attribute.Value); + } + } + State = 1003; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - while (_la==T__75) { - { - { - State = 875; - fileAttr(); - } - } - State = 880; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - } - State = 881; - dottedName(); - State = 882; - fileEntry(); - State = 883; + } + State = 1004; + _localctx.name = dottedName(); + Actions.SetFileName(_localctx.Builder, _localctx.name.Value); + State = 1006; + _localctx.entry = fileEntry(); + Actions.AddFileEntry(_localctx.Builder, _localctx.entry.Value); + State = 1017; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==HASH) { + { + State = 1008; Match(HASH); - State = 884; + State = 1009; Match(T__35); - State = 885; + State = 1010; Match(T__29); - State = 886; - bytes(); - State = 887; + State = 1011; + _localctx.hash = bytes(); + State = 1012; Match(T__30); - State = 888; - fileEntry(); - } - break; - case 2: - EnterOuterAlt(_localctx, 2); - { - State = 890; - Match(T__20); - State = 894; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - while (_la==T__75) { - { - { - State = 891; - fileAttr(); - } - } - State = 896; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - } - State = 897; - dottedName(); - State = 898; - fileEntry(); + Actions.SetFileHash(_localctx.Builder, _localctx.hash.Value); + State = 1014; + _localctx.trailingEntry = fileEntry(); + Actions.AddFileEntry(_localctx.Builder, _localctx.trailingEntry.Value); } - break; + } + } } catch (RecognitionException re) { @@ -3926,35 +4003,33 @@ public FileDeclContext fileDecl() { ErrorHandler.Recover(this, re); } finally { + Actions.EndFileDeclaration(_localctx, _localctx.Builder, _localctx.InitialSyntaxErrorCount); ExitRule(); } return _localctx; } public partial class FileAttrContext : ParserRuleContext { + public bool Value; public FileAttrContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_fileAttr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitFileAttr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public FileAttrContext fileAttr() { FileAttrContext _localctx = new FileAttrContext(Context, State); - EnterRule(_localctx, 92, RULE_fileAttr); + EnterRule(_localctx, 94, RULE_fileAttr); try { EnterOuterAlt(_localctx, 1); { - State = 902; + State = 1019; Match(T__75); } + Context.Stop = TokenStream.LT(-1); + _localctx.Value = Actions.ParseFileAttribute(_localctx.Start); } catch (RecognitionException re) { _localctx.exception = re; @@ -3968,26 +4043,23 @@ public FileAttrContext fileAttr() { } public partial class FileEntryContext : ParserRuleContext { + public bool Value; + public IToken entry; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ENTRYPOINT() { return GetToken(CILParser.ENTRYPOINT, 0); } public FileEntryContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_fileEntry; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitFileEntry(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public FileEntryContext fileEntry() { FileEntryContext _localctx = new FileEntryContext(Context, State); - EnterRule(_localctx, 94, RULE_fileEntry); + EnterRule(_localctx, 96, RULE_fileEntry); + _localctx.Value = false; try { - State = 906; + State = 1024; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__15: @@ -4036,8 +4108,9 @@ public FileEntryContext fileEntry() { case ENTRYPOINT: EnterOuterAlt(_localctx, 2); { - State = 905; - Match(ENTRYPOINT); + State = 1022; + _localctx.entry = Match(ENTRYPOINT); + _localctx.Value = Actions.ParseFileEntry(_localctx.entry); } break; default: @@ -4056,28 +4129,24 @@ public FileEntryContext fileEntry() { } public partial class AsmAttrAnyContext : ParserRuleContext { + public System.Reflection.AssemblyFlags Value; + public System.Reflection.AssemblyFlags Mask; public AsmAttrAnyContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_asmAttrAny; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitAsmAttrAny(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public AsmAttrAnyContext asmAttrAny() { AsmAttrAnyContext _localctx = new AsmAttrAnyContext(Context, State); - EnterRule(_localctx, 96, RULE_asmAttrAny); + EnterRule(_localctx, 98, RULE_asmAttrAny); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 908; + State = 1026; _la = TokenStream.LA(1); if ( !(_la==T__1 || _la==T__60 || ((((_la - 77)) & ~0x3f) == 0 && ((1L << (_la - 77)) & 127L) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -4087,6 +4156,8 @@ public AsmAttrAnyContext asmAttrAny() { Consume(); } } + Context.Stop = TokenStream.LT(-1); + Actions.SetAssemblyAttribute(_localctx); } catch (RecognitionException re) { _localctx.exception = re; @@ -4100,6 +4171,8 @@ public AsmAttrAnyContext asmAttrAny() { } public partial class AsmAttrContext : ParserRuleContext { + public System.Reflection.AssemblyFlags Value; + public AsmAttrAnyContext attribute; [System.Diagnostics.DebuggerNonUserCode] public AsmAttrAnyContext[] asmAttrAny() { return GetRuleContexts(); } @@ -4111,33 +4184,32 @@ public AsmAttrContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_asmAttr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitAsmAttr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public AsmAttrContext asmAttr() { AsmAttrContext _localctx = new AsmAttrContext(Context, State); - EnterRule(_localctx, 98, RULE_asmAttr); + EnterRule(_localctx, 100, RULE_asmAttr); + _localctx.Value = 0; int _la; try { EnterOuterAlt(_localctx, 1); { - State = 913; + State = 1033; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==T__1 || _la==T__60 || ((((_la - 77)) & ~0x3f) == 0 && ((1L << (_la - 77)) & 127L) != 0)) { { { - State = 910; - asmAttrAny(); + State = 1028; + _localctx.attribute = asmAttrAny(); + _localctx.Value = Actions.AddAssemblyAttribute( + _localctx.Value, + _localctx.attribute.Value, + _localctx.attribute.Mask); } } - State = 915; + State = 1035; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -4154,67 +4226,122 @@ public AsmAttrContext asmAttr() { return _localctx; } - public partial class Instr_noneContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_NONE() { return GetToken(CILParser.INSTR_NONE, 0); } - public Instr_noneContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { + public partial class InstrContext : ParserRuleContext { + public IToken op; + public MethodRefContext methodOperand; + public FieldRefContext fieldOperand; + public MdtokenContext metadataOperand; + public TypeSpecContext typeOperand; + public CalliSignatureContext signatureOperand; + public OwnerTypeContext ownerOperand; + [System.Diagnostics.DebuggerNonUserCode] public SimpleInstrContext simpleInstr() { + return GetRuleContext(0); } - public override int RuleIndex { get { return RULE_instr_none; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr_none(this); - else return visitor.VisitChildren(this); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_METHOD() { return GetToken(CILParser.INSTR_METHOD, 0); } + [System.Diagnostics.DebuggerNonUserCode] public MethodRefContext methodRef() { + return GetRuleContext(0); } - } - - [RuleVersion(0)] - public Instr_noneContext instr_none() { - Instr_noneContext _localctx = new Instr_noneContext(Context, State); - EnterRule(_localctx, 100, RULE_instr_none); - try { - EnterOuterAlt(_localctx, 1); - { - State = 916; - Match(INSTR_NONE); - } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_FIELD() { return GetToken(CILParser.INSTR_FIELD, 0); } + [System.Diagnostics.DebuggerNonUserCode] public FieldRefContext fieldRef() { + return GetRuleContext(0); } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); + [System.Diagnostics.DebuggerNonUserCode] public MdtokenContext mdtoken() { + return GetRuleContext(0); } - finally { - ExitRule(); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_TYPE() { return GetToken(CILParser.INSTR_TYPE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { + return GetRuleContext(0); } - return _localctx; - } - - public partial class Instr_varContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_VAR() { return GetToken(CILParser.INSTR_VAR, 0); } - public Instr_varContext(ParserRuleContext parent, int invokingState) + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_SIG() { return GetToken(CILParser.INSTR_SIG, 0); } + [System.Diagnostics.DebuggerNonUserCode] public CalliSignatureContext calliSignature() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_TOK() { return GetToken(CILParser.INSTR_TOK, 0); } + [System.Diagnostics.DebuggerNonUserCode] public OwnerTypeContext ownerType() { + return GetRuleContext(0); + } + public InstrContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_instr_var; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr_var(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_instr; } } } [RuleVersion(0)] - public Instr_varContext instr_var() { - Instr_varContext _localctx = new Instr_varContext(Context, State); - EnterRule(_localctx, 102, RULE_instr_var); + public InstrContext instr() { + InstrContext _localctx = new InstrContext(Context, State); + EnterRule(_localctx, 102, RULE_instr); try { - EnterOuterAlt(_localctx, 1); - { - State = 918; - Match(INSTR_VAR); + State = 1061; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,38,Context) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 1036; + simpleInstr(); + } + break; + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 1037; + _localctx.op = Match(INSTR_METHOD); + State = 1038; + _localctx.methodOperand = methodRef(); + Actions.EmitMethodReferenceInstruction(_localctx.op, _localctx.methodOperand); + } + break; + case 3: + EnterOuterAlt(_localctx, 3); + { + State = 1041; + _localctx.op = Match(INSTR_FIELD); + State = 1042; + _localctx.fieldOperand = fieldRef(); + Actions.EmitFieldReferenceInstruction(_localctx.op, _localctx.fieldOperand); + } + break; + case 4: + EnterOuterAlt(_localctx, 4); + { + State = 1045; + _localctx.op = Match(INSTR_FIELD); + State = 1046; + _localctx.metadataOperand = mdtoken(); + Actions.EmitMetadataTokenInstruction(_localctx.op, _localctx.metadataOperand); + } + break; + case 5: + EnterOuterAlt(_localctx, 5); + { + State = 1049; + _localctx.op = Match(INSTR_TYPE); + State = 1050; + _localctx.typeOperand = typeSpec(); + Actions.EmitTypeReferenceInstruction(_localctx.op, _localctx.typeOperand); + } + break; + case 6: + EnterOuterAlt(_localctx, 6); + { + State = 1053; + _localctx.op = Match(INSTR_SIG); + State = 1054; + _localctx.signatureOperand = calliSignature(); + Actions.EmitCalliInstruction(_localctx.op, _localctx.signatureOperand); + } + break; + case 7: + EnterOuterAlt(_localctx, 7); + { + State = 1057; + _localctx.op = Match(INSTR_TOK); + State = 1058; + _localctx.ownerOperand = ownerType(); + Actions.EmitOwnerTokenInstruction(_localctx.op, _localctx.ownerOperand); + } + break; } } catch (RecognitionException re) { @@ -4228,68 +4355,271 @@ public Instr_varContext instr_var() { return _localctx; } - public partial class Instr_iContext : ParserRuleContext { + public partial class SimpleInstrContext : ParserRuleContext { + public CILParser.SwitchInstructionBuilder SwitchBuilder; + public IToken op; + public Int32Context index; + public IdContext name; + public Int32Context value32; + public Int64Context value64; + public Float64Context value; + public Int64Context integerValue; + public BytesContext rawFloat; + public Int32Context offset; + public IdContext label; + public CompQstringContext userString; + public CompQstringContext ansiString; + public BytesContext rawString; + public Int32Context rawToken; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_NONE() { return GetToken(CILParser.INSTR_NONE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_VAR() { return GetToken(CILParser.INSTR_VAR, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public IdContext id() { + return GetRuleContext(0); + } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_I() { return GetToken(CILParser.INSTR_I, 0); } - public Instr_iContext(ParserRuleContext parent, int invokingState) + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_I8() { return GetToken(CILParser.INSTR_I8, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Int64Context int64() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_R() { return GetToken(CILParser.INSTR_R, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Float64Context float64() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public BytesContext bytes() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_BRTARGET() { return GetToken(CILParser.INSTR_BRTARGET, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_STRING() { return GetToken(CILParser.INSTR_STRING, 0); } + [System.Diagnostics.DebuggerNonUserCode] public CompQstringContext compQstring() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ANSI() { return GetToken(CILParser.ANSI, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_TOK() { return GetToken(CILParser.INSTR_TOK, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_SWITCH() { return GetToken(CILParser.INSTR_SWITCH, 0); } + [System.Diagnostics.DebuggerNonUserCode] public LabelsContext labels() { + return GetRuleContext(0); + } + public SimpleInstrContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_instr_i; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr_i(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_simpleInstr; } } } [RuleVersion(0)] - public Instr_iContext instr_i() { - Instr_iContext _localctx = new Instr_iContext(Context, State); - EnterRule(_localctx, 104, RULE_instr_i); + public SimpleInstrContext simpleInstr() { + SimpleInstrContext _localctx = new SimpleInstrContext(Context, State); + EnterRule(_localctx, 104, RULE_simpleInstr); try { - EnterOuterAlt(_localctx, 1); - { - State = 920; - Match(INSTR_I); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class Instr_i8Context : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_I8() { return GetToken(CILParser.INSTR_I8, 0); } - public Instr_i8Context(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_instr_i8; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr_i8(this); - else return visitor.VisitChildren(this); - } - } - - [RuleVersion(0)] - public Instr_i8Context instr_i8() { - Instr_i8Context _localctx = new Instr_i8Context(Context, State); - EnterRule(_localctx, 106, RULE_instr_i8); - try { - EnterOuterAlt(_localctx, 1); - { - State = 922; - Match(INSTR_I8); + State = 1141; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,40,Context) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 1063; + _localctx.op = Match(INSTR_NONE); + Actions.EmitNoOperandInstruction(_localctx.op); + } + break; + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 1065; + _localctx.op = Match(INSTR_VAR); + State = 1066; + _localctx.index = int32(); + Actions.EmitVariableIndexInstruction(_localctx.op, (_localctx.index!=null?(_localctx.index.Start):null)); + } + break; + case 3: + EnterOuterAlt(_localctx, 3); + { + State = 1069; + _localctx.op = Match(INSTR_VAR); + State = 1070; + _localctx.name = id(); + Actions.EmitVariableNameInstruction(_localctx.op, (_localctx.name!=null?(_localctx.name.Start):null)); + } + break; + case 4: + EnterOuterAlt(_localctx, 4); + { + State = 1073; + _localctx.op = Match(INSTR_I); + State = 1074; + _localctx.value32 = int32(); + Actions.EmitInt32Instruction(_localctx.op, (_localctx.value32!=null?(_localctx.value32.Start):null)); + } + break; + case 5: + EnterOuterAlt(_localctx, 5); + { + State = 1077; + _localctx.op = Match(INSTR_I8); + State = 1078; + _localctx.value64 = int64(); + Actions.EmitInt64Instruction(_localctx.op, (_localctx.value64!=null?(_localctx.value64.Start):null)); + } + break; + case 6: + EnterOuterAlt(_localctx, 6); + { + State = 1081; + _localctx.op = Match(INSTR_R); + State = 1082; + _localctx.value = float64(); + Actions.EmitFloatingInstruction(_localctx.op, _localctx.value.Value); + } + break; + case 7: + EnterOuterAlt(_localctx, 7); + { + State = 1085; + _localctx.op = Match(INSTR_R); + State = 1086; + _localctx.integerValue = int64(); + Actions.EmitFloatingInstruction(_localctx.op, (_localctx.integerValue!=null?(_localctx.integerValue.Start):null)); + } + break; + case 8: + EnterOuterAlt(_localctx, 8); + { + State = 1089; + _localctx.op = Match(INSTR_R); + State = 1090; + Match(T__29); + State = 1091; + _localctx.rawFloat = bytes(); + State = 1092; + Match(T__30); + Actions.EmitRawFloatingInstruction(_localctx.op, _localctx.rawFloat.Value, (_localctx.rawFloat!=null?(_localctx.rawFloat.Start):null)); + } + break; + case 9: + EnterOuterAlt(_localctx, 9); + { + State = 1095; + _localctx.op = Match(INSTR_R); + State = 1096; + Match(T__83); + State = 1097; + Match(T__29); + State = 1098; + _localctx.rawFloat = bytes(); + State = 1099; + Match(T__30); + Actions.EmitRawFloatingInstruction(_localctx.op, _localctx.rawFloat.Value, (_localctx.rawFloat!=null?(_localctx.rawFloat.Start):null)); + } + break; + case 10: + EnterOuterAlt(_localctx, 10); + { + State = 1102; + _localctx.op = Match(INSTR_BRTARGET); + State = 1103; + _localctx.offset = int32(); + Actions.EmitBranchOffsetInstruction(_localctx.op, (_localctx.offset!=null?(_localctx.offset.Start):null)); + } + break; + case 11: + EnterOuterAlt(_localctx, 11); + { + State = 1106; + _localctx.op = Match(INSTR_BRTARGET); + State = 1107; + _localctx.label = id(); + Actions.EmitBranchLabelInstruction(_localctx.op, (_localctx.label!=null?(_localctx.label.Start):null)); + } + break; + case 12: + EnterOuterAlt(_localctx, 12); + { + State = 1110; + _localctx.op = Match(INSTR_STRING); + State = 1111; + _localctx.userString = compQstring(); + Actions.EmitStringInstruction(_localctx.op, _localctx.userString.Value); + } + break; + case 13: + EnterOuterAlt(_localctx, 13); + { + State = 1114; + _localctx.op = Match(INSTR_STRING); + State = 1115; + Match(ANSI); + State = 1116; + Match(T__29); + State = 1117; + _localctx.ansiString = compQstring(); + State = 1118; + Match(T__30); + Actions.EmitAnsiStringInstruction(_localctx.op, _localctx.ansiString.Value); + } + break; + case 14: + EnterOuterAlt(_localctx, 14); + { + State = 1121; + _localctx.op = Match(INSTR_STRING); + State = 1122; + Match(T__83); + State = 1123; + Match(T__29); + State = 1124; + _localctx.rawString = bytes(); + State = 1125; + Match(T__30); + Actions.EmitRawStringInstruction(_localctx.op, _localctx.rawString.Value); + } + break; + case 15: + EnterOuterAlt(_localctx, 15); + { + State = 1128; + _localctx.op = Match(INSTR_TOK); + State = 1129; + _localctx.rawToken = int32(); + Actions.EmitRawTokenInstruction(_localctx.op, (_localctx.rawToken!=null?(_localctx.rawToken.Start):null)); + } + break; + case 16: + EnterOuterAlt(_localctx, 16); + { + State = 1132; + _localctx.op = Match(INSTR_SWITCH); + _localctx.SwitchBuilder = Actions.CreateSwitchInstruction(_localctx.op); + State = 1139; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case T__29: + { + State = 1134; + Match(T__29); + State = 1135; + labels(_localctx.SwitchBuilder); + State = 1136; + Match(T__30); + } + break; + case T__84: + { + State = 1138; + Match(T__84); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; } + Context.Stop = TokenStream.LT(-1); + Actions.CompleteSwitchInstruction(_localctx.SwitchBuilder); } catch (RecognitionException re) { _localctx.exception = re; @@ -4302,104 +4632,47 @@ public Instr_i8Context instr_i8() { return _localctx; } - public partial class Instr_rContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_R() { return GetToken(CILParser.INSTR_R, 0); } - public Instr_rContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_instr_r; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr_r(this); - else return visitor.VisitChildren(this); - } - } - - [RuleVersion(0)] - public Instr_rContext instr_r() { - Instr_rContext _localctx = new Instr_rContext(Context, State); - EnterRule(_localctx, 108, RULE_instr_r); - try { - EnterOuterAlt(_localctx, 1); - { - State = 924; - Match(INSTR_R); - } + public partial class CalliSignatureContext : ParserRuleContext { + public CILParser.CalliSignatureValue Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public CallConvContext convention; + public TypeContext returnType; + public SigArgsContext arguments; + [System.Diagnostics.DebuggerNonUserCode] public CallConvContext callConv() { + return GetRuleContext(0); } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); + [System.Diagnostics.DebuggerNonUserCode] public TypeContext type() { + return GetRuleContext(0); } - finally { - ExitRule(); + [System.Diagnostics.DebuggerNonUserCode] public SigArgsContext sigArgs() { + return GetRuleContext(0); } - return _localctx; - } - - public partial class Instr_brtargetContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_BRTARGET() { return GetToken(CILParser.INSTR_BRTARGET, 0); } - public Instr_brtargetContext(ParserRuleContext parent, int invokingState) + public CalliSignatureContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_instr_brtarget; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr_brtarget(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_calliSignature; } } } [RuleVersion(0)] - public Instr_brtargetContext instr_brtarget() { - Instr_brtargetContext _localctx = new Instr_brtargetContext(Context, State); - EnterRule(_localctx, 110, RULE_instr_brtarget); - try { - EnterOuterAlt(_localctx, 1); - { - State = 926; - Match(INSTR_BRTARGET); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } + public CalliSignatureContext calliSignature() { + CalliSignatureContext _localctx = new CalliSignatureContext(Context, State); + EnterRule(_localctx, 106, RULE_calliSignature); - public partial class Instr_methodContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_METHOD() { return GetToken(CILParser.INSTR_METHOD, 0); } - public Instr_methodContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_instr_method; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr_method(this); - else return visitor.VisitChildren(this); - } - } + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.CalliSignatureValue.Error; - [RuleVersion(0)] - public Instr_methodContext instr_method() { - Instr_methodContext _localctx = new Instr_methodContext(Context, State); - EnterRule(_localctx, 112, RULE_instr_method); try { EnterOuterAlt(_localctx, 1); { - State = 928; - Match(INSTR_METHOD); + State = 1143; + _localctx.convention = callConv(); + State = 1144; + _localctx.returnType = type(); + State = 1145; + _localctx.arguments = sigArgs(); + _localctx.Value = Actions.CreateCalliSignature(_localctx.convention.Value, _localctx.returnType.Value, _localctx.arguments.Value); } } catch (RecognitionException re) { @@ -4408,114 +4681,180 @@ public Instr_methodContext instr_method() { ErrorHandler.Recover(this, re); } finally { - ExitRule(); - } - return _localctx; - } - public partial class Instr_fieldContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_FIELD() { return GetToken(CILParser.INSTR_FIELD, 0); } - public Instr_fieldContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_instr_field; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr_field(this); - else return visitor.VisitChildren(this); - } - } + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; - [RuleVersion(0)] - public Instr_fieldContext instr_field() { - Instr_fieldContext _localctx = new Instr_fieldContext(Context, State); - EnterRule(_localctx, 114, RULE_instr_field); - try { - EnterOuterAlt(_localctx, 1); - { - State = 930; - Match(INSTR_FIELD); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { ExitRule(); } return _localctx; } - public partial class Instr_typeContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_TYPE() { return GetToken(CILParser.INSTR_TYPE, 0); } - public Instr_typeContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_instr_type; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr_type(this); - else return visitor.VisitChildren(this); + public partial class LabelsContext : ParserRuleContext { + public CILParser.SwitchInstructionBuilder Builder; + public IdContext headLabel; + public Int32Context headOffset; + public IdContext tailLabel; + public Int32Context tailOffset; + [System.Diagnostics.DebuggerNonUserCode] public IdContext[] id() { + return GetRuleContexts(); } - } - - [RuleVersion(0)] - public Instr_typeContext instr_type() { - Instr_typeContext _localctx = new Instr_typeContext(Context, State); - EnterRule(_localctx, 116, RULE_instr_type); - try { - EnterOuterAlt(_localctx, 1); - { - State = 932; - Match(INSTR_TYPE); - } + [System.Diagnostics.DebuggerNonUserCode] public IdContext id(int i) { + return GetRuleContext(i); } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); + [System.Diagnostics.DebuggerNonUserCode] public Int32Context[] int32() { + return GetRuleContexts(); } - finally { - ExitRule(); + [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32(int i) { + return GetRuleContext(i); } - return _localctx; - } - - public partial class Instr_stringContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_STRING() { return GetToken(CILParser.INSTR_STRING, 0); } - public Instr_stringContext(ParserRuleContext parent, int invokingState) + public LabelsContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } + public LabelsContext(ParserRuleContext parent, int invokingState, CILParser.SwitchInstructionBuilder Builder) : base(parent, invokingState) { + this.Builder = Builder; } - public override int RuleIndex { get { return RULE_instr_string; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr_string(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_labels; } } } [RuleVersion(0)] - public Instr_stringContext instr_string() { - Instr_stringContext _localctx = new Instr_stringContext(Context, State); - EnterRule(_localctx, 118, RULE_instr_string); + public LabelsContext labels(CILParser.SwitchInstructionBuilder Builder) { + LabelsContext _localctx = new LabelsContext(Context, State, Builder); + EnterRule(_localctx, 108, RULE_labels); try { - EnterOuterAlt(_localctx, 1); - { - State = 934; - Match(INSTR_STRING); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); + int _alt; + State = 1172; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case T__30: + EnterOuterAlt(_localctx, 1); + { + } + break; + case T__0: + case T__1: + case T__2: + case T__3: + case T__4: + case T__5: + case T__6: + case T__7: + case T__8: + case T__9: + case T__10: + case T__11: + case T__12: + case T__13: + case T__14: + case INT32: + case INSTANCE: + case UNMANAGED: + case SQSTRING: + case ID: + EnterOuterAlt(_localctx, 2); + { + State = 1161; + ErrorHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(TokenStream,42,Context); + while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + State = 1155; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case T__0: + case T__1: + case T__2: + case T__3: + case T__4: + case T__5: + case T__6: + case T__7: + case T__8: + case T__9: + case T__10: + case T__11: + case T__12: + case T__13: + case T__14: + case INSTANCE: + case UNMANAGED: + case SQSTRING: + case ID: + { + State = 1149; + _localctx.headLabel = id(); + Actions.AddSwitchLabel(_localctx.Builder, (_localctx.headLabel!=null?(_localctx.headLabel.Start):null)); + } + break; + case INT32: + { + State = 1152; + _localctx.headOffset = int32(); + Actions.AddSwitchOffset(_localctx.Builder, (_localctx.headOffset!=null?(_localctx.headOffset.Start):null)); + } + break; + default: + throw new NoViableAltException(this); + } + State = 1157; + Match(T__27); + } + } + } + State = 1163; + ErrorHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(TokenStream,42,Context); + } + State = 1170; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case T__0: + case T__1: + case T__2: + case T__3: + case T__4: + case T__5: + case T__6: + case T__7: + case T__8: + case T__9: + case T__10: + case T__11: + case T__12: + case T__13: + case T__14: + case INSTANCE: + case UNMANAGED: + case SQSTRING: + case ID: + { + State = 1164; + _localctx.tailLabel = id(); + Actions.AddSwitchLabel(_localctx.Builder, (_localctx.tailLabel!=null?(_localctx.tailLabel.Start):null)); + } + break; + case INT32: + { + State = 1167; + _localctx.tailOffset = int32(); + Actions.AddSwitchOffset(_localctx.Builder, (_localctx.tailOffset!=null?(_localctx.tailOffset.Start):null)); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { @@ -4524,30 +4863,59 @@ public Instr_stringContext instr_string() { return _localctx; } - public partial class Instr_sigContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_SIG() { return GetToken(CILParser.INSTR_SIG, 0); } - public Instr_sigContext(ParserRuleContext parent, int invokingState) + public partial class TypeArgsContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public TypeContext argument; + public TypeContext lastArgument; + [System.Diagnostics.DebuggerNonUserCode] public TypeContext[] type() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public TypeContext type(int i) { + return GetRuleContext(i); + } + public TypeArgsContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_instr_sig; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr_sig(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_typeArgs; } } } [RuleVersion(0)] - public Instr_sigContext instr_sig() { - Instr_sigContext _localctx = new Instr_sigContext(Context, State); - EnterRule(_localctx, 120, RULE_instr_sig); + public TypeArgsContext typeArgs() { + TypeArgsContext _localctx = new TypeArgsContext(Context, State); + EnterRule(_localctx, 110, RULE_typeArgs); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); try { + int _alt; EnterOuterAlt(_localctx, 1); { - State = 936; - Match(INSTR_SIG); + State = 1174; + Match(T__85); + State = 1181; + ErrorHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(TokenStream,45,Context); + while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + State = 1175; + _localctx.argument = type(); + _localctx.Builder.Add(_localctx.argument.Value); + State = 1177; + Match(T__27); + } + } + } + State = 1183; + ErrorHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(TokenStream,45,Context); + } + State = 1184; + _localctx.lastArgument = type(); + _localctx.Builder.Add(_localctx.lastArgument.Value); + State = 1186; + Match(T__86); } } catch (RecognitionException re) { @@ -4556,35 +4924,65 @@ public Instr_sigContext instr_sig() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } - public partial class Instr_tokContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_TOK() { return GetToken(CILParser.INSTR_TOK, 0); } - public Instr_tokContext(ParserRuleContext parent, int invokingState) + public partial class BoundsContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public BoundContext item; + public BoundContext lastItem; + [System.Diagnostics.DebuggerNonUserCode] public BoundContext[] bound() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public BoundContext bound(int i) { + return GetRuleContext(i); + } + public BoundsContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_instr_tok; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr_tok(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_bounds; } } } [RuleVersion(0)] - public Instr_tokContext instr_tok() { - Instr_tokContext _localctx = new Instr_tokContext(Context, State); - EnterRule(_localctx, 122, RULE_instr_tok); + public BoundsContext bounds() { + BoundsContext _localctx = new BoundsContext(Context, State); + EnterRule(_localctx, 112, RULE_bounds); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); try { + int _alt; EnterOuterAlt(_localctx, 1); { - State = 938; - Match(INSTR_TOK); + State = 1188; + Match(T__41); + State = 1195; + ErrorHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(TokenStream,46,Context); + while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + State = 1189; + _localctx.item = bound(); + _localctx.Builder.Add(Actions.CreateArrayBound(_localctx.item)); + State = 1191; + Match(T__27); + } + } + } + State = 1197; + ErrorHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(TokenStream,46,Context); + } + State = 1198; + _localctx.lastItem = bound(); + _localctx.Builder.Add(Actions.CreateArrayBound(_localctx.lastItem)); + State = 1200; + Match(T__42); } } catch (RecognitionException re) { @@ -4593,35 +4991,80 @@ public Instr_tokContext instr_tok() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } - public partial class Instr_switchContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTR_SWITCH() { return GetToken(CILParser.INSTR_SWITCH, 0); } - public Instr_switchContext(ParserRuleContext parent, int invokingState) + public partial class SigArgsContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public SigArgContext argument; + public SigArgContext lastArgument; + [System.Diagnostics.DebuggerNonUserCode] public SigArgContext[] sigArg() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public SigArgContext sigArg(int i) { + return GetRuleContext(i); + } + public SigArgsContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_instr_switch; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr_switch(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_sigArgs; } } } [RuleVersion(0)] - public Instr_switchContext instr_switch() { - Instr_switchContext _localctx = new Instr_switchContext(Context, State); - EnterRule(_localctx, 124, RULE_instr_switch); + public SigArgsContext sigArgs() { + SigArgsContext _localctx = new SigArgsContext(Context, State); + EnterRule(_localctx, 114, RULE_sigArgs); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); try { - EnterOuterAlt(_localctx, 1); - { - State = 940; - Match(INSTR_SWITCH); + int _alt; + State = 1217; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case T__29: + EnterOuterAlt(_localctx, 1); + { + State = 1202; + Match(T__29); + State = 1209; + ErrorHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(TokenStream,47,Context); + while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + State = 1203; + _localctx.argument = sigArg(); + _localctx.Builder.Add(_localctx.argument.Value); + State = 1205; + Match(T__27); + } + } + } + State = 1211; + ErrorHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(TokenStream,47,Context); + } + State = 1212; + _localctx.lastArgument = sigArg(); + _localctx.Builder.Add(_localctx.lastArgument.Value); + State = 1214; + Match(T__30); + } + break; + case T__84: + EnterOuterAlt(_localctx, 2); + { + State = 1216; + Match(T__84); + } + break; + default: + throw new NoViableAltException(this); } } catch (RecognitionException re) { @@ -4630,351 +5073,224 @@ public Instr_switchContext instr_switch() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } - public partial class InstrContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public Instr_noneContext instr_none() { - return GetRuleContext(0); + public partial class SigArgContext : ParserRuleContext { + public CILParser.SignatureArgumentValue Value; + public ParamAttrContext attributes; + public TypeContext argumentType; + public MarshalClauseContext marshalling; + public IdContext name; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ELLIPSIS() { return GetToken(CILParser.ELLIPSIS, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ParamAttrContext paramAttr() { + return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public Instr_varContext instr_var() { - return GetRuleContext(0); + [System.Diagnostics.DebuggerNonUserCode] public TypeContext type() { + return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { - return GetRuleContext(0); + [System.Diagnostics.DebuggerNonUserCode] public MarshalClauseContext marshalClause() { + return GetRuleContext(0); } [System.Diagnostics.DebuggerNonUserCode] public IdContext id() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public Instr_iContext instr_i() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public Instr_i8Context instr_i8() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public Int64Context int64() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public Instr_rContext instr_r() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public Float64Context float64() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public BytesContext bytes() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public Instr_brtargetContext instr_brtarget() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public Instr_methodContext instr_method() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public MethodRefContext methodRef() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public Instr_fieldContext instr_field() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public FieldRefContext fieldRef() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public MdtokenContext mdtoken() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public Instr_typeContext instr_type() { - return GetRuleContext(0); + public SigArgContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { } - [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public Instr_stringContext instr_string() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public CompQstringContext compQstring() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ANSI() { return GetToken(CILParser.ANSI, 0); } - [System.Diagnostics.DebuggerNonUserCode] public Instr_sigContext instr_sig() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public CallConvContext callConv() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public TypeContext type() { - return GetRuleContext(0); + public override int RuleIndex { get { return RULE_sigArg; } } + } + + [RuleVersion(0)] + public SigArgContext sigArg() { + SigArgContext _localctx = new SigArgContext(Context, State); + EnterRule(_localctx, 116, RULE_sigArg); + _localctx.Value = CILParser.SignatureArgumentValue.Error; + int _la; + try { + State = 1229; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,50,Context) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + State = 1219; + Match(ELLIPSIS); + _localctx.Value = Actions.CreateSentinelSignatureArgument(); + } + break; + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 1221; + _localctx.attributes = paramAttr(); + State = 1222; + _localctx.argumentType = type(); + State = 1223; + _localctx.marshalling = marshalClause(); + State = 1225; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 65534L) != 0) || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 70368746274833L) != 0)) { + { + State = 1224; + _localctx.name = id(); + } + } + + _localctx.Value = Actions.CreateSignatureArgument(_localctx.attributes.Value, _localctx.argumentType.Value, _localctx.marshalling.Value, _localctx.name); + } + break; + } } - [System.Diagnostics.DebuggerNonUserCode] public SigArgsContext sigArgs() { - return GetRuleContext(0); + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); } - [System.Diagnostics.DebuggerNonUserCode] public Instr_tokContext instr_tok() { - return GetRuleContext(0); + finally { + ExitRule(); } - [System.Diagnostics.DebuggerNonUserCode] public OwnerTypeContext ownerType() { - return GetRuleContext(0); + return _localctx; + } + + public partial class ClassNameContext : ParserRuleContext { + public CILParser.ClassNameValue Value; + public DottedNameContext assemblyName; + public SlashedNameContext typeName; + public MdtokenContext scopeToken; + public DottedNameContext moduleName; + public MdtokenContext typeToken; + [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { + return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public Instr_switchContext instr_switch() { - return GetRuleContext(0); + [System.Diagnostics.DebuggerNonUserCode] public SlashedNameContext slashedName() { + return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public LabelsContext labels() { - return GetRuleContext(0); + [System.Diagnostics.DebuggerNonUserCode] public MdtokenContext mdtoken() { + return GetRuleContext(0); } - public InstrContext(ParserRuleContext parent, int invokingState) + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PTR() { return GetToken(CILParser.PTR, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode MODULE() { return GetToken(CILParser.MODULE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode THIS() { return GetToken(CILParser.THIS, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BASE() { return GetToken(CILParser.BASE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NESTER() { return GetToken(CILParser.NESTER, 0); } + public ClassNameContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_instr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInstr(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_className; } } } [RuleVersion(0)] - public InstrContext instr() { - InstrContext _localctx = new InstrContext(Context, State); - EnterRule(_localctx, 126, RULE_instr); + public ClassNameContext className() { + ClassNameContext _localctx = new ClassNameContext(Context, State); + EnterRule(_localctx, 118, RULE_className); + _localctx.Value = CILParser.ClassNameValue.Error; try { - State = 1024; + State = 1268; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,35,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,51,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 942; - instr_none(); + State = 1231; + Match(T__41); + State = 1232; + _localctx.assemblyName = dottedName(); + State = 1233; + Match(T__42); + State = 1234; + _localctx.typeName = slashedName(); + _localctx.Value = Actions.CreateAssemblyQualifiedClassName(_localctx.assemblyName.Value, _localctx.typeName.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 943; - instr_var(); - State = 944; - int32(); + State = 1237; + Match(T__41); + State = 1238; + _localctx.scopeToken = mdtoken(); + State = 1239; + Match(T__42); + State = 1240; + _localctx.typeName = slashedName(); + _localctx.Value = Actions.CreateTokenQualifiedClassName(_localctx.scopeToken.Value, _localctx.typeName.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 946; - instr_var(); - State = 947; - id(); + State = 1243; + Match(T__41); + State = 1244; + Match(PTR); + State = 1245; + Match(T__42); + State = 1246; + _localctx.typeName = slashedName(); + _localctx.Value = Actions.CreatePointerQualifiedClassName(_localctx.typeName.Value); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 949; - instr_i(); - State = 950; - int32(); + State = 1249; + Match(T__41); + State = 1250; + Match(MODULE); + State = 1251; + _localctx.moduleName = dottedName(); + State = 1252; + Match(T__42); + State = 1253; + _localctx.typeName = slashedName(); + _localctx.Value = Actions.CreateModuleQualifiedClassName(_localctx.Start, _localctx.moduleName.Value, _localctx.typeName.Value); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 952; - instr_i8(); - State = 953; - int64(); + State = 1256; + _localctx.typeName = slashedName(); + _localctx.Value = Actions.CreateUnqualifiedClassName(_localctx.typeName.Value); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 955; - instr_r(); - State = 956; - float64(); + State = 1259; + _localctx.typeToken = mdtoken(); + _localctx.Value = Actions.CreateTokenClassName(_localctx.typeToken.Value); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 958; - instr_r(); - State = 959; - int64(); + State = 1262; + Match(THIS); + _localctx.Value = Actions.CreateThisClassName(_localctx.Start); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 961; - instr_r(); - State = 962; - Match(T__29); - State = 963; - bytes(); - State = 964; - Match(T__30); + State = 1264; + Match(BASE); + _localctx.Value = Actions.CreateBaseClassName(_localctx.Start); } break; case 9: EnterOuterAlt(_localctx, 9); { - State = 966; - instr_r(); - State = 967; - Match(T__83); - State = 968; - Match(T__29); - State = 969; - bytes(); - State = 970; - Match(T__30); - } - break; - case 10: - EnterOuterAlt(_localctx, 10); - { - State = 972; - instr_brtarget(); - State = 973; - int32(); - } - break; - case 11: - EnterOuterAlt(_localctx, 11); - { - State = 975; - instr_brtarget(); - State = 976; - id(); - } - break; - case 12: - EnterOuterAlt(_localctx, 12); - { - State = 978; - instr_method(); - State = 979; - methodRef(); - } - break; - case 13: - EnterOuterAlt(_localctx, 13); - { - State = 981; - instr_field(); - State = 982; - fieldRef(); - } - break; - case 14: - EnterOuterAlt(_localctx, 14); - { - State = 984; - instr_field(); - State = 985; - mdtoken(); - } - break; - case 15: - EnterOuterAlt(_localctx, 15); - { - State = 987; - instr_type(); - State = 988; - typeSpec(); - } - break; - case 16: - EnterOuterAlt(_localctx, 16); - { - State = 990; - instr_string(); - State = 991; - compQstring(); - } - break; - case 17: - EnterOuterAlt(_localctx, 17); - { - State = 993; - instr_string(); - State = 994; - Match(ANSI); - State = 995; - Match(T__29); - State = 996; - compQstring(); - State = 997; - Match(T__30); - } - break; - case 18: - EnterOuterAlt(_localctx, 18); - { - State = 999; - instr_string(); - State = 1000; - Match(T__83); - State = 1001; - Match(T__29); - State = 1002; - bytes(); - State = 1003; - Match(T__30); - } - break; - case 19: - EnterOuterAlt(_localctx, 19); - { - State = 1005; - instr_sig(); - State = 1006; - callConv(); - State = 1007; - type(); - State = 1008; - sigArgs(); - } - break; - case 20: - EnterOuterAlt(_localctx, 20); - { - State = 1010; - instr_tok(); - State = 1011; - ownerType(); - } - break; - case 21: - EnterOuterAlt(_localctx, 21); - { - State = 1013; - instr_tok(); - State = 1014; - int32(); - } - break; - case 22: - EnterOuterAlt(_localctx, 22); - { - State = 1016; - instr_switch(); - State = 1017; - Match(T__29); - State = 1018; - labels(); - State = 1019; - Match(T__30); - } - break; - case 23: - EnterOuterAlt(_localctx, 23); - { - State = 1021; - instr_switch(); - State = 1022; - Match(T__84); + State = 1266; + Match(NESTER); + _localctx.Value = Actions.CreateNesterClassName(_localctx.Start); } break; } @@ -4990,225 +5306,54 @@ public InstrContext instr() { return _localctx; } - public partial class LabelsContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public IdContext[] id() { - return GetRuleContexts(); - } - [System.Diagnostics.DebuggerNonUserCode] public IdContext id(int i) { - return GetRuleContext(i); - } - [System.Diagnostics.DebuggerNonUserCode] public Int32Context[] int32() { - return GetRuleContexts(); + public partial class SlashedNameContext : ParserRuleContext { + public CILParser.TypeName Value; + public CILParser.TypeName CurrentName; + public DottedNameContext part; + public DottedNameContext lastPart; + [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext[] dottedName() { + return GetRuleContexts(); } - [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32(int i) { - return GetRuleContext(i); + [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName(int i) { + return GetRuleContext(i); } - public LabelsContext(ParserRuleContext parent, int invokingState) + public SlashedNameContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_labels; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitLabels(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_slashedName; } } } [RuleVersion(0)] - public LabelsContext labels() { - LabelsContext _localctx = new LabelsContext(Context, State); - EnterRule(_localctx, 128, RULE_labels); + public SlashedNameContext slashedName() { + SlashedNameContext _localctx = new SlashedNameContext(Context, State); + EnterRule(_localctx, 120, RULE_slashedName); try { int _alt; - State = 1042; + EnterOuterAlt(_localctx, 1); + { + State = 1276; ErrorHandler.Sync(this); - switch (TokenStream.LA(1)) { - case T__30: - EnterOuterAlt(_localctx, 1); - { - } - break; - case T__0: - case T__1: - case T__2: - case T__3: - case T__4: - case T__5: - case T__6: - case T__7: - case T__8: - case T__9: - case T__10: - case T__11: - case T__12: - case T__13: - case T__14: - case INT32: - case INSTANCE: - case UNMANAGED: - case SQSTRING: - case ID: - EnterOuterAlt(_localctx, 2); - { - State = 1035; - ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,37,Context); - while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - State = 1029; - ErrorHandler.Sync(this); - switch (TokenStream.LA(1)) { - case T__0: - case T__1: - case T__2: - case T__3: - case T__4: - case T__5: - case T__6: - case T__7: - case T__8: - case T__9: - case T__10: - case T__11: - case T__12: - case T__13: - case T__14: - case INSTANCE: - case UNMANAGED: - case SQSTRING: - case ID: - { - State = 1027; - id(); - } - break; - case INT32: - { - State = 1028; - int32(); - } - break; - default: - throw new NoViableAltException(this); - } - State = 1031; - Match(T__27); - } - } - } - State = 1037; - ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,37,Context); - } - State = 1040; - ErrorHandler.Sync(this); - switch (TokenStream.LA(1)) { - case T__0: - case T__1: - case T__2: - case T__3: - case T__4: - case T__5: - case T__6: - case T__7: - case T__8: - case T__9: - case T__10: - case T__11: - case T__12: - case T__13: - case T__14: - case INSTANCE: - case UNMANAGED: - case SQSTRING: - case ID: - { - State = 1038; - id(); - } - break; - case INT32: - { - State = 1039; - int32(); - } - break; - default: - throw new NoViableAltException(this); - } - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class TypeArgsContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public TypeContext[] type() { - return GetRuleContexts(); - } - [System.Diagnostics.DebuggerNonUserCode] public TypeContext type(int i) { - return GetRuleContext(i); - } - public TypeArgsContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_typeArgs; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTypeArgs(this); - else return visitor.VisitChildren(this); - } - } - - [RuleVersion(0)] - public TypeArgsContext typeArgs() { - TypeArgsContext _localctx = new TypeArgsContext(Context, State); - EnterRule(_localctx, 130, RULE_typeArgs); - try { - int _alt; - EnterOuterAlt(_localctx, 1); - { - State = 1044; - Match(T__85); - State = 1050; - ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,40,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,52,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 1045; - type(); - State = 1046; - Match(T__27); - } + State = 1270; + _localctx.part = dottedName(); + _localctx.CurrentName = Actions.AddSlashedNamePart(_localctx.CurrentName, _localctx.part.Value); + State = 1272; + Match(T__87); } + } } - State = 1052; + State = 1278; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,40,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,52,Context); } - State = 1053; - type(); - State = 1054; - Match(T__86); + State = 1279; + _localctx.lastPart = dottedName(); + _localctx.CurrentName = Actions.AddSlashedNamePart(_localctx.CurrentName, _localctx.lastPart.Value); } } catch (RecognitionException re) { @@ -5217,63 +5362,53 @@ public TypeArgsContext typeArgs() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.CurrentName ?? new CILParser.TypeName(null, string.Empty); ExitRule(); } return _localctx; } - public partial class BoundsContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public BoundContext[] bound() { - return GetRuleContexts(); + public partial class AssemblyDeclsContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public AssemblyDeclContext declaration; + [System.Diagnostics.DebuggerNonUserCode] public AssemblyDeclContext[] assemblyDecl() { + return GetRuleContexts(); } - [System.Diagnostics.DebuggerNonUserCode] public BoundContext bound(int i) { - return GetRuleContext(i); + [System.Diagnostics.DebuggerNonUserCode] public AssemblyDeclContext assemblyDecl(int i) { + return GetRuleContext(i); } - public BoundsContext(ParserRuleContext parent, int invokingState) + public AssemblyDeclsContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_bounds; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitBounds(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_assemblyDecls; } } } [RuleVersion(0)] - public BoundsContext bounds() { - BoundsContext _localctx = new BoundsContext(Context, State); - EnterRule(_localctx, 132, RULE_bounds); + public AssemblyDeclsContext assemblyDecls() { + AssemblyDeclsContext _localctx = new AssemblyDeclsContext(Context, State); + EnterRule(_localctx, 122, RULE_assemblyDecls); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); + int _la; try { - int _alt; EnterOuterAlt(_localctx, 1); { - State = 1056; - Match(T__41); - State = 1062; + State = 1287; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,41,Context); - while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - State = 1057; - bound(); - State = 1058; - Match(T__27); - } - } + _la = TokenStream.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 38654771200L) != 0) || ((((_la - 167)) & ~0x3f) == 0 && ((1L << (_la - 167)) & 4103L) != 0) || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 6860954690125825L) != 0)) { + { + { + State = 1282; + _localctx.declaration = assemblyDecl(); + if (_localctx.declaration.Value is not null) _localctx.Builder.Add(_localctx.declaration.Value); } - State = 1064; + } + State = 1289; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,41,Context); + _la = TokenStream.LA(1); } - State = 1065; - bound(); - State = 1066; - Match(T__42); } } catch (RecognitionException re) { @@ -5282,74 +5417,87 @@ public BoundsContext bounds() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } - public partial class SigArgsContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public SigArgContext[] sigArg() { - return GetRuleContexts(); + public partial class AssemblyDeclContext : ParserRuleContext { + public CILParser.AssemblyDeclarationValue? Value; + public Int32Context algorithm; + public SecDeclContext security; + public AsmOrRefDeclContext shared; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode HASH() { return GetToken(CILParser.HASH, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { + return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public SigArgContext sigArg(int i) { - return GetRuleContext(i); + [System.Diagnostics.DebuggerNonUserCode] public SecDeclContext secDecl() { + return GetRuleContext(0); } - public SigArgsContext(ParserRuleContext parent, int invokingState) + [System.Diagnostics.DebuggerNonUserCode] public AsmOrRefDeclContext asmOrRefDecl() { + return GetRuleContext(0); + } + public AssemblyDeclContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_sigArgs; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSigArgs(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_assemblyDecl; } } } [RuleVersion(0)] - public SigArgsContext sigArgs() { - SigArgsContext _localctx = new SigArgsContext(Context, State); - EnterRule(_localctx, 134, RULE_sigArgs); + public AssemblyDeclContext assemblyDecl() { + AssemblyDeclContext _localctx = new AssemblyDeclContext(Context, State); + EnterRule(_localctx, 124, RULE_assemblyDecl); try { - int _alt; - State = 1081; + State = 1301; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { - case T__29: + case HASH: EnterOuterAlt(_localctx, 1); { - State = 1068; - Match(T__29); - State = 1074; - ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,42,Context); - while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - State = 1069; - sigArg(); - State = 1070; - Match(T__27); - } - } - } - State = 1076; - ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,42,Context); - } - State = 1077; - sigArg(); - State = 1078; - Match(T__30); + State = 1290; + Match(HASH); + State = 1291; + Match(T__88); + State = 1292; + _localctx.algorithm = int32(); + _localctx.Value = Actions.CreateAssemblyHashAlgorithmDeclaration((_localctx.algorithm!=null?(_localctx.algorithm.Start):null)); } break; - case T__84: + case PERMISSION: + case PERMISSIONSET: EnterOuterAlt(_localctx, 2); { - State = 1080; - Match(T__84); + State = 1295; + _localctx.security = secDecl(); + _localctx.Value = Actions.CreateAssemblySecurityDeclaration( + _localctx.security.Value, + (_localctx.security!=null?(_localctx.security.Start):null)); + } + break; + case T__15: + case T__31: + case T__34: + case T__166: + case T__167: + case T__168: + case INSTANCE: + case SQSTRING: + case PP_DEFINE: + case PP_UNDEF: + case PP_IFDEF: + case PP_IFNDEF: + case PP_ELSE: + case PP_ENDIF: + case PP_INCLUDE: + case DOTTEDNAME: + case ID: + EnterOuterAlt(_localctx, 3); + { + State = 1298; + _localctx.shared = asmOrRefDecl(); + _localctx.Value = _localctx.shared.Value; } break; default: @@ -5367,68 +5515,51 @@ public SigArgsContext sigArgs() { return _localctx; } - public partial class SigArgContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ELLIPSIS() { return GetToken(CILParser.ELLIPSIS, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ParamAttrContext paramAttr() { - return GetRuleContext(0); + public partial class TypeSpecContext : ParserRuleContext { + public CILParser.TypeSpecificationValue Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public ClassNameContext classType; + public TypeContext signatureType; + [System.Diagnostics.DebuggerNonUserCode] public ClassNameContext className() { + return GetRuleContext(0); } [System.Diagnostics.DebuggerNonUserCode] public TypeContext type() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public MarshalClauseContext marshalClause() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public IdContext id() { - return GetRuleContext(0); - } - public SigArgContext(ParserRuleContext parent, int invokingState) + public TypeSpecContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_sigArg; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSigArg(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_typeSpec; } } } [RuleVersion(0)] - public SigArgContext sigArg() { - SigArgContext _localctx = new SigArgContext(Context, State); - EnterRule(_localctx, 136, RULE_sigArg); - int _la; + public TypeSpecContext typeSpec() { + TypeSpecContext _localctx = new TypeSpecContext(Context, State); + EnterRule(_localctx, 126, RULE_typeSpec); + + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.TypeSpecificationValue.Error; + try { - State = 1090; + State = 1309; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,45,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,55,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 1083; - Match(ELLIPSIS); + State = 1303; + _localctx.classType = className(); + _localctx.Value = Actions.CreateClassTypeSpecification(_localctx.classType.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 1084; - paramAttr(); - State = 1085; - type(); - State = 1086; - marshalClause(); - State = 1088; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 65534L) != 0) || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 70368746274833L) != 0)) { - { - State = 1087; - id(); - } - } - + State = 1306; + _localctx.signatureType = type(); + _localctx.Value = Actions.CreateSignatureTypeSpecification(_localctx.signatureType.Value); } break; } @@ -5439,134 +5570,76 @@ public SigArgContext sigArg() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + ExitRule(); } return _localctx; } - public partial class ClassNameContext : ParserRuleContext { + public partial class TypeSpecOrScopeContext : ParserRuleContext { + public CILParser.TypeSpecificationValue Value; + public TypeSpecContext typeValue; + public DottedNameContext assemblyName; + public DottedNameContext moduleName; + [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { + return GetRuleContext(0); + } [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public SlashedNameContext slashedName() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public MdtokenContext mdtoken() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PTR() { return GetToken(CILParser.PTR, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode MODULE() { return GetToken(CILParser.MODULE, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode THIS() { return GetToken(CILParser.THIS, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BASE() { return GetToken(CILParser.BASE, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NESTER() { return GetToken(CILParser.NESTER, 0); } - public ClassNameContext(ParserRuleContext parent, int invokingState) + public TypeSpecOrScopeContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_className; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitClassName(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_typeSpecOrScope; } } } [RuleVersion(0)] - public ClassNameContext className() { - ClassNameContext _localctx = new ClassNameContext(Context, State); - EnterRule(_localctx, 138, RULE_className); + public TypeSpecOrScopeContext typeSpecOrScope() { + TypeSpecOrScopeContext _localctx = new TypeSpecOrScopeContext(Context, State); + EnterRule(_localctx, 128, RULE_typeSpecOrScope); + _localctx.Value = CILParser.TypeSpecificationValue.Error; try { - State = 1117; + State = 1325; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,46,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,56,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 1092; - Match(T__41); - State = 1093; - dottedName(); - State = 1094; - Match(T__42); - State = 1095; - slashedName(); + State = 1311; + _localctx.typeValue = typeSpec(); + _localctx.Value = _localctx.typeValue.Value; } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 1097; + State = 1314; Match(T__41); - State = 1098; - mdtoken(); - State = 1099; + State = 1315; + _localctx.assemblyName = dottedName(); + State = 1316; Match(T__42); - State = 1100; - slashedName(); + _localctx.Value = Actions.CreateAssemblyTypeSpecification(_localctx.assemblyName.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 1102; - Match(T__41); - State = 1103; - Match(PTR); - State = 1104; - Match(T__42); - State = 1105; - slashedName(); - } - break; - case 4: - EnterOuterAlt(_localctx, 4); - { - State = 1106; + State = 1319; Match(T__41); - State = 1107; + State = 1320; Match(MODULE); - State = 1108; - dottedName(); - State = 1109; + State = 1321; + _localctx.moduleName = dottedName(); + State = 1322; Match(T__42); - State = 1110; - slashedName(); - } - break; - case 5: - EnterOuterAlt(_localctx, 5); - { - State = 1112; - slashedName(); - } - break; - case 6: - EnterOuterAlt(_localctx, 6); - { - State = 1113; - mdtoken(); - } - break; - case 7: - EnterOuterAlt(_localctx, 7); - { - State = 1114; - Match(THIS); - } - break; - case 8: - EnterOuterAlt(_localctx, 8); - { - State = 1115; - Match(BASE); - } - break; - case 9: - EnterOuterAlt(_localctx, 9); - { - State = 1116; - Match(NESTER); + _localctx.Value = Actions.CreateModuleTypeSpecification(_localctx.moduleName.Value); } break; } @@ -5582,54 +5655,67 @@ public ClassNameContext className() { return _localctx; } - public partial class SlashedNameContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext[] dottedName() { - return GetRuleContexts(); + public partial class NativeTypeContext : ParserRuleContext { + public CILParser.NativeTypeValue Value; + public CILParser.NativeTypeBuilder Builder; + public NativeTypeElementContext element; + public NativeTypeArrayPointerInfoContext info; + [System.Diagnostics.DebuggerNonUserCode] public NativeTypeElementContext nativeTypeElement() { + return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName(int i) { - return GetRuleContext(i); + [System.Diagnostics.DebuggerNonUserCode] public NativeTypeArrayPointerInfoContext[] nativeTypeArrayPointerInfo() { + return GetRuleContexts(); } - public SlashedNameContext(ParserRuleContext parent, int invokingState) + [System.Diagnostics.DebuggerNonUserCode] public NativeTypeArrayPointerInfoContext nativeTypeArrayPointerInfo(int i) { + return GetRuleContext(i); + } + public NativeTypeContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_slashedName; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSlashedName(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_nativeType; } } } [RuleVersion(0)] - public SlashedNameContext slashedName() { - SlashedNameContext _localctx = new SlashedNameContext(Context, State); - EnterRule(_localctx, 140, RULE_slashedName); + public NativeTypeContext nativeType() { + NativeTypeContext _localctx = new NativeTypeContext(Context, State); + EnterRule(_localctx, 130, RULE_nativeType); + _localctx.Builder = new CILParser.NativeTypeBuilder(); try { int _alt; - EnterOuterAlt(_localctx, 1); - { - State = 1124; + State = 1338; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,47,Context); - while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - State = 1119; - dottedName(); - State = 1120; - Match(T__87); - } - } + switch ( Interpreter.AdaptivePredict(TokenStream,58,Context) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { } - State = 1126; + break; + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 1328; + _localctx.element = nativeTypeElement(); + Actions.SetNativeTypeElement(_localctx.Builder, _localctx.element.Value); + State = 1335; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,47,Context); - } - State = 1127; - dottedName(); + _alt = Interpreter.AdaptivePredict(TokenStream,57,Context); + while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + State = 1330; + _localctx.info = nativeTypeArrayPointerInfo(); + Actions.AddNativeTypeArrayPointerInfo(_localctx.Builder, _localctx.info.Value); + } + } + } + State = 1337; + ErrorHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(TokenStream,57,Context); + } + } + break; } } catch (RecognitionException re) { @@ -5638,225 +5724,704 @@ public SlashedNameContext slashedName() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = Actions.CreateNativeType(_localctx.Start, _localctx.Builder); ExitRule(); } return _localctx; } - public partial class AssemblyDeclsContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public AssemblyDeclContext[] assemblyDecl() { - return GetRuleContexts(); - } - [System.Diagnostics.DebuggerNonUserCode] public AssemblyDeclContext assemblyDecl(int i) { - return GetRuleContext(i); - } - public AssemblyDeclsContext(ParserRuleContext parent, int invokingState) + public partial class NativeTypeArrayPointerInfoContext : ParserRuleContext { + public CILParser.NativeTypeArrayPointerInfoValue Value; + public NativeTypeArrayPointerInfoContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_assemblyDecls; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitAssemblyDecls(this); - else return visitor.VisitChildren(this); + public override int RuleIndex { get { return RULE_nativeTypeArrayPointerInfo; } } + + public NativeTypeArrayPointerInfoContext() { } + public virtual void CopyFrom(NativeTypeArrayPointerInfoContext context) { + base.CopyFrom(context); + this.Value = context.Value; } } - - [RuleVersion(0)] - public AssemblyDeclsContext assemblyDecls() { - AssemblyDeclsContext _localctx = new AssemblyDeclsContext(Context, State); - EnterRule(_localctx, 142, RULE_assemblyDecls); - int _la; - try { - EnterOuterAlt(_localctx, 1); - { - State = 1132; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 38654771200L) != 0) || ((((_la - 167)) & ~0x3f) == 0 && ((1L << (_la - 167)) & 4103L) != 0) || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 6860954690125825L) != 0)) { - { - { - State = 1129; - assemblyDecl(); - } - } - State = 1134; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); + public partial class PointerArrayTypeSizeContext : NativeTypeArrayPointerInfoContext { + public Int32Context size; + [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { + return GetRuleContext(0); } - return _localctx; + public PointerArrayTypeSizeContext(NativeTypeArrayPointerInfoContext context) { CopyFrom(context); } } - - public partial class AssemblyDeclContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode HASH() { return GetToken(CILParser.HASH, 0); } + public partial class PointerArrayTypeParamIndexContext : NativeTypeArrayPointerInfoContext { + public Int32Context parameterIndex; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PLUS() { return GetToken(CILParser.PLUS, 0); } [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public SecDeclContext secDecl() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public AsmOrRefDeclContext asmOrRefDecl() { - return GetRuleContext(0); - } - public AssemblyDeclContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { + public PointerArrayTypeParamIndexContext(NativeTypeArrayPointerInfoContext context) { CopyFrom(context); } + } + public partial class PointerNativeTypeContext : NativeTypeArrayPointerInfoContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PTR() { return GetToken(CILParser.PTR, 0); } + public PointerNativeTypeContext(NativeTypeArrayPointerInfoContext context) { CopyFrom(context); } + } + public partial class PointerArrayTypeSizeParamIndexContext : NativeTypeArrayPointerInfoContext { + public Int32Context size; + public Int32Context parameterIndex; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PLUS() { return GetToken(CILParser.PLUS, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Int32Context[] int32() { + return GetRuleContexts(); } - public override int RuleIndex { get { return RULE_assemblyDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitAssemblyDecl(this); - else return visitor.VisitChildren(this); + [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32(int i) { + return GetRuleContext(i); } + public PointerArrayTypeSizeParamIndexContext(NativeTypeArrayPointerInfoContext context) { CopyFrom(context); } + } + public partial class PointerArrayTypeNoSizeDataContext : NativeTypeArrayPointerInfoContext { + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ARRAY_TYPE_NO_BOUNDS() { return GetToken(CILParser.ARRAY_TYPE_NO_BOUNDS, 0); } + public PointerArrayTypeNoSizeDataContext(NativeTypeArrayPointerInfoContext context) { CopyFrom(context); } } [RuleVersion(0)] - public AssemblyDeclContext assemblyDecl() { - AssemblyDeclContext _localctx = new AssemblyDeclContext(Context, State); - EnterRule(_localctx, 144, RULE_assemblyDecl); + public NativeTypeArrayPointerInfoContext nativeTypeArrayPointerInfo() { + NativeTypeArrayPointerInfoContext _localctx = new NativeTypeArrayPointerInfoContext(Context, State); + EnterRule(_localctx, 132, RULE_nativeTypeArrayPointerInfo); + _localctx.Value = Actions.CreatePointerNativeType(); try { - State = 1140; + State = 1362; ErrorHandler.Sync(this); - switch (TokenStream.LA(1)) { - case HASH: + switch ( Interpreter.AdaptivePredict(TokenStream,59,Context) ) { + case 1: + _localctx = new PointerNativeTypeContext(_localctx); EnterOuterAlt(_localctx, 1); { + State = 1340; + Match(PTR); + _localctx.Value = Actions.CreatePointerNativeType(); + } + break; + case 2: + _localctx = new PointerArrayTypeNoSizeDataContext(_localctx); + EnterOuterAlt(_localctx, 2); + { + State = 1342; + Match(ARRAY_TYPE_NO_BOUNDS); + _localctx.Value = Actions.CreatePointerArrayTypeNoSizeData(); + } + break; + case 3: + _localctx = new PointerArrayTypeSizeContext(_localctx); + EnterOuterAlt(_localctx, 3); + { + State = 1344; + Match(T__41); + State = 1345; + ((PointerArrayTypeSizeContext)_localctx).size = int32(); + State = 1346; + Match(T__42); + _localctx.Value = Actions.CreatePointerArrayTypeSize((((PointerArrayTypeSizeContext)_localctx).size!=null?(((PointerArrayTypeSizeContext)_localctx).size.Start):null)); + } + break; + case 4: + _localctx = new PointerArrayTypeSizeParamIndexContext(_localctx); + EnterOuterAlt(_localctx, 4); + { + State = 1349; + Match(T__41); + State = 1350; + ((PointerArrayTypeSizeParamIndexContext)_localctx).size = int32(); + State = 1351; + Match(PLUS); + State = 1352; + ((PointerArrayTypeSizeParamIndexContext)_localctx).parameterIndex = int32(); + State = 1353; + Match(T__42); + _localctx.Value = Actions.CreatePointerArrayTypeSizeParamIndex((((PointerArrayTypeSizeParamIndexContext)_localctx).size!=null?(((PointerArrayTypeSizeParamIndexContext)_localctx).size.Start):null), (((PointerArrayTypeSizeParamIndexContext)_localctx).parameterIndex!=null?(((PointerArrayTypeSizeParamIndexContext)_localctx).parameterIndex.Start):null)); + } + break; + case 5: + _localctx = new PointerArrayTypeParamIndexContext(_localctx); + EnterOuterAlt(_localctx, 5); + { + State = 1356; + Match(T__41); + State = 1357; + Match(PLUS); + State = 1358; + ((PointerArrayTypeParamIndexContext)_localctx).parameterIndex = int32(); + State = 1359; + Match(T__42); + _localctx.Value = Actions.CreatePointerArrayTypeParamIndex((((PointerArrayTypeParamIndexContext)_localctx).parameterIndex!=null?(((PointerArrayTypeParamIndexContext)_localctx).parameterIndex.Start):null)); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class NativeTypeElementContext : ParserRuleContext { + public CILParser.NativeTypeElementValue Value; + public IToken marshalType; + public CompQstringContext guid; + public CompQstringContext nativeTypeName; + public CompQstringContext marshallerType; + public CompQstringContext cookie; + public Int32Context size; + public NativeTypeContext element; + public IidParamIndexContext index; + public VariantTypeContext variant; + public CompQstringContext userDefinedType; + public IToken unsignedMarshalType; + public IToken marshalBool; + public DottedNameContext alias; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CUSTOM() { return GetToken(CILParser.CUSTOM, 0); } + [System.Diagnostics.DebuggerNonUserCode] public CompQstringContext[] compQstring() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public CompQstringContext compQstring(int i) { + return GetRuleContext(i); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FIXED() { return GetToken(CILParser.FIXED, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SYSSTRING() { return GetToken(CILParser.SYSSTRING, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ARRAY() { return GetToken(CILParser.ARRAY, 0); } + [System.Diagnostics.DebuggerNonUserCode] public NativeTypeContext nativeType() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VARIANT() { return GetToken(CILParser.VARIANT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CURRENCY() { return GetToken(CILParser.CURRENCY, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SYSCHAR() { return GetToken(CILParser.SYSCHAR, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VOID() { return GetToken(CILParser.VOID, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BOOL() { return GetToken(CILParser.BOOL, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT8() { return GetToken(CILParser.INT8, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT16() { return GetToken(CILParser.INT16, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT32_() { return GetToken(CILParser.INT32_, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT64_() { return GetToken(CILParser.INT64_, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOAT32() { return GetToken(CILParser.FLOAT32, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOAT64_() { return GetToken(CILParser.FLOAT64_, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ERROR() { return GetToken(CILParser.ERROR, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT8() { return GetToken(CILParser.UINT8, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT16() { return GetToken(CILParser.UINT16, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT32() { return GetToken(CILParser.UINT32, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT64() { return GetToken(CILParser.UINT64, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DECIMAL() { return GetToken(CILParser.DECIMAL, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DATE() { return GetToken(CILParser.DATE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BSTR() { return GetToken(CILParser.BSTR, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPSTR() { return GetToken(CILParser.LPSTR, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPWSTR() { return GetToken(CILParser.LPWSTR, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPTSTR() { return GetToken(CILParser.LPTSTR, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode OBJECTREF() { return GetToken(CILParser.OBJECTREF, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode IUNKNOWN() { return GetToken(CILParser.IUNKNOWN, 0); } + [System.Diagnostics.DebuggerNonUserCode] public IidParamIndexContext iidParamIndex() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode IDISPATCH() { return GetToken(CILParser.IDISPATCH, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STRUCT() { return GetToken(CILParser.STRUCT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INTERFACE() { return GetToken(CILParser.INTERFACE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SAFEARRAY() { return GetToken(CILParser.SAFEARRAY, 0); } + [System.Diagnostics.DebuggerNonUserCode] public VariantTypeContext variantType() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT() { return GetToken(CILParser.INT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT() { return GetToken(CILParser.UINT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BYVALSTR() { return GetToken(CILParser.BYVALSTR, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ANSI() { return GetToken(CILParser.ANSI, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode TBSTR() { return GetToken(CILParser.TBSTR, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode METHOD() { return GetToken(CILParser.METHOD, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPSTRUCT() { return GetToken(CILParser.LPSTRUCT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ANY() { return GetToken(CILParser.ANY, 0); } + [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { + return GetRuleContext(0); + } + public NativeTypeElementContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_nativeTypeElement; } } + } + + [RuleVersion(0)] + public NativeTypeElementContext nativeTypeElement() { + NativeTypeElementContext _localctx = new NativeTypeElementContext(Context, State); + EnterRule(_localctx, 134, RULE_nativeTypeElement); + _localctx.Value = CILParser.EmptyNativeTypeElementValue.Instance; + try { + State = 1509; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,60,Context) ) { + case 1: + EnterOuterAlt(_localctx, 1); + { + _localctx.Value = Actions.CreateEmptyNativeType(); + } + break; + case 2: + EnterOuterAlt(_localctx, 2); + { + State = 1365; + _localctx.marshalType = Match(CUSTOM); + State = 1366; + Match(T__29); + State = 1367; + _localctx.guid = compQstring(); + State = 1368; + Match(T__27); + State = 1369; + _localctx.nativeTypeName = compQstring(); + State = 1370; + Match(T__27); + State = 1371; + _localctx.marshallerType = compQstring(); + State = 1372; + Match(T__27); + State = 1373; + _localctx.cookie = compQstring(); + State = 1374; + Match(T__30); + _localctx.Value = Actions.CreateDeprecatedCustomMarshallerNativeType( + _localctx, _localctx.guid.Value, _localctx.nativeTypeName.Value, _localctx.marshallerType.Value, _localctx.cookie.Value); + } + break; + case 3: + EnterOuterAlt(_localctx, 3); + { + State = 1377; + _localctx.marshalType = Match(CUSTOM); + State = 1378; + Match(T__29); + State = 1379; + _localctx.marshallerType = compQstring(); + State = 1380; + Match(T__27); + State = 1381; + _localctx.cookie = compQstring(); + State = 1382; + Match(T__30); + _localctx.Value = Actions.CreateCustomMarshallerNativeType(_localctx.marshallerType.Value, _localctx.cookie.Value); + } + break; + case 4: + EnterOuterAlt(_localctx, 4); + { + State = 1385; + Match(FIXED); + State = 1386; + _localctx.marshalType = Match(SYSSTRING); + State = 1387; + Match(T__41); + State = 1388; + _localctx.size = int32(); + State = 1389; + Match(T__42); + _localctx.Value = Actions.CreateFixedSysStringNativeType((_localctx.size!=null?(_localctx.size.Start):null)); + } + break; + case 5: + EnterOuterAlt(_localctx, 5); + { + State = 1392; + Match(FIXED); + State = 1393; + _localctx.marshalType = Match(ARRAY); + State = 1394; + Match(T__41); + State = 1395; + _localctx.size = int32(); + State = 1396; + Match(T__42); + State = 1397; + _localctx.element = nativeType(); + _localctx.Value = Actions.CreateFixedArrayNativeType((_localctx.size!=null?(_localctx.size.Start):null), _localctx.element.Value); + } + break; + case 6: + EnterOuterAlt(_localctx, 6); + { + State = 1400; + _localctx.marshalType = Match(VARIANT); + _localctx.Value = Actions.CreateDeprecatedNativeType(_localctx, _localctx.marshalType); + } + break; + case 7: + EnterOuterAlt(_localctx, 7); + { + State = 1402; + _localctx.marshalType = Match(CURRENCY); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 8: + EnterOuterAlt(_localctx, 8); + { + State = 1404; + _localctx.marshalType = Match(SYSCHAR); + _localctx.Value = Actions.CreateDeprecatedNativeType(_localctx, _localctx.marshalType); + } + break; + case 9: + EnterOuterAlt(_localctx, 9); + { + State = 1406; + _localctx.marshalType = Match(VOID); + _localctx.Value = Actions.CreateDeprecatedNativeType(_localctx, _localctx.marshalType); + } + break; + case 10: + EnterOuterAlt(_localctx, 10); + { + State = 1408; + _localctx.marshalType = Match(BOOL); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 11: + EnterOuterAlt(_localctx, 11); + { + State = 1410; + _localctx.marshalType = Match(INT8); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 12: + EnterOuterAlt(_localctx, 12); + { + State = 1412; + _localctx.marshalType = Match(INT16); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 13: + EnterOuterAlt(_localctx, 13); + { + State = 1414; + _localctx.marshalType = Match(INT32_); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 14: + EnterOuterAlt(_localctx, 14); + { + State = 1416; + _localctx.marshalType = Match(INT64_); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 15: + EnterOuterAlt(_localctx, 15); + { + State = 1418; + _localctx.marshalType = Match(FLOAT32); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 16: + EnterOuterAlt(_localctx, 16); + { + State = 1420; + _localctx.marshalType = Match(FLOAT64_); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 17: + EnterOuterAlt(_localctx, 17); + { + State = 1422; + _localctx.marshalType = Match(ERROR); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 18: + EnterOuterAlt(_localctx, 18); + { + State = 1424; + _localctx.marshalType = Match(UINT8); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 19: + EnterOuterAlt(_localctx, 19); + { + State = 1426; + _localctx.marshalType = Match(UINT16); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 20: + EnterOuterAlt(_localctx, 20); + { + State = 1428; + _localctx.marshalType = Match(UINT32); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 21: + EnterOuterAlt(_localctx, 21); + { + State = 1430; + _localctx.marshalType = Match(UINT64); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 22: + EnterOuterAlt(_localctx, 22); + { + State = 1432; + _localctx.marshalType = Match(DECIMAL); + _localctx.Value = Actions.CreateDeprecatedNativeType(_localctx, _localctx.marshalType); + } + break; + case 23: + EnterOuterAlt(_localctx, 23); + { + State = 1434; + _localctx.marshalType = Match(DATE); + _localctx.Value = Actions.CreateDeprecatedNativeType(_localctx, _localctx.marshalType); + } + break; + case 24: + EnterOuterAlt(_localctx, 24); + { + State = 1436; + _localctx.marshalType = Match(BSTR); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 25: + EnterOuterAlt(_localctx, 25); + { + State = 1438; + _localctx.marshalType = Match(LPSTR); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 26: + EnterOuterAlt(_localctx, 26); + { + State = 1440; + _localctx.marshalType = Match(LPWSTR); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 27: + EnterOuterAlt(_localctx, 27); + { + State = 1442; + _localctx.marshalType = Match(LPTSTR); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 28: + EnterOuterAlt(_localctx, 28); + { + State = 1444; + _localctx.marshalType = Match(OBJECTREF); + _localctx.Value = Actions.CreateDeprecatedNativeType(_localctx, _localctx.marshalType); + } + break; + case 29: + EnterOuterAlt(_localctx, 29); + { + State = 1446; + _localctx.marshalType = Match(IUNKNOWN); + State = 1447; + _localctx.index = iidParamIndex(); + _localctx.Value = Actions.CreateIidNativeType(_localctx.marshalType, _localctx.index.Value); + } + break; + case 30: + EnterOuterAlt(_localctx, 30); + { + State = 1450; + _localctx.marshalType = Match(IDISPATCH); + State = 1451; + _localctx.index = iidParamIndex(); + _localctx.Value = Actions.CreateIidNativeType(_localctx.marshalType, _localctx.index.Value); + } + break; + case 31: + EnterOuterAlt(_localctx, 31); + { + State = 1454; + _localctx.marshalType = Match(STRUCT); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 32: + EnterOuterAlt(_localctx, 32); + { + State = 1456; + _localctx.marshalType = Match(INTERFACE); + State = 1457; + _localctx.index = iidParamIndex(); + _localctx.Value = Actions.CreateIidNativeType(_localctx.marshalType, _localctx.index.Value); + } + break; + case 33: + EnterOuterAlt(_localctx, 33); + { + State = 1460; + _localctx.marshalType = Match(SAFEARRAY); + State = 1461; + _localctx.variant = variantType(); + _localctx.Value = Actions.CreateSafeArrayNativeType(_localctx.variant.Value, null); + } + break; + case 34: + EnterOuterAlt(_localctx, 34); + { + State = 1464; + _localctx.marshalType = Match(SAFEARRAY); + State = 1465; + _localctx.variant = variantType(); + State = 1466; + Match(T__27); + State = 1467; + _localctx.userDefinedType = compQstring(); + _localctx.Value = Actions.CreateSafeArrayNativeType(_localctx.variant.Value, _localctx.userDefinedType.Value); + } + break; + case 35: + EnterOuterAlt(_localctx, 35); + { + State = 1470; + _localctx.marshalType = Match(INT); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 36: + EnterOuterAlt(_localctx, 36); + { + State = 1472; + _localctx.marshalType = Match(UINT); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); + } + break; + case 37: + EnterOuterAlt(_localctx, 37); + { + State = 1474; + Match(T__89); + State = 1475; + _localctx.unsignedMarshalType = Match(INT8); + _localctx.Value = Actions.CreateUnsignedNativeType(_localctx.unsignedMarshalType); + } + break; + case 38: + EnterOuterAlt(_localctx, 38); + { + State = 1477; + Match(T__89); + State = 1478; + _localctx.unsignedMarshalType = Match(INT16); + _localctx.Value = Actions.CreateUnsignedNativeType(_localctx.unsignedMarshalType); + } + break; + case 39: + EnterOuterAlt(_localctx, 39); + { + State = 1480; + Match(T__89); + State = 1481; + _localctx.unsignedMarshalType = Match(INT32_); + _localctx.Value = Actions.CreateUnsignedNativeType(_localctx.unsignedMarshalType); + } + break; + case 40: + EnterOuterAlt(_localctx, 40); + { + State = 1483; + Match(T__89); + State = 1484; + _localctx.unsignedMarshalType = Match(INT64_); + _localctx.Value = Actions.CreateUnsignedNativeType(_localctx.unsignedMarshalType); + } + break; + case 41: + EnterOuterAlt(_localctx, 41); + { + State = 1486; + Match(T__61); + State = 1487; + _localctx.marshalType = Match(STRUCT); + _localctx.Value = Actions.CreateNestedStructNativeType(_localctx); + } + break; + case 42: + EnterOuterAlt(_localctx, 42); { - State = 1135; - Match(HASH); - State = 1136; - Match(T__88); - State = 1137; - int32(); + State = 1489; + _localctx.marshalType = Match(BYVALSTR); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); } + break; + case 43: + EnterOuterAlt(_localctx, 43); + { + State = 1491; + Match(ANSI); + State = 1492; + _localctx.marshalType = Match(BSTR); + _localctx.Value = Actions.CreateAnsiBstrNativeType(); } break; - case PERMISSION: - case PERMISSIONSET: - EnterOuterAlt(_localctx, 2); + case 44: + EnterOuterAlt(_localctx, 44); { - State = 1138; - secDecl(); + State = 1494; + _localctx.marshalType = Match(TBSTR); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); } break; - case T__15: - case T__31: - case T__34: - case T__166: - case T__167: - case T__168: - case INSTANCE: - case SQSTRING: - case PP_DEFINE: - case PP_UNDEF: - case PP_IFDEF: - case PP_IFNDEF: - case PP_ELSE: - case PP_ENDIF: - case PP_INCLUDE: - case DOTTEDNAME: - case ID: - EnterOuterAlt(_localctx, 3); + case 45: + EnterOuterAlt(_localctx, 45); { - State = 1139; - asmOrRefDecl(); + State = 1496; + Match(VARIANT); + State = 1497; + _localctx.marshalBool = Match(BOOL); + _localctx.Value = Actions.CreateVariantBoolNativeType(); } break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class TypeSpecContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ClassNameContext className() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode MODULE() { return GetToken(CILParser.MODULE, 0); } - [System.Diagnostics.DebuggerNonUserCode] public TypeContext type() { - return GetRuleContext(0); - } - public TypeSpecContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_typeSpec; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTypeSpec(this); - else return visitor.VisitChildren(this); - } - } - - [RuleVersion(0)] - public TypeSpecContext typeSpec() { - TypeSpecContext _localctx = new TypeSpecContext(Context, State); - EnterRule(_localctx, 146, RULE_typeSpec); - try { - State = 1153; - ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,50,Context) ) { - case 1: - EnterOuterAlt(_localctx, 1); + case 46: + EnterOuterAlt(_localctx, 46); { - State = 1142; - className(); + State = 1499; + _localctx.marshalType = Match(METHOD); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); } break; - case 2: - EnterOuterAlt(_localctx, 2); + case 47: + EnterOuterAlt(_localctx, 47); { - State = 1143; - Match(T__41); - State = 1144; - dottedName(); - State = 1145; - Match(T__42); + State = 1501; + _localctx.marshalType = Match(LPSTRUCT); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); } break; - case 3: - EnterOuterAlt(_localctx, 3); + case 48: + EnterOuterAlt(_localctx, 48); { - State = 1147; - Match(T__41); - State = 1148; - Match(MODULE); - State = 1149; - dottedName(); - State = 1150; - Match(T__42); + State = 1503; + Match(T__33); + State = 1504; + _localctx.marshalType = Match(ANY); + _localctx.Value = Actions.CreateSimpleNativeType(_localctx.marshalType); } break; - case 4: - EnterOuterAlt(_localctx, 4); + case 49: + EnterOuterAlt(_localctx, 49); { - State = 1152; - type(); + State = 1506; + _localctx.alias = dottedName(); + _localctx.Value = Actions.CreateNativeTypeTypedef(_localctx, _localctx.alias.Value); } break; } @@ -5872,66 +6437,54 @@ public TypeSpecContext typeSpec() { return _localctx; } - public partial class NativeTypeContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public NativeTypeElementContext nativeTypeElement() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public NativeTypeArrayPointerInfoContext[] nativeTypeArrayPointerInfo() { - return GetRuleContexts(); - } - [System.Diagnostics.DebuggerNonUserCode] public NativeTypeArrayPointerInfoContext nativeTypeArrayPointerInfo(int i) { - return GetRuleContext(i); + public partial class IidParamIndexContext : ParserRuleContext { + public CILParser.IidParamIndexValue Value; + public Int32Context index; + [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { + return GetRuleContext(0); } - public NativeTypeContext(ParserRuleContext parent, int invokingState) + public IidParamIndexContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_nativeType; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitNativeType(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_iidParamIndex; } } } [RuleVersion(0)] - public NativeTypeContext nativeType() { - NativeTypeContext _localctx = new NativeTypeContext(Context, State); - EnterRule(_localctx, 148, RULE_nativeType); + public IidParamIndexContext iidParamIndex() { + IidParamIndexContext _localctx = new IidParamIndexContext(Context, State); + EnterRule(_localctx, 136, RULE_iidParamIndex); + _localctx.Value = CILParser.IidParamIndexValue.Empty; try { - int _alt; - State = 1163; + State = 1519; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,52,Context) ) { - case 1: + switch (TokenStream.LA(1)) { + case T__30: + case T__41: + case ARRAY_TYPE_NO_BOUNDS: + case PTR: EnterOuterAlt(_localctx, 1); { } break; - case 2: + case T__29: EnterOuterAlt(_localctx, 2); { - State = 1156; - nativeTypeElement(); - State = 1160; - ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,51,Context); - while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - State = 1157; - nativeTypeArrayPointerInfo(); - } - } - } - State = 1162; - ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,51,Context); - } + State = 1512; + Match(T__29); + State = 1513; + Match(T__90); + State = 1514; + Match(T__35); + State = 1515; + _localctx.index = int32(); + State = 1516; + Match(T__30); + _localctx.Value = Actions.GetIidParamIndex((_localctx.index!=null?(_localctx.index.Start):null)); } break; + default: + throw new NoViableAltException(this); } } catch (RecognitionException re) { @@ -5945,144 +6498,80 @@ public NativeTypeContext nativeType() { return _localctx; } - public partial class NativeTypeArrayPointerInfoContext : ParserRuleContext { - public NativeTypeArrayPointerInfoContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_nativeTypeArrayPointerInfo; } } - - public NativeTypeArrayPointerInfoContext() { } - public virtual void CopyFrom(NativeTypeArrayPointerInfoContext context) { - base.CopyFrom(context); - } - } - public partial class PointerArrayTypeSizeContext : NativeTypeArrayPointerInfoContext { - [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { - return GetRuleContext(0); - } - public PointerArrayTypeSizeContext(NativeTypeArrayPointerInfoContext context) { CopyFrom(context); } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitPointerArrayTypeSize(this); - else return visitor.VisitChildren(this); - } - } - public partial class PointerArrayTypeParamIndexContext : NativeTypeArrayPointerInfoContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PLUS() { return GetToken(CILParser.PLUS, 0); } - [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { - return GetRuleContext(0); - } - public PointerArrayTypeParamIndexContext(NativeTypeArrayPointerInfoContext context) { CopyFrom(context); } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitPointerArrayTypeParamIndex(this); - else return visitor.VisitChildren(this); - } - } - public partial class PointerNativeTypeContext : NativeTypeArrayPointerInfoContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PTR() { return GetToken(CILParser.PTR, 0); } - public PointerNativeTypeContext(NativeTypeArrayPointerInfoContext context) { CopyFrom(context); } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitPointerNativeType(this); - else return visitor.VisitChildren(this); + public partial class VariantTypeContext : ParserRuleContext { + public CILParser.VariantTypeValue Value; + public CILParser.VariantTypeBuilder Builder; + public VariantTypeElementContext element; + public IToken modifier; + [System.Diagnostics.DebuggerNonUserCode] public VariantTypeElementContext variantTypeElement() { + return GetRuleContext(0); } - } - public partial class PointerArrayTypeSizeParamIndexContext : NativeTypeArrayPointerInfoContext { - [System.Diagnostics.DebuggerNonUserCode] public Int32Context[] int32() { - return GetRuleContexts(); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] ARRAY_TYPE_NO_BOUNDS() { return GetTokens(CILParser.ARRAY_TYPE_NO_BOUNDS); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ARRAY_TYPE_NO_BOUNDS(int i) { + return GetToken(CILParser.ARRAY_TYPE_NO_BOUNDS, i); } - [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32(int i) { - return GetRuleContext(i); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] VECTOR() { return GetTokens(CILParser.VECTOR); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VECTOR(int i) { + return GetToken(CILParser.VECTOR, i); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PLUS() { return GetToken(CILParser.PLUS, 0); } - public PointerArrayTypeSizeParamIndexContext(NativeTypeArrayPointerInfoContext context) { CopyFrom(context); } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitPointerArrayTypeSizeParamIndex(this); - else return visitor.VisitChildren(this); + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] REF() { return GetTokens(CILParser.REF); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode REF(int i) { + return GetToken(CILParser.REF, i); } - } - public partial class PointerArrayTypeNoSizeDataContext : NativeTypeArrayPointerInfoContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ARRAY_TYPE_NO_BOUNDS() { return GetToken(CILParser.ARRAY_TYPE_NO_BOUNDS, 0); } - public PointerArrayTypeNoSizeDataContext(NativeTypeArrayPointerInfoContext context) { CopyFrom(context); } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitPointerArrayTypeNoSizeData(this); - else return visitor.VisitChildren(this); + public VariantTypeContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { } + public override int RuleIndex { get { return RULE_variantType; } } } [RuleVersion(0)] - public NativeTypeArrayPointerInfoContext nativeTypeArrayPointerInfo() { - NativeTypeArrayPointerInfoContext _localctx = new NativeTypeArrayPointerInfoContext(Context, State); - EnterRule(_localctx, 150, RULE_nativeTypeArrayPointerInfo); + public VariantTypeContext variantType() { + VariantTypeContext _localctx = new VariantTypeContext(Context, State); + EnterRule(_localctx, 138, RULE_variantType); + _localctx.Builder = new CILParser.VariantTypeBuilder(); + int _la; try { - State = 1182; + int _alt; + State = 1531; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,53,Context) ) { - case 1: - _localctx = new PointerNativeTypeContext(_localctx); - EnterOuterAlt(_localctx, 1); - { - State = 1165; - Match(PTR); - } - break; - case 2: - _localctx = new PointerArrayTypeNoSizeDataContext(_localctx); - EnterOuterAlt(_localctx, 2); - { - State = 1166; - Match(ARRAY_TYPE_NO_BOUNDS); - } - break; - case 3: - _localctx = new PointerArrayTypeSizeContext(_localctx); - EnterOuterAlt(_localctx, 3); - { - State = 1167; - Match(T__41); - State = 1168; - int32(); - State = 1169; - Match(T__42); - } - break; - case 4: - _localctx = new PointerArrayTypeSizeParamIndexContext(_localctx); - EnterOuterAlt(_localctx, 4); + switch ( Interpreter.AdaptivePredict(TokenStream,63,Context) ) { + case 1: + EnterOuterAlt(_localctx, 1); { - State = 1171; - Match(T__41); - State = 1172; - int32(); - State = 1173; - Match(PLUS); - State = 1174; - int32(); - State = 1175; - Match(T__42); } break; - case 5: - _localctx = new PointerArrayTypeParamIndexContext(_localctx); - EnterOuterAlt(_localctx, 5); + case 2: + EnterOuterAlt(_localctx, 2); { - State = 1177; - Match(T__41); - State = 1178; - Match(PLUS); - State = 1179; - int32(); - State = 1180; - Match(T__42); + State = 1522; + _localctx.element = variantTypeElement(); + Actions.SetVariantTypeElement(_localctx.Builder, _localctx.element.Value); + State = 1528; + ErrorHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(TokenStream,62,Context); + while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + State = 1524; + _localctx.modifier = TokenStream.LT(1); + _la = TokenStream.LA(1); + if ( !(((((_la - 228)) & ~0x3f) == 0 && ((1L << (_la - 228)) & 6442450945L) != 0)) ) { + _localctx.modifier = ErrorHandler.RecoverInline(this); + } + else { + ErrorHandler.ReportMatch(this); + Consume(); + } + Actions.AddVariantTypeModifier(_localctx.Builder, _localctx.modifier); + } + } + } + State = 1530; + ErrorHandler.Sync(this); + _alt = Interpreter.AdaptivePredict(TokenStream,62,Context); + } } break; } @@ -6093,34 +6582,18 @@ public NativeTypeArrayPointerInfoContext nativeTypeArrayPointerInfo() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = Actions.CreateVariantType(_localctx.Builder); ExitRule(); } return _localctx; } - public partial class NativeTypeElementContext : ParserRuleContext { - public IToken marshalType; - public IToken unsignedMarshalType; - public IToken marshalBool; - [System.Diagnostics.DebuggerNonUserCode] public CompQstringContext[] compQstring() { - return GetRuleContexts(); - } - [System.Diagnostics.DebuggerNonUserCode] public CompQstringContext compQstring(int i) { - return GetRuleContext(i); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CUSTOM() { return GetToken(CILParser.CUSTOM, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FIXED() { return GetToken(CILParser.FIXED, 0); } - [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SYSSTRING() { return GetToken(CILParser.SYSSTRING, 0); } - [System.Diagnostics.DebuggerNonUserCode] public NativeTypeContext nativeType() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ARRAY() { return GetToken(CILParser.ARRAY, 0); } + public partial class VariantTypeElementContext : ParserRuleContext { + public CILParser.VariantTypeElementValue Value; + public IToken value; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NULL() { return GetToken(CILParser.NULL, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VARIANT() { return GetToken(CILParser.VARIANT, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CURRENCY() { return GetToken(CILParser.CURRENCY, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SYSCHAR() { return GetToken(CILParser.SYSCHAR, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VOID() { return GetToken(CILParser.VOID, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BOOL() { return GetToken(CILParser.BOOL, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT8() { return GetToken(CILParser.INT8, 0); } @@ -6129,712 +6602,373 @@ [System.Diagnostics.DebuggerNonUserCode] public NativeTypeContext nativeType() { [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT64_() { return GetToken(CILParser.INT64_, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOAT32() { return GetToken(CILParser.FLOAT32, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOAT64_() { return GetToken(CILParser.FLOAT64_, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ERROR() { return GetToken(CILParser.ERROR, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT8() { return GetToken(CILParser.UINT8, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT16() { return GetToken(CILParser.UINT16, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT32() { return GetToken(CILParser.UINT32, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT64() { return GetToken(CILParser.UINT64, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PTR() { return GetToken(CILParser.PTR, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DECIMAL() { return GetToken(CILParser.DECIMAL, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DATE() { return GetToken(CILParser.DATE, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BSTR() { return GetToken(CILParser.BSTR, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPSTR() { return GetToken(CILParser.LPSTR, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPWSTR() { return GetToken(CILParser.LPWSTR, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPTSTR() { return GetToken(CILParser.LPTSTR, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode OBJECTREF() { return GetToken(CILParser.OBJECTREF, 0); } - [System.Diagnostics.DebuggerNonUserCode] public IidParamIndexContext iidParamIndex() { - return GetRuleContext(0); - } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode IUNKNOWN() { return GetToken(CILParser.IUNKNOWN, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode IDISPATCH() { return GetToken(CILParser.IDISPATCH, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STRUCT() { return GetToken(CILParser.STRUCT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INTERFACE() { return GetToken(CILParser.INTERFACE, 0); } - [System.Diagnostics.DebuggerNonUserCode] public VariantTypeContext variantType() { - return GetRuleContext(0); - } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SAFEARRAY() { return GetToken(CILParser.SAFEARRAY, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT() { return GetToken(CILParser.INT, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT() { return GetToken(CILParser.UINT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BYVALSTR() { return GetToken(CILParser.BYVALSTR, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ANSI() { return GetToken(CILParser.ANSI, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode TBSTR() { return GetToken(CILParser.TBSTR, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode METHOD() { return GetToken(CILParser.METHOD, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPSTRUCT() { return GetToken(CILParser.LPSTRUCT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ANY() { return GetToken(CILParser.ANY, 0); } - [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { - return GetRuleContext(0); - } - public NativeTypeElementContext(ParserRuleContext parent, int invokingState) + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ERROR() { return GetToken(CILParser.ERROR, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode HRESULT() { return GetToken(CILParser.HRESULT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CARRAY() { return GetToken(CILParser.CARRAY, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode USERDEFINED() { return GetToken(CILParser.USERDEFINED, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode RECORD() { return GetToken(CILParser.RECORD, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FILETIME() { return GetToken(CILParser.FILETIME, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BLOB() { return GetToken(CILParser.BLOB, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STREAM() { return GetToken(CILParser.STREAM, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STORAGE() { return GetToken(CILParser.STORAGE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STREAMED_OBJECT() { return GetToken(CILParser.STREAMED_OBJECT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STORED_OBJECT() { return GetToken(CILParser.STORED_OBJECT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BLOB_OBJECT() { return GetToken(CILParser.BLOB_OBJECT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CF() { return GetToken(CILParser.CF, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CLSID() { return GetToken(CILParser.CLSID, 0); } + public VariantTypeElementContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_nativeTypeElement; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitNativeTypeElement(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_variantTypeElement; } } } [RuleVersion(0)] - public NativeTypeElementContext nativeTypeElement() { - NativeTypeElementContext _localctx = new NativeTypeElementContext(Context, State); - EnterRule(_localctx, 152, RULE_nativeTypeElement); + public VariantTypeElementContext variantTypeElement() { + VariantTypeElementContext _localctx = new VariantTypeElementContext(Context, State); + EnterRule(_localctx, 140, RULE_variantTypeElement); + _localctx.Value = CILParser.VariantTypeElementValue.Error; try { - State = 1276; + State = 1613; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,54,Context) ) { - case 1: + switch (TokenStream.LA(1)) { + case NULL: EnterOuterAlt(_localctx, 1); { + State = 1533; + _localctx.value = Match(NULL); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 2: + case VARIANT: EnterOuterAlt(_localctx, 2); { - State = 1185; - _localctx.marshalType = Match(CUSTOM); - State = 1186; - Match(T__29); - State = 1187; - compQstring(); - State = 1188; - Match(T__27); - State = 1189; - compQstring(); - State = 1190; - Match(T__27); - State = 1191; - compQstring(); - State = 1192; - Match(T__27); - State = 1193; - compQstring(); - State = 1194; - Match(T__30); + State = 1535; + _localctx.value = Match(VARIANT); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 3: + case CURRENCY: EnterOuterAlt(_localctx, 3); { - State = 1196; - _localctx.marshalType = Match(CUSTOM); - State = 1197; - Match(T__29); - State = 1198; - compQstring(); - State = 1199; - Match(T__27); - State = 1200; - compQstring(); - State = 1201; - Match(T__30); + State = 1537; + _localctx.value = Match(CURRENCY); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 4: + case VOID: EnterOuterAlt(_localctx, 4); { - State = 1203; - Match(FIXED); - State = 1204; - _localctx.marshalType = Match(SYSSTRING); - State = 1205; - Match(T__41); - State = 1206; - int32(); - State = 1207; - Match(T__42); + State = 1539; + _localctx.value = Match(VOID); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 5: + case BOOL: EnterOuterAlt(_localctx, 5); { - State = 1209; - Match(FIXED); - State = 1210; - _localctx.marshalType = Match(ARRAY); - State = 1211; - Match(T__41); - State = 1212; - int32(); - State = 1213; - Match(T__42); - State = 1214; - nativeType(); + State = 1541; + _localctx.value = Match(BOOL); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 6: + case INT8: EnterOuterAlt(_localctx, 6); { - State = 1216; - _localctx.marshalType = Match(VARIANT); + State = 1543; + _localctx.value = Match(INT8); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 7: + case INT16: EnterOuterAlt(_localctx, 7); { - State = 1217; - _localctx.marshalType = Match(CURRENCY); + State = 1545; + _localctx.value = Match(INT16); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 8: + case INT32_: EnterOuterAlt(_localctx, 8); { - State = 1218; - _localctx.marshalType = Match(SYSCHAR); + State = 1547; + _localctx.value = Match(INT32_); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 9: + case INT64_: EnterOuterAlt(_localctx, 9); { - State = 1219; - _localctx.marshalType = Match(VOID); + State = 1549; + _localctx.value = Match(INT64_); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 10: + case FLOAT32: EnterOuterAlt(_localctx, 10); { - State = 1220; - _localctx.marshalType = Match(BOOL); + State = 1551; + _localctx.value = Match(FLOAT32); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 11: + case FLOAT64_: EnterOuterAlt(_localctx, 11); { - State = 1221; - _localctx.marshalType = Match(INT8); + State = 1553; + _localctx.value = Match(FLOAT64_); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 12: + case UINT8: EnterOuterAlt(_localctx, 12); { - State = 1222; - _localctx.marshalType = Match(INT16); + State = 1555; + _localctx.value = Match(UINT8); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 13: + case UINT16: EnterOuterAlt(_localctx, 13); { - State = 1223; - _localctx.marshalType = Match(INT32_); + State = 1557; + _localctx.value = Match(UINT16); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 14: + case UINT32: EnterOuterAlt(_localctx, 14); { - State = 1224; - _localctx.marshalType = Match(INT64_); - } - break; - case 15: - EnterOuterAlt(_localctx, 15); - { - State = 1225; - _localctx.marshalType = Match(FLOAT32); - } - break; - case 16: - EnterOuterAlt(_localctx, 16); - { - State = 1226; - _localctx.marshalType = Match(FLOAT64_); - } - break; - case 17: - EnterOuterAlt(_localctx, 17); - { - State = 1227; - _localctx.marshalType = Match(ERROR); - } - break; - case 18: - EnterOuterAlt(_localctx, 18); - { - State = 1228; - _localctx.marshalType = Match(UINT8); - } - break; - case 19: - EnterOuterAlt(_localctx, 19); - { - State = 1229; - _localctx.marshalType = Match(UINT16); - } - break; - case 20: - EnterOuterAlt(_localctx, 20); - { - State = 1230; - _localctx.marshalType = Match(UINT32); - } - break; - case 21: - EnterOuterAlt(_localctx, 21); - { - State = 1231; - _localctx.marshalType = Match(UINT64); - } - break; - case 22: - EnterOuterAlt(_localctx, 22); - { - State = 1232; - _localctx.marshalType = Match(DECIMAL); - } - break; - case 23: - EnterOuterAlt(_localctx, 23); - { - State = 1233; - _localctx.marshalType = Match(DATE); - } - break; - case 24: - EnterOuterAlt(_localctx, 24); - { - State = 1234; - _localctx.marshalType = Match(BSTR); - } - break; - case 25: - EnterOuterAlt(_localctx, 25); - { - State = 1235; - _localctx.marshalType = Match(LPSTR); - } - break; - case 26: - EnterOuterAlt(_localctx, 26); - { - State = 1236; - _localctx.marshalType = Match(LPWSTR); - } - break; - case 27: - EnterOuterAlt(_localctx, 27); - { - State = 1237; - _localctx.marshalType = Match(LPTSTR); - } - break; - case 28: - EnterOuterAlt(_localctx, 28); - { - State = 1238; - _localctx.marshalType = Match(OBJECTREF); + State = 1559; + _localctx.value = Match(UINT32); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 29: - EnterOuterAlt(_localctx, 29); + case UINT64: + EnterOuterAlt(_localctx, 15); { - State = 1239; - _localctx.marshalType = Match(IUNKNOWN); - State = 1240; - iidParamIndex(); + State = 1561; + _localctx.value = Match(UINT64); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 30: - EnterOuterAlt(_localctx, 30); + case PTR: + EnterOuterAlt(_localctx, 16); { - State = 1241; - _localctx.marshalType = Match(IDISPATCH); - State = 1242; - iidParamIndex(); + State = 1563; + _localctx.value = Match(PTR); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 31: - EnterOuterAlt(_localctx, 31); + case DECIMAL: + EnterOuterAlt(_localctx, 17); { - State = 1243; - _localctx.marshalType = Match(STRUCT); + State = 1565; + _localctx.value = Match(DECIMAL); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 32: - EnterOuterAlt(_localctx, 32); + case DATE: + EnterOuterAlt(_localctx, 18); { - State = 1244; - _localctx.marshalType = Match(INTERFACE); - State = 1245; - iidParamIndex(); + State = 1567; + _localctx.value = Match(DATE); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 33: - EnterOuterAlt(_localctx, 33); + case BSTR: + EnterOuterAlt(_localctx, 19); { - State = 1246; - _localctx.marshalType = Match(SAFEARRAY); - State = 1247; - variantType(); + State = 1569; + _localctx.value = Match(BSTR); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 34: - EnterOuterAlt(_localctx, 34); + case LPSTR: + EnterOuterAlt(_localctx, 20); { - State = 1248; - _localctx.marshalType = Match(SAFEARRAY); - State = 1249; - variantType(); - State = 1250; - Match(T__27); - State = 1251; - compQstring(); + State = 1571; + _localctx.value = Match(LPSTR); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 35: - EnterOuterAlt(_localctx, 35); + case LPWSTR: + EnterOuterAlt(_localctx, 21); { - State = 1253; - _localctx.marshalType = Match(INT); + State = 1573; + _localctx.value = Match(LPWSTR); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 36: - EnterOuterAlt(_localctx, 36); + case IUNKNOWN: + EnterOuterAlt(_localctx, 22); { - State = 1254; - _localctx.marshalType = Match(UINT); + State = 1575; + _localctx.value = Match(IUNKNOWN); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 37: - EnterOuterAlt(_localctx, 37); + case IDISPATCH: + EnterOuterAlt(_localctx, 23); { - State = 1255; - Match(T__89); - State = 1256; - _localctx.unsignedMarshalType = Match(INT8); + State = 1577; + _localctx.value = Match(IDISPATCH); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 38: - EnterOuterAlt(_localctx, 38); + case SAFEARRAY: + EnterOuterAlt(_localctx, 24); { - State = 1257; - Match(T__89); - State = 1258; - _localctx.unsignedMarshalType = Match(INT16); + State = 1579; + _localctx.value = Match(SAFEARRAY); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 39: - EnterOuterAlt(_localctx, 39); + case INT: + EnterOuterAlt(_localctx, 25); { - State = 1259; - Match(T__89); - State = 1260; - _localctx.unsignedMarshalType = Match(INT32_); + State = 1581; + _localctx.value = Match(INT); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 40: - EnterOuterAlt(_localctx, 40); + case UINT: + EnterOuterAlt(_localctx, 26); { - State = 1261; - Match(T__89); - State = 1262; - _localctx.unsignedMarshalType = Match(INT64_); + State = 1583; + _localctx.value = Match(UINT); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 41: - EnterOuterAlt(_localctx, 41); + case ERROR: + EnterOuterAlt(_localctx, 27); { - State = 1263; - Match(T__61); - State = 1264; - _localctx.marshalType = Match(STRUCT); + State = 1585; + _localctx.value = Match(ERROR); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 42: - EnterOuterAlt(_localctx, 42); + case HRESULT: + EnterOuterAlt(_localctx, 28); { - State = 1265; - _localctx.marshalType = Match(BYVALSTR); + State = 1587; + _localctx.value = Match(HRESULT); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 43: - EnterOuterAlt(_localctx, 43); + case CARRAY: + EnterOuterAlt(_localctx, 29); { - State = 1266; - Match(ANSI); - State = 1267; - _localctx.marshalType = Match(BSTR); + State = 1589; + _localctx.value = Match(CARRAY); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 44: - EnterOuterAlt(_localctx, 44); + case USERDEFINED: + EnterOuterAlt(_localctx, 30); { - State = 1268; - _localctx.marshalType = Match(TBSTR); + State = 1591; + _localctx.value = Match(USERDEFINED); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 45: - EnterOuterAlt(_localctx, 45); + case RECORD: + EnterOuterAlt(_localctx, 31); { - State = 1269; - Match(VARIANT); - State = 1270; - _localctx.marshalBool = Match(BOOL); + State = 1593; + _localctx.value = Match(RECORD); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 46: - EnterOuterAlt(_localctx, 46); + case FILETIME: + EnterOuterAlt(_localctx, 32); { - State = 1271; - _localctx.marshalType = Match(METHOD); + State = 1595; + _localctx.value = Match(FILETIME); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 47: - EnterOuterAlt(_localctx, 47); + case BLOB: + EnterOuterAlt(_localctx, 33); { - State = 1272; - _localctx.marshalType = Match(LPSTRUCT); + State = 1597; + _localctx.value = Match(BLOB); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 48: - EnterOuterAlt(_localctx, 48); + case STREAM: + EnterOuterAlt(_localctx, 34); { - State = 1273; - Match(T__33); - State = 1274; - _localctx.marshalType = Match(ANY); + State = 1599; + _localctx.value = Match(STREAM); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 49: - EnterOuterAlt(_localctx, 49); + case STORAGE: + EnterOuterAlt(_localctx, 35); { - State = 1275; - dottedName(); + State = 1601; + _localctx.value = Match(STORAGE); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class IidParamIndexContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { - return GetRuleContext(0); - } - public IidParamIndexContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_iidParamIndex; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitIidParamIndex(this); - else return visitor.VisitChildren(this); - } - } - - [RuleVersion(0)] - public IidParamIndexContext iidParamIndex() { - IidParamIndexContext _localctx = new IidParamIndexContext(Context, State); - EnterRule(_localctx, 154, RULE_iidParamIndex); - try { - State = 1285; - ErrorHandler.Sync(this); - switch (TokenStream.LA(1)) { - case T__30: - case T__41: - case ARRAY_TYPE_NO_BOUNDS: - case PTR: - EnterOuterAlt(_localctx, 1); + case STREAMED_OBJECT: + EnterOuterAlt(_localctx, 36); { + State = 1603; + _localctx.value = Match(STREAMED_OBJECT); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case T__29: - EnterOuterAlt(_localctx, 2); + case STORED_OBJECT: + EnterOuterAlt(_localctx, 37); { - State = 1279; - Match(T__29); - State = 1280; - Match(T__90); - State = 1281; - Match(T__35); - State = 1282; - int32(); - State = 1283; - Match(T__30); + State = 1605; + _localctx.value = Match(STORED_OBJECT); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class VariantTypeContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public VariantTypeElementContext variantTypeElement() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] ARRAY_TYPE_NO_BOUNDS() { return GetTokens(CILParser.ARRAY_TYPE_NO_BOUNDS); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ARRAY_TYPE_NO_BOUNDS(int i) { - return GetToken(CILParser.ARRAY_TYPE_NO_BOUNDS, i); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] VECTOR() { return GetTokens(CILParser.VECTOR); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VECTOR(int i) { - return GetToken(CILParser.VECTOR, i); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] REF() { return GetTokens(CILParser.REF); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode REF(int i) { - return GetToken(CILParser.REF, i); - } - public VariantTypeContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_variantType; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitVariantType(this); - else return visitor.VisitChildren(this); - } - } - - [RuleVersion(0)] - public VariantTypeContext variantType() { - VariantTypeContext _localctx = new VariantTypeContext(Context, State); - EnterRule(_localctx, 156, RULE_variantType); - int _la; - try { - int _alt; - State = 1295; - ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,57,Context) ) { - case 1: - EnterOuterAlt(_localctx, 1); + case BLOB_OBJECT: + EnterOuterAlt(_localctx, 38); { + State = 1607; + _localctx.value = Match(BLOB_OBJECT); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - case 2: - EnterOuterAlt(_localctx, 2); + case CF: + EnterOuterAlt(_localctx, 39); { - State = 1288; - variantTypeElement(); - State = 1292; - ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,56,Context); - while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - State = 1289; - _la = TokenStream.LA(1); - if ( !(((((_la - 228)) & ~0x3f) == 0 && ((1L << (_la - 228)) & 6442450945L) != 0)) ) { - ErrorHandler.RecoverInline(this); - } - else { - ErrorHandler.ReportMatch(this); - Consume(); - } - } - } - } - State = 1294; - ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,56,Context); + State = 1609; + _localctx.value = Match(CF); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } + break; + case CLSID: + EnterOuterAlt(_localctx, 40); + { + State = 1611; + _localctx.value = Match(CLSID); + _localctx.Value = Actions.GetVariantTypeElement(_localctx.value); } break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - ErrorHandler.ReportError(this, re); - ErrorHandler.Recover(this, re); - } - finally { - ExitRule(); - } - return _localctx; - } - - public partial class VariantTypeElementContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NULL() { return GetToken(CILParser.NULL, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VARIANT() { return GetToken(CILParser.VARIANT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CURRENCY() { return GetToken(CILParser.CURRENCY, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VOID() { return GetToken(CILParser.VOID, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BOOL() { return GetToken(CILParser.BOOL, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT8() { return GetToken(CILParser.INT8, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT16() { return GetToken(CILParser.INT16, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT32_() { return GetToken(CILParser.INT32_, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT64_() { return GetToken(CILParser.INT64_, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOAT32() { return GetToken(CILParser.FLOAT32, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOAT64_() { return GetToken(CILParser.FLOAT64_, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT8() { return GetToken(CILParser.UINT8, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT16() { return GetToken(CILParser.UINT16, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT32() { return GetToken(CILParser.UINT32, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT64() { return GetToken(CILParser.UINT64, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PTR() { return GetToken(CILParser.PTR, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DECIMAL() { return GetToken(CILParser.DECIMAL, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DATE() { return GetToken(CILParser.DATE, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BSTR() { return GetToken(CILParser.BSTR, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPSTR() { return GetToken(CILParser.LPSTR, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LPWSTR() { return GetToken(CILParser.LPWSTR, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode IUNKNOWN() { return GetToken(CILParser.IUNKNOWN, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode IDISPATCH() { return GetToken(CILParser.IDISPATCH, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SAFEARRAY() { return GetToken(CILParser.SAFEARRAY, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT() { return GetToken(CILParser.INT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT() { return GetToken(CILParser.UINT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ERROR() { return GetToken(CILParser.ERROR, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode HRESULT() { return GetToken(CILParser.HRESULT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CARRAY() { return GetToken(CILParser.CARRAY, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode USERDEFINED() { return GetToken(CILParser.USERDEFINED, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode RECORD() { return GetToken(CILParser.RECORD, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FILETIME() { return GetToken(CILParser.FILETIME, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BLOB() { return GetToken(CILParser.BLOB, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STREAM() { return GetToken(CILParser.STREAM, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STORAGE() { return GetToken(CILParser.STORAGE, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STREAMED_OBJECT() { return GetToken(CILParser.STREAMED_OBJECT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STORED_OBJECT() { return GetToken(CILParser.STORED_OBJECT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BLOB_OBJECT() { return GetToken(CILParser.BLOB_OBJECT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CF() { return GetToken(CILParser.CF, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CLSID() { return GetToken(CILParser.CLSID, 0); } - public VariantTypeElementContext(ParserRuleContext parent, int invokingState) - : base(parent, invokingState) - { - } - public override int RuleIndex { get { return RULE_variantTypeElement; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitVariantTypeElement(this); - else return visitor.VisitChildren(this); - } - } - - [RuleVersion(0)] - public VariantTypeElementContext variantTypeElement() { - VariantTypeElementContext _localctx = new VariantTypeElementContext(Context, State); - EnterRule(_localctx, 158, RULE_variantTypeElement); - int _la; - try { - EnterOuterAlt(_localctx, 1); - { - State = 1297; - _la = TokenStream.LA(1); - if ( !(((((_la - 177)) & ~0x3f) == 0 && ((1L << (_la - 177)) & -4482436704239647L) != 0) || _la==CLSID || _la==PTR) ) { - ErrorHandler.RecoverInline(this); - } - else { - ErrorHandler.ReportMatch(this); - Consume(); - } + default: + throw new NoViableAltException(this); } } catch (RecognitionException re) { @@ -6849,6 +6983,11 @@ public VariantTypeElementContext variantTypeElement() { } public partial class TypeContext : ParserRuleContext { + public CILParser.TypeValue Value; + public CILParser.ElementTypeValue ElementType; + public System.Collections.Immutable.ImmutableArray.Builder Modifiers; + public ElementTypeContext element; + public TypeModifiersContext modifier; [System.Diagnostics.DebuggerNonUserCode] public ElementTypeContext elementType() { return GetRuleContext(0); } @@ -6863,39 +7002,39 @@ public TypeContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_type; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitType(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TypeContext type() { TypeContext _localctx = new TypeContext(Context, State); - EnterRule(_localctx, 160, RULE_type); + EnterRule(_localctx, 142, RULE_type); + + _localctx.ElementType = CILParser.ElementTypeValue.Error; + _localctx.Modifiers = System.Collections.Immutable.ImmutableArray.CreateBuilder(); + try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 1299; - elementType(); - State = 1303; + State = 1615; + _localctx.element = elementType(); + _localctx.ElementType = _localctx.element.Value; + State = 1622; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,58,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,65,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 1300; - typeModifiers(); - } + State = 1617; + _localctx.modifier = typeModifiers(); + _localctx.Modifiers.Add(_localctx.modifier.Value); } + } } - State = 1305; + State = 1624; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,58,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,65,Context); } } } @@ -6905,203 +7044,172 @@ public TypeContext type() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = new CILParser.TypeValue(_localctx.ElementType, _localctx.Modifiers.ToImmutable()); ExitRule(); } return _localctx; } public partial class TypeModifiersContext : ParserRuleContext { + public CILParser.TypeModifierValue Value; public TypeModifiersContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_typeModifiers; } } - + public TypeModifiersContext() { } public virtual void CopyFrom(TypeModifiersContext context) { base.CopyFrom(context); + this.Value = context.Value; } } public partial class OptionalModifierContext : TypeModifiersContext { + public TypeSpecContext modifierType; [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { return GetRuleContext(0); } public OptionalModifierContext(TypeModifiersContext context) { CopyFrom(context); } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitOptionalModifier(this); - else return visitor.VisitChildren(this); - } } public partial class SZArrayModifierContext : TypeModifiersContext { [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ARRAY_TYPE_NO_BOUNDS() { return GetToken(CILParser.ARRAY_TYPE_NO_BOUNDS, 0); } public SZArrayModifierContext(TypeModifiersContext context) { CopyFrom(context); } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSZArrayModifier(this); - else return visitor.VisitChildren(this); - } } public partial class RequiredModifierContext : TypeModifiersContext { + public TypeSpecContext modifierType; [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { return GetRuleContext(0); } public RequiredModifierContext(TypeModifiersContext context) { CopyFrom(context); } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitRequiredModifier(this); - else return visitor.VisitChildren(this); - } } public partial class PtrModifierContext : TypeModifiersContext { [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PTR() { return GetToken(CILParser.PTR, 0); } public PtrModifierContext(TypeModifiersContext context) { CopyFrom(context); } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitPtrModifier(this); - else return visitor.VisitChildren(this); - } } public partial class PinnedModifierContext : TypeModifiersContext { public PinnedModifierContext(TypeModifiersContext context) { CopyFrom(context); } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitPinnedModifier(this); - else return visitor.VisitChildren(this); - } } public partial class GenericArgumentsModifierContext : TypeModifiersContext { + public TypeArgsContext arguments; [System.Diagnostics.DebuggerNonUserCode] public TypeArgsContext typeArgs() { return GetRuleContext(0); } public GenericArgumentsModifierContext(TypeModifiersContext context) { CopyFrom(context); } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitGenericArgumentsModifier(this); - else return visitor.VisitChildren(this); - } } public partial class ByRefModifierContext : TypeModifiersContext { [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode REF() { return GetToken(CILParser.REF, 0); } public ByRefModifierContext(TypeModifiersContext context) { CopyFrom(context); } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitByRefModifier(this); - else return visitor.VisitChildren(this); - } } public partial class ArrayModifierContext : TypeModifiersContext { + public BoundsContext arrayBounds; [System.Diagnostics.DebuggerNonUserCode] public BoundsContext bounds() { return GetRuleContext(0); } public ArrayModifierContext(TypeModifiersContext context) { CopyFrom(context); } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitArrayModifier(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TypeModifiersContext typeModifiers() { TypeModifiersContext _localctx = new TypeModifiersContext(Context, State); - EnterRule(_localctx, 162, RULE_typeModifiers); + EnterRule(_localctx, 144, RULE_typeModifiers); + _localctx.Value = CILParser.TypeModifierValue.Error; try { - State = 1324; + State = 1654; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,59,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,66,Context) ) { case 1: _localctx = new SZArrayModifierContext(_localctx); EnterOuterAlt(_localctx, 1); { - State = 1306; + State = 1625; Match(ARRAY_TYPE_NO_BOUNDS); + _localctx.Value = Actions.CreateSzArrayTypeModifier(); } break; case 2: _localctx = new SZArrayModifierContext(_localctx); EnterOuterAlt(_localctx, 2); { - State = 1307; + State = 1627; Match(T__41); - State = 1308; + State = 1628; Match(T__42); + _localctx.Value = Actions.CreateSzArrayTypeModifier(); } break; case 3: _localctx = new ArrayModifierContext(_localctx); EnterOuterAlt(_localctx, 3); { - State = 1309; - bounds(); + State = 1630; + ((ArrayModifierContext)_localctx).arrayBounds = bounds(); + _localctx.Value = Actions.CreateArrayTypeModifier(((ArrayModifierContext)_localctx).arrayBounds.Value); } break; case 4: _localctx = new ByRefModifierContext(_localctx); EnterOuterAlt(_localctx, 4); { - State = 1310; + State = 1633; Match(REF); + _localctx.Value = Actions.CreateByReferenceTypeModifier(); } break; case 5: _localctx = new PtrModifierContext(_localctx); EnterOuterAlt(_localctx, 5); { - State = 1311; + State = 1635; Match(PTR); + _localctx.Value = Actions.CreatePointerTypeModifier(); } break; case 6: _localctx = new PinnedModifierContext(_localctx); EnterOuterAlt(_localctx, 6); { - State = 1312; + State = 1637; Match(T__91); + _localctx.Value = Actions.CreatePinnedTypeModifier(); } break; case 7: _localctx = new RequiredModifierContext(_localctx); EnterOuterAlt(_localctx, 7); { - State = 1313; + State = 1639; Match(T__92); - State = 1314; + State = 1640; Match(T__29); - State = 1315; - typeSpec(); - State = 1316; + State = 1641; + ((RequiredModifierContext)_localctx).modifierType = typeSpec(); + State = 1642; Match(T__30); + _localctx.Value = Actions.CreateCustomTypeModifier(((RequiredModifierContext)_localctx).modifierType.Value, true); } break; case 8: _localctx = new OptionalModifierContext(_localctx); EnterOuterAlt(_localctx, 8); { - State = 1318; + State = 1645; Match(T__93); - State = 1319; + State = 1646; Match(T__29); - State = 1320; - typeSpec(); - State = 1321; + State = 1647; + ((OptionalModifierContext)_localctx).modifierType = typeSpec(); + State = 1648; Match(T__30); + _localctx.Value = Actions.CreateCustomTypeModifier(((OptionalModifierContext)_localctx).modifierType.Value, false); } break; case 9: _localctx = new GenericArgumentsModifierContext(_localctx); EnterOuterAlt(_localctx, 9); { - State = 1323; - typeArgs(); + State = 1651; + ((GenericArgumentsModifierContext)_localctx).arguments = typeArgs(); + _localctx.Value = Actions.CreateGenericArgumentsModifier(((GenericArgumentsModifierContext)_localctx).arguments.Value); } break; } @@ -7118,6 +7226,20 @@ public TypeModifiersContext typeModifiers() { } public partial class ElementTypeContext : ParserRuleContext { + public CILParser.ElementTypeValue Value; + public ClassNameContext classType; + public ClassNameContext valueClassType; + public ClassNameContext valueType; + public CallConvContext convention; + public TypeContext returnType; + public SigArgsContext arguments; + public Int32Context parameterIndex; + public DottedNameContext parameterName; + public NativeIntContext signedNative; + public NativeUintContext unsignedNative; + public SimpleTypeContext primitive; + public DottedNameContext alias; + public TypeContext sentinelType; [System.Diagnostics.DebuggerNonUserCode] public ClassNameContext className() { return GetRuleContext(0); } @@ -7125,13 +7247,13 @@ [System.Diagnostics.DebuggerNonUserCode] public ClassNameContext className() { [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VALUE() { return GetToken(CILParser.VALUE, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VALUETYPE() { return GetToken(CILParser.VALUETYPE, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode METHOD() { return GetToken(CILParser.METHOD, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PTR() { return GetToken(CILParser.PTR, 0); } [System.Diagnostics.DebuggerNonUserCode] public CallConvContext callConv() { return GetRuleContext(0); } [System.Diagnostics.DebuggerNonUserCode] public TypeContext type() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PTR() { return GetToken(CILParser.PTR, 0); } [System.Diagnostics.DebuggerNonUserCode] public SigArgsContext sigArgs() { return GetRuleContext(0); } @@ -7160,158 +7282,169 @@ public ElementTypeContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_elementType; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitElementType(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ElementTypeContext elementType() { ElementTypeContext _localctx = new ElementTypeContext(Context, State); - EnterRule(_localctx, 164, RULE_elementType); + EnterRule(_localctx, 146, RULE_elementType); + _localctx.Value = CILParser.ElementTypeValue.Error; try { - State = 1356; + State = 1714; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,60,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,67,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 1326; + State = 1656; Match(T__38); - State = 1327; - className(); + State = 1657; + _localctx.classType = className(); + _localctx.Value = Actions.CreateClassElementType(_localctx.classType.Value, false); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 1328; + State = 1660; Match(OBJECT); + _localctx.Value = Actions.CreateObjectElementType(); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 1329; + State = 1662; Match(VALUE); - State = 1330; + State = 1663; Match(T__38); - State = 1331; - className(); + State = 1664; + _localctx.valueClassType = className(); + _localctx.Value = Actions.CreateClassElementType(_localctx.valueClassType.Value, true); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 1332; + State = 1667; Match(VALUETYPE); - State = 1333; - className(); + State = 1668; + _localctx.valueType = className(); + _localctx.Value = Actions.CreateClassElementType(_localctx.valueType.Value, true); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 1334; + State = 1671; Match(METHOD); - State = 1335; - callConv(); - State = 1336; - type(); - State = 1337; + State = 1672; + _localctx.convention = callConv(); + State = 1673; + _localctx.returnType = type(); + State = 1674; Match(PTR); - State = 1338; - sigArgs(); + State = 1675; + _localctx.arguments = sigArgs(); + _localctx.Value = Actions.CreateFunctionPointerElementType(_localctx.convention.Value, _localctx.returnType.Value, _localctx.arguments.Value); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 1340; + State = 1678; Match(METHOD_TYPE_PARAMETER); - State = 1341; - int32(); + State = 1679; + _localctx.parameterIndex = int32(); + _localctx.Value = Actions.CreateIndexedGenericParameterElementType(true, (_localctx.parameterIndex!=null?(_localctx.parameterIndex.Start):null)); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 1342; + State = 1682; Match(TYPE_PARAMETER); - State = 1343; - int32(); + State = 1683; + _localctx.parameterIndex = int32(); + _localctx.Value = Actions.CreateIndexedGenericParameterElementType(false, (_localctx.parameterIndex!=null?(_localctx.parameterIndex.Start):null)); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 1344; + State = 1686; Match(METHOD_TYPE_PARAMETER); - State = 1345; - dottedName(); + State = 1687; + _localctx.parameterName = dottedName(); + _localctx.Value = Actions.CreateNamedGenericParameterElementType(_localctx.Start, true, _localctx.parameterName.Value); } break; case 9: EnterOuterAlt(_localctx, 9); { - State = 1346; + State = 1690; Match(TYPE_PARAMETER); - State = 1347; - dottedName(); + State = 1691; + _localctx.parameterName = dottedName(); + _localctx.Value = Actions.CreateNamedGenericParameterElementType(_localctx.Start, false, _localctx.parameterName.Value); } break; case 10: EnterOuterAlt(_localctx, 10); { - State = 1348; + State = 1694; Match(TYPEDREF); + _localctx.Value = Actions.CreateTypedReferenceElementType(); } break; case 11: EnterOuterAlt(_localctx, 11); { - State = 1349; + State = 1696; Match(VOID); + _localctx.Value = Actions.CreateVoidElementType(); } break; case 12: EnterOuterAlt(_localctx, 12); { - State = 1350; - nativeInt(); + State = 1698; + _localctx.signedNative = nativeInt(); + _localctx.Value = Actions.CreatePrimitiveElementType(_localctx.signedNative.Value); } break; case 13: EnterOuterAlt(_localctx, 13); { - State = 1351; - nativeUint(); + State = 1701; + _localctx.unsignedNative = nativeUint(); + _localctx.Value = Actions.CreatePrimitiveElementType(_localctx.unsignedNative.Value); } break; case 14: EnterOuterAlt(_localctx, 14); { - State = 1352; - simpleType(); + State = 1704; + _localctx.primitive = simpleType(); + _localctx.Value = Actions.CreatePrimitiveElementType(_localctx.primitive.Value); } break; case 15: EnterOuterAlt(_localctx, 15); { - State = 1353; - dottedName(); + State = 1707; + _localctx.alias = dottedName(); + _localctx.Value = Actions.CreateTypedefElementType(_localctx.Start, _localctx.alias.Value); } break; case 16: EnterOuterAlt(_localctx, 16); { - State = 1354; + State = 1710; Match(ELLIPSIS); - State = 1355; - type(); + State = 1711; + _localctx.sentinelType = type(); + _localctx.Value = Actions.CreateSentinelElementType(_localctx.sentinelType.Value); } break; } @@ -7328,6 +7461,8 @@ public ElementTypeContext elementType() { } public partial class SimpleTypeContext : ParserRuleContext { + public byte Value; + public IToken value; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CHAR() { return GetToken(CILParser.CHAR, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STRING() { return GetToken(CILParser.STRING, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode BOOL() { return GetToken(CILParser.BOOL, 0); } @@ -7346,147 +7481,158 @@ public SimpleTypeContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_simpleType; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSimpleType(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public SimpleTypeContext simpleType() { SimpleTypeContext _localctx = new SimpleTypeContext(Context, State); - EnterRule(_localctx, 166, RULE_simpleType); + EnterRule(_localctx, 148, RULE_simpleType); try { - State = 1379; + State = 1754; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,61,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,68,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 1358; - Match(CHAR); + State = 1716; + _localctx.value = Match(CHAR); + _localctx.Value = Actions.GetSimpleType(_localctx.value, false); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 1359; - Match(STRING); + State = 1718; + _localctx.value = Match(STRING); + _localctx.Value = Actions.GetSimpleType(_localctx.value, false); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 1360; - Match(BOOL); + State = 1720; + _localctx.value = Match(BOOL); + _localctx.Value = Actions.GetSimpleType(_localctx.value, false); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 1361; - Match(INT8); + State = 1722; + _localctx.value = Match(INT8); + _localctx.Value = Actions.GetSimpleType(_localctx.value, false); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 1362; - Match(INT16); + State = 1724; + _localctx.value = Match(INT16); + _localctx.Value = Actions.GetSimpleType(_localctx.value, false); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 1363; - Match(INT32_); + State = 1726; + _localctx.value = Match(INT32_); + _localctx.Value = Actions.GetSimpleType(_localctx.value, false); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 1364; - Match(INT64_); + State = 1728; + _localctx.value = Match(INT64_); + _localctx.Value = Actions.GetSimpleType(_localctx.value, false); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 1365; - Match(FLOAT32); + State = 1730; + _localctx.value = Match(FLOAT32); + _localctx.Value = Actions.GetSimpleType(_localctx.value, false); } break; case 9: EnterOuterAlt(_localctx, 9); { - State = 1366; - Match(FLOAT64_); + State = 1732; + _localctx.value = Match(FLOAT64_); + _localctx.Value = Actions.GetSimpleType(_localctx.value, false); } break; case 10: EnterOuterAlt(_localctx, 10); { - State = 1367; - Match(UINT8); + State = 1734; + _localctx.value = Match(UINT8); + _localctx.Value = Actions.GetSimpleType(_localctx.value, false); } break; case 11: EnterOuterAlt(_localctx, 11); { - State = 1368; - Match(UINT16); + State = 1736; + _localctx.value = Match(UINT16); + _localctx.Value = Actions.GetSimpleType(_localctx.value, false); } break; case 12: EnterOuterAlt(_localctx, 12); { - State = 1369; - Match(UINT32); + State = 1738; + _localctx.value = Match(UINT32); + _localctx.Value = Actions.GetSimpleType(_localctx.value, false); } break; case 13: EnterOuterAlt(_localctx, 13); { - State = 1370; - Match(UINT64); + State = 1740; + _localctx.value = Match(UINT64); + _localctx.Value = Actions.GetSimpleType(_localctx.value, false); } break; case 14: EnterOuterAlt(_localctx, 14); { - State = 1371; + State = 1742; Match(T__89); - State = 1372; - Match(INT8); + State = 1743; + _localctx.value = Match(INT8); + _localctx.Value = Actions.GetSimpleType(_localctx.value, true); } break; case 15: EnterOuterAlt(_localctx, 15); { - State = 1373; + State = 1745; Match(T__89); - State = 1374; - Match(INT16); + State = 1746; + _localctx.value = Match(INT16); + _localctx.Value = Actions.GetSimpleType(_localctx.value, true); } break; case 16: EnterOuterAlt(_localctx, 16); { - State = 1375; + State = 1748; Match(T__89); - State = 1376; - Match(INT32_); + State = 1749; + _localctx.value = Match(INT32_); + _localctx.Value = Actions.GetSimpleType(_localctx.value, true); } break; case 17: EnterOuterAlt(_localctx, 17); { - State = 1377; + State = 1751; Match(T__89); - State = 1378; - Match(INT64_); + State = 1752; + _localctx.value = Match(INT64_); + _localctx.Value = Actions.GetSimpleType(_localctx.value, true); } break; } @@ -7503,6 +7649,13 @@ public SimpleTypeContext simpleType() { } public partial class BoundContext : ParserRuleContext { + public int Lower; + public int Upper; + public bool HasLower; + public bool HasUpper; + public Int32Context size; + public Int32Context lower; + public Int32Context upper; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ELLIPSIS() { return GetToken(CILParser.ELLIPSIS, 0); } [System.Diagnostics.DebuggerNonUserCode] public Int32Context[] int32() { return GetRuleContexts(); @@ -7515,22 +7668,17 @@ public BoundContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_bound; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitBound(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public BoundContext bound() { BoundContext _localctx = new BoundContext(Context, State); - EnterRule(_localctx, 168, RULE_bound); + EnterRule(_localctx, 150, RULE_bound); + Actions.InitializeBound(_localctx); try { - State = 1391; + State = 1770; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,62,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,69,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { @@ -7539,35 +7687,38 @@ public BoundContext bound() { case 2: EnterOuterAlt(_localctx, 2); { - State = 1382; + State = 1757; Match(ELLIPSIS); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 1383; - int32(); + State = 1758; + _localctx.size = int32(); + Actions.SetBoundSize(_localctx, (_localctx.size!=null?(_localctx.size.Start):null)); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 1384; - int32(); - State = 1385; + State = 1761; + _localctx.lower = int32(); + State = 1762; Match(ELLIPSIS); - State = 1386; - int32(); + State = 1763; + _localctx.upper = int32(); + Actions.SetBoundRange(_localctx, (_localctx.lower!=null?(_localctx.lower.Start):null), (_localctx.upper!=null?(_localctx.upper.Start):null)); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 1388; - int32(); - State = 1389; + State = 1766; + _localctx.lower = int32(); + State = 1767; Match(ELLIPSIS); + Actions.SetBoundLower(_localctx, (_localctx.lower!=null?(_localctx.lower.Start):null)); } break; } @@ -7584,31 +7735,27 @@ public BoundContext bound() { } public partial class NativeIntContext : ParserRuleContext { + public byte Value; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT() { return GetToken(CILParser.INT, 0); } public NativeIntContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_nativeInt; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitNativeInt(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public NativeIntContext nativeInt() { NativeIntContext _localctx = new NativeIntContext(Context, State); - EnterRule(_localctx, 170, RULE_nativeInt); + EnterRule(_localctx, 152, RULE_nativeInt); try { EnterOuterAlt(_localctx, 1); { - State = 1393; + State = 1772; Match(T__0); - State = 1394; + State = 1773; Match(INT); + _localctx.Value = Actions.GetNativeIntType(); } } catch (RecognitionException re) { @@ -7623,6 +7770,7 @@ public NativeIntContext nativeInt() { } public partial class NativeUintContext : ParserRuleContext { + public byte Value; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT() { return GetToken(CILParser.INT, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UINT() { return GetToken(CILParser.UINT, 0); } public NativeUintContext(ParserRuleContext parent, int invokingState) @@ -7630,43 +7778,38 @@ public NativeUintContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_nativeUint; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitNativeUint(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public NativeUintContext nativeUint() { NativeUintContext _localctx = new NativeUintContext(Context, State); - EnterRule(_localctx, 172, RULE_nativeUint); + EnterRule(_localctx, 154, RULE_nativeUint); try { EnterOuterAlt(_localctx, 1); { - State = 1396; + State = 1776; Match(T__0); - State = 1400; + State = 1780; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__89: { - State = 1397; + State = 1777; Match(T__89); - State = 1398; + State = 1778; Match(INT); } break; case UINT: { - State = 1399; + State = 1779; Match(UINT); } break; default: throw new NoViableAltException(this); } + _localctx.Value = Actions.GetNativeUIntType(); } } catch (RecognitionException re) { @@ -7681,6 +7824,16 @@ public NativeUintContext nativeUint() { } public partial class SecDeclContext : ParserRuleContext { + public CILParser.SecurityDeclarationValue? Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public SecActionContext action; + public TypeSpecContext permissionType; + public NameValPairsContext pairs; + public CustomBlobDescrContext structuredValue; + public BytesContext rawValue; + public CompQstringContext textValue; + public SecAttrSetBlobContext attributes; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PERMISSION() { return GetToken(CILParser.PERMISSION, 0); } [System.Diagnostics.DebuggerNonUserCode] public SecActionContext secAction() { return GetRuleContext(0); @@ -7709,140 +7862,148 @@ public SecDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_secDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSecDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public SecDeclContext secDecl() { SecDeclContext _localctx = new SecDeclContext(Context, State); - EnterRule(_localctx, 174, RULE_secDecl); + EnterRule(_localctx, 156, RULE_secDecl); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; int _la; try { - State = 1449; + State = 1838; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,65,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,72,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 1402; + State = 1784; Match(PERMISSION); - State = 1403; - secAction(); - State = 1404; - typeSpec(); - State = 1405; + State = 1785; + _localctx.action = secAction(); + State = 1786; + _localctx.permissionType = typeSpec(); + State = 1787; Match(T__29); - State = 1406; - nameValPairs(); - State = 1407; + State = 1788; + _localctx.pairs = nameValPairs(); + State = 1789; Match(T__30); + _localctx.Value = Actions.CreateNamedPermissionDeclaration( + _localctx.action.Value, + _localctx.permissionType.Value, + _localctx.pairs.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 1409; + State = 1792; Match(PERMISSION); - State = 1410; - secAction(); - State = 1411; - typeSpec(); - State = 1412; + State = 1793; + _localctx.action = secAction(); + State = 1794; + _localctx.permissionType = typeSpec(); + State = 1795; Match(T__35); - State = 1413; + State = 1796; Match(T__16); - State = 1414; - customBlobDescr(); - State = 1415; + State = 1797; + _localctx.structuredValue = customBlobDescr(); + State = 1798; Match(T__17); + _localctx.Value = Actions.CreateStructuredPermissionDeclaration( + _localctx.action.Value, + _localctx.permissionType.Value, + _localctx.structuredValue.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 1417; + State = 1801; Match(PERMISSION); - State = 1418; - secAction(); - State = 1419; - typeSpec(); + State = 1802; + _localctx.action = secAction(); + State = 1803; + _localctx.permissionType = typeSpec(); + _localctx.Value = Actions.CreateEmptyPermissionDeclaration(_localctx.action.Value, _localctx.permissionType.Value); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 1421; + State = 1806; Match(PERMISSIONSET); - State = 1422; - secAction(); - State = 1423; + State = 1807; + _localctx.action = secAction(); + State = 1808; Match(T__35); - State = 1425; + State = 1810; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==T__83) { { - State = 1424; + State = 1809; Match(T__83); } } - State = 1427; + State = 1812; Match(T__29); - State = 1428; - bytes(); - State = 1429; + State = 1813; + _localctx.rawValue = bytes(); + State = 1814; Match(T__30); + _localctx.Value = Actions.CreateRawPermissionSetDeclaration(_localctx.action.Value, _localctx.rawValue.Value); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 1431; + State = 1817; Match(PERMISSIONSET); - State = 1432; - secAction(); - State = 1433; + State = 1818; + _localctx.action = secAction(); + State = 1819; Match(T__83); - State = 1434; + State = 1820; Match(T__29); - State = 1435; - bytes(); - State = 1436; + State = 1821; + _localctx.rawValue = bytes(); + State = 1822; Match(T__30); + _localctx.Value = Actions.CreateRawPermissionSetDeclaration(_localctx.action.Value, _localctx.rawValue.Value); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 1438; + State = 1825; Match(PERMISSIONSET); - State = 1439; - secAction(); - State = 1440; - compQstring(); + State = 1826; + _localctx.action = secAction(); + State = 1827; + _localctx.textValue = compQstring(); + _localctx.Value = Actions.CreateStringPermissionSetDeclaration(_localctx.action.Value, _localctx.textValue.Value); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 1442; + State = 1830; Match(PERMISSIONSET); - State = 1443; - secAction(); - State = 1444; + State = 1831; + _localctx.action = secAction(); + State = 1832; Match(T__35); - State = 1445; + State = 1833; Match(T__16); - State = 1446; - secAttrSetBlob(); - State = 1447; + State = 1834; + _localctx.attributes = secAttrSetBlob(); + State = 1835; Match(T__17); + _localctx.Value = Actions.CreateAttributePermissionSetDeclaration(_localctx.action.Value, _localctx.attributes.Value); } break; } @@ -7853,12 +8014,17 @@ public SecDeclContext secDecl() { ErrorHandler.Recover(this, re); } finally { + Actions.EndSecurityDeclaration(_localctx, _localctx.InitialSyntaxErrorCount); ExitRule(); } return _localctx; } public partial class SecAttrSetBlobContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public SecAttrBlobContext attribute; + public SecAttrBlobContext tail; [System.Diagnostics.DebuggerNonUserCode] public SecAttrBlobContext[] secAttrBlob() { return GetRuleContexts(); } @@ -7870,21 +8036,16 @@ public SecAttrSetBlobContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_secAttrSetBlob; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSecAttrSetBlob(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public SecAttrSetBlobContext secAttrSetBlob() { SecAttrSetBlobContext _localctx = new SecAttrSetBlobContext(Context, State); - EnterRule(_localctx, 176, RULE_secAttrSetBlob); + EnterRule(_localctx, 158, RULE_secAttrSetBlob); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); try { int _alt; - State = 1461; + State = 1853; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__17: @@ -7929,26 +8090,28 @@ public SecAttrSetBlobContext secAttrSetBlob() { case ID: EnterOuterAlt(_localctx, 2); { - State = 1457; + State = 1847; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,66,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,73,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 1452; - secAttrBlob(); - State = 1453; + State = 1841; + _localctx.attribute = secAttrBlob(); + _localctx.Builder.Add(_localctx.attribute.Value); + State = 1843; Match(T__27); } - } + } } - State = 1459; + State = 1849; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,66,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,73,Context); } - State = 1460; - secAttrBlob(); + State = 1850; + _localctx.tail = secAttrBlob(); + _localctx.Builder.Add(_localctx.tail.Value); } break; default: @@ -7961,12 +8124,17 @@ public SecAttrSetBlobContext secAttrSetBlob() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } public partial class SecAttrBlobContext : ParserRuleContext { + public CILParser.SecurityAttributeValue Value; + public IToken name; + public CustomBlobNVPairsContext arguments; + public TypeSpecContext securityType; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SQSTRING() { return GetToken(CILParser.SQSTRING, 0); } [System.Diagnostics.DebuggerNonUserCode] public CustomBlobNVPairsContext customBlobNVPairs() { return GetRuleContext(0); @@ -7979,52 +8147,49 @@ public SecAttrBlobContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_secAttrBlob; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSecAttrBlob(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public SecAttrBlobContext secAttrBlob() { SecAttrBlobContext _localctx = new SecAttrBlobContext(Context, State); - EnterRule(_localctx, 178, RULE_secAttrBlob); + EnterRule(_localctx, 160, RULE_secAttrBlob); + _localctx.Value = CILParser.SecurityAttributeValue.Error; try { - State = 1476; + State = 1870; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,68,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,75,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 1463; + State = 1855; Match(T__38); - State = 1464; - Match(SQSTRING); - State = 1465; + State = 1856; + _localctx.name = Match(SQSTRING); + State = 1857; Match(T__35); - State = 1466; + State = 1858; Match(T__16); - State = 1467; - customBlobNVPairs(); - State = 1468; + State = 1859; + _localctx.arguments = customBlobNVPairs(); + State = 1860; Match(T__17); + _localctx.Value = Actions.CreateNamedSecurityAttribute(_localctx.name, _localctx.arguments.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 1470; - typeSpec(); - State = 1471; + State = 1863; + _localctx.securityType = typeSpec(); + State = 1864; Match(T__35); - State = 1472; + State = 1865; Match(T__16); - State = 1473; - customBlobNVPairs(); - State = 1474; + State = 1866; + _localctx.arguments = customBlobNVPairs(); + State = 1867; Match(T__17); + _localctx.Value = Actions.CreateTypedSecurityAttribute(_localctx.securityType.Value, _localctx.arguments.Value); } break; } @@ -8041,6 +8206,10 @@ public SecAttrBlobContext secAttrBlob() { } public partial class NameValPairsContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public NameValPairContext pair; + public NameValPairContext tail; [System.Diagnostics.DebuggerNonUserCode] public NameValPairContext[] nameValPair() { return GetRuleContexts(); } @@ -8052,42 +8221,39 @@ public NameValPairsContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_nameValPairs; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitNameValPairs(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public NameValPairsContext nameValPairs() { NameValPairsContext _localctx = new NameValPairsContext(Context, State); - EnterRule(_localctx, 180, RULE_nameValPairs); + EnterRule(_localctx, 162, RULE_nameValPairs); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 1483; + State = 1878; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,69,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,76,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 1478; - nameValPair(); - State = 1479; + State = 1872; + _localctx.pair = nameValPair(); + _localctx.Builder.Add(_localctx.pair.Value); + State = 1874; Match(T__27); } - } + } } - State = 1485; + State = 1880; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,69,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,76,Context); } - State = 1486; - nameValPair(); + State = 1881; + _localctx.tail = nameValPair(); + _localctx.Builder.Add(_localctx.tail.Value); } } catch (RecognitionException re) { @@ -8096,12 +8262,16 @@ public NameValPairsContext nameValPairs() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } public partial class NameValPairContext : ParserRuleContext { + public CILParser.SecurityNameValuePairValue Value; + public CompQstringContext name; + public CaValueContext value; [System.Diagnostics.DebuggerNonUserCode] public CompQstringContext compQstring() { return GetRuleContext(0); } @@ -8113,27 +8283,23 @@ public NameValPairContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_nameValPair; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitNameValPair(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public NameValPairContext nameValPair() { NameValPairContext _localctx = new NameValPairContext(Context, State); - EnterRule(_localctx, 182, RULE_nameValPair); + EnterRule(_localctx, 164, RULE_nameValPair); + _localctx.Value = CILParser.SecurityNameValuePairValue.Error; try { EnterOuterAlt(_localctx, 1); { - State = 1488; - compQstring(); - State = 1489; + State = 1884; + _localctx.name = compQstring(); + State = 1885; Match(T__35); - State = 1490; - caValue(); + State = 1886; + _localctx.value = caValue(); + _localctx.Value = Actions.CreateSecurityNameValuePair(_localctx.name.Value, _localctx.value.Value); } } catch (RecognitionException re) { @@ -8148,28 +8314,23 @@ public NameValPairContext nameValPair() { } public partial class TruefalseContext : ParserRuleContext { + public bool Value; public TruefalseContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_truefalse; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTruefalse(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TruefalseContext truefalse() { TruefalseContext _localctx = new TruefalseContext(Context, State); - EnterRule(_localctx, 184, RULE_truefalse); + EnterRule(_localctx, 166, RULE_truefalse); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 1492; + State = 1889; _la = TokenStream.LA(1); if ( !(_la==T__94 || _la==T__95) ) { ErrorHandler.RecoverInline(this); @@ -8179,6 +8340,8 @@ public TruefalseContext truefalse() { Consume(); } } + Context.Stop = TokenStream.LT(-1); + _localctx.Value = Actions.ParseBoolean(_localctx.Start); } catch (RecognitionException re) { _localctx.exception = re; @@ -8192,6 +8355,13 @@ public TruefalseContext truefalse() { } public partial class CaValueContext : ParserRuleContext { + public CILParser.SecurityCaValue Value; + public TruefalseContext booleanValue; + public Int32Context integerValue; + public CompQstringContext textValue; + public ClassNameContext enumType; + public IToken kind; + public Int32Context enumValue; [System.Diagnostics.DebuggerNonUserCode] public TruefalseContext truefalse() { return GetRuleContext(0); } @@ -8212,118 +8382,121 @@ public CaValueContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_caValue; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCaValue(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public CaValueContext caValue() { CaValueContext _localctx = new CaValueContext(Context, State); - EnterRule(_localctx, 186, RULE_caValue); + EnterRule(_localctx, 168, RULE_caValue); + _localctx.Value = CILParser.SecurityCaValue.Error; try { - State = 1528; + State = 1936; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,70,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,77,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 1494; - truefalse(); + State = 1891; + _localctx.booleanValue = truefalse(); + _localctx.Value = Actions.CreateSecurityBooleanValue(_localctx.booleanValue.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 1495; - int32(); + State = 1894; + _localctx.integerValue = int32(); + _localctx.Value = Actions.CreateSecurityInt32Value((_localctx.integerValue!=null?(_localctx.integerValue.Start):null)); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 1496; + State = 1897; Match(INT32_); - State = 1497; + State = 1898; Match(T__29); - State = 1498; - int32(); - State = 1499; + State = 1899; + _localctx.integerValue = int32(); + State = 1900; Match(T__30); + _localctx.Value = Actions.CreateSecurityInt32Value((_localctx.integerValue!=null?(_localctx.integerValue.Start):null)); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 1501; - compQstring(); + State = 1903; + _localctx.textValue = compQstring(); + _localctx.Value = Actions.CreateSecurityStringValue(_localctx.textValue.Value); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 1502; - className(); - State = 1503; + State = 1906; + _localctx.enumType = className(); + State = 1907; Match(T__29); - State = 1504; - Match(INT8); - State = 1505; + State = 1908; + _localctx.kind = Match(INT8); + State = 1909; Match(T__74); - State = 1506; - int32(); - State = 1507; + State = 1910; + _localctx.enumValue = int32(); + State = 1911; Match(T__30); + _localctx.Value = Actions.CreateSecurityEnumValue(_localctx.enumType.Value, _localctx.kind, (_localctx.enumValue!=null?(_localctx.enumValue.Start):null)); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 1509; - className(); - State = 1510; + State = 1914; + _localctx.enumType = className(); + State = 1915; Match(T__29); - State = 1511; - Match(INT16); - State = 1512; + State = 1916; + _localctx.kind = Match(INT16); + State = 1917; Match(T__74); - State = 1513; - int32(); - State = 1514; + State = 1918; + _localctx.enumValue = int32(); + State = 1919; Match(T__30); + _localctx.Value = Actions.CreateSecurityEnumValue(_localctx.enumType.Value, _localctx.kind, (_localctx.enumValue!=null?(_localctx.enumValue.Start):null)); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 1516; - className(); - State = 1517; + State = 1922; + _localctx.enumType = className(); + State = 1923; Match(T__29); - State = 1518; - Match(INT32_); - State = 1519; + State = 1924; + _localctx.kind = Match(INT32_); + State = 1925; Match(T__74); - State = 1520; - int32(); - State = 1521; + State = 1926; + _localctx.enumValue = int32(); + State = 1927; Match(T__30); + _localctx.Value = Actions.CreateSecurityEnumValue(_localctx.enumType.Value, _localctx.kind, (_localctx.enumValue!=null?(_localctx.enumValue.Start):null)); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 1523; - className(); - State = 1524; + State = 1930; + _localctx.enumType = className(); + State = 1931; Match(T__29); - State = 1525; - int32(); - State = 1526; + State = 1932; + _localctx.enumValue = int32(); + State = 1933; Match(T__30); + _localctx.Value = Actions.CreateSecurityEnumValue(_localctx.enumType.Value, (_localctx.enumValue!=null?(_localctx.enumValue.Start):null)); } break; } @@ -8340,28 +8513,23 @@ public CaValueContext caValue() { } public partial class SecActionContext : ParserRuleContext { + public System.Reflection.DeclarativeSecurityAction Value; public SecActionContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_secAction; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSecAction(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public SecActionContext secAction() { SecActionContext _localctx = new SecActionContext(Context, State); - EnterRule(_localctx, 188, RULE_secAction); + EnterRule(_localctx, 170, RULE_secAction); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 1530; + State = 1938; _la = TokenStream.LA(1); if ( !(((((_la - 97)) & ~0x3f) == 0 && ((1L << (_la - 97)) & 32767L) != 0)) ) { ErrorHandler.RecoverInline(this); @@ -8371,6 +8539,8 @@ public SecActionContext secAction() { Consume(); } } + Context.Stop = TokenStream.LT(-1); + _localctx.Value = Actions.ParseSecurityAction(_localctx.Start); } catch (RecognitionException re) { _localctx.exception = re; @@ -8384,16 +8554,28 @@ public SecActionContext secAction() { } public partial class MethodRefContext : ParserRuleContext { + public CILParser.MethodReferenceValue Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public CallConvContext convention; + public TypeContext returnType; + public TypeSpecOrScopeContext owner; + public MethodNameContext name; + public TypeArgsContext genericArguments; + public SigArgsContext arguments; + public GenArityNotEmptyContext genericArity; + public MdtokenContext token; + public DottedNameContext alias; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DCOLON() { return GetToken(CILParser.DCOLON, 0); } [System.Diagnostics.DebuggerNonUserCode] public CallConvContext callConv() { return GetRuleContext(0); } [System.Diagnostics.DebuggerNonUserCode] public TypeContext type() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { - return GetRuleContext(0); + [System.Diagnostics.DebuggerNonUserCode] public TypeSpecOrScopeContext typeSpecOrScope() { + return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DCOLON() { return GetToken(CILParser.DCOLON, 0); } [System.Diagnostics.DebuggerNonUserCode] public MethodNameContext methodName() { return GetRuleContext(0); } @@ -8417,119 +8599,123 @@ public MethodRefContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_methodRef; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitMethodRef(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public MethodRefContext methodRef() { MethodRefContext _localctx = new MethodRefContext(Context, State); - EnterRule(_localctx, 190, RULE_methodRef); + EnterRule(_localctx, 172, RULE_methodRef); + + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.MethodReferenceValue.Error; + int _la; try { - State = 1566; + State = 1982; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,73,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,80,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 1532; - callConv(); - State = 1533; - type(); - State = 1534; - typeSpec(); - State = 1535; + State = 1940; + _localctx.convention = callConv(); + State = 1941; + _localctx.returnType = type(); + State = 1942; + _localctx.owner = typeSpecOrScope(); + State = 1943; Match(DCOLON); - State = 1536; - methodName(); - State = 1538; + State = 1944; + _localctx.name = methodName(); + State = 1946; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==T__85) { { - State = 1537; - typeArgs(); + State = 1945; + _localctx.genericArguments = typeArgs(); } } - State = 1540; - sigArgs(); + State = 1948; + _localctx.arguments = sigArgs(); + _localctx.Value = Actions.CreateMethodReference(_localctx.Start, _localctx.convention.Value, _localctx.returnType.Value, _localctx.owner.Value, _localctx.name.Value, _localctx.genericArguments is null ? null : _localctx.genericArguments.Value, null, _localctx.arguments.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 1542; - callConv(); - State = 1543; - type(); - State = 1544; - typeSpec(); - State = 1545; + State = 1951; + _localctx.convention = callConv(); + State = 1952; + _localctx.returnType = type(); + State = 1953; + _localctx.owner = typeSpecOrScope(); + State = 1954; Match(DCOLON); - State = 1546; - methodName(); - State = 1547; - genArityNotEmpty(); - State = 1548; - sigArgs(); + State = 1955; + _localctx.name = methodName(); + State = 1956; + _localctx.genericArity = genArityNotEmpty(); + State = 1957; + _localctx.arguments = sigArgs(); + _localctx.Value = Actions.CreateMethodReference(_localctx.Start, _localctx.convention.Value, _localctx.returnType.Value, _localctx.owner.Value, _localctx.name.Value, null, _localctx.genericArity.Value, _localctx.arguments.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 1550; - callConv(); - State = 1551; - type(); - State = 1552; - methodName(); - State = 1554; + State = 1960; + _localctx.convention = callConv(); + State = 1961; + _localctx.returnType = type(); + State = 1962; + _localctx.name = methodName(); + State = 1964; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==T__85) { { - State = 1553; - typeArgs(); + State = 1963; + _localctx.genericArguments = typeArgs(); } } - State = 1556; - sigArgs(); + State = 1966; + _localctx.arguments = sigArgs(); + _localctx.Value = Actions.CreateMethodReference(_localctx.Start, _localctx.convention.Value, _localctx.returnType.Value, null, _localctx.name.Value, _localctx.genericArguments is null ? null : _localctx.genericArguments.Value, null, _localctx.arguments.Value); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 1558; - callConv(); - State = 1559; - type(); - State = 1560; - methodName(); - State = 1561; - genArityNotEmpty(); - State = 1562; - sigArgs(); + State = 1969; + _localctx.convention = callConv(); + State = 1970; + _localctx.returnType = type(); + State = 1971; + _localctx.name = methodName(); + State = 1972; + _localctx.genericArity = genArityNotEmpty(); + State = 1973; + _localctx.arguments = sigArgs(); + _localctx.Value = Actions.CreateMethodReference(_localctx.Start, _localctx.convention.Value, _localctx.returnType.Value, null, _localctx.name.Value, null, _localctx.genericArity.Value, _localctx.arguments.Value); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 1564; - mdtoken(); + State = 1976; + _localctx.token = mdtoken(); + _localctx.Value = Actions.CreateTokenMethodReference(_localctx.token.Value); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 1565; - dottedName(); + State = 1979; + _localctx.alias = dottedName(); + _localctx.Value = Actions.CreateTypedefMethodReference(_localctx.Start, _localctx.alias.Value); } break; } @@ -8540,12 +8726,21 @@ public MethodRefContext methodRef() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + ExitRule(); } return _localctx; } public partial class CallConvContext : ParserRuleContext { + public byte Value; + public CallConvContext inner; + public CallKindContext kind; + public Int32Context raw; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INSTANCE() { return GetToken(CILParser.INSTANCE, 0); } [System.Diagnostics.DebuggerNonUserCode] public CallConvContext callConv() { return GetRuleContext(0); @@ -8562,58 +8757,56 @@ public CallConvContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_callConv; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCallConv(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public CallConvContext callConv() { CallConvContext _localctx = new CallConvContext(Context, State); - EnterRule(_localctx, 192, RULE_callConv); + EnterRule(_localctx, 174, RULE_callConv); try { - State = 1578; + State = 2001; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,74,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,81,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 1568; + State = 1984; Match(INSTANCE); - State = 1569; - callConv(); + State = 1985; + _localctx.inner = callConv(); + _localctx.Value = Actions.AddInstanceCallingConvention(_localctx.inner.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 1570; + State = 1988; Match(EXPLICIT); - State = 1571; - callConv(); + State = 1989; + _localctx.inner = callConv(); + _localctx.Value = Actions.AddExplicitCallingConvention(_localctx.inner.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 1572; - callKind(); + State = 1992; + _localctx.kind = callKind(); + _localctx.Value = _localctx.kind.Value; } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 1573; + State = 1995; Match(T__111); - State = 1574; + State = 1996; Match(T__29); - State = 1575; - int32(); - State = 1576; + State = 1997; + _localctx.raw = int32(); + State = 1998; Match(T__30); + _localctx.Value = Actions.GetRawCallingConvention((_localctx.raw!=null?(_localctx.raw.Start):null)); } break; } @@ -8630,6 +8823,8 @@ public CallConvContext callConv() { } public partial class CallKindContext : ParserRuleContext { + public byte Value; + public IToken kind; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DEFAULT() { return GetToken(CILParser.DEFAULT, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VARARG() { return GetToken(CILParser.VARARG, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UNMANAGED() { return GetToken(CILParser.UNMANAGED, 0); } @@ -8642,22 +8837,17 @@ public CallKindContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_callKind; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCallKind(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public CallKindContext callKind() { CallKindContext _localctx = new CallKindContext(Context, State); - EnterRule(_localctx, 194, RULE_callKind); + EnterRule(_localctx, 176, RULE_callKind); + _localctx.Value = Actions.GetDefaultCallingConvention(); try { - State = 1592; + State = 2022; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,75,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,82,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { @@ -8666,58 +8856,65 @@ public CallKindContext callKind() { case 2: EnterOuterAlt(_localctx, 2); { - State = 1581; - Match(DEFAULT); + State = 2004; + _localctx.kind = Match(DEFAULT); + _localctx.Value = Actions.GetCallingConvention(_localctx.kind); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 1582; - Match(VARARG); + State = 2006; + _localctx.kind = Match(VARARG); + _localctx.Value = Actions.GetCallingConvention(_localctx.kind); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 1583; + State = 2008; Match(UNMANAGED); - State = 1584; - Match(CDECL); + State = 2009; + _localctx.kind = Match(CDECL); + _localctx.Value = Actions.GetCallingConvention(_localctx.kind); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 1585; + State = 2011; Match(UNMANAGED); - State = 1586; - Match(STDCALL); + State = 2012; + _localctx.kind = Match(STDCALL); + _localctx.Value = Actions.GetCallingConvention(_localctx.kind); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 1587; + State = 2014; Match(UNMANAGED); - State = 1588; - Match(THISCALL); + State = 2015; + _localctx.kind = Match(THISCALL); + _localctx.Value = Actions.GetCallingConvention(_localctx.kind); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 1589; + State = 2017; Match(UNMANAGED); - State = 1590; - Match(FASTCALL); + State = 2018; + _localctx.kind = Match(FASTCALL); + _localctx.Value = Actions.GetCallingConvention(_localctx.kind); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 1591; - Match(UNMANAGED); + State = 2020; + _localctx.kind = Match(UNMANAGED); + _localctx.Value = Actions.GetCallingConvention(_localctx.kind); } break; } @@ -8734,6 +8931,10 @@ public CallKindContext callKind() { } public partial class MdtokenContext : ParserRuleContext { + public int Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public Int32Context token; [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } @@ -8742,29 +8943,25 @@ public MdtokenContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_mdtoken; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitMdtoken(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public MdtokenContext mdtoken() { MdtokenContext _localctx = new MdtokenContext(Context, State); - EnterRule(_localctx, 196, RULE_mdtoken); + EnterRule(_localctx, 178, RULE_mdtoken); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; try { EnterOuterAlt(_localctx, 1); { - State = 1594; + State = 2024; Match(T__112); - State = 1595; + State = 2025; Match(T__29); - State = 1596; - int32(); - State = 1597; + State = 2026; + _localctx.token = int32(); + State = 2027; Match(T__30); + _localctx.Value = Actions.ParseInt32((_localctx.token!=null?(_localctx.token.Start):null)); } } catch (RecognitionException re) { @@ -8773,12 +8970,21 @@ public MdtokenContext mdtoken() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + ExitRule(); } return _localctx; } public partial class MemberRefContext : ParserRuleContext { + public CILParser.MemberReferenceValue Value; + public MethodRefContext method; + public FieldRefContext field; + public MdtokenContext token; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode METHOD() { return GetToken(CILParser.METHOD, 0); } [System.Diagnostics.DebuggerNonUserCode] public MethodRefContext methodRef() { return GetRuleContext(0); @@ -8794,45 +9000,43 @@ public MemberRefContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_memberRef; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitMemberRef(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public MemberRefContext memberRef() { MemberRefContext _localctx = new MemberRefContext(Context, State); - EnterRule(_localctx, 198, RULE_memberRef); + EnterRule(_localctx, 180, RULE_memberRef); + _localctx.Value = CILParser.MemberReferenceValue.Error; try { - State = 1604; + State = 2041; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case METHOD: EnterOuterAlt(_localctx, 1); { - State = 1599; + State = 2030; Match(METHOD); - State = 1600; - methodRef(); + State = 2031; + _localctx.method = methodRef(); + _localctx.Value = Actions.CreateMethodMemberReference(_localctx.method.Value); } break; case T__36: EnterOuterAlt(_localctx, 2); { - State = 1601; + State = 2034; Match(T__36); - State = 1602; - fieldRef(); + State = 2035; + _localctx.field = fieldRef(); + _localctx.Value = Actions.CreateFieldMemberReference(_localctx.field.Value); } break; case T__112: EnterOuterAlt(_localctx, 3); { - State = 1603; - mdtoken(); + State = 2038; + _localctx.token = mdtoken(); + _localctx.Value = Actions.CreateTokenMemberReference(_localctx.token.Value); } break; default: @@ -8851,13 +9055,20 @@ public MemberRefContext memberRef() { } public partial class FieldRefContext : ParserRuleContext { + public CILParser.FieldReferenceValue Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public TypeContext fieldType; + public TypeSpecOrScopeContext owner; + public DottedNameContext name; + public DottedNameContext alias; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DCOLON() { return GetToken(CILParser.DCOLON, 0); } [System.Diagnostics.DebuggerNonUserCode] public TypeContext type() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { - return GetRuleContext(0); + [System.Diagnostics.DebuggerNonUserCode] public TypeSpecOrScopeContext typeSpecOrScope() { + return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DCOLON() { return GetToken(CILParser.DCOLON, 0); } [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { return GetRuleContext(0); } @@ -8866,49 +9077,50 @@ public FieldRefContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_fieldRef; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitFieldRef(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public FieldRefContext fieldRef() { FieldRefContext _localctx = new FieldRefContext(Context, State); - EnterRule(_localctx, 200, RULE_fieldRef); + EnterRule(_localctx, 182, RULE_fieldRef); + + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.FieldReferenceValue.Error; + try { - State = 1615; + State = 2056; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,77,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,84,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 1606; - type(); - State = 1607; - typeSpec(); - State = 1608; + State = 2043; + _localctx.fieldType = type(); + State = 2044; + _localctx.owner = typeSpecOrScope(); + State = 2045; Match(DCOLON); - State = 1609; - dottedName(); + State = 2046; + _localctx.name = dottedName(); + _localctx.Value = Actions.CreateFieldReference(_localctx.fieldType.Value, _localctx.owner.Value, _localctx.name.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 1611; - type(); - State = 1612; - dottedName(); + State = 2049; + _localctx.fieldType = type(); + State = 2050; + _localctx.name = dottedName(); + _localctx.Value = Actions.CreateFieldReference(_localctx.fieldType.Value, null, _localctx.name.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 1614; - dottedName(); + State = 2053; + _localctx.alias = dottedName(); + _localctx.Value = Actions.CreateTypedefFieldReference(_localctx.Start, _localctx.alias.Value); } break; } @@ -8919,12 +9131,21 @@ public FieldRefContext fieldRef() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + ExitRule(); } return _localctx; } public partial class TypeListContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public TypeSpecContext item; + public TypeSpecContext tail; [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext[] typeSpec() { return GetRuleContexts(); } @@ -8936,42 +9157,39 @@ public TypeListContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_typeList; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTypeList(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TypeListContext typeList() { TypeListContext _localctx = new TypeListContext(Context, State); - EnterRule(_localctx, 202, RULE_typeList); + EnterRule(_localctx, 184, RULE_typeList); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 1622; + State = 2064; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,78,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,85,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 1617; - typeSpec(); - State = 1618; + State = 2058; + _localctx.item = typeSpec(); + _localctx.Builder.Add(_localctx.item.Value); + State = 2060; Match(T__27); } - } + } } - State = 1624; + State = 2066; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,78,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,85,Context); } - State = 1625; - typeSpec(); + State = 2067; + _localctx.tail = typeSpec(); + _localctx.Builder.Add(_localctx.tail.Value); } } catch (RecognitionException re) { @@ -8980,12 +9198,15 @@ public TypeListContext typeList() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } public partial class TyparsClauseContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public TyparsContext parameters; [System.Diagnostics.DebuggerNonUserCode] public TyparsContext typars() { return GetRuleContext(0); } @@ -8994,20 +9215,15 @@ public TyparsClauseContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_typarsClause; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTyparsClause(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TyparsClauseContext typarsClause() { TyparsClauseContext _localctx = new TyparsClauseContext(Context, State); - EnterRule(_localctx, 204, RULE_typarsClause); + EnterRule(_localctx, 186, RULE_typarsClause); + _localctx.Value = System.Collections.Immutable.ImmutableArray.Empty; try { - State = 1632; + State = 2076; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__16: @@ -9022,12 +9238,13 @@ public TyparsClauseContext typarsClause() { case T__85: EnterOuterAlt(_localctx, 2); { - State = 1628; + State = 2071; Match(T__85); - State = 1629; - typars(); - State = 1630; + State = 2072; + _localctx.parameters = typars(); + State = 2073; Match(T__86); + _localctx.Value = _localctx.parameters.Value; } break; default: @@ -9046,6 +9263,7 @@ public TyparsClauseContext typarsClause() { } public partial class TyparAttribContext : ParserRuleContext { + public CILParser.AttributeValue Value; public IToken covariant; public IToken contravariant; public IToken @class; @@ -9063,75 +9281,77 @@ public TyparAttribContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_typarAttrib; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTyparAttrib(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TyparAttribContext typarAttrib() { TyparAttribContext _localctx = new TyparAttribContext(Context, State); - EnterRule(_localctx, 206, RULE_typarAttrib); + EnterRule(_localctx, 188, RULE_typarAttrib); + _localctx.Value = CILParser.AttributeValue.Empty; try { - State = 1645; + State = 2096; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case PLUS: EnterOuterAlt(_localctx, 1); { - State = 1634; + State = 2078; _localctx.covariant = Match(PLUS); + _localctx.Value = Actions.CreateGenericParameterAttribute(_localctx.covariant); } break; case T__113: EnterOuterAlt(_localctx, 2); { - State = 1635; + State = 2080; _localctx.contravariant = Match(T__113); + _localctx.Value = Actions.CreateGenericParameterAttribute(_localctx.contravariant); } break; case T__38: EnterOuterAlt(_localctx, 3); { - State = 1636; + State = 2082; _localctx.@class = Match(T__38); + _localctx.Value = Actions.CreateGenericParameterAttribute(_localctx.@class); } break; case VALUETYPE: EnterOuterAlt(_localctx, 4); { - State = 1637; + State = 2084; _localctx.valuetype = Match(VALUETYPE); + _localctx.Value = Actions.CreateGenericParameterAttribute(_localctx.valuetype); } break; case T__114: EnterOuterAlt(_localctx, 5); { - State = 1638; + State = 2086; _localctx.byrefLike = Match(T__114); + _localctx.Value = Actions.CreateGenericParameterAttribute(_localctx.byrefLike); } break; case T__115: EnterOuterAlt(_localctx, 6); { - State = 1639; + State = 2088; _localctx.ctor = Match(T__115); + _localctx.Value = Actions.CreateGenericParameterAttribute(_localctx.ctor); } break; case T__69: EnterOuterAlt(_localctx, 7); { - State = 1640; + State = 2090; Match(T__69); - State = 1641; + State = 2091; Match(T__29); - State = 1642; + State = 2092; _localctx.flags = int32(); - State = 1643; + State = 2093; Match(T__30); + _localctx.Value = Actions.CreateRawGenericParameterAttribute((_localctx.flags!=null?(_localctx.flags.Start):null)); } break; default: @@ -9150,6 +9370,8 @@ public TyparAttribContext typarAttrib() { } public partial class TyparAttribsContext : ParserRuleContext { + public System.Reflection.GenericParameterAttributes Value; + public TyparAttribContext attribute; [System.Diagnostics.DebuggerNonUserCode] public TyparAttribContext[] typarAttrib() { return GetRuleContexts(); } @@ -9161,33 +9383,29 @@ public TyparAttribsContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_typarAttribs; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTyparAttribs(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TyparAttribsContext typarAttribs() { TyparAttribsContext _localctx = new TyparAttribsContext(Context, State); - EnterRule(_localctx, 208, RULE_typarAttribs); + EnterRule(_localctx, 190, RULE_typarAttribs); + _localctx.Value = 0; int _la; try { EnterOuterAlt(_localctx, 1); { - State = 1650; + State = 2103; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==T__38 || ((((_la - 70)) & ~0x3f) == 0 && ((1L << (_la - 70)) & 123145302310913L) != 0) || _la==VALUETYPE || _la==PLUS) { { { - State = 1647; - typarAttrib(); + State = 2098; + _localctx.attribute = typarAttrib(); + _localctx.Value = Actions.AddGenericParameterAttribute(_localctx.Value, _localctx.attribute.Value); } } - State = 1652; + State = 2105; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -9205,6 +9423,10 @@ public TyparAttribsContext typarAttribs() { } public partial class TyparContext : ParserRuleContext { + public CILParser.GenericParameterDeclarationValue Value; + public TyparAttribsContext attributes; + public TyBoundContext constraints; + public DottedNameContext name; [System.Diagnostics.DebuggerNonUserCode] public TyparAttribsContext typarAttribs() { return GetRuleContext(0); } @@ -9219,36 +9441,32 @@ public TyparContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_typar; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTypar(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TyparContext typar() { TyparContext _localctx = new TyparContext(Context, State); - EnterRule(_localctx, 210, RULE_typar); + EnterRule(_localctx, 192, RULE_typar); + _localctx.Value = CILParser.GenericParameterDeclarationValue.Error; int _la; try { EnterOuterAlt(_localctx, 1); { - State = 1653; - typarAttribs(); - State = 1655; + State = 2106; + _localctx.attributes = typarAttribs(); + State = 2108; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==T__29) { { - State = 1654; - tyBound(); + State = 2107; + _localctx.constraints = tyBound(); } } - State = 1657; - dottedName(); + State = 2110; + _localctx.name = dottedName(); + _localctx.Value = Actions.CreateGenericParameterDeclaration(_localctx.Start, _localctx.attributes.Value, _localctx.constraints, _localctx.name.Value); } } catch (RecognitionException re) { @@ -9263,6 +9481,10 @@ public TyparContext typar() { } public partial class TyparsContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public TyparContext parameter; + public TyparContext tail; [System.Diagnostics.DebuggerNonUserCode] public TyparContext[] typar() { return GetRuleContexts(); } @@ -9274,42 +9496,39 @@ public TyparsContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_typars; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTypars(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TyparsContext typars() { TyparsContext _localctx = new TyparsContext(Context, State); - EnterRule(_localctx, 212, RULE_typars); + EnterRule(_localctx, 194, RULE_typars); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 1664; + State = 2119; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,83,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,90,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 1659; - typar(); - State = 1660; + State = 2113; + _localctx.parameter = typar(); + _localctx.Builder.Add(_localctx.parameter.Value); + State = 2115; Match(T__27); } - } + } } - State = 1666; + State = 2121; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,83,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,90,Context); } - State = 1667; - typar(); + State = 2122; + _localctx.tail = typar(); + _localctx.Builder.Add(_localctx.tail.Value); } } catch (RecognitionException re) { @@ -9318,12 +9537,15 @@ public TyparsContext typars() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } public partial class TyBoundContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public TypeListContext constraints; [System.Diagnostics.DebuggerNonUserCode] public TypeListContext typeList() { return GetRuleContext(0); } @@ -9332,27 +9554,23 @@ public TyBoundContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_tyBound; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTyBound(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TyBoundContext tyBound() { TyBoundContext _localctx = new TyBoundContext(Context, State); - EnterRule(_localctx, 214, RULE_tyBound); + EnterRule(_localctx, 196, RULE_tyBound); + _localctx.Value = System.Collections.Immutable.ImmutableArray.Empty; try { EnterOuterAlt(_localctx, 1); { - State = 1669; + State = 2125; Match(T__29); - State = 1670; - typeList(); - State = 1671; + State = 2126; + _localctx.constraints = typeList(); + State = 2127; Match(T__30); + _localctx.Value = _localctx.constraints.Value; } } catch (RecognitionException re) { @@ -9367,6 +9585,8 @@ public TyBoundContext tyBound() { } public partial class GenArityContext : ParserRuleContext { + public int Value; + public GenArityNotEmptyContext value; [System.Diagnostics.DebuggerNonUserCode] public GenArityNotEmptyContext genArityNotEmpty() { return GetRuleContext(0); } @@ -9375,37 +9595,27 @@ public GenArityContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_genArity; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitGenArity(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public GenArityContext genArity() { GenArityContext _localctx = new GenArityContext(Context, State); - EnterRule(_localctx, 216, RULE_genArity); + EnterRule(_localctx, 198, RULE_genArity); + int _la; try { - State = 1675; + EnterOuterAlt(_localctx, 1); + { + State = 2131; ErrorHandler.Sync(this); - switch (TokenStream.LA(1)) { - case T__29: - case T__84: - EnterOuterAlt(_localctx, 1); - { - } - break; - case T__85: - EnterOuterAlt(_localctx, 2); + _la = TokenStream.LA(1); + if (_la==T__85) { { - State = 1674; - genArityNotEmpty(); + State = 2130; + _localctx.value = genArityNotEmpty(); } - break; - default: - throw new NoViableAltException(this); + } + + _localctx.Value = Actions.GetGenericArity(_localctx.value); } } catch (RecognitionException re) { @@ -9420,6 +9630,8 @@ public GenArityContext genArity() { } public partial class GenArityNotEmptyContext : ParserRuleContext { + public int Value; + public Int32Context value; [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } @@ -9428,31 +9640,26 @@ public GenArityNotEmptyContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_genArityNotEmpty; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitGenArityNotEmpty(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public GenArityNotEmptyContext genArityNotEmpty() { GenArityNotEmptyContext _localctx = new GenArityNotEmptyContext(Context, State); - EnterRule(_localctx, 218, RULE_genArityNotEmpty); + EnterRule(_localctx, 200, RULE_genArityNotEmpty); try { EnterOuterAlt(_localctx, 1); { - State = 1677; + State = 2135; Match(T__85); - State = 1678; + State = 2136; Match(T__41); - State = 1679; - int32(); - State = 1680; + State = 2137; + _localctx.value = int32(); + State = 2138; Match(T__42); - State = 1681; + State = 2139; Match(T__86); + _localctx.Value = Actions.ParseInt32((_localctx.value!=null?(_localctx.value.Start):null)); } } catch (RecognitionException re) { @@ -9467,6 +9674,37 @@ public GenArityNotEmptyContext genArityNotEmpty() { } public partial class ClassDeclContext : ParserRuleContext { + public CILParser.PropertyBodyValue PropertyBody; + public CILParser.EventBodyValue EventBody; + public CILParser.CustomAttributeOwnerValue AttributeOwner; + public EventHeadContext eventHeader; + public PropHeadContext property; + public DataDeclContext data; + public SecDeclContext security; + public ExtSourceSpecContext source; + public CustomAttrDeclContext attribute; + public Int32Context size; + public Int32Context packing; + public ExportHeadContext export; + public ExptypeDeclsContext exportDeclarations; + public TypeSpecOrScopeContext declarationOwner; + public MethodNameContext declarationName; + public CallConvContext bodyConvention; + public TypeContext bodyReturnType; + public TypeSpecOrScopeContext bodyOwner; + public MethodNameContext bodyName; + public SigArgsContext bodyArguments; + public CallConvContext declarationConvention; + public TypeContext declarationReturnType; + public GenArityContext declarationArity; + public SigArgsContext declarationArguments; + public GenArityContext bodyArity; + public LanguageDeclContext language; + public Int32Context parameterIndex; + public DottedNameContext parameterName; + public TypeSpecContext constraintType; + public TypeSpecContext interfaceType; + public CustomDescrContext interfaceAttribute; [System.Diagnostics.DebuggerNonUserCode] public MethodHeadContext methodHead() { return GetRuleContext(0); } @@ -9479,18 +9717,18 @@ [System.Diagnostics.DebuggerNonUserCode] public ClassHeadContext classHead() { [System.Diagnostics.DebuggerNonUserCode] public ClassDeclsContext classDecls() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public EventHeadContext eventHead() { - return GetRuleContext(0); - } [System.Diagnostics.DebuggerNonUserCode] public EventDeclsContext eventDecls() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public PropHeadContext propHead() { - return GetRuleContext(0); + [System.Diagnostics.DebuggerNonUserCode] public EventHeadContext eventHead() { + return GetRuleContext(0); } [System.Diagnostics.DebuggerNonUserCode] public PropDeclsContext propDecls() { return GetRuleContext(0); } + [System.Diagnostics.DebuggerNonUserCode] public PropHeadContext propHead() { + return GetRuleContext(0); + } [System.Diagnostics.DebuggerNonUserCode] public FieldDeclContext fieldDecl() { return GetRuleContext(0); } @@ -9519,16 +9757,16 @@ [System.Diagnostics.DebuggerNonUserCode] public ExptypeDeclsContext exptypeDecls return GetRuleContext(0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode OVERRIDE() { return GetToken(CILParser.OVERRIDE, 0); } - [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext[] typeSpec() { - return GetRuleContexts(); - } - [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec(int i) { - return GetRuleContext(i); - } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] DCOLON() { return GetTokens(CILParser.DCOLON); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DCOLON(int i) { return GetToken(CILParser.DCOLON, i); } + [System.Diagnostics.DebuggerNonUserCode] public TypeSpecOrScopeContext[] typeSpecOrScope() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public TypeSpecOrScopeContext typeSpecOrScope(int i) { + return GetRuleContext(i); + } [System.Diagnostics.DebuggerNonUserCode] public MethodNameContext[] methodName() { return GetRuleContexts(); } @@ -9575,6 +9813,9 @@ [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { return GetRuleContext(0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CONSTRAINT() { return GetToken(CILParser.CONSTRAINT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { + return GetRuleContext(0); + } [System.Diagnostics.DebuggerNonUserCode] public CustomDescrContext customDescr() { return GetRuleContext(0); } @@ -9583,358 +9824,395 @@ public ClassDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_classDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitClassDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ClassDeclContext classDecl() { ClassDeclContext _localctx = new ClassDeclContext(Context, State); - EnterRule(_localctx, 220, RULE_classDecl); + EnterRule(_localctx, 202, RULE_classDecl); try { int _alt; - State = 1799; + State = 2292; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,89,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,96,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 1683; + State = 2142; methodHead(); - State = 1684; + State = 2143; Match(T__16); - State = 1685; + State = 2144; methodDecls(); - State = 1686; + State = 2145; Match(T__17); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 1688; + State = 2147; classHead(); - State = 1689; + State = 2148; Match(T__16); - State = 1690; + State = 2149; classDecls(); - State = 1691; + State = 2150; Match(T__17); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 1693; - eventHead(); - State = 1694; + State = 2152; + _localctx.eventHeader = eventHead(); + _localctx.EventBody = Actions.BeginEvent(_localctx.eventHeader.Value); + State = 2154; Match(T__16); - State = 1695; - eventDecls(); - State = 1696; + State = 2155; + eventDecls(_localctx.EventBody); + State = 2156; Match(T__17); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 1698; - propHead(); - State = 1699; + State = 2158; + _localctx.property = propHead(); + _localctx.PropertyBody = Actions.BeginProperty(_localctx.property.Value); + State = 2160; Match(T__16); - State = 1700; - propDecls(); - State = 1701; + State = 2161; + propDecls(_localctx.PropertyBody); + State = 2162; Match(T__17); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 1703; + State = 2164; fieldDecl(); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 1704; - dataDecl(); + State = 2165; + _localctx.data = dataDecl(); + Actions.ProcessClassDataDeclaration(_localctx.data); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 1705; - secDecl(); + State = 2168; + _localctx.security = secDecl(); + Actions.ProcessClassSecurityDeclaration(_localctx.security); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 1706; - extSourceSpec(); + State = 2171; + _localctx.source = extSourceSpec(); + Actions.ProcessClassSourceDirective(_localctx.source); } break; case 9: EnterOuterAlt(_localctx, 9); { - State = 1707; - customAttrDecl(); + State = 2174; + _localctx.attribute = customAttrDecl(); + Actions.ProcessClassCustomAttribute(_localctx.attribute); } break; case 10: EnterOuterAlt(_localctx, 10); { - State = 1708; + State = 2177; Match(T__116); - State = 1709; - int32(); + State = 2178; + _localctx.size = int32(); + Actions.SetClassSize((_localctx.size!=null?(_localctx.size.Start):null)); } break; case 11: EnterOuterAlt(_localctx, 11); { - State = 1710; + State = 2181; Match(T__117); - State = 1711; - int32(); + State = 2182; + _localctx.packing = int32(); + Actions.SetClassPackingSize((_localctx.packing!=null?(_localctx.packing.Start):null)); } break; case 12: EnterOuterAlt(_localctx, 12); { - State = 1712; - exportHead(); - State = 1713; + State = 2185; + _localctx.export = exportHead(); + State = 2186; Match(T__16); - State = 1714; - exptypeDecls(); - State = 1715; + State = 2187; + _localctx.exportDeclarations = exptypeDecls(); + State = 2188; Match(T__17); + Actions.ProcessClassExport(_localctx.export, _localctx.exportDeclarations); } break; case 13: EnterOuterAlt(_localctx, 13); { - State = 1717; + State = 2191; Match(OVERRIDE); - State = 1718; - typeSpec(); - State = 1719; + State = 2192; + _localctx.declarationOwner = typeSpecOrScope(); + State = 2193; Match(DCOLON); - State = 1720; - methodName(); - State = 1721; + State = 2194; + _localctx.declarationName = methodName(); + State = 2195; Match(T__118); - State = 1722; - callConv(); - State = 1723; - type(); - State = 1724; - typeSpec(); - State = 1725; + State = 2196; + _localctx.bodyConvention = callConv(); + State = 2197; + _localctx.bodyReturnType = type(); + State = 2198; + _localctx.bodyOwner = typeSpecOrScope(); + State = 2199; Match(DCOLON); - State = 1726; - methodName(); - State = 1727; - sigArgs(); + State = 2200; + _localctx.bodyName = methodName(); + State = 2201; + _localctx.bodyArguments = sigArgs(); + Actions.AddClassMethodOverride( + _localctx, + _localctx.declarationOwner.Value, + _localctx.declarationName.Value, + _localctx.bodyConvention.Value, + _localctx.bodyReturnType.Value, + _localctx.bodyOwner.Value, + _localctx.bodyName.Value, + _localctx.bodyArguments.Value); } break; case 14: EnterOuterAlt(_localctx, 14); { - State = 1729; + State = 2204; Match(OVERRIDE); - State = 1730; + State = 2205; Match(METHOD); - State = 1731; - callConv(); - State = 1732; - type(); - State = 1733; - typeSpec(); - State = 1734; + State = 2206; + _localctx.declarationConvention = callConv(); + State = 2207; + _localctx.declarationReturnType = type(); + State = 2208; + _localctx.declarationOwner = typeSpecOrScope(); + State = 2209; Match(DCOLON); - State = 1735; - methodName(); - State = 1736; - genArity(); - State = 1737; - sigArgs(); - State = 1738; + State = 2210; + _localctx.declarationName = methodName(); + State = 2211; + _localctx.declarationArity = genArity(); + State = 2212; + _localctx.declarationArguments = sigArgs(); + State = 2213; Match(T__118); - State = 1739; + State = 2214; Match(METHOD); - State = 1740; - callConv(); - State = 1741; - type(); - State = 1742; - typeSpec(); - State = 1743; + State = 2215; + _localctx.bodyConvention = callConv(); + State = 2216; + _localctx.bodyReturnType = type(); + State = 2217; + _localctx.bodyOwner = typeSpecOrScope(); + State = 2218; Match(DCOLON); - State = 1744; - methodName(); - State = 1745; - genArity(); - State = 1746; - sigArgs(); + State = 2219; + _localctx.bodyName = methodName(); + State = 2220; + _localctx.bodyArity = genArity(); + State = 2221; + _localctx.bodyArguments = sigArgs(); + Actions.AddClassMethodOverride( + _localctx, + _localctx.declarationConvention.Value, + _localctx.declarationReturnType.Value, + _localctx.declarationOwner.Value, + _localctx.declarationName.Value, + _localctx.declarationArity.Value, + _localctx.declarationArguments.Value, + _localctx.bodyConvention.Value, + _localctx.bodyReturnType.Value, + _localctx.bodyOwner.Value, + _localctx.bodyName.Value, + _localctx.bodyArity.Value, + _localctx.bodyArguments.Value); } break; case 15: EnterOuterAlt(_localctx, 15); { - State = 1748; - languageDecl(); + State = 2224; + _localctx.language = languageDecl(); + Actions.ProcessClassLanguageDirective(_localctx.language); } break; case 16: EnterOuterAlt(_localctx, 16); { - State = 1749; + State = 2227; compControl(); + Actions.ProcessClassCompilerControl(); } break; case 17: EnterOuterAlt(_localctx, 17); { - State = 1750; + State = 2230; Match(PARAM); - State = 1751; + State = 2231; Match(TYPE); - State = 1752; + State = 2232; Match(T__41); - State = 1753; - int32(); - State = 1754; + State = 2233; + _localctx.parameterIndex = int32(); + State = 2234; Match(T__42); - State = 1758; + _localctx.AttributeOwner = Actions.BeginClassGenericParameterDirective(_localctx, (_localctx.parameterIndex!=null?(_localctx.parameterIndex.Start):null)); + State = 2241; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,85,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,92,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 1755; - customAttrDecl(); - } + State = 2236; + _localctx.attribute = customAttrDecl(); + Actions.AddClassGenericDirectiveAttribute(_localctx.AttributeOwner, _localctx.attribute); } + } } - State = 1760; + State = 2243; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,85,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,92,Context); } } break; case 18: EnterOuterAlt(_localctx, 18); { - State = 1761; + State = 2244; Match(PARAM); - State = 1762; + State = 2245; Match(TYPE); - State = 1763; - dottedName(); - State = 1767; + State = 2246; + _localctx.parameterName = dottedName(); + _localctx.AttributeOwner = Actions.BeginClassGenericParameterDirective(_localctx.parameterName.Value); + State = 2253; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,86,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,93,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 1764; - customAttrDecl(); - } + State = 2248; + _localctx.attribute = customAttrDecl(); + Actions.AddClassGenericDirectiveAttribute(_localctx.AttributeOwner, _localctx.attribute); } + } } - State = 1769; + State = 2255; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,86,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,93,Context); } } break; case 19: EnterOuterAlt(_localctx, 19); { - State = 1770; + State = 2256; Match(PARAM); - State = 1771; + State = 2257; Match(CONSTRAINT); - State = 1772; + State = 2258; Match(T__41); - State = 1773; - int32(); - State = 1774; + State = 2259; + _localctx.parameterIndex = int32(); + State = 2260; Match(T__42); - State = 1775; + State = 2261; Match(T__27); - State = 1776; - typeSpec(); - State = 1780; + State = 2262; + _localctx.constraintType = typeSpec(); + _localctx.AttributeOwner = Actions.BeginClassGenericConstraintDirective(_localctx, (_localctx.parameterIndex!=null?(_localctx.parameterIndex.Start):null), _localctx.constraintType.Value); + State = 2269; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,87,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,94,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 1777; - customAttrDecl(); - } + State = 2264; + _localctx.attribute = customAttrDecl(); + Actions.AddClassGenericDirectiveAttribute(_localctx.AttributeOwner, _localctx.attribute); } + } } - State = 1782; + State = 2271; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,87,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,94,Context); } } break; case 20: EnterOuterAlt(_localctx, 20); { - State = 1783; + State = 2272; Match(PARAM); - State = 1784; + State = 2273; Match(CONSTRAINT); - State = 1785; - dottedName(); - State = 1786; + State = 2274; + _localctx.parameterName = dottedName(); + State = 2275; Match(T__27); - State = 1787; - typeSpec(); - State = 1791; + State = 2276; + _localctx.constraintType = typeSpec(); + _localctx.AttributeOwner = Actions.BeginClassGenericConstraintDirective(_localctx.parameterName.Value, _localctx.constraintType.Value); + State = 2283; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,88,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,95,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 1788; - customAttrDecl(); - } + State = 2278; + _localctx.attribute = customAttrDecl(); + Actions.AddClassGenericDirectiveAttribute(_localctx.AttributeOwner, _localctx.attribute); } + } } - State = 1793; + State = 2285; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,88,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,95,Context); } } break; case 21: EnterOuterAlt(_localctx, 21); { - State = 1794; + State = 2286; Match(T__119); - State = 1795; + State = 2287; Match(TYPE); - State = 1796; - typeSpec(); - State = 1797; - customDescr(); + State = 2288; + _localctx.interfaceType = typeSpec(); + State = 2289; + _localctx.interfaceAttribute = customDescr(); + Actions.AddInterfaceImplementationAttribute(_localctx, _localctx.interfaceType.Value, _localctx.interfaceAttribute); } break; } @@ -9945,12 +10223,23 @@ public ClassDeclContext classDecl() { ErrorHandler.Recover(this, re); } finally { + Actions.EndClassDeclaration(_localctx); ExitRule(); } return _localctx; } public partial class FieldDeclContext : ParserRuleContext { + public CILParser.FieldDeclarationValue Value; + public int InitialSyntaxErrorCount; + public CILParser.FieldDeclarationBuilder Builder; + public RepeatOptContext offset; + public FieldAttrContext attribute; + public MarshalBlobContext marshalling; + public TypeContext fieldType; + public DottedNameContext name; + public AtOptContext data; + public InitOptContext initializer; [System.Diagnostics.DebuggerNonUserCode] public RepeatOptContext repeatOpt() { return GetRuleContext(0); } @@ -9983,33 +10272,32 @@ public FieldDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_fieldDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitFieldDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public FieldDeclContext fieldDecl() { FieldDeclContext _localctx = new FieldDeclContext(Context, State); - EnterRule(_localctx, 222, RULE_fieldDecl); + EnterRule(_localctx, 204, RULE_fieldDecl); + + _localctx.Builder = Actions.PrepareFieldDeclaration(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.FieldDeclarationValue.Error; + try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 1801; + State = 2294; Match(T__120); - State = 1802; - repeatOpt(); - State = 1811; + State = 2295; + _localctx.offset = repeatOpt(); + State = 2307; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,91,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,98,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { - State = 1809; + State = 2305; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__15: @@ -10028,40 +10316,53 @@ public FieldDeclContext fieldDecl() { case T__125: case T__126: { - State = 1803; - fieldAttr(); + State = 2296; + _localctx.attribute = fieldAttr(); + Actions.AddFieldAttribute(_localctx.Builder, _localctx.attribute.Value); } break; case T__121: { - State = 1804; + State = 2299; Match(T__121); - State = 1805; + State = 2300; Match(T__29); - State = 1806; - marshalBlob(); - State = 1807; + State = 2301; + _localctx.marshalling = marshalBlob(); + State = 2302; Match(T__30); + Actions.SetFieldMarshalling(_localctx.Builder, _localctx.marshalling.Value); } break; default: throw new NoViableAltException(this); } - } + } } - State = 1813; + State = 2309; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,91,Context); - } - State = 1814; - type(); - State = 1815; - dottedName(); - State = 1816; - atOpt(); - State = 1817; - initOpt(); + _alt = Interpreter.AdaptivePredict(TokenStream,98,Context); + } + State = 2310; + _localctx.fieldType = type(); + State = 2311; + _localctx.name = dottedName(); + State = 2312; + _localctx.data = atOpt(); + State = 2313; + _localctx.initializer = initOpt(); + _localctx.Value = Actions.CreateFieldDeclaration( + _localctx, + _localctx.Builder, + _localctx.InitialSyntaxErrorCount, + _localctx.offset, + _localctx.fieldType.Value, + _localctx.name.Value, + _localctx.data.Value, + _localctx.initializer.Value); } + Context.Stop = TokenStream.LT(-1); + Actions.DefineField(_localctx, _localctx.Value); } catch (RecognitionException re) { _localctx.exception = re; @@ -10075,6 +10376,9 @@ public FieldDeclContext fieldDecl() { } public partial class FieldAttrContext : ParserRuleContext { + public CILParser.AttributeValue Value; + public IToken attribute; + public Int32Context flags; [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } @@ -10083,131 +10387,141 @@ public FieldAttrContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_fieldAttr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitFieldAttr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public FieldAttrContext fieldAttr() { FieldAttrContext _localctx = new FieldAttrContext(Context, State); - EnterRule(_localctx, 224, RULE_fieldAttr); + EnterRule(_localctx, 206, RULE_fieldAttr); + _localctx.Value = CILParser.AttributeValue.Empty; try { - State = 1838; + State = 2350; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__122: EnterOuterAlt(_localctx, 1); { - State = 1819; - Match(T__122); + State = 2316; + _localctx.attribute = Match(T__122); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__50: EnterOuterAlt(_localctx, 2); { - State = 1820; - Match(T__50); + State = 2318; + _localctx.attribute = Match(T__50); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__51: EnterOuterAlt(_localctx, 3); { - State = 1821; - Match(T__51); + State = 2320; + _localctx.attribute = Match(T__51); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__62: EnterOuterAlt(_localctx, 4); { - State = 1822; - Match(T__62); + State = 2322; + _localctx.attribute = Match(T__62); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__123: EnterOuterAlt(_localctx, 5); { - State = 1823; - Match(T__123); + State = 2324; + _localctx.attribute = Match(T__123); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__68: EnterOuterAlt(_localctx, 6); { - State = 1824; - Match(T__68); + State = 2326; + _localctx.attribute = Match(T__68); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__67: EnterOuterAlt(_localctx, 7); { - State = 1825; - Match(T__67); + State = 2328; + _localctx.attribute = Match(T__67); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__63: EnterOuterAlt(_localctx, 8); { - State = 1826; - Match(T__63); + State = 2330; + _localctx.attribute = Match(T__63); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__64: EnterOuterAlt(_localctx, 9); { - State = 1827; - Match(T__64); + State = 2332; + _localctx.attribute = Match(T__64); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__65: EnterOuterAlt(_localctx, 10); { - State = 1828; - Match(T__65); + State = 2334; + _localctx.attribute = Match(T__65); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__124: EnterOuterAlt(_localctx, 11); { - State = 1829; - Match(T__124); + State = 2336; + _localctx.attribute = Match(T__124); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__125: EnterOuterAlt(_localctx, 12); { - State = 1830; - Match(T__125); + State = 2338; + _localctx.attribute = Match(T__125); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__126: EnterOuterAlt(_localctx, 13); { - State = 1831; - Match(T__126); + State = 2340; + _localctx.attribute = Match(T__126); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__15: EnterOuterAlt(_localctx, 14); { - State = 1832; - Match(T__15); + State = 2342; + _localctx.attribute = Match(T__15); + _localctx.Value = Actions.CreateFieldAttribute(_localctx.attribute); } break; case T__69: EnterOuterAlt(_localctx, 15); { - State = 1833; + State = 2344; Match(T__69); - State = 1834; + State = 2345; Match(T__29); - State = 1835; - int32(); - State = 1836; + State = 2346; + _localctx.flags = int32(); + State = 2347; Match(T__30); + _localctx.Value = Actions.CreateRawFieldAttribute((_localctx.flags!=null?(_localctx.flags.Start):null)); } break; default: @@ -10226,6 +10540,9 @@ public FieldAttrContext fieldAttr() { } public partial class AtOptContext : ParserRuleContext { + public string? Value; + public IdContext name; + public Int32Context offset; [System.Diagnostics.DebuggerNonUserCode] public IdContext id() { return GetRuleContext(0); } @@ -10237,22 +10554,17 @@ public AtOptContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_atOpt; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitAtOpt(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public AtOptContext atOpt() { AtOptContext _localctx = new AtOptContext(Context, State); - EnterRule(_localctx, 226, RULE_atOpt); + EnterRule(_localctx, 208, RULE_atOpt); + _localctx.Value = null; try { - State = 1845; + State = 2361; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,93,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,100,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { @@ -10261,19 +10573,21 @@ public AtOptContext atOpt() { case 2: EnterOuterAlt(_localctx, 2); { - State = 1841; + State = 2353; Match(T__43); - State = 1842; - id(); + State = 2354; + _localctx.name = id(); + _localctx.Value = Actions.GetFieldDataName((_localctx.name!=null?(_localctx.name.Start):null)); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 1843; + State = 2357; Match(T__43); - State = 1844; - int32(); + State = 2358; + _localctx.offset = int32(); + _localctx.Value = Actions.GetFieldDataOffset((_localctx.offset!=null?(_localctx.offset.Start):null)); } break; } @@ -10290,6 +10604,10 @@ public AtOptContext atOpt() { } public partial class InitOptContext : ParserRuleContext { + public CILParser.FieldInitializerValue Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public FieldInitContext initializer; [System.Diagnostics.DebuggerNonUserCode] public FieldInitContext fieldInit() { return GetRuleContext(0); } @@ -10298,20 +10616,18 @@ public InitOptContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_initOpt; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitInitOpt(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public InitOptContext initOpt() { InitOptContext _localctx = new InitOptContext(Context, State); - EnterRule(_localctx, 228, RULE_initOpt); + EnterRule(_localctx, 210, RULE_initOpt); + + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.FieldInitializerValue.Empty; + try { - State = 1850; + State = 2368; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__0: @@ -10404,10 +10720,11 @@ public InitOptContext initOpt() { case T__35: EnterOuterAlt(_localctx, 2); { - State = 1848; + State = 2364; Match(T__35); - State = 1849; - fieldInit(); + State = 2365; + _localctx.initializer = fieldInit(); + _localctx.Value = _localctx.initializer.Value; } break; default: @@ -10420,12 +10737,20 @@ public InitOptContext initOpt() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + ExitRule(); } return _localctx; } public partial class RepeatOptContext : ParserRuleContext { + public int Value; + public bool HasValue; + public Int32Context offset; [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } @@ -10434,20 +10759,14 @@ public RepeatOptContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_repeatOpt; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitRepeatOpt(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public RepeatOptContext repeatOpt() { RepeatOptContext _localctx = new RepeatOptContext(Context, State); - EnterRule(_localctx, 230, RULE_repeatOpt); + EnterRule(_localctx, 212, RULE_repeatOpt); try { - State = 1857; + State = 2376; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__0: @@ -10502,12 +10821,13 @@ public RepeatOptContext repeatOpt() { case T__41: EnterOuterAlt(_localctx, 2); { - State = 1853; + State = 2371; Match(T__41); - State = 1854; - int32(); - State = 1855; + State = 2372; + _localctx.offset = int32(); + State = 2373; Match(T__42); + Actions.SetFieldOffset(_localctx, (_localctx.offset!=null?(_localctx.offset.Start):null)); } break; default: @@ -10526,6 +10846,12 @@ public RepeatOptContext repeatOpt() { } public partial class EventHeadContext : ParserRuleContext { + public CILParser.EventHeaderValue Value; + public int InitialSyntaxErrorCount; + public CILParser.EventHeaderBuilder Builder; + public EventAttrContext attribute; + public TypeSpecContext eventType; + public DottedNameContext name; [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { return GetRuleContext(0); } @@ -10543,69 +10869,82 @@ public EventHeadContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_eventHead; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitEventHead(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public EventHeadContext eventHead() { EventHeadContext _localctx = new EventHeadContext(Context, State); - EnterRule(_localctx, 232, RULE_eventHead); + EnterRule(_localctx, 214, RULE_eventHead); + + _localctx.Builder = new CILParser.EventHeaderBuilder(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.EventHeaderValue.Error; + int _la; try { - State = 1877; + State = 2403; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,98,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,105,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 1859; + State = 2378; Match(T__127); - State = 1863; + State = 2384; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==T__67 || _la==T__68) { { { - State = 1860; - eventAttr(); + State = 2379; + _localctx.attribute = eventAttr(); + Actions.AddEventAttribute(_localctx.Builder, _localctx.attribute.Value); } } - State = 1865; + State = 2386; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 1866; - typeSpec(); - State = 1867; - dottedName(); + State = 2387; + _localctx.eventType = typeSpec(); + State = 2388; + _localctx.name = dottedName(); + _localctx.Value = Actions.CreateEventHeader( + _localctx, + _localctx.Builder, + _localctx.InitialSyntaxErrorCount, + _localctx.eventType.Value, + _localctx.name.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 1869; + State = 2391; Match(T__127); - State = 1873; + State = 2397; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==T__67 || _la==T__68) { { { - State = 1870; - eventAttr(); + State = 2392; + _localctx.attribute = eventAttr(); + Actions.AddEventAttribute(_localctx.Builder, _localctx.attribute.Value); } } - State = 1875; + State = 2399; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 1876; - dottedName(); + State = 2400; + _localctx.name = dottedName(); + _localctx.Value = Actions.CreateEventHeader( + _localctx, + _localctx.Builder, + _localctx.InitialSyntaxErrorCount, + null, + _localctx.name.Value); } break; } @@ -10622,36 +10961,42 @@ public EventHeadContext eventHead() { } public partial class EventAttrContext : ParserRuleContext { + public CILParser.AttributeValue Value; + public IToken attribute; public EventAttrContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_eventAttr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitEventAttr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public EventAttrContext eventAttr() { EventAttrContext _localctx = new EventAttrContext(Context, State); - EnterRule(_localctx, 234, RULE_eventAttr); - int _la; + EnterRule(_localctx, 216, RULE_eventAttr); + _localctx.Value = CILParser.AttributeValue.Empty; try { - EnterOuterAlt(_localctx, 1); - { - State = 1879; - _la = TokenStream.LA(1); - if ( !(_la==T__67 || _la==T__68) ) { - ErrorHandler.RecoverInline(this); - } - else { - ErrorHandler.ReportMatch(this); - Consume(); - } + State = 2409; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case T__68: + EnterOuterAlt(_localctx, 1); + { + State = 2405; + _localctx.attribute = Match(T__68); + _localctx.Value = Actions.CreateEventAttribute(_localctx.attribute); + } + break; + case T__67: + EnterOuterAlt(_localctx, 2); + { + State = 2407; + _localctx.attribute = Match(T__67); + _localctx.Value = Actions.CreateEventAttribute(_localctx.attribute); + } + break; + default: + throw new NoViableAltException(this); } } catch (RecognitionException re) { @@ -10666,44 +11011,41 @@ public EventAttrContext eventAttr() { } public partial class EventDeclsContext : ParserRuleContext { + public CILParser.EventBodyValue Body; [System.Diagnostics.DebuggerNonUserCode] public EventDeclContext[] eventDecl() { return GetRuleContexts(); } [System.Diagnostics.DebuggerNonUserCode] public EventDeclContext eventDecl(int i) { return GetRuleContext(i); } - public EventDeclsContext(ParserRuleContext parent, int invokingState) + public EventDeclsContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } + public EventDeclsContext(ParserRuleContext parent, int invokingState, CILParser.EventBodyValue Body) : base(parent, invokingState) { + this.Body = Body; } public override int RuleIndex { get { return RULE_eventDecls; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitEventDecls(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] - public EventDeclsContext eventDecls() { - EventDeclsContext _localctx = new EventDeclsContext(Context, State); - EnterRule(_localctx, 236, RULE_eventDecls); + public EventDeclsContext eventDecls(CILParser.EventBodyValue Body) { + EventDeclsContext _localctx = new EventDeclsContext(Context, State, Body); + EnterRule(_localctx, 218, RULE_eventDecls); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 1884; + State = 2414; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 38788988928L) != 0) || ((((_la - 73)) & ~0x3f) == 0 && ((1L << (_la - 73)) & 1080863910568919043L) != 0) || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 105555249070081L) != 0)) { { { - State = 1881; - eventDecl(); + State = 2411; + eventDecl(_localctx.Body); } } - State = 1886; + State = 2416; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -10721,6 +11063,11 @@ public EventDeclsContext eventDecls() { } public partial class EventDeclContext : ParserRuleContext { + public CILParser.EventBodyValue Body; + public MethodRefContext accessor; + public ExtSourceSpecContext source; + public CustomAttrDeclContext attribute; + public LanguageDeclContext language; [System.Diagnostics.DebuggerNonUserCode] public MethodRefContext methodRef() { return GetRuleContext(0); } @@ -10736,69 +11083,70 @@ [System.Diagnostics.DebuggerNonUserCode] public LanguageDeclContext languageDecl [System.Diagnostics.DebuggerNonUserCode] public CompControlContext compControl() { return GetRuleContext(0); } - public EventDeclContext(ParserRuleContext parent, int invokingState) + public EventDeclContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } + public EventDeclContext(ParserRuleContext parent, int invokingState, CILParser.EventBodyValue Body) : base(parent, invokingState) { + this.Body = Body; } public override int RuleIndex { get { return RULE_eventDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitEventDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] - public EventDeclContext eventDecl() { - EventDeclContext _localctx = new EventDeclContext(Context, State); - EnterRule(_localctx, 238, RULE_eventDecl); + public EventDeclContext eventDecl(CILParser.EventBodyValue Body) { + EventDeclContext _localctx = new EventDeclContext(Context, State, Body); + EnterRule(_localctx, 220, RULE_eventDecl); try { - State = 1899; + State = 2443; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__128: EnterOuterAlt(_localctx, 1); { - State = 1887; + State = 2417; Match(T__128); - State = 1888; - methodRef(); + State = 2418; + _localctx.accessor = methodRef(); + Actions.AddEventAdder(_localctx.Body, _localctx.accessor.Value); } break; case T__129: EnterOuterAlt(_localctx, 2); { - State = 1889; + State = 2421; Match(T__129); - State = 1890; - methodRef(); + State = 2422; + _localctx.accessor = methodRef(); + Actions.AddEventRemover(_localctx.Body, _localctx.accessor.Value); } break; case T__130: EnterOuterAlt(_localctx, 3); { - State = 1891; + State = 2425; Match(T__130); - State = 1892; - methodRef(); + State = 2426; + _localctx.accessor = methodRef(); + Actions.AddEventRaiser(_localctx.Body, _localctx.accessor.Value); } break; case T__131: EnterOuterAlt(_localctx, 4); { - State = 1893; + State = 2429; Match(T__131); - State = 1894; - methodRef(); + State = 2430; + _localctx.accessor = methodRef(); + Actions.AddEventOther(_localctx.Body, _localctx.accessor.Value); } break; case T__72: case T__73: EnterOuterAlt(_localctx, 5); { - State = 1895; - extSourceSpec(); + State = 2433; + _localctx.source = extSourceSpec(); + Actions.ProcessEventSourceDirective(_localctx.Body, _localctx.source); } break; case T__15: @@ -10809,15 +11157,17 @@ public EventDeclContext eventDecl() { case ID: EnterOuterAlt(_localctx, 6); { - State = 1896; - customAttrDecl(); + State = 2436; + _localctx.attribute = customAttrDecl(); + Actions.AddEventCustomAttribute(_localctx.Body, _localctx.attribute); } break; case T__26: EnterOuterAlt(_localctx, 7); { - State = 1897; - languageDecl(); + State = 2439; + _localctx.language = languageDecl(); + Actions.ProcessEventLanguageDirective(_localctx.Body, _localctx.language); } break; case T__31: @@ -10830,7 +11180,7 @@ public EventDeclContext eventDecl() { case PP_INCLUDE: EnterOuterAlt(_localctx, 8); { - State = 1898; + State = 2442; compControl(); } break; @@ -10850,6 +11200,15 @@ public EventDeclContext eventDecl() { } public partial class PropHeadContext : ParserRuleContext { + public CILParser.PropertyHeaderValue Value; + public int InitialSyntaxErrorCount; + public CILParser.PropertyHeaderBuilder Builder; + public PropAttrContext attribute; + public CallConvContext convention; + public TypeContext propertyType; + public DottedNameContext name; + public SigArgsContext arguments; + public InitOptContext initializer; [System.Diagnostics.DebuggerNonUserCode] public CallConvContext callConv() { return GetRuleContext(0); } @@ -10876,48 +11235,57 @@ public PropHeadContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_propHead; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitPropHead(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public PropHeadContext propHead() { PropHeadContext _localctx = new PropHeadContext(Context, State); - EnterRule(_localctx, 240, RULE_propHead); + EnterRule(_localctx, 222, RULE_propHead); + + _localctx.Builder = new CILParser.PropertyHeaderBuilder(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.PropertyHeaderValue.Error; + int _la; try { EnterOuterAlt(_localctx, 1); { - State = 1901; + State = 2445; Match(T__132); - State = 1905; + State = 2451; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==T__67 || _la==T__68) { { { - State = 1902; - propAttr(); + State = 2446; + _localctx.attribute = propAttr(); + Actions.AddPropertyAttribute(_localctx.Builder, _localctx.attribute.Value); } } - State = 1907; + State = 2453; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 1908; - callConv(); - State = 1909; - type(); - State = 1910; - dottedName(); - State = 1911; - sigArgs(); - State = 1912; - initOpt(); + State = 2454; + _localctx.convention = callConv(); + State = 2455; + _localctx.propertyType = type(); + State = 2456; + _localctx.name = dottedName(); + State = 2457; + _localctx.arguments = sigArgs(); + State = 2458; + _localctx.initializer = initOpt(); + _localctx.Value = Actions.CreatePropertyHeader( + _localctx, + _localctx.Builder, + _localctx.InitialSyntaxErrorCount, + _localctx.convention.Value, + _localctx.propertyType.Value, + _localctx.name.Value, + _localctx.arguments.Value, + _localctx.initializer.Value); } } catch (RecognitionException re) { @@ -10932,36 +11300,42 @@ public PropHeadContext propHead() { } public partial class PropAttrContext : ParserRuleContext { + public CILParser.AttributeValue Value; + public IToken attribute; public PropAttrContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_propAttr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitPropAttr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public PropAttrContext propAttr() { PropAttrContext _localctx = new PropAttrContext(Context, State); - EnterRule(_localctx, 242, RULE_propAttr); - int _la; + EnterRule(_localctx, 224, RULE_propAttr); + _localctx.Value = CILParser.AttributeValue.Empty; try { - EnterOuterAlt(_localctx, 1); - { - State = 1914; - _la = TokenStream.LA(1); - if ( !(_la==T__67 || _la==T__68) ) { - ErrorHandler.RecoverInline(this); - } - else { - ErrorHandler.ReportMatch(this); - Consume(); - } + State = 2465; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case T__68: + EnterOuterAlt(_localctx, 1); + { + State = 2461; + _localctx.attribute = Match(T__68); + _localctx.Value = Actions.CreatePropertyAttribute(_localctx.attribute); + } + break; + case T__67: + EnterOuterAlt(_localctx, 2); + { + State = 2463; + _localctx.attribute = Match(T__67); + _localctx.Value = Actions.CreatePropertyAttribute(_localctx.attribute); + } + break; + default: + throw new NoViableAltException(this); } } catch (RecognitionException re) { @@ -10976,44 +11350,41 @@ public PropAttrContext propAttr() { } public partial class PropDeclsContext : ParserRuleContext { + public CILParser.PropertyBodyValue Body; [System.Diagnostics.DebuggerNonUserCode] public PropDeclContext[] propDecl() { return GetRuleContexts(); } [System.Diagnostics.DebuggerNonUserCode] public PropDeclContext propDecl(int i) { return GetRuleContext(i); } - public PropDeclsContext(ParserRuleContext parent, int invokingState) + public PropDeclsContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } + public PropDeclsContext(ParserRuleContext parent, int invokingState, CILParser.PropertyBodyValue Body) : base(parent, invokingState) { + this.Body = Body; } public override int RuleIndex { get { return RULE_propDecls; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitPropDecls(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] - public PropDeclsContext propDecls() { - PropDeclsContext _localctx = new PropDeclsContext(Context, State); - EnterRule(_localctx, 244, RULE_propDecls); + public PropDeclsContext propDecls(CILParser.PropertyBodyValue Body) { + PropDeclsContext _localctx = new PropDeclsContext(Context, State, Body); + EnterRule(_localctx, 226, RULE_propDecls); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 1919; + State = 2470; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 38788988928L) != 0) || ((((_la - 73)) & ~0x3f) == 0 && ((1L << (_la - 73)) & 7493989779944505347L) != 0) || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 105555249070081L) != 0)) { { { - State = 1916; - propDecl(); + State = 2467; + propDecl(_localctx.Body); } } - State = 1921; + State = 2472; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -11031,6 +11402,11 @@ public PropDeclsContext propDecls() { } public partial class PropDeclContext : ParserRuleContext { + public CILParser.PropertyBodyValue Body; + public MethodRefContext accessor; + public CustomAttrDeclContext attribute; + public ExtSourceSpecContext source; + public LanguageDeclContext language; [System.Diagnostics.DebuggerNonUserCode] public MethodRefContext methodRef() { return GetRuleContext(0); } @@ -11046,52 +11422,51 @@ [System.Diagnostics.DebuggerNonUserCode] public LanguageDeclContext languageDecl [System.Diagnostics.DebuggerNonUserCode] public CompControlContext compControl() { return GetRuleContext(0); } - public PropDeclContext(ParserRuleContext parent, int invokingState) + public PropDeclContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } + public PropDeclContext(ParserRuleContext parent, int invokingState, CILParser.PropertyBodyValue Body) : base(parent, invokingState) { + this.Body = Body; } public override int RuleIndex { get { return RULE_propDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitPropDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] - public PropDeclContext propDecl() { - PropDeclContext _localctx = new PropDeclContext(Context, State); - EnterRule(_localctx, 246, RULE_propDecl); + public PropDeclContext propDecl(CILParser.PropertyBodyValue Body) { + PropDeclContext _localctx = new PropDeclContext(Context, State, Body); + EnterRule(_localctx, 228, RULE_propDecl); try { - State = 1932; + State = 2495; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__133: EnterOuterAlt(_localctx, 1); { - State = 1922; + State = 2473; Match(T__133); - State = 1923; - methodRef(); + State = 2474; + _localctx.accessor = methodRef(); + Actions.AddPropertySetter(_localctx.Body, _localctx.accessor.Value); } break; case T__134: EnterOuterAlt(_localctx, 2); { - State = 1924; + State = 2477; Match(T__134); - State = 1925; - methodRef(); + State = 2478; + _localctx.accessor = methodRef(); + Actions.AddPropertyGetter(_localctx.Body, _localctx.accessor.Value); } break; case T__131: EnterOuterAlt(_localctx, 3); { - State = 1926; + State = 2481; Match(T__131); - State = 1927; - methodRef(); + State = 2482; + _localctx.accessor = methodRef(); + Actions.AddPropertyOther(_localctx.Body, _localctx.accessor.Value); } break; case T__15: @@ -11102,23 +11477,26 @@ public PropDeclContext propDecl() { case ID: EnterOuterAlt(_localctx, 4); { - State = 1928; - customAttrDecl(); + State = 2485; + _localctx.attribute = customAttrDecl(); + Actions.AddPropertyCustomAttribute(_localctx.Body, _localctx.attribute); } break; case T__72: case T__73: EnterOuterAlt(_localctx, 5); { - State = 1929; - extSourceSpec(); + State = 2488; + _localctx.source = extSourceSpec(); + Actions.ProcessPropertySourceDirective(_localctx.Body, _localctx.source); } break; case T__26: EnterOuterAlt(_localctx, 6); { - State = 1930; - languageDecl(); + State = 2491; + _localctx.language = languageDecl(); + Actions.ProcessPropertyLanguageDirective(_localctx.Body, _localctx.language); } break; case T__31: @@ -11131,7 +11509,7 @@ public PropDeclContext propDecl() { case PP_INCLUDE: EnterOuterAlt(_localctx, 7); { - State = 1931; + State = 2494; compControl(); } break; @@ -11151,6 +11529,8 @@ public PropDeclContext propDecl() { } public partial class MarshalClauseContext : ParserRuleContext { + public CILParser.MarshallingDescriptorValue Value; + public MarshalBlobContext value; [System.Diagnostics.DebuggerNonUserCode] public MarshalBlobContext marshalBlob() { return GetRuleContext(0); } @@ -11159,20 +11539,15 @@ public MarshalClauseContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_marshalClause; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitMarshalClause(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public MarshalClauseContext marshalClause() { MarshalClauseContext _localctx = new MarshalClauseContext(Context, State); - EnterRule(_localctx, 248, RULE_marshalClause); + EnterRule(_localctx, 230, RULE_marshalClause); + _localctx.Value = CILParser.MarshallingDescriptorValue.Empty; try { - State = 1940; + State = 2504; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__0: @@ -11202,19 +11577,21 @@ public MarshalClauseContext marshalClause() { case ID: EnterOuterAlt(_localctx, 1); { + _localctx.Value = Actions.CreateEmptyMarshallingDescriptor(); } break; case T__121: EnterOuterAlt(_localctx, 2); { - State = 1935; + State = 2498; Match(T__121); - State = 1936; + State = 2499; Match(T__29); - State = 1937; - marshalBlob(); - State = 1938; + State = 2500; + _localctx.value = marshalBlob(); + State = 2501; Match(T__30); + _localctx.Value = Actions.CompleteMarshalClause(_localctx.value.Value); } break; default: @@ -11233,6 +11610,10 @@ public MarshalClauseContext marshalClause() { } public partial class MarshalBlobContext : ParserRuleContext { + public CILParser.MarshallingDescriptorValue Value; + public CILParser.MarshalBlobBuilder Builder; + public NativeTypeContext nativeValue; + public HexbyteContext rawByte; [System.Diagnostics.DebuggerNonUserCode] public NativeTypeContext nativeType() { return GetRuleContext(0); } @@ -11247,21 +11628,16 @@ public MarshalBlobContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_marshalBlob; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitMarshalBlob(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public MarshalBlobContext marshalBlob() { MarshalBlobContext _localctx = new MarshalBlobContext(Context, State); - EnterRule(_localctx, 250, RULE_marshalBlob); + EnterRule(_localctx, 232, RULE_marshalBlob); + _localctx.Builder = new CILParser.MarshalBlobBuilder(); int _la; try { - State = 1951; + State = 2519; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__15: @@ -11315,30 +11691,32 @@ public MarshalBlobContext marshalBlob() { case ID: EnterOuterAlt(_localctx, 1); { - State = 1942; - nativeType(); + State = 2506; + _localctx.nativeValue = nativeType(); + Actions.SetMarshalBlobNativeType(_localctx.Builder, _localctx.nativeValue.Value); } break; case T__16: EnterOuterAlt(_localctx, 2); { - State = 1943; + State = 2509; Match(T__16); - State = 1945; + State = 2513; ErrorHandler.Sync(this); _la = TokenStream.LA(1); do { { { - State = 1944; - hexbyte(); + State = 2510; + _localctx.rawByte = hexbyte(); + Actions.AddMarshalBlobByte(_localctx.Builder, _localctx.rawByte.Value); } } - State = 1947; + State = 2515; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } while ( _la==INT32 || _la==ID || _la==HEXBYTE ); - State = 1949; + State = 2517; Match(T__17); } break; @@ -11352,12 +11730,15 @@ public MarshalBlobContext marshalBlob() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = Actions.CreateMarshallingDescriptor(_localctx.Builder); ExitRule(); } return _localctx; } public partial class ParamAttrContext : ParserRuleContext { + public int Value; + public ParamAttrElementContext element; [System.Diagnostics.DebuggerNonUserCode] public ParamAttrElementContext[] paramAttrElement() { return GetRuleContexts(); } @@ -11369,33 +11750,32 @@ public ParamAttrContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_paramAttr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitParamAttr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ParamAttrContext paramAttr() { ParamAttrContext _localctx = new ParamAttrContext(Context, State); - EnterRule(_localctx, 252, RULE_paramAttr); + EnterRule(_localctx, 234, RULE_paramAttr); + _localctx.Value = 0; int _la; try { EnterOuterAlt(_localctx, 1); { - State = 1956; + State = 2526; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==T__41) { { { - State = 1953; - paramAttrElement(); + State = 2521; + _localctx.element = paramAttrElement(); + _localctx.Value = Actions.AddParameterAttribute( + _localctx.Value, + _localctx.element.Value, + _localctx.element.ShouldAppend); } } - State = 1958; + State = 2528; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -11413,9 +11793,10 @@ public ParamAttrContext paramAttr() { } public partial class ParamAttrElementContext : ParserRuleContext { - public IToken @in; - public IToken @out; - public IToken opt; + public int Value; + public bool ShouldAppend; + public IToken attribute; + public Int32Context raw; [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } @@ -11424,64 +11805,62 @@ public ParamAttrElementContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_paramAttrElement; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitParamAttrElement(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ParamAttrElementContext paramAttrElement() { ParamAttrElementContext _localctx = new ParamAttrElementContext(Context, State); - EnterRule(_localctx, 254, RULE_paramAttrElement); + EnterRule(_localctx, 236, RULE_paramAttrElement); try { - State = 1972; + State = 2546; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,108,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,117,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 1959; + State = 2529; Match(T__41); - State = 1960; - _localctx.@in = Match(T__135); - State = 1961; + State = 2530; + _localctx.attribute = Match(T__135); + State = 2531; Match(T__42); + Actions.SetParameterAttributeElement(_localctx, _localctx.attribute); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 1962; + State = 2533; Match(T__41); - State = 1963; - _localctx.@out = Match(T__136); - State = 1964; + State = 2534; + _localctx.attribute = Match(T__136); + State = 2535; Match(T__42); + Actions.SetParameterAttributeElement(_localctx, _localctx.attribute); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 1965; + State = 2537; Match(T__41); - State = 1966; - _localctx.opt = Match(T__137); - State = 1967; + State = 2538; + _localctx.attribute = Match(T__137); + State = 2539; Match(T__42); + Actions.SetParameterAttributeElement(_localctx, _localctx.attribute); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 1968; + State = 2541; Match(T__41); - State = 1969; - int32(); - State = 1970; + State = 2542; + _localctx.raw = int32(); + State = 2543; Match(T__42); + Actions.SetRawParameterAttributeElement(_localctx, (_localctx.raw!=null?(_localctx.raw.Start):null)); } break; } @@ -11498,6 +11877,19 @@ public ParamAttrElementContext paramAttrElement() { } public partial class MethodHeadContext : ParserRuleContext { + public CILParser.MethodHeaderValue Value; + public int InitialSyntaxErrorCount; + public CILParser.MethodHeaderBuilder Builder; + public MethAttrContext attribute; + public PinvImplContext pInvoke; + public CallConvContext convention; + public ParamAttrContext returnAttributes; + public TypeContext returnType; + public MarshalClauseContext returnMarshalling; + public MethodNameContext name; + public TyparsClauseContext genericParameters; + public SigArgsContext arguments; + public ImplAttrContext implementation; [System.Diagnostics.DebuggerNonUserCode] public CallConvContext callConv() { return GetRuleContext(0); } @@ -11542,30 +11934,29 @@ public MethodHeadContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_methodHead; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitMethodHead(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public MethodHeadContext methodHead() { MethodHeadContext _localctx = new MethodHeadContext(Context, State); - EnterRule(_localctx, 256, RULE_methodHead); + EnterRule(_localctx, 238, RULE_methodHead); + + _localctx.Builder = Actions.PrepareMethodHeader(); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.MethodHeaderValue.Error; + int _la; try { EnterOuterAlt(_localctx, 1); { - State = 1974; + State = 2548; Match(T__138); - State = 1979; + State = 2557; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (((((_la - 51)) & ~0x3f) == 0 && ((1L << (_la - 51)) & 978955L) != 0) || ((((_la - 123)) & ~0x3f) == 0 && ((1L << (_la - 123)) & 33423365L) != 0)) { { - State = 1977; + State = 2555; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__50: @@ -11588,53 +11979,69 @@ public MethodHeadContext methodHead() { case T__144: case T__145: { - State = 1975; - methAttr(); + State = 2549; + _localctx.attribute = methAttr(); + Actions.AddMethodAttribute(_localctx.Builder, _localctx.attribute.Value); } break; case T__146: { - State = 1976; - pinvImpl(); + State = 2552; + _localctx.pInvoke = pinvImpl(); + Actions.AddPInvoke(_localctx.Builder, _localctx.pInvoke.Value); } break; default: throw new NoViableAltException(this); } } - State = 1981; + State = 2559; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 1982; - callConv(); - State = 1983; - paramAttr(); - State = 1984; - type(); - State = 1985; - marshalClause(); - State = 1986; - methodName(); - State = 1987; - typarsClause(); - State = 1988; - sigArgs(); - State = 1992; + State = 2560; + _localctx.convention = callConv(); + State = 2561; + _localctx.returnAttributes = paramAttr(); + State = 2562; + _localctx.returnType = type(); + State = 2563; + _localctx.returnMarshalling = marshalClause(); + State = 2564; + _localctx.name = methodName(); + State = 2565; + _localctx.genericParameters = typarsClause(); + State = 2566; + _localctx.arguments = sigArgs(); + State = 2572; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 32766L) != 0) || _la==T__69 || _la==T__155 || _la==UNMANAGED) { { { - State = 1989; - implAttr(); + State = 2567; + _localctx.implementation = implAttr(); + Actions.AddMethodImplementationAttribute(_localctx.Builder, _localctx.implementation.Value); } } - State = 1994; + State = 2574; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } + _localctx.Value = Actions.CreateMethodHeader( + _localctx, + _localctx.Builder, + _localctx.InitialSyntaxErrorCount, + _localctx.convention.Value, + _localctx.returnAttributes.Value, + _localctx.returnType.Value, + _localctx.returnMarshalling.Value, + _localctx.name.Value, + _localctx.genericParameters.Value, + _localctx.arguments.Value); } + Context.Stop = TokenStream.LT(-1); + Actions.BeginMethod(_localctx, _localctx.Value); } catch (RecognitionException re) { _localctx.exception = re; @@ -11648,6 +12055,9 @@ public MethodHeadContext methodHead() { } public partial class MethAttrContext : ParserRuleContext { + public CILParser.AttributeValue Value; + public IToken attribute; + public Int32Context flags; [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } @@ -11656,159 +12066,173 @@ public MethAttrContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_methAttr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitMethAttr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public MethAttrContext methAttr() { MethAttrContext _localctx = new MethAttrContext(Context, State); - EnterRule(_localctx, 258, RULE_methAttr); + EnterRule(_localctx, 240, RULE_methAttr); + _localctx.Value = CILParser.AttributeValue.Empty; try { - State = 2018; + State = 2619; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__122: EnterOuterAlt(_localctx, 1); { - State = 1995; - Match(T__122); + State = 2577; + _localctx.attribute = Match(T__122); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__50: EnterOuterAlt(_localctx, 2); { - State = 1996; - Match(T__50); + State = 2579; + _localctx.attribute = Match(T__50); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__51: EnterOuterAlt(_localctx, 3); { - State = 1997; - Match(T__51); + State = 2581; + _localctx.attribute = Match(T__51); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__62: EnterOuterAlt(_localctx, 4); { - State = 1998; - Match(T__62); + State = 2583; + _localctx.attribute = Match(T__62); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__139: EnterOuterAlt(_localctx, 5); { - State = 1999; - Match(T__139); + State = 2585; + _localctx.attribute = Match(T__139); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__67: EnterOuterAlt(_localctx, 6); { - State = 2000; - Match(T__67); + State = 2587; + _localctx.attribute = Match(T__67); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__140: EnterOuterAlt(_localctx, 7); { - State = 2001; - Match(T__140); + State = 2589; + _localctx.attribute = Match(T__140); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__141: EnterOuterAlt(_localctx, 8); { - State = 2002; - Match(T__141); + State = 2591; + _localctx.attribute = Match(T__141); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__53: EnterOuterAlt(_localctx, 9); { - State = 2003; - Match(T__53); + State = 2593; + _localctx.attribute = Match(T__53); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__63: EnterOuterAlt(_localctx, 10); { - State = 2004; - Match(T__63); + State = 2595; + _localctx.attribute = Match(T__63); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__64: EnterOuterAlt(_localctx, 11); { - State = 2005; - Match(T__64); + State = 2597; + _localctx.attribute = Match(T__64); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__65: EnterOuterAlt(_localctx, 12); { - State = 2006; - Match(T__65); + State = 2599; + _localctx.attribute = Match(T__65); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__124: EnterOuterAlt(_localctx, 13); { - State = 2007; - Match(T__124); + State = 2601; + _localctx.attribute = Match(T__124); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__142: EnterOuterAlt(_localctx, 14); { - State = 2008; - Match(T__142); + State = 2603; + _localctx.attribute = Match(T__142); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__143: EnterOuterAlt(_localctx, 15); { - State = 2009; - Match(T__143); + State = 2605; + _localctx.attribute = Match(T__143); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__68: EnterOuterAlt(_localctx, 16); { - State = 2010; - Match(T__68); + State = 2607; + _localctx.attribute = Match(T__68); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__144: EnterOuterAlt(_localctx, 17); { - State = 2011; - Match(T__144); + State = 2609; + _localctx.attribute = Match(T__144); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__145: EnterOuterAlt(_localctx, 18); { - State = 2012; - Match(T__145); + State = 2611; + _localctx.attribute = Match(T__145); + _localctx.Value = Actions.CreateMethodAttribute(_localctx.attribute); } break; case T__69: EnterOuterAlt(_localctx, 19); { - State = 2013; + State = 2613; Match(T__69); - State = 2014; + State = 2614; Match(T__29); - State = 2015; - int32(); - State = 2016; + State = 2615; + _localctx.flags = int32(); + State = 2616; Match(T__30); + _localctx.Value = Actions.CreateRawMethodAttribute((_localctx.flags!=null?(_localctx.flags.Start):null)); } break; default: @@ -11827,6 +12251,11 @@ public MethAttrContext methAttr() { } public partial class PinvImplContext : ParserRuleContext { + public CILParser.PInvokeValue Value; + public CILParser.PInvokeBuilder Builder; + public CompQstringContext module; + public CompQstringContext entryPoint; + public PinvAttrContext attribute; [System.Diagnostics.DebuggerNonUserCode] public CompQstringContext[] compQstring() { return GetRuleContexts(); } @@ -11844,76 +12273,74 @@ public PinvImplContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_pinvImpl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitPinvImpl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public PinvImplContext pinvImpl() { PinvImplContext _localctx = new PinvImplContext(Context, State); - EnterRule(_localctx, 260, RULE_pinvImpl); + EnterRule(_localctx, 242, RULE_pinvImpl); + _localctx.Builder = new CILParser.PInvokeBuilder(); int _la; try { - State = 2038; + State = 2644; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,116,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,125,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2020; + State = 2621; Match(T__146); - State = 2021; + State = 2622; Match(T__29); - State = 2027; + State = 2631; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==QSTRING) { { - State = 2022; - compQstring(); - State = 2025; + State = 2623; + _localctx.module = compQstring(); + Actions.SetPInvokeModule(_localctx.Builder, _localctx.module.Value); + State = 2629; ErrorHandler.Sync(this); _la = TokenStream.LA(1); if (_la==T__33) { { - State = 2023; + State = 2625; Match(T__33); - State = 2024; - compQstring(); + State = 2626; + _localctx.entryPoint = compQstring(); + Actions.SetPInvokeEntryPoint(_localctx.Builder, _localctx.entryPoint.Value); } } } } - State = 2032; + State = 2638; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (((((_la - 57)) & ~0x3f) == 0 && ((1L << (_la - 57)) & 8195L) != 0) || ((((_la - 148)) & ~0x3f) == 0 && ((1L << (_la - 148)) & 79L) != 0) || ((((_la - 223)) & ~0x3f) == 0 && ((1L << (_la - 223)) & 251658241L) != 0)) { { { - State = 2029; - pinvAttr(); + State = 2633; + _localctx.attribute = pinvAttr(); + Actions.AddPInvokeAttribute(_localctx.Builder, _localctx.attribute.Value); } } - State = 2034; + State = 2640; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 2035; + State = 2641; Match(T__30); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2036; + State = 2642; Match(T__146); - State = 2037; + State = 2643; Match(T__84); } break; @@ -11925,12 +12352,17 @@ public PinvImplContext pinvImpl() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = Actions.CreatePInvoke(_localctx.Builder); ExitRule(); } return _localctx; } public partial class PinvAttrContext : ParserRuleContext { + public CILParser.AttributeValue Value; + public IToken attribute; + public IToken setting; + public Int32Context flags; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ANSI() { return GetToken(CILParser.ANSI, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CDECL() { return GetToken(CILParser.CDECL, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode STDCALL() { return GetToken(CILParser.STDCALL, 0); } @@ -11944,149 +12376,407 @@ public PinvAttrContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_pinvAttr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitPinvAttr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public PinvAttrContext pinvAttr() { PinvAttrContext _localctx = new PinvAttrContext(Context, State); - EnterRule(_localctx, 262, RULE_pinvAttr); + EnterRule(_localctx, 244, RULE_pinvAttr); + _localctx.Value = CILParser.AttributeValue.Empty; try { - State = 2067; + State = 2688; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,117,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,126,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2040; - Match(T__147); + State = 2646; + _localctx.attribute = Match(T__147); + _localctx.Value = Actions.CreatePInvokeAttribute(_localctx.attribute); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2041; - Match(ANSI); + State = 2648; + _localctx.attribute = Match(ANSI); + _localctx.Value = Actions.CreatePInvokeAttribute(_localctx.attribute); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 2042; - Match(T__56); + State = 2650; + _localctx.attribute = Match(T__56); + _localctx.Value = Actions.CreatePInvokeAttribute(_localctx.attribute); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 2043; - Match(T__57); + State = 2652; + _localctx.attribute = Match(T__57); + _localctx.Value = Actions.CreatePInvokeAttribute(_localctx.attribute); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 2044; - Match(T__148); + State = 2654; + _localctx.attribute = Match(T__148); + _localctx.Value = Actions.CreatePInvokeAttribute(_localctx.attribute); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 2045; - Match(T__149); + State = 2656; + _localctx.attribute = Match(T__149); + _localctx.Value = Actions.CreatePInvokeAttribute(_localctx.attribute); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 2046; - Match(CDECL); + State = 2658; + _localctx.attribute = Match(CDECL); + _localctx.Value = Actions.CreatePInvokeAttribute(_localctx.attribute); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 2047; - Match(STDCALL); + State = 2660; + _localctx.attribute = Match(STDCALL); + _localctx.Value = Actions.CreatePInvokeAttribute(_localctx.attribute); } break; case 9: EnterOuterAlt(_localctx, 9); { - State = 2048; - Match(THISCALL); + State = 2662; + _localctx.attribute = Match(THISCALL); + _localctx.Value = Actions.CreatePInvokeAttribute(_localctx.attribute); } break; case 10: EnterOuterAlt(_localctx, 10); { - State = 2049; - Match(FASTCALL); + State = 2664; + _localctx.attribute = Match(FASTCALL); + _localctx.Value = Actions.CreatePInvokeAttribute(_localctx.attribute); } break; case 11: EnterOuterAlt(_localctx, 11); { - State = 2050; + State = 2666; Match(T__150); - State = 2051; + State = 2667; Match(T__74); - State = 2052; - Match(T__151); + State = 2668; + _localctx.setting = Match(T__151); + _localctx.Value = Actions.CreateBestFitPInvokeAttribute(_localctx.setting); } break; case 12: EnterOuterAlt(_localctx, 12); { - State = 2053; + State = 2670; Match(T__150); - State = 2054; + State = 2671; Match(T__74); - State = 2055; - Match(T__152); + State = 2672; + _localctx.setting = Match(T__152); + _localctx.Value = Actions.CreateBestFitPInvokeAttribute(_localctx.setting); } break; case 13: EnterOuterAlt(_localctx, 13); { - State = 2056; + State = 2674; Match(T__153); - State = 2057; + State = 2675; Match(T__74); - State = 2058; - Match(T__151); + State = 2676; + _localctx.setting = Match(T__151); + _localctx.Value = Actions.CreateCharMapErrorPInvokeAttribute(_localctx.setting); } break; case 14: EnterOuterAlt(_localctx, 14); { - State = 2059; + State = 2678; Match(T__153); - State = 2060; + State = 2679; Match(T__74); - State = 2061; - Match(T__152); + State = 2680; + _localctx.setting = Match(T__152); + _localctx.Value = Actions.CreateCharMapErrorPInvokeAttribute(_localctx.setting); + } + break; + case 15: + EnterOuterAlt(_localctx, 15); + { + State = 2682; + Match(T__69); + State = 2683; + Match(T__29); + State = 2684; + _localctx.flags = int32(); + State = 2685; + Match(T__30); + _localctx.Value = Actions.CreateRawPInvokeAttribute((_localctx.flags!=null?(_localctx.flags.Start):null)); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class MethodNameContext : ParserRuleContext { + public string Value; + public IToken ctorName; + public IToken cctorName; + public DottedNameContext dotted; + [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { + return GetRuleContext(0); + } + public MethodNameContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_methodName; } } + } + + [RuleVersion(0)] + public MethodNameContext methodName() { + MethodNameContext _localctx = new MethodNameContext(Context, State); + EnterRule(_localctx, 246, RULE_methodName); + _localctx.Value = string.Empty; + try { + State = 2697; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case T__115: + EnterOuterAlt(_localctx, 1); + { + State = 2690; + _localctx.ctorName = Match(T__115); + _localctx.Value = Actions.GetMethodName(_localctx.ctorName); + } + break; + case T__154: + EnterOuterAlt(_localctx, 2); + { + State = 2692; + _localctx.cctorName = Match(T__154); + _localctx.Value = Actions.GetMethodName(_localctx.cctorName); + } + break; + case T__15: + case INSTANCE: + case SQSTRING: + case DOTTEDNAME: + case ID: + EnterOuterAlt(_localctx, 3); + { + State = 2694; + _localctx.dotted = dottedName(); + _localctx.Value = _localctx.dotted.Value; + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ImplAttrContext : ParserRuleContext { + public CILParser.AttributeValue Value; + public IToken attribute; + public Int32Context flags; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UNMANAGED() { return GetToken(CILParser.UNMANAGED, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { + return GetRuleContext(0); + } + public ImplAttrContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_implAttr; } } + } + + [RuleVersion(0)] + public ImplAttrContext implAttr() { + ImplAttrContext _localctx = new ImplAttrContext(Context, State); + EnterRule(_localctx, 248, RULE_implAttr); + _localctx.Value = CILParser.AttributeValue.Empty; + try { + State = 2737; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case T__0: + EnterOuterAlt(_localctx, 1); + { + State = 2699; + _localctx.attribute = Match(T__0); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__1: + EnterOuterAlt(_localctx, 2); + { + State = 2701; + _localctx.attribute = Match(T__1); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__155: + EnterOuterAlt(_localctx, 3); + { + State = 2703; + _localctx.attribute = Match(T__155); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__2: + EnterOuterAlt(_localctx, 4); + { + State = 2705; + _localctx.attribute = Match(T__2); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__3: + EnterOuterAlt(_localctx, 5); + { + State = 2707; + _localctx.attribute = Match(T__3); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case UNMANAGED: + EnterOuterAlt(_localctx, 6); + { + State = 2709; + _localctx.attribute = Match(UNMANAGED); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__4: + EnterOuterAlt(_localctx, 7); + { + State = 2711; + _localctx.attribute = Match(T__4); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__5: + EnterOuterAlt(_localctx, 8); + { + State = 2713; + _localctx.attribute = Match(T__5); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__6: + EnterOuterAlt(_localctx, 9); + { + State = 2715; + _localctx.attribute = Match(T__6); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__7: + EnterOuterAlt(_localctx, 10); + { + State = 2717; + _localctx.attribute = Match(T__7); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__8: + EnterOuterAlt(_localctx, 11); + { + State = 2719; + _localctx.attribute = Match(T__8); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__9: + EnterOuterAlt(_localctx, 12); + { + State = 2721; + _localctx.attribute = Match(T__9); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__10: + EnterOuterAlt(_localctx, 13); + { + State = 2723; + _localctx.attribute = Match(T__10); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__11: + EnterOuterAlt(_localctx, 14); + { + State = 2725; + _localctx.attribute = Match(T__11); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__12: + EnterOuterAlt(_localctx, 15); + { + State = 2727; + _localctx.attribute = Match(T__12); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); + } + break; + case T__13: + EnterOuterAlt(_localctx, 16); + { + State = 2729; + _localctx.attribute = Match(T__13); + _localctx.Value = Actions.CreateMethodImplementationAttribute(_localctx.attribute); } break; - case 15: - EnterOuterAlt(_localctx, 15); + case T__69: + EnterOuterAlt(_localctx, 17); { - State = 2062; + State = 2731; Match(T__69); - State = 2063; + State = 2732; Match(T__29); - State = 2064; - int32(); - State = 2065; + State = 2733; + _localctx.flags = int32(); + State = 2734; Match(T__30); + _localctx.Value = Actions.CreateRawMethodImplementationAttribute((_localctx.flags!=null?(_localctx.flags.Start):null)); } break; + default: + throw new NoViableAltException(this); } } catch (RecognitionException re) { @@ -12100,58 +12790,42 @@ public PinvAttrContext pinvAttr() { return _localctx; } - public partial class MethodNameContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { - return GetRuleContext(0); + public partial class MethodDeclsContext : ParserRuleContext { + [System.Diagnostics.DebuggerNonUserCode] public MethodDeclContext[] methodDecl() { + return GetRuleContexts(); } - public MethodNameContext(ParserRuleContext parent, int invokingState) + [System.Diagnostics.DebuggerNonUserCode] public MethodDeclContext methodDecl(int i) { + return GetRuleContext(i); + } + public MethodDeclsContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_methodName; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitMethodName(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_methodDecls; } } } [RuleVersion(0)] - public MethodNameContext methodName() { - MethodNameContext _localctx = new MethodNameContext(Context, State); - EnterRule(_localctx, 264, RULE_methodName); + public MethodDeclsContext methodDecls() { + MethodDeclsContext _localctx = new MethodDeclsContext(Context, State); + EnterRule(_localctx, 250, RULE_methodDecls); + int _la; try { - State = 2072; + EnterOuterAlt(_localctx, 1); + { + State = 2742; ErrorHandler.Sync(this); - switch (TokenStream.LA(1)) { - case T__115: - EnterOuterAlt(_localctx, 1); + _la = TokenStream.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 38789119998L) != 0) || _la==T__72 || _la==T__73 || _la==T__157 || _la==T__164 || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 2303696760354115601L) != 0)) { { - State = 2069; - Match(T__115); - } - break; - case T__154: - EnterOuterAlt(_localctx, 2); { - State = 2070; - Match(T__154); + State = 2739; + methodDecl(); } - break; - case T__15: - case INSTANCE: - case SQSTRING: - case DOTTEDNAME: - case ID: - EnterOuterAlt(_localctx, 3); - { - State = 2071; - dottedName(); } - break; - default: - throw new NoViableAltException(this); + State = 2744; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } } } catch (RecognitionException re) { @@ -12165,159 +12839,318 @@ public MethodNameContext methodName() { return _localctx; } - public partial class ImplAttrContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode UNMANAGED() { return GetToken(CILParser.UNMANAGED, 0); } + public partial class MethodDeclContext : ParserRuleContext { + public Int32Context value; + public DataDeclContext declaration; + public SecDeclContext security; + public ExtSourceSpecContext source; + public LanguageDeclContext language; + public CustomDescrInMethodBodyContext attribute; + [System.Diagnostics.DebuggerNonUserCode] public InstrContext instr() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode EMITBYTE() { return GetToken(CILParser.EMITBYTE, 0); } [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } - public ImplAttrContext(ParserRuleContext parent, int invokingState) + [System.Diagnostics.DebuggerNonUserCode] public SehBlockContext sehBlock() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode MAXSTACK() { return GetToken(CILParser.MAXSTACK, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ENTRYPOINT() { return GetToken(CILParser.ENTRYPOINT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ZEROINIT() { return GetToken(CILParser.ZEROINIT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public LabelDeclContext labelDecl() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ScopeBlockContext scopeBlock() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public LocalsDeclContext localsDecl() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public DataDeclContext dataDecl() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public SecDeclContext secDecl() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ExtSourceSpecContext extSourceSpec() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public LanguageDeclContext languageDecl() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public CustomDescrInMethodBodyContext customDescrInMethodBody() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public CompControlContext compControl() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ExportDeclContext exportDecl() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public VtentryDeclContext vtentryDecl() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public OverrideDeclContext overrideDecl() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ParameterDeclContext parameterDecl() { + return GetRuleContext(0); + } + public MethodDeclContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_implAttr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitImplAttr(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_methodDecl; } } } [RuleVersion(0)] - public ImplAttrContext implAttr() { - ImplAttrContext _localctx = new ImplAttrContext(Context, State); - EnterRule(_localctx, 266, RULE_implAttr); + public MethodDeclContext methodDecl() { + MethodDeclContext _localctx = new MethodDeclContext(Context, State); + EnterRule(_localctx, 252, RULE_methodDecl); try { - State = 2095; + State = 2782; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { - case T__0: + case INSTR_NONE: + case INSTR_VAR: + case INSTR_I: + case INSTR_I8: + case INSTR_R: + case INSTR_METHOD: + case INSTR_SIG: + case INSTR_BRTARGET: + case INSTR_SWITCH: + case INSTR_TYPE: + case INSTR_STRING: + case INSTR_FIELD: + case INSTR_TOK: EnterOuterAlt(_localctx, 1); { - State = 2074; - Match(T__0); + State = 2745; + instr(); } break; - case T__1: + case EMITBYTE: EnterOuterAlt(_localctx, 2); { - State = 2075; - Match(T__1); + State = 2746; + Match(EMITBYTE); + State = 2747; + _localctx.value = int32(); + Actions.EmitByte((_localctx.value!=null?(_localctx.value.Start):null)); } break; - case T__155: + case T__157: EnterOuterAlt(_localctx, 3); { - State = 2076; - Match(T__155); + State = 2750; + sehBlock(); } break; - case T__2: + case MAXSTACK: EnterOuterAlt(_localctx, 4); { - State = 2077; - Match(T__2); + State = 2751; + Match(MAXSTACK); + State = 2752; + _localctx.value = int32(); + Actions.SetMaxStack((_localctx.value!=null?(_localctx.value.Start):null)); } break; - case T__3: + case ENTRYPOINT: EnterOuterAlt(_localctx, 5); { - State = 2078; - Match(T__3); + State = 2755; + Match(ENTRYPOINT); + Actions.SetEntryPoint(); } break; - case UNMANAGED: + case ZEROINIT: EnterOuterAlt(_localctx, 6); { - State = 2079; - Match(UNMANAGED); + State = 2757; + Match(ZEROINIT); + Actions.SetZeroInit(); } break; + case T__0: + case T__1: + case T__2: + case T__3: case T__4: + case T__5: + case T__6: + case T__7: + case T__8: + case T__9: + case T__10: + case T__11: + case T__12: + case T__13: + case T__14: + case INSTANCE: + case UNMANAGED: + case SQSTRING: + case ID: EnterOuterAlt(_localctx, 7); { - State = 2080; - Match(T__4); + State = 2759; + labelDecl(); } break; - case T__5: + case T__16: EnterOuterAlt(_localctx, 8); { - State = 2081; - Match(T__5); + State = 2760; + scopeBlock(); } break; - case T__6: + case LOCALS: EnterOuterAlt(_localctx, 9); { - State = 2082; - Match(T__6); + State = 2761; + localsDecl(); } break; - case T__7: + case T__164: EnterOuterAlt(_localctx, 10); { - State = 2083; - Match(T__7); + State = 2762; + _localctx.declaration = dataDecl(); + Actions.ProcessMethodDataDeclaration(_localctx.declaration); } break; - case T__8: + case PERMISSION: + case PERMISSIONSET: EnterOuterAlt(_localctx, 11); { - State = 2084; - Match(T__8); + State = 2765; + _localctx.security = secDecl(); + Actions.ProcessMethodSecurityDeclaration(_localctx.security); } break; - case T__9: + case T__72: + case T__73: EnterOuterAlt(_localctx, 12); { - State = 2085; - Match(T__9); + State = 2768; + _localctx.source = extSourceSpec(); + Actions.ProcessMethodSourceDirective(_localctx.source); } break; - case T__10: + case T__26: EnterOuterAlt(_localctx, 13); { - State = 2086; - Match(T__10); + State = 2771; + _localctx.language = languageDecl(); + Actions.ProcessMethodLanguageDirective(_localctx.language); } break; - case T__11: + case T__34: EnterOuterAlt(_localctx, 14); { - State = 2087; - Match(T__11); + State = 2774; + _localctx.attribute = customDescrInMethodBody(); + Actions.ProcessMethodCustomAttribute(_localctx.attribute); } break; - case T__12: + case T__31: + case PP_DEFINE: + case PP_UNDEF: + case PP_IFDEF: + case PP_IFNDEF: + case PP_ELSE: + case PP_ENDIF: + case PP_INCLUDE: EnterOuterAlt(_localctx, 15); { - State = 2088; - Match(T__12); + State = 2777; + compControl(); } break; - case T__13: + case EXPORT: EnterOuterAlt(_localctx, 16); { - State = 2089; - Match(T__13); + State = 2778; + exportDecl(); } break; - case T__69: + case VTENTRY: EnterOuterAlt(_localctx, 17); { - State = 2090; - Match(T__69); - State = 2091; - Match(T__29); - State = 2092; - int32(); - State = 2093; - Match(T__30); + State = 2779; + vtentryDecl(); + } + break; + case OVERRIDE: + EnterOuterAlt(_localctx, 18); + { + State = 2780; + overrideDecl(); + } + break; + case PARAM: + EnterOuterAlt(_localctx, 19); + { + State = 2781; + parameterDecl(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class LocalsDeclContext : ParserRuleContext { + public int InitialSyntaxErrorCount; + public IToken initialize; + public SigArgsContext arguments; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LOCALS() { return GetToken(CILParser.LOCALS, 0); } + [System.Diagnostics.DebuggerNonUserCode] public SigArgsContext sigArgs() { + return GetRuleContext(0); + } + public LocalsDeclContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_localsDecl; } } + } + + [RuleVersion(0)] + public LocalsDeclContext localsDecl() { + LocalsDeclContext _localctx = new LocalsDeclContext(Context, State); + EnterRule(_localctx, 254, RULE_localsDecl); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 2784; + Match(LOCALS); + State = 2786; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + if (_la==T__156) { + { + State = 2785; + _localctx.initialize = Match(T__156); } - break; - default: - throw new NoViableAltException(this); + } + + State = 2788; + _localctx.arguments = sigArgs(); } } catch (RecognitionException re) { @@ -12326,53 +13159,59 @@ public ImplAttrContext implAttr() { ErrorHandler.Recover(this, re); } finally { + Actions.EndLocalsDirective(_localctx, _localctx.InitialSyntaxErrorCount); ExitRule(); } return _localctx; } - public partial class MethodDeclsContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public MethodDeclContext[] methodDecl() { - return GetRuleContexts(); + public partial class ExportDeclContext : ParserRuleContext { + public int InitialSyntaxErrorCount; + public Int32Context ordinal; + public IdContext alias; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode EXPORT() { return GetToken(CILParser.EXPORT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { + return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public MethodDeclContext methodDecl(int i) { - return GetRuleContext(i); + [System.Diagnostics.DebuggerNonUserCode] public IdContext id() { + return GetRuleContext(0); } - public MethodDeclsContext(ParserRuleContext parent, int invokingState) + public ExportDeclContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_methodDecls; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitMethodDecls(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_exportDecl; } } } [RuleVersion(0)] - public MethodDeclsContext methodDecls() { - MethodDeclsContext _localctx = new MethodDeclsContext(Context, State); - EnterRule(_localctx, 268, RULE_methodDecls); + public ExportDeclContext exportDecl() { + ExportDeclContext _localctx = new ExportDeclContext(Context, State); + EnterRule(_localctx, 256, RULE_exportDecl); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2100; + State = 2790; + Match(EXPORT); + State = 2791; + Match(T__41); + State = 2792; + _localctx.ordinal = int32(); + State = 2793; + Match(T__42); + State = 2796; ErrorHandler.Sync(this); _la = TokenStream.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 38789119998L) != 0) || _la==T__72 || _la==T__73 || _la==T__157 || _la==T__164 || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 2303696760354115601L) != 0)) { - { + if (_la==T__33) { { - State = 2097; - methodDecl(); - } + State = 2794; + Match(T__33); + State = 2795; + _localctx.alias = id(); } - State = 2102; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); } + } } catch (RecognitionException re) { @@ -12381,63 +13220,73 @@ public MethodDeclsContext methodDecls() { ErrorHandler.Recover(this, re); } finally { + Actions.EndExportDirective(_localctx, _localctx.InitialSyntaxErrorCount); ExitRule(); } return _localctx; } - public partial class MethodDeclContext : ParserRuleContext { - [System.Diagnostics.DebuggerNonUserCode] public InstrContext instr() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode EMITBYTE() { return GetToken(CILParser.EMITBYTE, 0); } + public partial class VtentryDeclContext : ParserRuleContext { + public int InitialSyntaxErrorCount; + public Int32Context table; + public Int32Context slot; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VTENTRY() { return GetToken(CILParser.VTENTRY, 0); } [System.Diagnostics.DebuggerNonUserCode] public Int32Context[] int32() { return GetRuleContexts(); } [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32(int i) { return GetRuleContext(i); } - [System.Diagnostics.DebuggerNonUserCode] public SehBlockContext sehBlock() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode MAXSTACK() { return GetToken(CILParser.MAXSTACK, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode LOCALS() { return GetToken(CILParser.LOCALS, 0); } - [System.Diagnostics.DebuggerNonUserCode] public SigArgsContext sigArgs() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ENTRYPOINT() { return GetToken(CILParser.ENTRYPOINT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ZEROINIT() { return GetToken(CILParser.ZEROINIT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public DataDeclContext dataDecl() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public LabelDeclContext labelDecl() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public SecDeclContext secDecl() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ExtSourceSpecContext extSourceSpec() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public LanguageDeclContext languageDecl() { - return GetRuleContext(0); + public VtentryDeclContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { } - [System.Diagnostics.DebuggerNonUserCode] public CustomDescrInMethodBodyContext customDescrInMethodBody() { - return GetRuleContext(0); + public override int RuleIndex { get { return RULE_vtentryDecl; } } + } + + [RuleVersion(0)] + public VtentryDeclContext vtentryDecl() { + VtentryDeclContext _localctx = new VtentryDeclContext(Context, State); + EnterRule(_localctx, 258, RULE_vtentryDecl); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + try { + EnterOuterAlt(_localctx, 1); + { + State = 2798; + Match(VTENTRY); + State = 2799; + _localctx.table = int32(); + State = 2800; + Match(T__74); + State = 2801; + _localctx.slot = int32(); + } } - [System.Diagnostics.DebuggerNonUserCode] public CompControlContext compControl() { - return GetRuleContext(0); + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode EXPORT() { return GetToken(CILParser.EXPORT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public IdContext id() { - return GetRuleContext(0); + finally { + Actions.EndVTableEntryDirective(_localctx, _localctx.InitialSyntaxErrorCount); + ExitRule(); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode VTENTRY() { return GetToken(CILParser.VTENTRY, 0); } + return _localctx; + } + + public partial class OverrideDeclContext : ParserRuleContext { + public int InitialSyntaxErrorCount; + public TypeSpecOrScopeContext owner; + public MethodNameContext name; + public CallConvContext convention; + public TypeContext returnType; + public GenArityContext arity; + public SigArgsContext arguments; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode OVERRIDE() { return GetToken(CILParser.OVERRIDE, 0); } - [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { - return GetRuleContext(0); - } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DCOLON() { return GetToken(CILParser.DCOLON, 0); } + [System.Diagnostics.DebuggerNonUserCode] public TypeSpecOrScopeContext typeSpecOrScope() { + return GetRuleContext(0); + } [System.Diagnostics.DebuggerNonUserCode] public MethodNameContext methodName() { return GetRuleContext(0); } @@ -12451,399 +13300,284 @@ [System.Diagnostics.DebuggerNonUserCode] public TypeContext type() { [System.Diagnostics.DebuggerNonUserCode] public GenArityContext genArity() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ScopeBlockContext scopeBlock() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PARAM() { return GetToken(CILParser.PARAM, 0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode TYPE() { return GetToken(CILParser.TYPE, 0); } - [System.Diagnostics.DebuggerNonUserCode] public CustomAttrDeclContext[] customAttrDecl() { - return GetRuleContexts(); - } - [System.Diagnostics.DebuggerNonUserCode] public CustomAttrDeclContext customAttrDecl(int i) { - return GetRuleContext(i); - } - [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { - return GetRuleContext(0); - } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CONSTRAINT() { return GetToken(CILParser.CONSTRAINT, 0); } - [System.Diagnostics.DebuggerNonUserCode] public InitOptContext initOpt() { - return GetRuleContext(0); + [System.Diagnostics.DebuggerNonUserCode] public SigArgsContext sigArgs() { + return GetRuleContext(0); } - public MethodDeclContext(ParserRuleContext parent, int invokingState) + public OverrideDeclContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_methodDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitMethodDecl(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_overrideDecl; } } } [RuleVersion(0)] - public MethodDeclContext methodDecl() { - MethodDeclContext _localctx = new MethodDeclContext(Context, State); - EnterRule(_localctx, 270, RULE_methodDecl); + public OverrideDeclContext overrideDecl() { + OverrideDeclContext _localctx = new OverrideDeclContext(Context, State); + EnterRule(_localctx, 260, RULE_overrideDecl); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; try { - int _alt; - State = 2211; + State = 2818; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,126,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,133,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2103; - instr(); - } - break; - case 2: - EnterOuterAlt(_localctx, 2); - { - State = 2104; - Match(EMITBYTE); - State = 2105; - int32(); - } - break; - case 3: - EnterOuterAlt(_localctx, 3); - { - State = 2106; - sehBlock(); - } - break; - case 4: - EnterOuterAlt(_localctx, 4); - { - State = 2107; - Match(MAXSTACK); - State = 2108; - int32(); - } - break; - case 5: - EnterOuterAlt(_localctx, 5); - { - State = 2109; - Match(LOCALS); - State = 2110; - sigArgs(); - } - break; - case 6: - EnterOuterAlt(_localctx, 6); - { - State = 2111; - Match(LOCALS); - State = 2112; - Match(T__156); - State = 2113; - sigArgs(); - } - break; - case 7: - EnterOuterAlt(_localctx, 7); - { - State = 2114; - Match(ENTRYPOINT); - } - break; - case 8: - EnterOuterAlt(_localctx, 8); - { - State = 2115; - Match(ZEROINIT); - } - break; - case 9: - EnterOuterAlt(_localctx, 9); - { - State = 2116; - dataDecl(); - } - break; - case 10: - EnterOuterAlt(_localctx, 10); - { - State = 2117; - labelDecl(); - } - break; - case 11: - EnterOuterAlt(_localctx, 11); - { - State = 2118; - secDecl(); - } - break; - case 12: - EnterOuterAlt(_localctx, 12); - { - State = 2119; - extSourceSpec(); - } - break; - case 13: - EnterOuterAlt(_localctx, 13); - { - State = 2120; - languageDecl(); - } - break; - case 14: - EnterOuterAlt(_localctx, 14); - { - State = 2121; - customDescrInMethodBody(); - } - break; - case 15: - EnterOuterAlt(_localctx, 15); - { - State = 2122; - compControl(); - } - break; - case 16: - EnterOuterAlt(_localctx, 16); - { - State = 2123; - Match(EXPORT); - State = 2124; - Match(T__41); - State = 2125; - int32(); - State = 2126; - Match(T__42); - } - break; - case 17: - EnterOuterAlt(_localctx, 17); - { - State = 2128; - Match(EXPORT); - State = 2129; - Match(T__41); - State = 2130; - int32(); - State = 2131; - Match(T__42); - State = 2132; - Match(T__33); - State = 2133; - id(); - } - break; - case 18: - EnterOuterAlt(_localctx, 18); - { - State = 2135; - Match(VTENTRY); - State = 2136; - int32(); - State = 2137; - Match(T__74); - State = 2138; - int32(); - } - break; - case 19: - EnterOuterAlt(_localctx, 19); - { - State = 2140; - Match(OVERRIDE); - State = 2141; - typeSpec(); - State = 2142; - Match(DCOLON); - State = 2143; - methodName(); - } - break; - case 20: - EnterOuterAlt(_localctx, 20); - { - State = 2145; + State = 2803; Match(OVERRIDE); - State = 2146; - Match(METHOD); - State = 2147; - callConv(); - State = 2148; - type(); - State = 2149; - typeSpec(); - State = 2150; + State = 2804; + _localctx.owner = typeSpecOrScope(); + State = 2805; Match(DCOLON); - State = 2151; - methodName(); - State = 2152; - genArity(); - State = 2153; - sigArgs(); + State = 2806; + _localctx.name = methodName(); } break; - case 21: - EnterOuterAlt(_localctx, 21); + case 2: + EnterOuterAlt(_localctx, 2); { - State = 2155; - scopeBlock(); + State = 2808; + Match(OVERRIDE); + State = 2809; + Match(METHOD); + State = 2810; + _localctx.convention = callConv(); + State = 2811; + _localctx.returnType = type(); + State = 2812; + _localctx.owner = typeSpecOrScope(); + State = 2813; + Match(DCOLON); + State = 2814; + _localctx.name = methodName(); + State = 2815; + _localctx.arity = genArity(); + State = 2816; + _localctx.arguments = sigArgs(); } break; - case 22: - EnterOuterAlt(_localctx, 22); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + Actions.EndOverrideDirective(_localctx, _localctx.InitialSyntaxErrorCount); + ExitRule(); + } + return _localctx; + } + + public partial class ParameterDeclContext : ParserRuleContext { + public int InitialSyntaxErrorCount; + public System.Collections.Immutable.ImmutableArray.Builder Attributes; + public Int32Context genericIndex; + public CustomAttrDeclContext attribute; + public DottedNameContext genericName; + public Int32Context constraintIndex; + public TypeSpecContext constraintType; + public DottedNameContext constraintName; + public Int32Context parameterIndex; + public InitOptContext initializer; + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PARAM() { return GetToken(CILParser.PARAM, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode TYPE() { return GetToken(CILParser.TYPE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public CustomAttrDeclContext[] customAttrDecl() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public CustomAttrDeclContext customAttrDecl(int i) { + return GetRuleContext(i); + } + [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CONSTRAINT() { return GetToken(CILParser.CONSTRAINT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public InitOptContext initOpt() { + return GetRuleContext(0); + } + public ParameterDeclContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_parameterDecl; } } + } + + [RuleVersion(0)] + public ParameterDeclContext parameterDecl() { + ParameterDeclContext _localctx = new ParameterDeclContext(Context, State); + EnterRule(_localctx, 262, RULE_parameterDecl); + + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Attributes = System.Collections.Immutable.ImmutableArray.CreateBuilder(); + + try { + int _alt; + State = 2885; + ErrorHandler.Sync(this); + switch ( Interpreter.AdaptivePredict(TokenStream,139,Context) ) { + case 1: + EnterOuterAlt(_localctx, 1); { - State = 2156; + State = 2820; Match(PARAM); - State = 2157; + State = 2821; Match(TYPE); - State = 2158; + State = 2822; Match(T__41); - State = 2159; - int32(); - State = 2160; + State = 2823; + _localctx.genericIndex = int32(); + State = 2824; Match(T__42); - State = 2164; + State = 2830; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,121,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,134,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 2161; - customAttrDecl(); - } + State = 2825; + _localctx.attribute = customAttrDecl(); + Actions.AddCustomAttributeApplication(_localctx.Attributes, _localctx.attribute); } + } } - State = 2166; + State = 2832; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,121,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,134,Context); } } break; - case 23: - EnterOuterAlt(_localctx, 23); + case 2: + EnterOuterAlt(_localctx, 2); { - State = 2167; + State = 2833; Match(PARAM); - State = 2168; + State = 2834; Match(TYPE); - State = 2169; - dottedName(); - State = 2173; + State = 2835; + _localctx.genericName = dottedName(); + State = 2841; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,122,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,135,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 2170; - customAttrDecl(); - } + State = 2836; + _localctx.attribute = customAttrDecl(); + Actions.AddCustomAttributeApplication(_localctx.Attributes, _localctx.attribute); } + } } - State = 2175; + State = 2843; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,122,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,135,Context); } } break; - case 24: - EnterOuterAlt(_localctx, 24); + case 3: + EnterOuterAlt(_localctx, 3); { - State = 2176; + State = 2844; Match(PARAM); - State = 2177; + State = 2845; Match(CONSTRAINT); - State = 2178; + State = 2846; Match(T__41); - State = 2179; - int32(); - State = 2180; + State = 2847; + _localctx.constraintIndex = int32(); + State = 2848; Match(T__42); - State = 2181; + State = 2849; Match(T__27); - State = 2182; - typeSpec(); - State = 2186; + State = 2850; + _localctx.constraintType = typeSpec(); + State = 2856; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,123,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,136,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 2183; - customAttrDecl(); - } + State = 2851; + _localctx.attribute = customAttrDecl(); + Actions.AddCustomAttributeApplication(_localctx.Attributes, _localctx.attribute); } + } } - State = 2188; + State = 2858; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,123,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,136,Context); } } break; - case 25: - EnterOuterAlt(_localctx, 25); + case 4: + EnterOuterAlt(_localctx, 4); { - State = 2189; + State = 2859; Match(PARAM); - State = 2190; + State = 2860; Match(CONSTRAINT); - State = 2191; - dottedName(); - State = 2192; + State = 2861; + _localctx.constraintName = dottedName(); + State = 2862; Match(T__27); - State = 2193; - typeSpec(); - State = 2197; + State = 2863; + _localctx.constraintType = typeSpec(); + State = 2869; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,124,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,137,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 2194; - customAttrDecl(); - } + State = 2864; + _localctx.attribute = customAttrDecl(); + Actions.AddCustomAttributeApplication(_localctx.Attributes, _localctx.attribute); } + } } - State = 2199; + State = 2871; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,124,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,137,Context); } } break; - case 26: - EnterOuterAlt(_localctx, 26); + case 5: + EnterOuterAlt(_localctx, 5); { - State = 2200; + State = 2872; Match(PARAM); - State = 2201; + State = 2873; Match(T__41); - State = 2202; - int32(); - State = 2203; + State = 2874; + _localctx.parameterIndex = int32(); + State = 2875; Match(T__42); - State = 2204; - initOpt(); - State = 2208; + State = 2876; + _localctx.initializer = initOpt(); + State = 2882; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,125,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,138,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 2205; - customAttrDecl(); - } + State = 2877; + _localctx.attribute = customAttrDecl(); + Actions.AddCustomAttributeApplication(_localctx.Attributes, _localctx.attribute); } + } } - State = 2210; + State = 2884; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,125,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,138,Context); } } break; @@ -12855,12 +13589,17 @@ public MethodDeclContext methodDecl() { ErrorHandler.Recover(this, re); } finally { + Actions.EndParameterDirective( + _localctx, + _localctx.Attributes.ToImmutable(), + _localctx.InitialSyntaxErrorCount); ExitRule(); } return _localctx; } public partial class LabelDeclContext : ParserRuleContext { + public IdContext name; [System.Diagnostics.DebuggerNonUserCode] public IdContext id() { return GetRuleContext(0); } @@ -12869,25 +13608,20 @@ public LabelDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_labelDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitLabelDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public LabelDeclContext labelDecl() { LabelDeclContext _localctx = new LabelDeclContext(Context, State); - EnterRule(_localctx, 272, RULE_labelDecl); + EnterRule(_localctx, 264, RULE_labelDecl); try { EnterOuterAlt(_localctx, 1); { - State = 2213; - id(); - State = 2214; + State = 2887; + _localctx.name = id(); + State = 2888; Match(T__74); + Actions.DefineLabel((_localctx.name!=null?(_localctx.name.Start):null)); } } catch (RecognitionException re) { @@ -12902,6 +13636,11 @@ public LabelDeclContext labelDecl() { } public partial class CustomDescrInMethodBodyContext : ParserRuleContext { + public CILParser.CustomAttributeDeclarationValue Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public CustomDescrContext directAttribute; + public CustomDescrWithOwnerContext ownedAttribute; [System.Diagnostics.DebuggerNonUserCode] public CustomDescrContext customDescr() { return GetRuleContext(0); } @@ -12913,34 +13652,34 @@ public CustomDescrInMethodBodyContext(ParserRuleContext parent, int invokingStat { } public override int RuleIndex { get { return RULE_customDescrInMethodBody; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCustomDescrInMethodBody(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public CustomDescrInMethodBodyContext customDescrInMethodBody() { CustomDescrInMethodBodyContext _localctx = new CustomDescrInMethodBodyContext(Context, State); - EnterRule(_localctx, 274, RULE_customDescrInMethodBody); + EnterRule(_localctx, 266, RULE_customDescrInMethodBody); + + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.CustomAttributeDeclarationValue.Error; + try { - State = 2218; + State = 2897; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,127,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,140,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2216; - customDescr(); + State = 2891; + _localctx.directAttribute = customDescr(); + _localctx.Value = Actions.CreateCustomAttributeDeclaration(_localctx.directAttribute.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2217; - customDescrWithOwner(); + State = 2894; + _localctx.ownedAttribute = customDescrWithOwner(); + _localctx.Value = Actions.CreateCustomAttributeDeclaration(_localctx.ownedAttribute.Value); } break; } @@ -12951,6 +13690,11 @@ public CustomDescrInMethodBodyContext customDescrInMethodBody() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + ExitRule(); } return _localctx; @@ -12965,26 +13709,21 @@ public ScopeBlockContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_scopeBlock; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitScopeBlock(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ScopeBlockContext scopeBlock() { ScopeBlockContext _localctx = new ScopeBlockContext(Context, State); - EnterRule(_localctx, 276, RULE_scopeBlock); + EnterRule(_localctx, 268, RULE_scopeBlock); + Actions.BeginScope(_localctx); try { EnterOuterAlt(_localctx, 1); { - State = 2220; + State = 2899; Match(T__16); - State = 2221; + State = 2900; methodDecls(); - State = 2222; + State = 2901; Match(T__17); } } @@ -12994,12 +13733,16 @@ public ScopeBlockContext scopeBlock() { ErrorHandler.Recover(this, re); } finally { + Actions.EndScope(_localctx); ExitRule(); } return _localctx; } public partial class SehBlockContext : ParserRuleContext { + public int InitialSyntaxErrorCount; + public TryBlockContext tryRange; + public SehClausesContext clauses; [System.Diagnostics.DebuggerNonUserCode] public TryBlockContext tryBlock() { return GetRuleContext(0); } @@ -13011,25 +13754,20 @@ public SehBlockContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_sehBlock; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSehBlock(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public SehBlockContext sehBlock() { SehBlockContext _localctx = new SehBlockContext(Context, State); - EnterRule(_localctx, 278, RULE_sehBlock); + EnterRule(_localctx, 270, RULE_sehBlock); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; try { EnterOuterAlt(_localctx, 1); { - State = 2224; - tryBlock(); - State = 2225; - sehClauses(); + State = 2903; + _localctx.tryRange = tryBlock(); + State = 2904; + _localctx.clauses = sehClauses(); } } catch (RecognitionException re) { @@ -13038,12 +13776,16 @@ public SehBlockContext sehBlock() { ErrorHandler.Recover(this, re); } finally { + Actions.EndExceptionBlock(_localctx, _localctx.InitialSyntaxErrorCount); ExitRule(); } return _localctx; } public partial class SehClausesContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public SehClauseContext clause; [System.Diagnostics.DebuggerNonUserCode] public SehClauseContext[] sehClause() { return GetRuleContexts(); } @@ -13055,33 +13797,29 @@ public SehClausesContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_sehClauses; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSehClauses(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public SehClausesContext sehClauses() { SehClausesContext _localctx = new SehClausesContext(Context, State); - EnterRule(_localctx, 280, RULE_sehClauses); + EnterRule(_localctx, 272, RULE_sehClauses); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2228; + State = 2909; ErrorHandler.Sync(this); _la = TokenStream.LA(1); do { { { - State = 2227; - sehClause(); + State = 2906; + _localctx.clause = sehClause(); + _localctx.Builder.Add(_localctx.clause.Value); } } - State = 2230; + State = 2911; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } while ( ((((_la - 160)) & ~0x3f) == 0 && ((1L << (_la - 160)) & 15L) != 0) ); @@ -13093,12 +13831,19 @@ public SehClausesContext sehClauses() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } public partial class TryBlockContext : ParserRuleContext { + public CILParser.ExceptionRangeValue Value; + public ScopeBlockContext body; + public IdContext startLabel; + public IdContext endLabel; + public Int32Context startOffset; + public Int32Context endOffset; [System.Diagnostics.DebuggerNonUserCode] public ScopeBlockContext scopeBlock() { return GetRuleContext(0); } @@ -13119,55 +13864,53 @@ public TryBlockContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_tryBlock; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTryBlock(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TryBlockContext tryBlock() { TryBlockContext _localctx = new TryBlockContext(Context, State); - EnterRule(_localctx, 282, RULE_tryBlock); + EnterRule(_localctx, 274, RULE_tryBlock); + _localctx.Value = CILParser.ExceptionRangeValue.Invalid; try { - State = 2244; + State = 2929; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,129,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,142,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2232; + State = 2913; Match(T__157); - State = 2233; - scopeBlock(); + State = 2914; + _localctx.body = scopeBlock(); + _localctx.Value = Actions.CreateScopeExceptionRange(_localctx.body); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2234; + State = 2917; Match(T__157); - State = 2235; - id(); - State = 2236; + State = 2918; + _localctx.startLabel = id(); + State = 2919; Match(T__158); - State = 2237; - id(); + State = 2920; + _localctx.endLabel = id(); + _localctx.Value = Actions.CreateLabelExceptionRange((_localctx.startLabel!=null?(_localctx.startLabel.Start):null), (_localctx.endLabel!=null?(_localctx.endLabel.Start):null)); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 2239; + State = 2923; Match(T__157); - State = 2240; - int32(); - State = 2241; + State = 2924; + _localctx.startOffset = int32(); + State = 2925; Match(T__158); - State = 2242; - int32(); + State = 2926; + _localctx.endOffset = int32(); + _localctx.Value = Actions.CreateOffsetExceptionRange((_localctx.startOffset!=null?(_localctx.startOffset.Start):null), (_localctx.endOffset!=null?(_localctx.endOffset.Start):null)); } break; } @@ -13184,6 +13927,10 @@ public TryBlockContext tryBlock() { } public partial class SehClauseContext : ParserRuleContext { + public CILParser.ExceptionClauseValue Value; + public CatchClauseContext caught; + public HandlerBlockContext handler; + public FilterClauseContext filtered; [System.Diagnostics.DebuggerNonUserCode] public CatchClauseContext catchClause() { return GetRuleContext(0); } @@ -13204,56 +13951,55 @@ public SehClauseContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_sehClause; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSehClause(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public SehClauseContext sehClause() { SehClauseContext _localctx = new SehClauseContext(Context, State); - EnterRule(_localctx, 284, RULE_sehClause); + EnterRule(_localctx, 276, RULE_sehClause); + _localctx.Value = CILParser.ExceptionClauseValue.Invalid; try { - State = 2258; + State = 2947; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__160: EnterOuterAlt(_localctx, 1); { - State = 2246; - catchClause(); - State = 2247; - handlerBlock(); + State = 2931; + _localctx.caught = catchClause(); + State = 2932; + _localctx.handler = handlerBlock(); + _localctx.Value = Actions.CreateCatchExceptionClause(_localctx.caught.Value, _localctx.handler.Value); } break; case T__159: EnterOuterAlt(_localctx, 2); { - State = 2249; - filterClause(); - State = 2250; - handlerBlock(); + State = 2935; + _localctx.filtered = filterClause(); + State = 2936; + _localctx.handler = handlerBlock(); + _localctx.Value = Actions.CreateFilterExceptionClause(_localctx.filtered.Value, _localctx.handler.Value); } break; case T__161: EnterOuterAlt(_localctx, 3); { - State = 2252; + State = 2939; finallyClause(); - State = 2253; - handlerBlock(); + State = 2940; + _localctx.handler = handlerBlock(); + _localctx.Value = Actions.CreateFinallyExceptionClause(_localctx.handler.Value); } break; case T__162: EnterOuterAlt(_localctx, 4); { - State = 2255; + State = 2943; faultClause(); - State = 2256; - handlerBlock(); + State = 2944; + _localctx.handler = handlerBlock(); + _localctx.Value = Actions.CreateFaultExceptionClause(_localctx.handler.Value); } break; default: @@ -13272,6 +14018,10 @@ public SehClauseContext sehClause() { } public partial class FilterClauseContext : ParserRuleContext { + public CILParser.ExceptionFilterValue Value; + public ScopeBlockContext body; + public IdContext label; + public Int32Context offset; [System.Diagnostics.DebuggerNonUserCode] public ScopeBlockContext scopeBlock() { return GetRuleContext(0); } @@ -13286,47 +14036,45 @@ public FilterClauseContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_filterClause; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitFilterClause(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public FilterClauseContext filterClause() { FilterClauseContext _localctx = new FilterClauseContext(Context, State); - EnterRule(_localctx, 286, RULE_filterClause); + EnterRule(_localctx, 278, RULE_filterClause); + _localctx.Value = CILParser.ExceptionFilterValue.Invalid; try { - State = 2266; + State = 2961; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,131,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,144,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2260; + State = 2949; Match(T__159); - State = 2261; - scopeBlock(); + State = 2950; + _localctx.body = scopeBlock(); + _localctx.Value = Actions.CreateScopeFilter(_localctx.body); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2262; + State = 2953; Match(T__159); - State = 2263; - id(); + State = 2954; + _localctx.label = id(); + _localctx.Value = Actions.CreateLabelFilter((_localctx.label!=null?(_localctx.label.Start):null)); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 2264; + State = 2957; Match(T__159); - State = 2265; - int32(); + State = 2958; + _localctx.offset = int32(); + _localctx.Value = Actions.CreateOffsetFilter((_localctx.offset!=null?(_localctx.offset.Start):null)); } break; } @@ -13343,6 +14091,9 @@ public FilterClauseContext filterClause() { } public partial class CatchClauseContext : ParserRuleContext { + public CILParser.CatchTypeValue Value; + public int InitialSyntaxErrorCount; + public TypeSpecContext catchType; [System.Diagnostics.DebuggerNonUserCode] public TypeSpecContext typeSpec() { return GetRuleContext(0); } @@ -13351,25 +14102,23 @@ public CatchClauseContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_catchClause; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCatchClause(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public CatchClauseContext catchClause() { CatchClauseContext _localctx = new CatchClauseContext(Context, State); - EnterRule(_localctx, 288, RULE_catchClause); + EnterRule(_localctx, 280, RULE_catchClause); + + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.CatchTypeValue.Invalid; + try { EnterOuterAlt(_localctx, 1); { - State = 2268; + State = 2963; Match(T__160); - State = 2269; - typeSpec(); + State = 2964; + _localctx.catchType = typeSpec(); } } catch (RecognitionException re) { @@ -13378,6 +14127,7 @@ public CatchClauseContext catchClause() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = Actions.EndCatchClause(_localctx, _localctx.InitialSyntaxErrorCount); ExitRule(); } return _localctx; @@ -13389,22 +14139,16 @@ public FinallyClauseContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_finallyClause; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitFinallyClause(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public FinallyClauseContext finallyClause() { FinallyClauseContext _localctx = new FinallyClauseContext(Context, State); - EnterRule(_localctx, 290, RULE_finallyClause); + EnterRule(_localctx, 282, RULE_finallyClause); try { EnterOuterAlt(_localctx, 1); { - State = 2271; + State = 2966; Match(T__161); } } @@ -13425,22 +14169,16 @@ public FaultClauseContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_faultClause; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitFaultClause(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public FaultClauseContext faultClause() { FaultClauseContext _localctx = new FaultClauseContext(Context, State); - EnterRule(_localctx, 292, RULE_faultClause); + EnterRule(_localctx, 284, RULE_faultClause); try { EnterOuterAlt(_localctx, 1); { - State = 2273; + State = 2968; Match(T__162); } } @@ -13456,6 +14194,12 @@ public FaultClauseContext faultClause() { } public partial class HandlerBlockContext : ParserRuleContext { + public CILParser.ExceptionRangeValue Value; + public ScopeBlockContext body; + public IdContext startLabel; + public IdContext endLabel; + public Int32Context startOffset; + public Int32Context endOffset; [System.Diagnostics.DebuggerNonUserCode] public ScopeBlockContext scopeBlock() { return GetRuleContext(0); } @@ -13476,53 +14220,51 @@ public HandlerBlockContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_handlerBlock; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitHandlerBlock(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public HandlerBlockContext handlerBlock() { HandlerBlockContext _localctx = new HandlerBlockContext(Context, State); - EnterRule(_localctx, 294, RULE_handlerBlock); + EnterRule(_localctx, 286, RULE_handlerBlock); + _localctx.Value = CILParser.ExceptionRangeValue.Invalid; try { - State = 2286; + State = 2985; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,132,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,145,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2275; - scopeBlock(); + State = 2970; + _localctx.body = scopeBlock(); + _localctx.Value = Actions.CreateScopeExceptionRange(_localctx.body); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2276; + State = 2973; Match(T__163); - State = 2277; - id(); - State = 2278; + State = 2974; + _localctx.startLabel = id(); + State = 2975; Match(T__158); - State = 2279; - id(); + State = 2976; + _localctx.endLabel = id(); + _localctx.Value = Actions.CreateLabelExceptionRange((_localctx.startLabel!=null?(_localctx.startLabel.Start):null), (_localctx.endLabel!=null?(_localctx.endLabel.Start):null)); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 2281; + State = 2979; Match(T__163); - State = 2282; - int32(); - State = 2283; + State = 2980; + _localctx.startOffset = int32(); + State = 2981; Match(T__158); - State = 2284; - int32(); + State = 2982; + _localctx.endOffset = int32(); + _localctx.Value = Actions.CreateOffsetExceptionRange((_localctx.startOffset!=null?(_localctx.startOffset.Start):null), (_localctx.endOffset!=null?(_localctx.endOffset.Start):null)); } break; } @@ -13539,6 +14281,9 @@ public HandlerBlockContext handlerBlock() { } public partial class DataDeclContext : ParserRuleContext { + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public CILParser.DataDeclarationBuilder Builder; [System.Diagnostics.DebuggerNonUserCode] public DdHeadContext ddHead() { return GetRuleContext(0); } @@ -13550,25 +14295,23 @@ public DataDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_dataDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitDataDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public DataDeclContext dataDecl() { DataDeclContext _localctx = new DataDeclContext(Context, State); - EnterRule(_localctx, 296, RULE_dataDecl); + EnterRule(_localctx, 288, RULE_dataDecl); + + _localctx.Builder = Actions.CreateDataDeclaration(_localctx); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + try { EnterOuterAlt(_localctx, 1); { - State = 2288; - ddHead(); - State = 2289; - ddBody(); + State = 2987; + ddHead(_localctx.Builder); + State = 2988; + ddBody(_localctx.Builder); } } catch (RecognitionException re) { @@ -13577,59 +14320,61 @@ public DataDeclContext dataDecl() { ErrorHandler.Recover(this, re); } finally { + Actions.EndDataDeclaration(_localctx, _localctx.Builder, _localctx.InitialSyntaxErrorCount); ExitRule(); } return _localctx; } public partial class DdHeadContext : ParserRuleContext { + public CILParser.DataDeclarationBuilder Builder; + public TlsContext section; + public IdContext name; [System.Diagnostics.DebuggerNonUserCode] public TlsContext tls() { return GetRuleContext(0); } [System.Diagnostics.DebuggerNonUserCode] public IdContext id() { return GetRuleContext(0); } - public DdHeadContext(ParserRuleContext parent, int invokingState) + public DdHeadContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } + public DdHeadContext(ParserRuleContext parent, int invokingState, CILParser.DataDeclarationBuilder Builder) : base(parent, invokingState) { + this.Builder = Builder; } public override int RuleIndex { get { return RULE_ddHead; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitDdHead(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] - public DdHeadContext ddHead() { - DdHeadContext _localctx = new DdHeadContext(Context, State); - EnterRule(_localctx, 298, RULE_ddHead); + public DdHeadContext ddHead(CILParser.DataDeclarationBuilder Builder) { + DdHeadContext _localctx = new DdHeadContext(Context, State, Builder); + EnterRule(_localctx, 290, RULE_ddHead); try { - State = 2298; + State = 3000; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,133,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,146,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2291; + State = 2990; Match(T__164); - State = 2292; - tls(); - State = 2293; - id(); - State = 2294; + State = 2991; + _localctx.section = tls(); + State = 2992; + _localctx.name = id(); + State = 2993; Match(T__35); + Actions.SetDataDeclarationHeader(_localctx.Builder, _localctx.section.Value, (_localctx.name!=null?(_localctx.name.Start):null)); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2296; + State = 2996; Match(T__164); - State = 2297; - tls(); + State = 2997; + _localctx.section = tls(); + Actions.SetAnonymousDataDeclarationHeader(_localctx.Builder, _localctx.section.Value); } break; } @@ -13646,27 +14391,23 @@ public DdHeadContext ddHead() { } public partial class TlsContext : ParserRuleContext { + public byte Value; public TlsContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_tls; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitTls(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public TlsContext tls() { TlsContext _localctx = new TlsContext(Context, State); - EnterRule(_localctx, 300, RULE_tls); + EnterRule(_localctx, 292, RULE_tls); + _localctx.Value = Actions.GetMappedDataSection(); try { - State = 2303; + State = 3007; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,134,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,147,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { @@ -13675,15 +14416,17 @@ public TlsContext tls() { case 2: EnterOuterAlt(_localctx, 2); { - State = 2301; + State = 3003; Match(T__165); + _localctx.Value = Actions.GetTlsDataSection(_localctx); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 2302; + State = 3005; Match(T__1); + _localctx.Value = Actions.GetCilDataSection(); } break; } @@ -13700,6 +14443,7 @@ public TlsContext tls() { } public partial class DdBodyContext : ParserRuleContext { + public CILParser.DataDeclarationBuilder Builder; [System.Diagnostics.DebuggerNonUserCode] public DdItemListContext ddItemList() { return GetRuleContext(0); } @@ -13709,36 +14453,32 @@ [System.Diagnostics.DebuggerNonUserCode] public DdItemContext[] ddItem() { [System.Diagnostics.DebuggerNonUserCode] public DdItemContext ddItem(int i) { return GetRuleContext(i); } - public DdBodyContext(ParserRuleContext parent, int invokingState) + public DdBodyContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } + public DdBodyContext(ParserRuleContext parent, int invokingState, CILParser.DataDeclarationBuilder Builder) : base(parent, invokingState) { + this.Builder = Builder; } public override int RuleIndex { get { return RULE_ddBody; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitDdBody(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] - public DdBodyContext ddBody() { - DdBodyContext _localctx = new DdBodyContext(Context, State); - EnterRule(_localctx, 302, RULE_ddBody); + public DdBodyContext ddBody(CILParser.DataDeclarationBuilder Builder) { + DdBodyContext _localctx = new DdBodyContext(Context, State, Builder); + EnterRule(_localctx, 294, RULE_ddBody); int _la; try { - State = 2314; + State = 3018; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__16: EnterOuterAlt(_localctx, 1); { - State = 2305; + State = 3009; Match(T__16); - State = 2306; - ddItemList(); - State = 2307; + State = 3010; + ddItemList(_localctx.Builder); + State = 3011; Match(T__17); } break; @@ -13753,17 +14493,17 @@ public DdBodyContext ddBody() { case REF: EnterOuterAlt(_localctx, 2); { - State = 2310; + State = 3014; ErrorHandler.Sync(this); _la = TokenStream.LA(1); do { { { - State = 2309; - ddItem(); + State = 3013; + ddItem(_localctx.Builder); } } - State = 2312; + State = 3016; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } while ( _la==T__83 || ((((_la - 180)) & ~0x3f) == 0 && ((1L << (_la - 180)) & 505L) != 0) || _la==REF ); @@ -13785,53 +14525,50 @@ public DdBodyContext ddBody() { } public partial class DdItemListContext : ParserRuleContext { + public CILParser.DataDeclarationBuilder Builder; [System.Diagnostics.DebuggerNonUserCode] public DdItemContext[] ddItem() { return GetRuleContexts(); } [System.Diagnostics.DebuggerNonUserCode] public DdItemContext ddItem(int i) { return GetRuleContext(i); } - public DdItemListContext(ParserRuleContext parent, int invokingState) + public DdItemListContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } + public DdItemListContext(ParserRuleContext parent, int invokingState, CILParser.DataDeclarationBuilder Builder) : base(parent, invokingState) { + this.Builder = Builder; } public override int RuleIndex { get { return RULE_ddItemList; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitDdItemList(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] - public DdItemListContext ddItemList() { - DdItemListContext _localctx = new DdItemListContext(Context, State); - EnterRule(_localctx, 304, RULE_ddItemList); + public DdItemListContext ddItemList(CILParser.DataDeclarationBuilder Builder) { + DdItemListContext _localctx = new DdItemListContext(Context, State, Builder); + EnterRule(_localctx, 296, RULE_ddItemList); try { int _alt; EnterOuterAlt(_localctx, 1); { - State = 2321; + State = 3025; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,137,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,150,Context); while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { { { - State = 2316; - ddItem(); - State = 2317; + State = 3020; + ddItem(_localctx.Builder); + State = 3021; Match(T__27); } - } + } } - State = 2323; + State = 3027; ErrorHandler.Sync(this); - _alt = Interpreter.AdaptivePredict(TokenStream,137,Context); + _alt = Interpreter.AdaptivePredict(TokenStream,150,Context); } - State = 2324; - ddItem(); + State = 3028; + ddItem(_localctx.Builder); } } catch (RecognitionException re) { @@ -13846,28 +14583,28 @@ public DdItemListContext ddItemList() { } public partial class DdItemCountContext : ParserRuleContext { + public CILParser.DataDeclarationBuilder Builder; + public int Value; + public Int32Context count; [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } - public DdItemCountContext(ParserRuleContext parent, int invokingState) + public DdItemCountContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } + public DdItemCountContext(ParserRuleContext parent, int invokingState, CILParser.DataDeclarationBuilder Builder) : base(parent, invokingState) { + this.Builder = Builder; } public override int RuleIndex { get { return RULE_ddItemCount; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitDdItemCount(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] - public DdItemCountContext ddItemCount() { - DdItemCountContext _localctx = new DdItemCountContext(Context, State); - EnterRule(_localctx, 306, RULE_ddItemCount); + public DdItemCountContext ddItemCount(CILParser.DataDeclarationBuilder Builder) { + DdItemCountContext _localctx = new DdItemCountContext(Context, State, Builder); + EnterRule(_localctx, 298, RULE_ddItemCount); + _localctx.Value = 1; try { - State = 2331; + State = 3036; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__0: @@ -13970,12 +14707,13 @@ public DdItemCountContext ddItemCount() { case T__41: EnterOuterAlt(_localctx, 2); { - State = 2327; + State = 3031; Match(T__41); - State = 2328; - int32(); - State = 2329; + State = 3032; + _localctx.count = int32(); + State = 3033; Match(T__42); + _localctx.Value = Actions.ParseDataItemCount(_localctx.Builder, (_localctx.count!=null?(_localctx.count.Start):null)); } break; default: @@ -13994,6 +14732,15 @@ public DdItemCountContext ddItemCount() { } public partial class DdItemContext : ParserRuleContext { + public CILParser.DataDeclarationBuilder Builder; + public CompQstringContext stringValue; + public IdContext target; + public BytesContext byteValue; + public IToken kind; + public Float64Context floatingValue; + public DdItemCountContext count; + public Int64Context int64Value; + public Int32Context integerValue; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode CHAR() { return GetToken(CILParser.CHAR, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode PTR() { return GetToken(CILParser.PTR, 0); } [System.Diagnostics.DebuggerNonUserCode] public CompQstringContext compQstring() { @@ -14006,237 +14753,176 @@ [System.Diagnostics.DebuggerNonUserCode] public IdContext id() { [System.Diagnostics.DebuggerNonUserCode] public BytesContext bytes() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOAT32() { return GetToken(CILParser.FLOAT32, 0); } [System.Diagnostics.DebuggerNonUserCode] public Float64Context float64() { return GetRuleContext(0); } [System.Diagnostics.DebuggerNonUserCode] public DdItemCountContext ddItemCount() { return GetRuleContext(0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOAT32() { return GetToken(CILParser.FLOAT32, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOAT64_() { return GetToken(CILParser.FLOAT64_, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT64_() { return GetToken(CILParser.INT64_, 0); } [System.Diagnostics.DebuggerNonUserCode] public Int64Context int64() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT32_() { return GetToken(CILParser.INT32_, 0); } [System.Diagnostics.DebuggerNonUserCode] public Int32Context int32() { return GetRuleContext(0); } + [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT32_() { return GetToken(CILParser.INT32_, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT16() { return GetToken(CILParser.INT16, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT8() { return GetToken(CILParser.INT8, 0); } - public DdItemContext(ParserRuleContext parent, int invokingState) + public DdItemContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } + public DdItemContext(ParserRuleContext parent, int invokingState, CILParser.DataDeclarationBuilder Builder) : base(parent, invokingState) { + this.Builder = Builder; } public override int RuleIndex { get { return RULE_ddItem; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitDdItem(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] - public DdItemContext ddItem() { - DdItemContext _localctx = new DdItemContext(Context, State); - EnterRule(_localctx, 308, RULE_ddItem); + public DdItemContext ddItem(CILParser.DataDeclarationBuilder Builder) { + DdItemContext _localctx = new DdItemContext(Context, State, Builder); + EnterRule(_localctx, 300, RULE_ddItem); + int _la; try { - State = 2399; + State = 3086; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,139,Context) ) { - case 1: - EnterOuterAlt(_localctx, 1); - { - State = 2333; - Match(CHAR); - State = 2334; - Match(PTR); - State = 2335; - Match(T__29); - State = 2336; - compQstring(); - State = 2337; - Match(T__30); - } - break; - case 2: - EnterOuterAlt(_localctx, 2); - { - State = 2339; - Match(REF); - State = 2340; - Match(T__29); - State = 2341; - id(); - State = 2342; - Match(T__30); - } - break; - case 3: - EnterOuterAlt(_localctx, 3); - { - State = 2344; - Match(REF); - State = 2345; - id(); - } - break; - case 4: - EnterOuterAlt(_localctx, 4); - { - State = 2346; - Match(T__83); - State = 2347; - Match(T__29); - State = 2348; - bytes(); - State = 2349; - Match(T__30); - } - break; - case 5: - EnterOuterAlt(_localctx, 5); - { - State = 2351; - Match(FLOAT32); - State = 2352; - Match(T__29); - State = 2353; - float64(); - State = 2354; - Match(T__30); - State = 2355; - ddItemCount(); - } - break; - case 6: - EnterOuterAlt(_localctx, 6); - { - State = 2357; - Match(FLOAT64_); - State = 2358; - Match(T__29); - State = 2359; - float64(); - State = 2360; - Match(T__30); - State = 2361; - ddItemCount(); - } - break; - case 7: - EnterOuterAlt(_localctx, 7); - { - State = 2363; - Match(INT64_); - State = 2364; - Match(T__29); - State = 2365; - int64(); - State = 2366; - Match(T__30); - State = 2367; - ddItemCount(); - } - break; - case 8: - EnterOuterAlt(_localctx, 8); - { - State = 2369; - Match(INT32_); - State = 2370; - Match(T__29); - State = 2371; - int32(); - State = 2372; - Match(T__30); - State = 2373; - ddItemCount(); - } - break; - case 9: - EnterOuterAlt(_localctx, 9); + switch ( Interpreter.AdaptivePredict(TokenStream,152,Context) ) { + case 1: + EnterOuterAlt(_localctx, 1); { - State = 2375; - Match(INT16); - State = 2376; + State = 3038; + Match(CHAR); + State = 3039; + Match(PTR); + State = 3040; Match(T__29); - State = 2377; - int32(); - State = 2378; + State = 3041; + _localctx.stringValue = compQstring(); + State = 3042; Match(T__30); - State = 2379; - ddItemCount(); + Actions.AddDataString(_localctx.Builder, _localctx.stringValue.Value); } break; - case 10: - EnterOuterAlt(_localctx, 10); + case 2: + EnterOuterAlt(_localctx, 2); { - State = 2381; - Match(INT8); - State = 2382; + State = 3045; + Match(REF); + State = 3046; Match(T__29); - State = 2383; - int32(); - State = 2384; + State = 3047; + _localctx.target = id(); + State = 3048; Match(T__30); - State = 2385; - ddItemCount(); + Actions.AddDataReference(_localctx.Builder, (_localctx.target!=null?(_localctx.target.Start):null)); } break; - case 11: - EnterOuterAlt(_localctx, 11); + case 3: + EnterOuterAlt(_localctx, 3); { - State = 2387; - Match(FLOAT32); - State = 2388; - ddItemCount(); + State = 3051; + Match(REF); + State = 3052; + _localctx.target = id(); + Actions.AddDataReference(_localctx.Builder, (_localctx.target!=null?(_localctx.target.Start):null)); } break; - case 12: - EnterOuterAlt(_localctx, 12); + case 4: + EnterOuterAlt(_localctx, 4); { - State = 2389; - Match(FLOAT64_); - State = 2390; - ddItemCount(); + State = 3055; + Match(T__83); + State = 3056; + Match(T__29); + State = 3057; + _localctx.byteValue = bytes(); + State = 3058; + Match(T__30); + Actions.AddDataBytes(_localctx.Builder, _localctx.byteValue.Value); } break; - case 13: - EnterOuterAlt(_localctx, 13); + case 5: + EnterOuterAlt(_localctx, 5); { - State = 2391; - Match(INT64_); - State = 2392; - ddItemCount(); + State = 3061; + _localctx.kind = TokenStream.LT(1); + _la = TokenStream.LA(1); + if ( !(_la==FLOAT32 || _la==FLOAT64_) ) { + _localctx.kind = ErrorHandler.RecoverInline(this); + } + else { + ErrorHandler.ReportMatch(this); + Consume(); + } + State = 3062; + Match(T__29); + State = 3063; + _localctx.floatingValue = float64(); + State = 3064; + Match(T__30); + State = 3065; + _localctx.count = ddItemCount(_localctx.Builder); + Actions.AddFloatingPointData(_localctx.Builder, _localctx.kind, _localctx.floatingValue.Value, _localctx.count.Value); } break; - case 14: - EnterOuterAlt(_localctx, 14); + case 6: + EnterOuterAlt(_localctx, 6); { - State = 2393; - Match(INT32_); - State = 2394; - ddItemCount(); + State = 3068; + _localctx.kind = Match(INT64_); + State = 3069; + Match(T__29); + State = 3070; + _localctx.int64Value = int64(); + State = 3071; + Match(T__30); + State = 3072; + _localctx.count = ddItemCount(_localctx.Builder); + Actions.AddInt64Data(_localctx.Builder, _localctx.kind, (_localctx.int64Value!=null?(_localctx.int64Value.Start):null), _localctx.count.Value); } break; - case 15: - EnterOuterAlt(_localctx, 15); + case 7: + EnterOuterAlt(_localctx, 7); { - State = 2395; - Match(INT16); - State = 2396; - ddItemCount(); + State = 3075; + _localctx.kind = TokenStream.LT(1); + _la = TokenStream.LA(1); + if ( !(((((_la - 183)) & ~0x3f) == 0 && ((1L << (_la - 183)) & 7L) != 0)) ) { + _localctx.kind = ErrorHandler.RecoverInline(this); + } + else { + ErrorHandler.ReportMatch(this); + Consume(); + } + State = 3076; + Match(T__29); + State = 3077; + _localctx.integerValue = int32(); + State = 3078; + Match(T__30); + State = 3079; + _localctx.count = ddItemCount(_localctx.Builder); + Actions.AddIntegerData(_localctx.Builder, _localctx.kind, (_localctx.integerValue!=null?(_localctx.integerValue.Start):null), _localctx.count.Value); } break; - case 16: - EnterOuterAlt(_localctx, 16); + case 8: + EnterOuterAlt(_localctx, 8); { - State = 2397; - Match(INT8); - State = 2398; - ddItemCount(); + State = 3082; + _localctx.kind = TokenStream.LT(1); + _la = TokenStream.LA(1); + if ( !(((((_la - 183)) & ~0x3f) == 0 && ((1L << (_la - 183)) & 63L) != 0)) ) { + _localctx.kind = ErrorHandler.RecoverInline(this); + } + else { + ErrorHandler.ReportMatch(this); + Consume(); + } + State = 3083; + _localctx.count = ddItemCount(_localctx.Builder); + Actions.AddZeroData(_localctx.Builder, _localctx.kind, _localctx.count.Value); } break; } @@ -14253,6 +14939,32 @@ public DdItemContext ddItem() { } public partial class FieldSerInitContext : ParserRuleContext { + public System.Reflection.Metadata.BlobBuilder Value; + public Float64Context float32Value; + public Float64Context float64Value; + public Int32Context float32Bits; + public Int64Context float64Bits; + public IToken int64Type; + public Int64Context int64Value; + public IToken int32Type; + public Int32Context int32Value; + public IToken int16Type; + public Int32Context int16Value; + public IToken int8Type; + public Int32Context int8Value; + public IToken uint64Type; + public Int64Context uint64Value; + public IToken uint32Type; + public Int32Context uint32Value; + public IToken uint16Type; + public Int32Context uint16Value; + public IToken uint8Type; + public Int32Context uint8Value; + public IToken charType; + public Int32Context charValue; + public IToken boolType; + public TruefalseContext boolValue; + public BytesContext byteArrayValue; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOAT32() { return GetToken(CILParser.FLOAT32, 0); } [System.Diagnostics.DebuggerNonUserCode] public Float64Context float64() { return GetRuleContext(0); @@ -14285,215 +14997,224 @@ public FieldSerInitContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_fieldSerInit; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitFieldSerInit(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public FieldSerInitContext fieldSerInit() { FieldSerInitContext _localctx = new FieldSerInitContext(Context, State); - EnterRule(_localctx, 310, RULE_fieldSerInit); + EnterRule(_localctx, 302, RULE_fieldSerInit); try { - State = 2476; + State = 3178; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,140,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,153,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2401; + State = 3088; Match(FLOAT32); - State = 2402; + State = 3089; Match(T__29); - State = 2403; - float64(); - State = 2404; + State = 3090; + _localctx.float32Value = float64(); + State = 3091; Match(T__30); + _localctx.Value = Actions.CreateFloat32SerializedInitializer(_localctx.float32Value, _localctx.float32Value.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2406; + State = 3094; Match(FLOAT64_); - State = 2407; + State = 3095; Match(T__29); - State = 2408; - float64(); - State = 2409; + State = 3096; + _localctx.float64Value = float64(); + State = 3097; Match(T__30); + _localctx.Value = Actions.CreateFloat64SerializedInitializer(_localctx.float64Value, _localctx.float64Value.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 2411; + State = 3100; Match(FLOAT32); - State = 2412; + State = 3101; Match(T__29); - State = 2413; - int32(); - State = 2414; + State = 3102; + _localctx.float32Bits = int32(); + State = 3103; Match(T__30); + _localctx.Value = Actions.CreateFloat32BitsSerializedInitializer((_localctx.float32Bits!=null?(_localctx.float32Bits.Start):null)); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 2416; + State = 3106; Match(FLOAT64_); - State = 2417; + State = 3107; Match(T__29); - State = 2418; - int64(); - State = 2419; + State = 3108; + _localctx.float64Bits = int64(); + State = 3109; Match(T__30); + _localctx.Value = Actions.CreateFloat64BitsSerializedInitializer((_localctx.float64Bits!=null?(_localctx.float64Bits.Start):null)); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 2421; - Match(INT64_); - State = 2422; + State = 3112; + _localctx.int64Type = Match(INT64_); + State = 3113; Match(T__29); - State = 2423; - int64(); - State = 2424; + State = 3114; + _localctx.int64Value = int64(); + State = 3115; Match(T__30); + _localctx.Value = Actions.CreateIntegerSerializedInitializer(_localctx.int64Type, (_localctx.int64Value!=null?(_localctx.int64Value.Start):null)); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 2426; - Match(INT32_); - State = 2427; + State = 3118; + _localctx.int32Type = Match(INT32_); + State = 3119; Match(T__29); - State = 2428; - int32(); - State = 2429; + State = 3120; + _localctx.int32Value = int32(); + State = 3121; Match(T__30); + _localctx.Value = Actions.CreateIntegerSerializedInitializer(_localctx.int32Type, (_localctx.int32Value!=null?(_localctx.int32Value.Start):null)); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 2431; - Match(INT16); - State = 2432; + State = 3124; + _localctx.int16Type = Match(INT16); + State = 3125; Match(T__29); - State = 2433; - int32(); - State = 2434; + State = 3126; + _localctx.int16Value = int32(); + State = 3127; Match(T__30); + _localctx.Value = Actions.CreateIntegerSerializedInitializer(_localctx.int16Type, (_localctx.int16Value!=null?(_localctx.int16Value.Start):null)); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 2436; - Match(INT8); - State = 2437; + State = 3130; + _localctx.int8Type = Match(INT8); + State = 3131; Match(T__29); - State = 2438; - int32(); - State = 2439; + State = 3132; + _localctx.int8Value = int32(); + State = 3133; Match(T__30); + _localctx.Value = Actions.CreateIntegerSerializedInitializer(_localctx.int8Type, (_localctx.int8Value!=null?(_localctx.int8Value.Start):null)); } break; case 9: EnterOuterAlt(_localctx, 9); { - State = 2441; - Match(UINT64); - State = 2442; + State = 3136; + _localctx.uint64Type = Match(UINT64); + State = 3137; Match(T__29); - State = 2443; - int64(); - State = 2444; + State = 3138; + _localctx.uint64Value = int64(); + State = 3139; Match(T__30); + _localctx.Value = Actions.CreateIntegerSerializedInitializer(_localctx.uint64Type, (_localctx.uint64Value!=null?(_localctx.uint64Value.Start):null)); } break; case 10: EnterOuterAlt(_localctx, 10); { - State = 2446; - Match(UINT32); - State = 2447; + State = 3142; + _localctx.uint32Type = Match(UINT32); + State = 3143; Match(T__29); - State = 2448; - int32(); - State = 2449; + State = 3144; + _localctx.uint32Value = int32(); + State = 3145; Match(T__30); + _localctx.Value = Actions.CreateIntegerSerializedInitializer(_localctx.uint32Type, (_localctx.uint32Value!=null?(_localctx.uint32Value.Start):null)); } break; case 11: EnterOuterAlt(_localctx, 11); { - State = 2451; - Match(UINT16); - State = 2452; + State = 3148; + _localctx.uint16Type = Match(UINT16); + State = 3149; Match(T__29); - State = 2453; - int32(); - State = 2454; + State = 3150; + _localctx.uint16Value = int32(); + State = 3151; Match(T__30); + _localctx.Value = Actions.CreateIntegerSerializedInitializer(_localctx.uint16Type, (_localctx.uint16Value!=null?(_localctx.uint16Value.Start):null)); } break; case 12: EnterOuterAlt(_localctx, 12); { - State = 2456; - Match(UINT8); - State = 2457; + State = 3154; + _localctx.uint8Type = Match(UINT8); + State = 3155; Match(T__29); - State = 2458; - int32(); - State = 2459; + State = 3156; + _localctx.uint8Value = int32(); + State = 3157; Match(T__30); + _localctx.Value = Actions.CreateIntegerSerializedInitializer(_localctx.uint8Type, (_localctx.uint8Value!=null?(_localctx.uint8Value.Start):null)); } break; case 13: EnterOuterAlt(_localctx, 13); { - State = 2461; - Match(CHAR); - State = 2462; + State = 3160; + _localctx.charType = Match(CHAR); + State = 3161; Match(T__29); - State = 2463; - int32(); - State = 2464; + State = 3162; + _localctx.charValue = int32(); + State = 3163; Match(T__30); + _localctx.Value = Actions.CreateIntegerSerializedInitializer(_localctx.charType, (_localctx.charValue!=null?(_localctx.charValue.Start):null)); } break; case 14: EnterOuterAlt(_localctx, 14); { - State = 2466; - Match(BOOL); - State = 2467; + State = 3166; + _localctx.boolType = Match(BOOL); + State = 3167; Match(T__29); - State = 2468; - truefalse(); - State = 2469; + State = 3168; + _localctx.boolValue = truefalse(); + State = 3169; Match(T__30); + _localctx.Value = Actions.CreateBooleanSerializedInitializer(_localctx.boolType, _localctx.boolValue.Value); } break; case 15: EnterOuterAlt(_localctx, 15); { - State = 2471; + State = 3172; Match(T__83); - State = 2472; + State = 3173; Match(T__29); - State = 2473; - bytes(); - State = 2474; + State = 3174; + _localctx.byteArrayValue = bytes(); + State = 3175; Match(T__30); + _localctx.Value = Actions.CreateByteArraySerializedInitializer(_localctx.byteArrayValue.Value); } break; } @@ -14504,12 +15225,16 @@ public FieldSerInitContext fieldSerInit() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value ??= new System.Reflection.Metadata.BlobBuilder(); ExitRule(); } return _localctx; } public partial class BytesContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public HexbyteContext b; [System.Diagnostics.DebuggerNonUserCode] public HexbyteContext[] hexbyte() { return GetRuleContexts(); } @@ -14521,33 +15246,29 @@ public BytesContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_bytes; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitBytes(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public BytesContext bytes() { BytesContext _localctx = new BytesContext(Context, State); - EnterRule(_localctx, 312, RULE_bytes); + EnterRule(_localctx, 304, RULE_bytes); + _localctx.Builder = Actions.CreateByteAccumulator(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2481; + State = 3185; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==INT32 || _la==ID || _la==HEXBYTE) { { { - State = 2478; - hexbyte(); + State = 3180; + _localctx.b = hexbyte(); + Actions.AddByte(_localctx.Builder, _localctx.b.Value); } } - State = 2483; + State = 3187; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -14559,12 +15280,14 @@ public BytesContext bytes() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = Actions.EndBytes(_localctx.Builder); ExitRule(); } return _localctx; } public partial class HexbyteContext : ParserRuleContext { + public byte Value; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode INT32() { return GetToken(CILParser.INT32, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ID() { return GetToken(CILParser.ID, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode HEXBYTE() { return GetToken(CILParser.HEXBYTE, 0); } @@ -14573,23 +15296,17 @@ public HexbyteContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_hexbyte; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitHexbyte(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public HexbyteContext hexbyte() { HexbyteContext _localctx = new HexbyteContext(Context, State); - EnterRule(_localctx, 314, RULE_hexbyte); + EnterRule(_localctx, 306, RULE_hexbyte); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2484; + State = 3188; _la = TokenStream.LA(1); if ( !(_la==INT32 || _la==ID || _la==HEXBYTE) ) { ErrorHandler.RecoverInline(this); @@ -14599,6 +15316,8 @@ public HexbyteContext hexbyte() { Consume(); } } + Context.Stop = TokenStream.LT(-1); + _localctx.Value = GrammarActions.ParseHexbyte(_localctx.Start); } catch (RecognitionException re) { _localctx.exception = re; @@ -14612,6 +15331,9 @@ public HexbyteContext hexbyte() { } public partial class FieldInitContext : ParserRuleContext { + public CILParser.FieldInitializerValue Value; + public FieldSerInitContext serializedValue; + public CompQstringContext stringValue; [System.Diagnostics.DebuggerNonUserCode] public FieldSerInitContext fieldSerInit() { return GetRuleContext(0); } @@ -14624,20 +15346,15 @@ public FieldInitContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_fieldInit; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitFieldInit(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public FieldInitContext fieldInit() { FieldInitContext _localctx = new FieldInitContext(Context, State); - EnterRule(_localctx, 316, RULE_fieldInit); + EnterRule(_localctx, 308, RULE_fieldInit); + _localctx.Value = CILParser.FieldInitializerValue.Empty; try { - State = 2489; + State = 3198; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__83: @@ -14655,22 +15372,25 @@ public FieldInitContext fieldInit() { case UINT64: EnterOuterAlt(_localctx, 1); { - State = 2486; - fieldSerInit(); + State = 3190; + _localctx.serializedValue = fieldSerInit(); + _localctx.Value = Actions.CreateFieldInitializer(_localctx.serializedValue.Value); } break; case QSTRING: EnterOuterAlt(_localctx, 2); { - State = 2487; - compQstring(); + State = 3193; + _localctx.stringValue = compQstring(); + _localctx.Value = Actions.CreateFieldInitializer(_localctx.stringValue.Value); } break; case NULLREF: EnterOuterAlt(_localctx, 3); { - State = 2488; + State = 3196; Match(NULLREF); + _localctx.Value = Actions.CreateNullFieldInitializer(); } break; default: @@ -14689,6 +15409,57 @@ public FieldInitContext fieldInit() { } public partial class SerInitContext : ParserRuleContext { + public CILParser.SerializedInitializerValue Value; + public FieldSerInitContext scalarValue; + public IToken stringToken; + public IToken typeToken; + public ClassNameContext typeName; + public SerInitContext objectValue; + public IToken f32ElementToken; + public Int32Context f32Length; + public F32seqContext f32Values; + public IToken f64ElementToken; + public Int32Context f64Length; + public F64seqContext f64Values; + public IToken i64ElementToken; + public Int32Context i64Length; + public I64seqContext i64Values; + public IToken i32ElementToken; + public Int32Context i32Length; + public I32seqContext i32Values; + public IToken i16ElementToken; + public Int32Context i16Length; + public I16seqContext i16Values; + public IToken i8ElementToken; + public Int32Context i8Length; + public I8seqContext i8Values; + public IToken u64ElementToken; + public Int32Context u64Length; + public I64seqContext u64Values; + public IToken u32ElementToken; + public Int32Context u32Length; + public I32seqContext u32Values; + public IToken u16ElementToken; + public Int32Context u16Length; + public I16seqContext u16Values; + public IToken u8ElementToken; + public Int32Context u8Length; + public I8seqContext u8Values; + public IToken charElementToken; + public Int32Context charLength; + public I16seqContext charValues; + public IToken boolElementToken; + public Int32Context boolLength; + public BoolSeqContext boolValues; + public IToken stringElementToken; + public Int32Context stringLength; + public SqstringSeqContext stringValues; + public IToken typeElementToken; + public Int32Context typeLength; + public ClassSeqContext typeValues; + public IToken objectElementToken; + public Int32Context objectLength; + public ObjSeqContext objectValues; [System.Diagnostics.DebuggerNonUserCode] public FieldSerInitContext fieldSerInit() { return GetRuleContext(0); } @@ -14753,392 +15524,409 @@ public SerInitContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_serInit; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSerInit(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public SerInitContext serInit() { SerInitContext _localctx = new SerInitContext(Context, State); - EnterRule(_localctx, 318, RULE_serInit); + EnterRule(_localctx, 310, RULE_serInit); + _localctx.Value = CILParser.SerializedInitializerValue.Error; try { - State = 2639; + State = 3371; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,143,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,156,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2491; - fieldSerInit(); + State = 3200; + _localctx.scalarValue = fieldSerInit(); + _localctx.Value = Actions.CreateScalarSerializedValue(_localctx, _localctx.scalarValue, _localctx.scalarValue.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2492; + State = 3203; Match(STRING); - State = 2493; + State = 3204; Match(T__29); - State = 2494; + State = 3205; Match(NULLREF); - State = 2495; + State = 3206; Match(T__30); + _localctx.Value = Actions.CreateStringSerializedValue(); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 2496; + State = 3208; Match(STRING); - State = 2497; + State = 3209; Match(T__29); - State = 2498; - Match(SQSTRING); - State = 2499; + State = 3210; + _localctx.stringToken = Match(SQSTRING); + State = 3211; Match(T__30); + _localctx.Value = Actions.CreateStringSerializedValue(_localctx.stringToken); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 2500; + State = 3213; Match(TYPE); - State = 2501; + State = 3214; Match(T__29); - State = 2502; + State = 3215; Match(T__38); - State = 2503; - Match(SQSTRING); - State = 2504; + State = 3216; + _localctx.typeToken = Match(SQSTRING); + State = 3217; Match(T__30); + _localctx.Value = Actions.CreateTypeSerializedValue(_localctx.typeToken); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 2505; + State = 3219; Match(TYPE); - State = 2506; + State = 3220; Match(T__29); - State = 2507; - className(); - State = 2508; + State = 3221; + _localctx.typeName = className(); + State = 3222; Match(T__30); + _localctx.Value = Actions.CreateTypeSerializedValue(_localctx.typeName.Value); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 2510; + State = 3225; Match(TYPE); - State = 2511; + State = 3226; Match(T__29); - State = 2512; + State = 3227; Match(NULLREF); - State = 2513; + State = 3228; Match(T__30); + _localctx.Value = Actions.CreateNullTypeSerializedValue(); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 2514; + State = 3230; Match(OBJECT); - State = 2515; + State = 3231; Match(T__29); - State = 2516; - serInit(); - State = 2517; + State = 3232; + _localctx.objectValue = serInit(); + State = 3233; Match(T__30); + _localctx.Value = Actions.CreateObjectSerializedValue(_localctx.objectValue.Value); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 2519; - Match(FLOAT32); - State = 2520; + State = 3236; + _localctx.f32ElementToken = Match(FLOAT32); + State = 3237; Match(T__41); - State = 2521; - int32(); - State = 2522; + State = 3238; + _localctx.f32Length = int32(); + State = 3239; Match(T__42); - State = 2523; + State = 3240; Match(T__29); - State = 2524; - f32seq(); - State = 2525; + State = 3241; + _localctx.f32Values = f32seq(); + State = 3242; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.f32ElementToken, (_localctx.f32Length!=null?(_localctx.f32Length.Start):null), _localctx.f32Values.Value); } break; case 9: EnterOuterAlt(_localctx, 9); { - State = 2527; - Match(FLOAT64_); - State = 2528; + State = 3245; + _localctx.f64ElementToken = Match(FLOAT64_); + State = 3246; Match(T__41); - State = 2529; - int32(); - State = 2530; + State = 3247; + _localctx.f64Length = int32(); + State = 3248; Match(T__42); - State = 2531; + State = 3249; Match(T__29); - State = 2532; - f64seq(); - State = 2533; + State = 3250; + _localctx.f64Values = f64seq(); + State = 3251; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.f64ElementToken, (_localctx.f64Length!=null?(_localctx.f64Length.Start):null), _localctx.f64Values.Value); } break; case 10: EnterOuterAlt(_localctx, 10); { - State = 2535; - Match(INT64_); - State = 2536; + State = 3254; + _localctx.i64ElementToken = Match(INT64_); + State = 3255; Match(T__41); - State = 2537; - int32(); - State = 2538; + State = 3256; + _localctx.i64Length = int32(); + State = 3257; Match(T__42); - State = 2539; + State = 3258; Match(T__29); - State = 2540; - i64seq(); - State = 2541; + State = 3259; + _localctx.i64Values = i64seq(); + State = 3260; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.i64ElementToken, (_localctx.i64Length!=null?(_localctx.i64Length.Start):null), _localctx.i64Values.Value); } break; case 11: EnterOuterAlt(_localctx, 11); { - State = 2543; - Match(INT32_); - State = 2544; + State = 3263; + _localctx.i32ElementToken = Match(INT32_); + State = 3264; Match(T__41); - State = 2545; - int32(); - State = 2546; + State = 3265; + _localctx.i32Length = int32(); + State = 3266; Match(T__42); - State = 2547; + State = 3267; Match(T__29); - State = 2548; - i32seq(); - State = 2549; + State = 3268; + _localctx.i32Values = i32seq(); + State = 3269; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.i32ElementToken, (_localctx.i32Length!=null?(_localctx.i32Length.Start):null), _localctx.i32Values.Value); } break; case 12: EnterOuterAlt(_localctx, 12); { - State = 2551; - Match(INT16); - State = 2552; + State = 3272; + _localctx.i16ElementToken = Match(INT16); + State = 3273; Match(T__41); - State = 2553; - int32(); - State = 2554; + State = 3274; + _localctx.i16Length = int32(); + State = 3275; Match(T__42); - State = 2555; + State = 3276; Match(T__29); - State = 2556; - i16seq(); - State = 2557; + State = 3277; + _localctx.i16Values = i16seq(); + State = 3278; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.i16ElementToken, (_localctx.i16Length!=null?(_localctx.i16Length.Start):null), _localctx.i16Values.Value); } break; case 13: EnterOuterAlt(_localctx, 13); { - State = 2559; - Match(INT8); - State = 2560; + State = 3281; + _localctx.i8ElementToken = Match(INT8); + State = 3282; Match(T__41); - State = 2561; - int32(); - State = 2562; + State = 3283; + _localctx.i8Length = int32(); + State = 3284; Match(T__42); - State = 2563; + State = 3285; Match(T__29); - State = 2564; - i8seq(); - State = 2565; + State = 3286; + _localctx.i8Values = i8seq(); + State = 3287; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.i8ElementToken, (_localctx.i8Length!=null?(_localctx.i8Length.Start):null), _localctx.i8Values.Value); } break; case 14: EnterOuterAlt(_localctx, 14); { - State = 2567; - Match(UINT64); - State = 2568; + State = 3290; + _localctx.u64ElementToken = Match(UINT64); + State = 3291; Match(T__41); - State = 2569; - int32(); - State = 2570; + State = 3292; + _localctx.u64Length = int32(); + State = 3293; Match(T__42); - State = 2571; + State = 3294; Match(T__29); - State = 2572; - i64seq(); - State = 2573; + State = 3295; + _localctx.u64Values = i64seq(); + State = 3296; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.u64ElementToken, (_localctx.u64Length!=null?(_localctx.u64Length.Start):null), _localctx.u64Values.Value); } break; case 15: EnterOuterAlt(_localctx, 15); { - State = 2575; - Match(UINT32); - State = 2576; + State = 3299; + _localctx.u32ElementToken = Match(UINT32); + State = 3300; Match(T__41); - State = 2577; - int32(); - State = 2578; + State = 3301; + _localctx.u32Length = int32(); + State = 3302; Match(T__42); - State = 2579; + State = 3303; Match(T__29); - State = 2580; - i32seq(); - State = 2581; + State = 3304; + _localctx.u32Values = i32seq(); + State = 3305; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.u32ElementToken, (_localctx.u32Length!=null?(_localctx.u32Length.Start):null), _localctx.u32Values.Value); } break; case 16: EnterOuterAlt(_localctx, 16); { - State = 2583; - Match(UINT16); - State = 2584; + State = 3308; + _localctx.u16ElementToken = Match(UINT16); + State = 3309; Match(T__41); - State = 2585; - int32(); - State = 2586; + State = 3310; + _localctx.u16Length = int32(); + State = 3311; Match(T__42); - State = 2587; + State = 3312; Match(T__29); - State = 2588; - i16seq(); - State = 2589; + State = 3313; + _localctx.u16Values = i16seq(); + State = 3314; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.u16ElementToken, (_localctx.u16Length!=null?(_localctx.u16Length.Start):null), _localctx.u16Values.Value); } break; case 17: EnterOuterAlt(_localctx, 17); { - State = 2591; - Match(UINT8); - State = 2592; + State = 3317; + _localctx.u8ElementToken = Match(UINT8); + State = 3318; Match(T__41); - State = 2593; - int32(); - State = 2594; + State = 3319; + _localctx.u8Length = int32(); + State = 3320; Match(T__42); - State = 2595; + State = 3321; Match(T__29); - State = 2596; - i8seq(); - State = 2597; + State = 3322; + _localctx.u8Values = i8seq(); + State = 3323; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.u8ElementToken, (_localctx.u8Length!=null?(_localctx.u8Length.Start):null), _localctx.u8Values.Value); } break; case 18: EnterOuterAlt(_localctx, 18); { - State = 2599; - Match(CHAR); - State = 2600; + State = 3326; + _localctx.charElementToken = Match(CHAR); + State = 3327; Match(T__41); - State = 2601; - int32(); - State = 2602; + State = 3328; + _localctx.charLength = int32(); + State = 3329; Match(T__42); - State = 2603; + State = 3330; Match(T__29); - State = 2604; - i16seq(); - State = 2605; + State = 3331; + _localctx.charValues = i16seq(); + State = 3332; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.charElementToken, (_localctx.charLength!=null?(_localctx.charLength.Start):null), _localctx.charValues.Value); } break; case 19: EnterOuterAlt(_localctx, 19); { - State = 2607; - Match(BOOL); - State = 2608; + State = 3335; + _localctx.boolElementToken = Match(BOOL); + State = 3336; Match(T__41); - State = 2609; - int32(); - State = 2610; + State = 3337; + _localctx.boolLength = int32(); + State = 3338; Match(T__42); - State = 2611; + State = 3339; Match(T__29); - State = 2612; - boolSeq(); - State = 2613; + State = 3340; + _localctx.boolValues = boolSeq(); + State = 3341; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.boolElementToken, (_localctx.boolLength!=null?(_localctx.boolLength.Start):null), _localctx.boolValues.Value); } break; case 20: EnterOuterAlt(_localctx, 20); { - State = 2615; - Match(STRING); - State = 2616; + State = 3344; + _localctx.stringElementToken = Match(STRING); + State = 3345; Match(T__41); - State = 2617; - int32(); - State = 2618; + State = 3346; + _localctx.stringLength = int32(); + State = 3347; Match(T__42); - State = 2619; + State = 3348; Match(T__29); - State = 2620; - sqstringSeq(); - State = 2621; + State = 3349; + _localctx.stringValues = sqstringSeq(); + State = 3350; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.stringElementToken, (_localctx.stringLength!=null?(_localctx.stringLength.Start):null), _localctx.stringValues.Value); } break; case 21: EnterOuterAlt(_localctx, 21); { - State = 2623; - Match(TYPE); - State = 2624; + State = 3353; + _localctx.typeElementToken = Match(TYPE); + State = 3354; Match(T__41); - State = 2625; - int32(); - State = 2626; + State = 3355; + _localctx.typeLength = int32(); + State = 3356; Match(T__42); - State = 2627; + State = 3357; Match(T__29); - State = 2628; - classSeq(); - State = 2629; + State = 3358; + _localctx.typeValues = classSeq(); + State = 3359; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.typeElementToken, (_localctx.typeLength!=null?(_localctx.typeLength.Start):null), _localctx.typeValues.Value); } break; case 22: EnterOuterAlt(_localctx, 22); { - State = 2631; - Match(OBJECT); - State = 2632; + State = 3362; + _localctx.objectElementToken = Match(OBJECT); + State = 3363; Match(T__41); - State = 2633; - int32(); - State = 2634; + State = 3364; + _localctx.objectLength = int32(); + State = 3365; Match(T__42); - State = 2635; + State = 3366; Match(T__29); - State = 2636; - objSeq(); - State = 2637; + State = 3367; + _localctx.objectValues = objSeq(); + State = 3368; Match(T__30); + _localctx.Value = Actions.CreateArraySerializedValue(_localctx.objectElementToken, (_localctx.objectLength!=null?(_localctx.objectLength.Start):null), _localctx.objectValues.Value); } break; } @@ -15155,6 +15943,10 @@ public SerInitContext serInit() { } public partial class F32seqContext : ParserRuleContext { + public System.Reflection.Metadata.BlobBuilder Value; + public System.Reflection.Metadata.BlobBuilder Builder; + public Float64Context floatingValue; + public Int32Context integerValue; [System.Diagnostics.DebuggerNonUserCode] public Float64Context[] float64() { return GetRuleContexts(); } @@ -15172,45 +15964,42 @@ public F32seqContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_f32seq; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitF32seq(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public F32seqContext f32seq() { F32seqContext _localctx = new F32seqContext(Context, State); - EnterRule(_localctx, 320, RULE_f32seq); + EnterRule(_localctx, 312, RULE_f32seq); + _localctx.Builder = new System.Reflection.Metadata.BlobBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2645; + State = 3381; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (((((_la - 172)) & ~0x3f) == 0 && ((1L << (_la - 172)) & 98309L) != 0)) { { - State = 2643; + State = 3379; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,144,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,157,Context) ) { case 1: { - State = 2641; - float64(); + State = 3373; + _localctx.floatingValue = float64(); + Actions.AddFloat32SequenceValue(_localctx.Builder, _localctx.floatingValue.Value); } break; case 2: { - State = 2642; - int32(); + State = 3376; + _localctx.integerValue = int32(); + Actions.AddFloat32SequenceValue(_localctx.Builder, (_localctx.integerValue!=null?(_localctx.integerValue.Start):null)); } break; } } - State = 2647; + State = 3383; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -15222,12 +16011,17 @@ public F32seqContext f32seq() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder; ExitRule(); } return _localctx; } public partial class F64seqContext : ParserRuleContext { + public System.Reflection.Metadata.BlobBuilder Value; + public System.Reflection.Metadata.BlobBuilder Builder; + public Float64Context floatingValue; + public Int64Context integerValue; [System.Diagnostics.DebuggerNonUserCode] public Float64Context[] float64() { return GetRuleContexts(); } @@ -15245,45 +16039,42 @@ public F64seqContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_f64seq; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitF64seq(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public F64seqContext f64seq() { F64seqContext _localctx = new F64seqContext(Context, State); - EnterRule(_localctx, 322, RULE_f64seq); + EnterRule(_localctx, 314, RULE_f64seq); + _localctx.Builder = new System.Reflection.Metadata.BlobBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2652; + State = 3392; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (((((_la - 172)) & ~0x3f) == 0 && ((1L << (_la - 172)) & 98311L) != 0)) { { - State = 2650; + State = 3390; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,146,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,159,Context) ) { case 1: { - State = 2648; - float64(); + State = 3384; + _localctx.floatingValue = float64(); + Actions.AddFloat64SequenceValue(_localctx.Builder, _localctx.floatingValue.Value); } break; case 2: { - State = 2649; - int64(); + State = 3387; + _localctx.integerValue = int64(); + Actions.AddFloat64SequenceValue(_localctx.Builder, (_localctx.integerValue!=null?(_localctx.integerValue.Start):null)); } break; } } - State = 2654; + State = 3394; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -15295,12 +16086,16 @@ public F64seqContext f64seq() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder; ExitRule(); } return _localctx; } public partial class I64seqContext : ParserRuleContext { + public System.Reflection.Metadata.BlobBuilder Value; + public System.Reflection.Metadata.BlobBuilder Builder; + public Int64Context value; [System.Diagnostics.DebuggerNonUserCode] public Int64Context[] int64() { return GetRuleContexts(); } @@ -15312,33 +16107,29 @@ public I64seqContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_i64seq; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitI64seq(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public I64seqContext i64seq() { I64seqContext _localctx = new I64seqContext(Context, State); - EnterRule(_localctx, 324, RULE_i64seq); + EnterRule(_localctx, 316, RULE_i64seq); + _localctx.Builder = new System.Reflection.Metadata.BlobBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2658; + State = 3400; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==INT32 || _la==INT64) { { { - State = 2655; - int64(); + State = 3395; + _localctx.value = int64(); + Actions.AddInt64SequenceValue(_localctx.Builder, (_localctx.value!=null?(_localctx.value.Start):null)); } } - State = 2660; + State = 3402; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -15350,12 +16141,16 @@ public I64seqContext i64seq() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder; ExitRule(); } return _localctx; } public partial class I32seqContext : ParserRuleContext { + public System.Reflection.Metadata.BlobBuilder Value; + public System.Reflection.Metadata.BlobBuilder Builder; + public Int32Context value; [System.Diagnostics.DebuggerNonUserCode] public Int32Context[] int32() { return GetRuleContexts(); } @@ -15367,33 +16162,29 @@ public I32seqContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_i32seq; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitI32seq(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public I32seqContext i32seq() { I32seqContext _localctx = new I32seqContext(Context, State); - EnterRule(_localctx, 326, RULE_i32seq); + EnterRule(_localctx, 318, RULE_i32seq); + _localctx.Builder = new System.Reflection.Metadata.BlobBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2664; + State = 3408; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==INT32) { { { - State = 2661; - int32(); + State = 3403; + _localctx.value = int32(); + Actions.AddInt32SequenceValue(_localctx.Builder, (_localctx.value!=null?(_localctx.value.Start):null)); } } - State = 2666; + State = 3410; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -15405,12 +16196,16 @@ public I32seqContext i32seq() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder; ExitRule(); } return _localctx; } public partial class I16seqContext : ParserRuleContext { + public System.Reflection.Metadata.BlobBuilder Value; + public System.Reflection.Metadata.BlobBuilder Builder; + public Int32Context value; [System.Diagnostics.DebuggerNonUserCode] public Int32Context[] int32() { return GetRuleContexts(); } @@ -15422,33 +16217,29 @@ public I16seqContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_i16seq; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitI16seq(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public I16seqContext i16seq() { I16seqContext _localctx = new I16seqContext(Context, State); - EnterRule(_localctx, 328, RULE_i16seq); + EnterRule(_localctx, 320, RULE_i16seq); + _localctx.Builder = new System.Reflection.Metadata.BlobBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2670; + State = 3416; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==INT32) { { { - State = 2667; - int32(); + State = 3411; + _localctx.value = int32(); + Actions.AddInt16SequenceValue(_localctx.Builder, (_localctx.value!=null?(_localctx.value.Start):null)); } } - State = 2672; + State = 3418; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -15460,12 +16251,16 @@ public I16seqContext i16seq() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder; ExitRule(); } return _localctx; } public partial class I8seqContext : ParserRuleContext { + public System.Reflection.Metadata.BlobBuilder Value; + public System.Reflection.Metadata.BlobBuilder Builder; + public Int32Context value; [System.Diagnostics.DebuggerNonUserCode] public Int32Context[] int32() { return GetRuleContexts(); } @@ -15477,33 +16272,29 @@ public I8seqContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_i8seq; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitI8seq(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public I8seqContext i8seq() { I8seqContext _localctx = new I8seqContext(Context, State); - EnterRule(_localctx, 330, RULE_i8seq); + EnterRule(_localctx, 322, RULE_i8seq); + _localctx.Builder = new System.Reflection.Metadata.BlobBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2676; + State = 3424; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==INT32) { { { - State = 2673; - int32(); + State = 3419; + _localctx.value = int32(); + Actions.AddInt8SequenceValue(_localctx.Builder, (_localctx.value!=null?(_localctx.value.Start):null)); } } - State = 2678; + State = 3426; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -15515,12 +16306,16 @@ public I8seqContext i8seq() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder; ExitRule(); } return _localctx; } public partial class BoolSeqContext : ParserRuleContext { + public System.Reflection.Metadata.BlobBuilder Value; + public System.Reflection.Metadata.BlobBuilder Builder; + public TruefalseContext value; [System.Diagnostics.DebuggerNonUserCode] public TruefalseContext[] truefalse() { return GetRuleContexts(); } @@ -15532,33 +16327,29 @@ public BoolSeqContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_boolSeq; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitBoolSeq(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public BoolSeqContext boolSeq() { BoolSeqContext _localctx = new BoolSeqContext(Context, State); - EnterRule(_localctx, 332, RULE_boolSeq); + EnterRule(_localctx, 324, RULE_boolSeq); + _localctx.Builder = new System.Reflection.Metadata.BlobBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2682; + State = 3432; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==T__94 || _la==T__95) { { { - State = 2679; - truefalse(); + State = 3427; + _localctx.value = truefalse(); + Actions.AddBooleanSequenceValue(_localctx.Builder, _localctx.value.Value); } } - State = 2684; + State = 3434; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -15570,12 +16361,17 @@ public BoolSeqContext boolSeq() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder; ExitRule(); } return _localctx; } public partial class SqstringSeqContext : ParserRuleContext { + public System.Reflection.Metadata.BlobBuilder Value; + public System.Reflection.Metadata.BlobBuilder Builder; + public IToken nullValue; + public IToken stringValue; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] NULLREF() { return GetTokens(CILParser.NULLREF); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NULLREF(int i) { return GetToken(CILParser.NULLREF, i); @@ -15589,40 +16385,44 @@ public SqstringSeqContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_sqstringSeq; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitSqstringSeq(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public SqstringSeqContext sqstringSeq() { SqstringSeqContext _localctx = new SqstringSeqContext(Context, State); - EnterRule(_localctx, 334, RULE_sqstringSeq); + EnterRule(_localctx, 326, RULE_sqstringSeq); + _localctx.Builder = new System.Reflection.Metadata.BlobBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2688; + State = 3441; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==NULLREF || _la==SQSTRING) { { - { - State = 2685; - _la = TokenStream.LA(1); - if ( !(_la==NULLREF || _la==SQSTRING) ) { - ErrorHandler.RecoverInline(this); - } - else { - ErrorHandler.ReportMatch(this); - Consume(); - } + State = 3439; + ErrorHandler.Sync(this); + switch (TokenStream.LA(1)) { + case NULLREF: + { + State = 3435; + _localctx.nullValue = Match(NULLREF); + Actions.AddStringSequenceValue(_localctx.Builder, _localctx.nullValue); + } + break; + case SQSTRING: + { + State = 3437; + _localctx.stringValue = Match(SQSTRING); + Actions.AddStringSequenceValue(_localctx.Builder, _localctx.stringValue); + } + break; + default: + throw new NoViableAltException(this); } } - State = 2690; + State = 3443; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -15634,12 +16434,16 @@ public SqstringSeqContext sqstringSeq() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder; ExitRule(); } return _localctx; } public partial class ClassSeqContext : ParserRuleContext { + public CILParser.SerializedSequenceValue Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public ClassSeqElementContext value; [System.Diagnostics.DebuggerNonUserCode] public ClassSeqElementContext[] classSeqElement() { return GetRuleContexts(); } @@ -15651,33 +16455,29 @@ public ClassSeqContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_classSeq; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitClassSeq(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ClassSeqContext classSeq() { ClassSeqContext _localctx = new ClassSeqContext(Context, State); - EnterRule(_localctx, 336, RULE_classSeq); + EnterRule(_localctx, 328, RULE_classSeq); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2694; + State = 3449; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 4947802390528L) != 0) || _la==T__112 || _la==NULLREF || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 105553118478337L) != 0)) { { { - State = 2691; - classSeqElement(); + State = 3444; + _localctx.value = classSeqElement(); + _localctx.Builder.Add(_localctx.value.Value); } } - State = 2696; + State = 3451; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -15689,12 +16489,16 @@ public ClassSeqContext classSeq() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = new CILParser.ClassSerializedSequenceValue(_localctx.Builder.ToImmutable()); ExitRule(); } return _localctx; } public partial class ClassSeqElementContext : ParserRuleContext { + public CILParser.ClassSequenceElementValue Value; + public IToken quotedValue; + public ClassNameContext typeValue; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NULLREF() { return GetToken(CILParser.NULLREF, 0); } [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode SQSTRING() { return GetToken(CILParser.SQSTRING, 0); } [System.Diagnostics.DebuggerNonUserCode] public ClassNameContext className() { @@ -15705,36 +16509,33 @@ public ClassSeqElementContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_classSeqElement; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitClassSeqElement(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ClassSeqElementContext classSeqElement() { ClassSeqElementContext _localctx = new ClassSeqElementContext(Context, State); - EnterRule(_localctx, 338, RULE_classSeqElement); + EnterRule(_localctx, 330, RULE_classSeqElement); + _localctx.Value = CILParser.ClassSequenceElementValue.Error; try { - State = 2701; + State = 3460; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case NULLREF: EnterOuterAlt(_localctx, 1); { - State = 2697; + State = 3452; Match(NULLREF); + _localctx.Value = Actions.CreateNullClassSequenceValue(); } break; case T__38: EnterOuterAlt(_localctx, 2); { - State = 2698; + State = 3454; Match(T__38); - State = 2699; - Match(SQSTRING); + State = 3455; + _localctx.quotedValue = Match(SQSTRING); + _localctx.Value = Actions.CreateQuotedClassSequenceValue(_localctx.quotedValue); } break; case T__15: @@ -15749,8 +16550,9 @@ public ClassSeqElementContext classSeqElement() { case ID: EnterOuterAlt(_localctx, 3); { - State = 2700; - className(); + State = 3457; + _localctx.typeValue = className(); + _localctx.Value = Actions.CreateClassSequenceValue(_localctx.typeValue.Value); } break; default: @@ -15769,6 +16571,9 @@ public ClassSeqElementContext classSeqElement() { } public partial class ObjSeqContext : ParserRuleContext { + public CILParser.SerializedSequenceValue Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public SerInitContext value; [System.Diagnostics.DebuggerNonUserCode] public SerInitContext[] serInit() { return GetRuleContexts(); } @@ -15780,33 +16585,29 @@ public ObjSeqContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_objSeq; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitObjSeq(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ObjSeqContext objSeq() { ObjSeqContext _localctx = new ObjSeqContext(Context, State); - EnterRule(_localctx, 340, RULE_objSeq); + EnterRule(_localctx, 332, RULE_objSeq); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2706; + State = 3467; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while (_la==T__83 || ((((_la - 180)) & ~0x3f) == 0 && ((1L << (_la - 180)) & 106495L) != 0)) { { { - State = 2703; - serInit(); + State = 3462; + _localctx.value = serInit(); + _localctx.Builder.Add(_localctx.value.Value); } } - State = 2708; + State = 3469; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -15818,12 +16619,19 @@ public ObjSeqContext objSeq() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = new CILParser.ObjectSerializedSequenceValue(_localctx.Builder.ToImmutable()); ExitRule(); } return _localctx; } public partial class CustomAttrDeclContext : ParserRuleContext { + public CILParser.CustomAttributeDeclarationValue Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public CustomDescrContext directAttribute; + public CustomDescrWithOwnerContext ownedAttribute; + public DottedNameContext alias; [System.Diagnostics.DebuggerNonUserCode] public CustomDescrContext customDescr() { return GetRuleContext(0); } @@ -15838,41 +16646,42 @@ public CustomAttrDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_customAttrDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitCustomAttrDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public CustomAttrDeclContext customAttrDecl() { CustomAttrDeclContext _localctx = new CustomAttrDeclContext(Context, State); - EnterRule(_localctx, 342, RULE_customAttrDecl); + EnterRule(_localctx, 334, RULE_customAttrDecl); + + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + _localctx.Value = CILParser.CustomAttributeDeclarationValue.Error; + try { - State = 2712; + State = 3479; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,157,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,171,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2709; - customDescr(); + State = 3470; + _localctx.directAttribute = customDescr(); + _localctx.Value = Actions.CreateCustomAttributeDeclaration(_localctx.directAttribute.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2710; - customDescrWithOwner(); + State = 3473; + _localctx.ownedAttribute = customDescrWithOwner(); + _localctx.Value = Actions.CreateCustomAttributeDeclaration(_localctx.ownedAttribute.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 2711; - dottedName(); + State = 3476; + _localctx.alias = dottedName(); + _localctx.Value = Actions.CreateCustomAttributeTypedef(_localctx.alias.Value); } break; } @@ -15883,12 +16692,26 @@ public CustomAttrDeclContext customAttrDecl() { ErrorHandler.Recover(this, re); } finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + ExitRule(); } return _localctx; } public partial class AsmOrRefDeclContext : ParserRuleContext { + public CILParser.AssemblyDeclarationValue? Value; + public BytesContext key; + public IntOrWildcardContext major; + public IntOrWildcardContext minor; + public IntOrWildcardContext build; + public IntOrWildcardContext revision; + public CompQstringContext locale; + public BytesContext localeBytes; + public CustomAttrDeclContext attribute; [System.Diagnostics.DebuggerNonUserCode] public BytesContext bytes() { return GetRuleContext(0); } @@ -15912,93 +16735,98 @@ public AsmOrRefDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_asmOrRefDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitAsmOrRefDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public AsmOrRefDeclContext asmOrRefDecl() { AsmOrRefDeclContext _localctx = new AsmOrRefDeclContext(Context, State); - EnterRule(_localctx, 344, RULE_asmOrRefDecl); + EnterRule(_localctx, 336, RULE_asmOrRefDecl); try { - State = 2739; + State = 3513; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,158,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,172,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2714; + State = 3481; Match(T__166); - State = 2715; + State = 3482; Match(T__35); - State = 2716; + State = 3483; Match(T__29); - State = 2717; - bytes(); - State = 2718; + State = 3484; + _localctx.key = bytes(); + State = 3485; Match(T__30); + _localctx.Value = Actions.CreateAssemblyPublicKeyDeclaration(_localctx.key.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2720; + State = 3488; Match(T__167); - State = 2721; - intOrWildcard(); - State = 2722; + State = 3489; + _localctx.major = intOrWildcard(); + State = 3490; Match(T__74); - State = 2723; - intOrWildcard(); - State = 2724; + State = 3491; + _localctx.minor = intOrWildcard(); + State = 3492; Match(T__74); - State = 2725; - intOrWildcard(); - State = 2726; + State = 3493; + _localctx.build = intOrWildcard(); + State = 3494; Match(T__74); - State = 2727; - intOrWildcard(); + State = 3495; + _localctx.revision = intOrWildcard(); + _localctx.Value = Actions.CreateAssemblyVersionDeclaration( + _localctx.major.Value, + _localctx.minor.Value, + _localctx.build.Value, + _localctx.revision.Value); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 2729; + State = 3498; Match(T__168); - State = 2730; - compQstring(); + State = 3499; + _localctx.locale = compQstring(); + _localctx.Value = Actions.CreateAssemblyLocaleDeclaration(_localctx.locale.Value); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 2731; + State = 3502; Match(T__168); - State = 2732; + State = 3503; Match(T__35); - State = 2733; + State = 3504; Match(T__29); - State = 2734; - bytes(); - State = 2735; + State = 3505; + _localctx.localeBytes = bytes(); + State = 3506; Match(T__30); + _localctx.Value = Actions.CreateAssemblyLocaleDeclaration(_localctx.localeBytes.Value); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 2737; - customAttrDecl(); + State = 3509; + _localctx.attribute = customAttrDecl(); + _localctx.Value = Actions.CreateAssemblyCustomAttributeDeclaration( + _localctx.attribute.Value, + (_localctx.attribute!=null?(_localctx.attribute.Start):null)); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 2738; + State = 3512; compControl(); } break; @@ -16015,7 +16843,71 @@ public AsmOrRefDeclContext asmOrRefDecl() { return _localctx; } + public partial class AssemblyRefBlockContext : ParserRuleContext { + public CILParser.AssemblyReferenceValue? Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public AssemblyRefHeadContext header; + public AssemblyRefDeclsContext declarations; + [System.Diagnostics.DebuggerNonUserCode] public AssemblyRefHeadContext assemblyRefHead() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public AssemblyRefDeclsContext assemblyRefDecls() { + return GetRuleContext(0); + } + public AssemblyRefBlockContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_assemblyRefBlock; } } + } + + [RuleVersion(0)] + public AssemblyRefBlockContext assemblyRefBlock() { + AssemblyRefBlockContext _localctx = new AssemblyRefBlockContext(Context, State); + EnterRule(_localctx, 338, RULE_assemblyRefBlock); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + try { + EnterOuterAlt(_localctx, 1); + { + State = 3515; + _localctx.header = assemblyRefHead(); + State = 3516; + Match(T__16); + State = 3517; + _localctx.declarations = assemblyRefDecls(); + State = 3518; + Match(T__17); + _localctx.Value = Actions.CreateAssemblyReference( + _localctx.header.Value, + _localctx.declarations.Value); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + if (_localctx.HasSyntaxError) + { + _localctx.Value = null; + } + + ExitRule(); + } + return _localctx; + } + public partial class AssemblyRefHeadContext : ParserRuleContext { + public CILParser.AssemblyReferenceHeaderValue Value; + public AsmAttrContext attributes; + public DottedNameContext name; + public DottedNameContext alias; [System.Diagnostics.DebuggerNonUserCode] public AsmAttrContext asmAttr() { return GetRuleContext(0); } @@ -16030,50 +16922,53 @@ public AssemblyRefHeadContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_assemblyRefHead; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitAssemblyRefHead(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public AssemblyRefHeadContext assemblyRefHead() { AssemblyRefHeadContext _localctx = new AssemblyRefHeadContext(Context, State); - EnterRule(_localctx, 346, RULE_assemblyRefHead); + EnterRule(_localctx, 340, RULE_assemblyRefHead); + _localctx.Value = CILParser.AssemblyReferenceHeaderValue.Error; try { - State = 2753; + State = 3535; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,159,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,173,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2741; + State = 3521; Match(T__24); - State = 2742; + State = 3522; Match(T__39); - State = 2743; - asmAttr(); - State = 2744; - dottedName(); + State = 3523; + _localctx.attributes = asmAttr(); + State = 3524; + _localctx.name = dottedName(); + _localctx.Value = Actions.CreateAssemblyReferenceHeader( + _localctx.attributes.Value, + _localctx.name.Value, + _localctx.name.Value); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2746; + State = 3527; Match(T__24); - State = 2747; + State = 3528; Match(T__39); - State = 2748; - asmAttr(); - State = 2749; - dottedName(); - State = 2750; + State = 3529; + _localctx.attributes = asmAttr(); + State = 3530; + _localctx.name = dottedName(); + State = 3531; Match(T__33); - State = 2751; - dottedName(); + State = 3532; + _localctx.alias = dottedName(); + _localctx.Value = Actions.CreateAssemblyReferenceHeader( + _localctx.attributes.Value, + _localctx.name.Value, + _localctx.alias.Value); } break; } @@ -16090,6 +16985,9 @@ public AssemblyRefHeadContext assemblyRefHead() { } public partial class AssemblyRefDeclsContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public AssemblyRefDeclContext declaration; [System.Diagnostics.DebuggerNonUserCode] public AssemblyRefDeclContext[] assemblyRefDecl() { return GetRuleContexts(); } @@ -16101,33 +16999,29 @@ public AssemblyRefDeclsContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_assemblyRefDecls; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitAssemblyRefDecls(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public AssemblyRefDeclsContext assemblyRefDecls() { AssemblyRefDeclsContext _localctx = new AssemblyRefDeclsContext(Context, State); - EnterRule(_localctx, 348, RULE_assemblyRefDecls); + EnterRule(_localctx, 342, RULE_assemblyRefDecls); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2758; + State = 3542; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 36028835673735168L) != 0) || ((((_la - 167)) & ~0x3f) == 0 && ((1L << (_la - 167)) & 4111L) != 0) || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 105555249070081L) != 0)) { { { - State = 2755; - assemblyRefDecl(); + State = 3537; + _localctx.declaration = assemblyRefDecl(); + if (_localctx.declaration.Value is not null) _localctx.Builder.Add(_localctx.declaration.Value); } } - State = 2760; + State = 3544; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -16139,12 +17033,17 @@ public AssemblyRefDeclsContext assemblyRefDecls() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } public partial class AssemblyRefDeclContext : ParserRuleContext { + public CILParser.AssemblyDeclarationValue? Value; + public BytesContext hash; + public AsmOrRefDeclContext shared; + public BytesContext token; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode HASH() { return GetToken(CILParser.HASH, 0); } [System.Diagnostics.DebuggerNonUserCode] public BytesContext bytes() { return GetRuleContext(0); @@ -16157,35 +17056,30 @@ public AssemblyRefDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_assemblyRefDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitAssemblyRefDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public AssemblyRefDeclContext assemblyRefDecl() { AssemblyRefDeclContext _localctx = new AssemblyRefDeclContext(Context, State); - EnterRule(_localctx, 350, RULE_assemblyRefDecl); + EnterRule(_localctx, 344, RULE_assemblyRefDecl); try { - State = 2775; + State = 3564; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case HASH: EnterOuterAlt(_localctx, 1); { - State = 2761; + State = 3545; Match(HASH); - State = 2762; + State = 3546; Match(T__35); - State = 2763; + State = 3547; Match(T__29); - State = 2764; - bytes(); - State = 2765; + State = 3548; + _localctx.hash = bytes(); + State = 3549; Match(T__30); + _localctx.Value = Actions.CreateAssemblyReferenceHashDeclaration(_localctx.hash.Value); } break; case T__15: @@ -16207,30 +17101,33 @@ public AssemblyRefDeclContext assemblyRefDecl() { case ID: EnterOuterAlt(_localctx, 2); { - State = 2767; - asmOrRefDecl(); + State = 3552; + _localctx.shared = asmOrRefDecl(); + _localctx.Value = _localctx.shared.Value; } break; case T__169: EnterOuterAlt(_localctx, 3); { - State = 2768; + State = 3555; Match(T__169); - State = 2769; + State = 3556; Match(T__35); - State = 2770; + State = 3557; Match(T__29); - State = 2771; - bytes(); - State = 2772; + State = 3558; + _localctx.token = bytes(); + State = 3559; Match(T__30); + _localctx.Value = Actions.CreateAssemblyReferencePublicKeyTokenDeclaration(_localctx.token.Value); } break; case T__54: EnterOuterAlt(_localctx, 4); { - State = 2774; + State = 3562; Match(T__54); + _localctx.Value = Actions.CreateAssemblyReferenceAutoDeclaration(); } break; default: @@ -16248,57 +17145,104 @@ public AssemblyRefDeclContext assemblyRefDecl() { return _localctx; } + public partial class ExptypeBlockContext : ParserRuleContext { + public CILParser.ExportedTypeValue? Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public ExptypeHeadContext header; + public ExptypeDeclsContext declarations; + [System.Diagnostics.DebuggerNonUserCode] public ExptypeHeadContext exptypeHead() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ExptypeDeclsContext exptypeDecls() { + return GetRuleContext(0); + } + public ExptypeBlockContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_exptypeBlock; } } + } + + [RuleVersion(0)] + public ExptypeBlockContext exptypeBlock() { + ExptypeBlockContext _localctx = new ExptypeBlockContext(Context, State); + EnterRule(_localctx, 346, RULE_exptypeBlock); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + try { + EnterOuterAlt(_localctx, 1); + { + State = 3566; + _localctx.header = exptypeHead(); + State = 3567; + Match(T__16); + State = 3568; + _localctx.declarations = exptypeDecls(); + State = 3569; + Match(T__17); + _localctx.Value = Actions.CreateExportedType( + _localctx.header.Value, + _localctx.declarations.Value); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + if (_localctx.HasSyntaxError) + { + _localctx.Value = null; + } + + ExitRule(); + } + return _localctx; + } + public partial class ExptypeHeadContext : ParserRuleContext { + public CILParser.ExportedTypeHeaderValue Value; + public IToken head; + public ExptAttrsContext attributes; + public DottedNameContext name; + [System.Diagnostics.DebuggerNonUserCode] public ExptAttrsContext exptAttrs() { + return GetRuleContext(0); + } [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { return GetRuleContext(0); } - [System.Diagnostics.DebuggerNonUserCode] public ExptAttrContext[] exptAttr() { - return GetRuleContexts(); - } - [System.Diagnostics.DebuggerNonUserCode] public ExptAttrContext exptAttr(int i) { - return GetRuleContext(i); - } public ExptypeHeadContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_exptypeHead; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitExptypeHead(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ExptypeHeadContext exptypeHead() { ExptypeHeadContext _localctx = new ExptypeHeadContext(Context, State); - EnterRule(_localctx, 352, RULE_exptypeHead); - int _la; + EnterRule(_localctx, 348, RULE_exptypeHead); + _localctx.Value = CILParser.ExportedTypeHeaderValue.Error; try { EnterOuterAlt(_localctx, 1); { - State = 2777; - Match(T__49); - State = 2778; + State = 3572; + _localctx.head = Match(T__49); + State = 3573; Match(T__39); - State = 2782; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 4618441417868443648L) != 0) || _la==T__170) { - { - { - State = 2779; - exptAttr(); - } - } - State = 2784; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - } - State = 2785; - dottedName(); + State = 3574; + _localctx.attributes = exptAttrs(); + State = 3575; + _localctx.name = dottedName(); + _localctx.Value = Actions.CreateExportedTypeHeader( + _localctx.attributes.Value, + _localctx.name.Value, + _localctx.head); } } catch (RecognitionException re) { @@ -16313,55 +17257,98 @@ public ExptypeHeadContext exptypeHead() { } public partial class ExportHeadContext : ParserRuleContext { + public CILParser.ExportedTypeHeaderValue Value; + public IToken head; + public ExptAttrsContext attributes; + public DottedNameContext name; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode EXPORT() { return GetToken(CILParser.EXPORT, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ExptAttrsContext exptAttrs() { + return GetRuleContext(0); + } [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { return GetRuleContext(0); } + public ExportHeadContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_exportHead; } } + } + + [RuleVersion(0)] + public ExportHeadContext exportHead() { + ExportHeadContext _localctx = new ExportHeadContext(Context, State); + EnterRule(_localctx, 350, RULE_exportHead); + _localctx.Value = CILParser.ExportedTypeHeaderValue.Error; + try { + EnterOuterAlt(_localctx, 1); + { + State = 3578; + _localctx.head = Match(EXPORT); + State = 3579; + _localctx.attributes = exptAttrs(); + State = 3580; + _localctx.name = dottedName(); + _localctx.Value = Actions.CreateExportedTypeHeader( + _localctx.attributes.Value, + _localctx.name.Value, + _localctx.head); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + + public partial class ExptAttrsContext : ParserRuleContext { + public System.Reflection.TypeAttributes Value; + public ExptAttrContext attribute; [System.Diagnostics.DebuggerNonUserCode] public ExptAttrContext[] exptAttr() { return GetRuleContexts(); } [System.Diagnostics.DebuggerNonUserCode] public ExptAttrContext exptAttr(int i) { return GetRuleContext(i); } - public ExportHeadContext(ParserRuleContext parent, int invokingState) + public ExptAttrsContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } - public override int RuleIndex { get { return RULE_exportHead; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitExportHead(this); - else return visitor.VisitChildren(this); - } + public override int RuleIndex { get { return RULE_exptAttrs; } } } [RuleVersion(0)] - public ExportHeadContext exportHead() { - ExportHeadContext _localctx = new ExportHeadContext(Context, State); - EnterRule(_localctx, 354, RULE_exportHead); + public ExptAttrsContext exptAttrs() { + ExptAttrsContext _localctx = new ExptAttrsContext(Context, State); + EnterRule(_localctx, 352, RULE_exptAttrs); + _localctx.Value = 0; int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2787; - Match(EXPORT); - State = 2791; + State = 3588; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 4618441417868443648L) != 0) || _la==T__170) { { { - State = 2788; - exptAttr(); + State = 3583; + _localctx.attribute = exptAttr(); + _localctx.Value = Actions.AddExportedTypeAttribute( + _localctx.Value, + _localctx.attribute.Value, + _localctx.attribute.Mask); } } - State = 2793; + State = 3590; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } - State = 2794; - dottedName(); } } catch (RecognitionException re) { @@ -16376,103 +17363,101 @@ public ExportHeadContext exportHead() { } public partial class ExptAttrContext : ParserRuleContext { + public System.Reflection.TypeAttributes Value; + public System.Reflection.TypeAttributes Mask; public ExptAttrContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_exptAttr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitExptAttr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ExptAttrContext exptAttr() { ExptAttrContext _localctx = new ExptAttrContext(Context, State); - EnterRule(_localctx, 356, RULE_exptAttr); + EnterRule(_localctx, 354, RULE_exptAttr); try { - State = 2811; + State = 3606; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,164,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,177,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2796; + State = 3591; Match(T__51); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2797; + State = 3592; Match(T__50); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 2798; + State = 3593; Match(T__170); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 2799; + State = 3594; Match(T__61); - State = 2800; + State = 3595; Match(T__50); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 2801; + State = 3596; Match(T__61); - State = 2802; + State = 3597; Match(T__51); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 2803; + State = 3598; Match(T__61); - State = 2804; + State = 3599; Match(T__62); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 2805; + State = 3600; Match(T__61); - State = 2806; + State = 3601; Match(T__63); } break; case 8: EnterOuterAlt(_localctx, 8); { - State = 2807; + State = 3602; Match(T__61); - State = 2808; + State = 3603; Match(T__64); } break; case 9: EnterOuterAlt(_localctx, 9); { - State = 2809; + State = 3604; Match(T__61); - State = 2810; + State = 3605; Match(T__65); } break; } + Context.Stop = TokenStream.LT(-1); + Actions.SetExportedTypeAttribute(_localctx); } catch (RecognitionException re) { _localctx.exception = re; @@ -16486,6 +17471,9 @@ public ExptAttrContext exptAttr() { } public partial class ExptypeDeclsContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public ExptypeDeclContext declaration; [System.Diagnostics.DebuggerNonUserCode] public ExptypeDeclContext[] exptypeDecl() { return GetRuleContexts(); } @@ -16497,33 +17485,29 @@ public ExptypeDeclsContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_exptypeDecls; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitExptypeDecls(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ExptypeDeclsContext exptypeDecls() { ExptypeDeclsContext _localctx = new ExptypeDeclsContext(Context, State); - EnterRule(_localctx, 358, RULE_exptypeDecls); + EnterRule(_localctx, 356, RULE_exptypeDecls); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2816; + State = 3613; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 1125938597265408L) != 0) || _la==T__112 || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 105555249070081L) != 0)) { { { - State = 2813; - exptypeDecl(); + State = 3608; + _localctx.declaration = exptypeDecl(); + if (_localctx.declaration.Value is not null) _localctx.Builder.Add(_localctx.declaration.Value); } } - State = 2818; + State = 3615; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -16535,12 +17519,21 @@ public ExptypeDeclsContext exptypeDecls() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } public partial class ExptypeDeclContext : ParserRuleContext { + public CILParser.ExportedTypeDeclarationValue? Value; + public IToken location; + public DottedNameContext name; + public SlashedNameContext nestedName; + public DottedNameContext assemblyName; + public MdtokenContext token; + public Int32Context typeDefinitionId; + public CustomAttrDeclContext attribute; [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { return GetRuleContext(0); } @@ -16564,80 +17557,91 @@ public ExptypeDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_exptypeDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitExptypeDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ExptypeDeclContext exptypeDecl() { ExptypeDeclContext _localctx = new ExptypeDeclContext(Context, State); - EnterRule(_localctx, 360, RULE_exptypeDecl); + EnterRule(_localctx, 358, RULE_exptypeDecl); try { - State = 2832; + State = 3641; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,166,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,179,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2819; - Match(T__20); - State = 2820; - dottedName(); + State = 3616; + _localctx.location = Match(T__20); + State = 3617; + _localctx.name = dottedName(); + _localctx.Value = Actions.CreateExportedTypeFileDeclaration( + _localctx.name.Value, + _localctx.location); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2821; - Match(T__49); - State = 2822; + State = 3620; + _localctx.location = Match(T__49); + State = 3621; Match(T__39); - State = 2823; - slashedName(); + State = 3622; + _localctx.nestedName = slashedName(); + _localctx.Value = Actions.CreateNestedExportedTypeDeclaration( + _localctx.nestedName.Value, + _localctx.location); } break; case 3: EnterOuterAlt(_localctx, 3); { - State = 2824; - Match(T__24); - State = 2825; + State = 3625; + _localctx.location = Match(T__24); + State = 3626; Match(T__39); - State = 2826; - dottedName(); + State = 3627; + _localctx.assemblyName = dottedName(); + _localctx.Value = Actions.CreateExportedTypeAssemblyDeclaration( + _localctx.assemblyName.Value, + _localctx.location); } break; case 4: EnterOuterAlt(_localctx, 4); { - State = 2827; - mdtoken(); + State = 3630; + _localctx.token = mdtoken(); + _localctx.Value = Actions.CreateExportedTypeMetadataTokenDeclaration( + _localctx.token.Value, + (_localctx.token!=null?(_localctx.token.Start):null)); } break; case 5: EnterOuterAlt(_localctx, 5); { - State = 2828; + State = 3633; Match(T__49); - State = 2829; - int32(); + State = 3634; + _localctx.typeDefinitionId = int32(); + _localctx.Value = Actions.CreateExportedTypeDefinitionIdDeclaration( + (_localctx.typeDefinitionId!=null?(_localctx.typeDefinitionId.Start):null)); } break; case 6: EnterOuterAlt(_localctx, 6); { - State = 2830; - customAttrDecl(); + State = 3637; + _localctx.attribute = customAttrDecl(); + _localctx.Value = Actions.CreateExportedTypeCustomAttributeDeclaration( + _localctx.attribute.Value, + (_localctx.attribute!=null?(_localctx.attribute.Start):null)); } break; case 7: EnterOuterAlt(_localctx, 7); { - State = 2831; + State = 3640; compControl(); } break; @@ -16654,90 +17658,132 @@ public ExptypeDeclContext exptypeDecl() { return _localctx; } + public partial class ManifestResBlockContext : ParserRuleContext { + public CILParser.ManifestResourceValue? Value; + public bool HasSyntaxError; + public int InitialSyntaxErrorCount; + public ManifestResHeadContext header; + public ManifestResDeclsContext declarations; + [System.Diagnostics.DebuggerNonUserCode] public ManifestResHeadContext manifestResHead() { + return GetRuleContext(0); + } + [System.Diagnostics.DebuggerNonUserCode] public ManifestResDeclsContext manifestResDecls() { + return GetRuleContext(0); + } + public ManifestResBlockContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_manifestResBlock; } } + } + + [RuleVersion(0)] + public ManifestResBlockContext manifestResBlock() { + ManifestResBlockContext _localctx = new ManifestResBlockContext(Context, State); + EnterRule(_localctx, 360, RULE_manifestResBlock); + _localctx.InitialSyntaxErrorCount = Actions.SyntaxErrorCount; + try { + EnterOuterAlt(_localctx, 1); + { + State = 3643; + _localctx.header = manifestResHead(); + State = 3644; + Match(T__16); + State = 3645; + _localctx.declarations = manifestResDecls(); + State = 3646; + Match(T__17); + _localctx.Value = Actions.CreateManifestResource( + _localctx.header.Value, + _localctx.declarations.Value); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + + _localctx.HasSyntaxError = + Actions.HasSyntaxErrorsSince(_localctx.InitialSyntaxErrorCount) || + _localctx.exception is not null; + if (_localctx.HasSyntaxError) + { + _localctx.Value = null; + } + + ExitRule(); + } + return _localctx; + } + public partial class ManifestResHeadContext : ParserRuleContext { + public CILParser.ManifestResourceHeaderValue Value; + public IToken head; + public ManresAttrsContext attributes; + public DottedNameContext name; + public DottedNameContext alias; [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode MRESOURCE() { return GetToken(CILParser.MRESOURCE, 0); } + [System.Diagnostics.DebuggerNonUserCode] public ManresAttrsContext manresAttrs() { + return GetRuleContext(0); + } [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext[] dottedName() { return GetRuleContexts(); } [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName(int i) { return GetRuleContext(i); } - [System.Diagnostics.DebuggerNonUserCode] public ManresAttrContext[] manresAttr() { - return GetRuleContexts(); - } - [System.Diagnostics.DebuggerNonUserCode] public ManresAttrContext manresAttr(int i) { - return GetRuleContext(i); - } public ManifestResHeadContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_manifestResHead; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitManifestResHead(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ManifestResHeadContext manifestResHead() { ManifestResHeadContext _localctx = new ManifestResHeadContext(Context, State); EnterRule(_localctx, 362, RULE_manifestResHead); - int _la; + _localctx.Value = CILParser.ManifestResourceHeaderValue.Error; try { - State = 2853; + State = 3661; ErrorHandler.Sync(this); - switch ( Interpreter.AdaptivePredict(TokenStream,169,Context) ) { + switch ( Interpreter.AdaptivePredict(TokenStream,180,Context) ) { case 1: EnterOuterAlt(_localctx, 1); { - State = 2834; - Match(MRESOURCE); - State = 2838; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - while (_la==T__50 || _la==T__51) { - { - { - State = 2835; - manresAttr(); - } - } - State = 2840; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - } - State = 2841; - dottedName(); + State = 3649; + _localctx.head = Match(MRESOURCE); + State = 3650; + _localctx.attributes = manresAttrs(); + State = 3651; + _localctx.name = dottedName(); + _localctx.Value = Actions.CreateManifestResourceHeader( + _localctx.attributes.Value, + _localctx.name.Value, + _localctx.name.Value, + _localctx.head); } break; case 2: EnterOuterAlt(_localctx, 2); { - State = 2842; - Match(MRESOURCE); - State = 2846; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - while (_la==T__50 || _la==T__51) { - { - { - State = 2843; - manresAttr(); - } - } - State = 2848; - ErrorHandler.Sync(this); - _la = TokenStream.LA(1); - } - State = 2849; - dottedName(); - State = 2850; + State = 3654; + _localctx.head = Match(MRESOURCE); + State = 3655; + _localctx.attributes = manresAttrs(); + State = 3656; + _localctx.name = dottedName(); + State = 3657; Match(T__33); - State = 2851; - dottedName(); + State = 3658; + _localctx.alias = dottedName(); + _localctx.Value = Actions.CreateManifestResourceHeader( + _localctx.attributes.Value, + _localctx.name.Value, + _localctx.alias.Value, + _localctx.head); } break; } @@ -16753,29 +17799,79 @@ public ManifestResHeadContext manifestResHead() { return _localctx; } + public partial class ManresAttrsContext : ParserRuleContext { + public System.Reflection.ManifestResourceAttributes Value; + public ManresAttrContext attribute; + [System.Diagnostics.DebuggerNonUserCode] public ManresAttrContext[] manresAttr() { + return GetRuleContexts(); + } + [System.Diagnostics.DebuggerNonUserCode] public ManresAttrContext manresAttr(int i) { + return GetRuleContext(i); + } + public ManresAttrsContext(ParserRuleContext parent, int invokingState) + : base(parent, invokingState) + { + } + public override int RuleIndex { get { return RULE_manresAttrs; } } + } + + [RuleVersion(0)] + public ManresAttrsContext manresAttrs() { + ManresAttrsContext _localctx = new ManresAttrsContext(Context, State); + EnterRule(_localctx, 364, RULE_manresAttrs); + _localctx.Value = 0; + int _la; + try { + EnterOuterAlt(_localctx, 1); + { + State = 3668; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + while (_la==T__50 || _la==T__51) { + { + { + State = 3663; + _localctx.attribute = manresAttr(); + _localctx.Value = Actions.AddManifestResourceAttribute( + _localctx.Value, + _localctx.attribute.Value); + } + } + State = 3670; + ErrorHandler.Sync(this); + _la = TokenStream.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + ErrorHandler.ReportError(this, re); + ErrorHandler.Recover(this, re); + } + finally { + ExitRule(); + } + return _localctx; + } + public partial class ManresAttrContext : ParserRuleContext { + public System.Reflection.ManifestResourceAttributes Value; public ManresAttrContext(ParserRuleContext parent, int invokingState) : base(parent, invokingState) { } public override int RuleIndex { get { return RULE_manresAttr; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitManresAttr(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ManresAttrContext manresAttr() { ManresAttrContext _localctx = new ManresAttrContext(Context, State); - EnterRule(_localctx, 364, RULE_manresAttr); + EnterRule(_localctx, 366, RULE_manresAttr); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2855; + State = 3671; _la = TokenStream.LA(1); if ( !(_la==T__50 || _la==T__51) ) { ErrorHandler.RecoverInline(this); @@ -16785,6 +17881,8 @@ public ManresAttrContext manresAttr() { Consume(); } } + Context.Stop = TokenStream.LT(-1); + _localctx.Value = Actions.ParseManifestResourceAttribute(_localctx.Start); } catch (RecognitionException re) { _localctx.exception = re; @@ -16798,6 +17896,9 @@ public ManresAttrContext manresAttr() { } public partial class ManifestResDeclsContext : ParserRuleContext { + public System.Collections.Immutable.ImmutableArray Value; + public System.Collections.Immutable.ImmutableArray.Builder Builder; + public ManifestResDeclContext declaration; [System.Diagnostics.DebuggerNonUserCode] public ManifestResDeclContext[] manifestResDecl() { return GetRuleContexts(); } @@ -16809,33 +17910,29 @@ public ManifestResDeclsContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_manifestResDecls; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitManifestResDecls(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ManifestResDeclsContext manifestResDecls() { ManifestResDeclsContext _localctx = new ManifestResDeclsContext(Context, State); - EnterRule(_localctx, 366, RULE_manifestResDecls); + EnterRule(_localctx, 368, RULE_manifestResDecls); + _localctx.Builder = System.Collections.Immutable.ImmutableArray.CreateBuilder(); int _la; try { EnterOuterAlt(_localctx, 1); { - State = 2860; + State = 3678; ErrorHandler.Sync(this); _la = TokenStream.LA(1); while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 38690422784L) != 0) || ((((_la - 242)) & ~0x3f) == 0 && ((1L << (_la - 242)) & 105555249070081L) != 0)) { { { - State = 2857; - manifestResDecl(); + State = 3673; + _localctx.declaration = manifestResDecl(); + if (_localctx.declaration.Value is not null) _localctx.Builder.Add(_localctx.declaration.Value); } } - State = 2862; + State = 3680; ErrorHandler.Sync(this); _la = TokenStream.LA(1); } @@ -16847,12 +17944,18 @@ public ManifestResDeclsContext manifestResDecls() { ErrorHandler.Recover(this, re); } finally { + _localctx.Value = _localctx.Builder.ToImmutable(); ExitRule(); } return _localctx; } public partial class ManifestResDeclContext : ParserRuleContext { + public CILParser.ManifestResourceDeclarationValue? Value; + public IToken location; + public DottedNameContext name; + public Int32Context offset; + public CustomAttrDeclContext attribute; [System.Diagnostics.DebuggerNonUserCode] public DottedNameContext dottedName() { return GetRuleContext(0); } @@ -16870,44 +17973,43 @@ public ManifestResDeclContext(ParserRuleContext parent, int invokingState) { } public override int RuleIndex { get { return RULE_manifestResDecl; } } - [System.Diagnostics.DebuggerNonUserCode] - public override TResult Accept(IParseTreeVisitor visitor) { - ICILVisitor typedVisitor = visitor as ICILVisitor; - if (typedVisitor != null) return typedVisitor.VisitManifestResDecl(this); - else return visitor.VisitChildren(this); - } } [RuleVersion(0)] public ManifestResDeclContext manifestResDecl() { ManifestResDeclContext _localctx = new ManifestResDeclContext(Context, State); - EnterRule(_localctx, 368, RULE_manifestResDecl); + EnterRule(_localctx, 370, RULE_manifestResDecl); try { - State = 2873; + State = 3696; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case T__20: EnterOuterAlt(_localctx, 1); { - State = 2863; - Match(T__20); - State = 2864; - dottedName(); - State = 2865; + State = 3681; + _localctx.location = Match(T__20); + State = 3682; + _localctx.name = dottedName(); + State = 3683; Match(T__43); - State = 2866; - int32(); + State = 3684; + _localctx.offset = int32(); + _localctx.Value = Actions.CreateManifestResourceFileDeclaration( + _localctx.name.Value, + (_localctx.offset!=null?(_localctx.offset.Start):null), + _localctx.location); } break; case T__24: EnterOuterAlt(_localctx, 2); { - State = 2868; + State = 3687; Match(T__24); - State = 2869; + State = 3688; Match(T__39); - State = 2870; - dottedName(); + State = 3689; + _localctx.name = dottedName(); + _localctx.Value = Actions.CreateManifestResourceAssemblyDeclaration(_localctx.name.Value); } break; case T__15: @@ -16918,8 +18020,11 @@ public ManifestResDeclContext manifestResDecl() { case ID: EnterOuterAlt(_localctx, 3); { - State = 2871; - customAttrDecl(); + State = 3692; + _localctx.attribute = customAttrDecl(); + _localctx.Value = Actions.CreateManifestResourceCustomAttributeDeclaration( + _localctx.attribute.Value, + (_localctx.attribute!=null?(_localctx.attribute.Start):null)); } break; case T__31: @@ -16932,7 +18037,7 @@ public ManifestResDeclContext manifestResDecl() { case PP_INCLUDE: EnterOuterAlt(_localctx, 4); { - State = 2872; + State = 3695; compControl(); } break; @@ -16951,25 +18056,8 @@ public ManifestResDeclContext manifestResDecl() { return _localctx; } - public override bool Sempred(RuleContext _localctx, int ruleIndex, int predIndex) { - switch (ruleIndex) { - case 34: return vtfixupAttr_sempred((VtfixupAttrContext)_localctx, predIndex); - } - return true; - } - private bool vtfixupAttr_sempred(VtfixupAttrContext _localctx, int predIndex) { - switch (predIndex) { - case 0: return Precpred(Context, 5); - case 1: return Precpred(Context, 4); - case 2: return Precpred(Context, 3); - case 3: return Precpred(Context, 2); - case 4: return Precpred(Context, 1); - } - return true; - } - private static int[] _serializedATN = { - 4,1,304,2876,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2, + 4,1,304,3699,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2, 7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14, 2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21, 2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28, @@ -16997,1090 +18085,1389 @@ private bool vtfixupAttr_sempred(VtfixupAttrContext _localctx, int predIndex) { 2,165,7,165,2,166,7,166,2,167,7,167,2,168,7,168,2,169,7,169,2,170,7,170, 2,171,7,171,2,172,7,172,2,173,7,173,2,174,7,174,2,175,7,175,2,176,7,176, 2,177,7,177,2,178,7,178,2,179,7,179,2,180,7,180,2,181,7,181,2,182,7,182, - 2,183,7,183,2,184,7,184,1,0,1,0,1,1,1,1,1,1,1,1,5,1,377,8,1,10,1,12,1, - 380,9,1,1,1,1,1,3,1,384,8,1,1,2,1,2,1,3,1,3,5,3,390,8,3,10,3,12,3,393, - 9,3,1,3,1,3,1,4,5,4,398,8,4,10,4,12,4,401,9,4,1,5,1,5,1,5,1,5,1,5,1,5, + 2,183,7,183,2,184,7,184,2,185,7,185,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,5, + 1,381,8,1,10,1,12,1,384,9,1,1,1,1,1,1,1,1,1,1,1,3,1,391,8,1,1,2,1,2,1, + 3,1,3,1,3,5,3,398,8,3,10,3,12,3,401,9,3,1,3,1,3,1,3,1,4,5,4,407,8,4,10, + 4,12,4,410,9,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5, 1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1, 5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5, - 1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,453,8,5,1,6,1,6,1,6,1,7,1,7,1, - 7,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11, - 1,11,1,11,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13, - 1,13,1,13,1,13,1,13,3,13,494,8,13,1,14,1,14,1,15,1,15,1,15,5,15,501,8, - 15,10,15,12,15,504,9,15,1,15,1,15,1,16,1,16,1,17,1,17,1,18,1,18,1,18,1, - 18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,3,18,527,8,18, - 1,19,1,19,3,19,531,8,19,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1, - 20,1,20,1,20,1,20,1,20,1,20,1,20,3,20,549,8,20,1,21,1,21,1,21,1,21,1,21, - 1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21, - 1,21,1,21,1,21,1,21,1,21,1,21,3,21,576,8,21,1,22,1,22,1,22,1,22,1,22,1, - 22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1, - 22,1,22,3,22,599,8,22,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23, - 1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23, - 1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,3,23,635,8,23,1,24,1, - 24,1,25,1,25,3,25,641,8,25,1,26,1,26,1,26,1,27,1,27,5,27,648,8,27,10,27, - 12,27,651,9,27,1,28,1,28,1,28,1,28,1,28,1,28,1,28,5,28,660,8,28,10,28, - 12,28,663,9,28,1,29,1,29,1,30,1,30,3,30,669,8,30,1,31,1,31,1,31,1,31,1, - 31,1,31,1,31,1,31,1,31,3,31,680,8,31,1,32,1,32,1,32,1,32,1,32,1,32,3,32, - 688,8,32,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1, - 34,1,34,1,34,1,34,1,34,1,34,1,34,5,34,709,8,34,10,34,12,34,712,9,34,1, - 35,1,35,1,35,1,35,1,35,1,35,1,36,1,36,1,36,1,37,1,37,5,37,725,8,37,10, - 37,12,37,728,9,37,1,37,1,37,1,37,1,37,1,37,1,38,1,38,1,38,1,38,1,38,1, - 38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1, - 38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1, - 38,1,38,1,38,1,38,3,38,772,8,38,1,39,1,39,1,39,3,39,777,8,39,1,40,1,40, - 1,40,3,40,782,8,40,1,41,5,41,785,8,41,10,41,12,41,788,9,41,1,42,1,42,1, - 42,5,42,793,8,42,10,42,12,42,796,9,42,1,42,1,42,1,43,1,43,1,44,1,44,1, - 44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1, - 44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1, - 44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1, - 44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1, - 44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,873, - 8,44,1,45,1,45,5,45,877,8,45,10,45,12,45,880,9,45,1,45,1,45,1,45,1,45, - 1,45,1,45,1,45,1,45,1,45,1,45,1,45,5,45,893,8,45,10,45,12,45,896,9,45, - 1,45,1,45,1,45,3,45,901,8,45,1,46,1,46,1,47,1,47,3,47,907,8,47,1,48,1, - 48,1,49,5,49,912,8,49,10,49,12,49,915,9,49,1,50,1,50,1,51,1,51,1,52,1, - 52,1,53,1,53,1,54,1,54,1,55,1,55,1,56,1,56,1,57,1,57,1,58,1,58,1,59,1, - 59,1,60,1,60,1,61,1,61,1,62,1,62,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1, - 63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1, - 63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1, - 63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1, - 63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1, - 63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1, - 63,1,63,1,63,1,63,1,63,3,63,1025,8,63,1,64,1,64,1,64,3,64,1030,8,64,1, - 64,1,64,5,64,1034,8,64,10,64,12,64,1037,9,64,1,64,1,64,3,64,1041,8,64, - 3,64,1043,8,64,1,65,1,65,1,65,1,65,5,65,1049,8,65,10,65,12,65,1052,9,65, - 1,65,1,65,1,65,1,66,1,66,1,66,1,66,5,66,1061,8,66,10,66,12,66,1064,9,66, - 1,66,1,66,1,66,1,67,1,67,1,67,1,67,5,67,1073,8,67,10,67,12,67,1076,9,67, - 1,67,1,67,1,67,1,67,3,67,1082,8,67,1,68,1,68,1,68,1,68,1,68,3,68,1089, - 8,68,3,68,1091,8,68,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69, - 1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69, - 1,69,3,69,1118,8,69,1,70,1,70,1,70,5,70,1123,8,70,10,70,12,70,1126,9,70, - 1,70,1,70,1,71,5,71,1131,8,71,10,71,12,71,1134,9,71,1,72,1,72,1,72,1,72, - 1,72,3,72,1141,8,72,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73, - 1,73,3,73,1154,8,73,1,74,1,74,1,74,5,74,1159,8,74,10,74,12,74,1162,9,74, - 3,74,1164,8,74,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,75, - 1,75,1,75,1,75,1,75,1,75,1,75,3,75,1183,8,75,1,76,1,76,1,76,1,76,1,76, - 1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76, - 1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76, - 1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76, - 1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76, - 1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76, - 1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76,1,76, - 1,76,1,76,1,76,3,76,1277,8,76,1,77,1,77,1,77,1,77,1,77,1,77,1,77,3,77, - 1286,8,77,1,78,1,78,1,78,5,78,1291,8,78,10,78,12,78,1294,9,78,3,78,1296, - 8,78,1,79,1,79,1,80,1,80,5,80,1302,8,80,10,80,12,80,1305,9,80,1,81,1,81, - 1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81, - 1,81,1,81,3,81,1325,8,81,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82, - 1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82, - 1,82,1,82,1,82,1,82,1,82,1,82,1,82,3,82,1357,8,82,1,83,1,83,1,83,1,83, - 1,83,1,83,1,83,1,83,1,83,1,83,1,83,1,83,1,83,1,83,1,83,1,83,1,83,1,83, - 1,83,1,83,1,83,3,83,1380,8,83,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84, - 1,84,1,84,3,84,1392,8,84,1,85,1,85,1,85,1,86,1,86,1,86,1,86,3,86,1401, - 8,86,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87, - 1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,3,87,1426,8,87,1,87, - 1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87, - 1,87,1,87,1,87,1,87,1,87,1,87,1,87,3,87,1450,8,87,1,88,1,88,1,88,1,88, - 5,88,1456,8,88,10,88,12,88,1459,9,88,1,88,3,88,1462,8,88,1,89,1,89,1,89, - 1,89,1,89,1,89,1,89,1,89,1,89,1,89,1,89,1,89,1,89,3,89,1477,8,89,1,90, - 1,90,1,90,5,90,1482,8,90,10,90,12,90,1485,9,90,1,90,1,90,1,91,1,91,1,91, - 1,91,1,92,1,92,1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,93, - 1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,93, - 1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,93,3,93,1529,8,93,1,94,1,94, - 1,95,1,95,1,95,1,95,1,95,1,95,3,95,1539,8,95,1,95,1,95,1,95,1,95,1,95, - 1,95,1,95,1,95,1,95,1,95,1,95,1,95,1,95,1,95,3,95,1555,8,95,1,95,1,95, - 1,95,1,95,1,95,1,95,1,95,1,95,1,95,1,95,3,95,1567,8,95,1,96,1,96,1,96, - 1,96,1,96,1,96,1,96,1,96,1,96,1,96,3,96,1579,8,96,1,97,1,97,1,97,1,97, - 1,97,1,97,1,97,1,97,1,97,1,97,1,97,1,97,3,97,1593,8,97,1,98,1,98,1,98, - 1,98,1,98,1,99,1,99,1,99,1,99,1,99,3,99,1605,8,99,1,100,1,100,1,100,1, - 100,1,100,1,100,1,100,1,100,1,100,3,100,1616,8,100,1,101,1,101,1,101,5, - 101,1621,8,101,10,101,12,101,1624,9,101,1,101,1,101,1,102,1,102,1,102, - 1,102,1,102,3,102,1633,8,102,1,103,1,103,1,103,1,103,1,103,1,103,1,103, - 1,103,1,103,1,103,1,103,3,103,1646,8,103,1,104,5,104,1649,8,104,10,104, - 12,104,1652,9,104,1,105,1,105,3,105,1656,8,105,1,105,1,105,1,106,1,106, - 1,106,5,106,1663,8,106,10,106,12,106,1666,9,106,1,106,1,106,1,107,1,107, - 1,107,1,107,1,108,1,108,3,108,1676,8,108,1,109,1,109,1,109,1,109,1,109, - 1,109,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110, - 1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110, - 1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110, - 1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110, - 1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110, + 1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1, + 5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5, + 1,5,1,5,3,5,498,8,5,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1, + 8,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1, + 11,1,11,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1, + 13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,3,13,549,8,13,1,14,1,14,1,15,1,15, + 1,15,1,15,1,15,5,15,558,8,15,10,15,12,15,561,9,15,1,15,1,15,1,16,1,16, + 1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18, + 1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,3,18,590,8,18,1,19,1,19,1, + 19,1,19,1,19,3,19,597,8,19,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20, + 1,20,1,20,1,20,1,20,1,20,1,20,1,20,3,20,615,8,20,1,21,1,21,1,21,1,21,1, + 21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1, + 21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,3,21,647,8,21, + 1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22, + 1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,3,22,675,8, + 22,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1, + 23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1, + 23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,3,23,715,8,23,1,24, + 1,24,1,24,1,25,1,25,1,25,1,25,1,25,1,25,3,25,726,8,25,1,26,1,26,1,26,1, + 26,1,27,1,27,1,27,1,27,5,27,736,8,27,10,27,12,27,739,9,27,1,28,1,28,1, + 28,1,28,1,28,1,28,1,28,1,28,5,28,749,8,28,10,28,12,28,752,9,28,1,29,1, + 29,1,29,1,30,1,30,3,30,759,8,30,1,30,1,30,1,31,1,31,1,31,1,31,1,31,1,31, + 1,31,1,31,1,31,1,31,1,31,1,31,1,31,1,31,1,31,1,31,1,31,1,31,3,31,781,8, + 31,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,3,32,794,8,32, + 1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,34,1,34,1,34,5,34,808,8, + 34,10,34,12,34,811,9,34,1,34,1,34,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1, + 36,1,36,1,37,1,37,1,37,1,37,1,38,1,38,1,38,1,38,5,38,832,8,38,10,38,12, + 38,835,9,38,1,38,1,38,1,38,1,38,1,38,1,38,1,39,1,39,1,39,1,39,1,39,1,39, + 1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39, + 1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39, + 1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39, + 1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39,1,39, + 1,39,1,39,3,39,907,8,39,1,40,1,40,1,40,1,40,1,40,3,40,914,8,40,1,41,1, + 41,1,41,1,41,1,41,3,41,921,8,41,1,42,5,42,924,8,42,10,42,12,42,927,9,42, + 1,43,1,43,1,43,1,43,5,43,933,8,43,10,43,12,43,936,9,43,1,43,1,43,1,43, + 1,44,1,44,1,45,1,45,1,45,3,45,946,8,45,1,45,1,45,1,45,1,45,1,45,1,45,1, + 45,3,45,955,8,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,3,45,966, + 8,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,3,45,977,8,45,1,45,1, + 45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,3,45,990,8,45,1,45,1,45, + 3,45,994,8,45,1,46,1,46,1,46,1,46,5,46,1000,8,46,10,46,12,46,1003,9,46, + 1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,46,1,46,3,46, + 1018,8,46,1,47,1,47,1,48,1,48,1,48,3,48,1025,8,48,1,49,1,49,1,50,1,50, + 1,50,5,50,1032,8,50,10,50,12,50,1035,9,50,1,51,1,51,1,51,1,51,1,51,1,51, + 1,51,1,51,1,51,1,51,1,51,1,51,1,51,1,51,1,51,1,51,1,51,1,51,1,51,1,51, + 1,51,1,51,1,51,1,51,1,51,3,51,1062,8,51,1,52,1,52,1,52,1,52,1,52,1,52, + 1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52, + 1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52, + 1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52, + 1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52, + 1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52,1,52, + 3,52,1140,8,52,3,52,1142,8,52,1,53,1,53,1,53,1,53,1,53,1,54,1,54,1,54, + 1,54,1,54,1,54,1,54,3,54,1156,8,54,1,54,1,54,5,54,1160,8,54,10,54,12,54, + 1163,9,54,1,54,1,54,1,54,1,54,1,54,1,54,3,54,1171,8,54,3,54,1173,8,54, + 1,55,1,55,1,55,1,55,1,55,5,55,1180,8,55,10,55,12,55,1183,9,55,1,55,1,55, + 1,55,1,55,1,56,1,56,1,56,1,56,1,56,5,56,1194,8,56,10,56,12,56,1197,9,56, + 1,56,1,56,1,56,1,56,1,57,1,57,1,57,1,57,1,57,5,57,1208,8,57,10,57,12,57, + 1211,9,57,1,57,1,57,1,57,1,57,1,57,3,57,1218,8,57,1,58,1,58,1,58,1,58, + 1,58,1,58,3,58,1226,8,58,1,58,1,58,3,58,1230,8,58,1,59,1,59,1,59,1,59, + 1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59, + 1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59, + 1,59,1,59,1,59,1,59,1,59,3,59,1269,8,59,1,60,1,60,1,60,1,60,5,60,1275, + 8,60,10,60,12,60,1278,9,60,1,60,1,60,1,60,1,61,1,61,1,61,5,61,1286,8,61, + 10,61,12,61,1289,9,61,1,62,1,62,1,62,1,62,1,62,1,62,1,62,1,62,1,62,1,62, + 1,62,3,62,1302,8,62,1,63,1,63,1,63,1,63,1,63,1,63,3,63,1310,8,63,1,64, + 1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,64,3,64, + 1326,8,64,1,65,1,65,1,65,1,65,1,65,1,65,5,65,1334,8,65,10,65,12,65,1337, + 9,65,3,65,1339,8,65,1,66,1,66,1,66,1,66,1,66,1,66,1,66,1,66,1,66,1,66, + 1,66,1,66,1,66,1,66,1,66,1,66,1,66,1,66,1,66,1,66,1,66,1,66,3,66,1363, + 8,66,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67, + 1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67, + 1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67, + 1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67, + 1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67, + 1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67, + 1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67, + 1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67, + 1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67, + 1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67, + 1,67,1,67,1,67,1,67,1,67,1,67,3,67,1510,8,67,1,68,1,68,1,68,1,68,1,68, + 1,68,1,68,1,68,3,68,1520,8,68,1,69,1,69,1,69,1,69,1,69,5,69,1527,8,69, + 10,69,12,69,1530,9,69,3,69,1532,8,69,1,70,1,70,1,70,1,70,1,70,1,70,1,70, + 1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70, + 1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70, + 1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70, + 1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70, + 1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70, + 1,70,1,70,1,70,3,70,1614,8,70,1,71,1,71,1,71,1,71,1,71,5,71,1621,8,71, + 10,71,12,71,1624,9,71,1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72, + 1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72, + 1,72,1,72,1,72,1,72,1,72,3,72,1655,8,72,1,73,1,73,1,73,1,73,1,73,1,73, + 1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73, + 1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73, + 1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73, + 1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,1,73,3,73,1715,8,73,1,74, + 1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74, + 1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74, + 1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,3,74,1755,8,74,1,75,1,75, + 1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,75,1,75,3,75,1771, + 8,75,1,76,1,76,1,76,1,76,1,77,1,77,1,77,1,77,3,77,1781,8,77,1,77,1,77, + 1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78, + 1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,3,78,1811, + 8,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78, + 1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,1,78,3,78, + 1839,8,78,1,79,1,79,1,79,1,79,1,79,5,79,1846,8,79,10,79,12,79,1849,9,79, + 1,79,1,79,1,79,3,79,1854,8,79,1,80,1,80,1,80,1,80,1,80,1,80,1,80,1,80, + 1,80,1,80,1,80,1,80,1,80,1,80,1,80,3,80,1871,8,80,1,81,1,81,1,81,1,81, + 5,81,1877,8,81,10,81,12,81,1880,9,81,1,81,1,81,1,81,1,82,1,82,1,82,1,82, + 1,82,1,83,1,83,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84, + 1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84, + 1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84, + 1,84,1,84,1,84,1,84,1,84,1,84,3,84,1937,8,84,1,85,1,85,1,86,1,86,1,86, + 1,86,1,86,1,86,3,86,1947,8,86,1,86,1,86,1,86,1,86,1,86,1,86,1,86,1,86, + 1,86,1,86,1,86,1,86,1,86,1,86,1,86,1,86,3,86,1965,8,86,1,86,1,86,1,86, + 1,86,1,86,1,86,1,86,1,86,1,86,1,86,1,86,1,86,1,86,1,86,1,86,1,86,3,86, + 1983,8,86,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87,1,87, + 1,87,1,87,1,87,1,87,1,87,3,87,2002,8,87,1,88,1,88,1,88,1,88,1,88,1,88, + 1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,88,3,88, + 2023,8,88,1,89,1,89,1,89,1,89,1,89,1,89,1,90,1,90,1,90,1,90,1,90,1,90, + 1,90,1,90,1,90,1,90,1,90,3,90,2042,8,90,1,91,1,91,1,91,1,91,1,91,1,91, + 1,91,1,91,1,91,1,91,1,91,1,91,1,91,3,91,2057,8,91,1,92,1,92,1,92,1,92, + 5,92,2063,8,92,10,92,12,92,2066,9,92,1,92,1,92,1,92,1,93,1,93,1,93,1,93, + 1,93,1,93,3,93,2077,8,93,1,94,1,94,1,94,1,94,1,94,1,94,1,94,1,94,1,94, + 1,94,1,94,1,94,1,94,1,94,1,94,1,94,1,94,1,94,3,94,2097,8,94,1,95,1,95, + 1,95,5,95,2102,8,95,10,95,12,95,2105,9,95,1,96,1,96,3,96,2109,8,96,1,96, + 1,96,1,96,1,97,1,97,1,97,1,97,5,97,2118,8,97,10,97,12,97,2121,9,97,1,97, + 1,97,1,97,1,98,1,98,1,98,1,98,1,98,1,99,3,99,2132,8,99,1,99,1,99,1,100, + 1,100,1,100,1,100,1,100,1,100,1,100,1,101,1,101,1,101,1,101,1,101,1,101, + 1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101, + 1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101, + 1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101, + 1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101, + 1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101, + 1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101, + 1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101, + 1,101,1,101,1,101,1,101,1,101,1,101,1,101,5,101,2240,8,101,10,101,12,101, + 2243,9,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,5,101,2252,8,101, + 10,101,12,101,2255,9,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101,1,101, + 1,101,1,101,1,101,5,101,2268,8,101,10,101,12,101,2271,9,101,1,101,1,101, + 1,101,1,101,1,101,1,101,1,101,1,101,1,101,5,101,2282,8,101,10,101,12,101, + 2285,9,101,1,101,1,101,1,101,1,101,1,101,1,101,3,101,2293,8,101,1,102, + 1,102,1,102,1,102,1,102,1,102,1,102,1,102,1,102,1,102,1,102,5,102,2306, + 8,102,10,102,12,102,2309,9,102,1,102,1,102,1,102,1,102,1,102,1,102,1,103, + 1,103,1,103,1,103,1,103,1,103,1,103,1,103,1,103,1,103,1,103,1,103,1,103, + 1,103,1,103,1,103,1,103,1,103,1,103,1,103,1,103,1,103,1,103,1,103,1,103, + 1,103,1,103,1,103,1,103,1,103,1,103,1,103,1,103,1,103,3,103,2351,8,103, + 1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,1,104,3,104,2362,8,104, + 1,105,1,105,1,105,1,105,1,105,3,105,2369,8,105,1,106,1,106,1,106,1,106, + 1,106,1,106,3,106,2377,8,106,1,107,1,107,1,107,1,107,5,107,2383,8,107, + 10,107,12,107,2386,9,107,1,107,1,107,1,107,1,107,1,107,1,107,1,107,1,107, + 5,107,2396,8,107,10,107,12,107,2399,9,107,1,107,1,107,1,107,3,107,2404, + 8,107,1,108,1,108,1,108,1,108,3,108,2410,8,108,1,109,5,109,2413,8,109, + 10,109,12,109,2416,9,109,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110, 1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110,1,110, - 1,110,1,110,5,110,1757,8,110,10,110,12,110,1760,9,110,1,110,1,110,1,110, - 1,110,5,110,1766,8,110,10,110,12,110,1769,9,110,1,110,1,110,1,110,1,110, - 1,110,1,110,1,110,1,110,5,110,1779,8,110,10,110,12,110,1782,9,110,1,110, - 1,110,1,110,1,110,1,110,1,110,5,110,1790,8,110,10,110,12,110,1793,9,110, - 1,110,1,110,1,110,1,110,1,110,3,110,1800,8,110,1,111,1,111,1,111,1,111, - 1,111,1,111,1,111,1,111,5,111,1810,8,111,10,111,12,111,1813,9,111,1,111, - 1,111,1,111,1,111,1,111,1,112,1,112,1,112,1,112,1,112,1,112,1,112,1,112, - 1,112,1,112,1,112,1,112,1,112,1,112,1,112,1,112,1,112,1,112,1,112,3,112, - 1839,8,112,1,113,1,113,1,113,1,113,1,113,3,113,1846,8,113,1,114,1,114, - 1,114,3,114,1851,8,114,1,115,1,115,1,115,1,115,1,115,3,115,1858,8,115, - 1,116,1,116,5,116,1862,8,116,10,116,12,116,1865,9,116,1,116,1,116,1,116, - 1,116,1,116,5,116,1872,8,116,10,116,12,116,1875,9,116,1,116,3,116,1878, - 8,116,1,117,1,117,1,118,5,118,1883,8,118,10,118,12,118,1886,9,118,1,119, - 1,119,1,119,1,119,1,119,1,119,1,119,1,119,1,119,1,119,1,119,1,119,3,119, - 1900,8,119,1,120,1,120,5,120,1904,8,120,10,120,12,120,1907,9,120,1,120, - 1,120,1,120,1,120,1,120,1,120,1,121,1,121,1,122,5,122,1918,8,122,10,122, - 12,122,1921,9,122,1,123,1,123,1,123,1,123,1,123,1,123,1,123,1,123,1,123, - 1,123,3,123,1933,8,123,1,124,1,124,1,124,1,124,1,124,1,124,3,124,1941, - 8,124,1,125,1,125,1,125,4,125,1946,8,125,11,125,12,125,1947,1,125,1,125, - 3,125,1952,8,125,1,126,5,126,1955,8,126,10,126,12,126,1958,9,126,1,127, - 1,127,1,127,1,127,1,127,1,127,1,127,1,127,1,127,1,127,1,127,1,127,1,127, - 3,127,1973,8,127,1,128,1,128,1,128,5,128,1978,8,128,10,128,12,128,1981, - 9,128,1,128,1,128,1,128,1,128,1,128,1,128,1,128,1,128,5,128,1991,8,128, - 10,128,12,128,1994,9,128,1,129,1,129,1,129,1,129,1,129,1,129,1,129,1,129, - 1,129,1,129,1,129,1,129,1,129,1,129,1,129,1,129,1,129,1,129,1,129,1,129, - 1,129,1,129,1,129,3,129,2019,8,129,1,130,1,130,1,130,1,130,1,130,3,130, - 2026,8,130,3,130,2028,8,130,1,130,5,130,2031,8,130,10,130,12,130,2034, - 9,130,1,130,1,130,1,130,3,130,2039,8,130,1,131,1,131,1,131,1,131,1,131, - 1,131,1,131,1,131,1,131,1,131,1,131,1,131,1,131,1,131,1,131,1,131,1,131, - 1,131,1,131,1,131,1,131,1,131,1,131,1,131,1,131,1,131,1,131,3,131,2068, - 8,131,1,132,1,132,1,132,3,132,2073,8,132,1,133,1,133,1,133,1,133,1,133, - 1,133,1,133,1,133,1,133,1,133,1,133,1,133,1,133,1,133,1,133,1,133,1,133, - 1,133,1,133,1,133,1,133,3,133,2096,8,133,1,134,5,134,2099,8,134,10,134, - 12,134,2102,9,134,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135, - 1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135, - 1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135, - 1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135, - 1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,135, - 1,135,1,135,5,135,2163,8,135,10,135,12,135,2166,9,135,1,135,1,135,1,135, - 1,135,5,135,2172,8,135,10,135,12,135,2175,9,135,1,135,1,135,1,135,1,135, - 1,135,1,135,1,135,1,135,5,135,2185,8,135,10,135,12,135,2188,9,135,1,135, - 1,135,1,135,1,135,1,135,1,135,5,135,2196,8,135,10,135,12,135,2199,9,135, - 1,135,1,135,1,135,1,135,1,135,1,135,5,135,2207,8,135,10,135,12,135,2210, - 9,135,3,135,2212,8,135,1,136,1,136,1,136,1,137,1,137,3,137,2219,8,137, - 1,138,1,138,1,138,1,138,1,139,1,139,1,139,1,140,4,140,2229,8,140,11,140, - 12,140,2230,1,141,1,141,1,141,1,141,1,141,1,141,1,141,1,141,1,141,1,141, - 1,141,1,141,3,141,2245,8,141,1,142,1,142,1,142,1,142,1,142,1,142,1,142, - 1,142,1,142,1,142,1,142,1,142,3,142,2259,8,142,1,143,1,143,1,143,1,143, - 1,143,1,143,3,143,2267,8,143,1,144,1,144,1,144,1,145,1,145,1,146,1,146, - 1,147,1,147,1,147,1,147,1,147,1,147,1,147,1,147,1,147,1,147,1,147,3,147, - 2287,8,147,1,148,1,148,1,148,1,149,1,149,1,149,1,149,1,149,1,149,1,149, - 3,149,2299,8,149,1,150,1,150,1,150,3,150,2304,8,150,1,151,1,151,1,151, - 1,151,1,151,4,151,2311,8,151,11,151,12,151,2312,3,151,2315,8,151,1,152, - 1,152,1,152,5,152,2320,8,152,10,152,12,152,2323,9,152,1,152,1,152,1,153, - 1,153,1,153,1,153,1,153,3,153,2332,8,153,1,154,1,154,1,154,1,154,1,154, - 1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154, - 1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154, - 1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154, - 1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154, - 1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154, - 1,154,3,154,2400,8,154,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, + 1,110,1,110,1,110,1,110,1,110,1,110,3,110,2444,8,110,1,111,1,111,1,111, + 1,111,5,111,2450,8,111,10,111,12,111,2453,9,111,1,111,1,111,1,111,1,111, + 1,111,1,111,1,111,1,112,1,112,1,112,1,112,3,112,2466,8,112,1,113,5,113, + 2469,8,113,10,113,12,113,2472,9,113,1,114,1,114,1,114,1,114,1,114,1,114, + 1,114,1,114,1,114,1,114,1,114,1,114,1,114,1,114,1,114,1,114,1,114,1,114, + 1,114,1,114,1,114,1,114,3,114,2496,8,114,1,115,1,115,1,115,1,115,1,115, + 1,115,1,115,3,115,2505,8,115,1,116,1,116,1,116,1,116,1,116,1,116,1,116, + 4,116,2514,8,116,11,116,12,116,2515,1,116,1,116,3,116,2520,8,116,1,117, + 1,117,1,117,5,117,2525,8,117,10,117,12,117,2528,9,117,1,118,1,118,1,118, + 1,118,1,118,1,118,1,118,1,118,1,118,1,118,1,118,1,118,1,118,1,118,1,118, + 1,118,1,118,3,118,2547,8,118,1,119,1,119,1,119,1,119,1,119,1,119,1,119, + 5,119,2556,8,119,10,119,12,119,2559,9,119,1,119,1,119,1,119,1,119,1,119, + 1,119,1,119,1,119,1,119,1,119,5,119,2571,8,119,10,119,12,119,2574,9,119, + 1,119,1,119,1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120, + 1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120, + 1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120, + 1,120,1,120,1,120,1,120,1,120,1,120,1,120,1,120,3,120,2620,8,120,1,121, + 1,121,1,121,1,121,1,121,1,121,1,121,1,121,3,121,2630,8,121,3,121,2632, + 8,121,1,121,1,121,1,121,5,121,2637,8,121,10,121,12,121,2640,9,121,1,121, + 1,121,1,121,3,121,2645,8,121,1,122,1,122,1,122,1,122,1,122,1,122,1,122, + 1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122, + 1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122, + 1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122,1,122,3,122, + 2689,8,122,1,123,1,123,1,123,1,123,1,123,1,123,1,123,3,123,2698,8,123, + 1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124, + 1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124, + 1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124,1,124, + 1,124,1,124,3,124,2738,8,124,1,125,5,125,2741,8,125,10,125,12,125,2744, + 9,125,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126, + 1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126, + 1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126, + 1,126,1,126,3,126,2783,8,126,1,127,1,127,3,127,2787,8,127,1,127,1,127, + 1,128,1,128,1,128,1,128,1,128,1,128,3,128,2797,8,128,1,129,1,129,1,129, + 1,129,1,129,1,130,1,130,1,130,1,130,1,130,1,130,1,130,1,130,1,130,1,130, + 1,130,1,130,1,130,1,130,1,130,3,130,2819,8,130,1,131,1,131,1,131,1,131, + 1,131,1,131,1,131,1,131,5,131,2829,8,131,10,131,12,131,2832,9,131,1,131, + 1,131,1,131,1,131,1,131,1,131,5,131,2840,8,131,10,131,12,131,2843,9,131, + 1,131,1,131,1,131,1,131,1,131,1,131,1,131,1,131,1,131,1,131,5,131,2855, + 8,131,10,131,12,131,2858,9,131,1,131,1,131,1,131,1,131,1,131,1,131,1,131, + 1,131,5,131,2868,8,131,10,131,12,131,2871,9,131,1,131,1,131,1,131,1,131, + 1,131,1,131,1,131,1,131,5,131,2881,8,131,10,131,12,131,2884,9,131,3,131, + 2886,8,131,1,132,1,132,1,132,1,132,1,133,1,133,1,133,1,133,1,133,1,133, + 3,133,2898,8,133,1,134,1,134,1,134,1,134,1,135,1,135,1,135,1,136,1,136, + 1,136,4,136,2910,8,136,11,136,12,136,2911,1,137,1,137,1,137,1,137,1,137, + 1,137,1,137,1,137,1,137,1,137,1,137,1,137,1,137,1,137,1,137,1,137,3,137, + 2930,8,137,1,138,1,138,1,138,1,138,1,138,1,138,1,138,1,138,1,138,1,138, + 1,138,1,138,1,138,1,138,1,138,1,138,3,138,2948,8,138,1,139,1,139,1,139, + 1,139,1,139,1,139,1,139,1,139,1,139,1,139,1,139,1,139,3,139,2962,8,139, + 1,140,1,140,1,140,1,141,1,141,1,142,1,142,1,143,1,143,1,143,1,143,1,143, + 1,143,1,143,1,143,1,143,1,143,1,143,1,143,1,143,1,143,1,143,3,143,2986, + 8,143,1,144,1,144,1,144,1,145,1,145,1,145,1,145,1,145,1,145,1,145,1,145, + 1,145,1,145,3,145,3001,8,145,1,146,1,146,1,146,1,146,1,146,3,146,3008, + 8,146,1,147,1,147,1,147,1,147,1,147,4,147,3015,8,147,11,147,12,147,3016, + 3,147,3019,8,147,1,148,1,148,1,148,5,148,3024,8,148,10,148,12,148,3027, + 9,148,1,148,1,148,1,149,1,149,1,149,1,149,1,149,1,149,3,149,3037,8,149, + 1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150, + 1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150, + 1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150, + 1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150,1,150, + 3,150,3087,8,150,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151, + 1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151, + 1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151, + 1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151, + 1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151, + 1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151, + 1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151, + 1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,151,3,151,3179,8,151, + 1,152,1,152,1,152,5,152,3184,8,152,10,152,12,152,3187,9,152,1,153,1,153, + 1,154,1,154,1,154,1,154,1,154,1,154,1,154,1,154,3,154,3199,8,154,1,155, + 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, + 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, + 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, + 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, + 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, + 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, + 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, + 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, + 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, 1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155,1,155, - 1,155,1,155,1,155,1,155,1,155,1,155,1,155,3,155,2477,8,155,1,156,5,156, - 2480,8,156,10,156,12,156,2483,9,156,1,157,1,157,1,158,1,158,1,158,3,158, - 2490,8,158,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159, - 1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159, - 1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159, - 1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159, - 1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159, - 1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159, - 1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159, - 1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159, - 1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159, - 1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159, - 1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159, - 1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159,1,159, - 1,159,1,159,1,159,1,159,1,159,1,159,3,159,2640,8,159,1,160,1,160,5,160, - 2644,8,160,10,160,12,160,2647,9,160,1,161,1,161,5,161,2651,8,161,10,161, - 12,161,2654,9,161,1,162,5,162,2657,8,162,10,162,12,162,2660,9,162,1,163, - 5,163,2663,8,163,10,163,12,163,2666,9,163,1,164,5,164,2669,8,164,10,164, - 12,164,2672,9,164,1,165,5,165,2675,8,165,10,165,12,165,2678,9,165,1,166, - 5,166,2681,8,166,10,166,12,166,2684,9,166,1,167,5,167,2687,8,167,10,167, - 12,167,2690,9,167,1,168,5,168,2693,8,168,10,168,12,168,2696,9,168,1,169, - 1,169,1,169,1,169,3,169,2702,8,169,1,170,5,170,2705,8,170,10,170,12,170, - 2708,9,170,1,171,1,171,1,171,3,171,2713,8,171,1,172,1,172,1,172,1,172, + 1,155,1,155,3,155,3372,8,155,1,156,1,156,1,156,1,156,1,156,1,156,5,156, + 3380,8,156,10,156,12,156,3383,9,156,1,157,1,157,1,157,1,157,1,157,1,157, + 5,157,3391,8,157,10,157,12,157,3394,9,157,1,158,1,158,1,158,5,158,3399, + 8,158,10,158,12,158,3402,9,158,1,159,1,159,1,159,5,159,3407,8,159,10,159, + 12,159,3410,9,159,1,160,1,160,1,160,5,160,3415,8,160,10,160,12,160,3418, + 9,160,1,161,1,161,1,161,5,161,3423,8,161,10,161,12,161,3426,9,161,1,162, + 1,162,1,162,5,162,3431,8,162,10,162,12,162,3434,9,162,1,163,1,163,1,163, + 1,163,5,163,3440,8,163,10,163,12,163,3443,9,163,1,164,1,164,1,164,5,164, + 3448,8,164,10,164,12,164,3451,9,164,1,165,1,165,1,165,1,165,1,165,1,165, + 1,165,1,165,3,165,3461,8,165,1,166,1,166,1,166,5,166,3466,8,166,10,166, + 12,166,3469,9,166,1,167,1,167,1,167,1,167,1,167,1,167,1,167,1,167,1,167, + 3,167,3480,8,167,1,168,1,168,1,168,1,168,1,168,1,168,1,168,1,168,1,168, + 1,168,1,168,1,168,1,168,1,168,1,168,1,168,1,168,1,168,1,168,1,168,1,168, + 1,168,1,168,1,168,1,168,1,168,1,168,1,168,1,168,1,168,1,168,1,168,3,168, + 3514,8,168,1,169,1,169,1,169,1,169,1,169,1,169,1,170,1,170,1,170,1,170, + 1,170,1,170,1,170,1,170,1,170,1,170,1,170,1,170,1,170,1,170,3,170,3536, + 8,170,1,171,1,171,1,171,5,171,3541,8,171,10,171,12,171,3544,9,171,1,172, 1,172,1,172,1,172,1,172,1,172,1,172,1,172,1,172,1,172,1,172,1,172,1,172, - 1,172,1,172,1,172,1,172,1,172,1,172,1,172,1,172,1,172,3,172,2740,8,172, - 1,173,1,173,1,173,1,173,1,173,1,173,1,173,1,173,1,173,1,173,1,173,1,173, - 3,173,2754,8,173,1,174,5,174,2757,8,174,10,174,12,174,2760,9,174,1,175, - 1,175,1,175,1,175,1,175,1,175,1,175,1,175,1,175,1,175,1,175,1,175,1,175, - 1,175,3,175,2776,8,175,1,176,1,176,1,176,5,176,2781,8,176,10,176,12,176, - 2784,9,176,1,176,1,176,1,177,1,177,5,177,2790,8,177,10,177,12,177,2793, - 9,177,1,177,1,177,1,178,1,178,1,178,1,178,1,178,1,178,1,178,1,178,1,178, - 1,178,1,178,1,178,1,178,1,178,1,178,3,178,2812,8,178,1,179,5,179,2815, - 8,179,10,179,12,179,2818,9,179,1,180,1,180,1,180,1,180,1,180,1,180,1,180, - 1,180,1,180,1,180,1,180,1,180,1,180,3,180,2833,8,180,1,181,1,181,5,181, - 2837,8,181,10,181,12,181,2840,9,181,1,181,1,181,1,181,5,181,2845,8,181, - 10,181,12,181,2848,9,181,1,181,1,181,1,181,1,181,3,181,2854,8,181,1,182, - 1,182,1,183,5,183,2859,8,183,10,183,12,183,2862,9,183,1,184,1,184,1,184, - 1,184,1,184,1,184,1,184,1,184,1,184,1,184,3,184,2874,8,184,1,184,0,1,68, - 185,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46, - 48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94, - 96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130, - 132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166, - 168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202, - 204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238, - 240,242,244,246,248,250,252,254,256,258,260,262,264,266,268,270,272,274, - 276,278,280,282,284,286,288,290,292,294,296,298,300,302,304,306,308,310, - 312,314,316,318,320,322,324,326,328,330,332,334,336,338,340,342,344,346, - 348,350,352,354,356,358,360,362,364,366,368,0,14,5,0,1,15,242,242,246, - 246,263,263,288,288,4,0,16,16,242,242,263,263,287,288,1,0,172,173,1,0, - 37,38,1,0,73,74,3,0,2,2,61,61,77,83,2,0,228,228,259,260,9,0,177,177,182, - 194,200,200,206,207,209,214,217,218,221,221,229,241,261,261,1,0,95,96, - 1,0,97,111,1,0,68,69,2,0,172,172,288,289,2,0,178,178,263,263,1,0,51,52, - 3289,0,370,1,0,0,0,2,383,1,0,0,0,4,385,1,0,0,0,6,391,1,0,0,0,8,399,1,0, - 0,0,10,452,1,0,0,0,12,454,1,0,0,0,14,457,1,0,0,0,16,460,1,0,0,0,18,464, - 1,0,0,0,20,467,1,0,0,0,22,470,1,0,0,0,24,477,1,0,0,0,26,493,1,0,0,0,28, - 495,1,0,0,0,30,497,1,0,0,0,32,507,1,0,0,0,34,509,1,0,0,0,36,526,1,0,0, - 0,38,530,1,0,0,0,40,548,1,0,0,0,42,575,1,0,0,0,44,598,1,0,0,0,46,634,1, - 0,0,0,48,636,1,0,0,0,50,640,1,0,0,0,52,642,1,0,0,0,54,649,1,0,0,0,56,661, - 1,0,0,0,58,664,1,0,0,0,60,666,1,0,0,0,62,679,1,0,0,0,64,687,1,0,0,0,66, - 689,1,0,0,0,68,697,1,0,0,0,70,713,1,0,0,0,72,719,1,0,0,0,74,722,1,0,0, - 0,76,771,1,0,0,0,78,776,1,0,0,0,80,781,1,0,0,0,82,786,1,0,0,0,84,794,1, - 0,0,0,86,799,1,0,0,0,88,872,1,0,0,0,90,900,1,0,0,0,92,902,1,0,0,0,94,906, - 1,0,0,0,96,908,1,0,0,0,98,913,1,0,0,0,100,916,1,0,0,0,102,918,1,0,0,0, - 104,920,1,0,0,0,106,922,1,0,0,0,108,924,1,0,0,0,110,926,1,0,0,0,112,928, - 1,0,0,0,114,930,1,0,0,0,116,932,1,0,0,0,118,934,1,0,0,0,120,936,1,0,0, - 0,122,938,1,0,0,0,124,940,1,0,0,0,126,1024,1,0,0,0,128,1042,1,0,0,0,130, - 1044,1,0,0,0,132,1056,1,0,0,0,134,1081,1,0,0,0,136,1090,1,0,0,0,138,1117, - 1,0,0,0,140,1124,1,0,0,0,142,1132,1,0,0,0,144,1140,1,0,0,0,146,1153,1, - 0,0,0,148,1163,1,0,0,0,150,1182,1,0,0,0,152,1276,1,0,0,0,154,1285,1,0, - 0,0,156,1295,1,0,0,0,158,1297,1,0,0,0,160,1299,1,0,0,0,162,1324,1,0,0, - 0,164,1356,1,0,0,0,166,1379,1,0,0,0,168,1391,1,0,0,0,170,1393,1,0,0,0, - 172,1396,1,0,0,0,174,1449,1,0,0,0,176,1461,1,0,0,0,178,1476,1,0,0,0,180, - 1483,1,0,0,0,182,1488,1,0,0,0,184,1492,1,0,0,0,186,1528,1,0,0,0,188,1530, - 1,0,0,0,190,1566,1,0,0,0,192,1578,1,0,0,0,194,1592,1,0,0,0,196,1594,1, - 0,0,0,198,1604,1,0,0,0,200,1615,1,0,0,0,202,1622,1,0,0,0,204,1632,1,0, - 0,0,206,1645,1,0,0,0,208,1650,1,0,0,0,210,1653,1,0,0,0,212,1664,1,0,0, - 0,214,1669,1,0,0,0,216,1675,1,0,0,0,218,1677,1,0,0,0,220,1799,1,0,0,0, - 222,1801,1,0,0,0,224,1838,1,0,0,0,226,1845,1,0,0,0,228,1850,1,0,0,0,230, - 1857,1,0,0,0,232,1877,1,0,0,0,234,1879,1,0,0,0,236,1884,1,0,0,0,238,1899, - 1,0,0,0,240,1901,1,0,0,0,242,1914,1,0,0,0,244,1919,1,0,0,0,246,1932,1, - 0,0,0,248,1940,1,0,0,0,250,1951,1,0,0,0,252,1956,1,0,0,0,254,1972,1,0, - 0,0,256,1974,1,0,0,0,258,2018,1,0,0,0,260,2038,1,0,0,0,262,2067,1,0,0, - 0,264,2072,1,0,0,0,266,2095,1,0,0,0,268,2100,1,0,0,0,270,2211,1,0,0,0, - 272,2213,1,0,0,0,274,2218,1,0,0,0,276,2220,1,0,0,0,278,2224,1,0,0,0,280, - 2228,1,0,0,0,282,2244,1,0,0,0,284,2258,1,0,0,0,286,2266,1,0,0,0,288,2268, - 1,0,0,0,290,2271,1,0,0,0,292,2273,1,0,0,0,294,2286,1,0,0,0,296,2288,1, - 0,0,0,298,2298,1,0,0,0,300,2303,1,0,0,0,302,2314,1,0,0,0,304,2321,1,0, - 0,0,306,2331,1,0,0,0,308,2399,1,0,0,0,310,2476,1,0,0,0,312,2481,1,0,0, - 0,314,2484,1,0,0,0,316,2489,1,0,0,0,318,2639,1,0,0,0,320,2645,1,0,0,0, - 322,2652,1,0,0,0,324,2658,1,0,0,0,326,2664,1,0,0,0,328,2670,1,0,0,0,330, - 2676,1,0,0,0,332,2682,1,0,0,0,334,2688,1,0,0,0,336,2694,1,0,0,0,338,2701, - 1,0,0,0,340,2706,1,0,0,0,342,2712,1,0,0,0,344,2739,1,0,0,0,346,2753,1, - 0,0,0,348,2758,1,0,0,0,350,2775,1,0,0,0,352,2777,1,0,0,0,354,2787,1,0, - 0,0,356,2811,1,0,0,0,358,2816,1,0,0,0,360,2832,1,0,0,0,362,2853,1,0,0, - 0,364,2855,1,0,0,0,366,2860,1,0,0,0,368,2873,1,0,0,0,370,371,7,0,0,0,371, - 1,1,0,0,0,372,384,5,287,0,0,373,374,3,4,2,0,374,375,5,264,0,0,375,377, - 1,0,0,0,376,373,1,0,0,0,377,380,1,0,0,0,378,376,1,0,0,0,378,379,1,0,0, - 0,379,381,1,0,0,0,380,378,1,0,0,0,381,384,3,4,2,0,382,384,5,263,0,0,383, - 372,1,0,0,0,383,378,1,0,0,0,383,382,1,0,0,0,384,3,1,0,0,0,385,386,7,1, - 0,0,386,5,1,0,0,0,387,388,5,262,0,0,388,390,5,265,0,0,389,387,1,0,0,0, - 390,393,1,0,0,0,391,389,1,0,0,0,391,392,1,0,0,0,392,394,1,0,0,0,393,391, - 1,0,0,0,394,395,5,262,0,0,395,7,1,0,0,0,396,398,3,10,5,0,397,396,1,0,0, - 0,398,401,1,0,0,0,399,397,1,0,0,0,399,400,1,0,0,0,400,9,1,0,0,0,401,399, - 1,0,0,0,402,403,3,74,37,0,403,404,5,17,0,0,404,405,3,82,41,0,405,406,5, - 18,0,0,406,453,1,0,0,0,407,408,3,72,36,0,408,409,5,17,0,0,409,410,3,8, - 4,0,410,411,5,18,0,0,411,453,1,0,0,0,412,413,3,256,128,0,413,414,5,17, - 0,0,414,415,3,268,134,0,415,416,5,18,0,0,416,453,1,0,0,0,417,453,3,222, - 111,0,418,453,3,296,148,0,419,453,3,70,35,0,420,453,3,66,33,0,421,453, - 3,88,44,0,422,453,3,90,45,0,423,453,3,22,11,0,424,425,3,346,173,0,425, - 426,5,17,0,0,426,427,3,348,174,0,427,428,5,18,0,0,428,453,1,0,0,0,429, - 430,3,352,176,0,430,431,5,17,0,0,431,432,3,358,179,0,432,433,5,18,0,0, - 433,453,1,0,0,0,434,435,3,362,181,0,435,436,5,17,0,0,436,437,3,366,183, - 0,437,438,5,18,0,0,438,453,1,0,0,0,439,453,3,64,32,0,440,453,3,174,87, - 0,441,453,3,342,171,0,442,453,3,12,6,0,443,453,3,14,7,0,444,453,3,16,8, - 0,445,453,3,18,9,0,446,453,3,20,10,0,447,453,3,26,13,0,448,453,3,42,21, - 0,449,453,3,40,20,0,450,453,3,30,15,0,451,453,3,24,12,0,452,402,1,0,0, - 0,452,407,1,0,0,0,452,412,1,0,0,0,452,417,1,0,0,0,452,418,1,0,0,0,452, - 419,1,0,0,0,452,420,1,0,0,0,452,421,1,0,0,0,452,422,1,0,0,0,452,423,1, - 0,0,0,452,424,1,0,0,0,452,429,1,0,0,0,452,434,1,0,0,0,452,439,1,0,0,0, - 452,440,1,0,0,0,452,441,1,0,0,0,452,442,1,0,0,0,452,443,1,0,0,0,452,444, - 1,0,0,0,452,445,1,0,0,0,452,446,1,0,0,0,452,447,1,0,0,0,452,448,1,0,0, - 0,452,449,1,0,0,0,452,450,1,0,0,0,452,451,1,0,0,0,453,11,1,0,0,0,454,455, - 5,19,0,0,455,456,3,32,16,0,456,13,1,0,0,0,457,458,5,20,0,0,458,459,3,32, - 16,0,459,15,1,0,0,0,460,461,5,21,0,0,461,462,5,22,0,0,462,463,3,32,16, - 0,463,17,1,0,0,0,464,465,5,23,0,0,465,466,3,34,17,0,466,19,1,0,0,0,467, - 468,5,24,0,0,468,469,3,34,17,0,469,21,1,0,0,0,470,471,5,25,0,0,471,472, - 3,98,49,0,472,473,3,2,1,0,473,474,5,17,0,0,474,475,3,142,71,0,475,476, - 5,18,0,0,476,23,1,0,0,0,477,478,5,26,0,0,478,25,1,0,0,0,479,480,5,27,0, - 0,480,494,3,28,14,0,481,482,5,27,0,0,482,483,3,28,14,0,483,484,5,28,0, - 0,484,485,3,28,14,0,485,494,1,0,0,0,486,487,5,27,0,0,487,488,3,28,14,0, - 488,489,5,28,0,0,489,490,3,28,14,0,490,491,5,28,0,0,491,492,3,28,14,0, - 492,494,1,0,0,0,493,479,1,0,0,0,493,481,1,0,0,0,493,486,1,0,0,0,494,27, - 1,0,0,0,495,496,5,263,0,0,496,29,1,0,0,0,497,498,5,29,0,0,498,502,5,17, - 0,0,499,501,3,138,69,0,500,499,1,0,0,0,501,504,1,0,0,0,502,500,1,0,0,0, - 502,503,1,0,0,0,503,505,1,0,0,0,504,502,1,0,0,0,505,506,5,18,0,0,506,31, - 1,0,0,0,507,508,5,172,0,0,508,33,1,0,0,0,509,510,7,2,0,0,510,35,1,0,0, - 0,511,527,5,174,0,0,512,513,3,32,16,0,513,514,5,264,0,0,514,527,1,0,0, - 0,515,527,3,32,16,0,516,517,5,187,0,0,517,518,5,30,0,0,518,519,3,32,16, - 0,519,520,5,31,0,0,520,527,1,0,0,0,521,522,5,188,0,0,522,523,5,30,0,0, - 523,524,3,34,17,0,524,525,5,31,0,0,525,527,1,0,0,0,526,511,1,0,0,0,526, - 512,1,0,0,0,526,515,1,0,0,0,526,516,1,0,0,0,526,521,1,0,0,0,527,37,1,0, - 0,0,528,531,3,32,16,0,529,531,5,261,0,0,530,528,1,0,0,0,530,529,1,0,0, - 0,531,39,1,0,0,0,532,533,5,266,0,0,533,549,5,288,0,0,534,535,5,266,0,0, - 535,536,5,288,0,0,536,549,5,262,0,0,537,538,5,267,0,0,538,549,5,288,0, - 0,539,540,5,268,0,0,540,549,5,288,0,0,541,542,5,269,0,0,542,549,5,288, - 0,0,543,549,5,270,0,0,544,549,5,271,0,0,545,546,5,272,0,0,546,549,5,262, - 0,0,547,549,5,32,0,0,548,532,1,0,0,0,548,534,1,0,0,0,548,537,1,0,0,0,548, - 539,1,0,0,0,548,541,1,0,0,0,548,543,1,0,0,0,548,544,1,0,0,0,548,545,1, - 0,0,0,548,547,1,0,0,0,549,41,1,0,0,0,550,551,5,33,0,0,551,552,3,160,80, - 0,552,553,5,34,0,0,553,554,3,2,1,0,554,576,1,0,0,0,555,556,5,33,0,0,556, - 557,3,138,69,0,557,558,5,34,0,0,558,559,3,2,1,0,559,576,1,0,0,0,560,561, - 5,33,0,0,561,562,3,198,99,0,562,563,5,34,0,0,563,564,3,2,1,0,564,576,1, - 0,0,0,565,566,5,33,0,0,566,567,3,44,22,0,567,568,5,34,0,0,568,569,3,2, - 1,0,569,576,1,0,0,0,570,571,5,33,0,0,571,572,3,46,23,0,572,573,5,34,0, - 0,573,574,3,2,1,0,574,576,1,0,0,0,575,550,1,0,0,0,575,555,1,0,0,0,575, - 560,1,0,0,0,575,565,1,0,0,0,575,570,1,0,0,0,576,43,1,0,0,0,577,578,5,35, - 0,0,578,599,3,48,24,0,579,580,5,35,0,0,580,581,3,48,24,0,581,582,5,36, - 0,0,582,583,3,6,3,0,583,599,1,0,0,0,584,585,5,35,0,0,585,586,3,48,24,0, - 586,587,5,36,0,0,587,588,5,17,0,0,588,589,3,52,26,0,589,590,5,18,0,0,590, - 599,1,0,0,0,591,592,5,35,0,0,592,593,3,48,24,0,593,594,5,36,0,0,594,595, - 5,30,0,0,595,596,3,312,156,0,596,597,5,31,0,0,597,599,1,0,0,0,598,577, - 1,0,0,0,598,579,1,0,0,0,598,584,1,0,0,0,598,591,1,0,0,0,599,45,1,0,0,0, - 600,601,5,35,0,0,601,602,5,30,0,0,602,603,3,50,25,0,603,604,5,31,0,0,604, - 605,3,48,24,0,605,635,1,0,0,0,606,607,5,35,0,0,607,608,5,30,0,0,608,609, - 3,50,25,0,609,610,5,31,0,0,610,611,3,48,24,0,611,612,5,36,0,0,612,613, - 3,6,3,0,613,635,1,0,0,0,614,615,5,35,0,0,615,616,5,30,0,0,616,617,3,50, - 25,0,617,618,5,31,0,0,618,619,3,48,24,0,619,620,5,36,0,0,620,621,5,17, - 0,0,621,622,3,52,26,0,622,623,5,18,0,0,623,635,1,0,0,0,624,625,5,35,0, - 0,625,626,5,30,0,0,626,627,3,50,25,0,627,628,5,31,0,0,628,629,3,48,24, - 0,629,630,5,36,0,0,630,631,5,30,0,0,631,632,3,312,156,0,632,633,5,31,0, - 0,633,635,1,0,0,0,634,600,1,0,0,0,634,606,1,0,0,0,634,614,1,0,0,0,634, - 624,1,0,0,0,635,47,1,0,0,0,636,637,3,190,95,0,637,49,1,0,0,0,638,641,3, - 146,73,0,639,641,3,198,99,0,640,638,1,0,0,0,640,639,1,0,0,0,641,51,1,0, - 0,0,642,643,3,54,27,0,643,644,3,56,28,0,644,53,1,0,0,0,645,648,3,318,159, - 0,646,648,3,40,20,0,647,645,1,0,0,0,647,646,1,0,0,0,648,651,1,0,0,0,649, - 647,1,0,0,0,649,650,1,0,0,0,650,55,1,0,0,0,651,649,1,0,0,0,652,653,3,58, - 29,0,653,654,3,60,30,0,654,655,3,2,1,0,655,656,5,36,0,0,656,657,3,318, - 159,0,657,660,1,0,0,0,658,660,3,40,20,0,659,652,1,0,0,0,659,658,1,0,0, - 0,660,663,1,0,0,0,661,659,1,0,0,0,661,662,1,0,0,0,662,57,1,0,0,0,663,661, - 1,0,0,0,664,665,7,3,0,0,665,59,1,0,0,0,666,668,3,62,31,0,667,669,5,260, - 0,0,668,667,1,0,0,0,668,669,1,0,0,0,669,61,1,0,0,0,670,680,3,166,83,0, - 671,680,3,2,1,0,672,680,5,195,0,0,673,680,5,196,0,0,674,675,5,201,0,0, - 675,676,5,39,0,0,676,680,5,263,0,0,677,678,5,201,0,0,678,680,3,138,69, - 0,679,670,1,0,0,0,679,671,1,0,0,0,679,672,1,0,0,0,679,673,1,0,0,0,679, - 674,1,0,0,0,679,677,1,0,0,0,680,63,1,0,0,0,681,682,5,197,0,0,682,683,5, - 40,0,0,683,688,3,2,1,0,684,685,5,197,0,0,685,688,3,2,1,0,686,688,5,197, - 0,0,687,681,1,0,0,0,687,684,1,0,0,0,687,686,1,0,0,0,688,65,1,0,0,0,689, - 690,5,41,0,0,690,691,5,42,0,0,691,692,3,32,16,0,692,693,5,43,0,0,693,694, - 3,68,34,0,694,695,5,44,0,0,695,696,3,0,0,0,696,67,1,0,0,0,697,710,6,34, - -1,0,698,699,10,5,0,0,699,709,5,185,0,0,700,701,10,4,0,0,701,709,5,186, - 0,0,702,703,10,3,0,0,703,709,5,45,0,0,704,705,10,2,0,0,705,709,5,46,0, - 0,706,707,10,1,0,0,707,709,5,47,0,0,708,698,1,0,0,0,708,700,1,0,0,0,708, - 702,1,0,0,0,708,704,1,0,0,0,708,706,1,0,0,0,709,712,1,0,0,0,710,708,1, - 0,0,0,710,711,1,0,0,0,711,69,1,0,0,0,712,710,1,0,0,0,713,714,5,48,0,0, - 714,715,5,36,0,0,715,716,5,30,0,0,716,717,3,312,156,0,717,718,5,31,0,0, - 718,71,1,0,0,0,719,720,5,49,0,0,720,721,3,2,1,0,721,73,1,0,0,0,722,726, - 5,50,0,0,723,725,3,76,38,0,724,723,1,0,0,0,725,728,1,0,0,0,726,724,1,0, - 0,0,726,727,1,0,0,0,727,729,1,0,0,0,728,726,1,0,0,0,729,730,3,2,1,0,730, - 731,3,204,102,0,731,732,3,78,39,0,732,733,3,80,40,0,733,75,1,0,0,0,734, - 772,5,51,0,0,735,772,5,52,0,0,736,772,5,198,0,0,737,772,5,201,0,0,738, - 772,5,220,0,0,739,772,5,53,0,0,740,772,5,54,0,0,741,772,5,55,0,0,742,772, - 5,56,0,0,743,772,5,243,0,0,744,772,5,15,0,0,745,772,5,223,0,0,746,772, - 5,57,0,0,747,772,5,58,0,0,748,772,5,59,0,0,749,772,5,60,0,0,750,772,5, - 61,0,0,751,752,5,62,0,0,752,772,5,51,0,0,753,754,5,62,0,0,754,772,5,52, - 0,0,755,756,5,62,0,0,756,772,5,63,0,0,757,758,5,62,0,0,758,772,5,64,0, - 0,759,760,5,62,0,0,760,772,5,65,0,0,761,762,5,62,0,0,762,772,5,66,0,0, - 763,772,5,67,0,0,764,772,5,68,0,0,765,772,5,69,0,0,766,767,5,70,0,0,767, - 768,5,30,0,0,768,769,3,32,16,0,769,770,5,31,0,0,770,772,1,0,0,0,771,734, - 1,0,0,0,771,735,1,0,0,0,771,736,1,0,0,0,771,737,1,0,0,0,771,738,1,0,0, - 0,771,739,1,0,0,0,771,740,1,0,0,0,771,741,1,0,0,0,771,742,1,0,0,0,771, - 743,1,0,0,0,771,744,1,0,0,0,771,745,1,0,0,0,771,746,1,0,0,0,771,747,1, - 0,0,0,771,748,1,0,0,0,771,749,1,0,0,0,771,750,1,0,0,0,771,751,1,0,0,0, - 771,753,1,0,0,0,771,755,1,0,0,0,771,757,1,0,0,0,771,759,1,0,0,0,771,761, - 1,0,0,0,771,763,1,0,0,0,771,764,1,0,0,0,771,765,1,0,0,0,771,766,1,0,0, - 0,772,77,1,0,0,0,773,777,1,0,0,0,774,775,5,71,0,0,775,777,3,146,73,0,776, - 773,1,0,0,0,776,774,1,0,0,0,777,79,1,0,0,0,778,782,1,0,0,0,779,780,5,72, - 0,0,780,782,3,84,42,0,781,778,1,0,0,0,781,779,1,0,0,0,782,81,1,0,0,0,783, - 785,3,220,110,0,784,783,1,0,0,0,785,788,1,0,0,0,786,784,1,0,0,0,786,787, - 1,0,0,0,787,83,1,0,0,0,788,786,1,0,0,0,789,790,3,146,73,0,790,791,5,28, - 0,0,791,793,1,0,0,0,792,789,1,0,0,0,793,796,1,0,0,0,794,792,1,0,0,0,794, - 795,1,0,0,0,795,797,1,0,0,0,796,794,1,0,0,0,797,798,3,146,73,0,798,85, - 1,0,0,0,799,800,7,4,0,0,800,87,1,0,0,0,801,802,3,86,43,0,802,803,3,32, - 16,0,803,804,5,263,0,0,804,873,1,0,0,0,805,806,3,86,43,0,806,807,3,32, - 16,0,807,873,1,0,0,0,808,809,3,86,43,0,809,810,3,32,16,0,810,811,5,75, - 0,0,811,812,3,32,16,0,812,813,5,263,0,0,813,873,1,0,0,0,814,815,3,86,43, - 0,815,816,3,32,16,0,816,817,5,75,0,0,817,818,3,32,16,0,818,873,1,0,0,0, - 819,820,3,86,43,0,820,821,3,32,16,0,821,822,5,75,0,0,822,823,3,32,16,0, - 823,824,5,28,0,0,824,825,3,32,16,0,825,826,5,263,0,0,826,873,1,0,0,0,827, - 828,3,86,43,0,828,829,3,32,16,0,829,830,5,75,0,0,830,831,3,32,16,0,831, - 832,5,28,0,0,832,833,3,32,16,0,833,873,1,0,0,0,834,835,3,86,43,0,835,836, - 3,32,16,0,836,837,5,28,0,0,837,838,3,32,16,0,838,839,5,75,0,0,839,840, - 3,32,16,0,840,841,5,263,0,0,841,873,1,0,0,0,842,843,3,86,43,0,843,844, - 3,32,16,0,844,845,5,28,0,0,845,846,3,32,16,0,846,847,5,75,0,0,847,848, - 3,32,16,0,848,873,1,0,0,0,849,850,3,86,43,0,850,851,3,32,16,0,851,852, - 5,28,0,0,852,853,3,32,16,0,853,854,5,75,0,0,854,855,3,32,16,0,855,856, - 5,28,0,0,856,857,3,32,16,0,857,858,5,263,0,0,858,873,1,0,0,0,859,860,3, - 86,43,0,860,861,3,32,16,0,861,862,5,28,0,0,862,863,3,32,16,0,863,864,5, - 75,0,0,864,865,3,32,16,0,865,866,5,28,0,0,866,867,3,32,16,0,867,873,1, - 0,0,0,868,869,3,86,43,0,869,870,3,32,16,0,870,871,5,262,0,0,871,873,1, - 0,0,0,872,801,1,0,0,0,872,805,1,0,0,0,872,808,1,0,0,0,872,814,1,0,0,0, - 872,819,1,0,0,0,872,827,1,0,0,0,872,834,1,0,0,0,872,842,1,0,0,0,872,849, - 1,0,0,0,872,859,1,0,0,0,872,868,1,0,0,0,873,89,1,0,0,0,874,878,5,21,0, - 0,875,877,3,92,46,0,876,875,1,0,0,0,877,880,1,0,0,0,878,876,1,0,0,0,878, - 879,1,0,0,0,879,881,1,0,0,0,880,878,1,0,0,0,881,882,3,2,1,0,882,883,3, - 94,47,0,883,884,5,179,0,0,884,885,5,36,0,0,885,886,5,30,0,0,886,887,3, - 312,156,0,887,888,5,31,0,0,888,889,3,94,47,0,889,901,1,0,0,0,890,894,5, - 21,0,0,891,893,3,92,46,0,892,891,1,0,0,0,893,896,1,0,0,0,894,892,1,0,0, - 0,894,895,1,0,0,0,895,897,1,0,0,0,896,894,1,0,0,0,897,898,3,2,1,0,898, - 899,3,94,47,0,899,901,1,0,0,0,900,874,1,0,0,0,900,890,1,0,0,0,901,91,1, - 0,0,0,902,903,5,76,0,0,903,93,1,0,0,0,904,907,1,0,0,0,905,907,5,297,0, - 0,906,904,1,0,0,0,906,905,1,0,0,0,907,95,1,0,0,0,908,909,7,5,0,0,909,97, - 1,0,0,0,910,912,3,96,48,0,911,910,1,0,0,0,912,915,1,0,0,0,913,911,1,0, - 0,0,913,914,1,0,0,0,914,99,1,0,0,0,915,913,1,0,0,0,916,917,5,274,0,0,917, - 101,1,0,0,0,918,919,5,275,0,0,919,103,1,0,0,0,920,921,5,276,0,0,921,105, - 1,0,0,0,922,923,5,277,0,0,923,107,1,0,0,0,924,925,5,278,0,0,925,109,1, - 0,0,0,926,927,5,281,0,0,927,111,1,0,0,0,928,929,5,279,0,0,929,113,1,0, - 0,0,930,931,5,285,0,0,931,115,1,0,0,0,932,933,5,283,0,0,933,117,1,0,0, - 0,934,935,5,284,0,0,935,119,1,0,0,0,936,937,5,280,0,0,937,121,1,0,0,0, - 938,939,5,286,0,0,939,123,1,0,0,0,940,941,5,282,0,0,941,125,1,0,0,0,942, - 1025,3,100,50,0,943,944,3,102,51,0,944,945,3,32,16,0,945,1025,1,0,0,0, - 946,947,3,102,51,0,947,948,3,0,0,0,948,1025,1,0,0,0,949,950,3,104,52,0, - 950,951,3,32,16,0,951,1025,1,0,0,0,952,953,3,106,53,0,953,954,3,34,17, - 0,954,1025,1,0,0,0,955,956,3,108,54,0,956,957,3,36,18,0,957,1025,1,0,0, - 0,958,959,3,108,54,0,959,960,3,34,17,0,960,1025,1,0,0,0,961,962,3,108, - 54,0,962,963,5,30,0,0,963,964,3,312,156,0,964,965,5,31,0,0,965,1025,1, - 0,0,0,966,967,3,108,54,0,967,968,5,84,0,0,968,969,5,30,0,0,969,970,3,312, - 156,0,970,971,5,31,0,0,971,1025,1,0,0,0,972,973,3,110,55,0,973,974,3,32, - 16,0,974,1025,1,0,0,0,975,976,3,110,55,0,976,977,3,0,0,0,977,1025,1,0, - 0,0,978,979,3,112,56,0,979,980,3,190,95,0,980,1025,1,0,0,0,981,982,3,114, - 57,0,982,983,3,200,100,0,983,1025,1,0,0,0,984,985,3,114,57,0,985,986,3, - 196,98,0,986,1025,1,0,0,0,987,988,3,116,58,0,988,989,3,146,73,0,989,1025, - 1,0,0,0,990,991,3,118,59,0,991,992,3,6,3,0,992,1025,1,0,0,0,993,994,3, - 118,59,0,994,995,5,223,0,0,995,996,5,30,0,0,996,997,3,6,3,0,997,998,5, - 31,0,0,998,1025,1,0,0,0,999,1000,3,118,59,0,1000,1001,5,84,0,0,1001,1002, - 5,30,0,0,1002,1003,3,312,156,0,1003,1004,5,31,0,0,1004,1025,1,0,0,0,1005, - 1006,3,120,60,0,1006,1007,3,192,96,0,1007,1008,3,160,80,0,1008,1009,3, - 134,67,0,1009,1025,1,0,0,0,1010,1011,3,122,61,0,1011,1012,3,50,25,0,1012, - 1025,1,0,0,0,1013,1014,3,122,61,0,1014,1015,3,32,16,0,1015,1025,1,0,0, - 0,1016,1017,3,124,62,0,1017,1018,5,30,0,0,1018,1019,3,128,64,0,1019,1020, - 5,31,0,0,1020,1025,1,0,0,0,1021,1022,3,124,62,0,1022,1023,5,85,0,0,1023, - 1025,1,0,0,0,1024,942,1,0,0,0,1024,943,1,0,0,0,1024,946,1,0,0,0,1024,949, - 1,0,0,0,1024,952,1,0,0,0,1024,955,1,0,0,0,1024,958,1,0,0,0,1024,961,1, - 0,0,0,1024,966,1,0,0,0,1024,972,1,0,0,0,1024,975,1,0,0,0,1024,978,1,0, - 0,0,1024,981,1,0,0,0,1024,984,1,0,0,0,1024,987,1,0,0,0,1024,990,1,0,0, - 0,1024,993,1,0,0,0,1024,999,1,0,0,0,1024,1005,1,0,0,0,1024,1010,1,0,0, - 0,1024,1013,1,0,0,0,1024,1016,1,0,0,0,1024,1021,1,0,0,0,1025,127,1,0,0, - 0,1026,1043,1,0,0,0,1027,1030,3,0,0,0,1028,1030,3,32,16,0,1029,1027,1, - 0,0,0,1029,1028,1,0,0,0,1030,1031,1,0,0,0,1031,1032,5,28,0,0,1032,1034, - 1,0,0,0,1033,1029,1,0,0,0,1034,1037,1,0,0,0,1035,1033,1,0,0,0,1035,1036, - 1,0,0,0,1036,1040,1,0,0,0,1037,1035,1,0,0,0,1038,1041,3,0,0,0,1039,1041, - 3,32,16,0,1040,1038,1,0,0,0,1040,1039,1,0,0,0,1041,1043,1,0,0,0,1042,1026, - 1,0,0,0,1042,1035,1,0,0,0,1043,129,1,0,0,0,1044,1050,5,86,0,0,1045,1046, - 3,160,80,0,1046,1047,5,28,0,0,1047,1049,1,0,0,0,1048,1045,1,0,0,0,1049, - 1052,1,0,0,0,1050,1048,1,0,0,0,1050,1051,1,0,0,0,1051,1053,1,0,0,0,1052, - 1050,1,0,0,0,1053,1054,3,160,80,0,1054,1055,5,87,0,0,1055,131,1,0,0,0, - 1056,1062,5,42,0,0,1057,1058,3,168,84,0,1058,1059,5,28,0,0,1059,1061,1, - 0,0,0,1060,1057,1,0,0,0,1061,1064,1,0,0,0,1062,1060,1,0,0,0,1062,1063, - 1,0,0,0,1063,1065,1,0,0,0,1064,1062,1,0,0,0,1065,1066,3,168,84,0,1066, - 1067,5,43,0,0,1067,133,1,0,0,0,1068,1074,5,30,0,0,1069,1070,3,136,68,0, - 1070,1071,5,28,0,0,1071,1073,1,0,0,0,1072,1069,1,0,0,0,1073,1076,1,0,0, - 0,1074,1072,1,0,0,0,1074,1075,1,0,0,0,1075,1077,1,0,0,0,1076,1074,1,0, - 0,0,1077,1078,3,136,68,0,1078,1079,5,31,0,0,1079,1082,1,0,0,0,1080,1082, - 5,85,0,0,1081,1068,1,0,0,0,1081,1080,1,0,0,0,1082,135,1,0,0,0,1083,1091, - 5,176,0,0,1084,1085,3,252,126,0,1085,1086,3,160,80,0,1086,1088,3,248,124, - 0,1087,1089,3,0,0,0,1088,1087,1,0,0,0,1088,1089,1,0,0,0,1089,1091,1,0, - 0,0,1090,1083,1,0,0,0,1090,1084,1,0,0,0,1091,137,1,0,0,0,1092,1093,5,42, - 0,0,1093,1094,3,2,1,0,1094,1095,5,43,0,0,1095,1096,3,140,70,0,1096,1118, - 1,0,0,0,1097,1098,5,42,0,0,1098,1099,3,196,98,0,1099,1100,5,43,0,0,1100, - 1101,3,140,70,0,1101,1118,1,0,0,0,1102,1103,5,42,0,0,1103,1104,5,261,0, - 0,1104,1105,5,43,0,0,1105,1118,3,140,70,0,1106,1107,5,42,0,0,1107,1108, - 5,197,0,0,1108,1109,3,2,1,0,1109,1110,5,43,0,0,1110,1111,3,140,70,0,1111, - 1118,1,0,0,0,1112,1118,3,140,70,0,1113,1118,3,196,98,0,1114,1118,5,256, - 0,0,1115,1118,5,257,0,0,1116,1118,5,258,0,0,1117,1092,1,0,0,0,1117,1097, - 1,0,0,0,1117,1102,1,0,0,0,1117,1106,1,0,0,0,1117,1112,1,0,0,0,1117,1113, - 1,0,0,0,1117,1114,1,0,0,0,1117,1115,1,0,0,0,1117,1116,1,0,0,0,1118,139, - 1,0,0,0,1119,1120,3,2,1,0,1120,1121,5,88,0,0,1121,1123,1,0,0,0,1122,1119, - 1,0,0,0,1123,1126,1,0,0,0,1124,1122,1,0,0,0,1124,1125,1,0,0,0,1125,1127, - 1,0,0,0,1126,1124,1,0,0,0,1127,1128,3,2,1,0,1128,141,1,0,0,0,1129,1131, - 3,144,72,0,1130,1129,1,0,0,0,1131,1134,1,0,0,0,1132,1130,1,0,0,0,1132, - 1133,1,0,0,0,1133,143,1,0,0,0,1134,1132,1,0,0,0,1135,1136,5,179,0,0,1136, - 1137,5,89,0,0,1137,1141,3,32,16,0,1138,1141,3,174,87,0,1139,1141,3,344, - 172,0,1140,1135,1,0,0,0,1140,1138,1,0,0,0,1140,1139,1,0,0,0,1141,145,1, - 0,0,0,1142,1154,3,138,69,0,1143,1144,5,42,0,0,1144,1145,3,2,1,0,1145,1146, - 5,43,0,0,1146,1154,1,0,0,0,1147,1148,5,42,0,0,1148,1149,5,197,0,0,1149, - 1150,3,2,1,0,1150,1151,5,43,0,0,1151,1154,1,0,0,0,1152,1154,3,160,80,0, - 1153,1142,1,0,0,0,1153,1143,1,0,0,0,1153,1147,1,0,0,0,1153,1152,1,0,0, - 0,1154,147,1,0,0,0,1155,1164,1,0,0,0,1156,1160,3,152,76,0,1157,1159,3, - 150,75,0,1158,1157,1,0,0,0,1159,1162,1,0,0,0,1160,1158,1,0,0,0,1160,1161, - 1,0,0,0,1161,1164,1,0,0,0,1162,1160,1,0,0,0,1163,1155,1,0,0,0,1163,1156, - 1,0,0,0,1164,149,1,0,0,0,1165,1183,5,261,0,0,1166,1183,5,260,0,0,1167, - 1168,5,42,0,0,1168,1169,3,32,16,0,1169,1170,5,43,0,0,1170,1183,1,0,0,0, - 1171,1172,5,42,0,0,1172,1173,3,32,16,0,1173,1174,5,265,0,0,1174,1175,3, - 32,16,0,1175,1176,5,43,0,0,1176,1183,1,0,0,0,1177,1178,5,42,0,0,1178,1179, - 5,265,0,0,1179,1180,3,32,16,0,1180,1181,5,43,0,0,1181,1183,1,0,0,0,1182, - 1165,1,0,0,0,1182,1166,1,0,0,0,1182,1167,1,0,0,0,1182,1171,1,0,0,0,1182, - 1177,1,0,0,0,1183,151,1,0,0,0,1184,1277,1,0,0,0,1185,1186,5,202,0,0,1186, - 1187,5,30,0,0,1187,1188,3,6,3,0,1188,1189,5,28,0,0,1189,1190,3,6,3,0,1190, - 1191,5,28,0,0,1191,1192,3,6,3,0,1192,1193,5,28,0,0,1193,1194,3,6,3,0,1194, - 1195,5,31,0,0,1195,1277,1,0,0,0,1196,1197,5,202,0,0,1197,1198,5,30,0,0, - 1198,1199,3,6,3,0,1199,1200,5,28,0,0,1200,1201,3,6,3,0,1201,1202,5,31, - 0,0,1202,1277,1,0,0,0,1203,1204,5,203,0,0,1204,1205,5,204,0,0,1205,1206, - 5,42,0,0,1206,1207,3,32,16,0,1207,1208,5,43,0,0,1208,1277,1,0,0,0,1209, - 1210,5,203,0,0,1210,1211,5,205,0,0,1211,1212,5,42,0,0,1212,1213,3,32,16, - 0,1213,1214,5,43,0,0,1214,1215,3,148,74,0,1215,1277,1,0,0,0,1216,1277, - 5,206,0,0,1217,1277,5,207,0,0,1218,1277,5,208,0,0,1219,1277,5,200,0,0, - 1220,1277,5,182,0,0,1221,1277,5,183,0,0,1222,1277,5,184,0,0,1223,1277, - 5,185,0,0,1224,1277,5,186,0,0,1225,1277,5,187,0,0,1226,1277,5,188,0,0, - 1227,1277,5,209,0,0,1228,1277,5,189,0,0,1229,1277,5,190,0,0,1230,1277, - 5,191,0,0,1231,1277,5,192,0,0,1232,1277,5,210,0,0,1233,1277,5,211,0,0, - 1234,1277,5,212,0,0,1235,1277,5,213,0,0,1236,1277,5,214,0,0,1237,1277, - 5,215,0,0,1238,1277,5,216,0,0,1239,1240,5,217,0,0,1240,1277,3,154,77,0, - 1241,1242,5,218,0,0,1242,1277,3,154,77,0,1243,1277,5,219,0,0,1244,1245, - 5,220,0,0,1245,1277,3,154,77,0,1246,1247,5,221,0,0,1247,1277,3,156,78, - 0,1248,1249,5,221,0,0,1249,1250,3,156,78,0,1250,1251,5,28,0,0,1251,1252, - 3,6,3,0,1252,1277,1,0,0,0,1253,1277,5,193,0,0,1254,1277,5,194,0,0,1255, - 1256,5,90,0,0,1256,1277,5,183,0,0,1257,1258,5,90,0,0,1258,1277,5,184,0, - 0,1259,1260,5,90,0,0,1260,1277,5,185,0,0,1261,1262,5,90,0,0,1262,1277, - 5,186,0,0,1263,1264,5,62,0,0,1264,1277,5,219,0,0,1265,1277,5,222,0,0,1266, - 1267,5,223,0,0,1267,1277,5,212,0,0,1268,1277,5,224,0,0,1269,1270,5,206, - 0,0,1270,1277,5,182,0,0,1271,1277,5,225,0,0,1272,1277,5,227,0,0,1273,1274, - 5,34,0,0,1274,1277,5,226,0,0,1275,1277,3,2,1,0,1276,1184,1,0,0,0,1276, - 1185,1,0,0,0,1276,1196,1,0,0,0,1276,1203,1,0,0,0,1276,1209,1,0,0,0,1276, - 1216,1,0,0,0,1276,1217,1,0,0,0,1276,1218,1,0,0,0,1276,1219,1,0,0,0,1276, - 1220,1,0,0,0,1276,1221,1,0,0,0,1276,1222,1,0,0,0,1276,1223,1,0,0,0,1276, - 1224,1,0,0,0,1276,1225,1,0,0,0,1276,1226,1,0,0,0,1276,1227,1,0,0,0,1276, - 1228,1,0,0,0,1276,1229,1,0,0,0,1276,1230,1,0,0,0,1276,1231,1,0,0,0,1276, - 1232,1,0,0,0,1276,1233,1,0,0,0,1276,1234,1,0,0,0,1276,1235,1,0,0,0,1276, - 1236,1,0,0,0,1276,1237,1,0,0,0,1276,1238,1,0,0,0,1276,1239,1,0,0,0,1276, - 1241,1,0,0,0,1276,1243,1,0,0,0,1276,1244,1,0,0,0,1276,1246,1,0,0,0,1276, - 1248,1,0,0,0,1276,1253,1,0,0,0,1276,1254,1,0,0,0,1276,1255,1,0,0,0,1276, - 1257,1,0,0,0,1276,1259,1,0,0,0,1276,1261,1,0,0,0,1276,1263,1,0,0,0,1276, - 1265,1,0,0,0,1276,1266,1,0,0,0,1276,1268,1,0,0,0,1276,1269,1,0,0,0,1276, - 1271,1,0,0,0,1276,1272,1,0,0,0,1276,1273,1,0,0,0,1276,1275,1,0,0,0,1277, - 153,1,0,0,0,1278,1286,1,0,0,0,1279,1280,5,30,0,0,1280,1281,5,91,0,0,1281, - 1282,5,36,0,0,1282,1283,3,32,16,0,1283,1284,5,31,0,0,1284,1286,1,0,0,0, - 1285,1278,1,0,0,0,1285,1279,1,0,0,0,1286,155,1,0,0,0,1287,1296,1,0,0,0, - 1288,1292,3,158,79,0,1289,1291,7,6,0,0,1290,1289,1,0,0,0,1291,1294,1,0, - 0,0,1292,1290,1,0,0,0,1292,1293,1,0,0,0,1293,1296,1,0,0,0,1294,1292,1, - 0,0,0,1295,1287,1,0,0,0,1295,1288,1,0,0,0,1296,157,1,0,0,0,1297,1298,7, - 7,0,0,1298,159,1,0,0,0,1299,1303,3,164,82,0,1300,1302,3,162,81,0,1301, - 1300,1,0,0,0,1302,1305,1,0,0,0,1303,1301,1,0,0,0,1303,1304,1,0,0,0,1304, - 161,1,0,0,0,1305,1303,1,0,0,0,1306,1325,5,260,0,0,1307,1308,5,42,0,0,1308, - 1325,5,43,0,0,1309,1325,3,132,66,0,1310,1325,5,259,0,0,1311,1325,5,261, - 0,0,1312,1325,5,92,0,0,1313,1314,5,93,0,0,1314,1315,5,30,0,0,1315,1316, - 3,146,73,0,1316,1317,5,31,0,0,1317,1325,1,0,0,0,1318,1319,5,94,0,0,1319, - 1320,5,30,0,0,1320,1321,3,146,73,0,1321,1322,5,31,0,0,1322,1325,1,0,0, - 0,1323,1325,3,130,65,0,1324,1306,1,0,0,0,1324,1307,1,0,0,0,1324,1309,1, - 0,0,0,1324,1310,1,0,0,0,1324,1311,1,0,0,0,1324,1312,1,0,0,0,1324,1313, - 1,0,0,0,1324,1318,1,0,0,0,1324,1323,1,0,0,0,1325,163,1,0,0,0,1326,1327, - 5,39,0,0,1327,1357,3,138,69,0,1328,1357,5,196,0,0,1329,1330,5,198,0,0, - 1330,1331,5,39,0,0,1331,1357,3,138,69,0,1332,1333,5,199,0,0,1333,1357, - 3,138,69,0,1334,1335,5,225,0,0,1335,1336,3,192,96,0,1336,1337,3,160,80, - 0,1337,1338,5,261,0,0,1338,1339,3,134,67,0,1339,1357,1,0,0,0,1340,1341, - 5,252,0,0,1341,1357,3,32,16,0,1342,1343,5,251,0,0,1343,1357,3,32,16,0, - 1344,1345,5,252,0,0,1345,1357,3,2,1,0,1346,1347,5,251,0,0,1347,1357,3, - 2,1,0,1348,1357,5,253,0,0,1349,1357,5,200,0,0,1350,1357,3,170,85,0,1351, - 1357,3,172,86,0,1352,1357,3,166,83,0,1353,1357,3,2,1,0,1354,1355,5,176, - 0,0,1355,1357,3,160,80,0,1356,1326,1,0,0,0,1356,1328,1,0,0,0,1356,1329, - 1,0,0,0,1356,1332,1,0,0,0,1356,1334,1,0,0,0,1356,1340,1,0,0,0,1356,1342, - 1,0,0,0,1356,1344,1,0,0,0,1356,1346,1,0,0,0,1356,1348,1,0,0,0,1356,1349, - 1,0,0,0,1356,1350,1,0,0,0,1356,1351,1,0,0,0,1356,1352,1,0,0,0,1356,1353, - 1,0,0,0,1356,1354,1,0,0,0,1357,165,1,0,0,0,1358,1380,5,180,0,0,1359,1380, - 5,181,0,0,1360,1380,5,182,0,0,1361,1380,5,183,0,0,1362,1380,5,184,0,0, - 1363,1380,5,185,0,0,1364,1380,5,186,0,0,1365,1380,5,187,0,0,1366,1380, - 5,188,0,0,1367,1380,5,189,0,0,1368,1380,5,190,0,0,1369,1380,5,191,0,0, - 1370,1380,5,192,0,0,1371,1372,5,90,0,0,1372,1380,5,183,0,0,1373,1374,5, - 90,0,0,1374,1380,5,184,0,0,1375,1376,5,90,0,0,1376,1380,5,185,0,0,1377, - 1378,5,90,0,0,1378,1380,5,186,0,0,1379,1358,1,0,0,0,1379,1359,1,0,0,0, - 1379,1360,1,0,0,0,1379,1361,1,0,0,0,1379,1362,1,0,0,0,1379,1363,1,0,0, - 0,1379,1364,1,0,0,0,1379,1365,1,0,0,0,1379,1366,1,0,0,0,1379,1367,1,0, - 0,0,1379,1368,1,0,0,0,1379,1369,1,0,0,0,1379,1370,1,0,0,0,1379,1371,1, - 0,0,0,1379,1373,1,0,0,0,1379,1375,1,0,0,0,1379,1377,1,0,0,0,1380,167,1, - 0,0,0,1381,1392,1,0,0,0,1382,1392,5,176,0,0,1383,1392,3,32,16,0,1384,1385, - 3,32,16,0,1385,1386,5,176,0,0,1386,1387,3,32,16,0,1387,1392,1,0,0,0,1388, - 1389,3,32,16,0,1389,1390,5,176,0,0,1390,1392,1,0,0,0,1391,1381,1,0,0,0, - 1391,1382,1,0,0,0,1391,1383,1,0,0,0,1391,1384,1,0,0,0,1391,1388,1,0,0, - 0,1392,169,1,0,0,0,1393,1394,5,1,0,0,1394,1395,5,193,0,0,1395,171,1,0, - 0,0,1396,1400,5,1,0,0,1397,1398,5,90,0,0,1398,1401,5,193,0,0,1399,1401, - 5,194,0,0,1400,1397,1,0,0,0,1400,1399,1,0,0,0,1401,173,1,0,0,0,1402,1403, - 5,293,0,0,1403,1404,3,188,94,0,1404,1405,3,146,73,0,1405,1406,5,30,0,0, - 1406,1407,3,180,90,0,1407,1408,5,31,0,0,1408,1450,1,0,0,0,1409,1410,5, - 293,0,0,1410,1411,3,188,94,0,1411,1412,3,146,73,0,1412,1413,5,36,0,0,1413, - 1414,5,17,0,0,1414,1415,3,52,26,0,1415,1416,5,18,0,0,1416,1450,1,0,0,0, - 1417,1418,5,293,0,0,1418,1419,3,188,94,0,1419,1420,3,146,73,0,1420,1450, - 1,0,0,0,1421,1422,5,294,0,0,1422,1423,3,188,94,0,1423,1425,5,36,0,0,1424, - 1426,5,84,0,0,1425,1424,1,0,0,0,1425,1426,1,0,0,0,1426,1427,1,0,0,0,1427, - 1428,5,30,0,0,1428,1429,3,312,156,0,1429,1430,5,31,0,0,1430,1450,1,0,0, - 0,1431,1432,5,294,0,0,1432,1433,3,188,94,0,1433,1434,5,84,0,0,1434,1435, - 5,30,0,0,1435,1436,3,312,156,0,1436,1437,5,31,0,0,1437,1450,1,0,0,0,1438, - 1439,5,294,0,0,1439,1440,3,188,94,0,1440,1441,3,6,3,0,1441,1450,1,0,0, - 0,1442,1443,5,294,0,0,1443,1444,3,188,94,0,1444,1445,5,36,0,0,1445,1446, - 5,17,0,0,1446,1447,3,176,88,0,1447,1448,5,18,0,0,1448,1450,1,0,0,0,1449, - 1402,1,0,0,0,1449,1409,1,0,0,0,1449,1417,1,0,0,0,1449,1421,1,0,0,0,1449, - 1431,1,0,0,0,1449,1438,1,0,0,0,1449,1442,1,0,0,0,1450,175,1,0,0,0,1451, - 1462,1,0,0,0,1452,1453,3,178,89,0,1453,1454,5,28,0,0,1454,1456,1,0,0,0, - 1455,1452,1,0,0,0,1456,1459,1,0,0,0,1457,1455,1,0,0,0,1457,1458,1,0,0, - 0,1458,1460,1,0,0,0,1459,1457,1,0,0,0,1460,1462,3,178,89,0,1461,1451,1, - 0,0,0,1461,1457,1,0,0,0,1462,177,1,0,0,0,1463,1464,5,39,0,0,1464,1465, - 5,263,0,0,1465,1466,5,36,0,0,1466,1467,5,17,0,0,1467,1468,3,56,28,0,1468, - 1469,5,18,0,0,1469,1477,1,0,0,0,1470,1471,3,146,73,0,1471,1472,5,36,0, - 0,1472,1473,5,17,0,0,1473,1474,3,56,28,0,1474,1475,5,18,0,0,1475,1477, - 1,0,0,0,1476,1463,1,0,0,0,1476,1470,1,0,0,0,1477,179,1,0,0,0,1478,1479, - 3,182,91,0,1479,1480,5,28,0,0,1480,1482,1,0,0,0,1481,1478,1,0,0,0,1482, - 1485,1,0,0,0,1483,1481,1,0,0,0,1483,1484,1,0,0,0,1484,1486,1,0,0,0,1485, - 1483,1,0,0,0,1486,1487,3,182,91,0,1487,181,1,0,0,0,1488,1489,3,6,3,0,1489, - 1490,5,36,0,0,1490,1491,3,186,93,0,1491,183,1,0,0,0,1492,1493,7,8,0,0, - 1493,185,1,0,0,0,1494,1529,3,184,92,0,1495,1529,3,32,16,0,1496,1497,5, - 185,0,0,1497,1498,5,30,0,0,1498,1499,3,32,16,0,1499,1500,5,31,0,0,1500, - 1529,1,0,0,0,1501,1529,3,6,3,0,1502,1503,3,138,69,0,1503,1504,5,30,0,0, - 1504,1505,5,183,0,0,1505,1506,5,75,0,0,1506,1507,3,32,16,0,1507,1508,5, - 31,0,0,1508,1529,1,0,0,0,1509,1510,3,138,69,0,1510,1511,5,30,0,0,1511, - 1512,5,184,0,0,1512,1513,5,75,0,0,1513,1514,3,32,16,0,1514,1515,5,31,0, - 0,1515,1529,1,0,0,0,1516,1517,3,138,69,0,1517,1518,5,30,0,0,1518,1519, - 5,185,0,0,1519,1520,5,75,0,0,1520,1521,3,32,16,0,1521,1522,5,31,0,0,1522, - 1529,1,0,0,0,1523,1524,3,138,69,0,1524,1525,5,30,0,0,1525,1526,3,32,16, - 0,1526,1527,5,31,0,0,1527,1529,1,0,0,0,1528,1494,1,0,0,0,1528,1495,1,0, - 0,0,1528,1496,1,0,0,0,1528,1501,1,0,0,0,1528,1502,1,0,0,0,1528,1509,1, - 0,0,0,1528,1516,1,0,0,0,1528,1523,1,0,0,0,1529,187,1,0,0,0,1530,1531,7, - 9,0,0,1531,189,1,0,0,0,1532,1533,3,192,96,0,1533,1534,3,160,80,0,1534, - 1535,3,146,73,0,1535,1536,5,175,0,0,1536,1538,3,264,132,0,1537,1539,3, - 130,65,0,1538,1537,1,0,0,0,1538,1539,1,0,0,0,1539,1540,1,0,0,0,1540,1541, - 3,134,67,0,1541,1567,1,0,0,0,1542,1543,3,192,96,0,1543,1544,3,160,80,0, - 1544,1545,3,146,73,0,1545,1546,5,175,0,0,1546,1547,3,264,132,0,1547,1548, - 3,218,109,0,1548,1549,3,134,67,0,1549,1567,1,0,0,0,1550,1551,3,192,96, - 0,1551,1552,3,160,80,0,1552,1554,3,264,132,0,1553,1555,3,130,65,0,1554, - 1553,1,0,0,0,1554,1555,1,0,0,0,1555,1556,1,0,0,0,1556,1557,3,134,67,0, - 1557,1567,1,0,0,0,1558,1559,3,192,96,0,1559,1560,3,160,80,0,1560,1561, - 3,264,132,0,1561,1562,3,218,109,0,1562,1563,3,134,67,0,1563,1567,1,0,0, - 0,1564,1567,3,196,98,0,1565,1567,3,2,1,0,1566,1532,1,0,0,0,1566,1542,1, - 0,0,0,1566,1550,1,0,0,0,1566,1558,1,0,0,0,1566,1564,1,0,0,0,1566,1565, - 1,0,0,0,1567,191,1,0,0,0,1568,1569,5,242,0,0,1569,1579,3,192,96,0,1570, - 1571,5,243,0,0,1571,1579,3,192,96,0,1572,1579,3,194,97,0,1573,1574,5,112, - 0,0,1574,1575,5,30,0,0,1575,1576,3,32,16,0,1576,1577,5,31,0,0,1577,1579, - 1,0,0,0,1578,1568,1,0,0,0,1578,1570,1,0,0,0,1578,1572,1,0,0,0,1578,1573, - 1,0,0,0,1579,193,1,0,0,0,1580,1593,1,0,0,0,1581,1593,5,244,0,0,1582,1593, - 5,245,0,0,1583,1584,5,246,0,0,1584,1593,5,247,0,0,1585,1586,5,246,0,0, - 1586,1593,5,248,0,0,1587,1588,5,246,0,0,1588,1593,5,249,0,0,1589,1590, - 5,246,0,0,1590,1593,5,250,0,0,1591,1593,5,246,0,0,1592,1580,1,0,0,0,1592, - 1581,1,0,0,0,1592,1582,1,0,0,0,1592,1583,1,0,0,0,1592,1585,1,0,0,0,1592, - 1587,1,0,0,0,1592,1589,1,0,0,0,1592,1591,1,0,0,0,1593,195,1,0,0,0,1594, - 1595,5,113,0,0,1595,1596,5,30,0,0,1596,1597,3,32,16,0,1597,1598,5,31,0, - 0,1598,197,1,0,0,0,1599,1600,5,225,0,0,1600,1605,3,190,95,0,1601,1602, - 5,37,0,0,1602,1605,3,200,100,0,1603,1605,3,196,98,0,1604,1599,1,0,0,0, - 1604,1601,1,0,0,0,1604,1603,1,0,0,0,1605,199,1,0,0,0,1606,1607,3,160,80, - 0,1607,1608,3,146,73,0,1608,1609,5,175,0,0,1609,1610,3,2,1,0,1610,1616, - 1,0,0,0,1611,1612,3,160,80,0,1612,1613,3,2,1,0,1613,1616,1,0,0,0,1614, - 1616,3,2,1,0,1615,1606,1,0,0,0,1615,1611,1,0,0,0,1615,1614,1,0,0,0,1616, - 201,1,0,0,0,1617,1618,3,146,73,0,1618,1619,5,28,0,0,1619,1621,1,0,0,0, - 1620,1617,1,0,0,0,1621,1624,1,0,0,0,1622,1620,1,0,0,0,1622,1623,1,0,0, - 0,1623,1625,1,0,0,0,1624,1622,1,0,0,0,1625,1626,3,146,73,0,1626,203,1, - 0,0,0,1627,1633,1,0,0,0,1628,1629,5,86,0,0,1629,1630,3,212,106,0,1630, - 1631,5,87,0,0,1631,1633,1,0,0,0,1632,1627,1,0,0,0,1632,1628,1,0,0,0,1633, - 205,1,0,0,0,1634,1646,5,265,0,0,1635,1646,5,114,0,0,1636,1646,5,39,0,0, - 1637,1646,5,199,0,0,1638,1646,5,115,0,0,1639,1646,5,116,0,0,1640,1641, - 5,70,0,0,1641,1642,5,30,0,0,1642,1643,3,32,16,0,1643,1644,5,31,0,0,1644, - 1646,1,0,0,0,1645,1634,1,0,0,0,1645,1635,1,0,0,0,1645,1636,1,0,0,0,1645, - 1637,1,0,0,0,1645,1638,1,0,0,0,1645,1639,1,0,0,0,1645,1640,1,0,0,0,1646, - 207,1,0,0,0,1647,1649,3,206,103,0,1648,1647,1,0,0,0,1649,1652,1,0,0,0, - 1650,1648,1,0,0,0,1650,1651,1,0,0,0,1651,209,1,0,0,0,1652,1650,1,0,0,0, - 1653,1655,3,208,104,0,1654,1656,3,214,107,0,1655,1654,1,0,0,0,1655,1656, - 1,0,0,0,1656,1657,1,0,0,0,1657,1658,3,2,1,0,1658,211,1,0,0,0,1659,1660, - 3,210,105,0,1660,1661,5,28,0,0,1661,1663,1,0,0,0,1662,1659,1,0,0,0,1663, - 1666,1,0,0,0,1664,1662,1,0,0,0,1664,1665,1,0,0,0,1665,1667,1,0,0,0,1666, - 1664,1,0,0,0,1667,1668,3,210,105,0,1668,213,1,0,0,0,1669,1670,5,30,0,0, - 1670,1671,3,202,101,0,1671,1672,5,31,0,0,1672,215,1,0,0,0,1673,1676,1, - 0,0,0,1674,1676,3,218,109,0,1675,1673,1,0,0,0,1675,1674,1,0,0,0,1676,217, - 1,0,0,0,1677,1678,5,86,0,0,1678,1679,5,42,0,0,1679,1680,3,32,16,0,1680, - 1681,5,43,0,0,1681,1682,5,87,0,0,1682,219,1,0,0,0,1683,1684,3,256,128, - 0,1684,1685,5,17,0,0,1685,1686,3,268,134,0,1686,1687,5,18,0,0,1687,1800, - 1,0,0,0,1688,1689,3,74,37,0,1689,1690,5,17,0,0,1690,1691,3,82,41,0,1691, - 1692,5,18,0,0,1692,1800,1,0,0,0,1693,1694,3,232,116,0,1694,1695,5,17,0, - 0,1695,1696,3,236,118,0,1696,1697,5,18,0,0,1697,1800,1,0,0,0,1698,1699, - 3,240,120,0,1699,1700,5,17,0,0,1700,1701,3,244,122,0,1701,1702,5,18,0, - 0,1702,1800,1,0,0,0,1703,1800,3,222,111,0,1704,1800,3,296,148,0,1705,1800, - 3,174,87,0,1706,1800,3,88,44,0,1707,1800,3,342,171,0,1708,1709,5,117,0, - 0,1709,1800,3,32,16,0,1710,1711,5,118,0,0,1711,1800,3,32,16,0,1712,1713, - 3,354,177,0,1713,1714,5,17,0,0,1714,1715,3,358,179,0,1715,1716,5,18,0, - 0,1716,1800,1,0,0,0,1717,1718,5,301,0,0,1718,1719,3,146,73,0,1719,1720, - 5,175,0,0,1720,1721,3,264,132,0,1721,1722,5,119,0,0,1722,1723,3,192,96, - 0,1723,1724,3,160,80,0,1724,1725,3,146,73,0,1725,1726,5,175,0,0,1726,1727, - 3,264,132,0,1727,1728,3,134,67,0,1728,1800,1,0,0,0,1729,1730,5,301,0,0, - 1730,1731,5,225,0,0,1731,1732,3,192,96,0,1732,1733,3,160,80,0,1733,1734, - 3,146,73,0,1734,1735,5,175,0,0,1735,1736,3,264,132,0,1736,1737,3,216,108, - 0,1737,1738,3,134,67,0,1738,1739,5,119,0,0,1739,1740,5,225,0,0,1740,1741, - 3,192,96,0,1741,1742,3,160,80,0,1742,1743,3,146,73,0,1743,1744,5,175,0, - 0,1744,1745,3,264,132,0,1745,1746,3,216,108,0,1746,1747,3,134,67,0,1747, - 1800,1,0,0,0,1748,1800,3,26,13,0,1749,1800,3,40,20,0,1750,1751,5,254,0, - 0,1751,1752,5,195,0,0,1752,1753,5,42,0,0,1753,1754,3,32,16,0,1754,1758, - 5,43,0,0,1755,1757,3,342,171,0,1756,1755,1,0,0,0,1757,1760,1,0,0,0,1758, - 1756,1,0,0,0,1758,1759,1,0,0,0,1759,1800,1,0,0,0,1760,1758,1,0,0,0,1761, - 1762,5,254,0,0,1762,1763,5,195,0,0,1763,1767,3,2,1,0,1764,1766,3,342,171, - 0,1765,1764,1,0,0,0,1766,1769,1,0,0,0,1767,1765,1,0,0,0,1767,1768,1,0, - 0,0,1768,1800,1,0,0,0,1769,1767,1,0,0,0,1770,1771,5,254,0,0,1771,1772, - 5,255,0,0,1772,1773,5,42,0,0,1773,1774,3,32,16,0,1774,1775,5,43,0,0,1775, - 1776,5,28,0,0,1776,1780,3,146,73,0,1777,1779,3,342,171,0,1778,1777,1,0, - 0,0,1779,1782,1,0,0,0,1780,1778,1,0,0,0,1780,1781,1,0,0,0,1781,1800,1, - 0,0,0,1782,1780,1,0,0,0,1783,1784,5,254,0,0,1784,1785,5,255,0,0,1785,1786, - 3,2,1,0,1786,1787,5,28,0,0,1787,1791,3,146,73,0,1788,1790,3,342,171,0, - 1789,1788,1,0,0,0,1790,1793,1,0,0,0,1791,1789,1,0,0,0,1791,1792,1,0,0, - 0,1792,1800,1,0,0,0,1793,1791,1,0,0,0,1794,1795,5,120,0,0,1795,1796,5, - 195,0,0,1796,1797,3,146,73,0,1797,1798,3,44,22,0,1798,1800,1,0,0,0,1799, - 1683,1,0,0,0,1799,1688,1,0,0,0,1799,1693,1,0,0,0,1799,1698,1,0,0,0,1799, - 1703,1,0,0,0,1799,1704,1,0,0,0,1799,1705,1,0,0,0,1799,1706,1,0,0,0,1799, - 1707,1,0,0,0,1799,1708,1,0,0,0,1799,1710,1,0,0,0,1799,1712,1,0,0,0,1799, - 1717,1,0,0,0,1799,1729,1,0,0,0,1799,1748,1,0,0,0,1799,1749,1,0,0,0,1799, - 1750,1,0,0,0,1799,1761,1,0,0,0,1799,1770,1,0,0,0,1799,1783,1,0,0,0,1799, - 1794,1,0,0,0,1800,221,1,0,0,0,1801,1802,5,121,0,0,1802,1811,3,230,115, - 0,1803,1810,3,224,112,0,1804,1805,5,122,0,0,1805,1806,5,30,0,0,1806,1807, - 3,250,125,0,1807,1808,5,31,0,0,1808,1810,1,0,0,0,1809,1803,1,0,0,0,1809, - 1804,1,0,0,0,1810,1813,1,0,0,0,1811,1809,1,0,0,0,1811,1812,1,0,0,0,1812, - 1814,1,0,0,0,1813,1811,1,0,0,0,1814,1815,3,160,80,0,1815,1816,3,2,1,0, - 1816,1817,3,226,113,0,1817,1818,3,228,114,0,1818,223,1,0,0,0,1819,1839, - 5,123,0,0,1820,1839,5,51,0,0,1821,1839,5,52,0,0,1822,1839,5,63,0,0,1823, - 1839,5,124,0,0,1824,1839,5,69,0,0,1825,1839,5,68,0,0,1826,1839,5,64,0, - 0,1827,1839,5,65,0,0,1828,1839,5,66,0,0,1829,1839,5,125,0,0,1830,1839, - 5,126,0,0,1831,1839,5,127,0,0,1832,1839,5,16,0,0,1833,1834,5,70,0,0,1834, - 1835,5,30,0,0,1835,1836,3,32,16,0,1836,1837,5,31,0,0,1837,1839,1,0,0,0, - 1838,1819,1,0,0,0,1838,1820,1,0,0,0,1838,1821,1,0,0,0,1838,1822,1,0,0, - 0,1838,1823,1,0,0,0,1838,1824,1,0,0,0,1838,1825,1,0,0,0,1838,1826,1,0, - 0,0,1838,1827,1,0,0,0,1838,1828,1,0,0,0,1838,1829,1,0,0,0,1838,1830,1, - 0,0,0,1838,1831,1,0,0,0,1838,1832,1,0,0,0,1838,1833,1,0,0,0,1839,225,1, - 0,0,0,1840,1846,1,0,0,0,1841,1842,5,44,0,0,1842,1846,3,0,0,0,1843,1844, - 5,44,0,0,1844,1846,3,32,16,0,1845,1840,1,0,0,0,1845,1841,1,0,0,0,1845, - 1843,1,0,0,0,1846,227,1,0,0,0,1847,1851,1,0,0,0,1848,1849,5,36,0,0,1849, - 1851,3,316,158,0,1850,1847,1,0,0,0,1850,1848,1,0,0,0,1851,229,1,0,0,0, - 1852,1858,1,0,0,0,1853,1854,5,42,0,0,1854,1855,3,32,16,0,1855,1856,5,43, - 0,0,1856,1858,1,0,0,0,1857,1852,1,0,0,0,1857,1853,1,0,0,0,1858,231,1,0, - 0,0,1859,1863,5,128,0,0,1860,1862,3,234,117,0,1861,1860,1,0,0,0,1862,1865, - 1,0,0,0,1863,1861,1,0,0,0,1863,1864,1,0,0,0,1864,1866,1,0,0,0,1865,1863, - 1,0,0,0,1866,1867,3,146,73,0,1867,1868,3,2,1,0,1868,1878,1,0,0,0,1869, - 1873,5,128,0,0,1870,1872,3,234,117,0,1871,1870,1,0,0,0,1872,1875,1,0,0, - 0,1873,1871,1,0,0,0,1873,1874,1,0,0,0,1874,1876,1,0,0,0,1875,1873,1,0, - 0,0,1876,1878,3,2,1,0,1877,1859,1,0,0,0,1877,1869,1,0,0,0,1878,233,1,0, - 0,0,1879,1880,7,10,0,0,1880,235,1,0,0,0,1881,1883,3,238,119,0,1882,1881, - 1,0,0,0,1883,1886,1,0,0,0,1884,1882,1,0,0,0,1884,1885,1,0,0,0,1885,237, - 1,0,0,0,1886,1884,1,0,0,0,1887,1888,5,129,0,0,1888,1900,3,190,95,0,1889, - 1890,5,130,0,0,1890,1900,3,190,95,0,1891,1892,5,131,0,0,1892,1900,3,190, - 95,0,1893,1894,5,132,0,0,1894,1900,3,190,95,0,1895,1900,3,88,44,0,1896, - 1900,3,342,171,0,1897,1900,3,26,13,0,1898,1900,3,40,20,0,1899,1887,1,0, - 0,0,1899,1889,1,0,0,0,1899,1891,1,0,0,0,1899,1893,1,0,0,0,1899,1895,1, - 0,0,0,1899,1896,1,0,0,0,1899,1897,1,0,0,0,1899,1898,1,0,0,0,1900,239,1, - 0,0,0,1901,1905,5,133,0,0,1902,1904,3,242,121,0,1903,1902,1,0,0,0,1904, - 1907,1,0,0,0,1905,1903,1,0,0,0,1905,1906,1,0,0,0,1906,1908,1,0,0,0,1907, - 1905,1,0,0,0,1908,1909,3,192,96,0,1909,1910,3,160,80,0,1910,1911,3,2,1, - 0,1911,1912,3,134,67,0,1912,1913,3,228,114,0,1913,241,1,0,0,0,1914,1915, - 7,10,0,0,1915,243,1,0,0,0,1916,1918,3,246,123,0,1917,1916,1,0,0,0,1918, - 1921,1,0,0,0,1919,1917,1,0,0,0,1919,1920,1,0,0,0,1920,245,1,0,0,0,1921, - 1919,1,0,0,0,1922,1923,5,134,0,0,1923,1933,3,190,95,0,1924,1925,5,135, - 0,0,1925,1933,3,190,95,0,1926,1927,5,132,0,0,1927,1933,3,190,95,0,1928, - 1933,3,342,171,0,1929,1933,3,88,44,0,1930,1933,3,26,13,0,1931,1933,3,40, - 20,0,1932,1922,1,0,0,0,1932,1924,1,0,0,0,1932,1926,1,0,0,0,1932,1928,1, - 0,0,0,1932,1929,1,0,0,0,1932,1930,1,0,0,0,1932,1931,1,0,0,0,1933,247,1, - 0,0,0,1934,1941,1,0,0,0,1935,1936,5,122,0,0,1936,1937,5,30,0,0,1937,1938, - 3,250,125,0,1938,1939,5,31,0,0,1939,1941,1,0,0,0,1940,1934,1,0,0,0,1940, - 1935,1,0,0,0,1941,249,1,0,0,0,1942,1952,3,148,74,0,1943,1945,5,17,0,0, - 1944,1946,3,314,157,0,1945,1944,1,0,0,0,1946,1947,1,0,0,0,1947,1945,1, - 0,0,0,1947,1948,1,0,0,0,1948,1949,1,0,0,0,1949,1950,5,18,0,0,1950,1952, - 1,0,0,0,1951,1942,1,0,0,0,1951,1943,1,0,0,0,1952,251,1,0,0,0,1953,1955, - 3,254,127,0,1954,1953,1,0,0,0,1955,1958,1,0,0,0,1956,1954,1,0,0,0,1956, - 1957,1,0,0,0,1957,253,1,0,0,0,1958,1956,1,0,0,0,1959,1960,5,42,0,0,1960, - 1961,5,136,0,0,1961,1973,5,43,0,0,1962,1963,5,42,0,0,1963,1964,5,137,0, - 0,1964,1973,5,43,0,0,1965,1966,5,42,0,0,1966,1967,5,138,0,0,1967,1973, - 5,43,0,0,1968,1969,5,42,0,0,1969,1970,3,32,16,0,1970,1971,5,43,0,0,1971, - 1973,1,0,0,0,1972,1959,1,0,0,0,1972,1962,1,0,0,0,1972,1965,1,0,0,0,1972, - 1968,1,0,0,0,1973,255,1,0,0,0,1974,1979,5,139,0,0,1975,1978,3,258,129, - 0,1976,1978,3,260,130,0,1977,1975,1,0,0,0,1977,1976,1,0,0,0,1978,1981, - 1,0,0,0,1979,1977,1,0,0,0,1979,1980,1,0,0,0,1980,1982,1,0,0,0,1981,1979, - 1,0,0,0,1982,1983,3,192,96,0,1983,1984,3,252,126,0,1984,1985,3,160,80, - 0,1985,1986,3,248,124,0,1986,1987,3,264,132,0,1987,1988,3,204,102,0,1988, - 1992,3,134,67,0,1989,1991,3,266,133,0,1990,1989,1,0,0,0,1991,1994,1,0, - 0,0,1992,1990,1,0,0,0,1992,1993,1,0,0,0,1993,257,1,0,0,0,1994,1992,1,0, - 0,0,1995,2019,5,123,0,0,1996,2019,5,51,0,0,1997,2019,5,52,0,0,1998,2019, - 5,63,0,0,1999,2019,5,140,0,0,2000,2019,5,68,0,0,2001,2019,5,141,0,0,2002, - 2019,5,142,0,0,2003,2019,5,54,0,0,2004,2019,5,64,0,0,2005,2019,5,65,0, - 0,2006,2019,5,66,0,0,2007,2019,5,125,0,0,2008,2019,5,143,0,0,2009,2019, - 5,144,0,0,2010,2019,5,69,0,0,2011,2019,5,145,0,0,2012,2019,5,146,0,0,2013, - 2014,5,70,0,0,2014,2015,5,30,0,0,2015,2016,3,32,16,0,2016,2017,5,31,0, - 0,2017,2019,1,0,0,0,2018,1995,1,0,0,0,2018,1996,1,0,0,0,2018,1997,1,0, - 0,0,2018,1998,1,0,0,0,2018,1999,1,0,0,0,2018,2000,1,0,0,0,2018,2001,1, - 0,0,0,2018,2002,1,0,0,0,2018,2003,1,0,0,0,2018,2004,1,0,0,0,2018,2005, - 1,0,0,0,2018,2006,1,0,0,0,2018,2007,1,0,0,0,2018,2008,1,0,0,0,2018,2009, - 1,0,0,0,2018,2010,1,0,0,0,2018,2011,1,0,0,0,2018,2012,1,0,0,0,2018,2013, - 1,0,0,0,2019,259,1,0,0,0,2020,2021,5,147,0,0,2021,2027,5,30,0,0,2022,2025, - 3,6,3,0,2023,2024,5,34,0,0,2024,2026,3,6,3,0,2025,2023,1,0,0,0,2025,2026, - 1,0,0,0,2026,2028,1,0,0,0,2027,2022,1,0,0,0,2027,2028,1,0,0,0,2028,2032, - 1,0,0,0,2029,2031,3,262,131,0,2030,2029,1,0,0,0,2031,2034,1,0,0,0,2032, - 2030,1,0,0,0,2032,2033,1,0,0,0,2033,2035,1,0,0,0,2034,2032,1,0,0,0,2035, - 2039,5,31,0,0,2036,2037,5,147,0,0,2037,2039,5,85,0,0,2038,2020,1,0,0,0, - 2038,2036,1,0,0,0,2039,261,1,0,0,0,2040,2068,5,148,0,0,2041,2068,5,223, - 0,0,2042,2068,5,57,0,0,2043,2068,5,58,0,0,2044,2068,5,149,0,0,2045,2068, - 5,150,0,0,2046,2068,5,247,0,0,2047,2068,5,248,0,0,2048,2068,5,249,0,0, - 2049,2068,5,250,0,0,2050,2051,5,151,0,0,2051,2052,5,75,0,0,2052,2068,5, - 152,0,0,2053,2054,5,151,0,0,2054,2055,5,75,0,0,2055,2068,5,153,0,0,2056, - 2057,5,154,0,0,2057,2058,5,75,0,0,2058,2068,5,152,0,0,2059,2060,5,154, - 0,0,2060,2061,5,75,0,0,2061,2068,5,153,0,0,2062,2063,5,70,0,0,2063,2064, - 5,30,0,0,2064,2065,3,32,16,0,2065,2066,5,31,0,0,2066,2068,1,0,0,0,2067, - 2040,1,0,0,0,2067,2041,1,0,0,0,2067,2042,1,0,0,0,2067,2043,1,0,0,0,2067, - 2044,1,0,0,0,2067,2045,1,0,0,0,2067,2046,1,0,0,0,2067,2047,1,0,0,0,2067, - 2048,1,0,0,0,2067,2049,1,0,0,0,2067,2050,1,0,0,0,2067,2053,1,0,0,0,2067, - 2056,1,0,0,0,2067,2059,1,0,0,0,2067,2062,1,0,0,0,2068,263,1,0,0,0,2069, - 2073,5,116,0,0,2070,2073,5,155,0,0,2071,2073,3,2,1,0,2072,2069,1,0,0,0, - 2072,2070,1,0,0,0,2072,2071,1,0,0,0,2073,265,1,0,0,0,2074,2096,5,1,0,0, - 2075,2096,5,2,0,0,2076,2096,5,156,0,0,2077,2096,5,3,0,0,2078,2096,5,4, - 0,0,2079,2096,5,246,0,0,2080,2096,5,5,0,0,2081,2096,5,6,0,0,2082,2096, - 5,7,0,0,2083,2096,5,8,0,0,2084,2096,5,9,0,0,2085,2096,5,10,0,0,2086,2096, - 5,11,0,0,2087,2096,5,12,0,0,2088,2096,5,13,0,0,2089,2096,5,14,0,0,2090, - 2091,5,70,0,0,2091,2092,5,30,0,0,2092,2093,3,32,16,0,2093,2094,5,31,0, - 0,2094,2096,1,0,0,0,2095,2074,1,0,0,0,2095,2075,1,0,0,0,2095,2076,1,0, - 0,0,2095,2077,1,0,0,0,2095,2078,1,0,0,0,2095,2079,1,0,0,0,2095,2080,1, - 0,0,0,2095,2081,1,0,0,0,2095,2082,1,0,0,0,2095,2083,1,0,0,0,2095,2084, - 1,0,0,0,2095,2085,1,0,0,0,2095,2086,1,0,0,0,2095,2087,1,0,0,0,2095,2088, - 1,0,0,0,2095,2089,1,0,0,0,2095,2090,1,0,0,0,2096,267,1,0,0,0,2097,2099, - 3,270,135,0,2098,2097,1,0,0,0,2099,2102,1,0,0,0,2100,2098,1,0,0,0,2100, - 2101,1,0,0,0,2101,269,1,0,0,0,2102,2100,1,0,0,0,2103,2212,3,126,63,0,2104, - 2105,5,295,0,0,2105,2212,3,32,16,0,2106,2212,3,278,139,0,2107,2108,5,296, - 0,0,2108,2212,3,32,16,0,2109,2110,5,299,0,0,2110,2212,3,134,67,0,2111, - 2112,5,299,0,0,2112,2113,5,157,0,0,2113,2212,3,134,67,0,2114,2212,5,297, - 0,0,2115,2212,5,298,0,0,2116,2212,3,296,148,0,2117,2212,3,272,136,0,2118, - 2212,3,174,87,0,2119,2212,3,88,44,0,2120,2212,3,26,13,0,2121,2212,3,274, - 137,0,2122,2212,3,40,20,0,2123,2124,5,300,0,0,2124,2125,5,42,0,0,2125, - 2126,3,32,16,0,2126,2127,5,43,0,0,2127,2212,1,0,0,0,2128,2129,5,300,0, - 0,2129,2130,5,42,0,0,2130,2131,3,32,16,0,2131,2132,5,43,0,0,2132,2133, - 5,34,0,0,2133,2134,3,0,0,0,2134,2212,1,0,0,0,2135,2136,5,302,0,0,2136, - 2137,3,32,16,0,2137,2138,5,75,0,0,2138,2139,3,32,16,0,2139,2212,1,0,0, - 0,2140,2141,5,301,0,0,2141,2142,3,146,73,0,2142,2143,5,175,0,0,2143,2144, - 3,264,132,0,2144,2212,1,0,0,0,2145,2146,5,301,0,0,2146,2147,5,225,0,0, - 2147,2148,3,192,96,0,2148,2149,3,160,80,0,2149,2150,3,146,73,0,2150,2151, - 5,175,0,0,2151,2152,3,264,132,0,2152,2153,3,216,108,0,2153,2154,3,134, - 67,0,2154,2212,1,0,0,0,2155,2212,3,276,138,0,2156,2157,5,254,0,0,2157, - 2158,5,195,0,0,2158,2159,5,42,0,0,2159,2160,3,32,16,0,2160,2164,5,43,0, - 0,2161,2163,3,342,171,0,2162,2161,1,0,0,0,2163,2166,1,0,0,0,2164,2162, - 1,0,0,0,2164,2165,1,0,0,0,2165,2212,1,0,0,0,2166,2164,1,0,0,0,2167,2168, - 5,254,0,0,2168,2169,5,195,0,0,2169,2173,3,2,1,0,2170,2172,3,342,171,0, - 2171,2170,1,0,0,0,2172,2175,1,0,0,0,2173,2171,1,0,0,0,2173,2174,1,0,0, - 0,2174,2212,1,0,0,0,2175,2173,1,0,0,0,2176,2177,5,254,0,0,2177,2178,5, - 255,0,0,2178,2179,5,42,0,0,2179,2180,3,32,16,0,2180,2181,5,43,0,0,2181, - 2182,5,28,0,0,2182,2186,3,146,73,0,2183,2185,3,342,171,0,2184,2183,1,0, - 0,0,2185,2188,1,0,0,0,2186,2184,1,0,0,0,2186,2187,1,0,0,0,2187,2212,1, - 0,0,0,2188,2186,1,0,0,0,2189,2190,5,254,0,0,2190,2191,5,255,0,0,2191,2192, - 3,2,1,0,2192,2193,5,28,0,0,2193,2197,3,146,73,0,2194,2196,3,342,171,0, - 2195,2194,1,0,0,0,2196,2199,1,0,0,0,2197,2195,1,0,0,0,2197,2198,1,0,0, - 0,2198,2212,1,0,0,0,2199,2197,1,0,0,0,2200,2201,5,254,0,0,2201,2202,5, - 42,0,0,2202,2203,3,32,16,0,2203,2204,5,43,0,0,2204,2208,3,228,114,0,2205, - 2207,3,342,171,0,2206,2205,1,0,0,0,2207,2210,1,0,0,0,2208,2206,1,0,0,0, - 2208,2209,1,0,0,0,2209,2212,1,0,0,0,2210,2208,1,0,0,0,2211,2103,1,0,0, - 0,2211,2104,1,0,0,0,2211,2106,1,0,0,0,2211,2107,1,0,0,0,2211,2109,1,0, - 0,0,2211,2111,1,0,0,0,2211,2114,1,0,0,0,2211,2115,1,0,0,0,2211,2116,1, - 0,0,0,2211,2117,1,0,0,0,2211,2118,1,0,0,0,2211,2119,1,0,0,0,2211,2120, - 1,0,0,0,2211,2121,1,0,0,0,2211,2122,1,0,0,0,2211,2123,1,0,0,0,2211,2128, - 1,0,0,0,2211,2135,1,0,0,0,2211,2140,1,0,0,0,2211,2145,1,0,0,0,2211,2155, - 1,0,0,0,2211,2156,1,0,0,0,2211,2167,1,0,0,0,2211,2176,1,0,0,0,2211,2189, - 1,0,0,0,2211,2200,1,0,0,0,2212,271,1,0,0,0,2213,2214,3,0,0,0,2214,2215, - 5,75,0,0,2215,273,1,0,0,0,2216,2219,3,44,22,0,2217,2219,3,46,23,0,2218, - 2216,1,0,0,0,2218,2217,1,0,0,0,2219,275,1,0,0,0,2220,2221,5,17,0,0,2221, - 2222,3,268,134,0,2222,2223,5,18,0,0,2223,277,1,0,0,0,2224,2225,3,282,141, - 0,2225,2226,3,280,140,0,2226,279,1,0,0,0,2227,2229,3,284,142,0,2228,2227, - 1,0,0,0,2229,2230,1,0,0,0,2230,2228,1,0,0,0,2230,2231,1,0,0,0,2231,281, - 1,0,0,0,2232,2233,5,158,0,0,2233,2245,3,276,138,0,2234,2235,5,158,0,0, - 2235,2236,3,0,0,0,2236,2237,5,159,0,0,2237,2238,3,0,0,0,2238,2245,1,0, - 0,0,2239,2240,5,158,0,0,2240,2241,3,32,16,0,2241,2242,5,159,0,0,2242,2243, - 3,32,16,0,2243,2245,1,0,0,0,2244,2232,1,0,0,0,2244,2234,1,0,0,0,2244,2239, - 1,0,0,0,2245,283,1,0,0,0,2246,2247,3,288,144,0,2247,2248,3,294,147,0,2248, - 2259,1,0,0,0,2249,2250,3,286,143,0,2250,2251,3,294,147,0,2251,2259,1,0, - 0,0,2252,2253,3,290,145,0,2253,2254,3,294,147,0,2254,2259,1,0,0,0,2255, - 2256,3,292,146,0,2256,2257,3,294,147,0,2257,2259,1,0,0,0,2258,2246,1,0, - 0,0,2258,2249,1,0,0,0,2258,2252,1,0,0,0,2258,2255,1,0,0,0,2259,285,1,0, - 0,0,2260,2261,5,160,0,0,2261,2267,3,276,138,0,2262,2263,5,160,0,0,2263, - 2267,3,0,0,0,2264,2265,5,160,0,0,2265,2267,3,32,16,0,2266,2260,1,0,0,0, - 2266,2262,1,0,0,0,2266,2264,1,0,0,0,2267,287,1,0,0,0,2268,2269,5,161,0, - 0,2269,2270,3,146,73,0,2270,289,1,0,0,0,2271,2272,5,162,0,0,2272,291,1, - 0,0,0,2273,2274,5,163,0,0,2274,293,1,0,0,0,2275,2287,3,276,138,0,2276, - 2277,5,164,0,0,2277,2278,3,0,0,0,2278,2279,5,159,0,0,2279,2280,3,0,0,0, - 2280,2287,1,0,0,0,2281,2282,5,164,0,0,2282,2283,3,32,16,0,2283,2284,5, - 159,0,0,2284,2285,3,32,16,0,2285,2287,1,0,0,0,2286,2275,1,0,0,0,2286,2276, - 1,0,0,0,2286,2281,1,0,0,0,2287,295,1,0,0,0,2288,2289,3,298,149,0,2289, - 2290,3,302,151,0,2290,297,1,0,0,0,2291,2292,5,165,0,0,2292,2293,3,300, - 150,0,2293,2294,3,0,0,0,2294,2295,5,36,0,0,2295,2299,1,0,0,0,2296,2297, - 5,165,0,0,2297,2299,3,300,150,0,2298,2291,1,0,0,0,2298,2296,1,0,0,0,2299, - 299,1,0,0,0,2300,2304,1,0,0,0,2301,2304,5,166,0,0,2302,2304,5,2,0,0,2303, - 2300,1,0,0,0,2303,2301,1,0,0,0,2303,2302,1,0,0,0,2304,301,1,0,0,0,2305, - 2306,5,17,0,0,2306,2307,3,304,152,0,2307,2308,5,18,0,0,2308,2315,1,0,0, - 0,2309,2311,3,308,154,0,2310,2309,1,0,0,0,2311,2312,1,0,0,0,2312,2310, - 1,0,0,0,2312,2313,1,0,0,0,2313,2315,1,0,0,0,2314,2305,1,0,0,0,2314,2310, - 1,0,0,0,2315,303,1,0,0,0,2316,2317,3,308,154,0,2317,2318,5,28,0,0,2318, - 2320,1,0,0,0,2319,2316,1,0,0,0,2320,2323,1,0,0,0,2321,2319,1,0,0,0,2321, - 2322,1,0,0,0,2322,2324,1,0,0,0,2323,2321,1,0,0,0,2324,2325,3,308,154,0, - 2325,305,1,0,0,0,2326,2332,1,0,0,0,2327,2328,5,42,0,0,2328,2329,3,32,16, - 0,2329,2330,5,43,0,0,2330,2332,1,0,0,0,2331,2326,1,0,0,0,2331,2327,1,0, - 0,0,2332,307,1,0,0,0,2333,2334,5,180,0,0,2334,2335,5,261,0,0,2335,2336, - 5,30,0,0,2336,2337,3,6,3,0,2337,2338,5,31,0,0,2338,2400,1,0,0,0,2339,2340, - 5,259,0,0,2340,2341,5,30,0,0,2341,2342,3,0,0,0,2342,2343,5,31,0,0,2343, - 2400,1,0,0,0,2344,2345,5,259,0,0,2345,2400,3,0,0,0,2346,2347,5,84,0,0, - 2347,2348,5,30,0,0,2348,2349,3,312,156,0,2349,2350,5,31,0,0,2350,2400, - 1,0,0,0,2351,2352,5,187,0,0,2352,2353,5,30,0,0,2353,2354,3,36,18,0,2354, - 2355,5,31,0,0,2355,2356,3,306,153,0,2356,2400,1,0,0,0,2357,2358,5,188, - 0,0,2358,2359,5,30,0,0,2359,2360,3,36,18,0,2360,2361,5,31,0,0,2361,2362, - 3,306,153,0,2362,2400,1,0,0,0,2363,2364,5,186,0,0,2364,2365,5,30,0,0,2365, - 2366,3,34,17,0,2366,2367,5,31,0,0,2367,2368,3,306,153,0,2368,2400,1,0, - 0,0,2369,2370,5,185,0,0,2370,2371,5,30,0,0,2371,2372,3,32,16,0,2372,2373, - 5,31,0,0,2373,2374,3,306,153,0,2374,2400,1,0,0,0,2375,2376,5,184,0,0,2376, - 2377,5,30,0,0,2377,2378,3,32,16,0,2378,2379,5,31,0,0,2379,2380,3,306,153, - 0,2380,2400,1,0,0,0,2381,2382,5,183,0,0,2382,2383,5,30,0,0,2383,2384,3, - 32,16,0,2384,2385,5,31,0,0,2385,2386,3,306,153,0,2386,2400,1,0,0,0,2387, - 2388,5,187,0,0,2388,2400,3,306,153,0,2389,2390,5,188,0,0,2390,2400,3,306, - 153,0,2391,2392,5,186,0,0,2392,2400,3,306,153,0,2393,2394,5,185,0,0,2394, - 2400,3,306,153,0,2395,2396,5,184,0,0,2396,2400,3,306,153,0,2397,2398,5, - 183,0,0,2398,2400,3,306,153,0,2399,2333,1,0,0,0,2399,2339,1,0,0,0,2399, - 2344,1,0,0,0,2399,2346,1,0,0,0,2399,2351,1,0,0,0,2399,2357,1,0,0,0,2399, - 2363,1,0,0,0,2399,2369,1,0,0,0,2399,2375,1,0,0,0,2399,2381,1,0,0,0,2399, - 2387,1,0,0,0,2399,2389,1,0,0,0,2399,2391,1,0,0,0,2399,2393,1,0,0,0,2399, - 2395,1,0,0,0,2399,2397,1,0,0,0,2400,309,1,0,0,0,2401,2402,5,187,0,0,2402, - 2403,5,30,0,0,2403,2404,3,36,18,0,2404,2405,5,31,0,0,2405,2477,1,0,0,0, - 2406,2407,5,188,0,0,2407,2408,5,30,0,0,2408,2409,3,36,18,0,2409,2410,5, - 31,0,0,2410,2477,1,0,0,0,2411,2412,5,187,0,0,2412,2413,5,30,0,0,2413,2414, - 3,32,16,0,2414,2415,5,31,0,0,2415,2477,1,0,0,0,2416,2417,5,188,0,0,2417, - 2418,5,30,0,0,2418,2419,3,34,17,0,2419,2420,5,31,0,0,2420,2477,1,0,0,0, - 2421,2422,5,186,0,0,2422,2423,5,30,0,0,2423,2424,3,34,17,0,2424,2425,5, - 31,0,0,2425,2477,1,0,0,0,2426,2427,5,185,0,0,2427,2428,5,30,0,0,2428,2429, - 3,32,16,0,2429,2430,5,31,0,0,2430,2477,1,0,0,0,2431,2432,5,184,0,0,2432, - 2433,5,30,0,0,2433,2434,3,32,16,0,2434,2435,5,31,0,0,2435,2477,1,0,0,0, - 2436,2437,5,183,0,0,2437,2438,5,30,0,0,2438,2439,3,32,16,0,2439,2440,5, - 31,0,0,2440,2477,1,0,0,0,2441,2442,5,192,0,0,2442,2443,5,30,0,0,2443,2444, - 3,34,17,0,2444,2445,5,31,0,0,2445,2477,1,0,0,0,2446,2447,5,191,0,0,2447, - 2448,5,30,0,0,2448,2449,3,32,16,0,2449,2450,5,31,0,0,2450,2477,1,0,0,0, - 2451,2452,5,190,0,0,2452,2453,5,30,0,0,2453,2454,3,32,16,0,2454,2455,5, - 31,0,0,2455,2477,1,0,0,0,2456,2457,5,189,0,0,2457,2458,5,30,0,0,2458,2459, - 3,32,16,0,2459,2460,5,31,0,0,2460,2477,1,0,0,0,2461,2462,5,180,0,0,2462, - 2463,5,30,0,0,2463,2464,3,32,16,0,2464,2465,5,31,0,0,2465,2477,1,0,0,0, - 2466,2467,5,182,0,0,2467,2468,5,30,0,0,2468,2469,3,184,92,0,2469,2470, - 5,31,0,0,2470,2477,1,0,0,0,2471,2472,5,84,0,0,2472,2473,5,30,0,0,2473, - 2474,3,312,156,0,2474,2475,5,31,0,0,2475,2477,1,0,0,0,2476,2401,1,0,0, - 0,2476,2406,1,0,0,0,2476,2411,1,0,0,0,2476,2416,1,0,0,0,2476,2421,1,0, - 0,0,2476,2426,1,0,0,0,2476,2431,1,0,0,0,2476,2436,1,0,0,0,2476,2441,1, - 0,0,0,2476,2446,1,0,0,0,2476,2451,1,0,0,0,2476,2456,1,0,0,0,2476,2461, - 1,0,0,0,2476,2466,1,0,0,0,2476,2471,1,0,0,0,2477,311,1,0,0,0,2478,2480, - 3,314,157,0,2479,2478,1,0,0,0,2480,2483,1,0,0,0,2481,2479,1,0,0,0,2481, - 2482,1,0,0,0,2482,313,1,0,0,0,2483,2481,1,0,0,0,2484,2485,7,11,0,0,2485, - 315,1,0,0,0,2486,2490,3,310,155,0,2487,2490,3,6,3,0,2488,2490,5,178,0, - 0,2489,2486,1,0,0,0,2489,2487,1,0,0,0,2489,2488,1,0,0,0,2490,317,1,0,0, - 0,2491,2640,3,310,155,0,2492,2493,5,181,0,0,2493,2494,5,30,0,0,2494,2495, - 5,178,0,0,2495,2640,5,31,0,0,2496,2497,5,181,0,0,2497,2498,5,30,0,0,2498, - 2499,5,263,0,0,2499,2640,5,31,0,0,2500,2501,5,195,0,0,2501,2502,5,30,0, - 0,2502,2503,5,39,0,0,2503,2504,5,263,0,0,2504,2640,5,31,0,0,2505,2506, - 5,195,0,0,2506,2507,5,30,0,0,2507,2508,3,138,69,0,2508,2509,5,31,0,0,2509, - 2640,1,0,0,0,2510,2511,5,195,0,0,2511,2512,5,30,0,0,2512,2513,5,178,0, - 0,2513,2640,5,31,0,0,2514,2515,5,196,0,0,2515,2516,5,30,0,0,2516,2517, - 3,318,159,0,2517,2518,5,31,0,0,2518,2640,1,0,0,0,2519,2520,5,187,0,0,2520, - 2521,5,42,0,0,2521,2522,3,32,16,0,2522,2523,5,43,0,0,2523,2524,5,30,0, - 0,2524,2525,3,320,160,0,2525,2526,5,31,0,0,2526,2640,1,0,0,0,2527,2528, - 5,188,0,0,2528,2529,5,42,0,0,2529,2530,3,32,16,0,2530,2531,5,43,0,0,2531, - 2532,5,30,0,0,2532,2533,3,322,161,0,2533,2534,5,31,0,0,2534,2640,1,0,0, - 0,2535,2536,5,186,0,0,2536,2537,5,42,0,0,2537,2538,3,32,16,0,2538,2539, - 5,43,0,0,2539,2540,5,30,0,0,2540,2541,3,324,162,0,2541,2542,5,31,0,0,2542, - 2640,1,0,0,0,2543,2544,5,185,0,0,2544,2545,5,42,0,0,2545,2546,3,32,16, - 0,2546,2547,5,43,0,0,2547,2548,5,30,0,0,2548,2549,3,326,163,0,2549,2550, - 5,31,0,0,2550,2640,1,0,0,0,2551,2552,5,184,0,0,2552,2553,5,42,0,0,2553, - 2554,3,32,16,0,2554,2555,5,43,0,0,2555,2556,5,30,0,0,2556,2557,3,328,164, - 0,2557,2558,5,31,0,0,2558,2640,1,0,0,0,2559,2560,5,183,0,0,2560,2561,5, - 42,0,0,2561,2562,3,32,16,0,2562,2563,5,43,0,0,2563,2564,5,30,0,0,2564, - 2565,3,330,165,0,2565,2566,5,31,0,0,2566,2640,1,0,0,0,2567,2568,5,192, - 0,0,2568,2569,5,42,0,0,2569,2570,3,32,16,0,2570,2571,5,43,0,0,2571,2572, - 5,30,0,0,2572,2573,3,324,162,0,2573,2574,5,31,0,0,2574,2640,1,0,0,0,2575, - 2576,5,191,0,0,2576,2577,5,42,0,0,2577,2578,3,32,16,0,2578,2579,5,43,0, - 0,2579,2580,5,30,0,0,2580,2581,3,326,163,0,2581,2582,5,31,0,0,2582,2640, - 1,0,0,0,2583,2584,5,190,0,0,2584,2585,5,42,0,0,2585,2586,3,32,16,0,2586, - 2587,5,43,0,0,2587,2588,5,30,0,0,2588,2589,3,328,164,0,2589,2590,5,31, - 0,0,2590,2640,1,0,0,0,2591,2592,5,189,0,0,2592,2593,5,42,0,0,2593,2594, - 3,32,16,0,2594,2595,5,43,0,0,2595,2596,5,30,0,0,2596,2597,3,330,165,0, - 2597,2598,5,31,0,0,2598,2640,1,0,0,0,2599,2600,5,180,0,0,2600,2601,5,42, - 0,0,2601,2602,3,32,16,0,2602,2603,5,43,0,0,2603,2604,5,30,0,0,2604,2605, - 3,328,164,0,2605,2606,5,31,0,0,2606,2640,1,0,0,0,2607,2608,5,182,0,0,2608, - 2609,5,42,0,0,2609,2610,3,32,16,0,2610,2611,5,43,0,0,2611,2612,5,30,0, - 0,2612,2613,3,332,166,0,2613,2614,5,31,0,0,2614,2640,1,0,0,0,2615,2616, - 5,181,0,0,2616,2617,5,42,0,0,2617,2618,3,32,16,0,2618,2619,5,43,0,0,2619, - 2620,5,30,0,0,2620,2621,3,334,167,0,2621,2622,5,31,0,0,2622,2640,1,0,0, - 0,2623,2624,5,195,0,0,2624,2625,5,42,0,0,2625,2626,3,32,16,0,2626,2627, - 5,43,0,0,2627,2628,5,30,0,0,2628,2629,3,336,168,0,2629,2630,5,31,0,0,2630, - 2640,1,0,0,0,2631,2632,5,196,0,0,2632,2633,5,42,0,0,2633,2634,3,32,16, - 0,2634,2635,5,43,0,0,2635,2636,5,30,0,0,2636,2637,3,340,170,0,2637,2638, - 5,31,0,0,2638,2640,1,0,0,0,2639,2491,1,0,0,0,2639,2492,1,0,0,0,2639,2496, - 1,0,0,0,2639,2500,1,0,0,0,2639,2505,1,0,0,0,2639,2510,1,0,0,0,2639,2514, - 1,0,0,0,2639,2519,1,0,0,0,2639,2527,1,0,0,0,2639,2535,1,0,0,0,2639,2543, - 1,0,0,0,2639,2551,1,0,0,0,2639,2559,1,0,0,0,2639,2567,1,0,0,0,2639,2575, - 1,0,0,0,2639,2583,1,0,0,0,2639,2591,1,0,0,0,2639,2599,1,0,0,0,2639,2607, - 1,0,0,0,2639,2615,1,0,0,0,2639,2623,1,0,0,0,2639,2631,1,0,0,0,2640,319, - 1,0,0,0,2641,2644,3,36,18,0,2642,2644,3,32,16,0,2643,2641,1,0,0,0,2643, - 2642,1,0,0,0,2644,2647,1,0,0,0,2645,2643,1,0,0,0,2645,2646,1,0,0,0,2646, - 321,1,0,0,0,2647,2645,1,0,0,0,2648,2651,3,36,18,0,2649,2651,3,34,17,0, - 2650,2648,1,0,0,0,2650,2649,1,0,0,0,2651,2654,1,0,0,0,2652,2650,1,0,0, - 0,2652,2653,1,0,0,0,2653,323,1,0,0,0,2654,2652,1,0,0,0,2655,2657,3,34, - 17,0,2656,2655,1,0,0,0,2657,2660,1,0,0,0,2658,2656,1,0,0,0,2658,2659,1, - 0,0,0,2659,325,1,0,0,0,2660,2658,1,0,0,0,2661,2663,3,32,16,0,2662,2661, - 1,0,0,0,2663,2666,1,0,0,0,2664,2662,1,0,0,0,2664,2665,1,0,0,0,2665,327, - 1,0,0,0,2666,2664,1,0,0,0,2667,2669,3,32,16,0,2668,2667,1,0,0,0,2669,2672, - 1,0,0,0,2670,2668,1,0,0,0,2670,2671,1,0,0,0,2671,329,1,0,0,0,2672,2670, - 1,0,0,0,2673,2675,3,32,16,0,2674,2673,1,0,0,0,2675,2678,1,0,0,0,2676,2674, - 1,0,0,0,2676,2677,1,0,0,0,2677,331,1,0,0,0,2678,2676,1,0,0,0,2679,2681, - 3,184,92,0,2680,2679,1,0,0,0,2681,2684,1,0,0,0,2682,2680,1,0,0,0,2682, - 2683,1,0,0,0,2683,333,1,0,0,0,2684,2682,1,0,0,0,2685,2687,7,12,0,0,2686, - 2685,1,0,0,0,2687,2690,1,0,0,0,2688,2686,1,0,0,0,2688,2689,1,0,0,0,2689, - 335,1,0,0,0,2690,2688,1,0,0,0,2691,2693,3,338,169,0,2692,2691,1,0,0,0, - 2693,2696,1,0,0,0,2694,2692,1,0,0,0,2694,2695,1,0,0,0,2695,337,1,0,0,0, - 2696,2694,1,0,0,0,2697,2702,5,178,0,0,2698,2699,5,39,0,0,2699,2702,5,263, - 0,0,2700,2702,3,138,69,0,2701,2697,1,0,0,0,2701,2698,1,0,0,0,2701,2700, - 1,0,0,0,2702,339,1,0,0,0,2703,2705,3,318,159,0,2704,2703,1,0,0,0,2705, - 2708,1,0,0,0,2706,2704,1,0,0,0,2706,2707,1,0,0,0,2707,341,1,0,0,0,2708, - 2706,1,0,0,0,2709,2713,3,44,22,0,2710,2713,3,46,23,0,2711,2713,3,2,1,0, - 2712,2709,1,0,0,0,2712,2710,1,0,0,0,2712,2711,1,0,0,0,2713,343,1,0,0,0, - 2714,2715,5,167,0,0,2715,2716,5,36,0,0,2716,2717,5,30,0,0,2717,2718,3, - 312,156,0,2718,2719,5,31,0,0,2719,2740,1,0,0,0,2720,2721,5,168,0,0,2721, - 2722,3,38,19,0,2722,2723,5,75,0,0,2723,2724,3,38,19,0,2724,2725,5,75,0, - 0,2725,2726,3,38,19,0,2726,2727,5,75,0,0,2727,2728,3,38,19,0,2728,2740, - 1,0,0,0,2729,2730,5,169,0,0,2730,2740,3,6,3,0,2731,2732,5,169,0,0,2732, - 2733,5,36,0,0,2733,2734,5,30,0,0,2734,2735,3,312,156,0,2735,2736,5,31, - 0,0,2736,2740,1,0,0,0,2737,2740,3,342,171,0,2738,2740,3,40,20,0,2739,2714, - 1,0,0,0,2739,2720,1,0,0,0,2739,2729,1,0,0,0,2739,2731,1,0,0,0,2739,2737, - 1,0,0,0,2739,2738,1,0,0,0,2740,345,1,0,0,0,2741,2742,5,25,0,0,2742,2743, - 5,40,0,0,2743,2744,3,98,49,0,2744,2745,3,2,1,0,2745,2754,1,0,0,0,2746, - 2747,5,25,0,0,2747,2748,5,40,0,0,2748,2749,3,98,49,0,2749,2750,3,2,1,0, - 2750,2751,5,34,0,0,2751,2752,3,2,1,0,2752,2754,1,0,0,0,2753,2741,1,0,0, - 0,2753,2746,1,0,0,0,2754,347,1,0,0,0,2755,2757,3,350,175,0,2756,2755,1, - 0,0,0,2757,2760,1,0,0,0,2758,2756,1,0,0,0,2758,2759,1,0,0,0,2759,349,1, - 0,0,0,2760,2758,1,0,0,0,2761,2762,5,179,0,0,2762,2763,5,36,0,0,2763,2764, - 5,30,0,0,2764,2765,3,312,156,0,2765,2766,5,31,0,0,2766,2776,1,0,0,0,2767, - 2776,3,344,172,0,2768,2769,5,170,0,0,2769,2770,5,36,0,0,2770,2771,5,30, - 0,0,2771,2772,3,312,156,0,2772,2773,5,31,0,0,2773,2776,1,0,0,0,2774,2776, - 5,55,0,0,2775,2761,1,0,0,0,2775,2767,1,0,0,0,2775,2768,1,0,0,0,2775,2774, - 1,0,0,0,2776,351,1,0,0,0,2777,2778,5,50,0,0,2778,2782,5,40,0,0,2779,2781, - 3,356,178,0,2780,2779,1,0,0,0,2781,2784,1,0,0,0,2782,2780,1,0,0,0,2782, - 2783,1,0,0,0,2783,2785,1,0,0,0,2784,2782,1,0,0,0,2785,2786,3,2,1,0,2786, - 353,1,0,0,0,2787,2791,5,300,0,0,2788,2790,3,356,178,0,2789,2788,1,0,0, - 0,2790,2793,1,0,0,0,2791,2789,1,0,0,0,2791,2792,1,0,0,0,2792,2794,1,0, - 0,0,2793,2791,1,0,0,0,2794,2795,3,2,1,0,2795,355,1,0,0,0,2796,2812,5,52, - 0,0,2797,2812,5,51,0,0,2798,2812,5,171,0,0,2799,2800,5,62,0,0,2800,2812, - 5,51,0,0,2801,2802,5,62,0,0,2802,2812,5,52,0,0,2803,2804,5,62,0,0,2804, - 2812,5,63,0,0,2805,2806,5,62,0,0,2806,2812,5,64,0,0,2807,2808,5,62,0,0, - 2808,2812,5,65,0,0,2809,2810,5,62,0,0,2810,2812,5,66,0,0,2811,2796,1,0, - 0,0,2811,2797,1,0,0,0,2811,2798,1,0,0,0,2811,2799,1,0,0,0,2811,2801,1, - 0,0,0,2811,2803,1,0,0,0,2811,2805,1,0,0,0,2811,2807,1,0,0,0,2811,2809, - 1,0,0,0,2812,357,1,0,0,0,2813,2815,3,360,180,0,2814,2813,1,0,0,0,2815, - 2818,1,0,0,0,2816,2814,1,0,0,0,2816,2817,1,0,0,0,2817,359,1,0,0,0,2818, - 2816,1,0,0,0,2819,2820,5,21,0,0,2820,2833,3,2,1,0,2821,2822,5,50,0,0,2822, - 2823,5,40,0,0,2823,2833,3,140,70,0,2824,2825,5,25,0,0,2825,2826,5,40,0, - 0,2826,2833,3,2,1,0,2827,2833,3,196,98,0,2828,2829,5,50,0,0,2829,2833, - 3,32,16,0,2830,2833,3,342,171,0,2831,2833,3,40,20,0,2832,2819,1,0,0,0, - 2832,2821,1,0,0,0,2832,2824,1,0,0,0,2832,2827,1,0,0,0,2832,2828,1,0,0, - 0,2832,2830,1,0,0,0,2832,2831,1,0,0,0,2833,361,1,0,0,0,2834,2838,5,273, - 0,0,2835,2837,3,364,182,0,2836,2835,1,0,0,0,2837,2840,1,0,0,0,2838,2836, - 1,0,0,0,2838,2839,1,0,0,0,2839,2841,1,0,0,0,2840,2838,1,0,0,0,2841,2854, - 3,2,1,0,2842,2846,5,273,0,0,2843,2845,3,364,182,0,2844,2843,1,0,0,0,2845, - 2848,1,0,0,0,2846,2844,1,0,0,0,2846,2847,1,0,0,0,2847,2849,1,0,0,0,2848, - 2846,1,0,0,0,2849,2850,3,2,1,0,2850,2851,5,34,0,0,2851,2852,3,2,1,0,2852, - 2854,1,0,0,0,2853,2834,1,0,0,0,2853,2842,1,0,0,0,2854,363,1,0,0,0,2855, - 2856,7,13,0,0,2856,365,1,0,0,0,2857,2859,3,368,184,0,2858,2857,1,0,0,0, - 2859,2862,1,0,0,0,2860,2858,1,0,0,0,2860,2861,1,0,0,0,2861,367,1,0,0,0, - 2862,2860,1,0,0,0,2863,2864,5,21,0,0,2864,2865,3,2,1,0,2865,2866,5,44, - 0,0,2866,2867,3,32,16,0,2867,2874,1,0,0,0,2868,2869,5,25,0,0,2869,2870, - 5,40,0,0,2870,2874,3,2,1,0,2871,2874,3,342,171,0,2872,2874,3,40,20,0,2873, - 2863,1,0,0,0,2873,2868,1,0,0,0,2873,2871,1,0,0,0,2873,2872,1,0,0,0,2874, - 369,1,0,0,0,172,378,383,391,399,452,493,502,526,530,548,575,598,634,640, - 647,649,659,661,668,679,687,708,710,726,771,776,781,786,794,872,878,894, - 900,906,913,1024,1029,1035,1040,1042,1050,1062,1074,1081,1088,1090,1117, - 1124,1132,1140,1153,1160,1163,1182,1276,1285,1292,1295,1303,1324,1356, - 1379,1391,1400,1425,1449,1457,1461,1476,1483,1528,1538,1554,1566,1578, - 1592,1604,1615,1622,1632,1645,1650,1655,1664,1675,1758,1767,1780,1791, - 1799,1809,1811,1838,1845,1850,1857,1863,1873,1877,1884,1899,1905,1919, - 1932,1940,1947,1951,1956,1972,1977,1979,1992,2018,2025,2027,2032,2038, - 2067,2072,2095,2100,2164,2173,2186,2197,2208,2211,2218,2230,2244,2258, - 2266,2286,2298,2303,2312,2314,2321,2331,2399,2476,2481,2489,2639,2643, - 2645,2650,2652,2658,2664,2670,2676,2682,2688,2694,2701,2706,2712,2739, - 2753,2758,2775,2782,2791,2811,2816,2832,2838,2846,2853,2860,2873 + 1,172,1,172,1,172,1,172,1,172,1,172,3,172,3565,8,172,1,173,1,173,1,173, + 1,173,1,173,1,173,1,174,1,174,1,174,1,174,1,174,1,174,1,175,1,175,1,175, + 1,175,1,175,1,176,1,176,1,176,5,176,3587,8,176,10,176,12,176,3590,9,176, + 1,177,1,177,1,177,1,177,1,177,1,177,1,177,1,177,1,177,1,177,1,177,1,177, + 1,177,1,177,1,177,3,177,3607,8,177,1,178,1,178,1,178,5,178,3612,8,178, + 10,178,12,178,3615,9,178,1,179,1,179,1,179,1,179,1,179,1,179,1,179,1,179, + 1,179,1,179,1,179,1,179,1,179,1,179,1,179,1,179,1,179,1,179,1,179,1,179, + 1,179,1,179,1,179,1,179,1,179,3,179,3642,8,179,1,180,1,180,1,180,1,180, + 1,180,1,180,1,181,1,181,1,181,1,181,1,181,1,181,1,181,1,181,1,181,1,181, + 1,181,1,181,3,181,3662,8,181,1,182,1,182,1,182,5,182,3667,8,182,10,182, + 12,182,3670,9,182,1,183,1,183,1,184,1,184,1,184,5,184,3677,8,184,10,184, + 12,184,3680,9,184,1,185,1,185,1,185,1,185,1,185,1,185,1,185,1,185,1,185, + 1,185,1,185,1,185,1,185,1,185,1,185,3,185,3697,8,185,1,185,0,0,186,0,2, + 4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52, + 54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100, + 102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136, + 138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172, + 174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208, + 210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244, + 246,248,250,252,254,256,258,260,262,264,266,268,270,272,274,276,278,280, + 282,284,286,288,290,292,294,296,298,300,302,304,306,308,310,312,314,316, + 318,320,322,324,326,328,330,332,334,336,338,340,342,344,346,348,350,352, + 354,356,358,360,362,364,366,368,370,0,16,5,0,1,15,242,242,246,246,263, + 263,288,288,4,0,16,16,242,242,263,263,287,288,1,0,172,173,1,0,37,38,2, + 0,45,47,185,186,1,0,73,74,1,0,262,263,3,0,2,2,61,61,77,83,2,0,228,228, + 259,260,1,0,95,96,1,0,97,111,1,0,187,188,1,0,183,185,1,0,183,188,2,0,172, + 172,288,289,1,0,51,52,4137,0,372,1,0,0,0,2,390,1,0,0,0,4,392,1,0,0,0,6, + 399,1,0,0,0,8,408,1,0,0,0,10,497,1,0,0,0,12,499,1,0,0,0,14,503,1,0,0,0, + 16,507,1,0,0,0,18,512,1,0,0,0,20,516,1,0,0,0,22,520,1,0,0,0,24,528,1,0, + 0,0,26,548,1,0,0,0,28,550,1,0,0,0,30,552,1,0,0,0,32,564,1,0,0,0,34,566, + 1,0,0,0,36,589,1,0,0,0,38,596,1,0,0,0,40,614,1,0,0,0,42,646,1,0,0,0,44, + 674,1,0,0,0,46,714,1,0,0,0,48,716,1,0,0,0,50,725,1,0,0,0,52,727,1,0,0, + 0,54,737,1,0,0,0,56,750,1,0,0,0,58,753,1,0,0,0,60,756,1,0,0,0,62,780,1, + 0,0,0,64,793,1,0,0,0,66,795,1,0,0,0,68,809,1,0,0,0,70,814,1,0,0,0,72,816, + 1,0,0,0,74,823,1,0,0,0,76,827,1,0,0,0,78,906,1,0,0,0,80,913,1,0,0,0,82, + 920,1,0,0,0,84,925,1,0,0,0,86,934,1,0,0,0,88,940,1,0,0,0,90,993,1,0,0, + 0,92,995,1,0,0,0,94,1019,1,0,0,0,96,1024,1,0,0,0,98,1026,1,0,0,0,100,1033, + 1,0,0,0,102,1061,1,0,0,0,104,1141,1,0,0,0,106,1143,1,0,0,0,108,1172,1, + 0,0,0,110,1174,1,0,0,0,112,1188,1,0,0,0,114,1217,1,0,0,0,116,1229,1,0, + 0,0,118,1268,1,0,0,0,120,1276,1,0,0,0,122,1287,1,0,0,0,124,1301,1,0,0, + 0,126,1309,1,0,0,0,128,1325,1,0,0,0,130,1338,1,0,0,0,132,1362,1,0,0,0, + 134,1509,1,0,0,0,136,1519,1,0,0,0,138,1531,1,0,0,0,140,1613,1,0,0,0,142, + 1615,1,0,0,0,144,1654,1,0,0,0,146,1714,1,0,0,0,148,1754,1,0,0,0,150,1770, + 1,0,0,0,152,1772,1,0,0,0,154,1776,1,0,0,0,156,1838,1,0,0,0,158,1853,1, + 0,0,0,160,1870,1,0,0,0,162,1878,1,0,0,0,164,1884,1,0,0,0,166,1889,1,0, + 0,0,168,1936,1,0,0,0,170,1938,1,0,0,0,172,1982,1,0,0,0,174,2001,1,0,0, + 0,176,2022,1,0,0,0,178,2024,1,0,0,0,180,2041,1,0,0,0,182,2056,1,0,0,0, + 184,2064,1,0,0,0,186,2076,1,0,0,0,188,2096,1,0,0,0,190,2103,1,0,0,0,192, + 2106,1,0,0,0,194,2119,1,0,0,0,196,2125,1,0,0,0,198,2131,1,0,0,0,200,2135, + 1,0,0,0,202,2292,1,0,0,0,204,2294,1,0,0,0,206,2350,1,0,0,0,208,2361,1, + 0,0,0,210,2368,1,0,0,0,212,2376,1,0,0,0,214,2403,1,0,0,0,216,2409,1,0, + 0,0,218,2414,1,0,0,0,220,2443,1,0,0,0,222,2445,1,0,0,0,224,2465,1,0,0, + 0,226,2470,1,0,0,0,228,2495,1,0,0,0,230,2504,1,0,0,0,232,2519,1,0,0,0, + 234,2526,1,0,0,0,236,2546,1,0,0,0,238,2548,1,0,0,0,240,2619,1,0,0,0,242, + 2644,1,0,0,0,244,2688,1,0,0,0,246,2697,1,0,0,0,248,2737,1,0,0,0,250,2742, + 1,0,0,0,252,2782,1,0,0,0,254,2784,1,0,0,0,256,2790,1,0,0,0,258,2798,1, + 0,0,0,260,2818,1,0,0,0,262,2885,1,0,0,0,264,2887,1,0,0,0,266,2897,1,0, + 0,0,268,2899,1,0,0,0,270,2903,1,0,0,0,272,2909,1,0,0,0,274,2929,1,0,0, + 0,276,2947,1,0,0,0,278,2961,1,0,0,0,280,2963,1,0,0,0,282,2966,1,0,0,0, + 284,2968,1,0,0,0,286,2985,1,0,0,0,288,2987,1,0,0,0,290,3000,1,0,0,0,292, + 3007,1,0,0,0,294,3018,1,0,0,0,296,3025,1,0,0,0,298,3036,1,0,0,0,300,3086, + 1,0,0,0,302,3178,1,0,0,0,304,3185,1,0,0,0,306,3188,1,0,0,0,308,3198,1, + 0,0,0,310,3371,1,0,0,0,312,3381,1,0,0,0,314,3392,1,0,0,0,316,3400,1,0, + 0,0,318,3408,1,0,0,0,320,3416,1,0,0,0,322,3424,1,0,0,0,324,3432,1,0,0, + 0,326,3441,1,0,0,0,328,3449,1,0,0,0,330,3460,1,0,0,0,332,3467,1,0,0,0, + 334,3479,1,0,0,0,336,3513,1,0,0,0,338,3515,1,0,0,0,340,3535,1,0,0,0,342, + 3542,1,0,0,0,344,3564,1,0,0,0,346,3566,1,0,0,0,348,3572,1,0,0,0,350,3578, + 1,0,0,0,352,3588,1,0,0,0,354,3606,1,0,0,0,356,3613,1,0,0,0,358,3641,1, + 0,0,0,360,3643,1,0,0,0,362,3661,1,0,0,0,364,3668,1,0,0,0,366,3671,1,0, + 0,0,368,3678,1,0,0,0,370,3696,1,0,0,0,372,373,7,0,0,0,373,1,1,0,0,0,374, + 375,5,287,0,0,375,391,6,1,-1,0,376,377,3,4,2,0,377,378,6,1,-1,0,378,379, + 5,264,0,0,379,381,1,0,0,0,380,376,1,0,0,0,381,384,1,0,0,0,382,380,1,0, + 0,0,382,383,1,0,0,0,383,385,1,0,0,0,384,382,1,0,0,0,385,386,3,4,2,0,386, + 387,6,1,-1,0,387,391,1,0,0,0,388,389,5,263,0,0,389,391,6,1,-1,0,390,374, + 1,0,0,0,390,382,1,0,0,0,390,388,1,0,0,0,391,3,1,0,0,0,392,393,7,1,0,0, + 393,5,1,0,0,0,394,395,5,262,0,0,395,396,6,3,-1,0,396,398,5,265,0,0,397, + 394,1,0,0,0,398,401,1,0,0,0,399,397,1,0,0,0,399,400,1,0,0,0,400,402,1, + 0,0,0,401,399,1,0,0,0,402,403,5,262,0,0,403,404,6,3,-1,0,404,7,1,0,0,0, + 405,407,3,10,5,0,406,405,1,0,0,0,407,410,1,0,0,0,408,406,1,0,0,0,408,409, + 1,0,0,0,409,9,1,0,0,0,410,408,1,0,0,0,411,412,3,76,38,0,412,413,5,17,0, + 0,413,414,3,84,42,0,414,415,5,18,0,0,415,498,1,0,0,0,416,417,3,74,37,0, + 417,418,5,17,0,0,418,419,3,8,4,0,419,420,5,18,0,0,420,498,1,0,0,0,421, + 422,3,238,119,0,422,423,5,17,0,0,423,424,3,250,125,0,424,425,5,18,0,0, + 425,498,1,0,0,0,426,498,3,204,102,0,427,428,6,5,-1,0,428,429,3,288,144, + 0,429,430,6,5,-1,0,430,498,1,0,0,0,431,432,6,5,-1,0,432,433,3,72,36,0, + 433,434,6,5,-1,0,434,498,1,0,0,0,435,436,6,5,-1,0,436,437,3,66,33,0,437, + 438,6,5,-1,0,438,498,1,0,0,0,439,440,6,5,-1,0,440,441,3,90,45,0,441,442, + 6,5,-1,0,442,498,1,0,0,0,443,444,6,5,-1,0,444,445,3,92,46,0,445,446,6, + 5,-1,0,446,498,1,0,0,0,447,448,6,5,-1,0,448,449,3,22,11,0,449,450,6,5, + -1,0,450,498,1,0,0,0,451,452,6,5,-1,0,452,453,3,338,169,0,453,454,6,5, + -1,0,454,498,1,0,0,0,455,456,6,5,-1,0,456,457,3,346,173,0,457,458,6,5, + -1,0,458,498,1,0,0,0,459,460,6,5,-1,0,460,461,3,360,180,0,461,462,6,5, + -1,0,462,498,1,0,0,0,463,464,6,5,-1,0,464,465,3,64,32,0,465,466,6,5,-1, + 0,466,498,1,0,0,0,467,468,6,5,-1,0,468,469,3,156,78,0,469,470,6,5,-1,0, + 470,498,1,0,0,0,471,472,3,334,167,0,472,473,6,5,-1,0,473,498,1,0,0,0,474, + 475,6,5,-1,0,475,498,3,12,6,0,476,477,6,5,-1,0,477,498,3,14,7,0,478,479, + 6,5,-1,0,479,498,3,16,8,0,480,481,6,5,-1,0,481,498,3,18,9,0,482,483,6, + 5,-1,0,483,498,3,20,10,0,484,485,6,5,-1,0,485,486,3,26,13,0,486,487,6, + 5,-1,0,487,498,1,0,0,0,488,489,6,5,-1,0,489,490,3,42,21,0,490,491,6,5, + -1,0,491,498,1,0,0,0,492,493,6,5,-1,0,493,498,3,40,20,0,494,498,3,30,15, + 0,495,496,6,5,-1,0,496,498,3,24,12,0,497,411,1,0,0,0,497,416,1,0,0,0,497, + 421,1,0,0,0,497,426,1,0,0,0,497,427,1,0,0,0,497,431,1,0,0,0,497,435,1, + 0,0,0,497,439,1,0,0,0,497,443,1,0,0,0,497,447,1,0,0,0,497,451,1,0,0,0, + 497,455,1,0,0,0,497,459,1,0,0,0,497,463,1,0,0,0,497,467,1,0,0,0,497,471, + 1,0,0,0,497,474,1,0,0,0,497,476,1,0,0,0,497,478,1,0,0,0,497,480,1,0,0, + 0,497,482,1,0,0,0,497,484,1,0,0,0,497,488,1,0,0,0,497,492,1,0,0,0,497, + 494,1,0,0,0,497,495,1,0,0,0,498,11,1,0,0,0,499,500,5,19,0,0,500,501,3, + 32,16,0,501,502,6,6,-1,0,502,13,1,0,0,0,503,504,5,20,0,0,504,505,3,32, + 16,0,505,506,6,7,-1,0,506,15,1,0,0,0,507,508,5,21,0,0,508,509,5,22,0,0, + 509,510,3,32,16,0,510,511,6,8,-1,0,511,17,1,0,0,0,512,513,5,23,0,0,513, + 514,3,34,17,0,514,515,6,9,-1,0,515,19,1,0,0,0,516,517,5,24,0,0,517,518, + 3,34,17,0,518,519,6,10,-1,0,519,21,1,0,0,0,520,521,5,25,0,0,521,522,3, + 100,50,0,522,523,3,2,1,0,523,524,5,17,0,0,524,525,3,122,61,0,525,526,5, + 18,0,0,526,527,6,11,-1,0,527,23,1,0,0,0,528,529,5,26,0,0,529,25,1,0,0, + 0,530,531,5,27,0,0,531,532,3,28,14,0,532,533,6,13,-1,0,533,549,1,0,0,0, + 534,535,5,27,0,0,535,536,3,28,14,0,536,537,5,28,0,0,537,538,3,28,14,0, + 538,539,6,13,-1,0,539,549,1,0,0,0,540,541,5,27,0,0,541,542,3,28,14,0,542, + 543,5,28,0,0,543,544,3,28,14,0,544,545,5,28,0,0,545,546,3,28,14,0,546, + 547,6,13,-1,0,547,549,1,0,0,0,548,530,1,0,0,0,548,534,1,0,0,0,548,540, + 1,0,0,0,549,27,1,0,0,0,550,551,5,263,0,0,551,29,1,0,0,0,552,553,5,29,0, + 0,553,559,5,17,0,0,554,555,3,118,59,0,555,556,6,15,-1,0,556,558,1,0,0, + 0,557,554,1,0,0,0,558,561,1,0,0,0,559,557,1,0,0,0,559,560,1,0,0,0,560, + 562,1,0,0,0,561,559,1,0,0,0,562,563,5,18,0,0,563,31,1,0,0,0,564,565,5, + 172,0,0,565,33,1,0,0,0,566,567,7,2,0,0,567,35,1,0,0,0,568,569,5,174,0, + 0,569,590,6,18,-1,0,570,571,3,32,16,0,571,572,5,264,0,0,572,573,6,18,-1, + 0,573,590,1,0,0,0,574,575,3,32,16,0,575,576,6,18,-1,0,576,590,1,0,0,0, + 577,578,5,187,0,0,578,579,5,30,0,0,579,580,3,32,16,0,580,581,5,31,0,0, + 581,582,6,18,-1,0,582,590,1,0,0,0,583,584,5,188,0,0,584,585,5,30,0,0,585, + 586,3,34,17,0,586,587,5,31,0,0,587,588,6,18,-1,0,588,590,1,0,0,0,589,568, + 1,0,0,0,589,570,1,0,0,0,589,574,1,0,0,0,589,577,1,0,0,0,589,583,1,0,0, + 0,590,37,1,0,0,0,591,592,3,32,16,0,592,593,6,19,-1,0,593,597,1,0,0,0,594, + 595,5,261,0,0,595,597,6,19,-1,0,596,591,1,0,0,0,596,594,1,0,0,0,597,39, + 1,0,0,0,598,599,5,266,0,0,599,615,5,288,0,0,600,601,5,266,0,0,601,602, + 5,288,0,0,602,615,5,262,0,0,603,604,5,267,0,0,604,615,5,288,0,0,605,606, + 5,268,0,0,606,615,5,288,0,0,607,608,5,269,0,0,608,615,5,288,0,0,609,615, + 5,270,0,0,610,615,5,271,0,0,611,612,5,272,0,0,612,615,5,262,0,0,613,615, + 5,32,0,0,614,598,1,0,0,0,614,600,1,0,0,0,614,603,1,0,0,0,614,605,1,0,0, + 0,614,607,1,0,0,0,614,609,1,0,0,0,614,610,1,0,0,0,614,611,1,0,0,0,614, + 613,1,0,0,0,615,41,1,0,0,0,616,617,5,33,0,0,617,618,3,142,71,0,618,619, + 5,34,0,0,619,620,3,2,1,0,620,621,6,21,-1,0,621,647,1,0,0,0,622,623,5,33, + 0,0,623,624,3,118,59,0,624,625,5,34,0,0,625,626,3,2,1,0,626,627,6,21,-1, + 0,627,647,1,0,0,0,628,629,5,33,0,0,629,630,3,180,90,0,630,631,5,34,0,0, + 631,632,3,2,1,0,632,633,6,21,-1,0,633,647,1,0,0,0,634,635,5,33,0,0,635, + 636,3,44,22,0,636,637,5,34,0,0,637,638,3,2,1,0,638,639,6,21,-1,0,639,647, + 1,0,0,0,640,641,5,33,0,0,641,642,3,46,23,0,642,643,5,34,0,0,643,644,3, + 2,1,0,644,645,6,21,-1,0,645,647,1,0,0,0,646,616,1,0,0,0,646,622,1,0,0, + 0,646,628,1,0,0,0,646,634,1,0,0,0,646,640,1,0,0,0,647,43,1,0,0,0,648,649, + 5,35,0,0,649,650,3,48,24,0,650,651,6,22,-1,0,651,675,1,0,0,0,652,653,5, + 35,0,0,653,654,3,48,24,0,654,655,5,36,0,0,655,656,3,6,3,0,656,657,6,22, + -1,0,657,675,1,0,0,0,658,659,5,35,0,0,659,660,3,48,24,0,660,661,5,36,0, + 0,661,662,5,17,0,0,662,663,3,52,26,0,663,664,5,18,0,0,664,665,6,22,-1, + 0,665,675,1,0,0,0,666,667,5,35,0,0,667,668,3,48,24,0,668,669,5,36,0,0, + 669,670,5,30,0,0,670,671,3,304,152,0,671,672,5,31,0,0,672,673,6,22,-1, + 0,673,675,1,0,0,0,674,648,1,0,0,0,674,652,1,0,0,0,674,658,1,0,0,0,674, + 666,1,0,0,0,675,45,1,0,0,0,676,677,5,35,0,0,677,678,5,30,0,0,678,679,3, + 50,25,0,679,680,5,31,0,0,680,681,3,48,24,0,681,682,6,23,-1,0,682,715,1, + 0,0,0,683,684,5,35,0,0,684,685,5,30,0,0,685,686,3,50,25,0,686,687,5,31, + 0,0,687,688,3,48,24,0,688,689,5,36,0,0,689,690,3,6,3,0,690,691,6,23,-1, + 0,691,715,1,0,0,0,692,693,5,35,0,0,693,694,5,30,0,0,694,695,3,50,25,0, + 695,696,5,31,0,0,696,697,3,48,24,0,697,698,5,36,0,0,698,699,5,17,0,0,699, + 700,3,52,26,0,700,701,5,18,0,0,701,702,6,23,-1,0,702,715,1,0,0,0,703,704, + 5,35,0,0,704,705,5,30,0,0,705,706,3,50,25,0,706,707,5,31,0,0,707,708,3, + 48,24,0,708,709,5,36,0,0,709,710,5,30,0,0,710,711,3,304,152,0,711,712, + 5,31,0,0,712,713,6,23,-1,0,713,715,1,0,0,0,714,676,1,0,0,0,714,683,1,0, + 0,0,714,692,1,0,0,0,714,703,1,0,0,0,715,47,1,0,0,0,716,717,3,172,86,0, + 717,718,6,24,-1,0,718,49,1,0,0,0,719,720,3,128,64,0,720,721,6,25,-1,0, + 721,726,1,0,0,0,722,723,3,180,90,0,723,724,6,25,-1,0,724,726,1,0,0,0,725, + 719,1,0,0,0,725,722,1,0,0,0,726,51,1,0,0,0,727,728,3,54,27,0,728,729,3, + 56,28,0,729,730,6,26,-1,0,730,53,1,0,0,0,731,732,3,310,155,0,732,733,6, + 27,-1,0,733,736,1,0,0,0,734,736,3,40,20,0,735,731,1,0,0,0,735,734,1,0, + 0,0,736,739,1,0,0,0,737,735,1,0,0,0,737,738,1,0,0,0,738,55,1,0,0,0,739, + 737,1,0,0,0,740,741,3,58,29,0,741,742,3,60,30,0,742,743,3,2,1,0,743,744, + 5,36,0,0,744,745,3,310,155,0,745,746,6,28,-1,0,746,749,1,0,0,0,747,749, + 3,40,20,0,748,740,1,0,0,0,748,747,1,0,0,0,749,752,1,0,0,0,750,748,1,0, + 0,0,750,751,1,0,0,0,751,57,1,0,0,0,752,750,1,0,0,0,753,754,7,3,0,0,754, + 755,6,29,-1,0,755,59,1,0,0,0,756,758,3,62,31,0,757,759,5,260,0,0,758,757, + 1,0,0,0,758,759,1,0,0,0,759,760,1,0,0,0,760,761,6,30,-1,0,761,61,1,0,0, + 0,762,763,3,148,74,0,763,764,6,31,-1,0,764,781,1,0,0,0,765,766,3,2,1,0, + 766,767,6,31,-1,0,767,781,1,0,0,0,768,769,5,195,0,0,769,781,6,31,-1,0, + 770,771,5,196,0,0,771,781,6,31,-1,0,772,773,5,201,0,0,773,774,5,39,0,0, + 774,775,5,263,0,0,775,781,6,31,-1,0,776,777,5,201,0,0,777,778,3,118,59, + 0,778,779,6,31,-1,0,779,781,1,0,0,0,780,762,1,0,0,0,780,765,1,0,0,0,780, + 768,1,0,0,0,780,770,1,0,0,0,780,772,1,0,0,0,780,776,1,0,0,0,781,63,1,0, + 0,0,782,783,5,197,0,0,783,784,5,40,0,0,784,785,3,2,1,0,785,786,6,32,-1, + 0,786,794,1,0,0,0,787,788,5,197,0,0,788,789,3,2,1,0,789,790,6,32,-1,0, + 790,794,1,0,0,0,791,792,5,197,0,0,792,794,6,32,-1,0,793,782,1,0,0,0,793, + 787,1,0,0,0,793,791,1,0,0,0,794,65,1,0,0,0,795,796,5,41,0,0,796,797,5, + 42,0,0,797,798,3,32,16,0,798,799,5,43,0,0,799,800,3,68,34,0,800,801,5, + 44,0,0,801,802,3,0,0,0,802,803,6,33,-1,0,803,67,1,0,0,0,804,805,3,70,35, + 0,805,806,6,34,-1,0,806,808,1,0,0,0,807,804,1,0,0,0,808,811,1,0,0,0,809, + 807,1,0,0,0,809,810,1,0,0,0,810,812,1,0,0,0,811,809,1,0,0,0,812,813,6, + 34,-1,0,813,69,1,0,0,0,814,815,7,4,0,0,815,71,1,0,0,0,816,817,5,48,0,0, + 817,818,5,36,0,0,818,819,5,30,0,0,819,820,3,304,152,0,820,821,5,31,0,0, + 821,822,6,36,-1,0,822,73,1,0,0,0,823,824,5,49,0,0,824,825,3,2,1,0,825, + 826,6,37,-1,0,826,75,1,0,0,0,827,833,5,50,0,0,828,829,3,78,39,0,829,830, + 6,38,-1,0,830,832,1,0,0,0,831,828,1,0,0,0,832,835,1,0,0,0,833,831,1,0, + 0,0,833,834,1,0,0,0,834,836,1,0,0,0,835,833,1,0,0,0,836,837,3,2,1,0,837, + 838,3,186,93,0,838,839,3,80,40,0,839,840,3,82,41,0,840,841,6,38,-1,0,841, + 77,1,0,0,0,842,843,5,51,0,0,843,907,6,39,-1,0,844,845,5,52,0,0,845,907, + 6,39,-1,0,846,847,5,198,0,0,847,907,6,39,-1,0,848,849,5,201,0,0,849,907, + 6,39,-1,0,850,851,5,220,0,0,851,907,6,39,-1,0,852,853,5,53,0,0,853,907, + 6,39,-1,0,854,855,5,54,0,0,855,907,6,39,-1,0,856,857,5,55,0,0,857,907, + 6,39,-1,0,858,859,5,56,0,0,859,907,6,39,-1,0,860,861,5,243,0,0,861,907, + 6,39,-1,0,862,863,5,15,0,0,863,907,6,39,-1,0,864,865,5,223,0,0,865,907, + 6,39,-1,0,866,867,5,57,0,0,867,907,6,39,-1,0,868,869,5,58,0,0,869,907, + 6,39,-1,0,870,871,5,59,0,0,871,907,6,39,-1,0,872,873,5,60,0,0,873,907, + 6,39,-1,0,874,875,5,61,0,0,875,907,6,39,-1,0,876,877,5,62,0,0,877,878, + 5,51,0,0,878,907,6,39,-1,0,879,880,5,62,0,0,880,881,5,52,0,0,881,907,6, + 39,-1,0,882,883,5,62,0,0,883,884,5,63,0,0,884,907,6,39,-1,0,885,886,5, + 62,0,0,886,887,5,64,0,0,887,907,6,39,-1,0,888,889,5,62,0,0,889,890,5,65, + 0,0,890,907,6,39,-1,0,891,892,5,62,0,0,892,893,5,66,0,0,893,907,6,39,-1, + 0,894,895,5,67,0,0,895,907,6,39,-1,0,896,897,5,68,0,0,897,907,6,39,-1, + 0,898,899,5,69,0,0,899,907,6,39,-1,0,900,901,5,70,0,0,901,902,5,30,0,0, + 902,903,3,32,16,0,903,904,5,31,0,0,904,905,6,39,-1,0,905,907,1,0,0,0,906, + 842,1,0,0,0,906,844,1,0,0,0,906,846,1,0,0,0,906,848,1,0,0,0,906,850,1, + 0,0,0,906,852,1,0,0,0,906,854,1,0,0,0,906,856,1,0,0,0,906,858,1,0,0,0, + 906,860,1,0,0,0,906,862,1,0,0,0,906,864,1,0,0,0,906,866,1,0,0,0,906,868, + 1,0,0,0,906,870,1,0,0,0,906,872,1,0,0,0,906,874,1,0,0,0,906,876,1,0,0, + 0,906,879,1,0,0,0,906,882,1,0,0,0,906,885,1,0,0,0,906,888,1,0,0,0,906, + 891,1,0,0,0,906,894,1,0,0,0,906,896,1,0,0,0,906,898,1,0,0,0,906,900,1, + 0,0,0,907,79,1,0,0,0,908,914,1,0,0,0,909,910,5,71,0,0,910,911,3,126,63, + 0,911,912,6,40,-1,0,912,914,1,0,0,0,913,908,1,0,0,0,913,909,1,0,0,0,914, + 81,1,0,0,0,915,921,1,0,0,0,916,917,5,72,0,0,917,918,3,86,43,0,918,919, + 6,41,-1,0,919,921,1,0,0,0,920,915,1,0,0,0,920,916,1,0,0,0,921,83,1,0,0, + 0,922,924,3,202,101,0,923,922,1,0,0,0,924,927,1,0,0,0,925,923,1,0,0,0, + 925,926,1,0,0,0,926,85,1,0,0,0,927,925,1,0,0,0,928,929,3,126,63,0,929, + 930,6,43,-1,0,930,931,5,28,0,0,931,933,1,0,0,0,932,928,1,0,0,0,933,936, + 1,0,0,0,934,932,1,0,0,0,934,935,1,0,0,0,935,937,1,0,0,0,936,934,1,0,0, + 0,937,938,3,126,63,0,938,939,6,43,-1,0,939,87,1,0,0,0,940,941,7,5,0,0, + 941,89,1,0,0,0,942,943,3,88,44,0,943,945,3,32,16,0,944,946,7,6,0,0,945, + 944,1,0,0,0,945,946,1,0,0,0,946,947,1,0,0,0,947,948,6,45,-1,0,948,994, + 1,0,0,0,949,950,3,88,44,0,950,951,3,32,16,0,951,952,5,75,0,0,952,954,3, + 32,16,0,953,955,5,263,0,0,954,953,1,0,0,0,954,955,1,0,0,0,955,956,1,0, + 0,0,956,957,6,45,-1,0,957,994,1,0,0,0,958,959,3,88,44,0,959,960,3,32,16, + 0,960,961,5,75,0,0,961,962,3,32,16,0,962,963,5,28,0,0,963,965,3,32,16, + 0,964,966,5,263,0,0,965,964,1,0,0,0,965,966,1,0,0,0,966,967,1,0,0,0,967, + 968,6,45,-1,0,968,994,1,0,0,0,969,970,3,88,44,0,970,971,3,32,16,0,971, + 972,5,28,0,0,972,973,3,32,16,0,973,974,5,75,0,0,974,976,3,32,16,0,975, + 977,5,263,0,0,976,975,1,0,0,0,976,977,1,0,0,0,977,978,1,0,0,0,978,979, + 6,45,-1,0,979,994,1,0,0,0,980,981,3,88,44,0,981,982,3,32,16,0,982,983, + 5,28,0,0,983,984,3,32,16,0,984,985,5,75,0,0,985,986,3,32,16,0,986,987, + 5,28,0,0,987,989,3,32,16,0,988,990,5,263,0,0,989,988,1,0,0,0,989,990,1, + 0,0,0,990,991,1,0,0,0,991,992,6,45,-1,0,992,994,1,0,0,0,993,942,1,0,0, + 0,993,949,1,0,0,0,993,958,1,0,0,0,993,969,1,0,0,0,993,980,1,0,0,0,994, + 91,1,0,0,0,995,1001,5,21,0,0,996,997,3,94,47,0,997,998,6,46,-1,0,998,1000, + 1,0,0,0,999,996,1,0,0,0,1000,1003,1,0,0,0,1001,999,1,0,0,0,1001,1002,1, + 0,0,0,1002,1004,1,0,0,0,1003,1001,1,0,0,0,1004,1005,3,2,1,0,1005,1006, + 6,46,-1,0,1006,1007,3,96,48,0,1007,1017,6,46,-1,0,1008,1009,5,179,0,0, + 1009,1010,5,36,0,0,1010,1011,5,30,0,0,1011,1012,3,304,152,0,1012,1013, + 5,31,0,0,1013,1014,6,46,-1,0,1014,1015,3,96,48,0,1015,1016,6,46,-1,0,1016, + 1018,1,0,0,0,1017,1008,1,0,0,0,1017,1018,1,0,0,0,1018,93,1,0,0,0,1019, + 1020,5,76,0,0,1020,95,1,0,0,0,1021,1025,1,0,0,0,1022,1023,5,297,0,0,1023, + 1025,6,48,-1,0,1024,1021,1,0,0,0,1024,1022,1,0,0,0,1025,97,1,0,0,0,1026, + 1027,7,7,0,0,1027,99,1,0,0,0,1028,1029,3,98,49,0,1029,1030,6,50,-1,0,1030, + 1032,1,0,0,0,1031,1028,1,0,0,0,1032,1035,1,0,0,0,1033,1031,1,0,0,0,1033, + 1034,1,0,0,0,1034,101,1,0,0,0,1035,1033,1,0,0,0,1036,1062,3,104,52,0,1037, + 1038,5,279,0,0,1038,1039,3,172,86,0,1039,1040,6,51,-1,0,1040,1062,1,0, + 0,0,1041,1042,5,285,0,0,1042,1043,3,182,91,0,1043,1044,6,51,-1,0,1044, + 1062,1,0,0,0,1045,1046,5,285,0,0,1046,1047,3,178,89,0,1047,1048,6,51,-1, + 0,1048,1062,1,0,0,0,1049,1050,5,283,0,0,1050,1051,3,126,63,0,1051,1052, + 6,51,-1,0,1052,1062,1,0,0,0,1053,1054,5,280,0,0,1054,1055,3,106,53,0,1055, + 1056,6,51,-1,0,1056,1062,1,0,0,0,1057,1058,5,286,0,0,1058,1059,3,50,25, + 0,1059,1060,6,51,-1,0,1060,1062,1,0,0,0,1061,1036,1,0,0,0,1061,1037,1, + 0,0,0,1061,1041,1,0,0,0,1061,1045,1,0,0,0,1061,1049,1,0,0,0,1061,1053, + 1,0,0,0,1061,1057,1,0,0,0,1062,103,1,0,0,0,1063,1064,5,274,0,0,1064,1142, + 6,52,-1,0,1065,1066,5,275,0,0,1066,1067,3,32,16,0,1067,1068,6,52,-1,0, + 1068,1142,1,0,0,0,1069,1070,5,275,0,0,1070,1071,3,0,0,0,1071,1072,6,52, + -1,0,1072,1142,1,0,0,0,1073,1074,5,276,0,0,1074,1075,3,32,16,0,1075,1076, + 6,52,-1,0,1076,1142,1,0,0,0,1077,1078,5,277,0,0,1078,1079,3,34,17,0,1079, + 1080,6,52,-1,0,1080,1142,1,0,0,0,1081,1082,5,278,0,0,1082,1083,3,36,18, + 0,1083,1084,6,52,-1,0,1084,1142,1,0,0,0,1085,1086,5,278,0,0,1086,1087, + 3,34,17,0,1087,1088,6,52,-1,0,1088,1142,1,0,0,0,1089,1090,5,278,0,0,1090, + 1091,5,30,0,0,1091,1092,3,304,152,0,1092,1093,5,31,0,0,1093,1094,6,52, + -1,0,1094,1142,1,0,0,0,1095,1096,5,278,0,0,1096,1097,5,84,0,0,1097,1098, + 5,30,0,0,1098,1099,3,304,152,0,1099,1100,5,31,0,0,1100,1101,6,52,-1,0, + 1101,1142,1,0,0,0,1102,1103,5,281,0,0,1103,1104,3,32,16,0,1104,1105,6, + 52,-1,0,1105,1142,1,0,0,0,1106,1107,5,281,0,0,1107,1108,3,0,0,0,1108,1109, + 6,52,-1,0,1109,1142,1,0,0,0,1110,1111,5,284,0,0,1111,1112,3,6,3,0,1112, + 1113,6,52,-1,0,1113,1142,1,0,0,0,1114,1115,5,284,0,0,1115,1116,5,223,0, + 0,1116,1117,5,30,0,0,1117,1118,3,6,3,0,1118,1119,5,31,0,0,1119,1120,6, + 52,-1,0,1120,1142,1,0,0,0,1121,1122,5,284,0,0,1122,1123,5,84,0,0,1123, + 1124,5,30,0,0,1124,1125,3,304,152,0,1125,1126,5,31,0,0,1126,1127,6,52, + -1,0,1127,1142,1,0,0,0,1128,1129,5,286,0,0,1129,1130,3,32,16,0,1130,1131, + 6,52,-1,0,1131,1142,1,0,0,0,1132,1133,5,282,0,0,1133,1139,6,52,-1,0,1134, + 1135,5,30,0,0,1135,1136,3,108,54,0,1136,1137,5,31,0,0,1137,1140,1,0,0, + 0,1138,1140,5,85,0,0,1139,1134,1,0,0,0,1139,1138,1,0,0,0,1140,1142,1,0, + 0,0,1141,1063,1,0,0,0,1141,1065,1,0,0,0,1141,1069,1,0,0,0,1141,1073,1, + 0,0,0,1141,1077,1,0,0,0,1141,1081,1,0,0,0,1141,1085,1,0,0,0,1141,1089, + 1,0,0,0,1141,1095,1,0,0,0,1141,1102,1,0,0,0,1141,1106,1,0,0,0,1141,1110, + 1,0,0,0,1141,1114,1,0,0,0,1141,1121,1,0,0,0,1141,1128,1,0,0,0,1141,1132, + 1,0,0,0,1142,105,1,0,0,0,1143,1144,3,174,87,0,1144,1145,3,142,71,0,1145, + 1146,3,114,57,0,1146,1147,6,53,-1,0,1147,107,1,0,0,0,1148,1173,1,0,0,0, + 1149,1150,3,0,0,0,1150,1151,6,54,-1,0,1151,1156,1,0,0,0,1152,1153,3,32, + 16,0,1153,1154,6,54,-1,0,1154,1156,1,0,0,0,1155,1149,1,0,0,0,1155,1152, + 1,0,0,0,1156,1157,1,0,0,0,1157,1158,5,28,0,0,1158,1160,1,0,0,0,1159,1155, + 1,0,0,0,1160,1163,1,0,0,0,1161,1159,1,0,0,0,1161,1162,1,0,0,0,1162,1170, + 1,0,0,0,1163,1161,1,0,0,0,1164,1165,3,0,0,0,1165,1166,6,54,-1,0,1166,1171, + 1,0,0,0,1167,1168,3,32,16,0,1168,1169,6,54,-1,0,1169,1171,1,0,0,0,1170, + 1164,1,0,0,0,1170,1167,1,0,0,0,1171,1173,1,0,0,0,1172,1148,1,0,0,0,1172, + 1161,1,0,0,0,1173,109,1,0,0,0,1174,1181,5,86,0,0,1175,1176,3,142,71,0, + 1176,1177,6,55,-1,0,1177,1178,5,28,0,0,1178,1180,1,0,0,0,1179,1175,1,0, + 0,0,1180,1183,1,0,0,0,1181,1179,1,0,0,0,1181,1182,1,0,0,0,1182,1184,1, + 0,0,0,1183,1181,1,0,0,0,1184,1185,3,142,71,0,1185,1186,6,55,-1,0,1186, + 1187,5,87,0,0,1187,111,1,0,0,0,1188,1195,5,42,0,0,1189,1190,3,150,75,0, + 1190,1191,6,56,-1,0,1191,1192,5,28,0,0,1192,1194,1,0,0,0,1193,1189,1,0, + 0,0,1194,1197,1,0,0,0,1195,1193,1,0,0,0,1195,1196,1,0,0,0,1196,1198,1, + 0,0,0,1197,1195,1,0,0,0,1198,1199,3,150,75,0,1199,1200,6,56,-1,0,1200, + 1201,5,43,0,0,1201,113,1,0,0,0,1202,1209,5,30,0,0,1203,1204,3,116,58,0, + 1204,1205,6,57,-1,0,1205,1206,5,28,0,0,1206,1208,1,0,0,0,1207,1203,1,0, + 0,0,1208,1211,1,0,0,0,1209,1207,1,0,0,0,1209,1210,1,0,0,0,1210,1212,1, + 0,0,0,1211,1209,1,0,0,0,1212,1213,3,116,58,0,1213,1214,6,57,-1,0,1214, + 1215,5,31,0,0,1215,1218,1,0,0,0,1216,1218,5,85,0,0,1217,1202,1,0,0,0,1217, + 1216,1,0,0,0,1218,115,1,0,0,0,1219,1220,5,176,0,0,1220,1230,6,58,-1,0, + 1221,1222,3,234,117,0,1222,1223,3,142,71,0,1223,1225,3,230,115,0,1224, + 1226,3,0,0,0,1225,1224,1,0,0,0,1225,1226,1,0,0,0,1226,1227,1,0,0,0,1227, + 1228,6,58,-1,0,1228,1230,1,0,0,0,1229,1219,1,0,0,0,1229,1221,1,0,0,0,1230, + 117,1,0,0,0,1231,1232,5,42,0,0,1232,1233,3,2,1,0,1233,1234,5,43,0,0,1234, + 1235,3,120,60,0,1235,1236,6,59,-1,0,1236,1269,1,0,0,0,1237,1238,5,42,0, + 0,1238,1239,3,178,89,0,1239,1240,5,43,0,0,1240,1241,3,120,60,0,1241,1242, + 6,59,-1,0,1242,1269,1,0,0,0,1243,1244,5,42,0,0,1244,1245,5,261,0,0,1245, + 1246,5,43,0,0,1246,1247,3,120,60,0,1247,1248,6,59,-1,0,1248,1269,1,0,0, + 0,1249,1250,5,42,0,0,1250,1251,5,197,0,0,1251,1252,3,2,1,0,1252,1253,5, + 43,0,0,1253,1254,3,120,60,0,1254,1255,6,59,-1,0,1255,1269,1,0,0,0,1256, + 1257,3,120,60,0,1257,1258,6,59,-1,0,1258,1269,1,0,0,0,1259,1260,3,178, + 89,0,1260,1261,6,59,-1,0,1261,1269,1,0,0,0,1262,1263,5,256,0,0,1263,1269, + 6,59,-1,0,1264,1265,5,257,0,0,1265,1269,6,59,-1,0,1266,1267,5,258,0,0, + 1267,1269,6,59,-1,0,1268,1231,1,0,0,0,1268,1237,1,0,0,0,1268,1243,1,0, + 0,0,1268,1249,1,0,0,0,1268,1256,1,0,0,0,1268,1259,1,0,0,0,1268,1262,1, + 0,0,0,1268,1264,1,0,0,0,1268,1266,1,0,0,0,1269,119,1,0,0,0,1270,1271,3, + 2,1,0,1271,1272,6,60,-1,0,1272,1273,5,88,0,0,1273,1275,1,0,0,0,1274,1270, + 1,0,0,0,1275,1278,1,0,0,0,1276,1274,1,0,0,0,1276,1277,1,0,0,0,1277,1279, + 1,0,0,0,1278,1276,1,0,0,0,1279,1280,3,2,1,0,1280,1281,6,60,-1,0,1281,121, + 1,0,0,0,1282,1283,3,124,62,0,1283,1284,6,61,-1,0,1284,1286,1,0,0,0,1285, + 1282,1,0,0,0,1286,1289,1,0,0,0,1287,1285,1,0,0,0,1287,1288,1,0,0,0,1288, + 123,1,0,0,0,1289,1287,1,0,0,0,1290,1291,5,179,0,0,1291,1292,5,89,0,0,1292, + 1293,3,32,16,0,1293,1294,6,62,-1,0,1294,1302,1,0,0,0,1295,1296,3,156,78, + 0,1296,1297,6,62,-1,0,1297,1302,1,0,0,0,1298,1299,3,336,168,0,1299,1300, + 6,62,-1,0,1300,1302,1,0,0,0,1301,1290,1,0,0,0,1301,1295,1,0,0,0,1301,1298, + 1,0,0,0,1302,125,1,0,0,0,1303,1304,3,118,59,0,1304,1305,6,63,-1,0,1305, + 1310,1,0,0,0,1306,1307,3,142,71,0,1307,1308,6,63,-1,0,1308,1310,1,0,0, + 0,1309,1303,1,0,0,0,1309,1306,1,0,0,0,1310,127,1,0,0,0,1311,1312,3,126, + 63,0,1312,1313,6,64,-1,0,1313,1326,1,0,0,0,1314,1315,5,42,0,0,1315,1316, + 3,2,1,0,1316,1317,5,43,0,0,1317,1318,6,64,-1,0,1318,1326,1,0,0,0,1319, + 1320,5,42,0,0,1320,1321,5,197,0,0,1321,1322,3,2,1,0,1322,1323,5,43,0,0, + 1323,1324,6,64,-1,0,1324,1326,1,0,0,0,1325,1311,1,0,0,0,1325,1314,1,0, + 0,0,1325,1319,1,0,0,0,1326,129,1,0,0,0,1327,1339,1,0,0,0,1328,1329,3,134, + 67,0,1329,1335,6,65,-1,0,1330,1331,3,132,66,0,1331,1332,6,65,-1,0,1332, + 1334,1,0,0,0,1333,1330,1,0,0,0,1334,1337,1,0,0,0,1335,1333,1,0,0,0,1335, + 1336,1,0,0,0,1336,1339,1,0,0,0,1337,1335,1,0,0,0,1338,1327,1,0,0,0,1338, + 1328,1,0,0,0,1339,131,1,0,0,0,1340,1341,5,261,0,0,1341,1363,6,66,-1,0, + 1342,1343,5,260,0,0,1343,1363,6,66,-1,0,1344,1345,5,42,0,0,1345,1346,3, + 32,16,0,1346,1347,5,43,0,0,1347,1348,6,66,-1,0,1348,1363,1,0,0,0,1349, + 1350,5,42,0,0,1350,1351,3,32,16,0,1351,1352,5,265,0,0,1352,1353,3,32,16, + 0,1353,1354,5,43,0,0,1354,1355,6,66,-1,0,1355,1363,1,0,0,0,1356,1357,5, + 42,0,0,1357,1358,5,265,0,0,1358,1359,3,32,16,0,1359,1360,5,43,0,0,1360, + 1361,6,66,-1,0,1361,1363,1,0,0,0,1362,1340,1,0,0,0,1362,1342,1,0,0,0,1362, + 1344,1,0,0,0,1362,1349,1,0,0,0,1362,1356,1,0,0,0,1363,133,1,0,0,0,1364, + 1510,6,67,-1,0,1365,1366,5,202,0,0,1366,1367,5,30,0,0,1367,1368,3,6,3, + 0,1368,1369,5,28,0,0,1369,1370,3,6,3,0,1370,1371,5,28,0,0,1371,1372,3, + 6,3,0,1372,1373,5,28,0,0,1373,1374,3,6,3,0,1374,1375,5,31,0,0,1375,1376, + 6,67,-1,0,1376,1510,1,0,0,0,1377,1378,5,202,0,0,1378,1379,5,30,0,0,1379, + 1380,3,6,3,0,1380,1381,5,28,0,0,1381,1382,3,6,3,0,1382,1383,5,31,0,0,1383, + 1384,6,67,-1,0,1384,1510,1,0,0,0,1385,1386,5,203,0,0,1386,1387,5,204,0, + 0,1387,1388,5,42,0,0,1388,1389,3,32,16,0,1389,1390,5,43,0,0,1390,1391, + 6,67,-1,0,1391,1510,1,0,0,0,1392,1393,5,203,0,0,1393,1394,5,205,0,0,1394, + 1395,5,42,0,0,1395,1396,3,32,16,0,1396,1397,5,43,0,0,1397,1398,3,130,65, + 0,1398,1399,6,67,-1,0,1399,1510,1,0,0,0,1400,1401,5,206,0,0,1401,1510, + 6,67,-1,0,1402,1403,5,207,0,0,1403,1510,6,67,-1,0,1404,1405,5,208,0,0, + 1405,1510,6,67,-1,0,1406,1407,5,200,0,0,1407,1510,6,67,-1,0,1408,1409, + 5,182,0,0,1409,1510,6,67,-1,0,1410,1411,5,183,0,0,1411,1510,6,67,-1,0, + 1412,1413,5,184,0,0,1413,1510,6,67,-1,0,1414,1415,5,185,0,0,1415,1510, + 6,67,-1,0,1416,1417,5,186,0,0,1417,1510,6,67,-1,0,1418,1419,5,187,0,0, + 1419,1510,6,67,-1,0,1420,1421,5,188,0,0,1421,1510,6,67,-1,0,1422,1423, + 5,209,0,0,1423,1510,6,67,-1,0,1424,1425,5,189,0,0,1425,1510,6,67,-1,0, + 1426,1427,5,190,0,0,1427,1510,6,67,-1,0,1428,1429,5,191,0,0,1429,1510, + 6,67,-1,0,1430,1431,5,192,0,0,1431,1510,6,67,-1,0,1432,1433,5,210,0,0, + 1433,1510,6,67,-1,0,1434,1435,5,211,0,0,1435,1510,6,67,-1,0,1436,1437, + 5,212,0,0,1437,1510,6,67,-1,0,1438,1439,5,213,0,0,1439,1510,6,67,-1,0, + 1440,1441,5,214,0,0,1441,1510,6,67,-1,0,1442,1443,5,215,0,0,1443,1510, + 6,67,-1,0,1444,1445,5,216,0,0,1445,1510,6,67,-1,0,1446,1447,5,217,0,0, + 1447,1448,3,136,68,0,1448,1449,6,67,-1,0,1449,1510,1,0,0,0,1450,1451,5, + 218,0,0,1451,1452,3,136,68,0,1452,1453,6,67,-1,0,1453,1510,1,0,0,0,1454, + 1455,5,219,0,0,1455,1510,6,67,-1,0,1456,1457,5,220,0,0,1457,1458,3,136, + 68,0,1458,1459,6,67,-1,0,1459,1510,1,0,0,0,1460,1461,5,221,0,0,1461,1462, + 3,138,69,0,1462,1463,6,67,-1,0,1463,1510,1,0,0,0,1464,1465,5,221,0,0,1465, + 1466,3,138,69,0,1466,1467,5,28,0,0,1467,1468,3,6,3,0,1468,1469,6,67,-1, + 0,1469,1510,1,0,0,0,1470,1471,5,193,0,0,1471,1510,6,67,-1,0,1472,1473, + 5,194,0,0,1473,1510,6,67,-1,0,1474,1475,5,90,0,0,1475,1476,5,183,0,0,1476, + 1510,6,67,-1,0,1477,1478,5,90,0,0,1478,1479,5,184,0,0,1479,1510,6,67,-1, + 0,1480,1481,5,90,0,0,1481,1482,5,185,0,0,1482,1510,6,67,-1,0,1483,1484, + 5,90,0,0,1484,1485,5,186,0,0,1485,1510,6,67,-1,0,1486,1487,5,62,0,0,1487, + 1488,5,219,0,0,1488,1510,6,67,-1,0,1489,1490,5,222,0,0,1490,1510,6,67, + -1,0,1491,1492,5,223,0,0,1492,1493,5,212,0,0,1493,1510,6,67,-1,0,1494, + 1495,5,224,0,0,1495,1510,6,67,-1,0,1496,1497,5,206,0,0,1497,1498,5,182, + 0,0,1498,1510,6,67,-1,0,1499,1500,5,225,0,0,1500,1510,6,67,-1,0,1501,1502, + 5,227,0,0,1502,1510,6,67,-1,0,1503,1504,5,34,0,0,1504,1505,5,226,0,0,1505, + 1510,6,67,-1,0,1506,1507,3,2,1,0,1507,1508,6,67,-1,0,1508,1510,1,0,0,0, + 1509,1364,1,0,0,0,1509,1365,1,0,0,0,1509,1377,1,0,0,0,1509,1385,1,0,0, + 0,1509,1392,1,0,0,0,1509,1400,1,0,0,0,1509,1402,1,0,0,0,1509,1404,1,0, + 0,0,1509,1406,1,0,0,0,1509,1408,1,0,0,0,1509,1410,1,0,0,0,1509,1412,1, + 0,0,0,1509,1414,1,0,0,0,1509,1416,1,0,0,0,1509,1418,1,0,0,0,1509,1420, + 1,0,0,0,1509,1422,1,0,0,0,1509,1424,1,0,0,0,1509,1426,1,0,0,0,1509,1428, + 1,0,0,0,1509,1430,1,0,0,0,1509,1432,1,0,0,0,1509,1434,1,0,0,0,1509,1436, + 1,0,0,0,1509,1438,1,0,0,0,1509,1440,1,0,0,0,1509,1442,1,0,0,0,1509,1444, + 1,0,0,0,1509,1446,1,0,0,0,1509,1450,1,0,0,0,1509,1454,1,0,0,0,1509,1456, + 1,0,0,0,1509,1460,1,0,0,0,1509,1464,1,0,0,0,1509,1470,1,0,0,0,1509,1472, + 1,0,0,0,1509,1474,1,0,0,0,1509,1477,1,0,0,0,1509,1480,1,0,0,0,1509,1483, + 1,0,0,0,1509,1486,1,0,0,0,1509,1489,1,0,0,0,1509,1491,1,0,0,0,1509,1494, + 1,0,0,0,1509,1496,1,0,0,0,1509,1499,1,0,0,0,1509,1501,1,0,0,0,1509,1503, + 1,0,0,0,1509,1506,1,0,0,0,1510,135,1,0,0,0,1511,1520,1,0,0,0,1512,1513, + 5,30,0,0,1513,1514,5,91,0,0,1514,1515,5,36,0,0,1515,1516,3,32,16,0,1516, + 1517,5,31,0,0,1517,1518,6,68,-1,0,1518,1520,1,0,0,0,1519,1511,1,0,0,0, + 1519,1512,1,0,0,0,1520,137,1,0,0,0,1521,1532,1,0,0,0,1522,1523,3,140,70, + 0,1523,1528,6,69,-1,0,1524,1525,7,8,0,0,1525,1527,6,69,-1,0,1526,1524, + 1,0,0,0,1527,1530,1,0,0,0,1528,1526,1,0,0,0,1528,1529,1,0,0,0,1529,1532, + 1,0,0,0,1530,1528,1,0,0,0,1531,1521,1,0,0,0,1531,1522,1,0,0,0,1532,139, + 1,0,0,0,1533,1534,5,177,0,0,1534,1614,6,70,-1,0,1535,1536,5,206,0,0,1536, + 1614,6,70,-1,0,1537,1538,5,207,0,0,1538,1614,6,70,-1,0,1539,1540,5,200, + 0,0,1540,1614,6,70,-1,0,1541,1542,5,182,0,0,1542,1614,6,70,-1,0,1543,1544, + 5,183,0,0,1544,1614,6,70,-1,0,1545,1546,5,184,0,0,1546,1614,6,70,-1,0, + 1547,1548,5,185,0,0,1548,1614,6,70,-1,0,1549,1550,5,186,0,0,1550,1614, + 6,70,-1,0,1551,1552,5,187,0,0,1552,1614,6,70,-1,0,1553,1554,5,188,0,0, + 1554,1614,6,70,-1,0,1555,1556,5,189,0,0,1556,1614,6,70,-1,0,1557,1558, + 5,190,0,0,1558,1614,6,70,-1,0,1559,1560,5,191,0,0,1560,1614,6,70,-1,0, + 1561,1562,5,192,0,0,1562,1614,6,70,-1,0,1563,1564,5,261,0,0,1564,1614, + 6,70,-1,0,1565,1566,5,210,0,0,1566,1614,6,70,-1,0,1567,1568,5,211,0,0, + 1568,1614,6,70,-1,0,1569,1570,5,212,0,0,1570,1614,6,70,-1,0,1571,1572, + 5,213,0,0,1572,1614,6,70,-1,0,1573,1574,5,214,0,0,1574,1614,6,70,-1,0, + 1575,1576,5,217,0,0,1576,1614,6,70,-1,0,1577,1578,5,218,0,0,1578,1614, + 6,70,-1,0,1579,1580,5,221,0,0,1580,1614,6,70,-1,0,1581,1582,5,193,0,0, + 1582,1614,6,70,-1,0,1583,1584,5,194,0,0,1584,1614,6,70,-1,0,1585,1586, + 5,209,0,0,1586,1614,6,70,-1,0,1587,1588,5,229,0,0,1588,1614,6,70,-1,0, + 1589,1590,5,230,0,0,1590,1614,6,70,-1,0,1591,1592,5,231,0,0,1592,1614, + 6,70,-1,0,1593,1594,5,232,0,0,1594,1614,6,70,-1,0,1595,1596,5,233,0,0, + 1596,1614,6,70,-1,0,1597,1598,5,234,0,0,1598,1614,6,70,-1,0,1599,1600, + 5,235,0,0,1600,1614,6,70,-1,0,1601,1602,5,236,0,0,1602,1614,6,70,-1,0, + 1603,1604,5,237,0,0,1604,1614,6,70,-1,0,1605,1606,5,238,0,0,1606,1614, + 6,70,-1,0,1607,1608,5,239,0,0,1608,1614,6,70,-1,0,1609,1610,5,240,0,0, + 1610,1614,6,70,-1,0,1611,1612,5,241,0,0,1612,1614,6,70,-1,0,1613,1533, + 1,0,0,0,1613,1535,1,0,0,0,1613,1537,1,0,0,0,1613,1539,1,0,0,0,1613,1541, + 1,0,0,0,1613,1543,1,0,0,0,1613,1545,1,0,0,0,1613,1547,1,0,0,0,1613,1549, + 1,0,0,0,1613,1551,1,0,0,0,1613,1553,1,0,0,0,1613,1555,1,0,0,0,1613,1557, + 1,0,0,0,1613,1559,1,0,0,0,1613,1561,1,0,0,0,1613,1563,1,0,0,0,1613,1565, + 1,0,0,0,1613,1567,1,0,0,0,1613,1569,1,0,0,0,1613,1571,1,0,0,0,1613,1573, + 1,0,0,0,1613,1575,1,0,0,0,1613,1577,1,0,0,0,1613,1579,1,0,0,0,1613,1581, + 1,0,0,0,1613,1583,1,0,0,0,1613,1585,1,0,0,0,1613,1587,1,0,0,0,1613,1589, + 1,0,0,0,1613,1591,1,0,0,0,1613,1593,1,0,0,0,1613,1595,1,0,0,0,1613,1597, + 1,0,0,0,1613,1599,1,0,0,0,1613,1601,1,0,0,0,1613,1603,1,0,0,0,1613,1605, + 1,0,0,0,1613,1607,1,0,0,0,1613,1609,1,0,0,0,1613,1611,1,0,0,0,1614,141, + 1,0,0,0,1615,1616,3,146,73,0,1616,1622,6,71,-1,0,1617,1618,3,144,72,0, + 1618,1619,6,71,-1,0,1619,1621,1,0,0,0,1620,1617,1,0,0,0,1621,1624,1,0, + 0,0,1622,1620,1,0,0,0,1622,1623,1,0,0,0,1623,143,1,0,0,0,1624,1622,1,0, + 0,0,1625,1626,5,260,0,0,1626,1655,6,72,-1,0,1627,1628,5,42,0,0,1628,1629, + 5,43,0,0,1629,1655,6,72,-1,0,1630,1631,3,112,56,0,1631,1632,6,72,-1,0, + 1632,1655,1,0,0,0,1633,1634,5,259,0,0,1634,1655,6,72,-1,0,1635,1636,5, + 261,0,0,1636,1655,6,72,-1,0,1637,1638,5,92,0,0,1638,1655,6,72,-1,0,1639, + 1640,5,93,0,0,1640,1641,5,30,0,0,1641,1642,3,126,63,0,1642,1643,5,31,0, + 0,1643,1644,6,72,-1,0,1644,1655,1,0,0,0,1645,1646,5,94,0,0,1646,1647,5, + 30,0,0,1647,1648,3,126,63,0,1648,1649,5,31,0,0,1649,1650,6,72,-1,0,1650, + 1655,1,0,0,0,1651,1652,3,110,55,0,1652,1653,6,72,-1,0,1653,1655,1,0,0, + 0,1654,1625,1,0,0,0,1654,1627,1,0,0,0,1654,1630,1,0,0,0,1654,1633,1,0, + 0,0,1654,1635,1,0,0,0,1654,1637,1,0,0,0,1654,1639,1,0,0,0,1654,1645,1, + 0,0,0,1654,1651,1,0,0,0,1655,145,1,0,0,0,1656,1657,5,39,0,0,1657,1658, + 3,118,59,0,1658,1659,6,73,-1,0,1659,1715,1,0,0,0,1660,1661,5,196,0,0,1661, + 1715,6,73,-1,0,1662,1663,5,198,0,0,1663,1664,5,39,0,0,1664,1665,3,118, + 59,0,1665,1666,6,73,-1,0,1666,1715,1,0,0,0,1667,1668,5,199,0,0,1668,1669, + 3,118,59,0,1669,1670,6,73,-1,0,1670,1715,1,0,0,0,1671,1672,5,225,0,0,1672, + 1673,3,174,87,0,1673,1674,3,142,71,0,1674,1675,5,261,0,0,1675,1676,3,114, + 57,0,1676,1677,6,73,-1,0,1677,1715,1,0,0,0,1678,1679,5,252,0,0,1679,1680, + 3,32,16,0,1680,1681,6,73,-1,0,1681,1715,1,0,0,0,1682,1683,5,251,0,0,1683, + 1684,3,32,16,0,1684,1685,6,73,-1,0,1685,1715,1,0,0,0,1686,1687,5,252,0, + 0,1687,1688,3,2,1,0,1688,1689,6,73,-1,0,1689,1715,1,0,0,0,1690,1691,5, + 251,0,0,1691,1692,3,2,1,0,1692,1693,6,73,-1,0,1693,1715,1,0,0,0,1694,1695, + 5,253,0,0,1695,1715,6,73,-1,0,1696,1697,5,200,0,0,1697,1715,6,73,-1,0, + 1698,1699,3,152,76,0,1699,1700,6,73,-1,0,1700,1715,1,0,0,0,1701,1702,3, + 154,77,0,1702,1703,6,73,-1,0,1703,1715,1,0,0,0,1704,1705,3,148,74,0,1705, + 1706,6,73,-1,0,1706,1715,1,0,0,0,1707,1708,3,2,1,0,1708,1709,6,73,-1,0, + 1709,1715,1,0,0,0,1710,1711,5,176,0,0,1711,1712,3,142,71,0,1712,1713,6, + 73,-1,0,1713,1715,1,0,0,0,1714,1656,1,0,0,0,1714,1660,1,0,0,0,1714,1662, + 1,0,0,0,1714,1667,1,0,0,0,1714,1671,1,0,0,0,1714,1678,1,0,0,0,1714,1682, + 1,0,0,0,1714,1686,1,0,0,0,1714,1690,1,0,0,0,1714,1694,1,0,0,0,1714,1696, + 1,0,0,0,1714,1698,1,0,0,0,1714,1701,1,0,0,0,1714,1704,1,0,0,0,1714,1707, + 1,0,0,0,1714,1710,1,0,0,0,1715,147,1,0,0,0,1716,1717,5,180,0,0,1717,1755, + 6,74,-1,0,1718,1719,5,181,0,0,1719,1755,6,74,-1,0,1720,1721,5,182,0,0, + 1721,1755,6,74,-1,0,1722,1723,5,183,0,0,1723,1755,6,74,-1,0,1724,1725, + 5,184,0,0,1725,1755,6,74,-1,0,1726,1727,5,185,0,0,1727,1755,6,74,-1,0, + 1728,1729,5,186,0,0,1729,1755,6,74,-1,0,1730,1731,5,187,0,0,1731,1755, + 6,74,-1,0,1732,1733,5,188,0,0,1733,1755,6,74,-1,0,1734,1735,5,189,0,0, + 1735,1755,6,74,-1,0,1736,1737,5,190,0,0,1737,1755,6,74,-1,0,1738,1739, + 5,191,0,0,1739,1755,6,74,-1,0,1740,1741,5,192,0,0,1741,1755,6,74,-1,0, + 1742,1743,5,90,0,0,1743,1744,5,183,0,0,1744,1755,6,74,-1,0,1745,1746,5, + 90,0,0,1746,1747,5,184,0,0,1747,1755,6,74,-1,0,1748,1749,5,90,0,0,1749, + 1750,5,185,0,0,1750,1755,6,74,-1,0,1751,1752,5,90,0,0,1752,1753,5,186, + 0,0,1753,1755,6,74,-1,0,1754,1716,1,0,0,0,1754,1718,1,0,0,0,1754,1720, + 1,0,0,0,1754,1722,1,0,0,0,1754,1724,1,0,0,0,1754,1726,1,0,0,0,1754,1728, + 1,0,0,0,1754,1730,1,0,0,0,1754,1732,1,0,0,0,1754,1734,1,0,0,0,1754,1736, + 1,0,0,0,1754,1738,1,0,0,0,1754,1740,1,0,0,0,1754,1742,1,0,0,0,1754,1745, + 1,0,0,0,1754,1748,1,0,0,0,1754,1751,1,0,0,0,1755,149,1,0,0,0,1756,1771, + 1,0,0,0,1757,1771,5,176,0,0,1758,1759,3,32,16,0,1759,1760,6,75,-1,0,1760, + 1771,1,0,0,0,1761,1762,3,32,16,0,1762,1763,5,176,0,0,1763,1764,3,32,16, + 0,1764,1765,6,75,-1,0,1765,1771,1,0,0,0,1766,1767,3,32,16,0,1767,1768, + 5,176,0,0,1768,1769,6,75,-1,0,1769,1771,1,0,0,0,1770,1756,1,0,0,0,1770, + 1757,1,0,0,0,1770,1758,1,0,0,0,1770,1761,1,0,0,0,1770,1766,1,0,0,0,1771, + 151,1,0,0,0,1772,1773,5,1,0,0,1773,1774,5,193,0,0,1774,1775,6,76,-1,0, + 1775,153,1,0,0,0,1776,1780,5,1,0,0,1777,1778,5,90,0,0,1778,1781,5,193, + 0,0,1779,1781,5,194,0,0,1780,1777,1,0,0,0,1780,1779,1,0,0,0,1781,1782, + 1,0,0,0,1782,1783,6,77,-1,0,1783,155,1,0,0,0,1784,1785,5,293,0,0,1785, + 1786,3,170,85,0,1786,1787,3,126,63,0,1787,1788,5,30,0,0,1788,1789,3,162, + 81,0,1789,1790,5,31,0,0,1790,1791,6,78,-1,0,1791,1839,1,0,0,0,1792,1793, + 5,293,0,0,1793,1794,3,170,85,0,1794,1795,3,126,63,0,1795,1796,5,36,0,0, + 1796,1797,5,17,0,0,1797,1798,3,52,26,0,1798,1799,5,18,0,0,1799,1800,6, + 78,-1,0,1800,1839,1,0,0,0,1801,1802,5,293,0,0,1802,1803,3,170,85,0,1803, + 1804,3,126,63,0,1804,1805,6,78,-1,0,1805,1839,1,0,0,0,1806,1807,5,294, + 0,0,1807,1808,3,170,85,0,1808,1810,5,36,0,0,1809,1811,5,84,0,0,1810,1809, + 1,0,0,0,1810,1811,1,0,0,0,1811,1812,1,0,0,0,1812,1813,5,30,0,0,1813,1814, + 3,304,152,0,1814,1815,5,31,0,0,1815,1816,6,78,-1,0,1816,1839,1,0,0,0,1817, + 1818,5,294,0,0,1818,1819,3,170,85,0,1819,1820,5,84,0,0,1820,1821,5,30, + 0,0,1821,1822,3,304,152,0,1822,1823,5,31,0,0,1823,1824,6,78,-1,0,1824, + 1839,1,0,0,0,1825,1826,5,294,0,0,1826,1827,3,170,85,0,1827,1828,3,6,3, + 0,1828,1829,6,78,-1,0,1829,1839,1,0,0,0,1830,1831,5,294,0,0,1831,1832, + 3,170,85,0,1832,1833,5,36,0,0,1833,1834,5,17,0,0,1834,1835,3,158,79,0, + 1835,1836,5,18,0,0,1836,1837,6,78,-1,0,1837,1839,1,0,0,0,1838,1784,1,0, + 0,0,1838,1792,1,0,0,0,1838,1801,1,0,0,0,1838,1806,1,0,0,0,1838,1817,1, + 0,0,0,1838,1825,1,0,0,0,1838,1830,1,0,0,0,1839,157,1,0,0,0,1840,1854,1, + 0,0,0,1841,1842,3,160,80,0,1842,1843,6,79,-1,0,1843,1844,5,28,0,0,1844, + 1846,1,0,0,0,1845,1841,1,0,0,0,1846,1849,1,0,0,0,1847,1845,1,0,0,0,1847, + 1848,1,0,0,0,1848,1850,1,0,0,0,1849,1847,1,0,0,0,1850,1851,3,160,80,0, + 1851,1852,6,79,-1,0,1852,1854,1,0,0,0,1853,1840,1,0,0,0,1853,1847,1,0, + 0,0,1854,159,1,0,0,0,1855,1856,5,39,0,0,1856,1857,5,263,0,0,1857,1858, + 5,36,0,0,1858,1859,5,17,0,0,1859,1860,3,56,28,0,1860,1861,5,18,0,0,1861, + 1862,6,80,-1,0,1862,1871,1,0,0,0,1863,1864,3,126,63,0,1864,1865,5,36,0, + 0,1865,1866,5,17,0,0,1866,1867,3,56,28,0,1867,1868,5,18,0,0,1868,1869, + 6,80,-1,0,1869,1871,1,0,0,0,1870,1855,1,0,0,0,1870,1863,1,0,0,0,1871,161, + 1,0,0,0,1872,1873,3,164,82,0,1873,1874,6,81,-1,0,1874,1875,5,28,0,0,1875, + 1877,1,0,0,0,1876,1872,1,0,0,0,1877,1880,1,0,0,0,1878,1876,1,0,0,0,1878, + 1879,1,0,0,0,1879,1881,1,0,0,0,1880,1878,1,0,0,0,1881,1882,3,164,82,0, + 1882,1883,6,81,-1,0,1883,163,1,0,0,0,1884,1885,3,6,3,0,1885,1886,5,36, + 0,0,1886,1887,3,168,84,0,1887,1888,6,82,-1,0,1888,165,1,0,0,0,1889,1890, + 7,9,0,0,1890,167,1,0,0,0,1891,1892,3,166,83,0,1892,1893,6,84,-1,0,1893, + 1937,1,0,0,0,1894,1895,3,32,16,0,1895,1896,6,84,-1,0,1896,1937,1,0,0,0, + 1897,1898,5,185,0,0,1898,1899,5,30,0,0,1899,1900,3,32,16,0,1900,1901,5, + 31,0,0,1901,1902,6,84,-1,0,1902,1937,1,0,0,0,1903,1904,3,6,3,0,1904,1905, + 6,84,-1,0,1905,1937,1,0,0,0,1906,1907,3,118,59,0,1907,1908,5,30,0,0,1908, + 1909,5,183,0,0,1909,1910,5,75,0,0,1910,1911,3,32,16,0,1911,1912,5,31,0, + 0,1912,1913,6,84,-1,0,1913,1937,1,0,0,0,1914,1915,3,118,59,0,1915,1916, + 5,30,0,0,1916,1917,5,184,0,0,1917,1918,5,75,0,0,1918,1919,3,32,16,0,1919, + 1920,5,31,0,0,1920,1921,6,84,-1,0,1921,1937,1,0,0,0,1922,1923,3,118,59, + 0,1923,1924,5,30,0,0,1924,1925,5,185,0,0,1925,1926,5,75,0,0,1926,1927, + 3,32,16,0,1927,1928,5,31,0,0,1928,1929,6,84,-1,0,1929,1937,1,0,0,0,1930, + 1931,3,118,59,0,1931,1932,5,30,0,0,1932,1933,3,32,16,0,1933,1934,5,31, + 0,0,1934,1935,6,84,-1,0,1935,1937,1,0,0,0,1936,1891,1,0,0,0,1936,1894, + 1,0,0,0,1936,1897,1,0,0,0,1936,1903,1,0,0,0,1936,1906,1,0,0,0,1936,1914, + 1,0,0,0,1936,1922,1,0,0,0,1936,1930,1,0,0,0,1937,169,1,0,0,0,1938,1939, + 7,10,0,0,1939,171,1,0,0,0,1940,1941,3,174,87,0,1941,1942,3,142,71,0,1942, + 1943,3,128,64,0,1943,1944,5,175,0,0,1944,1946,3,246,123,0,1945,1947,3, + 110,55,0,1946,1945,1,0,0,0,1946,1947,1,0,0,0,1947,1948,1,0,0,0,1948,1949, + 3,114,57,0,1949,1950,6,86,-1,0,1950,1983,1,0,0,0,1951,1952,3,174,87,0, + 1952,1953,3,142,71,0,1953,1954,3,128,64,0,1954,1955,5,175,0,0,1955,1956, + 3,246,123,0,1956,1957,3,200,100,0,1957,1958,3,114,57,0,1958,1959,6,86, + -1,0,1959,1983,1,0,0,0,1960,1961,3,174,87,0,1961,1962,3,142,71,0,1962, + 1964,3,246,123,0,1963,1965,3,110,55,0,1964,1963,1,0,0,0,1964,1965,1,0, + 0,0,1965,1966,1,0,0,0,1966,1967,3,114,57,0,1967,1968,6,86,-1,0,1968,1983, + 1,0,0,0,1969,1970,3,174,87,0,1970,1971,3,142,71,0,1971,1972,3,246,123, + 0,1972,1973,3,200,100,0,1973,1974,3,114,57,0,1974,1975,6,86,-1,0,1975, + 1983,1,0,0,0,1976,1977,3,178,89,0,1977,1978,6,86,-1,0,1978,1983,1,0,0, + 0,1979,1980,3,2,1,0,1980,1981,6,86,-1,0,1981,1983,1,0,0,0,1982,1940,1, + 0,0,0,1982,1951,1,0,0,0,1982,1960,1,0,0,0,1982,1969,1,0,0,0,1982,1976, + 1,0,0,0,1982,1979,1,0,0,0,1983,173,1,0,0,0,1984,1985,5,242,0,0,1985,1986, + 3,174,87,0,1986,1987,6,87,-1,0,1987,2002,1,0,0,0,1988,1989,5,243,0,0,1989, + 1990,3,174,87,0,1990,1991,6,87,-1,0,1991,2002,1,0,0,0,1992,1993,3,176, + 88,0,1993,1994,6,87,-1,0,1994,2002,1,0,0,0,1995,1996,5,112,0,0,1996,1997, + 5,30,0,0,1997,1998,3,32,16,0,1998,1999,5,31,0,0,1999,2000,6,87,-1,0,2000, + 2002,1,0,0,0,2001,1984,1,0,0,0,2001,1988,1,0,0,0,2001,1992,1,0,0,0,2001, + 1995,1,0,0,0,2002,175,1,0,0,0,2003,2023,1,0,0,0,2004,2005,5,244,0,0,2005, + 2023,6,88,-1,0,2006,2007,5,245,0,0,2007,2023,6,88,-1,0,2008,2009,5,246, + 0,0,2009,2010,5,247,0,0,2010,2023,6,88,-1,0,2011,2012,5,246,0,0,2012,2013, + 5,248,0,0,2013,2023,6,88,-1,0,2014,2015,5,246,0,0,2015,2016,5,249,0,0, + 2016,2023,6,88,-1,0,2017,2018,5,246,0,0,2018,2019,5,250,0,0,2019,2023, + 6,88,-1,0,2020,2021,5,246,0,0,2021,2023,6,88,-1,0,2022,2003,1,0,0,0,2022, + 2004,1,0,0,0,2022,2006,1,0,0,0,2022,2008,1,0,0,0,2022,2011,1,0,0,0,2022, + 2014,1,0,0,0,2022,2017,1,0,0,0,2022,2020,1,0,0,0,2023,177,1,0,0,0,2024, + 2025,5,113,0,0,2025,2026,5,30,0,0,2026,2027,3,32,16,0,2027,2028,5,31,0, + 0,2028,2029,6,89,-1,0,2029,179,1,0,0,0,2030,2031,5,225,0,0,2031,2032,3, + 172,86,0,2032,2033,6,90,-1,0,2033,2042,1,0,0,0,2034,2035,5,37,0,0,2035, + 2036,3,182,91,0,2036,2037,6,90,-1,0,2037,2042,1,0,0,0,2038,2039,3,178, + 89,0,2039,2040,6,90,-1,0,2040,2042,1,0,0,0,2041,2030,1,0,0,0,2041,2034, + 1,0,0,0,2041,2038,1,0,0,0,2042,181,1,0,0,0,2043,2044,3,142,71,0,2044,2045, + 3,128,64,0,2045,2046,5,175,0,0,2046,2047,3,2,1,0,2047,2048,6,91,-1,0,2048, + 2057,1,0,0,0,2049,2050,3,142,71,0,2050,2051,3,2,1,0,2051,2052,6,91,-1, + 0,2052,2057,1,0,0,0,2053,2054,3,2,1,0,2054,2055,6,91,-1,0,2055,2057,1, + 0,0,0,2056,2043,1,0,0,0,2056,2049,1,0,0,0,2056,2053,1,0,0,0,2057,183,1, + 0,0,0,2058,2059,3,126,63,0,2059,2060,6,92,-1,0,2060,2061,5,28,0,0,2061, + 2063,1,0,0,0,2062,2058,1,0,0,0,2063,2066,1,0,0,0,2064,2062,1,0,0,0,2064, + 2065,1,0,0,0,2065,2067,1,0,0,0,2066,2064,1,0,0,0,2067,2068,3,126,63,0, + 2068,2069,6,92,-1,0,2069,185,1,0,0,0,2070,2077,1,0,0,0,2071,2072,5,86, + 0,0,2072,2073,3,194,97,0,2073,2074,5,87,0,0,2074,2075,6,93,-1,0,2075,2077, + 1,0,0,0,2076,2070,1,0,0,0,2076,2071,1,0,0,0,2077,187,1,0,0,0,2078,2079, + 5,265,0,0,2079,2097,6,94,-1,0,2080,2081,5,114,0,0,2081,2097,6,94,-1,0, + 2082,2083,5,39,0,0,2083,2097,6,94,-1,0,2084,2085,5,199,0,0,2085,2097,6, + 94,-1,0,2086,2087,5,115,0,0,2087,2097,6,94,-1,0,2088,2089,5,116,0,0,2089, + 2097,6,94,-1,0,2090,2091,5,70,0,0,2091,2092,5,30,0,0,2092,2093,3,32,16, + 0,2093,2094,5,31,0,0,2094,2095,6,94,-1,0,2095,2097,1,0,0,0,2096,2078,1, + 0,0,0,2096,2080,1,0,0,0,2096,2082,1,0,0,0,2096,2084,1,0,0,0,2096,2086, + 1,0,0,0,2096,2088,1,0,0,0,2096,2090,1,0,0,0,2097,189,1,0,0,0,2098,2099, + 3,188,94,0,2099,2100,6,95,-1,0,2100,2102,1,0,0,0,2101,2098,1,0,0,0,2102, + 2105,1,0,0,0,2103,2101,1,0,0,0,2103,2104,1,0,0,0,2104,191,1,0,0,0,2105, + 2103,1,0,0,0,2106,2108,3,190,95,0,2107,2109,3,196,98,0,2108,2107,1,0,0, + 0,2108,2109,1,0,0,0,2109,2110,1,0,0,0,2110,2111,3,2,1,0,2111,2112,6,96, + -1,0,2112,193,1,0,0,0,2113,2114,3,192,96,0,2114,2115,6,97,-1,0,2115,2116, + 5,28,0,0,2116,2118,1,0,0,0,2117,2113,1,0,0,0,2118,2121,1,0,0,0,2119,2117, + 1,0,0,0,2119,2120,1,0,0,0,2120,2122,1,0,0,0,2121,2119,1,0,0,0,2122,2123, + 3,192,96,0,2123,2124,6,97,-1,0,2124,195,1,0,0,0,2125,2126,5,30,0,0,2126, + 2127,3,184,92,0,2127,2128,5,31,0,0,2128,2129,6,98,-1,0,2129,197,1,0,0, + 0,2130,2132,3,200,100,0,2131,2130,1,0,0,0,2131,2132,1,0,0,0,2132,2133, + 1,0,0,0,2133,2134,6,99,-1,0,2134,199,1,0,0,0,2135,2136,5,86,0,0,2136,2137, + 5,42,0,0,2137,2138,3,32,16,0,2138,2139,5,43,0,0,2139,2140,5,87,0,0,2140, + 2141,6,100,-1,0,2141,201,1,0,0,0,2142,2143,3,238,119,0,2143,2144,5,17, + 0,0,2144,2145,3,250,125,0,2145,2146,5,18,0,0,2146,2293,1,0,0,0,2147,2148, + 3,76,38,0,2148,2149,5,17,0,0,2149,2150,3,84,42,0,2150,2151,5,18,0,0,2151, + 2293,1,0,0,0,2152,2153,3,214,107,0,2153,2154,6,101,-1,0,2154,2155,5,17, + 0,0,2155,2156,3,218,109,0,2156,2157,5,18,0,0,2157,2293,1,0,0,0,2158,2159, + 3,222,111,0,2159,2160,6,101,-1,0,2160,2161,5,17,0,0,2161,2162,3,226,113, + 0,2162,2163,5,18,0,0,2163,2293,1,0,0,0,2164,2293,3,204,102,0,2165,2166, + 3,288,144,0,2166,2167,6,101,-1,0,2167,2293,1,0,0,0,2168,2169,3,156,78, + 0,2169,2170,6,101,-1,0,2170,2293,1,0,0,0,2171,2172,3,90,45,0,2172,2173, + 6,101,-1,0,2173,2293,1,0,0,0,2174,2175,3,334,167,0,2175,2176,6,101,-1, + 0,2176,2293,1,0,0,0,2177,2178,5,117,0,0,2178,2179,3,32,16,0,2179,2180, + 6,101,-1,0,2180,2293,1,0,0,0,2181,2182,5,118,0,0,2182,2183,3,32,16,0,2183, + 2184,6,101,-1,0,2184,2293,1,0,0,0,2185,2186,3,350,175,0,2186,2187,5,17, + 0,0,2187,2188,3,356,178,0,2188,2189,5,18,0,0,2189,2190,6,101,-1,0,2190, + 2293,1,0,0,0,2191,2192,5,301,0,0,2192,2193,3,128,64,0,2193,2194,5,175, + 0,0,2194,2195,3,246,123,0,2195,2196,5,119,0,0,2196,2197,3,174,87,0,2197, + 2198,3,142,71,0,2198,2199,3,128,64,0,2199,2200,5,175,0,0,2200,2201,3,246, + 123,0,2201,2202,3,114,57,0,2202,2203,6,101,-1,0,2203,2293,1,0,0,0,2204, + 2205,5,301,0,0,2205,2206,5,225,0,0,2206,2207,3,174,87,0,2207,2208,3,142, + 71,0,2208,2209,3,128,64,0,2209,2210,5,175,0,0,2210,2211,3,246,123,0,2211, + 2212,3,198,99,0,2212,2213,3,114,57,0,2213,2214,5,119,0,0,2214,2215,5,225, + 0,0,2215,2216,3,174,87,0,2216,2217,3,142,71,0,2217,2218,3,128,64,0,2218, + 2219,5,175,0,0,2219,2220,3,246,123,0,2220,2221,3,198,99,0,2221,2222,3, + 114,57,0,2222,2223,6,101,-1,0,2223,2293,1,0,0,0,2224,2225,3,26,13,0,2225, + 2226,6,101,-1,0,2226,2293,1,0,0,0,2227,2228,3,40,20,0,2228,2229,6,101, + -1,0,2229,2293,1,0,0,0,2230,2231,5,254,0,0,2231,2232,5,195,0,0,2232,2233, + 5,42,0,0,2233,2234,3,32,16,0,2234,2235,5,43,0,0,2235,2241,6,101,-1,0,2236, + 2237,3,334,167,0,2237,2238,6,101,-1,0,2238,2240,1,0,0,0,2239,2236,1,0, + 0,0,2240,2243,1,0,0,0,2241,2239,1,0,0,0,2241,2242,1,0,0,0,2242,2293,1, + 0,0,0,2243,2241,1,0,0,0,2244,2245,5,254,0,0,2245,2246,5,195,0,0,2246,2247, + 3,2,1,0,2247,2253,6,101,-1,0,2248,2249,3,334,167,0,2249,2250,6,101,-1, + 0,2250,2252,1,0,0,0,2251,2248,1,0,0,0,2252,2255,1,0,0,0,2253,2251,1,0, + 0,0,2253,2254,1,0,0,0,2254,2293,1,0,0,0,2255,2253,1,0,0,0,2256,2257,5, + 254,0,0,2257,2258,5,255,0,0,2258,2259,5,42,0,0,2259,2260,3,32,16,0,2260, + 2261,5,43,0,0,2261,2262,5,28,0,0,2262,2263,3,126,63,0,2263,2269,6,101, + -1,0,2264,2265,3,334,167,0,2265,2266,6,101,-1,0,2266,2268,1,0,0,0,2267, + 2264,1,0,0,0,2268,2271,1,0,0,0,2269,2267,1,0,0,0,2269,2270,1,0,0,0,2270, + 2293,1,0,0,0,2271,2269,1,0,0,0,2272,2273,5,254,0,0,2273,2274,5,255,0,0, + 2274,2275,3,2,1,0,2275,2276,5,28,0,0,2276,2277,3,126,63,0,2277,2283,6, + 101,-1,0,2278,2279,3,334,167,0,2279,2280,6,101,-1,0,2280,2282,1,0,0,0, + 2281,2278,1,0,0,0,2282,2285,1,0,0,0,2283,2281,1,0,0,0,2283,2284,1,0,0, + 0,2284,2293,1,0,0,0,2285,2283,1,0,0,0,2286,2287,5,120,0,0,2287,2288,5, + 195,0,0,2288,2289,3,126,63,0,2289,2290,3,44,22,0,2290,2291,6,101,-1,0, + 2291,2293,1,0,0,0,2292,2142,1,0,0,0,2292,2147,1,0,0,0,2292,2152,1,0,0, + 0,2292,2158,1,0,0,0,2292,2164,1,0,0,0,2292,2165,1,0,0,0,2292,2168,1,0, + 0,0,2292,2171,1,0,0,0,2292,2174,1,0,0,0,2292,2177,1,0,0,0,2292,2181,1, + 0,0,0,2292,2185,1,0,0,0,2292,2191,1,0,0,0,2292,2204,1,0,0,0,2292,2224, + 1,0,0,0,2292,2227,1,0,0,0,2292,2230,1,0,0,0,2292,2244,1,0,0,0,2292,2256, + 1,0,0,0,2292,2272,1,0,0,0,2292,2286,1,0,0,0,2293,203,1,0,0,0,2294,2295, + 5,121,0,0,2295,2307,3,212,106,0,2296,2297,3,206,103,0,2297,2298,6,102, + -1,0,2298,2306,1,0,0,0,2299,2300,5,122,0,0,2300,2301,5,30,0,0,2301,2302, + 3,232,116,0,2302,2303,5,31,0,0,2303,2304,6,102,-1,0,2304,2306,1,0,0,0, + 2305,2296,1,0,0,0,2305,2299,1,0,0,0,2306,2309,1,0,0,0,2307,2305,1,0,0, + 0,2307,2308,1,0,0,0,2308,2310,1,0,0,0,2309,2307,1,0,0,0,2310,2311,3,142, + 71,0,2311,2312,3,2,1,0,2312,2313,3,208,104,0,2313,2314,3,210,105,0,2314, + 2315,6,102,-1,0,2315,205,1,0,0,0,2316,2317,5,123,0,0,2317,2351,6,103,-1, + 0,2318,2319,5,51,0,0,2319,2351,6,103,-1,0,2320,2321,5,52,0,0,2321,2351, + 6,103,-1,0,2322,2323,5,63,0,0,2323,2351,6,103,-1,0,2324,2325,5,124,0,0, + 2325,2351,6,103,-1,0,2326,2327,5,69,0,0,2327,2351,6,103,-1,0,2328,2329, + 5,68,0,0,2329,2351,6,103,-1,0,2330,2331,5,64,0,0,2331,2351,6,103,-1,0, + 2332,2333,5,65,0,0,2333,2351,6,103,-1,0,2334,2335,5,66,0,0,2335,2351,6, + 103,-1,0,2336,2337,5,125,0,0,2337,2351,6,103,-1,0,2338,2339,5,126,0,0, + 2339,2351,6,103,-1,0,2340,2341,5,127,0,0,2341,2351,6,103,-1,0,2342,2343, + 5,16,0,0,2343,2351,6,103,-1,0,2344,2345,5,70,0,0,2345,2346,5,30,0,0,2346, + 2347,3,32,16,0,2347,2348,5,31,0,0,2348,2349,6,103,-1,0,2349,2351,1,0,0, + 0,2350,2316,1,0,0,0,2350,2318,1,0,0,0,2350,2320,1,0,0,0,2350,2322,1,0, + 0,0,2350,2324,1,0,0,0,2350,2326,1,0,0,0,2350,2328,1,0,0,0,2350,2330,1, + 0,0,0,2350,2332,1,0,0,0,2350,2334,1,0,0,0,2350,2336,1,0,0,0,2350,2338, + 1,0,0,0,2350,2340,1,0,0,0,2350,2342,1,0,0,0,2350,2344,1,0,0,0,2351,207, + 1,0,0,0,2352,2362,1,0,0,0,2353,2354,5,44,0,0,2354,2355,3,0,0,0,2355,2356, + 6,104,-1,0,2356,2362,1,0,0,0,2357,2358,5,44,0,0,2358,2359,3,32,16,0,2359, + 2360,6,104,-1,0,2360,2362,1,0,0,0,2361,2352,1,0,0,0,2361,2353,1,0,0,0, + 2361,2357,1,0,0,0,2362,209,1,0,0,0,2363,2369,1,0,0,0,2364,2365,5,36,0, + 0,2365,2366,3,308,154,0,2366,2367,6,105,-1,0,2367,2369,1,0,0,0,2368,2363, + 1,0,0,0,2368,2364,1,0,0,0,2369,211,1,0,0,0,2370,2377,1,0,0,0,2371,2372, + 5,42,0,0,2372,2373,3,32,16,0,2373,2374,5,43,0,0,2374,2375,6,106,-1,0,2375, + 2377,1,0,0,0,2376,2370,1,0,0,0,2376,2371,1,0,0,0,2377,213,1,0,0,0,2378, + 2384,5,128,0,0,2379,2380,3,216,108,0,2380,2381,6,107,-1,0,2381,2383,1, + 0,0,0,2382,2379,1,0,0,0,2383,2386,1,0,0,0,2384,2382,1,0,0,0,2384,2385, + 1,0,0,0,2385,2387,1,0,0,0,2386,2384,1,0,0,0,2387,2388,3,126,63,0,2388, + 2389,3,2,1,0,2389,2390,6,107,-1,0,2390,2404,1,0,0,0,2391,2397,5,128,0, + 0,2392,2393,3,216,108,0,2393,2394,6,107,-1,0,2394,2396,1,0,0,0,2395,2392, + 1,0,0,0,2396,2399,1,0,0,0,2397,2395,1,0,0,0,2397,2398,1,0,0,0,2398,2400, + 1,0,0,0,2399,2397,1,0,0,0,2400,2401,3,2,1,0,2401,2402,6,107,-1,0,2402, + 2404,1,0,0,0,2403,2378,1,0,0,0,2403,2391,1,0,0,0,2404,215,1,0,0,0,2405, + 2406,5,69,0,0,2406,2410,6,108,-1,0,2407,2408,5,68,0,0,2408,2410,6,108, + -1,0,2409,2405,1,0,0,0,2409,2407,1,0,0,0,2410,217,1,0,0,0,2411,2413,3, + 220,110,0,2412,2411,1,0,0,0,2413,2416,1,0,0,0,2414,2412,1,0,0,0,2414,2415, + 1,0,0,0,2415,219,1,0,0,0,2416,2414,1,0,0,0,2417,2418,5,129,0,0,2418,2419, + 3,172,86,0,2419,2420,6,110,-1,0,2420,2444,1,0,0,0,2421,2422,5,130,0,0, + 2422,2423,3,172,86,0,2423,2424,6,110,-1,0,2424,2444,1,0,0,0,2425,2426, + 5,131,0,0,2426,2427,3,172,86,0,2427,2428,6,110,-1,0,2428,2444,1,0,0,0, + 2429,2430,5,132,0,0,2430,2431,3,172,86,0,2431,2432,6,110,-1,0,2432,2444, + 1,0,0,0,2433,2434,3,90,45,0,2434,2435,6,110,-1,0,2435,2444,1,0,0,0,2436, + 2437,3,334,167,0,2437,2438,6,110,-1,0,2438,2444,1,0,0,0,2439,2440,3,26, + 13,0,2440,2441,6,110,-1,0,2441,2444,1,0,0,0,2442,2444,3,40,20,0,2443,2417, + 1,0,0,0,2443,2421,1,0,0,0,2443,2425,1,0,0,0,2443,2429,1,0,0,0,2443,2433, + 1,0,0,0,2443,2436,1,0,0,0,2443,2439,1,0,0,0,2443,2442,1,0,0,0,2444,221, + 1,0,0,0,2445,2451,5,133,0,0,2446,2447,3,224,112,0,2447,2448,6,111,-1,0, + 2448,2450,1,0,0,0,2449,2446,1,0,0,0,2450,2453,1,0,0,0,2451,2449,1,0,0, + 0,2451,2452,1,0,0,0,2452,2454,1,0,0,0,2453,2451,1,0,0,0,2454,2455,3,174, + 87,0,2455,2456,3,142,71,0,2456,2457,3,2,1,0,2457,2458,3,114,57,0,2458, + 2459,3,210,105,0,2459,2460,6,111,-1,0,2460,223,1,0,0,0,2461,2462,5,69, + 0,0,2462,2466,6,112,-1,0,2463,2464,5,68,0,0,2464,2466,6,112,-1,0,2465, + 2461,1,0,0,0,2465,2463,1,0,0,0,2466,225,1,0,0,0,2467,2469,3,228,114,0, + 2468,2467,1,0,0,0,2469,2472,1,0,0,0,2470,2468,1,0,0,0,2470,2471,1,0,0, + 0,2471,227,1,0,0,0,2472,2470,1,0,0,0,2473,2474,5,134,0,0,2474,2475,3,172, + 86,0,2475,2476,6,114,-1,0,2476,2496,1,0,0,0,2477,2478,5,135,0,0,2478,2479, + 3,172,86,0,2479,2480,6,114,-1,0,2480,2496,1,0,0,0,2481,2482,5,132,0,0, + 2482,2483,3,172,86,0,2483,2484,6,114,-1,0,2484,2496,1,0,0,0,2485,2486, + 3,334,167,0,2486,2487,6,114,-1,0,2487,2496,1,0,0,0,2488,2489,3,90,45,0, + 2489,2490,6,114,-1,0,2490,2496,1,0,0,0,2491,2492,3,26,13,0,2492,2493,6, + 114,-1,0,2493,2496,1,0,0,0,2494,2496,3,40,20,0,2495,2473,1,0,0,0,2495, + 2477,1,0,0,0,2495,2481,1,0,0,0,2495,2485,1,0,0,0,2495,2488,1,0,0,0,2495, + 2491,1,0,0,0,2495,2494,1,0,0,0,2496,229,1,0,0,0,2497,2505,6,115,-1,0,2498, + 2499,5,122,0,0,2499,2500,5,30,0,0,2500,2501,3,232,116,0,2501,2502,5,31, + 0,0,2502,2503,6,115,-1,0,2503,2505,1,0,0,0,2504,2497,1,0,0,0,2504,2498, + 1,0,0,0,2505,231,1,0,0,0,2506,2507,3,130,65,0,2507,2508,6,116,-1,0,2508, + 2520,1,0,0,0,2509,2513,5,17,0,0,2510,2511,3,306,153,0,2511,2512,6,116, + -1,0,2512,2514,1,0,0,0,2513,2510,1,0,0,0,2514,2515,1,0,0,0,2515,2513,1, + 0,0,0,2515,2516,1,0,0,0,2516,2517,1,0,0,0,2517,2518,5,18,0,0,2518,2520, + 1,0,0,0,2519,2506,1,0,0,0,2519,2509,1,0,0,0,2520,233,1,0,0,0,2521,2522, + 3,236,118,0,2522,2523,6,117,-1,0,2523,2525,1,0,0,0,2524,2521,1,0,0,0,2525, + 2528,1,0,0,0,2526,2524,1,0,0,0,2526,2527,1,0,0,0,2527,235,1,0,0,0,2528, + 2526,1,0,0,0,2529,2530,5,42,0,0,2530,2531,5,136,0,0,2531,2532,5,43,0,0, + 2532,2547,6,118,-1,0,2533,2534,5,42,0,0,2534,2535,5,137,0,0,2535,2536, + 5,43,0,0,2536,2547,6,118,-1,0,2537,2538,5,42,0,0,2538,2539,5,138,0,0,2539, + 2540,5,43,0,0,2540,2547,6,118,-1,0,2541,2542,5,42,0,0,2542,2543,3,32,16, + 0,2543,2544,5,43,0,0,2544,2545,6,118,-1,0,2545,2547,1,0,0,0,2546,2529, + 1,0,0,0,2546,2533,1,0,0,0,2546,2537,1,0,0,0,2546,2541,1,0,0,0,2547,237, + 1,0,0,0,2548,2557,5,139,0,0,2549,2550,3,240,120,0,2550,2551,6,119,-1,0, + 2551,2556,1,0,0,0,2552,2553,3,242,121,0,2553,2554,6,119,-1,0,2554,2556, + 1,0,0,0,2555,2549,1,0,0,0,2555,2552,1,0,0,0,2556,2559,1,0,0,0,2557,2555, + 1,0,0,0,2557,2558,1,0,0,0,2558,2560,1,0,0,0,2559,2557,1,0,0,0,2560,2561, + 3,174,87,0,2561,2562,3,234,117,0,2562,2563,3,142,71,0,2563,2564,3,230, + 115,0,2564,2565,3,246,123,0,2565,2566,3,186,93,0,2566,2572,3,114,57,0, + 2567,2568,3,248,124,0,2568,2569,6,119,-1,0,2569,2571,1,0,0,0,2570,2567, + 1,0,0,0,2571,2574,1,0,0,0,2572,2570,1,0,0,0,2572,2573,1,0,0,0,2573,2575, + 1,0,0,0,2574,2572,1,0,0,0,2575,2576,6,119,-1,0,2576,239,1,0,0,0,2577,2578, + 5,123,0,0,2578,2620,6,120,-1,0,2579,2580,5,51,0,0,2580,2620,6,120,-1,0, + 2581,2582,5,52,0,0,2582,2620,6,120,-1,0,2583,2584,5,63,0,0,2584,2620,6, + 120,-1,0,2585,2586,5,140,0,0,2586,2620,6,120,-1,0,2587,2588,5,68,0,0,2588, + 2620,6,120,-1,0,2589,2590,5,141,0,0,2590,2620,6,120,-1,0,2591,2592,5,142, + 0,0,2592,2620,6,120,-1,0,2593,2594,5,54,0,0,2594,2620,6,120,-1,0,2595, + 2596,5,64,0,0,2596,2620,6,120,-1,0,2597,2598,5,65,0,0,2598,2620,6,120, + -1,0,2599,2600,5,66,0,0,2600,2620,6,120,-1,0,2601,2602,5,125,0,0,2602, + 2620,6,120,-1,0,2603,2604,5,143,0,0,2604,2620,6,120,-1,0,2605,2606,5,144, + 0,0,2606,2620,6,120,-1,0,2607,2608,5,69,0,0,2608,2620,6,120,-1,0,2609, + 2610,5,145,0,0,2610,2620,6,120,-1,0,2611,2612,5,146,0,0,2612,2620,6,120, + -1,0,2613,2614,5,70,0,0,2614,2615,5,30,0,0,2615,2616,3,32,16,0,2616,2617, + 5,31,0,0,2617,2618,6,120,-1,0,2618,2620,1,0,0,0,2619,2577,1,0,0,0,2619, + 2579,1,0,0,0,2619,2581,1,0,0,0,2619,2583,1,0,0,0,2619,2585,1,0,0,0,2619, + 2587,1,0,0,0,2619,2589,1,0,0,0,2619,2591,1,0,0,0,2619,2593,1,0,0,0,2619, + 2595,1,0,0,0,2619,2597,1,0,0,0,2619,2599,1,0,0,0,2619,2601,1,0,0,0,2619, + 2603,1,0,0,0,2619,2605,1,0,0,0,2619,2607,1,0,0,0,2619,2609,1,0,0,0,2619, + 2611,1,0,0,0,2619,2613,1,0,0,0,2620,241,1,0,0,0,2621,2622,5,147,0,0,2622, + 2631,5,30,0,0,2623,2624,3,6,3,0,2624,2629,6,121,-1,0,2625,2626,5,34,0, + 0,2626,2627,3,6,3,0,2627,2628,6,121,-1,0,2628,2630,1,0,0,0,2629,2625,1, + 0,0,0,2629,2630,1,0,0,0,2630,2632,1,0,0,0,2631,2623,1,0,0,0,2631,2632, + 1,0,0,0,2632,2638,1,0,0,0,2633,2634,3,244,122,0,2634,2635,6,121,-1,0,2635, + 2637,1,0,0,0,2636,2633,1,0,0,0,2637,2640,1,0,0,0,2638,2636,1,0,0,0,2638, + 2639,1,0,0,0,2639,2641,1,0,0,0,2640,2638,1,0,0,0,2641,2645,5,31,0,0,2642, + 2643,5,147,0,0,2643,2645,5,85,0,0,2644,2621,1,0,0,0,2644,2642,1,0,0,0, + 2645,243,1,0,0,0,2646,2647,5,148,0,0,2647,2689,6,122,-1,0,2648,2649,5, + 223,0,0,2649,2689,6,122,-1,0,2650,2651,5,57,0,0,2651,2689,6,122,-1,0,2652, + 2653,5,58,0,0,2653,2689,6,122,-1,0,2654,2655,5,149,0,0,2655,2689,6,122, + -1,0,2656,2657,5,150,0,0,2657,2689,6,122,-1,0,2658,2659,5,247,0,0,2659, + 2689,6,122,-1,0,2660,2661,5,248,0,0,2661,2689,6,122,-1,0,2662,2663,5,249, + 0,0,2663,2689,6,122,-1,0,2664,2665,5,250,0,0,2665,2689,6,122,-1,0,2666, + 2667,5,151,0,0,2667,2668,5,75,0,0,2668,2669,5,152,0,0,2669,2689,6,122, + -1,0,2670,2671,5,151,0,0,2671,2672,5,75,0,0,2672,2673,5,153,0,0,2673,2689, + 6,122,-1,0,2674,2675,5,154,0,0,2675,2676,5,75,0,0,2676,2677,5,152,0,0, + 2677,2689,6,122,-1,0,2678,2679,5,154,0,0,2679,2680,5,75,0,0,2680,2681, + 5,153,0,0,2681,2689,6,122,-1,0,2682,2683,5,70,0,0,2683,2684,5,30,0,0,2684, + 2685,3,32,16,0,2685,2686,5,31,0,0,2686,2687,6,122,-1,0,2687,2689,1,0,0, + 0,2688,2646,1,0,0,0,2688,2648,1,0,0,0,2688,2650,1,0,0,0,2688,2652,1,0, + 0,0,2688,2654,1,0,0,0,2688,2656,1,0,0,0,2688,2658,1,0,0,0,2688,2660,1, + 0,0,0,2688,2662,1,0,0,0,2688,2664,1,0,0,0,2688,2666,1,0,0,0,2688,2670, + 1,0,0,0,2688,2674,1,0,0,0,2688,2678,1,0,0,0,2688,2682,1,0,0,0,2689,245, + 1,0,0,0,2690,2691,5,116,0,0,2691,2698,6,123,-1,0,2692,2693,5,155,0,0,2693, + 2698,6,123,-1,0,2694,2695,3,2,1,0,2695,2696,6,123,-1,0,2696,2698,1,0,0, + 0,2697,2690,1,0,0,0,2697,2692,1,0,0,0,2697,2694,1,0,0,0,2698,247,1,0,0, + 0,2699,2700,5,1,0,0,2700,2738,6,124,-1,0,2701,2702,5,2,0,0,2702,2738,6, + 124,-1,0,2703,2704,5,156,0,0,2704,2738,6,124,-1,0,2705,2706,5,3,0,0,2706, + 2738,6,124,-1,0,2707,2708,5,4,0,0,2708,2738,6,124,-1,0,2709,2710,5,246, + 0,0,2710,2738,6,124,-1,0,2711,2712,5,5,0,0,2712,2738,6,124,-1,0,2713,2714, + 5,6,0,0,2714,2738,6,124,-1,0,2715,2716,5,7,0,0,2716,2738,6,124,-1,0,2717, + 2718,5,8,0,0,2718,2738,6,124,-1,0,2719,2720,5,9,0,0,2720,2738,6,124,-1, + 0,2721,2722,5,10,0,0,2722,2738,6,124,-1,0,2723,2724,5,11,0,0,2724,2738, + 6,124,-1,0,2725,2726,5,12,0,0,2726,2738,6,124,-1,0,2727,2728,5,13,0,0, + 2728,2738,6,124,-1,0,2729,2730,5,14,0,0,2730,2738,6,124,-1,0,2731,2732, + 5,70,0,0,2732,2733,5,30,0,0,2733,2734,3,32,16,0,2734,2735,5,31,0,0,2735, + 2736,6,124,-1,0,2736,2738,1,0,0,0,2737,2699,1,0,0,0,2737,2701,1,0,0,0, + 2737,2703,1,0,0,0,2737,2705,1,0,0,0,2737,2707,1,0,0,0,2737,2709,1,0,0, + 0,2737,2711,1,0,0,0,2737,2713,1,0,0,0,2737,2715,1,0,0,0,2737,2717,1,0, + 0,0,2737,2719,1,0,0,0,2737,2721,1,0,0,0,2737,2723,1,0,0,0,2737,2725,1, + 0,0,0,2737,2727,1,0,0,0,2737,2729,1,0,0,0,2737,2731,1,0,0,0,2738,249,1, + 0,0,0,2739,2741,3,252,126,0,2740,2739,1,0,0,0,2741,2744,1,0,0,0,2742,2740, + 1,0,0,0,2742,2743,1,0,0,0,2743,251,1,0,0,0,2744,2742,1,0,0,0,2745,2783, + 3,102,51,0,2746,2747,5,295,0,0,2747,2748,3,32,16,0,2748,2749,6,126,-1, + 0,2749,2783,1,0,0,0,2750,2783,3,270,135,0,2751,2752,5,296,0,0,2752,2753, + 3,32,16,0,2753,2754,6,126,-1,0,2754,2783,1,0,0,0,2755,2756,5,297,0,0,2756, + 2783,6,126,-1,0,2757,2758,5,298,0,0,2758,2783,6,126,-1,0,2759,2783,3,264, + 132,0,2760,2783,3,268,134,0,2761,2783,3,254,127,0,2762,2763,3,288,144, + 0,2763,2764,6,126,-1,0,2764,2783,1,0,0,0,2765,2766,3,156,78,0,2766,2767, + 6,126,-1,0,2767,2783,1,0,0,0,2768,2769,3,90,45,0,2769,2770,6,126,-1,0, + 2770,2783,1,0,0,0,2771,2772,3,26,13,0,2772,2773,6,126,-1,0,2773,2783,1, + 0,0,0,2774,2775,3,266,133,0,2775,2776,6,126,-1,0,2776,2783,1,0,0,0,2777, + 2783,3,40,20,0,2778,2783,3,256,128,0,2779,2783,3,258,129,0,2780,2783,3, + 260,130,0,2781,2783,3,262,131,0,2782,2745,1,0,0,0,2782,2746,1,0,0,0,2782, + 2750,1,0,0,0,2782,2751,1,0,0,0,2782,2755,1,0,0,0,2782,2757,1,0,0,0,2782, + 2759,1,0,0,0,2782,2760,1,0,0,0,2782,2761,1,0,0,0,2782,2762,1,0,0,0,2782, + 2765,1,0,0,0,2782,2768,1,0,0,0,2782,2771,1,0,0,0,2782,2774,1,0,0,0,2782, + 2777,1,0,0,0,2782,2778,1,0,0,0,2782,2779,1,0,0,0,2782,2780,1,0,0,0,2782, + 2781,1,0,0,0,2783,253,1,0,0,0,2784,2786,5,299,0,0,2785,2787,5,157,0,0, + 2786,2785,1,0,0,0,2786,2787,1,0,0,0,2787,2788,1,0,0,0,2788,2789,3,114, + 57,0,2789,255,1,0,0,0,2790,2791,5,300,0,0,2791,2792,5,42,0,0,2792,2793, + 3,32,16,0,2793,2796,5,43,0,0,2794,2795,5,34,0,0,2795,2797,3,0,0,0,2796, + 2794,1,0,0,0,2796,2797,1,0,0,0,2797,257,1,0,0,0,2798,2799,5,302,0,0,2799, + 2800,3,32,16,0,2800,2801,5,75,0,0,2801,2802,3,32,16,0,2802,259,1,0,0,0, + 2803,2804,5,301,0,0,2804,2805,3,128,64,0,2805,2806,5,175,0,0,2806,2807, + 3,246,123,0,2807,2819,1,0,0,0,2808,2809,5,301,0,0,2809,2810,5,225,0,0, + 2810,2811,3,174,87,0,2811,2812,3,142,71,0,2812,2813,3,128,64,0,2813,2814, + 5,175,0,0,2814,2815,3,246,123,0,2815,2816,3,198,99,0,2816,2817,3,114,57, + 0,2817,2819,1,0,0,0,2818,2803,1,0,0,0,2818,2808,1,0,0,0,2819,261,1,0,0, + 0,2820,2821,5,254,0,0,2821,2822,5,195,0,0,2822,2823,5,42,0,0,2823,2824, + 3,32,16,0,2824,2830,5,43,0,0,2825,2826,3,334,167,0,2826,2827,6,131,-1, + 0,2827,2829,1,0,0,0,2828,2825,1,0,0,0,2829,2832,1,0,0,0,2830,2828,1,0, + 0,0,2830,2831,1,0,0,0,2831,2886,1,0,0,0,2832,2830,1,0,0,0,2833,2834,5, + 254,0,0,2834,2835,5,195,0,0,2835,2841,3,2,1,0,2836,2837,3,334,167,0,2837, + 2838,6,131,-1,0,2838,2840,1,0,0,0,2839,2836,1,0,0,0,2840,2843,1,0,0,0, + 2841,2839,1,0,0,0,2841,2842,1,0,0,0,2842,2886,1,0,0,0,2843,2841,1,0,0, + 0,2844,2845,5,254,0,0,2845,2846,5,255,0,0,2846,2847,5,42,0,0,2847,2848, + 3,32,16,0,2848,2849,5,43,0,0,2849,2850,5,28,0,0,2850,2856,3,126,63,0,2851, + 2852,3,334,167,0,2852,2853,6,131,-1,0,2853,2855,1,0,0,0,2854,2851,1,0, + 0,0,2855,2858,1,0,0,0,2856,2854,1,0,0,0,2856,2857,1,0,0,0,2857,2886,1, + 0,0,0,2858,2856,1,0,0,0,2859,2860,5,254,0,0,2860,2861,5,255,0,0,2861,2862, + 3,2,1,0,2862,2863,5,28,0,0,2863,2869,3,126,63,0,2864,2865,3,334,167,0, + 2865,2866,6,131,-1,0,2866,2868,1,0,0,0,2867,2864,1,0,0,0,2868,2871,1,0, + 0,0,2869,2867,1,0,0,0,2869,2870,1,0,0,0,2870,2886,1,0,0,0,2871,2869,1, + 0,0,0,2872,2873,5,254,0,0,2873,2874,5,42,0,0,2874,2875,3,32,16,0,2875, + 2876,5,43,0,0,2876,2882,3,210,105,0,2877,2878,3,334,167,0,2878,2879,6, + 131,-1,0,2879,2881,1,0,0,0,2880,2877,1,0,0,0,2881,2884,1,0,0,0,2882,2880, + 1,0,0,0,2882,2883,1,0,0,0,2883,2886,1,0,0,0,2884,2882,1,0,0,0,2885,2820, + 1,0,0,0,2885,2833,1,0,0,0,2885,2844,1,0,0,0,2885,2859,1,0,0,0,2885,2872, + 1,0,0,0,2886,263,1,0,0,0,2887,2888,3,0,0,0,2888,2889,5,75,0,0,2889,2890, + 6,132,-1,0,2890,265,1,0,0,0,2891,2892,3,44,22,0,2892,2893,6,133,-1,0,2893, + 2898,1,0,0,0,2894,2895,3,46,23,0,2895,2896,6,133,-1,0,2896,2898,1,0,0, + 0,2897,2891,1,0,0,0,2897,2894,1,0,0,0,2898,267,1,0,0,0,2899,2900,5,17, + 0,0,2900,2901,3,250,125,0,2901,2902,5,18,0,0,2902,269,1,0,0,0,2903,2904, + 3,274,137,0,2904,2905,3,272,136,0,2905,271,1,0,0,0,2906,2907,3,276,138, + 0,2907,2908,6,136,-1,0,2908,2910,1,0,0,0,2909,2906,1,0,0,0,2910,2911,1, + 0,0,0,2911,2909,1,0,0,0,2911,2912,1,0,0,0,2912,273,1,0,0,0,2913,2914,5, + 158,0,0,2914,2915,3,268,134,0,2915,2916,6,137,-1,0,2916,2930,1,0,0,0,2917, + 2918,5,158,0,0,2918,2919,3,0,0,0,2919,2920,5,159,0,0,2920,2921,3,0,0,0, + 2921,2922,6,137,-1,0,2922,2930,1,0,0,0,2923,2924,5,158,0,0,2924,2925,3, + 32,16,0,2925,2926,5,159,0,0,2926,2927,3,32,16,0,2927,2928,6,137,-1,0,2928, + 2930,1,0,0,0,2929,2913,1,0,0,0,2929,2917,1,0,0,0,2929,2923,1,0,0,0,2930, + 275,1,0,0,0,2931,2932,3,280,140,0,2932,2933,3,286,143,0,2933,2934,6,138, + -1,0,2934,2948,1,0,0,0,2935,2936,3,278,139,0,2936,2937,3,286,143,0,2937, + 2938,6,138,-1,0,2938,2948,1,0,0,0,2939,2940,3,282,141,0,2940,2941,3,286, + 143,0,2941,2942,6,138,-1,0,2942,2948,1,0,0,0,2943,2944,3,284,142,0,2944, + 2945,3,286,143,0,2945,2946,6,138,-1,0,2946,2948,1,0,0,0,2947,2931,1,0, + 0,0,2947,2935,1,0,0,0,2947,2939,1,0,0,0,2947,2943,1,0,0,0,2948,277,1,0, + 0,0,2949,2950,5,160,0,0,2950,2951,3,268,134,0,2951,2952,6,139,-1,0,2952, + 2962,1,0,0,0,2953,2954,5,160,0,0,2954,2955,3,0,0,0,2955,2956,6,139,-1, + 0,2956,2962,1,0,0,0,2957,2958,5,160,0,0,2958,2959,3,32,16,0,2959,2960, + 6,139,-1,0,2960,2962,1,0,0,0,2961,2949,1,0,0,0,2961,2953,1,0,0,0,2961, + 2957,1,0,0,0,2962,279,1,0,0,0,2963,2964,5,161,0,0,2964,2965,3,126,63,0, + 2965,281,1,0,0,0,2966,2967,5,162,0,0,2967,283,1,0,0,0,2968,2969,5,163, + 0,0,2969,285,1,0,0,0,2970,2971,3,268,134,0,2971,2972,6,143,-1,0,2972,2986, + 1,0,0,0,2973,2974,5,164,0,0,2974,2975,3,0,0,0,2975,2976,5,159,0,0,2976, + 2977,3,0,0,0,2977,2978,6,143,-1,0,2978,2986,1,0,0,0,2979,2980,5,164,0, + 0,2980,2981,3,32,16,0,2981,2982,5,159,0,0,2982,2983,3,32,16,0,2983,2984, + 6,143,-1,0,2984,2986,1,0,0,0,2985,2970,1,0,0,0,2985,2973,1,0,0,0,2985, + 2979,1,0,0,0,2986,287,1,0,0,0,2987,2988,3,290,145,0,2988,2989,3,294,147, + 0,2989,289,1,0,0,0,2990,2991,5,165,0,0,2991,2992,3,292,146,0,2992,2993, + 3,0,0,0,2993,2994,5,36,0,0,2994,2995,6,145,-1,0,2995,3001,1,0,0,0,2996, + 2997,5,165,0,0,2997,2998,3,292,146,0,2998,2999,6,145,-1,0,2999,3001,1, + 0,0,0,3000,2990,1,0,0,0,3000,2996,1,0,0,0,3001,291,1,0,0,0,3002,3008,1, + 0,0,0,3003,3004,5,166,0,0,3004,3008,6,146,-1,0,3005,3006,5,2,0,0,3006, + 3008,6,146,-1,0,3007,3002,1,0,0,0,3007,3003,1,0,0,0,3007,3005,1,0,0,0, + 3008,293,1,0,0,0,3009,3010,5,17,0,0,3010,3011,3,296,148,0,3011,3012,5, + 18,0,0,3012,3019,1,0,0,0,3013,3015,3,300,150,0,3014,3013,1,0,0,0,3015, + 3016,1,0,0,0,3016,3014,1,0,0,0,3016,3017,1,0,0,0,3017,3019,1,0,0,0,3018, + 3009,1,0,0,0,3018,3014,1,0,0,0,3019,295,1,0,0,0,3020,3021,3,300,150,0, + 3021,3022,5,28,0,0,3022,3024,1,0,0,0,3023,3020,1,0,0,0,3024,3027,1,0,0, + 0,3025,3023,1,0,0,0,3025,3026,1,0,0,0,3026,3028,1,0,0,0,3027,3025,1,0, + 0,0,3028,3029,3,300,150,0,3029,297,1,0,0,0,3030,3037,1,0,0,0,3031,3032, + 5,42,0,0,3032,3033,3,32,16,0,3033,3034,5,43,0,0,3034,3035,6,149,-1,0,3035, + 3037,1,0,0,0,3036,3030,1,0,0,0,3036,3031,1,0,0,0,3037,299,1,0,0,0,3038, + 3039,5,180,0,0,3039,3040,5,261,0,0,3040,3041,5,30,0,0,3041,3042,3,6,3, + 0,3042,3043,5,31,0,0,3043,3044,6,150,-1,0,3044,3087,1,0,0,0,3045,3046, + 5,259,0,0,3046,3047,5,30,0,0,3047,3048,3,0,0,0,3048,3049,5,31,0,0,3049, + 3050,6,150,-1,0,3050,3087,1,0,0,0,3051,3052,5,259,0,0,3052,3053,3,0,0, + 0,3053,3054,6,150,-1,0,3054,3087,1,0,0,0,3055,3056,5,84,0,0,3056,3057, + 5,30,0,0,3057,3058,3,304,152,0,3058,3059,5,31,0,0,3059,3060,6,150,-1,0, + 3060,3087,1,0,0,0,3061,3062,7,11,0,0,3062,3063,5,30,0,0,3063,3064,3,36, + 18,0,3064,3065,5,31,0,0,3065,3066,3,298,149,0,3066,3067,6,150,-1,0,3067, + 3087,1,0,0,0,3068,3069,5,186,0,0,3069,3070,5,30,0,0,3070,3071,3,34,17, + 0,3071,3072,5,31,0,0,3072,3073,3,298,149,0,3073,3074,6,150,-1,0,3074,3087, + 1,0,0,0,3075,3076,7,12,0,0,3076,3077,5,30,0,0,3077,3078,3,32,16,0,3078, + 3079,5,31,0,0,3079,3080,3,298,149,0,3080,3081,6,150,-1,0,3081,3087,1,0, + 0,0,3082,3083,7,13,0,0,3083,3084,3,298,149,0,3084,3085,6,150,-1,0,3085, + 3087,1,0,0,0,3086,3038,1,0,0,0,3086,3045,1,0,0,0,3086,3051,1,0,0,0,3086, + 3055,1,0,0,0,3086,3061,1,0,0,0,3086,3068,1,0,0,0,3086,3075,1,0,0,0,3086, + 3082,1,0,0,0,3087,301,1,0,0,0,3088,3089,5,187,0,0,3089,3090,5,30,0,0,3090, + 3091,3,36,18,0,3091,3092,5,31,0,0,3092,3093,6,151,-1,0,3093,3179,1,0,0, + 0,3094,3095,5,188,0,0,3095,3096,5,30,0,0,3096,3097,3,36,18,0,3097,3098, + 5,31,0,0,3098,3099,6,151,-1,0,3099,3179,1,0,0,0,3100,3101,5,187,0,0,3101, + 3102,5,30,0,0,3102,3103,3,32,16,0,3103,3104,5,31,0,0,3104,3105,6,151,-1, + 0,3105,3179,1,0,0,0,3106,3107,5,188,0,0,3107,3108,5,30,0,0,3108,3109,3, + 34,17,0,3109,3110,5,31,0,0,3110,3111,6,151,-1,0,3111,3179,1,0,0,0,3112, + 3113,5,186,0,0,3113,3114,5,30,0,0,3114,3115,3,34,17,0,3115,3116,5,31,0, + 0,3116,3117,6,151,-1,0,3117,3179,1,0,0,0,3118,3119,5,185,0,0,3119,3120, + 5,30,0,0,3120,3121,3,32,16,0,3121,3122,5,31,0,0,3122,3123,6,151,-1,0,3123, + 3179,1,0,0,0,3124,3125,5,184,0,0,3125,3126,5,30,0,0,3126,3127,3,32,16, + 0,3127,3128,5,31,0,0,3128,3129,6,151,-1,0,3129,3179,1,0,0,0,3130,3131, + 5,183,0,0,3131,3132,5,30,0,0,3132,3133,3,32,16,0,3133,3134,5,31,0,0,3134, + 3135,6,151,-1,0,3135,3179,1,0,0,0,3136,3137,5,192,0,0,3137,3138,5,30,0, + 0,3138,3139,3,34,17,0,3139,3140,5,31,0,0,3140,3141,6,151,-1,0,3141,3179, + 1,0,0,0,3142,3143,5,191,0,0,3143,3144,5,30,0,0,3144,3145,3,32,16,0,3145, + 3146,5,31,0,0,3146,3147,6,151,-1,0,3147,3179,1,0,0,0,3148,3149,5,190,0, + 0,3149,3150,5,30,0,0,3150,3151,3,32,16,0,3151,3152,5,31,0,0,3152,3153, + 6,151,-1,0,3153,3179,1,0,0,0,3154,3155,5,189,0,0,3155,3156,5,30,0,0,3156, + 3157,3,32,16,0,3157,3158,5,31,0,0,3158,3159,6,151,-1,0,3159,3179,1,0,0, + 0,3160,3161,5,180,0,0,3161,3162,5,30,0,0,3162,3163,3,32,16,0,3163,3164, + 5,31,0,0,3164,3165,6,151,-1,0,3165,3179,1,0,0,0,3166,3167,5,182,0,0,3167, + 3168,5,30,0,0,3168,3169,3,166,83,0,3169,3170,5,31,0,0,3170,3171,6,151, + -1,0,3171,3179,1,0,0,0,3172,3173,5,84,0,0,3173,3174,5,30,0,0,3174,3175, + 3,304,152,0,3175,3176,5,31,0,0,3176,3177,6,151,-1,0,3177,3179,1,0,0,0, + 3178,3088,1,0,0,0,3178,3094,1,0,0,0,3178,3100,1,0,0,0,3178,3106,1,0,0, + 0,3178,3112,1,0,0,0,3178,3118,1,0,0,0,3178,3124,1,0,0,0,3178,3130,1,0, + 0,0,3178,3136,1,0,0,0,3178,3142,1,0,0,0,3178,3148,1,0,0,0,3178,3154,1, + 0,0,0,3178,3160,1,0,0,0,3178,3166,1,0,0,0,3178,3172,1,0,0,0,3179,303,1, + 0,0,0,3180,3181,3,306,153,0,3181,3182,6,152,-1,0,3182,3184,1,0,0,0,3183, + 3180,1,0,0,0,3184,3187,1,0,0,0,3185,3183,1,0,0,0,3185,3186,1,0,0,0,3186, + 305,1,0,0,0,3187,3185,1,0,0,0,3188,3189,7,14,0,0,3189,307,1,0,0,0,3190, + 3191,3,302,151,0,3191,3192,6,154,-1,0,3192,3199,1,0,0,0,3193,3194,3,6, + 3,0,3194,3195,6,154,-1,0,3195,3199,1,0,0,0,3196,3197,5,178,0,0,3197,3199, + 6,154,-1,0,3198,3190,1,0,0,0,3198,3193,1,0,0,0,3198,3196,1,0,0,0,3199, + 309,1,0,0,0,3200,3201,3,302,151,0,3201,3202,6,155,-1,0,3202,3372,1,0,0, + 0,3203,3204,5,181,0,0,3204,3205,5,30,0,0,3205,3206,5,178,0,0,3206,3207, + 5,31,0,0,3207,3372,6,155,-1,0,3208,3209,5,181,0,0,3209,3210,5,30,0,0,3210, + 3211,5,263,0,0,3211,3212,5,31,0,0,3212,3372,6,155,-1,0,3213,3214,5,195, + 0,0,3214,3215,5,30,0,0,3215,3216,5,39,0,0,3216,3217,5,263,0,0,3217,3218, + 5,31,0,0,3218,3372,6,155,-1,0,3219,3220,5,195,0,0,3220,3221,5,30,0,0,3221, + 3222,3,118,59,0,3222,3223,5,31,0,0,3223,3224,6,155,-1,0,3224,3372,1,0, + 0,0,3225,3226,5,195,0,0,3226,3227,5,30,0,0,3227,3228,5,178,0,0,3228,3229, + 5,31,0,0,3229,3372,6,155,-1,0,3230,3231,5,196,0,0,3231,3232,5,30,0,0,3232, + 3233,3,310,155,0,3233,3234,5,31,0,0,3234,3235,6,155,-1,0,3235,3372,1,0, + 0,0,3236,3237,5,187,0,0,3237,3238,5,42,0,0,3238,3239,3,32,16,0,3239,3240, + 5,43,0,0,3240,3241,5,30,0,0,3241,3242,3,312,156,0,3242,3243,5,31,0,0,3243, + 3244,6,155,-1,0,3244,3372,1,0,0,0,3245,3246,5,188,0,0,3246,3247,5,42,0, + 0,3247,3248,3,32,16,0,3248,3249,5,43,0,0,3249,3250,5,30,0,0,3250,3251, + 3,314,157,0,3251,3252,5,31,0,0,3252,3253,6,155,-1,0,3253,3372,1,0,0,0, + 3254,3255,5,186,0,0,3255,3256,5,42,0,0,3256,3257,3,32,16,0,3257,3258,5, + 43,0,0,3258,3259,5,30,0,0,3259,3260,3,316,158,0,3260,3261,5,31,0,0,3261, + 3262,6,155,-1,0,3262,3372,1,0,0,0,3263,3264,5,185,0,0,3264,3265,5,42,0, + 0,3265,3266,3,32,16,0,3266,3267,5,43,0,0,3267,3268,5,30,0,0,3268,3269, + 3,318,159,0,3269,3270,5,31,0,0,3270,3271,6,155,-1,0,3271,3372,1,0,0,0, + 3272,3273,5,184,0,0,3273,3274,5,42,0,0,3274,3275,3,32,16,0,3275,3276,5, + 43,0,0,3276,3277,5,30,0,0,3277,3278,3,320,160,0,3278,3279,5,31,0,0,3279, + 3280,6,155,-1,0,3280,3372,1,0,0,0,3281,3282,5,183,0,0,3282,3283,5,42,0, + 0,3283,3284,3,32,16,0,3284,3285,5,43,0,0,3285,3286,5,30,0,0,3286,3287, + 3,322,161,0,3287,3288,5,31,0,0,3288,3289,6,155,-1,0,3289,3372,1,0,0,0, + 3290,3291,5,192,0,0,3291,3292,5,42,0,0,3292,3293,3,32,16,0,3293,3294,5, + 43,0,0,3294,3295,5,30,0,0,3295,3296,3,316,158,0,3296,3297,5,31,0,0,3297, + 3298,6,155,-1,0,3298,3372,1,0,0,0,3299,3300,5,191,0,0,3300,3301,5,42,0, + 0,3301,3302,3,32,16,0,3302,3303,5,43,0,0,3303,3304,5,30,0,0,3304,3305, + 3,318,159,0,3305,3306,5,31,0,0,3306,3307,6,155,-1,0,3307,3372,1,0,0,0, + 3308,3309,5,190,0,0,3309,3310,5,42,0,0,3310,3311,3,32,16,0,3311,3312,5, + 43,0,0,3312,3313,5,30,0,0,3313,3314,3,320,160,0,3314,3315,5,31,0,0,3315, + 3316,6,155,-1,0,3316,3372,1,0,0,0,3317,3318,5,189,0,0,3318,3319,5,42,0, + 0,3319,3320,3,32,16,0,3320,3321,5,43,0,0,3321,3322,5,30,0,0,3322,3323, + 3,322,161,0,3323,3324,5,31,0,0,3324,3325,6,155,-1,0,3325,3372,1,0,0,0, + 3326,3327,5,180,0,0,3327,3328,5,42,0,0,3328,3329,3,32,16,0,3329,3330,5, + 43,0,0,3330,3331,5,30,0,0,3331,3332,3,320,160,0,3332,3333,5,31,0,0,3333, + 3334,6,155,-1,0,3334,3372,1,0,0,0,3335,3336,5,182,0,0,3336,3337,5,42,0, + 0,3337,3338,3,32,16,0,3338,3339,5,43,0,0,3339,3340,5,30,0,0,3340,3341, + 3,324,162,0,3341,3342,5,31,0,0,3342,3343,6,155,-1,0,3343,3372,1,0,0,0, + 3344,3345,5,181,0,0,3345,3346,5,42,0,0,3346,3347,3,32,16,0,3347,3348,5, + 43,0,0,3348,3349,5,30,0,0,3349,3350,3,326,163,0,3350,3351,5,31,0,0,3351, + 3352,6,155,-1,0,3352,3372,1,0,0,0,3353,3354,5,195,0,0,3354,3355,5,42,0, + 0,3355,3356,3,32,16,0,3356,3357,5,43,0,0,3357,3358,5,30,0,0,3358,3359, + 3,328,164,0,3359,3360,5,31,0,0,3360,3361,6,155,-1,0,3361,3372,1,0,0,0, + 3362,3363,5,196,0,0,3363,3364,5,42,0,0,3364,3365,3,32,16,0,3365,3366,5, + 43,0,0,3366,3367,5,30,0,0,3367,3368,3,332,166,0,3368,3369,5,31,0,0,3369, + 3370,6,155,-1,0,3370,3372,1,0,0,0,3371,3200,1,0,0,0,3371,3203,1,0,0,0, + 3371,3208,1,0,0,0,3371,3213,1,0,0,0,3371,3219,1,0,0,0,3371,3225,1,0,0, + 0,3371,3230,1,0,0,0,3371,3236,1,0,0,0,3371,3245,1,0,0,0,3371,3254,1,0, + 0,0,3371,3263,1,0,0,0,3371,3272,1,0,0,0,3371,3281,1,0,0,0,3371,3290,1, + 0,0,0,3371,3299,1,0,0,0,3371,3308,1,0,0,0,3371,3317,1,0,0,0,3371,3326, + 1,0,0,0,3371,3335,1,0,0,0,3371,3344,1,0,0,0,3371,3353,1,0,0,0,3371,3362, + 1,0,0,0,3372,311,1,0,0,0,3373,3374,3,36,18,0,3374,3375,6,156,-1,0,3375, + 3380,1,0,0,0,3376,3377,3,32,16,0,3377,3378,6,156,-1,0,3378,3380,1,0,0, + 0,3379,3373,1,0,0,0,3379,3376,1,0,0,0,3380,3383,1,0,0,0,3381,3379,1,0, + 0,0,3381,3382,1,0,0,0,3382,313,1,0,0,0,3383,3381,1,0,0,0,3384,3385,3,36, + 18,0,3385,3386,6,157,-1,0,3386,3391,1,0,0,0,3387,3388,3,34,17,0,3388,3389, + 6,157,-1,0,3389,3391,1,0,0,0,3390,3384,1,0,0,0,3390,3387,1,0,0,0,3391, + 3394,1,0,0,0,3392,3390,1,0,0,0,3392,3393,1,0,0,0,3393,315,1,0,0,0,3394, + 3392,1,0,0,0,3395,3396,3,34,17,0,3396,3397,6,158,-1,0,3397,3399,1,0,0, + 0,3398,3395,1,0,0,0,3399,3402,1,0,0,0,3400,3398,1,0,0,0,3400,3401,1,0, + 0,0,3401,317,1,0,0,0,3402,3400,1,0,0,0,3403,3404,3,32,16,0,3404,3405,6, + 159,-1,0,3405,3407,1,0,0,0,3406,3403,1,0,0,0,3407,3410,1,0,0,0,3408,3406, + 1,0,0,0,3408,3409,1,0,0,0,3409,319,1,0,0,0,3410,3408,1,0,0,0,3411,3412, + 3,32,16,0,3412,3413,6,160,-1,0,3413,3415,1,0,0,0,3414,3411,1,0,0,0,3415, + 3418,1,0,0,0,3416,3414,1,0,0,0,3416,3417,1,0,0,0,3417,321,1,0,0,0,3418, + 3416,1,0,0,0,3419,3420,3,32,16,0,3420,3421,6,161,-1,0,3421,3423,1,0,0, + 0,3422,3419,1,0,0,0,3423,3426,1,0,0,0,3424,3422,1,0,0,0,3424,3425,1,0, + 0,0,3425,323,1,0,0,0,3426,3424,1,0,0,0,3427,3428,3,166,83,0,3428,3429, + 6,162,-1,0,3429,3431,1,0,0,0,3430,3427,1,0,0,0,3431,3434,1,0,0,0,3432, + 3430,1,0,0,0,3432,3433,1,0,0,0,3433,325,1,0,0,0,3434,3432,1,0,0,0,3435, + 3436,5,178,0,0,3436,3440,6,163,-1,0,3437,3438,5,263,0,0,3438,3440,6,163, + -1,0,3439,3435,1,0,0,0,3439,3437,1,0,0,0,3440,3443,1,0,0,0,3441,3439,1, + 0,0,0,3441,3442,1,0,0,0,3442,327,1,0,0,0,3443,3441,1,0,0,0,3444,3445,3, + 330,165,0,3445,3446,6,164,-1,0,3446,3448,1,0,0,0,3447,3444,1,0,0,0,3448, + 3451,1,0,0,0,3449,3447,1,0,0,0,3449,3450,1,0,0,0,3450,329,1,0,0,0,3451, + 3449,1,0,0,0,3452,3453,5,178,0,0,3453,3461,6,165,-1,0,3454,3455,5,39,0, + 0,3455,3456,5,263,0,0,3456,3461,6,165,-1,0,3457,3458,3,118,59,0,3458,3459, + 6,165,-1,0,3459,3461,1,0,0,0,3460,3452,1,0,0,0,3460,3454,1,0,0,0,3460, + 3457,1,0,0,0,3461,331,1,0,0,0,3462,3463,3,310,155,0,3463,3464,6,166,-1, + 0,3464,3466,1,0,0,0,3465,3462,1,0,0,0,3466,3469,1,0,0,0,3467,3465,1,0, + 0,0,3467,3468,1,0,0,0,3468,333,1,0,0,0,3469,3467,1,0,0,0,3470,3471,3,44, + 22,0,3471,3472,6,167,-1,0,3472,3480,1,0,0,0,3473,3474,3,46,23,0,3474,3475, + 6,167,-1,0,3475,3480,1,0,0,0,3476,3477,3,2,1,0,3477,3478,6,167,-1,0,3478, + 3480,1,0,0,0,3479,3470,1,0,0,0,3479,3473,1,0,0,0,3479,3476,1,0,0,0,3480, + 335,1,0,0,0,3481,3482,5,167,0,0,3482,3483,5,36,0,0,3483,3484,5,30,0,0, + 3484,3485,3,304,152,0,3485,3486,5,31,0,0,3486,3487,6,168,-1,0,3487,3514, + 1,0,0,0,3488,3489,5,168,0,0,3489,3490,3,38,19,0,3490,3491,5,75,0,0,3491, + 3492,3,38,19,0,3492,3493,5,75,0,0,3493,3494,3,38,19,0,3494,3495,5,75,0, + 0,3495,3496,3,38,19,0,3496,3497,6,168,-1,0,3497,3514,1,0,0,0,3498,3499, + 5,169,0,0,3499,3500,3,6,3,0,3500,3501,6,168,-1,0,3501,3514,1,0,0,0,3502, + 3503,5,169,0,0,3503,3504,5,36,0,0,3504,3505,5,30,0,0,3505,3506,3,304,152, + 0,3506,3507,5,31,0,0,3507,3508,6,168,-1,0,3508,3514,1,0,0,0,3509,3510, + 3,334,167,0,3510,3511,6,168,-1,0,3511,3514,1,0,0,0,3512,3514,3,40,20,0, + 3513,3481,1,0,0,0,3513,3488,1,0,0,0,3513,3498,1,0,0,0,3513,3502,1,0,0, + 0,3513,3509,1,0,0,0,3513,3512,1,0,0,0,3514,337,1,0,0,0,3515,3516,3,340, + 170,0,3516,3517,5,17,0,0,3517,3518,3,342,171,0,3518,3519,5,18,0,0,3519, + 3520,6,169,-1,0,3520,339,1,0,0,0,3521,3522,5,25,0,0,3522,3523,5,40,0,0, + 3523,3524,3,100,50,0,3524,3525,3,2,1,0,3525,3526,6,170,-1,0,3526,3536, + 1,0,0,0,3527,3528,5,25,0,0,3528,3529,5,40,0,0,3529,3530,3,100,50,0,3530, + 3531,3,2,1,0,3531,3532,5,34,0,0,3532,3533,3,2,1,0,3533,3534,6,170,-1,0, + 3534,3536,1,0,0,0,3535,3521,1,0,0,0,3535,3527,1,0,0,0,3536,341,1,0,0,0, + 3537,3538,3,344,172,0,3538,3539,6,171,-1,0,3539,3541,1,0,0,0,3540,3537, + 1,0,0,0,3541,3544,1,0,0,0,3542,3540,1,0,0,0,3542,3543,1,0,0,0,3543,343, + 1,0,0,0,3544,3542,1,0,0,0,3545,3546,5,179,0,0,3546,3547,5,36,0,0,3547, + 3548,5,30,0,0,3548,3549,3,304,152,0,3549,3550,5,31,0,0,3550,3551,6,172, + -1,0,3551,3565,1,0,0,0,3552,3553,3,336,168,0,3553,3554,6,172,-1,0,3554, + 3565,1,0,0,0,3555,3556,5,170,0,0,3556,3557,5,36,0,0,3557,3558,5,30,0,0, + 3558,3559,3,304,152,0,3559,3560,5,31,0,0,3560,3561,6,172,-1,0,3561,3565, + 1,0,0,0,3562,3563,5,55,0,0,3563,3565,6,172,-1,0,3564,3545,1,0,0,0,3564, + 3552,1,0,0,0,3564,3555,1,0,0,0,3564,3562,1,0,0,0,3565,345,1,0,0,0,3566, + 3567,3,348,174,0,3567,3568,5,17,0,0,3568,3569,3,356,178,0,3569,3570,5, + 18,0,0,3570,3571,6,173,-1,0,3571,347,1,0,0,0,3572,3573,5,50,0,0,3573,3574, + 5,40,0,0,3574,3575,3,352,176,0,3575,3576,3,2,1,0,3576,3577,6,174,-1,0, + 3577,349,1,0,0,0,3578,3579,5,300,0,0,3579,3580,3,352,176,0,3580,3581,3, + 2,1,0,3581,3582,6,175,-1,0,3582,351,1,0,0,0,3583,3584,3,354,177,0,3584, + 3585,6,176,-1,0,3585,3587,1,0,0,0,3586,3583,1,0,0,0,3587,3590,1,0,0,0, + 3588,3586,1,0,0,0,3588,3589,1,0,0,0,3589,353,1,0,0,0,3590,3588,1,0,0,0, + 3591,3607,5,52,0,0,3592,3607,5,51,0,0,3593,3607,5,171,0,0,3594,3595,5, + 62,0,0,3595,3607,5,51,0,0,3596,3597,5,62,0,0,3597,3607,5,52,0,0,3598,3599, + 5,62,0,0,3599,3607,5,63,0,0,3600,3601,5,62,0,0,3601,3607,5,64,0,0,3602, + 3603,5,62,0,0,3603,3607,5,65,0,0,3604,3605,5,62,0,0,3605,3607,5,66,0,0, + 3606,3591,1,0,0,0,3606,3592,1,0,0,0,3606,3593,1,0,0,0,3606,3594,1,0,0, + 0,3606,3596,1,0,0,0,3606,3598,1,0,0,0,3606,3600,1,0,0,0,3606,3602,1,0, + 0,0,3606,3604,1,0,0,0,3607,355,1,0,0,0,3608,3609,3,358,179,0,3609,3610, + 6,178,-1,0,3610,3612,1,0,0,0,3611,3608,1,0,0,0,3612,3615,1,0,0,0,3613, + 3611,1,0,0,0,3613,3614,1,0,0,0,3614,357,1,0,0,0,3615,3613,1,0,0,0,3616, + 3617,5,21,0,0,3617,3618,3,2,1,0,3618,3619,6,179,-1,0,3619,3642,1,0,0,0, + 3620,3621,5,50,0,0,3621,3622,5,40,0,0,3622,3623,3,120,60,0,3623,3624,6, + 179,-1,0,3624,3642,1,0,0,0,3625,3626,5,25,0,0,3626,3627,5,40,0,0,3627, + 3628,3,2,1,0,3628,3629,6,179,-1,0,3629,3642,1,0,0,0,3630,3631,3,178,89, + 0,3631,3632,6,179,-1,0,3632,3642,1,0,0,0,3633,3634,5,50,0,0,3634,3635, + 3,32,16,0,3635,3636,6,179,-1,0,3636,3642,1,0,0,0,3637,3638,3,334,167,0, + 3638,3639,6,179,-1,0,3639,3642,1,0,0,0,3640,3642,3,40,20,0,3641,3616,1, + 0,0,0,3641,3620,1,0,0,0,3641,3625,1,0,0,0,3641,3630,1,0,0,0,3641,3633, + 1,0,0,0,3641,3637,1,0,0,0,3641,3640,1,0,0,0,3642,359,1,0,0,0,3643,3644, + 3,362,181,0,3644,3645,5,17,0,0,3645,3646,3,368,184,0,3646,3647,5,18,0, + 0,3647,3648,6,180,-1,0,3648,361,1,0,0,0,3649,3650,5,273,0,0,3650,3651, + 3,364,182,0,3651,3652,3,2,1,0,3652,3653,6,181,-1,0,3653,3662,1,0,0,0,3654, + 3655,5,273,0,0,3655,3656,3,364,182,0,3656,3657,3,2,1,0,3657,3658,5,34, + 0,0,3658,3659,3,2,1,0,3659,3660,6,181,-1,0,3660,3662,1,0,0,0,3661,3649, + 1,0,0,0,3661,3654,1,0,0,0,3662,363,1,0,0,0,3663,3664,3,366,183,0,3664, + 3665,6,182,-1,0,3665,3667,1,0,0,0,3666,3663,1,0,0,0,3667,3670,1,0,0,0, + 3668,3666,1,0,0,0,3668,3669,1,0,0,0,3669,365,1,0,0,0,3670,3668,1,0,0,0, + 3671,3672,7,15,0,0,3672,367,1,0,0,0,3673,3674,3,370,185,0,3674,3675,6, + 184,-1,0,3675,3677,1,0,0,0,3676,3673,1,0,0,0,3677,3680,1,0,0,0,3678,3676, + 1,0,0,0,3678,3679,1,0,0,0,3679,369,1,0,0,0,3680,3678,1,0,0,0,3681,3682, + 5,21,0,0,3682,3683,3,2,1,0,3683,3684,5,44,0,0,3684,3685,3,32,16,0,3685, + 3686,6,185,-1,0,3686,3697,1,0,0,0,3687,3688,5,25,0,0,3688,3689,5,40,0, + 0,3689,3690,3,2,1,0,3690,3691,6,185,-1,0,3691,3697,1,0,0,0,3692,3693,3, + 334,167,0,3693,3694,6,185,-1,0,3694,3697,1,0,0,0,3695,3697,3,40,20,0,3696, + 3681,1,0,0,0,3696,3687,1,0,0,0,3696,3692,1,0,0,0,3696,3695,1,0,0,0,3697, + 371,1,0,0,0,184,382,390,399,408,497,548,559,589,596,614,646,674,714,725, + 735,737,748,750,758,780,793,809,833,906,913,920,925,934,945,954,965,976, + 989,993,1001,1017,1024,1033,1061,1139,1141,1155,1161,1170,1172,1181,1195, + 1209,1217,1225,1229,1268,1276,1287,1301,1309,1325,1335,1338,1362,1509, + 1519,1528,1531,1613,1622,1654,1714,1754,1770,1780,1810,1838,1847,1853, + 1870,1878,1936,1946,1964,1982,2001,2022,2041,2056,2064,2076,2096,2103, + 2108,2119,2131,2241,2253,2269,2283,2292,2305,2307,2350,2361,2368,2376, + 2384,2397,2403,2409,2414,2443,2451,2465,2470,2495,2504,2515,2519,2526, + 2546,2555,2557,2572,2619,2629,2631,2638,2644,2688,2697,2737,2742,2782, + 2786,2796,2818,2830,2841,2856,2869,2882,2885,2897,2911,2929,2947,2961, + 2985,3000,3007,3016,3018,3025,3036,3086,3178,3185,3198,3371,3379,3381, + 3390,3392,3400,3408,3416,3424,3432,3439,3441,3449,3460,3467,3479,3513, + 3535,3542,3564,3588,3606,3613,3641,3661,3668,3678,3696 }; public static readonly ATN _ATN = diff --git a/src/tools/ilasm/src/ILAssembler/gen/CILVisitor.cs b/src/tools/ilasm/src/ILAssembler/gen/CILVisitor.cs deleted file mode 100644 index d74d21a93c4052..00000000000000 --- a/src/tools/ilasm/src/ILAssembler/gen/CILVisitor.cs +++ /dev/null @@ -1,1225 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// ANTLR Version: 4.13.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -// Generated from CIL.g4 by ANTLR 4.13.1 - -// Unreachable code detected -#pragma warning disable 0162 -// The variable '...' is assigned but its value is never used -#pragma warning disable 0219 -// Missing XML comment for publicly visible type or member '...' -#pragma warning disable 1591 -// Ambiguous reference in cref attribute -#pragma warning disable 419 - -namespace ILAssembler { -using Antlr4.Runtime.Misc; -using Antlr4.Runtime.Tree; -using IToken = Antlr4.Runtime.IToken; - -/// -/// This interface defines a complete generic visitor for a parse tree produced -/// by . -/// -/// The return type of the visit operation. -[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.1")] -[System.CLSCompliant(false)] -public interface ICILVisitor : IParseTreeVisitor { - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitId([NotNull] CILParser.IdContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitDottedName([NotNull] CILParser.DottedNameContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitDottedNamePart([NotNull] CILParser.DottedNamePartContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCompQstring([NotNull] CILParser.CompQstringContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitDecls([NotNull] CILParser.DeclsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitDecl([NotNull] CILParser.DeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSubsystem([NotNull] CILParser.SubsystemContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCorflags([NotNull] CILParser.CorflagsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitAlignment([NotNull] CILParser.AlignmentContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitImagebase([NotNull] CILParser.ImagebaseContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitStackreserve([NotNull] CILParser.StackreserveContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitAssemblyBlock([NotNull] CILParser.AssemblyBlockContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitMscorlib([NotNull] CILParser.MscorlibContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitLanguageDecl([NotNull] CILParser.LanguageDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitLanguageString([NotNull] CILParser.LanguageStringContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTypelist([NotNull] CILParser.TypelistContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInt32([NotNull] CILParser.Int32Context context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInt64([NotNull] CILParser.Int64Context context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitFloat64([NotNull] CILParser.Float64Context context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitIntOrWildcard([NotNull] CILParser.IntOrWildcardContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCompControl([NotNull] CILParser.CompControlContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTypedefDecl([NotNull] CILParser.TypedefDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCustomDescr([NotNull] CILParser.CustomDescrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCustomDescrWithOwner([NotNull] CILParser.CustomDescrWithOwnerContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCustomType([NotNull] CILParser.CustomTypeContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitOwnerType([NotNull] CILParser.OwnerTypeContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCustomBlobDescr([NotNull] CILParser.CustomBlobDescrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCustomBlobArgs([NotNull] CILParser.CustomBlobArgsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCustomBlobNVPairs([NotNull] CILParser.CustomBlobNVPairsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitFieldOrProp([NotNull] CILParser.FieldOrPropContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSerializType([NotNull] CILParser.SerializTypeContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSerializTypeElement([NotNull] CILParser.SerializTypeElementContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitModuleHead([NotNull] CILParser.ModuleHeadContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitVtfixupDecl([NotNull] CILParser.VtfixupDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitVtfixupAttr([NotNull] CILParser.VtfixupAttrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitVtableDecl([NotNull] CILParser.VtableDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitNameSpaceHead([NotNull] CILParser.NameSpaceHeadContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitClassHead([NotNull] CILParser.ClassHeadContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitClassAttr([NotNull] CILParser.ClassAttrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitExtendsClause([NotNull] CILParser.ExtendsClauseContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitImplClause([NotNull] CILParser.ImplClauseContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitClassDecls([NotNull] CILParser.ClassDeclsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitImplList([NotNull] CILParser.ImplListContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitEsHead([NotNull] CILParser.EsHeadContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitExtSourceSpec([NotNull] CILParser.ExtSourceSpecContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitFileDecl([NotNull] CILParser.FileDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitFileAttr([NotNull] CILParser.FileAttrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitFileEntry([NotNull] CILParser.FileEntryContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitAsmAttrAny([NotNull] CILParser.AsmAttrAnyContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitAsmAttr([NotNull] CILParser.AsmAttrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr_none([NotNull] CILParser.Instr_noneContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr_var([NotNull] CILParser.Instr_varContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr_i([NotNull] CILParser.Instr_iContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr_i8([NotNull] CILParser.Instr_i8Context context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr_r([NotNull] CILParser.Instr_rContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr_brtarget([NotNull] CILParser.Instr_brtargetContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr_method([NotNull] CILParser.Instr_methodContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr_field([NotNull] CILParser.Instr_fieldContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr_type([NotNull] CILParser.Instr_typeContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr_string([NotNull] CILParser.Instr_stringContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr_sig([NotNull] CILParser.Instr_sigContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr_tok([NotNull] CILParser.Instr_tokContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr_switch([NotNull] CILParser.Instr_switchContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInstr([NotNull] CILParser.InstrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitLabels([NotNull] CILParser.LabelsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTypeArgs([NotNull] CILParser.TypeArgsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitBounds([NotNull] CILParser.BoundsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSigArgs([NotNull] CILParser.SigArgsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSigArg([NotNull] CILParser.SigArgContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitClassName([NotNull] CILParser.ClassNameContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSlashedName([NotNull] CILParser.SlashedNameContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitAssemblyDecls([NotNull] CILParser.AssemblyDeclsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitAssemblyDecl([NotNull] CILParser.AssemblyDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTypeSpec([NotNull] CILParser.TypeSpecContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitNativeType([NotNull] CILParser.NativeTypeContext context); - /// - /// Visit a parse tree produced by the PointerNativeType - /// labeled alternative in . - /// - /// The parse tree. - /// The visitor result. - Result VisitPointerNativeType([NotNull] CILParser.PointerNativeTypeContext context); - /// - /// Visit a parse tree produced by the PointerArrayTypeNoSizeData - /// labeled alternative in . - /// - /// The parse tree. - /// The visitor result. - Result VisitPointerArrayTypeNoSizeData([NotNull] CILParser.PointerArrayTypeNoSizeDataContext context); - /// - /// Visit a parse tree produced by the PointerArrayTypeSize - /// labeled alternative in . - /// - /// The parse tree. - /// The visitor result. - Result VisitPointerArrayTypeSize([NotNull] CILParser.PointerArrayTypeSizeContext context); - /// - /// Visit a parse tree produced by the PointerArrayTypeSizeParamIndex - /// labeled alternative in . - /// - /// The parse tree. - /// The visitor result. - Result VisitPointerArrayTypeSizeParamIndex([NotNull] CILParser.PointerArrayTypeSizeParamIndexContext context); - /// - /// Visit a parse tree produced by the PointerArrayTypeParamIndex - /// labeled alternative in . - /// - /// The parse tree. - /// The visitor result. - Result VisitPointerArrayTypeParamIndex([NotNull] CILParser.PointerArrayTypeParamIndexContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitNativeTypeElement([NotNull] CILParser.NativeTypeElementContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitIidParamIndex([NotNull] CILParser.IidParamIndexContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitVariantType([NotNull] CILParser.VariantTypeContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitVariantTypeElement([NotNull] CILParser.VariantTypeElementContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitType([NotNull] CILParser.TypeContext context); - /// - /// Visit a parse tree produced by the SZArrayModifier - /// labeled alternative in . - /// - /// The parse tree. - /// The visitor result. - Result VisitSZArrayModifier([NotNull] CILParser.SZArrayModifierContext context); - /// - /// Visit a parse tree produced by the ArrayModifier - /// labeled alternative in . - /// - /// The parse tree. - /// The visitor result. - Result VisitArrayModifier([NotNull] CILParser.ArrayModifierContext context); - /// - /// Visit a parse tree produced by the ByRefModifier - /// labeled alternative in . - /// - /// The parse tree. - /// The visitor result. - Result VisitByRefModifier([NotNull] CILParser.ByRefModifierContext context); - /// - /// Visit a parse tree produced by the PtrModifier - /// labeled alternative in . - /// - /// The parse tree. - /// The visitor result. - Result VisitPtrModifier([NotNull] CILParser.PtrModifierContext context); - /// - /// Visit a parse tree produced by the PinnedModifier - /// labeled alternative in . - /// - /// The parse tree. - /// The visitor result. - Result VisitPinnedModifier([NotNull] CILParser.PinnedModifierContext context); - /// - /// Visit a parse tree produced by the RequiredModifier - /// labeled alternative in . - /// - /// The parse tree. - /// The visitor result. - Result VisitRequiredModifier([NotNull] CILParser.RequiredModifierContext context); - /// - /// Visit a parse tree produced by the OptionalModifier - /// labeled alternative in . - /// - /// The parse tree. - /// The visitor result. - Result VisitOptionalModifier([NotNull] CILParser.OptionalModifierContext context); - /// - /// Visit a parse tree produced by the GenericArgumentsModifier - /// labeled alternative in . - /// - /// The parse tree. - /// The visitor result. - Result VisitGenericArgumentsModifier([NotNull] CILParser.GenericArgumentsModifierContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitElementType([NotNull] CILParser.ElementTypeContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSimpleType([NotNull] CILParser.SimpleTypeContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitBound([NotNull] CILParser.BoundContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitNativeInt([NotNull] CILParser.NativeIntContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitNativeUint([NotNull] CILParser.NativeUintContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSecDecl([NotNull] CILParser.SecDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSecAttrSetBlob([NotNull] CILParser.SecAttrSetBlobContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSecAttrBlob([NotNull] CILParser.SecAttrBlobContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitNameValPairs([NotNull] CILParser.NameValPairsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitNameValPair([NotNull] CILParser.NameValPairContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTruefalse([NotNull] CILParser.TruefalseContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCaValue([NotNull] CILParser.CaValueContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSecAction([NotNull] CILParser.SecActionContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitMethodRef([NotNull] CILParser.MethodRefContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCallConv([NotNull] CILParser.CallConvContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCallKind([NotNull] CILParser.CallKindContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitMdtoken([NotNull] CILParser.MdtokenContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitMemberRef([NotNull] CILParser.MemberRefContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitFieldRef([NotNull] CILParser.FieldRefContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTypeList([NotNull] CILParser.TypeListContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTyparsClause([NotNull] CILParser.TyparsClauseContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTyparAttrib([NotNull] CILParser.TyparAttribContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTyparAttribs([NotNull] CILParser.TyparAttribsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTypar([NotNull] CILParser.TyparContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTypars([NotNull] CILParser.TyparsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTyBound([NotNull] CILParser.TyBoundContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitGenArity([NotNull] CILParser.GenArityContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitGenArityNotEmpty([NotNull] CILParser.GenArityNotEmptyContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitClassDecl([NotNull] CILParser.ClassDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitFieldDecl([NotNull] CILParser.FieldDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitFieldAttr([NotNull] CILParser.FieldAttrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitAtOpt([NotNull] CILParser.AtOptContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitInitOpt([NotNull] CILParser.InitOptContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitRepeatOpt([NotNull] CILParser.RepeatOptContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitEventHead([NotNull] CILParser.EventHeadContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitEventAttr([NotNull] CILParser.EventAttrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitEventDecls([NotNull] CILParser.EventDeclsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitEventDecl([NotNull] CILParser.EventDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitPropHead([NotNull] CILParser.PropHeadContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitPropAttr([NotNull] CILParser.PropAttrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitPropDecls([NotNull] CILParser.PropDeclsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitPropDecl([NotNull] CILParser.PropDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitMarshalClause([NotNull] CILParser.MarshalClauseContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitMarshalBlob([NotNull] CILParser.MarshalBlobContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitParamAttr([NotNull] CILParser.ParamAttrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitParamAttrElement([NotNull] CILParser.ParamAttrElementContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitMethodHead([NotNull] CILParser.MethodHeadContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitMethAttr([NotNull] CILParser.MethAttrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitPinvImpl([NotNull] CILParser.PinvImplContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitPinvAttr([NotNull] CILParser.PinvAttrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitMethodName([NotNull] CILParser.MethodNameContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitImplAttr([NotNull] CILParser.ImplAttrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitMethodDecls([NotNull] CILParser.MethodDeclsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitMethodDecl([NotNull] CILParser.MethodDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitLabelDecl([NotNull] CILParser.LabelDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCustomDescrInMethodBody([NotNull] CILParser.CustomDescrInMethodBodyContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitScopeBlock([NotNull] CILParser.ScopeBlockContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSehBlock([NotNull] CILParser.SehBlockContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSehClauses([NotNull] CILParser.SehClausesContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTryBlock([NotNull] CILParser.TryBlockContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSehClause([NotNull] CILParser.SehClauseContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitFilterClause([NotNull] CILParser.FilterClauseContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCatchClause([NotNull] CILParser.CatchClauseContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitFinallyClause([NotNull] CILParser.FinallyClauseContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitFaultClause([NotNull] CILParser.FaultClauseContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitHandlerBlock([NotNull] CILParser.HandlerBlockContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitDataDecl([NotNull] CILParser.DataDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitDdHead([NotNull] CILParser.DdHeadContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitTls([NotNull] CILParser.TlsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitDdBody([NotNull] CILParser.DdBodyContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitDdItemList([NotNull] CILParser.DdItemListContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitDdItemCount([NotNull] CILParser.DdItemCountContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitDdItem([NotNull] CILParser.DdItemContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitFieldSerInit([NotNull] CILParser.FieldSerInitContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitBytes([NotNull] CILParser.BytesContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitHexbyte([NotNull] CILParser.HexbyteContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitFieldInit([NotNull] CILParser.FieldInitContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSerInit([NotNull] CILParser.SerInitContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitF32seq([NotNull] CILParser.F32seqContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitF64seq([NotNull] CILParser.F64seqContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitI64seq([NotNull] CILParser.I64seqContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitI32seq([NotNull] CILParser.I32seqContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitI16seq([NotNull] CILParser.I16seqContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitI8seq([NotNull] CILParser.I8seqContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitBoolSeq([NotNull] CILParser.BoolSeqContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitSqstringSeq([NotNull] CILParser.SqstringSeqContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitClassSeq([NotNull] CILParser.ClassSeqContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitClassSeqElement([NotNull] CILParser.ClassSeqElementContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitObjSeq([NotNull] CILParser.ObjSeqContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitCustomAttrDecl([NotNull] CILParser.CustomAttrDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitAsmOrRefDecl([NotNull] CILParser.AsmOrRefDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitAssemblyRefHead([NotNull] CILParser.AssemblyRefHeadContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitAssemblyRefDecls([NotNull] CILParser.AssemblyRefDeclsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitAssemblyRefDecl([NotNull] CILParser.AssemblyRefDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitExptypeHead([NotNull] CILParser.ExptypeHeadContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitExportHead([NotNull] CILParser.ExportHeadContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitExptAttr([NotNull] CILParser.ExptAttrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitExptypeDecls([NotNull] CILParser.ExptypeDeclsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitExptypeDecl([NotNull] CILParser.ExptypeDeclContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitManifestResHead([NotNull] CILParser.ManifestResHeadContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitManresAttr([NotNull] CILParser.ManresAttrContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitManifestResDecls([NotNull] CILParser.ManifestResDeclsContext context); - /// - /// Visit a parse tree produced by . - /// - /// The parse tree. - /// The visitor result. - Result VisitManifestResDecl([NotNull] CILParser.ManifestResDeclContext context); -} -} // namespace ILAssembler diff --git a/src/tools/ilasm/src/ILAssembler/gen/ilasm-generator.csproj b/src/tools/ilasm/src/ILAssembler/gen/ilasm-generator.csproj index e4b7699a7e0634..9d5efdadea9022 100644 --- a/src/tools/ilasm/src/ILAssembler/gen/ilasm-generator.csproj +++ b/src/tools/ilasm/src/ILAssembler/gen/ilasm-generator.csproj @@ -2,7 +2,7 @@ $(NetCoreAppToolCurrent) - true + false enable $(NoWarn);CS3021 true @@ -21,6 +21,7 @@ false + false false ILAssembler $(ProjectDir) @@ -44,4 +45,14 @@ + + + + + + + diff --git a/src/tools/ilasm/tests/ILAssembler.Tests/CustomAttributeTests.cs b/src/tools/ilasm/tests/ILAssembler.Tests/CustomAttributeTests.cs index eebffb4057638f..a6bb73eb2daae1 100644 --- a/src/tools/ilasm/tests/ILAssembler.Tests/CustomAttributeTests.cs +++ b/src/tools/ilasm/tests/ILAssembler.Tests/CustomAttributeTests.cs @@ -76,6 +76,28 @@ .method public static void M() cil managed } } + [Theory] + [InlineData("0x123", 0x23)] + [InlineData("-0x123", 0xDD)] + public void HexByteBlob_PrefixedValuesAreMasked(string literal, byte expected) + { + string source = $$""" + .assembly extern mscorlib { } + .assembly Test { } + .class public auto ansi Test extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.ObsoleteAttribute::.ctor() = ({{literal}}) + } + """; + + using var pe = DocumentCompilerTestHelpers.CompileAndGetReader(source, new Options()); + var reader = pe.GetMetadataReader(); + var type = reader.GetTypeDefinition(MetadataTokens.TypeDefinitionHandle(2)); + var attribute = reader.GetCustomAttribute(Assert.Single(type.GetCustomAttributes())); + + Assert.Equal([expected], reader.GetBlobBytes(attribute.Value)); + } + [Fact] public void CustomAttributeOnMethod_EmittedCorrectly() @@ -466,6 +488,45 @@ .class public auto ansi Test extends [mscorlib]System.Object AssertNamedArgument(value.NamedArguments[5], CustomAttributeNamedArgumentKind.Property, "Kind", "Contoso.Kind", 3); } + [Fact] + public void CustomAttribute_VerbalNamedArgument_ResolvesSerializationTypeAlias() + { + string source = """ + .assembly extern mscorlib { } + .assembly test { } + .typedef int32 as MyInt + .class public auto ansi sealed NamedAttribute extends [mscorlib]System.Attribute + { + .method public specialname rtspecialname instance void .ctor() cil managed + { + ldarg.0 + call instance void [mscorlib]System.Attribute::.ctor() + ret + } + } + .class public auto ansi Test extends [mscorlib]System.Object + { + .custom instance void NamedAttribute::.ctor() = { + property MyInt Number = int32(42) + } + } + """; + + using var pe = DocumentCompilerTestHelpers.CompileAndGetReader(source, new Options()); + var reader = pe.GetMetadataReader(); + var type = reader.TypeDefinitions + .Single(handle => reader.GetString(reader.GetTypeDefinition(handle).Name) == "Test"); + var attribute = reader.GetCustomAttribute(Assert.Single(reader.GetCustomAttributes(type))); + CustomAttributeValue value = attribute.DecodeValue(DocumentCompilerTestHelpers.Decoder); + + AssertNamedArgument( + Assert.Single(value.NamedArguments), + CustomAttributeNamedArgumentKind.Property, + "Number", + "int32", + 42); + } + [Fact] public void CustomAttribute_VerbalTypeArgumentFromUnversionedAssemblyReference_EmitsAssemblyQualifiedTypeName() { diff --git a/src/tools/ilasm/tests/ILAssembler.Tests/DataTests.cs b/src/tools/ilasm/tests/ILAssembler.Tests/DataTests.cs index bee32b4291a744..94dfaf92a75590 100644 --- a/src/tools/ilasm/tests/ILAssembler.Tests/DataTests.cs +++ b/src/tools/ilasm/tests/ILAssembler.Tests/DataTests.cs @@ -370,6 +370,45 @@ .field public static int32 Value at Good BitConverter.ToInt32(ReadData(pe, fields["Value"], sizeof(int)))); } + [Fact] + public void OutOfRangeDataRepeatCount_DoesNotAliasFollowingData() + { + string source = """ + .assembly test { } + .data Broken = int8[999999999999999999999999] + .data Good = int32(0x12345678) + .class public auto ansi DataHolder + { + .field public static int8 Missing at Broken + .field public static int32 Value at Good + } + """; + + var compiler = new DocumentCompiler(); + (ImmutableArray diagnostics, CompilationResult? result) = compiler.Compile( + new SourceText(source, "test.il"), + _ => throw new InvalidOperationException("Unexpected include"), + _ => throw new InvalidOperationException("Unexpected resource"), + new Options { ErrorTolerant = true }); + + var diagnostic = Assert.Single(diagnostics); + Assert.Equal(DiagnosticIds.LiteralOutOfRange, diagnostic.Id); + Assert.NotNull(result); + + var image = new BlobBuilder(); + result!.Serialize(image); + using var pe = new PEReader(image.ToImmutableArray()); + MetadataReader reader = pe.GetMetadataReader(); + Dictionary fields = reader.FieldDefinitions + .Select(reader.GetFieldDefinition) + .ToDictionary(field => reader.GetString(field.Name)); + + Assert.Equal(0, fields["Missing"].GetRelativeVirtualAddress()); + Assert.Equal( + 0x12345678, + BitConverter.ToInt32(ReadData(pe, fields["Value"], sizeof(int)))); + } + private static byte[] ReadData(PEReader pe, FieldDefinition field, int length) { int rva = field.GetRelativeVirtualAddress(); diff --git a/src/tools/ilasm/tests/ILAssembler.Tests/DocumentCompilerTestHelpers.cs b/src/tools/ilasm/tests/ILAssembler.Tests/DocumentCompilerTestHelpers.cs index 9b915d2e25d864..c1cf88af90e558 100644 --- a/src/tools/ilasm/tests/ILAssembler.Tests/DocumentCompilerTestHelpers.cs +++ b/src/tools/ilasm/tests/ILAssembler.Tests/DocumentCompilerTestHelpers.cs @@ -44,7 +44,7 @@ internal static PEReader CompileAndGetReader(SourceText sourceText, Func includedDocumentLoader, Func resourceLocator, Options options) + internal static PEReader CompileAndGetReader(SourceText sourceText, Func includedDocumentLoader, Func resourceLocator, Options options) { var documentCompiler = new DocumentCompiler(); var (diagnostics, result) = documentCompiler.Compile(sourceText, includedDocumentLoader, resourceLocator, options); diff --git a/src/tools/ilasm/tests/ILAssembler.Tests/DocumentCompilerTests.cs b/src/tools/ilasm/tests/ILAssembler.Tests/DocumentCompilerTests.cs index 8fc79e9ea39886..c1fc6f9928a491 100644 --- a/src/tools/ilasm/tests/ILAssembler.Tests/DocumentCompilerTests.cs +++ b/src/tools/ilasm/tests/ILAssembler.Tests/DocumentCompilerTests.cs @@ -2,9 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Buffers.Binary; using System.Collections.Immutable; using System.Linq; using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; using System.Reflection.PortableExecutable; using Xunit; @@ -198,5 +200,221 @@ public void SyntaxErrorInDeclaration_DoesNotLeakScopesIntoFollowingDeclarations( Assert.Equal(string.Empty, reader.GetString(following.Namespace)); Assert.True(following.GetDeclaringType().IsNil); } + + [Fact] + public void MalformedTopLevelClassHeader_DoesNotMaterializeBodyDeclarations() + { + string source = """ + .assembly extern mscorlib { } + .assembly test { } + .class public auto ansi Broken extends + { + .field public static int32 LeakedField + .method public static void LeakedMethod() cil managed + { + ret + } + .property int32 LeakedProperty() + { + } + .event [mscorlib]System.EventHandler LeakedEvent + { + } + .class nested public auto ansi LeakedNested + { + } + .data SharedData = int32(1) + .custom instance void [mscorlib]System.ObsoleteAttribute::.ctor() = (01 00 00 00) + } + .data SharedData = int32(2) + .class public auto ansi Following + { + .field public static int32 KeptData at SharedData + } + """; + + using PEReader pe = CompileErrorTolerantAndGetReader(source); + MetadataReader reader = pe.GetMetadataReader(); + TypeDefinition moduleType = + reader.GetTypeDefinition(MetadataTokens.TypeDefinitionHandle(1)); + string[] typeNames = reader.TypeDefinitions + .Select(handle => reader.GetString(reader.GetTypeDefinition(handle).Name)) + .ToArray(); + + Assert.Empty(moduleType.GetFields()); + Assert.Empty(moduleType.GetMethods()); + Assert.DoesNotContain("LeakedNested", typeNames); + Assert.Contains("Following", typeNames); + Assert.Equal(0, reader.GetTableRowCount(TableIndex.Property)); + Assert.Equal(0, reader.GetTableRowCount(TableIndex.Event)); + Assert.Equal(0, reader.GetTableRowCount(TableIndex.CustomAttribute)); + + TypeDefinition following = reader.TypeDefinitions + .Select(reader.GetTypeDefinition) + .Single(type => reader.GetString(type.Name) == "Following"); + FieldDefinition keptData = + reader.GetFieldDefinition(Assert.Single(following.GetFields())); + Assert.Equal( + 2, + BinaryPrimitives.ReadInt32LittleEndian( + pe.GetSectionData(keptData.GetRelativeVirtualAddress()) + .GetContent() + .AsSpan(0, sizeof(int)))); + } + + [Fact] + public void MalformedNestedClassHeader_DoesNotMaterializeBodyDeclarations_AndFollowingMembersRemainInScope() + { + string source = """ + .assembly extern mscorlib { } + .assembly test { } + .class public auto ansi Outer + { + .class nested public auto ansi Broken extends + { + .field public int32 LeakedField + .method public static void LeakedMethod() cil managed + { + ret + } + .property int32 LeakedProperty() + { + } + .event [mscorlib]System.EventHandler LeakedEvent + { + } + .class nested public auto ansi LeakedNested + { + } + .pack 4 + .size 32 + .custom instance void [mscorlib]System.ObsoleteAttribute::.ctor() = (01 00 00 00) + } + .field public int32 KeptField + .method public static void KeptMethod() cil managed + { + ret + } + .property int32 KeptProperty() + { + } + .event [mscorlib]System.EventHandler KeptEvent + { + } + .class nested public auto ansi KeptNested + { + } + } + .class public auto ansi Following + { + } + """; + + using PEReader pe = CompileErrorTolerantAndGetReader(source); + MetadataReader reader = pe.GetMetadataReader(); + TypeDefinitionHandle outerHandle = reader.TypeDefinitions + .Single(handle => reader.GetString(reader.GetTypeDefinition(handle).Name) == "Outer"); + TypeDefinition outer = reader.GetTypeDefinition(outerHandle); + string[] typeNames = reader.TypeDefinitions + .Select(handle => reader.GetString(reader.GetTypeDefinition(handle).Name)) + .ToArray(); + + FieldDefinitionHandle fieldHandle = Assert.Single(outer.GetFields()); + Assert.Equal("KeptField", reader.GetString(reader.GetFieldDefinition(fieldHandle).Name)); + MethodDefinitionHandle methodHandle = Assert.Single(outer.GetMethods()); + Assert.Equal("KeptMethod", reader.GetString(reader.GetMethodDefinition(methodHandle).Name)); + PropertyDefinitionHandle propertyHandle = Assert.Single(outer.GetProperties()); + Assert.Equal("KeptProperty", reader.GetString(reader.GetPropertyDefinition(propertyHandle).Name)); + EventDefinitionHandle eventHandle = Assert.Single(outer.GetEvents()); + Assert.Equal("KeptEvent", reader.GetString(reader.GetEventDefinition(eventHandle).Name)); + Assert.Empty(reader.GetCustomAttributes(outerHandle)); + Assert.Equal(0, reader.GetTableRowCount(TableIndex.ClassLayout)); + Assert.DoesNotContain("LeakedNested", typeNames); + Assert.Contains("KeptNested", typeNames); + + TypeDefinition following = reader.TypeDefinitions + .Select(reader.GetTypeDefinition) + .Single(type => reader.GetString(type.Name) == "Following"); + Assert.Equal(string.Empty, reader.GetString(following.Namespace)); + Assert.True(following.GetDeclaringType().IsNil); + } + + [Fact] + public void MalformedNestedNamespace_DoesNotMaterializeChildren_AndFollowingNamespacesRemainInScope() + { + string source = """ + .assembly extern mscorlib { } + .assembly test { } + .namespace Outer + { + .namespace + { + .class public auto ansi Suppressed + { + } + .namespace Inner + { + .class public auto ansi DeeplySuppressed + { + } + } + .field public static int32 SuppressedGlobalField + .method public static void SuppressedGlobalMethod() cil managed + { + ret + } + .subsystem 2 + .custom instance void [mscorlib]System.ObsoleteAttribute::.ctor() = (01 00 00 00) + } + .class public auto ansi Kept + { + } + .namespace Sibling + { + .class public auto ansi SiblingType + { + } + } + } + .class public auto ansi Global + { + } + """; + + using PEReader pe = CompileErrorTolerantAndGetReader(source); + MetadataReader reader = pe.GetMetadataReader(); + Dictionary types = reader.TypeDefinitions + .Select(reader.GetTypeDefinition) + .ToDictionary(type => reader.GetString(type.Name)); + TypeDefinition moduleType = + reader.GetTypeDefinition(MetadataTokens.TypeDefinitionHandle(1)); + + Assert.DoesNotContain("Suppressed", types.Keys); + Assert.DoesNotContain("DeeplySuppressed", types.Keys); + Assert.Empty(moduleType.GetFields()); + Assert.Empty(moduleType.GetMethods()); + Assert.Equal(0, reader.GetTableRowCount(TableIndex.CustomAttribute)); + Assert.Equal(Subsystem.WindowsCui, pe.PEHeaders.PEHeader!.Subsystem); + Assert.Equal("Outer", reader.GetString(types["Kept"].Namespace)); + Assert.Equal("Outer.Sibling", reader.GetString(types["SiblingType"].Namespace)); + Assert.Equal(string.Empty, reader.GetString(types["Global"].Namespace)); + } + + private static PEReader CompileErrorTolerantAndGetReader(string source) + { + var compiler = new DocumentCompiler(); + var (diagnostics, image) = compiler.Compile( + new SourceText(source, "test.il"), + _ => throw new InvalidOperationException("Unexpected include"), + _ => throw new InvalidOperationException("Unexpected resource"), + new Options { ErrorTolerant = true }); + + Assert.Contains(diagnostics, diagnostic => diagnostic.Id == "Parser"); + Assert.NotNull(image); + + var imageBuilder = new BlobBuilder(); + image!.Serialize(imageBuilder); + return new PEReader(imageBuilder.ToImmutableArray()); + } } } diff --git a/src/tools/ilasm/tests/ILAssembler.Tests/ExceptionHandlingTests.cs b/src/tools/ilasm/tests/ILAssembler.Tests/ExceptionHandlingTests.cs index 35984ed433dd62..5991798df8a6ad 100644 --- a/src/tools/ilasm/tests/ILAssembler.Tests/ExceptionHandlingTests.cs +++ b/src/tools/ilasm/tests/ILAssembler.Tests/ExceptionHandlingTests.cs @@ -653,6 +653,68 @@ leave.s DONE Assert.Equal(3, region.HandlerLength); } + [Fact] + public void UndefinedLabelsInExceptionRegion_ReportDiagnostics() + { + string source = """ + .assembly extern mscorlib { } + .assembly test { } + .class public auto ansi beforefieldinit Test extends [mscorlib]System.Object + { + .method public static void M() cil managed + { + .maxstack 1 + .try MISSING_START to TRY_END filter MISSING_FILTER handler HANDLER_START to HANDLER_END + TRY_START: + nop + leave.s DONE + TRY_END: + FILTER_START: + pop + ldc.i4.1 + endfilter + HANDLER_START: + pop + leave.s DONE + HANDLER_END: + DONE: + ret + } + } + """; + + DocumentCompiler compiler = new(); + (ImmutableArray diagnostics, CompilationResult? result) = compiler.Compile( + new SourceText(source, "test.il"), + _ => throw new InvalidOperationException("Unexpected include"), + _ => throw new InvalidOperationException("Unexpected resource"), + new Options { ErrorTolerant = true }); + + Diagnostic[] labelErrors = diagnostics + .Where(diagnostic => diagnostic.Id == DiagnosticIds.LabelNotFound) + .ToArray(); + Assert.Collection( + labelErrors, + diagnostic => + { + Assert.Equal("Label 'MISSING_START' not found", diagnostic.Message); + Assert.Equal( + source.IndexOf("MISSING_START", StringComparison.Ordinal), + diagnostic.Location.Span.Start); + }, + diagnostic => + { + Assert.Equal("Label 'MISSING_FILTER' not found", diagnostic.Message); + Assert.Equal( + source.IndexOf("MISSING_FILTER", StringComparison.Ordinal), + diagnostic.Location.Span.Start); + }); + Assert.NotNull(result); + + BlobBuilder image = new(); + result!.Serialize(image); + } + [Fact] public void NestedTryBlocks_EmitInnerRegionBeforeOuterRegion() { diff --git a/src/tools/ilasm/tests/ILAssembler.Tests/InstructionTests.cs b/src/tools/ilasm/tests/ILAssembler.Tests/InstructionTests.cs index e7706f78f97126..c3c031dfac1b20 100644 --- a/src/tools/ilasm/tests/ILAssembler.Tests/InstructionTests.cs +++ b/src/tools/ilasm/tests/ILAssembler.Tests/InstructionTests.cs @@ -733,6 +733,40 @@ .method public static void F() cil managed Assert.Equal(expected, BitConverter.Int64BitsToDouble(BinaryPrimitives.ReadInt64LittleEndian(il.AsSpan(1)))); } + [Theory] + [InlineData("01", 1)] + [InlineData("012", 10)] + [InlineData("-012", -10)] + public void LdcI4_MultiDigitOctalLiteral_EmitsExpectedValue(string literal, int expected) + { + string source = $$""" + .assembly Test { } + .class public auto ansi Test + { + .method public static void F() cil managed + { + ldc.i4 {{literal}} + pop + ret + } + } + """; + + using var pe = DocumentCompilerTestHelpers.CompileAndGetReader(source, new Options()); + byte[] il = GetMethodIL(pe, "F"); + + int actual = il[0] switch + { + 0x15 => -1, + >= 0x16 and <= 0x1E => il[0] - 0x16, + 0x1F => unchecked((sbyte)il[1]), + 0x20 => BinaryPrimitives.ReadInt32LittleEndian(il.AsSpan(1)), + _ => throw new InvalidOperationException($"Unexpected ldc.i4 opcode 0x{il[0]:X2}"), + }; + + Assert.Equal(expected, actual); + } + [Fact] public void LdcR4_IntegerLiteral_PreservesValue() { diff --git a/src/tools/ilasm/tests/ILAssembler.Tests/ManifestResourceTests.cs b/src/tools/ilasm/tests/ILAssembler.Tests/ManifestResourceTests.cs index afd14a7d827443..8dff421de8cd09 100644 --- a/src/tools/ilasm/tests/ILAssembler.Tests/ManifestResourceTests.cs +++ b/src/tools/ilasm/tests/ILAssembler.Tests/ManifestResourceTests.cs @@ -115,7 +115,7 @@ .class public auto ansi beforefieldinit Test resourceLocator: alias => { Assert.Equal("MissingAlias", alias); - return null!; + return null; }); var strictDiagnostic = Assert.Single(strictDiagnostics.Where(d => d.Id == DiagnosticIds.FileNotFound)); @@ -129,7 +129,7 @@ .class public auto ansi beforefieldinit Test resourceLocator: alias => { Assert.Equal("MissingAlias", alias); - return null!; + return null; }); var tolerantDiagnostic = Assert.Single(tolerantDiagnostics.Where(d => d.Id == DiagnosticIds.FileNotFound)); @@ -143,7 +143,54 @@ .class public auto ansi beforefieldinit Test Assert.Equal("Missing.Resource", reader.GetString(resource.Name)); Assert.True(resource.Implementation.IsNil); Assert.Equal(0u, resource.Offset); - Assert.Equal(0, pe.PEHeaders.CorHeader!.ResourcesDirectory.Size); + Assert.Equal(4, pe.PEHeaders.CorHeader!.ResourcesDirectory.Size); + Assert.Empty(ReadEmbeddedResource(pe, resource)); + } + + [Fact] + public void MissingEmbeddedManifestResource_DoesNotAliasFollowingResource() + { + string source = """ + .assembly test { } + .mresource public Missing.Resource as MissingAlias + { + } + .mresource public Valid.Resource as ValidAlias + { + } + .class public auto ansi beforefieldinit Test + { + } + """; + byte[] expectedResourceBytes = [0x10, 0x20, 0x30, 0x40]; + + var (diagnostics, imageBytes) = CompileAndGetImageBytes( + source, + new Options { ErrorTolerant = true }, + resourceLocator: alias => alias switch + { + "MissingAlias" => null, + "ValidAlias" => expectedResourceBytes, + _ => throw new InvalidOperationException($"Unexpected resource alias: {alias}") + }); + + var diagnostic = Assert.Single(diagnostics); + Assert.Equal(DiagnosticIds.FileNotFound, diagnostic.Id); + Assert.False(imageBytes.IsDefault); + + using var pe = new PEReader(imageBytes); + var reader = pe.GetMetadataReader(); + ManifestResource[] resources = reader.ManifestResources + .Select(reader.GetManifestResource) + .ToArray(); + + Assert.Equal(2, resources.Length); + Assert.Equal("Missing.Resource", reader.GetString(resources[0].Name)); + Assert.Equal(0u, resources[0].Offset); + Assert.Empty(ReadEmbeddedResource(pe, resources[0])); + Assert.Equal("Valid.Resource", reader.GetString(resources[1].Name)); + Assert.Equal(4u, resources[1].Offset); + Assert.Equal(expectedResourceBytes, ReadEmbeddedResource(pe, resources[1])); } [Fact] @@ -220,7 +267,7 @@ private static (ImmutableArray Diagnostics, ImmutableArray Ima string source, Options options, Func? includedDocumentLoader = null, - Func? resourceLocator = null) + Func? resourceLocator = null) { return CompileAndGetImageBytes( ImmutableArray.Create(new SourceText(source, "test.il")), @@ -233,7 +280,7 @@ private static (ImmutableArray Diagnostics, ImmutableArray Ima ImmutableArray documents, Options options, Func? includedDocumentLoader = null, - Func? resourceLocator = null) + Func? resourceLocator = null) { var compiler = new DocumentCompiler(); var (diagnostics, image) = compiler.Compile( diff --git a/src/tools/ilasm/tests/ILAssembler.Tests/SourceDirectiveTests.cs b/src/tools/ilasm/tests/ILAssembler.Tests/SourceDirectiveTests.cs index e184de67a8fed5..d9b916524a634d 100644 --- a/src/tools/ilasm/tests/ILAssembler.Tests/SourceDirectiveTests.cs +++ b/src/tools/ilasm/tests/ILAssembler.Tests/SourceDirectiveTests.cs @@ -24,6 +24,7 @@ public class SourceDirectiveTests private const string CSharpLanguageGuid = "{3F5162F8-07C6-11D3-9053-00C04FA302A1}"; private const string CSharpVendorGuid = "{994B45C4-E6E9-11D2-903F-00C04FA302A1}"; private const string DocumentTypeGuid = "{5A869D0B-6611-11D3-BD2A-0000F80849BD}"; + private const string VisualBasicLanguageGuid = "{3A12D0B8-C26C-11D0-B442-00A0244A1DD2}"; [Fact] public void LanguageDecl_DoesNotThrow() @@ -521,6 +522,65 @@ .line 20 "doc2.cs" Assert.Equal(pe.GetMetadataReader().MethodDefinitions.Count, pdbReader.MethodDebugInformation.Count); } + [Fact] + public void MultiDocumentCompile_WithDifferentLanguages_PreservesEachPdbDocumentLanguage() + { + ImmutableArray documents = + [ + new SourceText($$""" + .assembly test { } + .language '{{CSharpLanguageGuid}}' + .class public auto ansi First + { + .method public static void M1() cil managed + { + .line 10 "first.cs" + nop + ret + } + } + """, "first.il"), + new SourceText($$""" + .language '{{VisualBasicLanguageGuid}}' + .class public auto ansi Second + { + .method public static void M2() cil managed + { + .line 20 "second.vb" + nop + ret + } + } + """, "second.il"), + ]; + + DocumentCompiler compiler = new(); + (ImmutableArray diagnostics, CompilationResult? result) = compiler.Compile( + documents, + _ => throw new InvalidOperationException("Unexpected include"), + _ => throw new InvalidOperationException("Unexpected resource"), + new Options { Pdb = true }); + + Assert.Empty(diagnostics); + Assert.NotNull(result); + + BlobBuilder image = new(); + result!.Serialize(image); + using PEReader pe = new(image.ToImmutableArray()); + DebugDirectoryEntry embeddedPdb = Assert.Single( + pe.ReadDebugDirectory(), + entry => entry.Type == DebugDirectoryEntryType.EmbeddedPortablePdb); + using MetadataReaderProvider pdbProvider = + pe.ReadEmbeddedPortablePdbDebugDirectoryData(embeddedPdb); + MetadataReader pdbReader = pdbProvider.GetMetadataReader(); + Dictionary documentLanguages = pdbReader.Documents.ToDictionary( + handle => pdbReader.GetString(pdbReader.GetDocument(handle).Name), + handle => pdbReader.GetGuid(pdbReader.GetDocument(handle).Language)); + + Assert.Equal(Guid.Parse(CSharpLanguageGuid), documentLanguages["first.cs"]); + Assert.Equal(Guid.Parse(VisualBasicLanguageGuid), documentLanguages["second.vb"]); + } + [Fact] public void MultiDocumentCompile_DoesNotReusePreviousDocumentPath() { diff --git a/src/tools/ilasm/tests/ILAssembler.Tests/SyntaxTests.cs b/src/tools/ilasm/tests/ILAssembler.Tests/SyntaxTests.cs index 97295ecaa3a332..259cdb70c7bb4a 100644 --- a/src/tools/ilasm/tests/ILAssembler.Tests/SyntaxTests.cs +++ b/src/tools/ilasm/tests/ILAssembler.Tests/SyntaxTests.cs @@ -13,6 +13,7 @@ using System.Reflection.PortableExecutable; using System.Text; using System.Threading.Tasks; +using Antlr4.Runtime; using Internal.IL; using Xunit; using DocumentCompilerTestHelpers = ILAssembler.Tests.DocumentCompilerTestHelpers; @@ -37,6 +38,25 @@ public void StringHelpers_ParsesEscapeSequences(string input, string expected) Assert.Equal(expected, result); } + [Fact] + public void StringCharStream_SeekPastEnd_ClampsToEnd() + { + Type streamType = typeof(DocumentCompiler).Assembly.GetType( + "ILAssembler.StringCharStream", + throwOnError: true)!; + var stream = (ICharStream)Activator.CreateInstance( + streamType, + BindingFlags.Instance | BindingFlags.NonPublic, + binder: null, + args: ["abc", "test.il"], + culture: null)!; + + stream.Seek(10); + + Assert.Equal(stream.Size, stream.Index); + Assert.Equal(TokenConstants.EOF, stream.LA(1)); + } + [Fact] public void Diagnostic_LiteralOutOfRange() @@ -55,6 +75,132 @@ .pack 99999999999999999999999999999999 Assert.Equal(DiagnosticSeverity.Error, error.Severity); } + [Theory] + [InlineData("018")] + [InlineData("09")] + [InlineData("-018")] + public void InvalidOctalIntegerLiteral_ReportsDiagnostic(string literal) + { + string source = $$""" + .class public auto ansi beforefieldinit Test + { + .pack {{literal}} + } + """; + + var diagnostics = DocumentCompilerTestHelpers.CompileAndGetDiagnostics(source, new Options()); + + var error = Assert.Single(diagnostics); + Assert.Equal(DiagnosticIds.InvalidOctalLiteral, error.Id); + Assert.Equal(DiagnosticSeverity.Error, error.Severity); + Assert.Equal($"The value '{literal}' is not a valid octal literal", error.Message); + } + + [Fact] + public void OctalIntegerLiteral_ParsesValidDigits() + { + using var pe = DocumentCompilerTestHelpers.CompileAndGetReader( + """ + .class public auto ansi beforefieldinit Test + { + .pack 010 + } + """, + new Options()); + + var reader = pe.GetMetadataReader(); + var type = reader.GetTypeDefinition(MetadataTokens.TypeDefinitionHandle(2)); + + Assert.Equal(8, type.GetLayout().PackingSize); + } + + [Theory] + [InlineData("not-a-number", double.MaxValue)] + [InlineData("-not-a-number", double.MinValue)] + public void InvalidFloatingLiteral_SaturatesWithOriginalSign(string text, double expected) + { + object actions = CreateGrammarActions(); + Type grammarActionsType = actions.GetType(); + MethodInfo parseFloatingLiteral = grammarActionsType.GetMethod( + "ParseFloatingLiteral", + BindingFlags.Instance | BindingFlags.NonPublic)!; + var token = new CommonToken(CILLexer.FLOAT64, text); + + Assert.Equal(expected, (double)parseFloatingLiteral.Invoke(actions, [token])!); + } + + [Theory] + [InlineData("ParseBoolean", 0)] + [InlineData("ParseFileAttribute", 1)] + [InlineData("ParseSecurityAction", 1)] + [InlineData("ParseVTableFixupAttribute", 0)] + [InlineData("ParseManifestResourceAttribute", 0)] + public void InvalidSingleTokenConversion_ReturnsSafeFallback( + string methodName, + int expected) + { + object actions = CreateGrammarActions(); + MethodInfo conversion = actions.GetType().GetMethod( + methodName, + BindingFlags.Instance | BindingFlags.NonPublic)!; + var token = new CommonToken(CILLexer.ID, "invalid"); + + object result = conversion.Invoke(actions, [token])!; + + Assert.Equal(expected, Convert.ToInt32(result)); + } + + [Fact] + public void InvalidContextSingleTokenConversions_ReturnSafeFallback() + { + object actions = CreateGrammarActions(); + Type actionsType = actions.GetType(); + var token = new CommonToken(CILLexer.ID, "invalid"); + var parent = new ParserRuleContext(); + var assemblyContext = new CILParser.AsmAttrAnyContext(parent, invokingState: 0) + { + Start = token, + Stop = token, + }; + var exportedTypeContext = new CILParser.ExptAttrContext(parent, invokingState: 0) + { + Start = token, + Stop = token, + }; + + actionsType.GetMethod( + "SetAssemblyAttribute", + BindingFlags.Instance | BindingFlags.NonPublic)! + .Invoke(actions, [assemblyContext]); + actionsType.GetMethod( + "SetExportedTypeAttribute", + BindingFlags.Instance | BindingFlags.NonPublic)! + .Invoke(actions, [exportedTypeContext]); + + Assert.Equal(0, (int)assemblyContext.Value); + Assert.Equal(0, (int)assemblyContext.Mask); + Assert.Equal(0, (int)exportedTypeContext.Value); + Assert.Equal(0, (int)exportedTypeContext.Mask); + } + + [Fact] + public void SyntheticToken_SourceSpanIsClamped() + { + var token = new CommonToken(CILLexer.Eof) + { + StartIndex = -1, + StopIndex = -1, + }; + MethodInfo getSourceSpan = typeof(Location).GetMethod( + "GetSourceSpan", + BindingFlags.Static | BindingFlags.NonPublic)!; + + SourceSpan span = (SourceSpan)getSourceSpan.Invoke(obj: null, [token])!; + + Assert.Equal(0, span.Start); + Assert.Equal(0, span.Length); + } + [Fact] public void Diagnostic_FileNotFound() @@ -308,6 +454,7 @@ .method public static void M() cil managed } """)] [InlineData(".permission demand class X (Name = )")] + [InlineData(".class public auto ansi Test { .field public static literal bool F = bool(invalid true) }")] [InlineData(".class extern { }")] [InlineData(".class public auto ansi Test { .export public { } }")] [InlineData(".assembly extern Name { .ver : }")] @@ -320,6 +467,115 @@ public void MalformedTypedGrammarValues_ReportParserDiagnosticsInsteadOfThrowing Assert.Contains(diagnostics, diagnostic => diagnostic.Id == "Parser"); } + private static object CreateGrammarActions() + { + Type grammarActionsType = typeof(DocumentCompiler).Assembly.GetType( + "ILAssembler.GrammarActions", + throwOnError: true)!; + return Activator.CreateInstance( + grammarActionsType, + BindingFlags.Instance | BindingFlags.NonPublic, + binder: null, + args: + [ + new Dictionary(), + new Options(), + (Func)(_ => throw new InvalidOperationException("Unexpected resource")), + ], + culture: null)!; + } + + [Theory] + [InlineData("[mscorlib]System.Object")] + [InlineData("[.module Other.netmodule]System.Object")] + [InlineData("System.Object")] + [InlineData("class [mscorlib]System.Object")] + [InlineData("class [.module Other.netmodule]System.Object")] + [InlineData("class [mscorlib]Generic`1")] + public void EmptyClasses_DoNotBufferFollowingDeclarations(string baseType) + { + var source = new StringBuilder(".assembly extern mscorlib { } .module extern Other.netmodule "); + for (int i = 0; i < 100; i++) + { + source.Append($".class public C{i} extends {baseType} {{ }} "); + } + + var tokens = new MeasuringTokenStream(new CILLexer(new AntlrInputStream(source.ToString()))); + CILParser parser = CreateParser(tokens); + + parser.decls(); + + Assert.Equal(0, parser.NumberOfSyntaxErrors); + Assert.Equal(TokenConstants.EOF, tokens.LA(1)); + Assert.InRange(tokens.MaximumBufferedTokens, 1, 64); + } + + [Theory] + [InlineData("[Scope]", false)] + [InlineData("method void [Scope]::Target()", false)] + [InlineData("field int32 [Scope]::Value", false)] + [InlineData("[.module Scope]", true)] + [InlineData("method void [.module Scope]::Target()", true)] + [InlineData("field int32 [.module Scope]::Value", true)] + public void BareScopes_ArePreservedForOwners(string source, bool isModule) + { + var tokens = new UnbufferedTokenStream(new CILLexer(new AntlrInputStream(source))); + CILParser parser = CreateParser(tokens); + + CILParser.OwnerTypeContext owner = parser.ownerType(); + + Assert.Equal(0, parser.NumberOfSyntaxErrors); + Assert.False(owner.HasSyntaxError); + Assert.Equal(TokenConstants.EOF, tokens.LA(1)); + CILParser.TypeSpecificationValue? scope = owner.Value switch + { + CILParser.TypeOwnerValue type => type.Type, + CILParser.MemberOwnerValue + { + Member: CILParser.MethodMemberReferenceValue + { + Method: CILParser.ParsedMethodReferenceValue method + } + } => method.Owner, + CILParser.MemberOwnerValue + { + Member: CILParser.FieldMemberReferenceValue + { + Field: CILParser.ParsedFieldReferenceValue field + } + } => field.Owner, + _ => throw new InvalidOperationException($"Unexpected owner: {owner.Value}") + }; + if (isModule) + { + Assert.Equal("Scope", Assert.IsType(scope).ModuleName); + } + else + { + Assert.Equal("Scope", Assert.IsType(scope).AssemblyName); + } + } + + private static CILParser CreateParser(ITokenStream tokens) + { + var parser = new CILParser(tokens) { BuildParseTree = false }; + typeof(CILParser).GetProperty("Actions", BindingFlags.Instance | BindingFlags.NonPublic)! + .SetValue(parser, CreateGrammarActions()); + + return parser; + } + + private sealed class MeasuringTokenStream(ITokenSource source) : UnbufferedTokenStream(source) + { + public int MaximumBufferedTokens { get; private set; } + + public override void Release(int marker) + { + MaximumBufferedTokens = Math.Max(MaximumBufferedTokens, n); + base.Release(marker); + } + } + public static TheoryData TruncatedDirectiveMutations { get diff --git a/src/tools/ilasm/tests/ILAssembler.Tests/TypeDefinitionTests.cs b/src/tools/ilasm/tests/ILAssembler.Tests/TypeDefinitionTests.cs index aae8196e76a4b4..857eff8d611114 100644 --- a/src/tools/ilasm/tests/ILAssembler.Tests/TypeDefinitionTests.cs +++ b/src/tools/ilasm/tests/ILAssembler.Tests/TypeDefinitionTests.cs @@ -508,6 +508,26 @@ .class public auto ansi beforefieldinit MyType extends [mscorlib]System.Object { Assert.Equal("System.Tests", reader.GetString(typeDef.Namespace)); } + [Fact] + public void Namespace_DottedTypeName_ComposesWithSeparator() + { + string source = """ + .assembly extern mscorlib { } + .assembly Test { } + .namespace Outer + { + .class public auto ansi beforefieldinit Inner.Type extends [mscorlib]System.Object { } + } + """; + + using var pe = DocumentCompilerTestHelpers.CompileAndGetReader(source, new Options()); + var reader = pe.GetMetadataReader(); + + var typeDef = reader.GetTypeDefinition(MetadataTokens.TypeDefinitionHandle(2)); + Assert.Equal("Type", reader.GetString(typeDef.Name)); + Assert.Equal("Outer.Inner", reader.GetString(typeDef.Namespace)); + } + [Fact] public void LeadingDotInTypeName_Preserved() diff --git a/src/tools/ilasm/tests/ILAssembler.Tests/TypedefTests.cs b/src/tools/ilasm/tests/ILAssembler.Tests/TypedefTests.cs index ac9b09e0bad4f8..cceb2214c59306 100644 --- a/src/tools/ilasm/tests/ILAssembler.Tests/TypedefTests.cs +++ b/src/tools/ilasm/tests/ILAssembler.Tests/TypedefTests.cs @@ -95,6 +95,27 @@ .field public UndefinedTypedef myField Assert.Equal(DiagnosticSeverity.Error, error.Severity); } + [Fact] + public void Typedef_CustomAttributeAliasNotFound_ReportsError() + { + string source = """ + .assembly test { } + .class public auto ansi Test + { + MissingAttributeAlias + } + """; + + Diagnostic error = Assert.Single( + DocumentCompilerTestHelpers.CompileAndGetDiagnostics(source, new Options())); + + Assert.Equal(DiagnosticIds.TypedefNotFound, error.Id); + Assert.Equal("Typedef 'MissingAttributeAlias' not found", error.Message); + Assert.Equal( + source.IndexOf("MissingAttributeAlias", StringComparison.Ordinal), + error.Location.Span.Start); + } + [Fact] public void Typedef_ResolvedInTypeContext() @@ -143,6 +164,26 @@ .method public static void TestMethod() cil managed Assert.Empty(diagnostics); } + [Fact] + public void Typedef_TypeBlob_ResolvesAsNativeMarshalType() + { + string source = """ + .assembly test { } + .typedef int32 as NativeTypeBlob + .class public auto ansi Test + { + .field public marshal(NativeTypeBlob) int32 Value + } + """; + + using var pe = DocumentCompilerTestHelpers.CompileAndGetReader(source, new Options()); + var reader = pe.GetMetadataReader(); + var type = reader.GetTypeDefinition(MetadataTokens.TypeDefinitionHandle(2)); + var field = reader.GetFieldDefinition(Assert.Single(type.GetFields())); + + Assert.Equal([0x08], reader.GetBlobBytes(field.GetMarshallingDescriptor())); + } + [Fact] public void Typedef_FieldAndCustomAttributeForms_EmitResolvableMetadata() { diff --git a/src/tools/ilasm/tests/ILAssembler.Tests/VTableTests.cs b/src/tools/ilasm/tests/ILAssembler.Tests/VTableTests.cs index c23df5f22cea18..4516e80d449fb3 100644 --- a/src/tools/ilasm/tests/ILAssembler.Tests/VTableTests.cs +++ b/src/tools/ilasm/tests/ILAssembler.Tests/VTableTests.cs @@ -213,5 +213,33 @@ .export [1] Assert.Equal(firstImage, secondImage); } + + [Fact] + public void RawVTable_ReportsDiagnosticInsteadOfThrowing() + { + string source = """ + .assembly test { } + .vtable = (01 00 00 00) + """; + ImmutableArray diagnostics = default; + CompilationResult? result = null; + DocumentCompiler compiler = new(); + + Exception? exception = Record.Exception( + () => (diagnostics, result) = compiler.Compile( + new SourceText(source, "test.il"), + _ => throw new InvalidOperationException("Unexpected include"), + _ => throw new InvalidOperationException("Unexpected resource"), + new Options { ErrorTolerant = true })); + + Assert.Null(exception); + Diagnostic diagnostic = Assert.Single(diagnostics); + Assert.Equal(DiagnosticIds.UnsupportedVTableDeclaration, diagnostic.Id); + Assert.Equal(DiagnosticSeverity.Error, diagnostic.Severity); + Assert.NotNull(result); + + BlobBuilder image = new(); + result!.Serialize(image); + } } }