├── .dockerignore
├── .editorconfig
├── .gitattributes
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── feature_request.md
│ └── question.md
├── pull_request_template.md
└── workflows
│ ├── create-release.yml
│ ├── syntax-checker.yml
│ └── test-build.yml
├── .gitignore
├── .gitmodules
├── CONTRIBUTING.md
├── Directory.Build.props
├── Directory.Packages.props
├── Dockerfile
├── Dockerfile.NonEnglish
├── GitVersion.yml
├── LICENSE-libyaml
├── LICENSE.txt
├── README.md
├── YamlDotNet.Analyzers.StaticGenerator
├── ClassObject.cs
├── EnumMappings.cs
├── File.cs
├── ObjectAccessorFileGenerator.cs
├── SerializableSyntaxReceiver.cs
├── StaticContextFile.cs
├── StaticObjectFactoryFile.cs
├── StaticPropertyDescriptorFile.cs
├── StaticTypeInspectorFile.cs
├── StaticTypeResolverFile.cs
├── SymbolCollectionExtensions.cs
├── SymbolExtensions.cs
├── TypeFactoryGenerator.cs
└── YamlDotNet.Analyzers.StaticGenerator.csproj
├── YamlDotNet.Benchmark
├── BigFileBenchmark.cs
├── Program.cs
├── Resources
│ ├── saltern.yml
│ └── saltern.yml.gz
├── SerializationBenchmarks.cs
├── YamlDotNet.Benchmark.csproj
└── YamlStreamBenchmark.cs
├── YamlDotNet.Core7AoTCompileTest.Model
├── ExternalModel.cs
└── YamlDotNet.Core7AoTCompileTest.Model.csproj
├── YamlDotNet.Core7AoTCompileTest
├── Program.cs
├── StaticAoTContext.cs
└── YamlDotNet.Core7AoTCompileTest.csproj
├── YamlDotNet.Fsharp.Test
├── DeserializerTests.fs
├── SerializerTests.fs
├── StringExtensions.fs
└── YamlDotNet.Fsharp.Test.fsproj
├── YamlDotNet.Samples.Fsharp
├── DeserializeObjectGraph.fs
└── YamlDotNet.Samples.Fsharp.fsproj
├── YamlDotNet.Samples
├── ConvertYamlToJson.cs
├── DeserializeGenericObject.cs
├── DeserializeObjectGraph.cs
├── DeserializingMultipleDocuments.cs
├── Helpers
│ ├── SampleAttribute.cs
│ └── TestOutputHelperExtensions.cs
├── LoadingAYamlStream.cs
├── SerializeObjectGraph.cs
├── UseTypeConverters.cs
├── ValidatingDuringDeserialization.cs
└── YamlDotNet.Samples.csproj
├── YamlDotNet.Test
├── Analyzers
│ └── StaticGenerator
│ │ ├── ObjectTests.cs
│ │ ├── RootCollectionTests.cs
│ │ ├── StaticAoTContext.cs
│ │ └── StructTests.cs
├── Core
│ ├── EmitterTests.cs
│ ├── EmitterTestsHelper.cs
│ ├── EventsHelper.cs
│ ├── InsertionQueueTests.cs
│ ├── LookAheadBufferTests.cs
│ ├── MarkCursorTests.cs
│ ├── ParserTests.cs
│ ├── ScannerTests.cs
│ ├── TokenHelper.cs
│ └── YamlExceptionTests.cs
├── EnumerableExtensions.cs
├── GlobalSuppressions.cs
├── Helpers
│ ├── OrderedDictionaryTests.cs
│ └── PortabilityTests.cs
├── RepresentationModel
│ └── YamlStreamTests.cs
├── Serialization
│ ├── BufferedDeserialization
│ │ ├── KeyValueTypeDiscriminatorTests.cs
│ │ ├── TypeDiscriminatingNodeDeserializerTests.cs
│ │ └── UniqueKeyTypeDiscriminatorTests.cs
│ ├── ComplexYamlTypeConverterTests.cs
│ ├── DateOnlyConverterTests.cs
│ ├── DateTime8601ConverterTests.cs
│ ├── DateTimeConverterTests.cs
│ ├── DateTimeOffsetConverterTests.cs
│ ├── DeserializerTest.cs
│ ├── EmitDefaultValuesTests.cs
│ ├── ForcedPlainStyleTests.cs
│ ├── GenericTestDictionary.cs
│ ├── GenericTestList.cs
│ ├── HiddenPropertyTests.cs
│ ├── MergingParserTests.cs
│ ├── NamingConventionTests.cs
│ ├── ObjectFactoryTests.cs
│ ├── PrivateConstructorTests.cs
│ ├── RepresentationModelSerializationTests.cs
│ ├── SerializationTestHelper.cs
│ ├── SerializationTests.cs
│ ├── TimeOnlyConverterTests.cs
│ ├── TypeConverterAttributeTests.cs
│ ├── TypeConverterTests.cs
│ └── YamlCommentTests.cs
├── Spec
│ ├── ParserSpecTests.cs
│ ├── SerializerSpecTests.cs
│ └── SpecTestData.cs
├── StringExtensions.cs
├── Yaml.cs
├── YamlDotNet.Test.csproj
├── YamlTests.cs
├── files
│ ├── 01-directives.yaml
│ ├── 02-scalar-in-imp-doc.yaml
│ ├── 03-scalar-in-exp-doc.yaml
│ ├── 04-scalars-in-multi-docs.yaml
│ ├── 05-circular-sequence.yaml
│ ├── 06-float-tag.yaml
│ ├── 07-scalar-styles.yaml
│ ├── 08-flow-sequence.yaml
│ ├── 09-flow-mapping.yaml
│ ├── 10-mixed-nodes-in-sequence.yaml
│ ├── 11-mixed-nodes-in-mapping.yaml
│ ├── 12-compact-sequence.yaml
│ ├── 13-compact-mapping.yaml
│ ├── 14-mapping-wo-indent.yaml
│ ├── anchors-overwriting.yaml
│ ├── backreference.yaml
│ ├── backwards-alias.yaml
│ ├── convertible.template
│ ├── dictionary-explicit.yaml
│ ├── dictionary.yaml
│ ├── explicit-type.template
│ ├── fail-backreference.yaml
│ ├── forward-alias.yaml
│ ├── guid.yaml
│ ├── invalid-reference.yaml
│ ├── list-explicit.yaml
│ ├── list-of-dictionaries.yaml
│ ├── list.yaml
│ ├── local-tags.yaml
│ ├── multi-doc-tag.yaml
│ ├── ordered-properties.yaml
│ ├── tags.yaml
│ └── unicode-32bits-escape.yaml
├── xunit.runner.linux.json
└── xunit.runner.windows.json
├── YamlDotNet.sln
├── YamlDotNet.snk
├── YamlDotNet
├── Core
│ ├── AnchorName.cs
│ ├── AnchorNotFoundException.cs
│ ├── CharacterAnalyzer.cs
│ ├── Constants.cs
│ ├── Cursor.cs
│ ├── Emitter.cs
│ ├── EmitterSettings.cs
│ ├── EmitterState.cs
│ ├── Events
│ │ ├── AnchorAlias.cs
│ │ ├── Comment.cs
│ │ ├── DocumentEnd.cs
│ │ ├── DocumentStart.cs
│ │ ├── EventType.cs
│ │ ├── IParsingEventVisitor.cs
│ │ ├── MappingEnd.cs
│ │ ├── MappingStart.cs
│ │ ├── MappingStyle.cs
│ │ ├── NodeEvent.cs
│ │ ├── ParsingEvent.cs
│ │ ├── Scalar.cs
│ │ ├── SequenceEnd.cs
│ │ ├── SequenceStart.cs
│ │ ├── SequenceStyle.cs
│ │ ├── StreamEnd.cs
│ │ └── StreamStart.cs
│ ├── ForwardAnchorNotSupportedException.cs
│ ├── HashCode.cs
│ ├── IEmitter.cs
│ ├── ILookAheadBuffer.cs
│ ├── IParser.cs
│ ├── IScanner.cs
│ ├── InsertionQueue.cs
│ ├── LookAheadBuffer.cs
│ ├── Mark.cs
│ ├── MaximumRecursionLevelReachedException.cs
│ ├── MergingParser.cs
│ ├── ObjectPool
│ │ ├── DefaultObjectPool.cs
│ │ ├── DefaultPooledObjectPolicy.cs
│ │ ├── IPooledObjectPolicy.cs
│ │ ├── IResettable.cs
│ │ ├── ObjectPool.cs
│ │ ├── StringBuilderPool.cs
│ │ ├── StringBuilderPooledObjectPolicy.cs
│ │ └── StringLookAheadBufferPool.cs
│ ├── Parser.cs
│ ├── ParserExtensions.cs
│ ├── ParserState.cs
│ ├── RecursionLevel.cs
│ ├── ScalarStyle.cs
│ ├── Scanner.cs
│ ├── SemanticErrorException.cs
│ ├── SimpleKey.cs
│ ├── StringLookAheadBuffer.cs
│ ├── SyntaxErrorException.cs
│ ├── TagDirectiveCollection.cs
│ ├── TagName.cs
│ ├── Tokens
│ │ ├── Anchor.cs
│ │ ├── AnchorAlias.cs
│ │ ├── BlockEnd.cs
│ │ ├── BlockEntry.cs
│ │ ├── BlockMappingStart.cs
│ │ ├── BlockSequenceStart.cs
│ │ ├── Comment.cs
│ │ ├── DocumentEnd.cs
│ │ ├── DocumentStart.cs
│ │ ├── Error.cs
│ │ ├── FlowEntry.cs
│ │ ├── FlowMappingEnd.cs
│ │ ├── FlowMappingStart.cs
│ │ ├── FlowSequenceEnd.cs
│ │ ├── FlowSequenceStart.cs
│ │ ├── Key.cs
│ │ ├── Scalar.cs
│ │ ├── StreamEnd.cs
│ │ ├── StreamStart.cs
│ │ ├── Tag.cs
│ │ ├── TagDirective.cs
│ │ ├── Token.cs
│ │ ├── Value.cs
│ │ └── VersionDirective.cs
│ ├── Version.cs
│ └── YamlException.cs
├── CultureInfoAdapter.cs
├── Helpers
│ ├── DefaultFsharpHelper.cs
│ ├── DictionaryExtensions.cs
│ ├── ExpressionExtensions.cs
│ ├── FsharpHelper.cs
│ ├── GenericCollectionToNonGenericAdapter.cs
│ ├── GenericDictionaryToNonGenericAdapter.cs
│ ├── IFsharpHelper.cs
│ ├── IOrderedDictionary.cs
│ ├── NullFsharpHelper.cs
│ ├── NumberExtensions.cs
│ ├── OrderedDictionary.cs
│ ├── Polyfills.cs
│ ├── ReadOnlyCollectionExtensions.cs
│ └── ThrowHelper.cs
├── Portability
│ └── readme.txt
├── Properties
│ ├── AssemblyInfo.template
│ └── CustomAssemblyInfo.cs
├── PropertyInfoExtensions.cs
├── ReflectionExtensions.cs
├── RepresentationModel
│ ├── DocumentLoadingState.cs
│ ├── EmitterState.cs
│ ├── IYamlVisitor.cs
│ ├── LibYamlEventStream.cs
│ ├── YamlAliasNode.cs
│ ├── YamlDocument.cs
│ ├── YamlMappingNode.cs
│ ├── YamlNode.cs
│ ├── YamlNodeIdentityEqualityComparer.cs
│ ├── YamlNodeType.cs
│ ├── YamlScalarNode.cs
│ ├── YamlSequenceNode.cs
│ ├── YamlStream.cs
│ ├── YamlVisitor.cs
│ └── YamlVisitorBase.cs
├── Serialization
│ ├── BufferedDeserialization
│ │ ├── ITypeDiscriminatingNodeDeserializerOptions.cs
│ │ ├── ParserBuffer.cs
│ │ ├── TypeDiscriminatingNodeDeserializer.cs
│ │ ├── TypeDiscriminatingNodeDeserializerOptions.cs
│ │ └── TypeDiscriminators
│ │ │ ├── IValueTypeDiscriminator.cs
│ │ │ ├── KeyValueTypeDiscriminator.cs
│ │ │ └── UniqueKeyTypeDiscriminator.cs
│ ├── BuilderSkeleton.cs
│ ├── Callbacks
│ │ ├── OnDeserializedAttribute.cs
│ │ ├── OnDeserializingAttribute.cs
│ │ ├── OnSerializedAttribute.cs
│ │ └── OnSerializingAttribute.cs
│ ├── Converters
│ │ ├── DateOnlyConverter.cs
│ │ ├── DateTime8601Converter.cs
│ │ ├── DateTimeConverter.cs
│ │ ├── DateTimeOffsetConverter.cs
│ │ ├── GuidConverter.cs
│ │ ├── SystemTypeConverter.cs
│ │ └── TimeOnlyConverter.cs
│ ├── DefaultValuesHandling.cs
│ ├── Deserializer.cs
│ ├── DeserializerBuilder.cs
│ ├── EmissionPhaseObjectGraphVisitorArgs.cs
│ ├── EventEmitters
│ │ ├── ChainedEventEmitter.cs
│ │ ├── JsonEventEmitter.cs
│ │ ├── TypeAssigningEventEmitter.cs
│ │ └── WriterEventEmitter.cs
│ ├── EventInfo.cs
│ ├── IAliasProvider.cs
│ ├── IDeserializer.cs
│ ├── IEventEmitter.cs
│ ├── INamingConvention.cs
│ ├── INodeDeserializer.cs
│ ├── INodeTypeResolver.cs
│ ├── IObjectAccessor.cs
│ ├── IObjectDescriptor.cs
│ ├── IObjectFactory.cs
│ ├── IObjectGraphTraversalStrategy.cs
│ ├── IObjectGraphVisitor.cs
│ ├── IPropertyDescriptor.cs
│ ├── IRegistrationLocationSelectionSyntax.cs
│ ├── ISerializer.cs
│ ├── ITypeInspector.cs
│ ├── ITypeResolver.cs
│ ├── IValueDeserializer.cs
│ ├── IValuePromise.cs
│ ├── IValueSerializer.cs
│ ├── IYamlConvertible.cs
│ ├── IYamlSerializable.cs
│ ├── IYamlTypeConverter.cs
│ ├── LazyComponentRegistrationList.cs
│ ├── LazyComponentRegistrationListExtensions.cs
│ ├── NamingConventions
│ │ ├── CamelCaseNamingConvention.cs
│ │ ├── HyphenatedNamingConvention.cs
│ │ ├── LowerCaseNamingConvention.cs
│ │ ├── NullNamingConvention.cs
│ │ ├── PascalCaseNamingConvention.cs
│ │ └── UnderscoredNamingConvention.cs
│ ├── NodeDeserializers
│ │ ├── ArrayNodeDeserializer.cs
│ │ ├── CollectionDeserializer.cs
│ │ ├── CollectionNodeDeserializer.cs
│ │ ├── DictionaryDeserializer.cs
│ │ ├── DictionaryNodeDeserializer.cs
│ │ ├── EnumerableNodeDeserializer.cs
│ │ ├── FsharpListNodeDeserializer.cs
│ │ ├── NullNodeDeserializer.cs
│ │ ├── ObjectNodeDeserializer.cs
│ │ ├── ScalarNodeDeserializer.cs
│ │ ├── StaticArrayNodeDeserializer.cs
│ │ ├── StaticCollectionNodeDeserializer.cs
│ │ ├── StaticDictionaryNodeDeserializer.cs
│ │ ├── TypeConverterNodeDeserializer.cs
│ │ ├── YamlConvertibleNodeDeserializer.cs
│ │ └── YamlSerializableNodeDeserializer.cs
│ ├── NodeTypeResolvers
│ │ ├── DefaultContainersNodeTypeResolver.cs
│ │ ├── MappingNodeTypeResolver.cs
│ │ ├── RejectUnknownTagsNodeTypeResolver.cs
│ │ ├── TagNodeTypeResolver.cs
│ │ ├── TypeNameInTagNodeTypeResolver.cs
│ │ ├── YamlConvertibleTypeResolver.cs
│ │ └── YamlSerializableTypeResolver.cs
│ ├── Nothing.cs
│ ├── ObjectDescriptor.cs
│ ├── ObjectFactories
│ │ ├── DefaultObjectFactory.cs
│ │ ├── LambdaObjectFactory.cs
│ │ ├── ObjectFactoryBase.cs
│ │ └── StaticObjectFactory.cs
│ ├── ObjectGraphTraversalStrategies
│ │ ├── FullObjectGraphTraversalStrategy.cs
│ │ └── RoundtripObjectGraphTraversalStrategy.cs
│ ├── ObjectGraphTraversalStrategyFactory.cs
│ ├── ObjectGraphVisitors
│ │ ├── AnchorAssigner.cs
│ │ ├── AnchorAssigningObjectGraphVisitor.cs
│ │ ├── ChainedObjectGraphVisitor.cs
│ │ ├── CommentsObjectGraphVisitor.cs
│ │ ├── CustomSerializationObjectGraphVisitor.cs
│ │ ├── DefaultExclusiveObjectGraphVisitor.cs
│ │ ├── DefaultValuesObjectGraphVisitor.cs
│ │ ├── EmittingObjectGraphVisitor.cs
│ │ └── PreProcessingPhaseObjectGraphVisitorSkeleton.cs
│ ├── PropertyDescriptor.cs
│ ├── Schemas
│ │ └── FailsafeSchema.cs
│ ├── Serializer.cs
│ ├── SerializerBuilder.cs
│ ├── Settings.cs
│ ├── StaticBuilderSkeleton.cs
│ ├── StaticContext.cs
│ ├── StaticDeserializerBuilder.cs
│ ├── StaticSerializerBuilder.cs
│ ├── StreamFragment.cs
│ ├── TagMappings.cs
│ ├── TypeInspectors
│ │ ├── CachedTypeInspector.cs
│ │ ├── CompositeTypeInspector.cs
│ │ ├── NamingConventionTypeInspector.cs
│ │ ├── ReadableAndWritablePropertiesTypeInspector.cs
│ │ ├── ReadableFieldsTypeInspector.cs
│ │ ├── ReadablePropertiesTypeInspector.cs
│ │ ├── ReflectionTypeInspector.cs
│ │ ├── TypeInspectorSkeleton.cs
│ │ └── WritablePropertiesTypeInspector.cs
│ ├── TypeResolvers
│ │ ├── DynamicTypeResolver.cs
│ │ └── StaticTypeResolver.cs
│ ├── Utilities
│ │ ├── IPostDeserializationCallback.cs
│ │ ├── ITypeConverter.cs
│ │ ├── NullTypeConverter.cs
│ │ ├── ObjectAnchorCollection.cs
│ │ ├── ReflectionTypeConverter.cs
│ │ ├── SerializerState.cs
│ │ ├── StringExtensions.cs
│ │ ├── TypeConverter.cs
│ │ └── TypeConverterCache.cs
│ ├── ValueDeserializers
│ │ ├── AliasValueDeserializer.cs
│ │ └── NodeValueDeserializer.cs
│ ├── YamlAttributeOverrides.cs
│ ├── YamlAttributeOverridesInspector.cs
│ ├── YamlAttributesTypeInspector.cs
│ ├── YamlConverterAttribute.cs
│ ├── YamlFormatter.cs
│ ├── YamlIgnoreAttribute.cs
│ ├── YamlMemberAttribute.cs
│ ├── YamlSerializable.cs
│ └── YamlStaticContextAttribute.cs
├── StandardRegexOptions.cs
└── YamlDotNet.csproj
├── appveyor.yml
├── build.cmd
├── build.sh
├── docker-build.sh
├── tools
├── build
│ ├── AutoNumberToStringConverter.cs
│ ├── BuildDefinition.cs
│ ├── GitHubApiModels.cs
│ ├── Program.cs
│ ├── TwitterProvider.cs
│ ├── build.csproj
│ └── build.sln
├── parsers
│ ├── build.ps1
│ ├── perl-yaml-pp
│ │ ├── Dockerfile
│ │ └── parse.pl
│ ├── python
│ │ └── Dockerfile
│ └── reference
│ │ ├── Dockerfile
│ │ └── run.sh
└── syntax-checker
│ ├── Dockerfile
│ ├── build.cmd
│ └── check-syntax.ps1
├── yamldotnet.png
└── yamldotnet.xcf
/.dockerignore:
--------------------------------------------------------------------------------
1 | .git
2 | Dockerfile.NonEnglish
3 | Dockerfile
4 | bin
5 | obj
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.sh text eol=lf
2 | *.cs text eol=crlf
3 | *.fs text eol=crlf
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [EdwardCooke]
2 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is. Please explain what you observe and what you expected to happen instead. If there is an exception, include its message and stack trace.
12 |
13 | **To Reproduce**
14 | Try to add the steps needed to reproduce the problem. Feel free to open a pull request with a failing test if that makes sense. Otherwise, at least provide some code and / or YAML that reproduce the issue.
15 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/question.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Question
3 | about: For general usage questions
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | Feel free to ask any question on how to use the library. Alternatively, consider asking the question on [Stackoverflow](https://stackoverflow.com), tagged with [yamldotnet](https://stackoverflow.com/questions/tagged/yamldotnet).
11 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | ## Welcome!
2 |
3 | Thanks for your interest in contributing to this project. Any contribution will
4 | be gladly accepted, provided that they are generally useful and follow the
5 | conventions of the project.
6 |
7 | 1. Please create **one pull request for each feature**. This results in smaller pull requests that are easier to review and validate.
8 |
9 | 1. **Avoid reformatting existing code** unless you are making other changes to it.
10 | - Cleaning-up of `using`s is acceptable, if you made other changes to that file.
11 | - If you believe that some code is badly formatted and needs fixing, isolate that change in a separate pull request.
12 |
13 | 1. Always add one or more **unit tests** that prove that the feature / fix you are submitting is working correctly.
14 |
15 | 1. Please **describe the motivation** behind the pull request. Explain what was the problem / requirement. Unless the implementation is self-explanatory, also describe the solution.
16 | * Of course, there's no need to be too verbose. Usually one or two lines will be enough.
17 |
18 | 1. Follow the project's [coding conventions](CONTRIBUTING.md#coding-style)
19 |
--------------------------------------------------------------------------------
/.github/workflows/create-release.yml:
--------------------------------------------------------------------------------
1 | name: Create a new release
2 | on:
3 | workflow_dispatch:
4 | inputs:
5 | ref:
6 | description: Commit name to release (defaults to master)
7 | required: false
8 | args:
9 | description: Additional command line arguments
10 | required: false
11 |
12 | jobs:
13 | release:
14 | name: Draft Release
15 | runs-on: ubuntu-latest
16 | env:
17 | DOTNET_CLI_TELEMETRY_OPTOUT: 1
18 | steps:
19 | - name: Checkout the repository
20 | uses: actions/checkout@v2
21 | with:
22 | fetch-depth: 0
23 | ref: ${{ github.event.inputs.ref }}
24 |
25 | # Make sure the required versions of dotnet core on the server
26 | - name: Install dotnet 3.1
27 | uses: actions/setup-dotnet@v3
28 | with:
29 | dotnet-version: 3.1.x
30 |
31 | - name: Install dotnet 6.0
32 | uses: actions/setup-dotnet@v3
33 | with:
34 | dotnet-version: 6.0.x
35 |
36 | - name: Install dotnet 8.0
37 | uses: actions/setup-dotnet@v3
38 | with:
39 | dotnet-version: 8.0.x
40 |
41 | - name: Install GitVersion.Tool
42 | run: dotnet tool install --global GitVersion.Tool
43 |
44 | - name: Create draft release
45 | env:
46 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47 | run: ./build.sh CreateGithubRelease ${{ github.event.inputs.args }}
48 |
--------------------------------------------------------------------------------
/.github/workflows/syntax-checker.yml:
--------------------------------------------------------------------------------
1 | name: Check Yaml Syntax
2 |
3 | on:
4 | issues:
5 | types: [ opened, edited ]
6 |
7 | jobs:
8 | build:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - name: Check syntax on YAML code blocks
12 | uses: docker://aaubry/yamldotnet-syntax-checker:latest
13 | with:
14 | args: -repository ${{ github.repository }} -issueNumber ${{ github.event.issue.number }} -apiToken ${{ secrets.BOT_TOKEN }}
15 |
--------------------------------------------------------------------------------
/.github/workflows/test-build.yml:
--------------------------------------------------------------------------------
1 | name: Test build
2 | on:
3 | workflow_dispatch:
4 | inputs:
5 | ref:
6 | description: Commit name (defaults to master)
7 | required: false
8 | target:
9 | description: Command line
10 | required: true
11 | default: ResolveVersion --verbose
12 |
13 | jobs:
14 | release:
15 | name: Test build
16 | runs-on: ubuntu-latest
17 | env:
18 | DOTNET_CLI_TELEMETRY_OPTOUT: 1
19 | steps:
20 | - name: Checkout the repository
21 | uses: actions/checkout@v2
22 | with:
23 | fetch-depth: 0
24 | ref: ${{ github.event.inputs.ref }}
25 |
26 | - name: Install GitVersion.Tool
27 | run: dotnet tool install --global GitVersion.Tool
28 |
29 | - name: Build
30 | env:
31 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 | TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
33 | TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
34 | TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
35 | TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
36 | run: ./build.sh ${{ github.event.inputs.target }}
37 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
2 | bin
3 | obj
4 |
5 | # mstest test results
6 | TestResults
7 | *.suo
8 | *.user
9 | *.userprefs
10 | *.pidb
11 | *.bak
12 | *.orig
13 | Help/*
14 | release/*
15 | _ReSharper.*
16 | *.pidb
17 | *.userprefs
18 | packages
19 | packages/*
20 | !packages/repositories.config
21 | .vscode
22 |
23 | *.nuspec.tmp
24 | README.html
25 |
26 | samples/dotnet/project.lock.json
27 | YamlDotNet/Properties/AssemblyInfo.Generated.cs
28 |
29 | .vs
30 | .idea
31 |
32 | /YamlDotNet/Properties/AssemblyInfo.cs
33 | BenchmarkDotNet.Artifacts*
34 |
35 | /YamlDotNet.AotTest/exitcode.txt
36 | /tools/build/Properties/launchSettings.json
37 | /YamlDotNet.Unity
38 | *.meta
39 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "BuildUtils.UnityPrerequisites"]
2 | path = BuildUtils.UnityPrerequisites
3 | url = https://github.com/aaubry/BuildUtils.UnityPrerequisites.git
4 | [submodule "yaml-test-suite"]
5 | path = YamlDotNet.Test/yaml-test-suite
6 | url = https://github.com/yaml/yaml-test-suite
7 | branch = data-2022-01-17
8 |
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Antoine Aubry
5 | https://github.com/aaubry/YamlDotNet/wiki
6 | https://github.com/aaubry/YamlDotNet
7 | MIT
8 | Copyright (c) Antoine Aubry and contributors
9 | yaml parser development library serialization
10 |
11 |
12 |
13 | 9999
14 | True
15 | 12.0
16 |
17 |
18 |
19 | true
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Directory.Packages.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | true
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/GitVersion.yml:
--------------------------------------------------------------------------------
1 | mode: ContinuousDelivery
2 | increment: None
3 | commit-message-incrementing: MergeMessageOnly
4 | branches:
5 | master:
6 | commit-message-incrementing: MergeMessageOnly
7 | increment: None
8 | regex: "^master$"
9 |
--------------------------------------------------------------------------------
/LICENSE-libyaml:
--------------------------------------------------------------------------------
1 | Copyright (c) 2006 Kirill Simonov
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7 | of the Software, and to permit persons to whom the Software is furnished to do
8 | so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Antoine Aubry and contributors
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7 | of the Software, and to permit persons to whom the Software is furnished to do
8 | so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
--------------------------------------------------------------------------------
/YamlDotNet.Analyzers.StaticGenerator/EnumMappings.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using Microsoft.CodeAnalysis;
23 |
24 | namespace YamlDotNet.Analyzers.StaticGenerator
25 | {
26 | public class EnumMappings
27 | {
28 | public ITypeSymbol Type { get; set; }
29 | public string ActualName { get; set; }
30 | public string EnumMemberValue { get; set; }
31 |
32 | public EnumMappings(ITypeSymbol type, string actualName, string enumMemberValue)
33 | {
34 | ActualName = actualName;
35 | EnumMemberValue = enumMemberValue;
36 | Type = type;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/YamlDotNet.Analyzers.StaticGenerator/SymbolCollectionExtensions.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System.Collections.Generic;
23 | using System.Linq;
24 | using Microsoft.CodeAnalysis;
25 |
26 | namespace YamlDotNet.Analyzers.StaticGenerator
27 | {
28 | static class SymbolCollectionExtensions
29 | {
30 | public static bool ContainsName(this IEnumerable enumerable, T symbol)
31 | where T : ISymbol
32 | {
33 | return enumerable.Any(t => t.Name == symbol.Name);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/YamlDotNet.Analyzers.StaticGenerator/YamlDotNet.Analyzers.StaticGenerator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | enable
6 | false
7 | true
8 |
9 |
10 |
11 | YamlDotNet.Analyzers.StaticGenerator
12 | YamlDotNet Contributors
13 | Roslyn Code Generator that will generate a static context for use with YamlDotNet to support ahead-of-time and library trimming.
14 | images/yamldotnet.png
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | all
26 | runtime; build; native; contentfiles; analyzers; buildtransitive
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/YamlDotNet.Benchmark/BigFileBenchmark.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System.IO.Compression;
23 | using System.Text;
24 | using BenchmarkDotNet.Attributes;
25 | using FastSerialization;
26 | using YamlDotNet.RepresentationModel;
27 | using YamlDotNet.Serialization;
28 |
29 | namespace YamlDotNet.Benchmark;
30 |
31 | [MemoryDiagnoser]
32 | public class BigFileBenchmark
33 | {
34 | private string yamlString = "";
35 |
36 | [GlobalSetup]
37 | public void Setup()
38 | {
39 | var stringBuilder = new StringBuilder();
40 | //100mb
41 | while (stringBuilder.Length < 1000 * 1000 * 100)
42 | {
43 | stringBuilder.AppendLine("- test");
44 | }
45 | yamlString = stringBuilder.ToString();
46 | }
47 |
48 | [Benchmark]
49 | public void LoadLarge()
50 | {
51 | var deserializer = new DeserializerBuilder().Build();
52 | var result = deserializer.Deserialize>(yamlString);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/YamlDotNet.Benchmark/Program.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using BenchmarkDotNet.Running;
23 | using YamlDotNet.Benchmark;
24 |
25 | BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
26 |
--------------------------------------------------------------------------------
/YamlDotNet.Benchmark/Resources/saltern.yml.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aaubry/YamlDotNet/b8ac2a98ffcc12434eff6c6abb75b38ad1b1ab04/YamlDotNet.Benchmark/Resources/saltern.yml.gz
--------------------------------------------------------------------------------
/YamlDotNet.Benchmark/YamlDotNet.Benchmark.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0;net472
6 | enable
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/YamlDotNet.Benchmark/YamlStreamBenchmark.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using BenchmarkDotNet.Attributes;
23 | using YamlDotNet.RepresentationModel;
24 |
25 | namespace YamlDotNet.Benchmark;
26 |
27 | [MemoryDiagnoser]
28 | public class YamlStreamBenchmark
29 | {
30 | private string yamlString = "";
31 |
32 | [GlobalSetup]
33 | public void Setup()
34 | {
35 | using var reader = new StreamReader(File.OpenRead("Resources/saltern.yml"));
36 | yamlString = reader.ReadToEnd();
37 | }
38 |
39 | [Benchmark]
40 | public void LoadLarge()
41 | {
42 | var yamlStream = new YamlStream();
43 | yamlStream.Load(new StringReader(yamlString));
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/YamlDotNet.Core7AoTCompileTest.Model/ExternalModel.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core7AoTCompileTest.Model;
23 |
24 | public class ExternalModel
25 | {
26 | public string? Text { get; set; }
27 | public string NotNull { get; set; } = string.Empty;
28 | }
29 |
--------------------------------------------------------------------------------
/YamlDotNet.Core7AoTCompileTest.Model/YamlDotNet.Core7AoTCompileTest.Model.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/YamlDotNet.Core7AoTCompileTest/StaticAoTContext.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using YamlDotNet.Core7AoTCompileTest.Model;
23 | using YamlDotNet.Serialization;
24 |
25 | namespace YamlDotNet.Core7AoTCompileTest
26 | {
27 | // The rest of this partial class gets generated at build time
28 | [YamlStaticContext]
29 | [YamlSerializable(typeof(ExternalModel))]
30 | public partial class StaticContext : YamlDotNet.Serialization.StaticContext
31 | {
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/YamlDotNet.Core7AoTCompileTest/YamlDotNet.Core7AoTCompileTest.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 | true
7 | true
8 | enable
9 | true
10 | true
11 |
12 |
13 |
14 | AnyCPU
15 | true
16 | full
17 | false
18 | bin\Debug\
19 | DEBUG;TRACE
20 | prompt
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/YamlDotNet.Fsharp.Test/StringExtensions.fs:
--------------------------------------------------------------------------------
1 | namespace YamlDotNet.Fsharp.Test
2 |
3 | open System.Runtime.CompilerServices
4 |
5 | []
6 | type StringExtensions() =
7 | []
8 | static member NormalizeNewLines(x: string) =
9 | x.Replace("\r\n", "\n").Replace("\n", System.Environment.NewLine)
10 |
11 | []
12 | static member TrimNewLines(x: string) = x.TrimEnd('\r').TrimEnd('\n')
13 |
14 | []
15 | static member Clean(x: string) = x.NormalizeNewLines().TrimNewLines()
16 |
--------------------------------------------------------------------------------
/YamlDotNet.Fsharp.Test/YamlDotNet.Fsharp.Test.fsproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0;net6.0;net47
4 | false
5 | ..\YamlDotNet.snk
6 | true
7 |
8 | true
9 | 5
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | all
23 | runtime; build; native; contentfiles; analyzers; buildtransitive
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/YamlDotNet.Samples.Fsharp/YamlDotNet.Samples.Fsharp.fsproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 | false
7 |
8 | 5
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/YamlDotNet.Samples/Helpers/SampleAttribute.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using Xunit;
23 |
24 | namespace YamlDotNet.Samples.Helpers
25 | {
26 | ///
27 | /// Marks a test as being a code sample.
28 | ///
29 | public class SampleAttribute : FactAttribute
30 | {
31 | public string Description { get; set; }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/YamlDotNet.Samples/Helpers/TestOutputHelperExtensions.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using Xunit.Abstractions;
23 |
24 | namespace YamlDotNet.Samples.Helpers
25 | {
26 | public static class TestOutputHelperExtensions
27 | {
28 | public static void WriteLine(this ITestOutputHelper output)
29 | {
30 | output.WriteLine(string.Empty);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/YamlDotNet.Samples/YamlDotNet.Samples.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/Analyzers/StaticGenerator/StaticAoTContext.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using YamlDotNet.Serialization;
23 |
24 | namespace YamlDotNet.Test.Analyzers.StaticGenerator
25 | {
26 | [YamlStaticContext]
27 | public partial class StaticContext : YamlDotNet.Serialization.StaticContext
28 | {
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/Core/MarkCursorTests.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using FluentAssertions;
23 | using Xunit;
24 | using YamlDotNet.Core;
25 |
26 | namespace YamlDotNet.Test.Core
27 | {
28 | public class MarkCursorTests
29 | {
30 | [Fact]
31 | public void ShouldProvideAnOneIndexedMark()
32 | {
33 | var cursor = new Cursor();
34 |
35 | var result = cursor.Mark();
36 |
37 | result.Line.Should().Be(1, "the mark should be at line 1");
38 | result.Column.Should().Be(1, "the mark should be at column 1");
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/EnumerableExtensions.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 | using System.Collections.Generic;
24 |
25 | namespace YamlDotNet.Test
26 | {
27 | public static class EnumerableExtensions
28 | {
29 | public static IEnumerable Do(this IEnumerable source, Action action)
30 | {
31 | foreach (var item in source)
32 | {
33 | action(item);
34 | yield return item;
35 | }
36 | }
37 |
38 | public static void Run(this IEnumerable source, Action action)
39 | {
40 | foreach (var element in source)
41 | {
42 | action(element);
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | // This file is used by Code Analysis to maintain SuppressMessage
23 | // attributes that are applied to this project.
24 | // Project-level suppressions either have no target or are given
25 | // a specific target and scoped to a namespace, type, member, etc.
26 |
27 | using System.Diagnostics.CodeAnalysis;
28 |
29 | [assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Many test classes use non-compliant properties to test specific cases.", Scope = "namespaceanddescendants", Target = "~N:YamlDotNet.Test")]
30 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/Helpers/PortabilityTests.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 | using System.Globalization;
24 | using Xunit;
25 |
26 | namespace YamlDotNet.Test.Helpers
27 | {
28 | public class PortabilityTests
29 | {
30 | [Fact]
31 | public void GetPublicStaticMethodReturnsCorrectMethodInfo()
32 | {
33 | var expected = DateTimeOffset.UtcNow;
34 |
35 | var type = typeof(DateTimeOffset);
36 | var method = type.GetPublicStaticMethod("Parse", typeof(string), typeof(IFormatProvider));
37 |
38 | var actual = (DateTimeOffset)method.Invoke(null, new object[] { expected.ToString("o"), CultureInfo.InvariantCulture });
39 |
40 | Assert.Equal(expected, actual);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/StringExtensions.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 |
24 | namespace YamlDotNet.Test
25 | {
26 | public static class StringExtensions
27 | {
28 | public static string NormalizeNewLines(this string value)
29 | {
30 | return value
31 | .Replace("\r\n", "\n")
32 | .Replace("\n", Environment.NewLine);
33 | }
34 |
35 | public static string TrimNewLines(this string value)
36 | {
37 | return value.TrimEnd('\r', '\n');
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/YamlDotNet.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0;net6.0;net47
4 | false
5 | ..\YamlDotNet.snk
6 | true
7 | true
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | {BF32DE1B-6276-4341-B212-F8862ADBBA7A}
21 | YamlDotNet
22 |
23 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | xunit.runner.json
35 | PreserveNewest
36 |
37 |
38 |
39 |
40 |
41 |
42 | xunit.runner.json
43 | PreserveNewest
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/01-directives.yaml:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG ! !foo
3 | %TAG !yaml! tag:yaml.org,2002:
4 | ---
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/02-scalar-in-imp-doc.yaml:
--------------------------------------------------------------------------------
1 | 'a scalar'
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/03-scalar-in-exp-doc.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | 'a scalar'
3 | ...
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/04-scalars-in-multi-docs.yaml:
--------------------------------------------------------------------------------
1 | 'a scalar'
2 | ---
3 | 'another scalar'
4 | ---
5 | 'yet another scalar'
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/05-circular-sequence.yaml:
--------------------------------------------------------------------------------
1 | &A [ *A ]
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/06-float-tag.yaml:
--------------------------------------------------------------------------------
1 | !!float "3.14" # A good approximation.
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/07-scalar-styles.yaml:
--------------------------------------------------------------------------------
1 | --- # Implicit empty plain scalars do not produce tokens.
2 | --- a plain scalar
3 | --- 'a single-quoted scalar'
4 | --- "a double-quoted scalar"
5 | --- |-
6 | a literal scalar
7 | --- >-
8 | a folded
9 | scalar
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/08-flow-sequence.yaml:
--------------------------------------------------------------------------------
1 | [item 1, item 2, item 3]
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/09-flow-mapping.yaml:
--------------------------------------------------------------------------------
1 | {
2 | a simple key: a value, # Note that the KEY token is produced.
3 | ? a complex key: another value,
4 | }
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/10-mixed-nodes-in-sequence.yaml:
--------------------------------------------------------------------------------
1 | - item 1
2 | - item 2
3 | -
4 | - item 3.1
5 | - item 3.2
6 | -
7 | key 1: value 1
8 | key 2: value 2
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/11-mixed-nodes-in-mapping.yaml:
--------------------------------------------------------------------------------
1 | a simple key: a value # The KEY token is produced here.
2 | ? a complex key
3 | : another value
4 | a mapping:
5 | key 1: value 1
6 | key 2: value 2
7 | a sequence:
8 | - item 1
9 | - item 2
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/12-compact-sequence.yaml:
--------------------------------------------------------------------------------
1 | - - item 1
2 | - item 2
3 | - key 1: value 1
4 | key 2: value 2
5 | - ? complex key
6 | : complex value
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/13-compact-mapping.yaml:
--------------------------------------------------------------------------------
1 | ? a sequence
2 | : - item 1
3 | - item 2
4 | ? a mapping
5 | : key 1: value 1
6 | key 2: value 2
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/14-mapping-wo-indent.yaml:
--------------------------------------------------------------------------------
1 | key:
2 | - item 1 # BLOCK-SEQUENCE-START is NOT produced here.
3 | - item 2
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/anchors-overwriting.yaml:
--------------------------------------------------------------------------------
1 | a : &anchor [foo]
2 | c : *anchor
3 | b : &anchor [bar]
4 | d : *anchor
5 |
6 | e : &anchor2 baz
7 | g : *anchor2
8 | f : &anchor2 foobar
9 | h : *anchor2
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/backreference.yaml:
--------------------------------------------------------------------------------
1 | anchor: &default
2 | key1: value1
3 | key2: value2
4 | alias:
5 | <<: *default
6 | key2: Overriding key2
7 | key3: value3
8 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/backwards-alias.yaml:
--------------------------------------------------------------------------------
1 | - &first a scalar
2 | - another scalar
3 | - *first
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/convertible.template:
--------------------------------------------------------------------------------
1 | aaa:
2 | !{type}
3 | Left: hello
4 | Right: world
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/dictionary-explicit.yaml:
--------------------------------------------------------------------------------
1 | !Dictionary {
2 | key1: 1,
3 | key2: 2
4 | }
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/dictionary.yaml:
--------------------------------------------------------------------------------
1 | !!map {
2 | key1: value1,
3 | key2: value2
4 | }
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/explicit-type.template:
--------------------------------------------------------------------------------
1 | !{type} {
2 | aaa: bbb
3 | }
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/forward-alias.yaml:
--------------------------------------------------------------------------------
1 | - *first
2 | - another scalar
3 | - &first a scalar
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/guid.yaml:
--------------------------------------------------------------------------------
1 | 9462790D-5C44-4689-8542-5E2DD38EBD98
2 | ...
3 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/invalid-reference.yaml:
--------------------------------------------------------------------------------
1 | - [*municipality-0701, *municipality-0711, *municipality-0707, *municipality-0708, *municipality-0709]
2 | - [*municipality-1501, *municipality-1505, *municipality-1509, *municipality-1513, *municipality-0211]
3 | -
4 | - &municipality-0211 0211
5 | - &municipality-0701 0701
6 | - &municipality-0707 0707
7 | - &municipality-0708 0708
8 | - &municipality-0709 0709
9 | - &municipality-0711 0711
10 | - &municipality-1513 1513
11 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/list-explicit.yaml:
--------------------------------------------------------------------------------
1 | !List [ 3, 4, 5 ]
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/list-of-dictionaries.yaml:
--------------------------------------------------------------------------------
1 | -
2 | connection: conn1
3 | path: path1
4 | -
5 | connection: conn2
6 | path: path2
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/list.yaml:
--------------------------------------------------------------------------------
1 | - one
2 | - two
3 | - three
4 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/local-tags.yaml:
--------------------------------------------------------------------------------
1 | --- !MyObject
2 | a: 1.0
3 | b: 42
4 | c: -7
5 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/multi-doc-tag.yaml:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !x! tag:example.com,2014:
3 | --- !x!foo
4 | x: 0
5 | --- !x!bar
6 | x: 1
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/ordered-properties.yaml:
--------------------------------------------------------------------------------
1 | Order1: Order1 value
2 | Order2: Order2 value
3 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/tags.yaml:
--------------------------------------------------------------------------------
1 | !!point
2 | X: 10
3 | Y: 20
4 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/files/unicode-32bits-escape.yaml:
--------------------------------------------------------------------------------
1 | - hello♥
2 | - "hel\U0010fffflo\u2665"
3 |
--------------------------------------------------------------------------------
/YamlDotNet.Test/xunit.runner.linux.json:
--------------------------------------------------------------------------------
1 | {
2 | "appDomain": "denied",
3 | "methodDisplay": "method"
4 | }
--------------------------------------------------------------------------------
/YamlDotNet.Test/xunit.runner.windows.json:
--------------------------------------------------------------------------------
1 | {
2 | "methodDisplay": "method"
3 | }
--------------------------------------------------------------------------------
/YamlDotNet.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aaubry/YamlDotNet/b8ac2a98ffcc12434eff6c6abb75b38ad1b1ab04/YamlDotNet.snk
--------------------------------------------------------------------------------
/YamlDotNet/Core/Constants.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using YamlDotNet.Core.Tokens;
23 |
24 | namespace YamlDotNet.Core
25 | {
26 | ///
27 | /// Defines constants that relate to the YAML specification.
28 | ///
29 | public static class Constants
30 | {
31 | public static readonly TagDirective[] DefaultTagDirectives =
32 | [
33 | new TagDirective("!", "!"),
34 | new TagDirective("!!", "tag:yaml.org,2002:")
35 | ];
36 |
37 | public const int MajorVersion = 1;
38 | public const int MinorVersion = 3;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/EmitterState.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core
23 | {
24 | internal enum EmitterState
25 | {
26 | StreamStart,
27 | StreamEnd,
28 | FirstDocumentStart,
29 | DocumentStart,
30 | DocumentContent,
31 | DocumentEnd,
32 | FlowSequenceFirstItem,
33 | FlowSequenceItem,
34 | FlowMappingFirstKey,
35 | FlowMappingKey,
36 | FlowMappingSimpleValue,
37 | FlowMappingValue,
38 | BlockSequenceFirstItem,
39 | BlockSequenceItem,
40 | BlockMappingFirstKey,
41 | BlockMappingKey,
42 | BlockMappingSimpleValue,
43 | BlockMappingValue
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Events/EventType.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Events
23 | {
24 | internal enum EventType
25 | {
26 | None,
27 | StreamStart,
28 | StreamEnd,
29 | DocumentStart,
30 | DocumentEnd,
31 | Alias,
32 | Scalar,
33 | SequenceStart,
34 | SequenceEnd,
35 | MappingStart,
36 | MappingEnd,
37 | Comment,
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Events/IParsingEventVisitor.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Events
23 | {
24 | ///
25 | /// Callback interface for external event Visitor.
26 | ///
27 | public interface IParsingEventVisitor
28 | {
29 | void Visit(AnchorAlias e);
30 | void Visit(StreamStart e);
31 | void Visit(StreamEnd e);
32 | void Visit(DocumentStart e);
33 | void Visit(DocumentEnd e);
34 | void Visit(Scalar e);
35 | void Visit(SequenceStart e);
36 | void Visit(SequenceEnd e);
37 | void Visit(MappingStart e);
38 | void Visit(MappingEnd e);
39 | void Visit(Comment e);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Events/MappingStyle.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Events
23 | {
24 | ///
25 | /// Specifies the style of a mapping.
26 | ///
27 | public enum MappingStyle
28 | {
29 | ///
30 | /// Let the emitter choose the style.
31 | ///
32 | Any,
33 |
34 | ///
35 | /// The block mapping style.
36 | ///
37 | Block,
38 |
39 | ///
40 | /// The flow mapping style.
41 | ///
42 | Flow
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Events/SequenceStyle.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Events
23 | {
24 | ///
25 | /// Specifies the style of a sequence.
26 | ///
27 | public enum SequenceStyle
28 | {
29 | ///
30 | /// Let the emitter choose the style.
31 | ///
32 | Any,
33 |
34 | ///
35 | /// The block sequence style.
36 | ///
37 | Block,
38 |
39 | ///
40 | /// The flow sequence style.
41 | ///
42 | Flow
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/HashCode.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core
23 | {
24 | ///
25 | /// Supports implementations of by providing methods to combine two hash codes.
26 | ///
27 | internal static class HashCode
28 | {
29 | ///
30 | /// Combines two hash codes.
31 | ///
32 | /// The first hash code.
33 | /// The second hash code.
34 | ///
35 | public static int CombineHashCodes(int h1, int h2)
36 | {
37 | return ((h1 << 5) + h1) ^ h2;
38 | }
39 |
40 | public static int CombineHashCodes(int h1, object? o2)
41 | {
42 | return CombineHashCodes(h1, GetHashCode(o2));
43 | }
44 |
45 | private static int GetHashCode(object? obj)
46 | {
47 | return obj != null ? obj.GetHashCode() : 0;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/IEmitter.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using YamlDotNet.Core.Events;
23 |
24 | namespace YamlDotNet.Core
25 | {
26 | ///
27 | /// Represents a YAML stream emitter.
28 | ///
29 | public interface IEmitter
30 | {
31 | ///
32 | /// Emits an event.
33 | ///
34 | void Emit(ParsingEvent @event);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/ILookAheadBuffer.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core
23 | {
24 | internal interface ILookAheadBuffer
25 | {
26 | ///
27 | /// Gets a value indicating whether the end of the input reader has been reached.
28 | ///
29 | bool EndOfInput { get; }
30 |
31 | ///
32 | /// Gets the character at the specified offset.
33 | ///
34 | char Peek(int offset);
35 |
36 | ///
37 | /// Skips the next characters. Those characters must have been
38 | /// obtained first by calling the method.
39 | ///
40 | void Skip(int length);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/IParser.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using YamlDotNet.Core.Events;
23 |
24 | namespace YamlDotNet.Core
25 | {
26 | ///
27 | /// Represents a YAML stream parser.
28 | ///
29 | public interface IParser
30 | {
31 | ///
32 | /// Gets the current event. Returns null before the first call to ,
33 | /// and also after returns false.
34 | ///
35 | ParsingEvent? Current { get; }
36 |
37 | ///
38 | /// Moves to the next event.
39 | ///
40 | /// Returns true if there are more events available, otherwise returns false.
41 | bool MoveNext();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/ParserState.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core
23 | {
24 | internal enum ParserState
25 | {
26 | StreamStart,
27 | StreamEnd,
28 | ImplicitDocumentStart,
29 | DocumentStart,
30 | DocumentContent,
31 | DocumentEnd,
32 | BlockNode,
33 | BlockNodeOrIndentlessSequence,
34 | FlowNode,
35 | BlockSequenceFirstEntry,
36 | BlockSequenceEntry,
37 | IndentlessSequenceEntry,
38 | BlockMappingFirstKey,
39 | BlockMappingKey,
40 | BlockMappingValue,
41 | FlowSequenceFirstEntry,
42 | FlowSequenceEntry,
43 | FlowSequenceEntryMappingKey,
44 | FlowSequenceEntryMappingValue,
45 | FlowSequenceEntryMappingEnd,
46 | FlowMappingFirstKey,
47 | FlowMappingKey,
48 | FlowMappingValue,
49 | FlowMappingEmptyValue
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/BlockEnd.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a block end token.
26 | ///
27 | public sealed class BlockEnd : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public BlockEnd()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public BlockEnd(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/BlockEntry.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a block entry event.
26 | ///
27 | public sealed class BlockEntry : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public BlockEntry()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public BlockEntry(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/BlockMappingStart.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a block mapping start token.
26 | ///
27 | public sealed class BlockMappingStart : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public BlockMappingStart()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public BlockMappingStart(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/BlockSequenceStart.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a block sequence start token.
26 | ///
27 | public sealed class BlockSequenceStart : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public BlockSequenceStart()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public BlockSequenceStart(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/DocumentEnd.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a document end token.
26 | ///
27 | public sealed class DocumentEnd : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public DocumentEnd()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public DocumentEnd(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/DocumentStart.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a document start token.
26 | ///
27 | public sealed class DocumentStart : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public DocumentStart()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public DocumentStart(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/Error.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Error tokens.
26 | ///
27 | public class Error : Token
28 | {
29 | ///
30 | /// Gets the value of the error
31 | ///
32 | public string Value { get; }
33 |
34 | public Error(string value, Mark start, Mark end)
35 | : base(start, end)
36 | {
37 | Value = value;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/FlowEntry.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a flow entry event.
26 | ///
27 | public sealed class FlowEntry : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public FlowEntry()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public FlowEntry(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/FlowMappingEnd.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a flow mapping end token.
26 | ///
27 | public sealed class FlowMappingEnd : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public FlowMappingEnd()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public FlowMappingEnd(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/FlowMappingStart.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a flow mapping start token.
26 | ///
27 | public sealed class FlowMappingStart : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public FlowMappingStart()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public FlowMappingStart(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/FlowSequenceEnd.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a flow sequence end token.
26 | ///
27 | public sealed class FlowSequenceEnd : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public FlowSequenceEnd()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public FlowSequenceEnd(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/FlowSequenceStart.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a flow sequence start token.
26 | ///
27 | public sealed class FlowSequenceStart : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public FlowSequenceStart()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public FlowSequenceStart(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/Key.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a key token.
26 | ///
27 | public sealed class Key : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public Key()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public Key(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/StreamEnd.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a stream end event.
26 | ///
27 | public sealed class StreamEnd : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public StreamEnd()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public StreamEnd(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/StreamStart.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a stream start token.
26 | ///
27 | public sealed class StreamStart : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public StreamStart()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public StreamStart(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/Token.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Base class for YAML tokens.
26 | ///
27 | public abstract class Token
28 | {
29 | ///
30 | /// Gets the start of the token in the input stream.
31 | ///
32 | public Mark Start { get; }
33 |
34 | ///
35 | /// Gets the end of the token in the input stream.
36 | ///
37 | public Mark End { get; }
38 |
39 | ///
40 | /// Initializes a new instance of the class.
41 | ///
42 | /// The start position of the token.
43 | /// The end position of the token.
44 | protected Token(in Mark start, in Mark end)
45 | {
46 | this.Start = start;
47 | this.End = end;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/YamlDotNet/Core/Tokens/Value.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Core.Tokens
23 | {
24 | ///
25 | /// Represents a value token.
26 | ///
27 | public sealed class Value : Token
28 | {
29 | ///
30 | /// Initializes a new instance of the class.
31 | ///
32 | public Value()
33 | : this(Mark.Empty, Mark.Empty)
34 | {
35 | }
36 |
37 | ///
38 | /// Initializes a new instance of the class.
39 | ///
40 | /// The start position of the token.
41 | /// The end position of the token.
42 | public Value(in Mark start, in Mark end)
43 | : base(start, end)
44 | {
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/YamlDotNet/CultureInfoAdapter.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 | using System.Globalization;
24 |
25 | namespace YamlDotNet
26 | {
27 | internal sealed class CultureInfoAdapter : CultureInfo
28 | {
29 | private readonly IFormatProvider provider;
30 |
31 | public CultureInfoAdapter(CultureInfo baseCulture, IFormatProvider provider)
32 | : base(baseCulture.Name)
33 | {
34 | this.provider = provider;
35 | }
36 |
37 | #if NETSTANDARD2_0_OR_GREATER || NET6_0_OR_GREATER
38 | public override object GetFormat(Type? formatType)
39 | #else
40 | public override object? GetFormat(Type formatType)
41 | #endif
42 | {
43 | return provider.GetFormat(formatType)!;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/YamlDotNet/Helpers/FsharpHelper.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 | using YamlDotNet.Serialization;
24 |
25 | namespace YamlDotNet.Helpers
26 | {
27 | public static class FsharpHelper
28 | {
29 | public static IFsharpHelper? Instance { get; set; }
30 |
31 | public static bool IsOptionType(Type t) => Instance?.IsOptionType(t) ?? false;
32 |
33 | public static Type? GetOptionUnderlyingType(Type t) => Instance?.GetOptionUnderlyingType(t);
34 |
35 | public static object? GetValue(IObjectDescriptor objectDescriptor) => Instance?.GetValue(objectDescriptor);
36 |
37 | public static bool IsFsharpListType(Type t) => Instance?.IsFsharpListType(t) ?? false;
38 |
39 | public static object? CreateFsharpListFromArray(Type t, Type itemsType, Array arr) => Instance?.CreateFsharpListFromArray(t, itemsType, arr);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/YamlDotNet/Helpers/IFsharpHelper.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 | using YamlDotNet.Serialization;
24 |
25 | namespace YamlDotNet.Helpers
26 | {
27 | public interface IFsharpHelper
28 | {
29 | bool IsOptionType(Type t);
30 | Type? GetOptionUnderlyingType(Type t);
31 | object? GetValue(IObjectDescriptor objectDescriptor);
32 | bool IsFsharpListType(Type t);
33 | object? CreateFsharpListFromArray(Type t, Type itemsType, Array arr);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/YamlDotNet/Helpers/NullFsharpHelper.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 | using YamlDotNet.Serialization;
24 |
25 | namespace YamlDotNet.Helpers
26 | {
27 | ///
28 | /// Empty implementation of the fsharphelper to allow trimming of csharp applications.
29 | ///
30 | public class NullFsharpHelper : IFsharpHelper
31 | {
32 | public object? CreateFsharpListFromArray(Type t, Type itemsType, Array arr) => null;
33 |
34 | public Type? GetOptionUnderlyingType(Type t) => null;
35 |
36 | public object? GetValue(IObjectDescriptor objectDescriptor) => null;
37 |
38 | public bool IsFsharpListType(Type t) => false;
39 |
40 | public bool IsOptionType(Type t) => false;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/YamlDotNet/Helpers/NumberExtensions.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Helpers
23 | {
24 | internal static class NumberExtensions
25 | {
26 | public static bool IsPowerOfTwo(this int value)
27 | {
28 | return (value & (value - 1)) == 0;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/YamlDotNet/Helpers/Polyfills.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | #pragma warning disable IDE0130
23 | namespace YamlDotNet
24 | #pragma warning restore IDE0130
25 | {
26 | internal static class Polyfills
27 | {
28 | #if NETFRAMEWORK || NETSTANDARD2_0
29 | [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
30 | internal static bool Contains(this string source, char c) => source.IndexOf(c) != -1;
31 |
32 | [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
33 | internal static bool EndsWith(this string source, char c) => source.Length > 0 && source[source.Length - 1] == c;
34 |
35 | [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
36 | internal static bool StartsWith(this string source, char c) => source.Length > 0 && source[0] == c;
37 | #endif
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/YamlDotNet/Helpers/ReadOnlyCollectionExtensions.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System.Collections.Generic;
23 |
24 | namespace YamlDotNet.Helpers
25 | {
26 | internal static class ReadOnlyCollectionExtensions
27 | {
28 | public static IReadOnlyList AsReadonlyList(this List list)
29 | {
30 | return list;
31 | }
32 |
33 | public static IReadOnlyDictionary AsReadonlyDictionary(this Dictionary dictionary) where TKey : notnull
34 | {
35 | return dictionary;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/YamlDotNet/Helpers/ThrowHelper.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 | using System.Runtime.CompilerServices;
24 |
25 | namespace YamlDotNet.Helpers
26 | {
27 | internal static class ThrowHelper
28 | {
29 | [MethodImpl(MethodImplOptions.NoInlining)]
30 | public static void ThrowArgumentOutOfRangeException(string paramName, string message)
31 | {
32 | throw new ArgumentOutOfRangeException(paramName, message);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/YamlDotNet/Portability/readme.txt:
--------------------------------------------------------------------------------
1 | The subdirectories of this directory contain platform-specific code
2 | that aims to bridge the gap between the different targetted platforms.
3 |
4 | Each directory should contain code that should only be included or excluded
5 | on a set of platforms. The name of the directory should consist of a list
6 | of target platforms, separated by a plus sign (+).
7 | In that directory, every file inside the 'include' subdirectory
8 | will be included in those platforms, while every file inside the 'exclude' subdirectory
9 | will be included in all other platforms.
10 |
11 | Most (all?) types added to this folder should be internal to avoid conflicting
12 | with other libraries.
13 |
--------------------------------------------------------------------------------
/YamlDotNet/Properties/AssemblyInfo.template:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | #pragma warning disable IDE0055
23 | #if !UNITY
24 | using System.Reflection;
25 | using System.Runtime.InteropServices;
26 |
27 | // Setting ComVisible to false makes the types in this assembly not visible
28 | // to COM components. If you need to access a type in this assembly from
29 | // COM, set the ComVisible attribute to true on that type.
30 | [assembly: ComVisible(false)]
31 |
32 | // Version information for an assembly consists of the following four values:
33 | //
34 | // Major Version
35 | // Minor Version
36 | // Build Number
37 | // Revision
38 | //
39 | // You can specify all the values or you can default the Revision and Build Numbers
40 | // by using the '*' as shown below:
41 | [assembly: AssemblyVersion("<%assemblyVersion%>")]
42 | [assembly: AssemblyFileVersion("<%assemblyFileVersion%>")]
43 | [assembly: AssemblyInformationalVersion("<%assemblyInformationalVersion%>")]
44 |
45 | #endif
46 | #pragma warning restore IDE0055
47 |
--------------------------------------------------------------------------------
/YamlDotNet/PropertyInfoExtensions.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System.Reflection;
23 |
24 | namespace YamlDotNet
25 | {
26 | internal static class PropertyInfoExtensions
27 | {
28 | public static object? ReadValue(this PropertyInfo property, object target)
29 | {
30 | return property.GetValue(target, null);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/YamlDotNet/RepresentationModel/EmitterState.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System.Collections.Generic;
23 | using YamlDotNet.Core;
24 |
25 | namespace YamlDotNet.RepresentationModel
26 | {
27 | ///
28 | /// Holds state that is used when emitting a stream.
29 | ///
30 | internal class EmitterState
31 | {
32 | ///
33 | /// Gets the already emitted anchors.
34 | ///
35 | /// The emitted anchors.
36 | public HashSet EmittedAnchors { get; } = [];
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/YamlDotNet/RepresentationModel/YamlNodeIdentityEqualityComparer.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System.Collections.Generic;
23 | using System.Diagnostics.CodeAnalysis;
24 |
25 | namespace YamlDotNet.RepresentationModel
26 | {
27 | ///
28 | /// Comparer that is based on identity comparisons.
29 | ///
30 | public sealed class YamlNodeIdentityEqualityComparer : IEqualityComparer
31 | {
32 | #region IEqualityComparer Members
33 |
34 | ///
35 | public bool Equals([AllowNull] YamlNode x, [AllowNull] YamlNode y)
36 | {
37 | return ReferenceEquals(x, y);
38 | }
39 |
40 | ///
41 | public int GetHashCode(YamlNode obj)
42 | {
43 | return obj.GetHashCode();
44 | }
45 |
46 | #endregion
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/YamlDotNet/RepresentationModel/YamlNodeType.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.RepresentationModel
23 | {
24 | ///
25 | /// Specifies the type of node in the representation model.
26 | ///
27 | public enum YamlNodeType
28 | {
29 | ///
30 | /// The node is a .
31 | ///
32 | Alias,
33 |
34 | ///
35 | /// The node is a .
36 | ///
37 | Mapping,
38 |
39 | ///
40 | /// The node is a .
41 | ///
42 | Scalar,
43 |
44 | ///
45 | /// The node is a .
46 | ///
47 | Sequence
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/Callbacks/OnDeserializedAttribute.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 |
24 | namespace YamlDotNet.Serialization.Callbacks
25 | {
26 | [AttributeUsage(AttributeTargets.Method)]
27 | public sealed class OnDeserializedAttribute : Attribute
28 | {
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/Callbacks/OnDeserializingAttribute.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 |
24 | namespace YamlDotNet.Serialization.Callbacks
25 | {
26 | [AttributeUsage(AttributeTargets.Method)]
27 | public sealed class OnDeserializingAttribute : Attribute
28 | {
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/Callbacks/OnSerializedAttribute.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 |
24 | namespace YamlDotNet.Serialization.Callbacks
25 | {
26 | [AttributeUsage(AttributeTargets.Method)]
27 | public sealed class OnSerializedAttribute : Attribute
28 | {
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/Callbacks/OnSerializingAttribute.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 |
24 | namespace YamlDotNet.Serialization.Callbacks
25 | {
26 | [AttributeUsage(AttributeTargets.Method)]
27 | public sealed class OnSerializingAttribute : Attribute
28 | {
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/IAliasProvider.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using YamlDotNet.Core;
23 |
24 | namespace YamlDotNet.Serialization
25 | {
26 | public interface IAliasProvider
27 | {
28 | AnchorName GetAlias(object target);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/IEventEmitter.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using YamlDotNet.Core;
23 |
24 | namespace YamlDotNet.Serialization
25 | {
26 | public interface IEventEmitter
27 | {
28 | void Emit(AliasEventInfo eventInfo, IEmitter emitter);
29 | void Emit(ScalarEventInfo eventInfo, IEmitter emitter);
30 | void Emit(MappingStartEventInfo eventInfo, IEmitter emitter);
31 | void Emit(MappingEndEventInfo eventInfo, IEmitter emitter);
32 | void Emit(SequenceStartEventInfo eventInfo, IEmitter emitter);
33 | void Emit(SequenceEndEventInfo eventInfo, IEmitter emitter);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/INamingConvention.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 |
23 | namespace YamlDotNet.Serialization
24 | {
25 | ///
26 | /// Translates property names according to a specific convention.
27 | ///
28 | public interface INamingConvention
29 | {
30 | string Apply(string value);
31 | string Reverse(string value);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/INodeDeserializer.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 | using YamlDotNet.Core;
24 |
25 | namespace YamlDotNet.Serialization
26 | {
27 | public interface INodeDeserializer
28 | {
29 |
30 | bool Deserialize(IParser reader, Type expectedType, Func nestedObjectDeserializer, out object? value, ObjectDeserializer rootDeserializer);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/INodeTypeResolver.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 | using YamlDotNet.Core.Events;
24 |
25 | namespace YamlDotNet.Serialization
26 | {
27 | public interface INodeTypeResolver
28 | {
29 | ///
30 | /// Determines the type of the specified node.
31 | ///
32 | /// The node to be deserialized.
33 | /// The type that has been determined so far.
34 | ///
35 | /// true if has been resolved completely;
36 | /// false if the next type should be invoked.
37 | ///
38 | bool Resolve(NodeEvent? nodeEvent, ref Type currentType);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/IObjectGraphTraversalStrategy.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | namespace YamlDotNet.Serialization
23 | {
24 | ///
25 | /// Defines a strategy that walks through an object graph.
26 | ///
27 | public interface IObjectGraphTraversalStrategy
28 | {
29 | ///
30 | /// Traverses the specified object graph.
31 | ///
32 | /// The graph.
33 | /// An that is to be notified during the traversal.
34 | /// A that will be passed to the .
35 | /// The serializer to use to serialize complex objects.
36 | void Traverse(IObjectDescriptor graph, IObjectGraphVisitor visitor, TContext context, ObjectSerializer serializer);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/IPropertyDescriptor.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 | using YamlDotNet.Core;
24 |
25 | namespace YamlDotNet.Serialization
26 | {
27 | public interface IPropertyDescriptor
28 | {
29 | string Name { get; }
30 | bool AllowNulls { get; }
31 | bool CanWrite { get; }
32 | Type Type { get; }
33 | Type? TypeOverride { get; set; }
34 | int Order { get; set; }
35 | ScalarStyle ScalarStyle { get; set; }
36 | bool Required { get; }
37 | Type? ConverterType { get; }
38 |
39 | T? GetCustomAttribute() where T : Attribute;
40 |
41 | IObjectDescriptor Read(object target);
42 | void Write(object target, object? value);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/ITypeResolver.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 |
24 | namespace YamlDotNet.Serialization
25 | {
26 | ///
27 | /// Resolves the type of values.
28 | ///
29 | public interface ITypeResolver
30 | {
31 | Type Resolve(Type staticType, object? actualValue);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/IValueDeserializer.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 | using YamlDotNet.Core;
24 | using YamlDotNet.Serialization.Utilities;
25 |
26 | namespace YamlDotNet.Serialization
27 | {
28 | public interface IValueDeserializer
29 | {
30 | object? DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/YamlDotNet/Serialization/IValuePromise.cs:
--------------------------------------------------------------------------------
1 | // This file is part of YamlDotNet - A .NET library for YAML.
2 | // Copyright (c) Antoine Aubry and contributors
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of
5 | // this software and associated documentation files (the "Software"), to deal in
6 | // the Software without restriction, including without limitation the rights to
7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 | // of the Software, and to permit persons to whom the Software is furnished to do
9 | // so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in all
12 | // copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | // SOFTWARE.
21 |
22 | using System;
23 |
24 | namespace YamlDotNet.Serialization
25 | {
26 | public interface IValuePromise
27 | {
28 | event Action