From 724207b7c09d66a84e2efd5abeb023878f0df219 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 09:30:58 -0800 Subject: [PATCH 01/71] Asdf --- .gitignore | 7 + docs/{architecture.md => 0_architecture.md} | 13 +- docs/1_interfaces+datatypes.md | 70 ++++++ odata.sln | 28 +++ odata.tests/MSTestSettings.cs | 1 + odata.tests/Test1.cs | 31 +++ odata.tests/odata.tests.csproj | 23 ++ .../AbstractSyntaxTreeNodes/BatchOptions.cs | 20 ++ .../AbstractSyntaxTreeNodes/Context.cs | 20 ++ .../EntityCastOptions.cs | 20 ++ .../AbstractSyntaxTreeNodes/EntityOptions.cs | 20 ++ .../MetadataOptions.cs | 20 ++ .../OdataRelativeUri.cs | 188 +++++++++++++++ .../QualifiedEntityTypeName.cs | 20 ++ .../AbstractSyntaxTreeNodes/QueryOptions.cs | 20 ++ .../AbstractSyntaxTreeNodes/ResourcePath.cs | 20 ++ .../BatchOptionsConverter.cs | 16 ++ .../AstToCstConverters/ContextConverter.cs | 16 ++ .../EntityCastOptionsConverter.cs | 16 ++ .../EntityOptionsConverter.cs | 16 ++ .../MetadataOptionsConverter.cs | 16 ++ .../OdataRelativeUriConverter.cs | 130 ++++++++++ .../QualifiedEntityTypeNameConverter.cs | 16 ++ .../QueryOptionsConverter.cs | 16 ++ .../ResourcePathConverter.cs | 16 ++ .../CombinatorParsers/BatchOptionsParser.cs | 11 + .../CombinatorParsers/BatchParser.cs | 12 + .../CombinatorParsers/ContextParser.cs | 11 + .../EntityCastOptionsParser.cs | 11 + .../CombinatorParsers/EntityOptionsParser.cs | 11 + .../CombinatorParsers/EntityParser.cs | 12 + .../MetadataOptionsParser.cs | 11 + .../CombinatorParsers/MetadataParser.cs | 12 + .../OdataRelativeUriParser.cs | 77 ++++++ .../QualifiedTypeNameParser.cs | 12 + .../CombinatorParsers/QueryOptionsParser.cs | 12 + .../CombinatorParsers/QuestionMarkParser.cs | 12 + .../CombinatorParsers/ResourcePathParser.cs | 11 + .../CombinatorParsers/SlashParser.cs | 12 + .../ConcreteSyntaxTreeNodes/Batch.cs | 11 + .../ConcreteSyntaxTreeNodes/BatchOptions.cs | 20 ++ .../ConcreteSyntaxTreeNodes/Context.cs | 20 ++ .../ConcreteSyntaxTreeNodes/Entity.cs | 11 + .../EntityCastOptions.cs | 20 ++ .../ConcreteSyntaxTreeNodes/EntityOptions.cs | 20 ++ .../ConcreteSyntaxTreeNodes/Metadata.cs | 11 + .../MetadataOptions.cs | 20 ++ .../OdataRelativeUri.cs | 222 ++++++++++++++++++ .../QualifiedEntityTypeName.cs | 20 ++ .../ConcreteSyntaxTreeNodes/QueryOptions.cs | 20 ++ .../ConcreteSyntaxTreeNodes/QuestionMark.cs | 11 + .../ConcreteSyntaxTreeNodes/ResourcePath.cs | 20 ++ .../ConcreteSyntaxTreeNodes/Slash.cs | 11 + .../BatchOptionsConverter.cs | 16 ++ .../CstToAstConverters/ContextConverter.cs | 16 ++ .../EntityCastOptionsConverter.cs | 16 ++ .../EntityOptionsConverter.cs | 16 ++ .../MetadataOptionsConverter.cs | 16 ++ .../OdataRelativeUriConverter.cs | 130 ++++++++++ .../QualifiedEntityTypeNameConverter.cs | 16 ++ .../QueryOptionsConverter.cs | 16 ++ .../ResourcePathConverter.cs | 16 ++ .../SyntacticCstNodes/contextfree.abnf | 120 ++++++++++ .../Transcribers/BatchOptionsTranscriber.cs | 15 ++ .../Transcribers/BatchTranscriber.cs | 20 ++ .../Transcribers/ContextTranscriber.cs | 15 ++ .../EntityCastOptionsTranscriber.cs | 15 ++ .../Transcribers/EntityOptionsTranscriber.cs | 15 ++ .../Transcribers/EntityTranscriber.cs | 20 ++ .../MetadataOptionsTranscriber.cs | 15 ++ .../Transcribers/MetadataTranscriber.cs | 20 ++ .../OdataRelativeUriTranscriber.cs | 144 ++++++++++++ .../QualifiedEntityTypeNameTranscriber.cs | 15 ++ .../Transcribers/QueryOptionsTranscriber.cs | 15 ++ .../Transcribers/QuestionMarkTranscriber.cs | 20 ++ .../Transcribers/ResourcePathTranscriber.cs | 15 ++ .../Transcribers/SlashTranscriber.cs | 20 ++ odata/Root/Parser.cs | 16 ++ odata/Root/Void.cs | 9 + odata/odata.csproj | 17 ++ 80 files changed, 2220 insertions(+), 7 deletions(-) create mode 100644 .gitignore rename docs/{architecture.md => 0_architecture.md} (97%) create mode 100644 docs/1_interfaces+datatypes.md create mode 100644 odata.sln create mode 100644 odata.tests/MSTestSettings.cs create mode 100644 odata.tests/Test1.cs create mode 100644 odata.tests/odata.tests.csproj create mode 100644 odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/BatchOptions.cs create mode 100644 odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/Context.cs create mode 100644 odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/EntityCastOptions.cs create mode 100644 odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/EntityOptions.cs create mode 100644 odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/MetadataOptions.cs create mode 100644 odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/OdataRelativeUri.cs create mode 100644 odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/QualifiedEntityTypeName.cs create mode 100644 odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/QueryOptions.cs create mode 100644 odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/ResourcePath.cs create mode 100644 odata/Root/OdataResourcePath/AstToCstConverters/BatchOptionsConverter.cs create mode 100644 odata/Root/OdataResourcePath/AstToCstConverters/ContextConverter.cs create mode 100644 odata/Root/OdataResourcePath/AstToCstConverters/EntityCastOptionsConverter.cs create mode 100644 odata/Root/OdataResourcePath/AstToCstConverters/EntityOptionsConverter.cs create mode 100644 odata/Root/OdataResourcePath/AstToCstConverters/MetadataOptionsConverter.cs create mode 100644 odata/Root/OdataResourcePath/AstToCstConverters/OdataRelativeUriConverter.cs create mode 100644 odata/Root/OdataResourcePath/AstToCstConverters/QualifiedEntityTypeNameConverter.cs create mode 100644 odata/Root/OdataResourcePath/AstToCstConverters/QueryOptionsConverter.cs create mode 100644 odata/Root/OdataResourcePath/AstToCstConverters/ResourcePathConverter.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/BatchOptionsParser.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/BatchParser.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/ContextParser.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/EntityCastOptionsParser.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/EntityOptionsParser.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/EntityParser.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/MetadataOptionsParser.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/MetadataParser.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/OdataRelativeUriParser.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/QualifiedTypeNameParser.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/QueryOptionsParser.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/QuestionMarkParser.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/ResourcePathParser.cs create mode 100644 odata/Root/OdataResourcePath/CombinatorParsers/SlashParser.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Batch.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/BatchOptions.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Context.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Entity.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/EntityCastOptions.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/EntityOptions.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Metadata.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/MetadataOptions.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/OdataRelativeUri.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/QualifiedEntityTypeName.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/QueryOptions.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/QuestionMark.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/ResourcePath.cs create mode 100644 odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Slash.cs create mode 100644 odata/Root/OdataResourcePath/CstToAstConverters/BatchOptionsConverter.cs create mode 100644 odata/Root/OdataResourcePath/CstToAstConverters/ContextConverter.cs create mode 100644 odata/Root/OdataResourcePath/CstToAstConverters/EntityCastOptionsConverter.cs create mode 100644 odata/Root/OdataResourcePath/CstToAstConverters/EntityOptionsConverter.cs create mode 100644 odata/Root/OdataResourcePath/CstToAstConverters/MetadataOptionsConverter.cs create mode 100644 odata/Root/OdataResourcePath/CstToAstConverters/OdataRelativeUriConverter.cs create mode 100644 odata/Root/OdataResourcePath/CstToAstConverters/QualifiedEntityTypeNameConverter.cs create mode 100644 odata/Root/OdataResourcePath/CstToAstConverters/QueryOptionsConverter.cs create mode 100644 odata/Root/OdataResourcePath/CstToAstConverters/ResourcePathConverter.cs create mode 100644 odata/Root/OdataResourcePath/SyntacticCstNodes/contextfree.abnf create mode 100644 odata/Root/OdataResourcePath/Transcribers/BatchOptionsTranscriber.cs create mode 100644 odata/Root/OdataResourcePath/Transcribers/BatchTranscriber.cs create mode 100644 odata/Root/OdataResourcePath/Transcribers/ContextTranscriber.cs create mode 100644 odata/Root/OdataResourcePath/Transcribers/EntityCastOptionsTranscriber.cs create mode 100644 odata/Root/OdataResourcePath/Transcribers/EntityOptionsTranscriber.cs create mode 100644 odata/Root/OdataResourcePath/Transcribers/EntityTranscriber.cs create mode 100644 odata/Root/OdataResourcePath/Transcribers/MetadataOptionsTranscriber.cs create mode 100644 odata/Root/OdataResourcePath/Transcribers/MetadataTranscriber.cs create mode 100644 odata/Root/OdataResourcePath/Transcribers/OdataRelativeUriTranscriber.cs create mode 100644 odata/Root/OdataResourcePath/Transcribers/QualifiedEntityTypeNameTranscriber.cs create mode 100644 odata/Root/OdataResourcePath/Transcribers/QueryOptionsTranscriber.cs create mode 100644 odata/Root/OdataResourcePath/Transcribers/QuestionMarkTranscriber.cs create mode 100644 odata/Root/OdataResourcePath/Transcribers/ResourcePathTranscriber.cs create mode 100644 odata/Root/OdataResourcePath/Transcribers/SlashTranscriber.cs create mode 100644 odata/Root/Parser.cs create mode 100644 odata/Root/Void.cs create mode 100644 odata/odata.csproj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..f6f13e6c96 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +################################################################################ +# This .gitignore file was automatically created by Microsoft(R) Visual Studio. +################################################################################ + +.vs/ +/**/obj/** +/**/bin/** \ No newline at end of file diff --git a/docs/architecture.md b/docs/0_architecture.md similarity index 97% rename from docs/architecture.md rename to docs/0_architecture.md index 17afb7c4f8..562e463d36 100644 --- a/docs/architecture.md +++ b/docs/0_architecture.md @@ -216,6 +216,8 @@ For these reasons (and many others), I think it's best for now to simply underst ### data flow +https://mermaid.js.org/syntax/sequenceDiagram.html + ```mermaid --- title: request flow @@ -277,8 +279,6 @@ Notice that in each case, the request and response types are the same for both t 2. Because the HTTP portion is not strictly necessary for processing a request, it means that odata services can be easily composed at this layer. If an odata_request is sent by a client using the same type that it is processed by the service, then it means that additional odata services can themselves be treated as "data stores". More on this [later](#a-common-abstraction-for-handling-a-request). 3. These types can be shared by consumers of the odata libraries, but currently they are not. To see the impact of this sharing, let's dive into the mechanics of each translation of the data: -(NOTE: whenever a CST is reference below, it is not necessarily being exposed to customers or something that customers are expected to use). - #### user defined types to odata request ```mermaid @@ -481,11 +481,10 @@ Clearly, there's still a lot of infrastructure to flesh out, and a lot of implem ## follow-ups 1. dive into all of the interfaces+datatypes for request handling, parsing, transcribing, translating, etc. -2. there must be an analog to the existing "syntactic AST" -3. being able to stream payloads -4. handling serialization of customer-defined types -5. CSDL defined authz -6. custom headers, query options, endpoints, etc. +2. being able to stream payloads +3. handling serialization of customer-defined types +4. CSDL defined authz +5. custom headers, query options, endpoints, etc. diff --git a/docs/1_interfaces+datatypes.md b/docs/1_interfaces+datatypes.md new file mode 100644 index 0000000000..a9bb20bbd4 --- /dev/null +++ b/docs/1_interfaces+datatypes.md @@ -0,0 +1,70 @@ +## pattern overview + +We should stick to the naming conventions laid out in the [architecture](./architecture.md). So, we should have "parser"s to create CSTs from strings, "converter"s to move between CSTs and ASTs, "translator"s to move between different types of ASTs, "transcriber"s to create strings from CSTs, "serializer"s to go from user defined types to ASTs, and "deserializer"s to go from ASTs to user defined types. + +The CSTs will be a discriminated union that corresponds directly to the [OData ABNF](https://docs.oasis-open.org/odata/odata/v4.01/cs01/abnf/odata-abnf-construction-rules.txt). + +The ASTs will be a discriminated union that corresponds to the same ABNF but with the string literals removed, as well as "overhead" from the CST like aliases. + +The transcribers will be implemented as visitors on the CST nodes to convert them to strings using an intermediate `StringBuilder`. + +The converters will be implemented as visitors on the AST or CST nodes to produce instances of the other. + +TODO parsers will be... + +The translators will be implemented as visitors on the AST nodes to produce a corresponding AST for the desired data store. + +Please see the [appendix](#appendix) for other modeling options that were explored. + +## odata resource path example + +Let's use the odata resource path as an example of the above patterns. + +### syntactic CST? + +TODO do you want to have a syntactic CST that is a context-free grammar (should the context free grammar be defined by the literals used in the ABNF? write this out and keep it somewhere if so)? then your parsers could be combinators; if you do this you will need a converter from syntactic to semantic CST +TODO regardless of the above, you need to have a syntactic CST **anyway** to have parity with ODL + +### (semantic?) CST + +A sample implementation of the CST is [here](../odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/OdataRelativeUri.cs). + +### AST + +A sample implementation of the AST is [here](../odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/OdataRelativeUri.cs). + +### CST transcriber + +A sample implementation of the transcriber is [here](../odata/Root/OdataResourcePath/Transcribers/OdataRelativeUriTranscriber.cs). + +### CST to AST converter + +A sample implementation of the CST to AST translator is [here](../odata/Root/OdataResourcePath/CstToAstTranslators/OdataRelativeUriTranslator.cs). + +### AST to CST converter + +A sample implementation of the CST to AST translator is [here](../odata/Root/OdataResourcePath/AstToCstTranslators/OdataRelativeUriTranslator.cs). + +### uri parser + +TODO + +### translator + +TODO + +## let's now attempt take some time to show mechanically how to implement a node in the AST and all of its associated utilities + +Let's try with `keyPredicate` using the [ABNF](https://docs.oasis-open.org/odata/odata/v4.01/cs01/abnf/odata-abnf-construction-rules.txt). + +## some takeaways + +Using this discriminated union pattern, it is clear from the code where the "feature gaps" are: any nodes that only have a private constructor have not yet been implemented. We should implement a node in its completeness so that we can maintain this status. Doing this will ensure that the "feature gaps" are never tribal knowledge, but something that any developer can discover just by looking at the code. + +These unions *also* allow us to easily scale across developers. Any number of developers can implement as many nodes as there are developers provided that no two developers are working on the same node. Also, by separating each phase of the handling process in this way, we are able to implement the nodes "piecewise", meaning: a developer can define the AST node, create a PR, and merge it; the developer can then define the CST node, create a PR, and merge it; they can then implement a converter, and so in. These can all be done as individual, discrete, atomic steps done (mostly) independently of each other. + +## appendix + +### parsing + +Parser combinators were tried using the Sprache nuget package. Though combinators are very flexible, the code is trivially readable, and development is exceedingly fast, combinators result in potentially incorrect parsing on grammars that are not context-free; the OData ABNF is not a context-free grammar, so we cannot rely on combinators. You can see an attempt at this implementation [here](https://github.com/OData/odata.net/blob/corranrogue9/framework/interfacesanddatatypes/odata/Root/OdataResourcePath/CombinatorParsers/OdataRelativeUriParser.cs). diff --git a/odata.sln b/odata.sln new file mode 100644 index 0000000000..87252d662f --- /dev/null +++ b/odata.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35514.174 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "odata", "odata\odata.csproj", "{6E3F11CA-8949-47C1-894C-CE61D911A2F2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "odata.tests", "odata.tests\odata.tests.csproj", "{07CA58E0-3FA7-4BC2-8CB1-6974049CB5CF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6E3F11CA-8949-47C1-894C-CE61D911A2F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6E3F11CA-8949-47C1-894C-CE61D911A2F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6E3F11CA-8949-47C1-894C-CE61D911A2F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6E3F11CA-8949-47C1-894C-CE61D911A2F2}.Release|Any CPU.Build.0 = Release|Any CPU + {07CA58E0-3FA7-4BC2-8CB1-6974049CB5CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07CA58E0-3FA7-4BC2-8CB1-6974049CB5CF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07CA58E0-3FA7-4BC2-8CB1-6974049CB5CF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07CA58E0-3FA7-4BC2-8CB1-6974049CB5CF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/odata.tests/MSTestSettings.cs b/odata.tests/MSTestSettings.cs new file mode 100644 index 0000000000..aaf278c844 --- /dev/null +++ b/odata.tests/MSTestSettings.cs @@ -0,0 +1 @@ +[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] diff --git a/odata.tests/Test1.cs b/odata.tests/Test1.cs new file mode 100644 index 0000000000..9ddb6a0368 --- /dev/null +++ b/odata.tests/Test1.cs @@ -0,0 +1,31 @@ +namespace odata.tests +{ + using Root.OdataResourcePath.CombinatorParsers; + using Root.OdataResourcePath.Transcribers; + using Sprache; + using System.Text; + + [TestClass] + public sealed class Test1 + { + [TestMethod] + public void TestMethod1() + { + var url = "$metadata"; + var cst = OdataRelativeUriParser.Instance.Parse(url); + + var ast = Root.OdataResourcePath.CstToAstConverters.OdataRelativeUriConverter + .Default + .Visit(cst, default); + + var newCst = Root.OdataResourcePath.AstToCstConverters.OdataRelativeUriConverter + .Default + .Visit(ast, default); + + var stringBuilder = new StringBuilder(); + OdataRelativeUriTranscriber.Default.Visit(newCst, stringBuilder); + + Assert.AreEqual(url, stringBuilder.ToString()); + } + } +} diff --git a/odata.tests/odata.tests.csproj b/odata.tests/odata.tests.csproj new file mode 100644 index 0000000000..abc9457433 --- /dev/null +++ b/odata.tests/odata.tests.csproj @@ -0,0 +1,23 @@ + + + + net9.0 + latest + enable + enable + + + + + + + + + + + + + + + + diff --git a/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/BatchOptions.cs b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/BatchOptions.cs new file mode 100644 index 0000000000..d0cdd1ecdf --- /dev/null +++ b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/BatchOptions.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.AbstractSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class BatchOptions + { + private BatchOptions() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(BatchOptions node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} diff --git a/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/Context.cs b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/Context.cs new file mode 100644 index 0000000000..a740f43679 --- /dev/null +++ b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/Context.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.AbstractSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class Context + { + private Context() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(Context node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} \ No newline at end of file diff --git a/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/EntityCastOptions.cs b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/EntityCastOptions.cs new file mode 100644 index 0000000000..c145f5e9b2 --- /dev/null +++ b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/EntityCastOptions.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.AbstractSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class EntityCastOptions + { + private EntityCastOptions() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(EntityCastOptions node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} diff --git a/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/EntityOptions.cs b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/EntityOptions.cs new file mode 100644 index 0000000000..b6acb2e319 --- /dev/null +++ b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/EntityOptions.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.AbstractSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class EntityOptions + { + private EntityOptions() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(EntityOptions node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} diff --git a/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/MetadataOptions.cs b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/MetadataOptions.cs new file mode 100644 index 0000000000..842dc5c20d --- /dev/null +++ b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/MetadataOptions.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.AbstractSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class MetadataOptions + { + private MetadataOptions() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(MetadataOptions node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} \ No newline at end of file diff --git a/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/OdataRelativeUri.cs b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/OdataRelativeUri.cs new file mode 100644 index 0000000000..a3f76ad2eb --- /dev/null +++ b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/OdataRelativeUri.cs @@ -0,0 +1,188 @@ +namespace Root.OdataResourcePath.AbstractSyntaxTreeNodes +{ + /// + /// this is the AST for odata resource paths + /// pulled from `odataRelativeUri` definition in https://docs.oasis-open.org/odata/odata/v4.01/cs01/abnf/odata-abnf-construction-rules.txt + /// + public abstract class OdataRelativeUri + { + private OdataRelativeUri() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(OdataRelativeUri node, TContext context) + { + return node.Dispatch(this, context); + } + + public abstract TResult Accept(BatchOnly node, TContext context); + public abstract TResult Accept(BatchWithOptions node, TContext context); + public abstract TResult Accept(EntityWithOptions node, TContext context); + public abstract TResult Accept(EntityWithCast node, TContext context); + public abstract TResult Accept(MetadataOnly node, TContext context); + public abstract TResult Accept(MetadataWithOptions node, TContext context); + public abstract TResult Accept(MetadataWithContext node, TContext context); + public abstract TResult Accept(MetadataWithOptionsAndContext node, TContext context); + public abstract TResult Accept(ResourcePathOnly node, TContext context); + public abstract TResult Accept(ResourcePathWithQueryOptions node, TContext context); + } + + public sealed class BatchOnly : OdataRelativeUri + { + private BatchOnly() + { + } + + public static BatchOnly Instance { get; } = new BatchOnly(); + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class BatchWithOptions : OdataRelativeUri + { + public BatchWithOptions(BatchOptions batchOptions) + { + this.BatchOptions = batchOptions; + } + + public BatchOptions BatchOptions { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class EntityWithOptions : OdataRelativeUri + { + public EntityWithOptions(EntityOptions entityOptions) + { + this.EntityOptions = entityOptions; + } + + public EntityOptions EntityOptions { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class EntityWithCast : OdataRelativeUri + { + public EntityWithCast(QualifiedEntityTypeName qualifiedEntityTypeName, EntityCastOptions entityCastOptions) + { + this.QualifiedEntityTypeName = qualifiedEntityTypeName; + this.EntityCastOptions = entityCastOptions; + } + + public QualifiedEntityTypeName QualifiedEntityTypeName { get; } + public EntityCastOptions EntityCastOptions { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class MetadataOnly : OdataRelativeUri + { + private MetadataOnly() + { + } + + public static MetadataOnly Instance { get; } = new MetadataOnly(); + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class MetadataWithOptions : OdataRelativeUri + { + public MetadataWithOptions(MetadataOptions metadataOptions) + { + this.MetadataOptions = metadataOptions; + } + + public MetadataOptions MetadataOptions { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class MetadataWithContext : OdataRelativeUri + { + public MetadataWithContext(Context context) + { + this.Context = context; + } + + public Context Context { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class MetadataWithOptionsAndContext : OdataRelativeUri + { + public MetadataWithOptionsAndContext(MetadataOptions metadataOptions, Context context) + { + this.MetadataOptions = metadataOptions; + this.Context = context; + } + + public MetadataOptions MetadataOptions { get; } + public Context Context { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class ResourcePathOnly : OdataRelativeUri + { + public ResourcePathOnly(ResourcePath resourcePath) + { + this.ResourcePath = resourcePath; + } + + public ResourcePath ResourcePath { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class ResourcePathWithQueryOptions : OdataRelativeUri + { + public ResourcePathWithQueryOptions(ResourcePath resourcePath, QueryOptions queryOptions) + { + this.ResourcePath = resourcePath; + this.QueryOptions = queryOptions; + } + + public ResourcePath ResourcePath { get; } + public QueryOptions QueryOptions { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + } +} \ No newline at end of file diff --git a/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/QualifiedEntityTypeName.cs b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/QualifiedEntityTypeName.cs new file mode 100644 index 0000000000..a51434c1d6 --- /dev/null +++ b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/QualifiedEntityTypeName.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.AbstractSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class QualifiedEntityTypeName + { + private QualifiedEntityTypeName() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(QualifiedEntityTypeName node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} diff --git a/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/QueryOptions.cs b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/QueryOptions.cs new file mode 100644 index 0000000000..8839ad698e --- /dev/null +++ b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/QueryOptions.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.AbstractSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class QueryOptions + { + private QueryOptions() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(QueryOptions node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} \ No newline at end of file diff --git a/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/ResourcePath.cs b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/ResourcePath.cs new file mode 100644 index 0000000000..61d342016a --- /dev/null +++ b/odata/Root/OdataResourcePath/AbstractSyntaxTreeNodes/ResourcePath.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.AbstractSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class ResourcePath + { + private ResourcePath() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(ResourcePath node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} \ No newline at end of file diff --git a/odata/Root/OdataResourcePath/AstToCstConverters/BatchOptionsConverter.cs b/odata/Root/OdataResourcePath/AstToCstConverters/BatchOptionsConverter.cs new file mode 100644 index 0000000000..ba38f924f1 --- /dev/null +++ b/odata/Root/OdataResourcePath/AstToCstConverters/BatchOptionsConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.AstToCstConverters +{ + using Root; + + public sealed class BatchOptionsConverter : + AbstractSyntaxTreeNodes.BatchOptions.Visitor< + ConcreteSyntaxTreeNodes.BatchOptions, + Void> + { + private BatchOptionsConverter() + { + } + + public static BatchOptionsConverter Default { get; } = new BatchOptionsConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/AstToCstConverters/ContextConverter.cs b/odata/Root/OdataResourcePath/AstToCstConverters/ContextConverter.cs new file mode 100644 index 0000000000..52c19eb4ec --- /dev/null +++ b/odata/Root/OdataResourcePath/AstToCstConverters/ContextConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.AstToCstConverters +{ + using Root; + + public sealed class ContextConverter : + AbstractSyntaxTreeNodes.Context.Visitor< + ConcreteSyntaxTreeNodes.Context, + Void> + { + private ContextConverter() + { + } + + public static ContextConverter Default { get; } = new ContextConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/AstToCstConverters/EntityCastOptionsConverter.cs b/odata/Root/OdataResourcePath/AstToCstConverters/EntityCastOptionsConverter.cs new file mode 100644 index 0000000000..0912b9f51f --- /dev/null +++ b/odata/Root/OdataResourcePath/AstToCstConverters/EntityCastOptionsConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.AstToCstConverters +{ + using Root; + + public sealed class EntityCastOptionsConverter : + AbstractSyntaxTreeNodes.EntityCastOptions.Visitor< + ConcreteSyntaxTreeNodes.EntityCastOptions, + Void> + { + private EntityCastOptionsConverter() + { + } + + public static EntityCastOptionsConverter Default { get; } = new EntityCastOptionsConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/AstToCstConverters/EntityOptionsConverter.cs b/odata/Root/OdataResourcePath/AstToCstConverters/EntityOptionsConverter.cs new file mode 100644 index 0000000000..8f736b2ed9 --- /dev/null +++ b/odata/Root/OdataResourcePath/AstToCstConverters/EntityOptionsConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.AstToCstConverters +{ + using Root; + + public sealed class EntityOptionsConverter : + AbstractSyntaxTreeNodes.EntityOptions.Visitor< + ConcreteSyntaxTreeNodes.EntityOptions, + Void> + { + private EntityOptionsConverter() + { + } + + public static EntityOptionsConverter Default { get; } = new EntityOptionsConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/AstToCstConverters/MetadataOptionsConverter.cs b/odata/Root/OdataResourcePath/AstToCstConverters/MetadataOptionsConverter.cs new file mode 100644 index 0000000000..f91163103c --- /dev/null +++ b/odata/Root/OdataResourcePath/AstToCstConverters/MetadataOptionsConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.AstToCstConverters +{ + using Root; + + public sealed class MetadataOptionsConverter : + AbstractSyntaxTreeNodes.MetadataOptions.Visitor< + ConcreteSyntaxTreeNodes.MetadataOptions, + Void> + { + private MetadataOptionsConverter() + { + } + + public static MetadataOptionsConverter Default { get; } = new MetadataOptionsConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/AstToCstConverters/OdataRelativeUriConverter.cs b/odata/Root/OdataResourcePath/AstToCstConverters/OdataRelativeUriConverter.cs new file mode 100644 index 0000000000..62b6dbf292 --- /dev/null +++ b/odata/Root/OdataResourcePath/AstToCstConverters/OdataRelativeUriConverter.cs @@ -0,0 +1,130 @@ +namespace Root.OdataResourcePath.AstToCstConverters +{ + using Root; + + public sealed class OdataRelativeUriConverter : + AbstractSyntaxTreeNodes.OdataRelativeUri.Visitor< + ConcreteSyntaxTreeNodes.OdataRelativeUri, + Void> + { + private readonly BatchOptionsConverter batchOptionsCstToAstTranslator; + private readonly EntityOptionsConverter entityOptionsTranslator; + private readonly QualifiedEntityTypeNameConverter qualifiedEntityTypeNameTranslator; + private readonly EntityCastOptionsConverter entityCastOptionsTranslator; + private readonly MetadataOptionsConverter metadataOptionsTranslator; + private readonly ContextConverter contextTranslator; + private readonly ResourcePathConverter resourcePathTranslator; + private readonly QueryOptionsConverter queryOptionsTranslator; + + private OdataRelativeUriConverter( + BatchOptionsConverter batchOptionsCstToAstTranslator, + EntityOptionsConverter entityOptionsTranslator, + QualifiedEntityTypeNameConverter qualifiedEntityTypeNameTranslator, + EntityCastOptionsConverter entityCastOptionsTranslator, + MetadataOptionsConverter metadataOptionsTranslator, + ContextConverter contextTranslator, + ResourcePathConverter resourcePathTranslator, + QueryOptionsConverter queryOptionsTranslator) + { + this.batchOptionsCstToAstTranslator = batchOptionsCstToAstTranslator; + this.entityOptionsTranslator = entityOptionsTranslator; + this.qualifiedEntityTypeNameTranslator = qualifiedEntityTypeNameTranslator; + this.entityCastOptionsTranslator = entityCastOptionsTranslator; + this.metadataOptionsTranslator = metadataOptionsTranslator; + this.contextTranslator = contextTranslator; + this.resourcePathTranslator = resourcePathTranslator; + this.queryOptionsTranslator = queryOptionsTranslator; + } + + public static OdataRelativeUriConverter Default { get; } = new OdataRelativeUriConverter( + BatchOptionsConverter.Default, + EntityOptionsConverter.Default, + QualifiedEntityTypeNameConverter.Default, + EntityCastOptionsConverter.Default, + MetadataOptionsConverter.Default, + ContextConverter.Default, + ResourcePathConverter.Default, + QueryOptionsConverter.Default); + + public override ConcreteSyntaxTreeNodes.OdataRelativeUri Accept( + AbstractSyntaxTreeNodes.OdataRelativeUri.BatchOnly node, + Void context) + { + return ConcreteSyntaxTreeNodes.OdataRelativeUri.BatchOnly.Instance; + } + + public override ConcreteSyntaxTreeNodes.OdataRelativeUri Accept( + AbstractSyntaxTreeNodes.OdataRelativeUri.BatchWithOptions node, + Void context) + { + var batchOptions = this.batchOptionsCstToAstTranslator.Visit(node.BatchOptions, context); + return new ConcreteSyntaxTreeNodes.OdataRelativeUri.BatchWithOptions(batchOptions); + } + + public override ConcreteSyntaxTreeNodes.OdataRelativeUri Accept( + AbstractSyntaxTreeNodes.OdataRelativeUri.EntityWithOptions node, + Void context) + { + var entityOptions = this.entityOptionsTranslator.Visit(node.EntityOptions, context); + return new ConcreteSyntaxTreeNodes.OdataRelativeUri.EntityWithOptions(entityOptions); + } + + public override ConcreteSyntaxTreeNodes.OdataRelativeUri Accept( + AbstractSyntaxTreeNodes.OdataRelativeUri.EntityWithCast node, + Void context) + { + var qualifiedEntityTypeName = this.qualifiedEntityTypeNameTranslator.Visit(node.QualifiedEntityTypeName, context); + var entityCastOptions = this.entityCastOptionsTranslator.Visit(node.EntityCastOptions, context); + return new ConcreteSyntaxTreeNodes.OdataRelativeUri.EntityWithCast(qualifiedEntityTypeName, entityCastOptions); + } + + public override ConcreteSyntaxTreeNodes.OdataRelativeUri Accept( + AbstractSyntaxTreeNodes.OdataRelativeUri.MetadataOnly node, + Void context) + { + return ConcreteSyntaxTreeNodes.OdataRelativeUri.MetadataOnly.Instance; + } + + public override ConcreteSyntaxTreeNodes.OdataRelativeUri Accept( + AbstractSyntaxTreeNodes.OdataRelativeUri.MetadataWithOptions node, + Void context) + { + var metadataOptions = this.metadataOptionsTranslator.Visit(node.MetadataOptions, context); + return new ConcreteSyntaxTreeNodes.OdataRelativeUri.MetadataWithOptions(metadataOptions); + } + + public override ConcreteSyntaxTreeNodes.OdataRelativeUri Accept( + AbstractSyntaxTreeNodes.OdataRelativeUri.MetadataWithContext node, + Void context) + { + var metadataContext = this.contextTranslator.Visit(node.Context, context); + return new ConcreteSyntaxTreeNodes.OdataRelativeUri.MetadataWithContext(metadataContext); + } + + public override ConcreteSyntaxTreeNodes.OdataRelativeUri Accept( + AbstractSyntaxTreeNodes.OdataRelativeUri.MetadataWithOptionsAndContext node, + Void context) + { + var metadataOptions = this.metadataOptionsTranslator.Visit(node.MetadataOptions, context); + var metadataContext = this.contextTranslator.Visit(node.Context, context); + return new ConcreteSyntaxTreeNodes.OdataRelativeUri.MetadataWithOptionsAndContext(metadataOptions, metadataContext); + } + + public override ConcreteSyntaxTreeNodes.OdataRelativeUri Accept( + AbstractSyntaxTreeNodes.OdataRelativeUri.ResourcePathOnly node, + Void context) + { + var resourcePath = this.resourcePathTranslator.Visit(node.ResourcePath, context); + return new ConcreteSyntaxTreeNodes.OdataRelativeUri.ResourcePathOnly(resourcePath); + } + + public override ConcreteSyntaxTreeNodes.OdataRelativeUri Accept( + AbstractSyntaxTreeNodes.OdataRelativeUri.ResourcePathWithQueryOptions node, + Void context) + { + var resourcePath = this.resourcePathTranslator.Visit(node.ResourcePath, context); + var queryOptions = this.queryOptionsTranslator.Visit(node.QueryOptions, context); + return new ConcreteSyntaxTreeNodes.OdataRelativeUri.ResourcePathWithQueryOptions(resourcePath, queryOptions); + } + } +} diff --git a/odata/Root/OdataResourcePath/AstToCstConverters/QualifiedEntityTypeNameConverter.cs b/odata/Root/OdataResourcePath/AstToCstConverters/QualifiedEntityTypeNameConverter.cs new file mode 100644 index 0000000000..0e98234d8f --- /dev/null +++ b/odata/Root/OdataResourcePath/AstToCstConverters/QualifiedEntityTypeNameConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.AstToCstConverters +{ + using Root; + + public sealed class QualifiedEntityTypeNameConverter : + AbstractSyntaxTreeNodes.QualifiedEntityTypeName.Visitor< + ConcreteSyntaxTreeNodes.QualifiedEntityTypeName, + Void> + { + private QualifiedEntityTypeNameConverter() + { + } + + public static QualifiedEntityTypeNameConverter Default { get; } = new QualifiedEntityTypeNameConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/AstToCstConverters/QueryOptionsConverter.cs b/odata/Root/OdataResourcePath/AstToCstConverters/QueryOptionsConverter.cs new file mode 100644 index 0000000000..4d2f3c02bf --- /dev/null +++ b/odata/Root/OdataResourcePath/AstToCstConverters/QueryOptionsConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.AstToCstConverters +{ + using Root; + + public sealed class QueryOptionsConverter : + AbstractSyntaxTreeNodes.QueryOptions.Visitor< + ConcreteSyntaxTreeNodes.QueryOptions, + Void> + { + private QueryOptionsConverter() + { + } + + public static QueryOptionsConverter Default { get; } = new QueryOptionsConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/AstToCstConverters/ResourcePathConverter.cs b/odata/Root/OdataResourcePath/AstToCstConverters/ResourcePathConverter.cs new file mode 100644 index 0000000000..99d4dfbced --- /dev/null +++ b/odata/Root/OdataResourcePath/AstToCstConverters/ResourcePathConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.AstToCstConverters +{ + using Root; + + public sealed class ResourcePathConverter : + AbstractSyntaxTreeNodes.ResourcePath.Visitor< + ConcreteSyntaxTreeNodes.ResourcePath, + Void> + { + private ResourcePathConverter() + { + } + + public static ResourcePathConverter Default { get; } = new ResourcePathConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/BatchOptionsParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/BatchOptionsParser.cs new file mode 100644 index 0000000000..9e9cda0d64 --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/BatchOptionsParser.cs @@ -0,0 +1,11 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class BatchOptionsParser + { + public static Parser Instance { get; } = Parser.None( + "BatchOptions parsing has not been implemented"); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/BatchParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/BatchParser.cs new file mode 100644 index 0000000000..6c3cc5a56f --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/BatchParser.cs @@ -0,0 +1,12 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class BatchParser + { + public static Parser Instance { get; } = Parse + .String("$batch") + .Return(Batch.Instance); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/ContextParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/ContextParser.cs new file mode 100644 index 0000000000..1a99dea959 --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/ContextParser.cs @@ -0,0 +1,11 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class ContextParser + { + public static Parser Instance { get; } = Parser.None( + "BatchOptions parsing has not been implemented"); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/EntityCastOptionsParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/EntityCastOptionsParser.cs new file mode 100644 index 0000000000..9ff2fae563 --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/EntityCastOptionsParser.cs @@ -0,0 +1,11 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class EntityCastOptionsParser + { + public static Parser Instance { get; } = Parser.None( + "BatchOptions parsing has not been implemented"); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/EntityOptionsParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/EntityOptionsParser.cs new file mode 100644 index 0000000000..6f35c0ffae --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/EntityOptionsParser.cs @@ -0,0 +1,11 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class EntityOptionsParser + { + public static Parser Instance { get; } = Parser.None( + "BatchOptions parsing has not been implemented"); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/EntityParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/EntityParser.cs new file mode 100644 index 0000000000..32352e9e16 --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/EntityParser.cs @@ -0,0 +1,12 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class EntityParser + { + public static Parser Instance { get; } = Parse + .String("$entity") + .Return(Entity.Instance); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/MetadataOptionsParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/MetadataOptionsParser.cs new file mode 100644 index 0000000000..d541f54dd7 --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/MetadataOptionsParser.cs @@ -0,0 +1,11 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class MetadataOptionsParser + { + public static Parser Instance { get; } = Parser.None( + "BatchOptions parsing has not been implemented"); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/MetadataParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/MetadataParser.cs new file mode 100644 index 0000000000..7b8dba68b2 --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/MetadataParser.cs @@ -0,0 +1,12 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class MetadataParser + { + public static Parser Instance { get; } = Parse + .String("$metadata") + .Return(Metadata.Instance); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/OdataRelativeUriParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/OdataRelativeUriParser.cs new file mode 100644 index 0000000000..cd381fc072 --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/OdataRelativeUriParser.cs @@ -0,0 +1,77 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class OdataRelativeUriParser + { + public static Parser BatchOnly { get; } = + from batch in BatchParser.Instance + select OdataRelativeUri.BatchOnly.Instance; + + public static Parser BatchWithOptions { get; } = + //// TODO can you avoid using this syntax? + from batch in BatchParser.Instance + from questionMark in QuestionMarkParser.Instance + from batchOptions in BatchOptionsParser.Instance + select new OdataRelativeUri.BatchWithOptions(batchOptions); + + public static Parser EntityWithOptions { get; } = + from entity in EntityParser.Instance + from questionMark in QuestionMarkParser.Instance + from entityOptions in EntityOptionsParser.Instance + select new OdataRelativeUri.EntityWithOptions(entityOptions); + + public static Parser EntityWithCast { get; } = + from entity in EntityParser.Instance + from slash in SlashParser.Instance + from qualifiedTypeName in QualifiedTypeNameParser.Instance + from questionMark in QuestionMarkParser.Instance + from entityCastOptions in EntityCastOptionsParser.Instance + select new OdataRelativeUri.EntityWithCast(qualifiedTypeName, entityCastOptions); + + public static Parser MetadataOnly { get; } = + from metadata in MetadataParser.Instance + select OdataRelativeUri.MetadataOnly.Instance; + + public static Parser MetadataWithOptions { get; } = + from metadata in MetadataParser.Instance + from questionMark in QuestionMarkParser.Instance + from metadataOptions in MetadataOptionsParser.Instance + select new OdataRelativeUri.MetadataWithOptions(metadataOptions); + + public static Parser MetadataWithContext { get; } = + from metadata in MetadataParser.Instance + from context in ContextParser.Instance + select new OdataRelativeUri.MetadataWithContext(context); + + public static Parser MetadataWithOptionsAndContext { get; } = + from metadata in MetadataParser.Instance + from questionMark in QuestionMarkParser.Instance + from metadataOptions in MetadataOptionsParser.Instance + from context in ContextParser.Instance + select new OdataRelativeUri.MetadataWithOptionsAndContext(metadataOptions, context); + + public static Parser ResourcePathOnly { get; } = + from resourcePath in ResourcePathParser.Instance + select new OdataRelativeUri.ResourcePathOnly(resourcePath); + + public static Parser ResourcePathWithQueryOptions { get; } = + from resourcePath in ResourcePathParser.Instance + from questionMark in QuestionMarkParser.Instance + from queryOptions in QueryOptionsParser.Instance + select new OdataRelativeUri.ResourcePathWithQueryOptions(resourcePath, queryOptions); + + public static Parser Instance { get; } = + BatchOnly + .Or(BatchWithOptions) + .Or(EntityWithOptions) + .Or(EntityWithCast) + .Or(MetadataOnly) + .Or(MetadataWithOptions) + .Or(MetadataWithContext) + .Or(MetadataWithOptionsAndContext) + .Or(ResourcePathOnly) + .Or(ResourcePathWithQueryOptions); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/QualifiedTypeNameParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/QualifiedTypeNameParser.cs new file mode 100644 index 0000000000..5335c92dad --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/QualifiedTypeNameParser.cs @@ -0,0 +1,12 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class QualifiedTypeNameParser + { + //// TODO how to implement this for the "Feature gap" case? + public static Parser Instance { get; } = Parser.None( + "BatchOptions parsing has not been implemented"); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/QueryOptionsParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/QueryOptionsParser.cs new file mode 100644 index 0000000000..c064675c77 --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/QueryOptionsParser.cs @@ -0,0 +1,12 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class QueryOptionsParser + { + //// TODO how to implement this for the "Feature gap" case? + public static Parser Instance { get; } = Parser.None( + "BatchOptions parsing has not been implemented"); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/QuestionMarkParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/QuestionMarkParser.cs new file mode 100644 index 0000000000..f951e2c1b2 --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/QuestionMarkParser.cs @@ -0,0 +1,12 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class QuestionMarkParser + { + public static Parser Instance { get; } = Parse + .String("?") + .Return(QuestionMark.Instance); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/ResourcePathParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/ResourcePathParser.cs new file mode 100644 index 0000000000..eb3da00d10 --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/ResourcePathParser.cs @@ -0,0 +1,11 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class ResourcePathParser + { + public static Parser Instance { get; } = Parser.None( + "BatchOptions parsing has not been implemented"); + } +} diff --git a/odata/Root/OdataResourcePath/CombinatorParsers/SlashParser.cs b/odata/Root/OdataResourcePath/CombinatorParsers/SlashParser.cs new file mode 100644 index 0000000000..ef17cff7bf --- /dev/null +++ b/odata/Root/OdataResourcePath/CombinatorParsers/SlashParser.cs @@ -0,0 +1,12 @@ +namespace Root.OdataResourcePath.CombinatorParsers +{ + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + using Sprache; + + public static class SlashParser + { + public static Parser Instance { get; } = Parse + .String("/") + .Return(Slash.Instance); + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Batch.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Batch.cs new file mode 100644 index 0000000000..344213fd6f --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Batch.cs @@ -0,0 +1,11 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + public sealed class Batch + { + private Batch() + { + } + + public static Batch Instance { get; } = new Batch(); + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/BatchOptions.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/BatchOptions.cs new file mode 100644 index 0000000000..3b95211d84 --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/BatchOptions.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class BatchOptions + { + private BatchOptions() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(BatchOptions node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Context.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Context.cs new file mode 100644 index 0000000000..ebbfd10c2b --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Context.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class Context + { + private Context() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(Context node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Entity.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Entity.cs new file mode 100644 index 0000000000..83d1582bcd --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Entity.cs @@ -0,0 +1,11 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + public sealed class Entity + { + private Entity() + { + } + + public static Entity Instance { get; } = new Entity(); + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/EntityCastOptions.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/EntityCastOptions.cs new file mode 100644 index 0000000000..664dfcc184 --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/EntityCastOptions.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class EntityCastOptions + { + private EntityCastOptions() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(EntityCastOptions node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/EntityOptions.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/EntityOptions.cs new file mode 100644 index 0000000000..35c797bafc --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/EntityOptions.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class EntityOptions + { + private EntityOptions() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(EntityOptions node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Metadata.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Metadata.cs new file mode 100644 index 0000000000..6322036e76 --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Metadata.cs @@ -0,0 +1,11 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + public sealed class Metadata + { + private Metadata() + { + } + + public static Metadata Instance { get; } = new Metadata(); + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/MetadataOptions.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/MetadataOptions.cs new file mode 100644 index 0000000000..89e89fa1da --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/MetadataOptions.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class MetadataOptions + { + private MetadataOptions() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(MetadataOptions node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/OdataRelativeUri.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/OdataRelativeUri.cs new file mode 100644 index 0000000000..8a5a000f1c --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/OdataRelativeUri.cs @@ -0,0 +1,222 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + /// + /// this is the AST for odata resource paths + /// pulled from `odataRelativeUri` definition in https://docs.oasis-open.org/odata/odata/v4.01/cs01/abnf/odata-abnf-construction-rules.txt + /// + public abstract class OdataRelativeUri + { + private OdataRelativeUri() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(OdataRelativeUri node, TContext context) + { + return node.Dispatch(this, context); + } + + public abstract TResult Accept(BatchOnly node, TContext context); + public abstract TResult Accept(BatchWithOptions node, TContext context); + public abstract TResult Accept(EntityWithOptions node, TContext context); + public abstract TResult Accept(EntityWithCast node, TContext context); + public abstract TResult Accept(MetadataOnly node, TContext context); + public abstract TResult Accept(MetadataWithOptions node, TContext context); + public abstract TResult Accept(MetadataWithContext node, TContext context); + public abstract TResult Accept(MetadataWithOptionsAndContext node, TContext context); + public abstract TResult Accept(ResourcePathOnly node, TContext context); + public abstract TResult Accept(ResourcePathWithQueryOptions node, TContext context); + } + + public sealed class BatchOnly : OdataRelativeUri + { + private BatchOnly() + { + this.Batch = Batch.Instance; + this.QuestionMark = QuestionMark.Instance; + } + + public Batch Batch { get; } + public QuestionMark QuestionMark { get; } + + public static BatchOnly Instance { get; } = new BatchOnly(); + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class BatchWithOptions : OdataRelativeUri + { + public BatchWithOptions(BatchOptions batchOptions) + { + this.Batch = Batch.Instance; + this.QuestionMark = QuestionMark.Instance; + this.BatchOptions = batchOptions; + } + + public Batch Batch { get; } + public QuestionMark QuestionMark { get; } + public BatchOptions BatchOptions { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class EntityWithOptions : OdataRelativeUri + { + public EntityWithOptions(EntityOptions entityOptions) + { + this.Entity = Entity.Instance; + this.QuestionMark = QuestionMark.Instance; + this.EntityOptions = entityOptions; + } + + public Entity Entity { get; } + public QuestionMark QuestionMark { get; } + public EntityOptions EntityOptions { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class EntityWithCast : OdataRelativeUri + { + public EntityWithCast(QualifiedEntityTypeName qualifiedEntityTypeName, EntityCastOptions entityCastOptions) + { + this.Entity = Entity.Instance; + this.Slash = Slash.Instance; + this.QualifiedEntityTypeName = qualifiedEntityTypeName; + this.QuestionMark = QuestionMark.Instance; + this.EntityCastOptions = entityCastOptions; + } + + public Entity Entity { get; } + public Slash Slash { get; } + public QualifiedEntityTypeName QualifiedEntityTypeName { get; } + public QuestionMark QuestionMark { get; } + public EntityCastOptions EntityCastOptions { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class MetadataOnly : OdataRelativeUri + { + private MetadataOnly() + { + this.Metadata = Metadata.Instance; + } + + public Metadata Metadata { get; } + + public static MetadataOnly Instance { get; } = new MetadataOnly(); + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class MetadataWithOptions : OdataRelativeUri + { + public MetadataWithOptions(MetadataOptions metadataOptions) + { + this.Metadata = Metadata.Instance; + this.QuestionMark = QuestionMark.Instance; + this.MetadataOptions = metadataOptions; + } + + public Metadata Metadata { get; } + public QuestionMark QuestionMark { get; } + public MetadataOptions MetadataOptions { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class MetadataWithContext : OdataRelativeUri + { + public MetadataWithContext(Context context) + { + this.Metadata = Metadata.Instance; + this.Context = context; + } + + public Metadata Metadata { get; } + public Context Context { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class MetadataWithOptionsAndContext : OdataRelativeUri + { + public MetadataWithOptionsAndContext(MetadataOptions metadataOptions, Context context) + { + this.Metadata = Metadata.Instance; + this.QuestionMark = QuestionMark.Instance; + this.MetadataOptions = metadataOptions; + this.Context = context; + } + + public Metadata Metadata { get; } + public QuestionMark QuestionMark { get; } + public MetadataOptions MetadataOptions { get; } + public Context Context { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class ResourcePathOnly : OdataRelativeUri + { + public ResourcePathOnly(ResourcePath resourcePath) + { + this.ResourcePath = resourcePath; + } + + public ResourcePath ResourcePath { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + + public sealed class ResourcePathWithQueryOptions : OdataRelativeUri + { + public ResourcePathWithQueryOptions(ResourcePath resourcePath, QueryOptions queryOptions) + { + this.ResourcePath = resourcePath; + this.QuestionMark = QuestionMark.Instance; + this.QueryOptions = queryOptions; + } + + public ResourcePath ResourcePath { get; } + public QuestionMark QuestionMark { get; } + public QueryOptions QueryOptions { get; } + + protected sealed override TResult Dispatch(Visitor visitor, TContext context) + { + return visitor.Accept(this, context); + } + } + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/QualifiedEntityTypeName.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/QualifiedEntityTypeName.cs new file mode 100644 index 0000000000..e40ccdedce --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/QualifiedEntityTypeName.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class QualifiedEntityTypeName + { + private QualifiedEntityTypeName() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(QualifiedEntityTypeName node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/QueryOptions.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/QueryOptions.cs new file mode 100644 index 0000000000..12b20a69a7 --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/QueryOptions.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class QueryOptions + { + private QueryOptions() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(QueryOptions node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/QuestionMark.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/QuestionMark.cs new file mode 100644 index 0000000000..f655fe33b9 --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/QuestionMark.cs @@ -0,0 +1,11 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + public sealed class QuestionMark + { + private QuestionMark() + { + } + + public static QuestionMark Instance { get; } = new QuestionMark(); + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/ResourcePath.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/ResourcePath.cs new file mode 100644 index 0000000000..5db1a44713 --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/ResourcePath.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + // TODO this is just a stub for now + public abstract class ResourcePath + { + private ResourcePath() + { + } + + protected abstract TResult Dispatch(Visitor visitor, TContext context); + + public abstract class Visitor + { + public TResult Visit(ResourcePath node, TContext context) + { + return node.Dispatch(this, context); + } + } + } +} diff --git a/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Slash.cs b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Slash.cs new file mode 100644 index 0000000000..4e1b1a302e --- /dev/null +++ b/odata/Root/OdataResourcePath/ConcreteSyntaxTreeNodes/Slash.cs @@ -0,0 +1,11 @@ +namespace Root.OdataResourcePath.ConcreteSyntaxTreeNodes +{ + public sealed class Slash + { + private Slash() + { + } + + public static Slash Instance { get; } = new Slash(); + } +} diff --git a/odata/Root/OdataResourcePath/CstToAstConverters/BatchOptionsConverter.cs b/odata/Root/OdataResourcePath/CstToAstConverters/BatchOptionsConverter.cs new file mode 100644 index 0000000000..44fc218b51 --- /dev/null +++ b/odata/Root/OdataResourcePath/CstToAstConverters/BatchOptionsConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.CstToAstConverters +{ + using Root; + + public sealed class BatchOptionsConverter : + ConcreteSyntaxTreeNodes.BatchOptions.Visitor< + AbstractSyntaxTreeNodes.BatchOptions, + Void> + { + private BatchOptionsConverter() + { + } + + public static BatchOptionsConverter Default { get; } = new BatchOptionsConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/CstToAstConverters/ContextConverter.cs b/odata/Root/OdataResourcePath/CstToAstConverters/ContextConverter.cs new file mode 100644 index 0000000000..33ba1bc519 --- /dev/null +++ b/odata/Root/OdataResourcePath/CstToAstConverters/ContextConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.CstToAstConverters +{ + using Root; + + public sealed class ContextConverter : + ConcreteSyntaxTreeNodes.Context.Visitor< + AbstractSyntaxTreeNodes.Context, + Void> + { + private ContextConverter() + { + } + + public static ContextConverter Default { get; } = new ContextConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/CstToAstConverters/EntityCastOptionsConverter.cs b/odata/Root/OdataResourcePath/CstToAstConverters/EntityCastOptionsConverter.cs new file mode 100644 index 0000000000..89677b8a0b --- /dev/null +++ b/odata/Root/OdataResourcePath/CstToAstConverters/EntityCastOptionsConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.CstToAstConverters +{ + using Root; + + public sealed class EntityCastOptionsConverter : + ConcreteSyntaxTreeNodes.EntityCastOptions.Visitor< + AbstractSyntaxTreeNodes.EntityCastOptions, + Void> + { + private EntityCastOptionsConverter() + { + } + + public static EntityCastOptionsConverter Default { get; } = new EntityCastOptionsConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/CstToAstConverters/EntityOptionsConverter.cs b/odata/Root/OdataResourcePath/CstToAstConverters/EntityOptionsConverter.cs new file mode 100644 index 0000000000..c02722df1c --- /dev/null +++ b/odata/Root/OdataResourcePath/CstToAstConverters/EntityOptionsConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.CstToAstConverters +{ + using Root; + + public sealed class EntityOptionsConverter : + ConcreteSyntaxTreeNodes.EntityOptions.Visitor< + AbstractSyntaxTreeNodes.EntityOptions, + Void> + { + private EntityOptionsConverter() + { + } + + public static EntityOptionsConverter Default { get; } = new EntityOptionsConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/CstToAstConverters/MetadataOptionsConverter.cs b/odata/Root/OdataResourcePath/CstToAstConverters/MetadataOptionsConverter.cs new file mode 100644 index 0000000000..2e1e60b2f5 --- /dev/null +++ b/odata/Root/OdataResourcePath/CstToAstConverters/MetadataOptionsConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.CstToAstConverters +{ + using Root; + + public sealed class MetadataOptionsConverter : + ConcreteSyntaxTreeNodes.MetadataOptions.Visitor< + AbstractSyntaxTreeNodes.MetadataOptions, + Void> + { + private MetadataOptionsConverter() + { + } + + public static MetadataOptionsConverter Default { get; } = new MetadataOptionsConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/CstToAstConverters/OdataRelativeUriConverter.cs b/odata/Root/OdataResourcePath/CstToAstConverters/OdataRelativeUriConverter.cs new file mode 100644 index 0000000000..c4fa62991f --- /dev/null +++ b/odata/Root/OdataResourcePath/CstToAstConverters/OdataRelativeUriConverter.cs @@ -0,0 +1,130 @@ +namespace Root.OdataResourcePath.CstToAstConverters +{ + using Root; + + public sealed class OdataRelativeUriConverter : + ConcreteSyntaxTreeNodes.OdataRelativeUri.Visitor< + AbstractSyntaxTreeNodes.OdataRelativeUri, + Void> + { + private readonly BatchOptionsConverter batchOptionsCstToAstTranslator; + private readonly EntityOptionsConverter entityOptionsTranslator; + private readonly QualifiedEntityTypeNameConverter qualifiedEntityTypeNameTranslator; + private readonly EntityCastOptionsConverter entityCastOptionsTranslator; + private readonly MetadataOptionsConverter metadataOptionsTranslator; + private readonly ContextConverter contextTranslator; + private readonly ResourcePathConverter resourcePathTranslator; + private readonly QueryOptionsConverter queryOptionsTranslator; + + private OdataRelativeUriConverter( + BatchOptionsConverter batchOptionsCstToAstTranslator, + EntityOptionsConverter entityOptionsTranslator, + QualifiedEntityTypeNameConverter qualifiedEntityTypeNameTranslator, + EntityCastOptionsConverter entityCastOptionsTranslator, + MetadataOptionsConverter metadataOptionsTranslator, + ContextConverter contextTranslator, + ResourcePathConverter resourcePathTranslator, + QueryOptionsConverter queryOptionsTranslator) + { + this.batchOptionsCstToAstTranslator = batchOptionsCstToAstTranslator; + this.entityOptionsTranslator = entityOptionsTranslator; + this.qualifiedEntityTypeNameTranslator = qualifiedEntityTypeNameTranslator; + this.entityCastOptionsTranslator = entityCastOptionsTranslator; + this.metadataOptionsTranslator = metadataOptionsTranslator; + this.contextTranslator = contextTranslator; + this.resourcePathTranslator = resourcePathTranslator; + this.queryOptionsTranslator = queryOptionsTranslator; + } + + public static OdataRelativeUriConverter Default { get; } = new OdataRelativeUriConverter( + BatchOptionsConverter.Default, + EntityOptionsConverter.Default, + QualifiedEntityTypeNameConverter.Default, + EntityCastOptionsConverter.Default, + MetadataOptionsConverter.Default, + ContextConverter.Default, + ResourcePathConverter.Default, + QueryOptionsConverter.Default); + + public override AbstractSyntaxTreeNodes.OdataRelativeUri Accept( + ConcreteSyntaxTreeNodes.OdataRelativeUri.BatchOnly node, + Void context) + { + return AbstractSyntaxTreeNodes.OdataRelativeUri.BatchOnly.Instance; + } + + public override AbstractSyntaxTreeNodes.OdataRelativeUri Accept( + ConcreteSyntaxTreeNodes.OdataRelativeUri.BatchWithOptions node, + Void context) + { + var batchOptions = this.batchOptionsCstToAstTranslator.Visit(node.BatchOptions, context); + return new AbstractSyntaxTreeNodes.OdataRelativeUri.BatchWithOptions(batchOptions); + } + + public override AbstractSyntaxTreeNodes.OdataRelativeUri Accept( + ConcreteSyntaxTreeNodes.OdataRelativeUri.EntityWithOptions node, + Void context) + { + var entityOptions = this.entityOptionsTranslator.Visit(node.EntityOptions, context); + return new AbstractSyntaxTreeNodes.OdataRelativeUri.EntityWithOptions(entityOptions); + } + + public override AbstractSyntaxTreeNodes.OdataRelativeUri Accept( + ConcreteSyntaxTreeNodes.OdataRelativeUri.EntityWithCast node, + Void context) + { + var qualifiedEntityTypeName = this.qualifiedEntityTypeNameTranslator.Visit(node.QualifiedEntityTypeName, context); + var entityCastOptions = this.entityCastOptionsTranslator.Visit(node.EntityCastOptions, context); + return new AbstractSyntaxTreeNodes.OdataRelativeUri.EntityWithCast(qualifiedEntityTypeName, entityCastOptions); + } + + public override AbstractSyntaxTreeNodes.OdataRelativeUri Accept( + ConcreteSyntaxTreeNodes.OdataRelativeUri.MetadataOnly node, + Void context) + { + return AbstractSyntaxTreeNodes.OdataRelativeUri.MetadataOnly.Instance; + } + + public override AbstractSyntaxTreeNodes.OdataRelativeUri Accept( + ConcreteSyntaxTreeNodes.OdataRelativeUri.MetadataWithOptions node, + Void context) + { + var metadataOptions = this.metadataOptionsTranslator.Visit(node.MetadataOptions, context); + return new AbstractSyntaxTreeNodes.OdataRelativeUri.MetadataWithOptions(metadataOptions); + } + + public override AbstractSyntaxTreeNodes.OdataRelativeUri Accept( + ConcreteSyntaxTreeNodes.OdataRelativeUri.MetadataWithContext node, + Void context) + { + var metadataContext = this.contextTranslator.Visit(node.Context, context); + return new AbstractSyntaxTreeNodes.OdataRelativeUri.MetadataWithContext(metadataContext); + } + + public override AbstractSyntaxTreeNodes.OdataRelativeUri Accept( + ConcreteSyntaxTreeNodes.OdataRelativeUri.MetadataWithOptionsAndContext node, + Void context) + { + var metadataOptions = this.metadataOptionsTranslator.Visit(node.MetadataOptions, context); + var metadataContext = this.contextTranslator.Visit(node.Context, context); + return new AbstractSyntaxTreeNodes.OdataRelativeUri.MetadataWithOptionsAndContext(metadataOptions, metadataContext); + } + + public override AbstractSyntaxTreeNodes.OdataRelativeUri Accept( + ConcreteSyntaxTreeNodes.OdataRelativeUri.ResourcePathOnly node, + Void context) + { + var resourcePath = this.resourcePathTranslator.Visit(node.ResourcePath, context); + return new AbstractSyntaxTreeNodes.OdataRelativeUri.ResourcePathOnly(resourcePath); + } + + public override AbstractSyntaxTreeNodes.OdataRelativeUri Accept( + ConcreteSyntaxTreeNodes.OdataRelativeUri.ResourcePathWithQueryOptions node, + Void context) + { + var resourcePath = this.resourcePathTranslator.Visit(node.ResourcePath, context); + var queryOptions = this.queryOptionsTranslator.Visit(node.QueryOptions, context); + return new AbstractSyntaxTreeNodes.OdataRelativeUri.ResourcePathWithQueryOptions(resourcePath, queryOptions); + } + } +} diff --git a/odata/Root/OdataResourcePath/CstToAstConverters/QualifiedEntityTypeNameConverter.cs b/odata/Root/OdataResourcePath/CstToAstConverters/QualifiedEntityTypeNameConverter.cs new file mode 100644 index 0000000000..4c3e170b23 --- /dev/null +++ b/odata/Root/OdataResourcePath/CstToAstConverters/QualifiedEntityTypeNameConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.CstToAstConverters +{ + using Root; + + public sealed class QualifiedEntityTypeNameConverter : + ConcreteSyntaxTreeNodes.QualifiedEntityTypeName.Visitor< + AbstractSyntaxTreeNodes.QualifiedEntityTypeName, + Void> + { + private QualifiedEntityTypeNameConverter() + { + } + + public static QualifiedEntityTypeNameConverter Default { get; } = new QualifiedEntityTypeNameConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/CstToAstConverters/QueryOptionsConverter.cs b/odata/Root/OdataResourcePath/CstToAstConverters/QueryOptionsConverter.cs new file mode 100644 index 0000000000..e078663d28 --- /dev/null +++ b/odata/Root/OdataResourcePath/CstToAstConverters/QueryOptionsConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.CstToAstConverters +{ + using Root; + + public sealed class QueryOptionsConverter : + ConcreteSyntaxTreeNodes.QueryOptions.Visitor< + AbstractSyntaxTreeNodes.QueryOptions, + Void> + { + private QueryOptionsConverter() + { + } + + public static QueryOptionsConverter Default { get; } = new QueryOptionsConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/CstToAstConverters/ResourcePathConverter.cs b/odata/Root/OdataResourcePath/CstToAstConverters/ResourcePathConverter.cs new file mode 100644 index 0000000000..b2e52d34a0 --- /dev/null +++ b/odata/Root/OdataResourcePath/CstToAstConverters/ResourcePathConverter.cs @@ -0,0 +1,16 @@ +namespace Root.OdataResourcePath.CstToAstConverters +{ + using Root; + + public sealed class ResourcePathConverter : + ConcreteSyntaxTreeNodes.ResourcePath.Visitor< + AbstractSyntaxTreeNodes.ResourcePath, + Void> + { + private ResourcePathConverter() + { + } + + public static ResourcePathConverter Default { get; } = new ResourcePathConverter(); + } +} diff --git a/odata/Root/OdataResourcePath/SyntacticCstNodes/contextfree.abnf b/odata/Root/OdataResourcePath/SyntacticCstNodes/contextfree.abnf new file mode 100644 index 0000000000..e92bde4d0f --- /dev/null +++ b/odata/Root/OdataResourcePath/SyntacticCstNodes/contextfree.abnf @@ -0,0 +1,120 @@ +odataRelativeUri = '$batch' [ "?" batchOptions ] + / '$entity' "?" entityOptions + / '$entity' "/" qualifiedTypeName ? entityCastOptions + / '$metadata' [ "?" metadataOptions ] [ context ] + / resourcePath [ "?" queryOptions ] + +batchOptions = batchOption *( "&" batchOption ) + +; TODO do `odataRelativeUri`s that start with $entity +; TODO do `odataRelativeUri`s that start with $metadata + +resourcePath = one + / TODO + / '$all' [ "/" qualifiedTypeName ] ; '$all' [ "/" qualifiedTypeName ] + +; entitySetName [ collectionNavigation ] +one = odataIdentifier [ "/" qualifiedTypeName ] [ simpleKey ] ; TODO finish this + / odataIdentifier [ "/" qualifiedTypeName ] [ compoundKey ] ; TODO finish this + / ; TODO finsih this + +batchOption = format + / customQueryOption + +format = ( "$format" / "format" ) EQ + ( "atom" + / "json" + / "xml" + / 1*pchar "/" 1*pchar + ) + +customQueryOption = customName [ EQ customValue ] + +customName = qchar-no-AMP-EQ-AT-DOLLAR *( qchar-no-AMP-EQ ) + +customValue = *( qchar-no-AMP ) + +qualifiedTypeName = namespace "." entityTypeName + +namespace = namespacePart *( "." namespacePart ) + +namespacePart = odataIdentifier + +entityTypeName = odataIdentifier + +odataIdentifier = identifierLeadingCharacter *127identifierCharacter + +identifierLeadingCharacter = ALPHA / "_" ; plus Unicode characters from the categories L or Nl + +identifierCharacter = ALPHA / "_" / DIGIT ; plus Unicode characters from the categories L, Nl, Nd, Mn, Mc, Pc, or Cf + +pchar = unreserved + / pct-encoded + / sub-delims + / ":" + / "@" + +unreserved = ALPHA + / DIGIT + / "-" + / "." + / "_" + / "~" + +pct-encoded = "%" HEXDIG HEXDIG + +sub-delims = "$" + / "&" + / "'" + / "=" + / other-delims + +other-delims = "!" + / "(" + / ")" + / "*" + / "+" + / "," + / ";" + +qchar-no-AMP = unreserved + / pct-encoded + / other-delims + / ":" + / "@" + / "/" + / "?" + / "$" + / "'" + / "=" + +qchar-no-AMP-EQ = unreserved + / pct-encoded + / other-delims + / ":" + / "@" + / "/" + / "?" + / "$" + / "'" +qchar-no-AMP-EQ-AT-DOLLAR = unreserved + / pct-encoded + / other-delims + / ":" + / "/" + / "?" + / "'" + +;------------------------------------------------------------------------------ +; 9. Punctuation +;------------------------------------------------------------------------------ + +EQ = "=" + +;------------------------------------------------------------------------------ +; C. ABNF core definitions [RFC5234] +;------------------------------------------------------------------------------ + +ALPHA = %x41-5A / %x61-7A +DIGIT = %x30-39 +HEXDIG = DIGIT / A-to-F \ No newline at end of file diff --git a/odata/Root/OdataResourcePath/Transcribers/BatchOptionsTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/BatchOptionsTranscriber.cs new file mode 100644 index 0000000000..85b49849db --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/BatchOptionsTranscriber.cs @@ -0,0 +1,15 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class BatchOptionsTranscriber : BatchOptions.Visitor + { + private BatchOptionsTranscriber() + { + } + + public static BatchOptionsTranscriber Default { get; } = new BatchOptionsTranscriber(); + } +} diff --git a/odata/Root/OdataResourcePath/Transcribers/BatchTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/BatchTranscriber.cs new file mode 100644 index 0000000000..fe215768a3 --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/BatchTranscriber.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class BatchTranscriber + { + private BatchTranscriber() + { + } + + public static BatchTranscriber Default { get; } = new BatchTranscriber(); + + public void Transcribe(Batch node, StringBuilder context) + { + context.Append("$batch"); + } + } +} diff --git a/odata/Root/OdataResourcePath/Transcribers/ContextTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/ContextTranscriber.cs new file mode 100644 index 0000000000..350b312857 --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/ContextTranscriber.cs @@ -0,0 +1,15 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class ContextTranscriber : Context.Visitor + { + private ContextTranscriber() + { + } + + public static ContextTranscriber Default { get; } = new ContextTranscriber(); + } +} diff --git a/odata/Root/OdataResourcePath/Transcribers/EntityCastOptionsTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/EntityCastOptionsTranscriber.cs new file mode 100644 index 0000000000..76505fc4f0 --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/EntityCastOptionsTranscriber.cs @@ -0,0 +1,15 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class EntityCastOptionsTranscriber : EntityCastOptions.Visitor + { + private EntityCastOptionsTranscriber() + { + } + + public static EntityCastOptionsTranscriber Default { get; } = new EntityCastOptionsTranscriber(); + } +} diff --git a/odata/Root/OdataResourcePath/Transcribers/EntityOptionsTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/EntityOptionsTranscriber.cs new file mode 100644 index 0000000000..b9c2418e6c --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/EntityOptionsTranscriber.cs @@ -0,0 +1,15 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class EntityOptionsTranscriber : EntityOptions.Visitor + { + private EntityOptionsTranscriber() + { + } + + public static EntityOptionsTranscriber Default { get; } = new EntityOptionsTranscriber(); + } +} diff --git a/odata/Root/OdataResourcePath/Transcribers/EntityTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/EntityTranscriber.cs new file mode 100644 index 0000000000..27b227e108 --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/EntityTranscriber.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class EntityTranscriber + { + private EntityTranscriber() + { + } + + public static EntityTranscriber Default { get; } = new EntityTranscriber(); + + public void Transcribe(Entity node, StringBuilder context) + { + context.Append("entity"); + } + } +} diff --git a/odata/Root/OdataResourcePath/Transcribers/MetadataOptionsTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/MetadataOptionsTranscriber.cs new file mode 100644 index 0000000000..576b892d9c --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/MetadataOptionsTranscriber.cs @@ -0,0 +1,15 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class MetadataOptionsTranscriber : MetadataOptions.Visitor + { + private MetadataOptionsTranscriber() + { + } + + public static MetadataOptionsTranscriber Default { get; } = new MetadataOptionsTranscriber(); + } +} diff --git a/odata/Root/OdataResourcePath/Transcribers/MetadataTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/MetadataTranscriber.cs new file mode 100644 index 0000000000..6ab667f723 --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/MetadataTranscriber.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class MetadataTranscriber + { + private MetadataTranscriber() + { + } + + public static MetadataTranscriber Default { get; } = new MetadataTranscriber(); + + public void Transcribe(Metadata node, StringBuilder context) + { + context.Append("$metadata"); + } + } +} diff --git a/odata/Root/OdataResourcePath/Transcribers/OdataRelativeUriTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/OdataRelativeUriTranscriber.cs new file mode 100644 index 0000000000..809beb37ec --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/OdataRelativeUriTranscriber.cs @@ -0,0 +1,144 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class OdataRelativeUriTranscriber : OdataRelativeUri.Visitor + { + private readonly BatchTranscriber batchTranscriber; + private readonly QuestionMarkTranscriber questionMarkTranscriber; + private readonly BatchOptionsTranscriber batchOptionsTranscriber; + private readonly EntityTranscriber entityTranscriber; + private readonly EntityOptionsTranscriber entityOptionsTranscriber; + private readonly SlashTranscriber slashTranscriber; + private readonly QualifiedEntityTypeNameTranscriber qualifiedEntityTypeNameTranscriber; + private readonly EntityCastOptionsTranscriber entityCastOptionsTranscriber; + private readonly MetadataTranscriber metadataTranscriber; + private readonly MetadataOptionsTranscriber metadataOptionsTranscriber; + private readonly ContextTranscriber contextTranscriber; + private readonly ResourcePathTranscriber resourcePathTranscriber; + private readonly QueryOptionsTranscriber queryOptionsTranscriber; + + private OdataRelativeUriTranscriber( + BatchTranscriber batchTranscriber, + QuestionMarkTranscriber questionMarkTranscriber, + BatchOptionsTranscriber batchOptionsTranscriber, + EntityTranscriber entityTranscriber, + EntityOptionsTranscriber entityOptionsTranscriber, + SlashTranscriber slashTranscriber, + QualifiedEntityTypeNameTranscriber qualifiedEntityTypeNameTranscriber, + EntityCastOptionsTranscriber entityCastOptionsTranscriber, + MetadataTranscriber metadataTranscriber, + MetadataOptionsTranscriber metadataOptionsTranscriber, + ContextTranscriber contextTranscriber, + ResourcePathTranscriber resourcePathTranscriber, + QueryOptionsTranscriber queryOptionsTranscriber) + { + this.batchTranscriber = batchTranscriber; + this.questionMarkTranscriber = questionMarkTranscriber; + this.batchOptionsTranscriber = batchOptionsTranscriber; + this.entityTranscriber = entityTranscriber; + this.entityOptionsTranscriber = entityOptionsTranscriber; + this.slashTranscriber = slashTranscriber; + this.qualifiedEntityTypeNameTranscriber = qualifiedEntityTypeNameTranscriber; + this.entityCastOptionsTranscriber = entityCastOptionsTranscriber; + this.metadataTranscriber = metadataTranscriber; + this.metadataOptionsTranscriber = metadataOptionsTranscriber; + this.contextTranscriber = contextTranscriber; + this.resourcePathTranscriber = resourcePathTranscriber; + this.queryOptionsTranscriber = queryOptionsTranscriber; + } + + public static OdataRelativeUriTranscriber Default { get; } = new OdataRelativeUriTranscriber( + BatchTranscriber.Default, + QuestionMarkTranscriber.Default, + BatchOptionsTranscriber.Default, + EntityTranscriber.Default, + EntityOptionsTranscriber.Default, + SlashTranscriber.Default, + QualifiedEntityTypeNameTranscriber.Default, + EntityCastOptionsTranscriber.Default, + MetadataTranscriber.Default, + MetadataOptionsTranscriber.Default, + ContextTranscriber.Default, + ResourcePathTranscriber.Default, + QueryOptionsTranscriber.Default); + + public override Void Accept(OdataRelativeUri.BatchOnly node, StringBuilder context) + { + this.batchTranscriber.Transcribe(node.Batch, context); + return default; + } + + public override Void Accept(OdataRelativeUri.BatchWithOptions node, StringBuilder context) + { + this.batchTranscriber.Transcribe(node.Batch, context); + this.questionMarkTranscriber.Transcribe(node.QuestionMark, context); + this.batchOptionsTranscriber.Visit(node.BatchOptions, context); + return default; + } + + public override Void Accept(OdataRelativeUri.EntityWithOptions node, StringBuilder context) + { + this.entityTranscriber.Transcribe(node.Entity, context); + this.questionMarkTranscriber.Transcribe(node.QuestionMark, context); + this.entityOptionsTranscriber.Visit(node.EntityOptions, context); + return default; + } + + public override Void Accept(OdataRelativeUri.EntityWithCast node, StringBuilder context) + { + this.entityTranscriber.Transcribe(node.Entity, context); + this.slashTranscriber.Transcribe(node.Slash, context); + this.qualifiedEntityTypeNameTranscriber.Visit(node.QualifiedEntityTypeName, context); + this.questionMarkTranscriber.Transcribe(node.QuestionMark, context); + this.entityCastOptionsTranscriber.Visit(node.EntityCastOptions, context); + return default; + } + + public override Void Accept(OdataRelativeUri.MetadataOnly node, StringBuilder context) + { + this.metadataTranscriber.Transcribe(node.Metadata, context); + return default; + } + + public override Void Accept(OdataRelativeUri.MetadataWithOptions node, StringBuilder context) + { + this.metadataTranscriber.Transcribe(node.Metadata, context); + this.questionMarkTranscriber.Transcribe(node.QuestionMark, context); + this.metadataOptionsTranscriber.Visit(node.MetadataOptions, context); + return default; + } + + public override Void Accept(OdataRelativeUri.MetadataWithContext node, StringBuilder context) + { + this.metadataTranscriber.Transcribe(node.Metadata, context); + this.contextTranscriber.Visit(node.Context, context); + return default; + } + + public override Void Accept(OdataRelativeUri.MetadataWithOptionsAndContext node, StringBuilder context) + { + this.metadataTranscriber.Transcribe(node.Metadata, context); + this.questionMarkTranscriber.Transcribe(node.QuestionMark, context); + this.metadataOptionsTranscriber.Visit(node.MetadataOptions, context); + this.contextTranscriber.Visit(node.Context, context); + return default; + } + + public override Void Accept(OdataRelativeUri.ResourcePathOnly node, StringBuilder context) + { + this.resourcePathTranscriber.Visit(node.ResourcePath, context); + return default; + } + + public override Void Accept(OdataRelativeUri.ResourcePathWithQueryOptions node, StringBuilder context) + { + this.resourcePathTranscriber.Visit(node.ResourcePath, context); + this.questionMarkTranscriber.Transcribe(node.QuestionMark, context); + this.queryOptionsTranscriber.Visit(node.QueryOptions, context); + return default; + } + } +} diff --git a/odata/Root/OdataResourcePath/Transcribers/QualifiedEntityTypeNameTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/QualifiedEntityTypeNameTranscriber.cs new file mode 100644 index 0000000000..781b50da0c --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/QualifiedEntityTypeNameTranscriber.cs @@ -0,0 +1,15 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class QualifiedEntityTypeNameTranscriber : QualifiedEntityTypeName.Visitor + { + private QualifiedEntityTypeNameTranscriber() + { + } + + public static QualifiedEntityTypeNameTranscriber Default { get; } = new QualifiedEntityTypeNameTranscriber(); + } +} diff --git a/odata/Root/OdataResourcePath/Transcribers/QueryOptionsTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/QueryOptionsTranscriber.cs new file mode 100644 index 0000000000..09d6446b82 --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/QueryOptionsTranscriber.cs @@ -0,0 +1,15 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class QueryOptionsTranscriber : QueryOptions.Visitor + { + private QueryOptionsTranscriber() + { + } + + public static QueryOptionsTranscriber Default { get; } = new QueryOptionsTranscriber(); + } +} diff --git a/odata/Root/OdataResourcePath/Transcribers/QuestionMarkTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/QuestionMarkTranscriber.cs new file mode 100644 index 0000000000..c0eff9e41b --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/QuestionMarkTranscriber.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class QuestionMarkTranscriber + { + private QuestionMarkTranscriber() + { + } + + public static QuestionMarkTranscriber Default { get; } = new QuestionMarkTranscriber(); + + public void Transcribe(QuestionMark node, StringBuilder context) + { + context.Append('?'); + } + } +} diff --git a/odata/Root/OdataResourcePath/Transcribers/ResourcePathTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/ResourcePathTranscriber.cs new file mode 100644 index 0000000000..1a06c428e4 --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/ResourcePathTranscriber.cs @@ -0,0 +1,15 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class ResourcePathTranscriber : ResourcePath.Visitor + { + private ResourcePathTranscriber() + { + } + + public static ResourcePathTranscriber Default { get; } = new ResourcePathTranscriber(); + } +} diff --git a/odata/Root/OdataResourcePath/Transcribers/SlashTranscriber.cs b/odata/Root/OdataResourcePath/Transcribers/SlashTranscriber.cs new file mode 100644 index 0000000000..ffc623296b --- /dev/null +++ b/odata/Root/OdataResourcePath/Transcribers/SlashTranscriber.cs @@ -0,0 +1,20 @@ +namespace Root.OdataResourcePath.Transcribers +{ + using System.Text; + + using Root.OdataResourcePath.ConcreteSyntaxTreeNodes; + + public sealed class SlashTranscriber + { + private SlashTranscriber() + { + } + + public static SlashTranscriber Default { get; } = new SlashTranscriber(); + + public void Transcribe(Slash node, StringBuilder context) + { + context.Append("/"); + } + } +} diff --git a/odata/Root/Parser.cs b/odata/Root/Parser.cs new file mode 100644 index 0000000000..766e816b4a --- /dev/null +++ b/odata/Root/Parser.cs @@ -0,0 +1,16 @@ +namespace Root +{ + using Sprache; + using System.Linq; + + /// + /// TODO put this in the right folder and namespace + /// + public static class Parser + { + public static Parser None(string errorMessage) + { + return input => Result.Failure(input, errorMessage, Enumerable.Empty()); + } + } +} diff --git a/odata/Root/Void.cs b/odata/Root/Void.cs new file mode 100644 index 0000000000..b0aab22aa1 --- /dev/null +++ b/odata/Root/Void.cs @@ -0,0 +1,9 @@ +namespace Root +{ + /// + /// TODO put this in the right folder and namespace + /// + public struct Void + { + } +} diff --git a/odata/odata.csproj b/odata/odata.csproj new file mode 100644 index 0000000000..696bb9aa6b --- /dev/null +++ b/odata/odata.csproj @@ -0,0 +1,17 @@ + + + + net9.0 + enable + + + + + + + + + + + + From 82fce04ee50401a004c5207415716a44627dca2a Mon Sep 17 00:00:00 2001 From: Garrett DeBruin <16618938+corranrogue9@users.noreply.github.com> Date: Wed, 4 Dec 2024 09:36:03 -0800 Subject: [PATCH 02/71] Update 0_architecture.md --- docs/0_architecture.md | 71 +++++------------------------------------- 1 file changed, 7 insertions(+), 64 deletions(-) diff --git a/docs/0_architecture.md b/docs/0_architecture.md index 562e463d36..ee5a819326 100644 --- a/docs/0_architecture.md +++ b/docs/0_architecture.md @@ -216,8 +216,6 @@ For these reasons (and many others), I think it's best for now to simply underst ### data flow -https://mermaid.js.org/syntax/sequenceDiagram.html - ```mermaid --- title: request flow @@ -279,6 +277,8 @@ Notice that in each case, the request and response types are the same for both t 2. Because the HTTP portion is not strictly necessary for processing a request, it means that odata services can be easily composed at this layer. If an odata_request is sent by a client using the same type that it is processed by the service, then it means that additional odata services can themselves be treated as "data stores". More on this [later](#a-common-abstraction-for-handling-a-request). 3. These types can be shared by consumers of the odata libraries, but currently they are not. To see the impact of this sharing, let's dive into the mechanics of each translation of the data: +(NOTE: whenever a CST is reference below, it is not necessarily being exposed to customers or something that customers are expected to use). + #### user defined types to odata request ```mermaid @@ -481,65 +481,8 @@ Clearly, there's still a lot of infrastructure to flesh out, and a lot of implem ## follow-ups 1. dive into all of the interfaces+datatypes for request handling, parsing, transcribing, translating, etc. -2. being able to stream payloads -3. handling serialization of customer-defined types -4. CSDL defined authz -5. custom headers, query options, endpoints, etc. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +2. there must be an analog to the existing "syntactic AST" +3. being able to stream payloads +4. handling serialization of customer-defined types +5. CSDL defined authz +6. custom headers, query options, endpoints, etc. From c296918dec6a94ce6e51a7b0db691f4d5ea7ba68 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 10:00:16 -0800 Subject: [PATCH 03/71] asdf --- odata/AbnfParser/CstNodes/RuleList.cs | 22 +++++++++++++++++++ .../SyntacticCstNodes/contextfree.abnf | 14 ++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 odata/AbnfParser/CstNodes/RuleList.cs diff --git a/odata/AbnfParser/CstNodes/RuleList.cs b/odata/AbnfParser/CstNodes/RuleList.cs new file mode 100644 index 0000000000..8759504907 --- /dev/null +++ b/odata/AbnfParser/CstNodes/RuleList.cs @@ -0,0 +1,22 @@ +namespace AbnfParser.CstNodes +{ + using System.Collections.Generic; + + public sealed class RuleList + { + public RuleList(IEnumerable inners) + { + //// TODO assert one or more elements + Inners = inners; + } + + public IEnumerable Inners { get; } + + public abstract class Inner + { + private Inner() + { + } + } + } +} diff --git a/odata/Root/OdataResourcePath/SyntacticCstNodes/contextfree.abnf b/odata/Root/OdataResourcePath/SyntacticCstNodes/contextfree.abnf index e92bde4d0f..0334a6cff0 100644 --- a/odata/Root/OdataResourcePath/SyntacticCstNodes/contextfree.abnf +++ b/odata/Root/OdataResourcePath/SyntacticCstNodes/contextfree.abnf @@ -1,3 +1,17 @@ + + +; TODO TODO TODO TODO TODO TODO TODO TODO +; "evaluate" the ABNF to show where expression sequences are allowed by multiple paths through the ABNF; these are the "ambiguities" +; use literals and odataIdentifier as "terminal" and re-evaluate if there are other teminals that are needed (keyPathLiteral for example seems likely) +; +; how do you want to distinguish between things like odataIdentifier and keyPathLiteral? you could +; 1. treat them both as "identifier" or something +; 2. distinguish them as individual things (but this might lead to cases where a keyPathLiteral is labeled as an odataIdentifier) +; 3. have a DU that says "we *know* this was a keyPathLiteral" and "we *know* this was an odataIdentifier" and "it's possible this was a keyPathLiteral or an odataIdentifier, we can't distinguish" +; TODO TODO TODO TODO TODO TODO TODO TODO + + + odataRelativeUri = '$batch' [ "?" batchOptions ] / '$entity' "?" entityOptions / '$entity' "/" qualifiedTypeName ? entityCastOptions From f5a94ff12c2158082e8578c01c6a2520d8b835a1 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 13:44:46 -0800 Subject: [PATCH 04/71] asdf --- odata/AbnfParser/CstNodes/Cnl.cs | 6 ++++++ odata/AbnfParser/CstNodes/Cwsp.cs | 6 ++++++ odata/AbnfParser/CstNodes/DefinedAs.cs | 9 +++++++++ odata/AbnfParser/CstNodes/Elements.cs | 6 ++++++ odata/AbnfParser/CstNodes/Rule.cs | 18 ++++++++++++++++++ odata/AbnfParser/CstNodes/RuleList.cs | 22 ++++++++++++++++++++++ odata/AbnfParser/CstNodes/RuleName.cs | 6 ++++++ 7 files changed, 73 insertions(+) create mode 100644 odata/AbnfParser/CstNodes/Cnl.cs create mode 100644 odata/AbnfParser/CstNodes/Cwsp.cs create mode 100644 odata/AbnfParser/CstNodes/DefinedAs.cs create mode 100644 odata/AbnfParser/CstNodes/Elements.cs create mode 100644 odata/AbnfParser/CstNodes/Rule.cs create mode 100644 odata/AbnfParser/CstNodes/RuleName.cs diff --git a/odata/AbnfParser/CstNodes/Cnl.cs b/odata/AbnfParser/CstNodes/Cnl.cs new file mode 100644 index 0000000000..fa3328a874 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Cnl.cs @@ -0,0 +1,6 @@ +namespace AbnfParser.CstNodes +{ + public class Cnl + { + } +} diff --git a/odata/AbnfParser/CstNodes/Cwsp.cs b/odata/AbnfParser/CstNodes/Cwsp.cs new file mode 100644 index 0000000000..26ea6a33bd --- /dev/null +++ b/odata/AbnfParser/CstNodes/Cwsp.cs @@ -0,0 +1,6 @@ +namespace AbnfParser.CstNodes +{ + public class Cwsp + { + } +} diff --git a/odata/AbnfParser/CstNodes/DefinedAs.cs b/odata/AbnfParser/CstNodes/DefinedAs.cs new file mode 100644 index 0000000000..ab620a4d6c --- /dev/null +++ b/odata/AbnfParser/CstNodes/DefinedAs.cs @@ -0,0 +1,9 @@ +namespace AbnfParser.CstNodes +{ + public abstract class DefinedAs + { + private DefinedAs() + { + } + } +} diff --git a/odata/AbnfParser/CstNodes/Elements.cs b/odata/AbnfParser/CstNodes/Elements.cs new file mode 100644 index 0000000000..affc34a340 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Elements.cs @@ -0,0 +1,6 @@ +namespace AbnfParser.CstNodes +{ + public sealed class Elements + { + } +} diff --git a/odata/AbnfParser/CstNodes/Rule.cs b/odata/AbnfParser/CstNodes/Rule.cs new file mode 100644 index 0000000000..158327a6f5 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Rule.cs @@ -0,0 +1,18 @@ +namespace AbnfParser.CstNodes +{ + public sealed class Rule + { + public Rule(RuleName ruleName, DefinedAs definedAs, Elements elements, Cnl cnl) + { + RuleName = ruleName; + DefinedAs = definedAs; + Elements = elements; + Cnl = cnl; + } + + public RuleName RuleName { get; } + public DefinedAs DefinedAs { get; } + public Elements Elements { get; } + public Cnl Cnl { get; } + } +} diff --git a/odata/AbnfParser/CstNodes/RuleList.cs b/odata/AbnfParser/CstNodes/RuleList.cs index 8759504907..2b5cf406a9 100644 --- a/odata/AbnfParser/CstNodes/RuleList.cs +++ b/odata/AbnfParser/CstNodes/RuleList.cs @@ -17,6 +17,28 @@ public abstract class Inner private Inner() { } + + public sealed class RuleInner : Inner + { + public RuleInner(Rule rule) + { + Rule = rule; + } + + public Rule Rule { get; } + } + + public sealed class CommentInner : Inner + { + public CommentInner(IEnumerable cwsps, Cnl cnl) + { + Cwsps = cwsps; + Cnl = cnl; + } + + public IEnumerable Cwsps { get; } + public Cnl Cnl { get; } + } } } } diff --git a/odata/AbnfParser/CstNodes/RuleName.cs b/odata/AbnfParser/CstNodes/RuleName.cs new file mode 100644 index 0000000000..0bb81b9bb0 --- /dev/null +++ b/odata/AbnfParser/CstNodes/RuleName.cs @@ -0,0 +1,6 @@ +namespace AbnfParser.CstNodes +{ + public sealed class RuleName + { + } +} From 9388b242ed7d81c0005709116b0f50bcdc7e318d Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 14:08:56 -0800 Subject: [PATCH 05/71] asdf --- odata/AbnfParser/CstNodes/Core/Alpha.cs | 269 +++++++++++++ odata/AbnfParser/CstNodes/Core/Char.cs | 494 ++++++++++++++++++++++++ odata/AbnfParser/CstNodes/Dash.cs | 12 + odata/AbnfParser/CstNodes/Digit.cs | 12 + odata/AbnfParser/CstNodes/RuleList.cs | 3 + odata/AbnfParser/CstNodes/RuleName.cs | 50 ++- 6 files changed, 839 insertions(+), 1 deletion(-) create mode 100644 odata/AbnfParser/CstNodes/Core/Alpha.cs create mode 100644 odata/AbnfParser/CstNodes/Core/Char.cs create mode 100644 odata/AbnfParser/CstNodes/Dash.cs create mode 100644 odata/AbnfParser/CstNodes/Digit.cs diff --git a/odata/AbnfParser/CstNodes/Core/Alpha.cs b/odata/AbnfParser/CstNodes/Core/Alpha.cs new file mode 100644 index 0000000000..dce01f2e82 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Core/Alpha.cs @@ -0,0 +1,269 @@ +namespace AbnfParser.CstNodes.Core +{ + public abstract class Alpha + { + private Alpha() + { + } + + public sealed class x41 : Alpha + { + public x41(AbnfParser.CstNodes.Core.x41 value) + { + Value = value; + } + + public Core.x41 Value { get; } + } + + public sealed class x42 : Alpha + { + public x42(AbnfParser.CstNodes.Core.x42 value) + { + Value = value; + } + + public Core.x42 Value { get; } + } + + public sealed class x43 : Alpha + { + public x43(AbnfParser.CstNodes.Core.x43 value) + { + Value = value; + } + + public Core.x43 Value { get; } + } + + public sealed class x44 : Alpha + { + public x44(AbnfParser.CstNodes.Core.x44 value) + { + Value = value; + } + + public Core.x44 Value { get; } + } + + public sealed class x45 : Alpha + { + public x45(AbnfParser.CstNodes.Core.x45 value) + { + Value = value; + } + + public Core.x45 Value { get; } + } + + public sealed class x46 : Alpha + { + public x46(AbnfParser.CstNodes.Core.x46 value) + { + Value = value; + } + + public Core.x46 Value { get; } + } + + public sealed class x47 : Alpha + { + public x47(AbnfParser.CstNodes.Core.x47 value) + { + Value = value; + } + + public Core.x47 Value { get; } + } + + public sealed class x48 : Alpha + { + public x48(AbnfParser.CstNodes.Core.x48 value) + { + Value = value; + } + + public Core.x48 Value { get; } + } + + public sealed class x49 : Alpha + { + public x49(AbnfParser.CstNodes.Core.x49 value) + { + Value = value; + } + + public Core.x49 Value { get; } + } + + public sealed class x4A : Alpha + { + public x4A(AbnfParser.CstNodes.Core.x4A value) + { + Value = value; + } + + public Core.x4A Value { get; } + } + + public sealed class x4B : Alpha + { + public x4B(AbnfParser.CstNodes.Core.x4B value) + { + Value = value; + } + + public Core.x4B Value { get; } + } + + public sealed class x4C : Alpha + { + public x4C(AbnfParser.CstNodes.Core.x4C value) + { + Value = value; + } + + public Core.x4C Value { get; } + } + + public sealed class x4D : Alpha + { + public x4D(AbnfParser.CstNodes.Core.x4D value) + { + Value = value; + } + + public Core.x4D Value { get; } + } + + public sealed class x4E : Alpha + { + public x4E(AbnfParser.CstNodes.Core.x4E value) + { + Value = value; + } + + public Core.x4E Value { get; } + } + + public sealed class x4F : Alpha + { + public x4F(AbnfParser.CstNodes.Core.x4F value) + { + Value = value; + } + + public Core.x4F Value { get; } + } + + public sealed class x50 : Alpha + { + public x50(AbnfParser.CstNodes.Core.x50 value) + { + Value = value; + } + + public Core.x50 Value { get; } + } + + public sealed class x51 : Alpha + { + public x51(AbnfParser.CstNodes.Core.x51 value) + { + Value = value; + } + + public Core.x51 Value { get; } + } + + public sealed class x52 : Alpha + { + public x52(AbnfParser.CstNodes.Core.x52 value) + { + Value = value; + } + + public Core.x52 Value { get; } + } + + public sealed class x53 : Alpha + { + public x53(AbnfParser.CstNodes.Core.x53 value) + { + Value = value; + } + + public Core.x53 Value { get; } + } + + public sealed class x54 : Alpha + { + public x54(AbnfParser.CstNodes.Core.x54 value) + { + Value = value; + } + + public Core.x54 Value { get; } + } + + public sealed class x55 : Alpha + { + public x55(AbnfParser.CstNodes.Core.x55 value) + { + Value = value; + } + + public Core.x55 Value { get; } + } + + public sealed class x56 : Alpha + { + public x56(AbnfParser.CstNodes.Core.x56 value) + { + Value = value; + } + + public Core.x56 Value { get; } + } + + public sealed class x57 : Alpha + { + public x57(AbnfParser.CstNodes.Core.x57 value) + { + Value = value; + } + + public Core.x57 Value { get; } + } + + public sealed class x58 : Alpha + { + public x58(AbnfParser.CstNodes.Core.x58 value) + { + Value = value; + } + + public Core.x58 Value { get; } + } + + public sealed class x59 : Alpha + { + public x59(AbnfParser.CstNodes.Core.x59 value) + { + Value = value; + } + + public Core.x59 Value { get; } + } + + public sealed class x5A : Alpha + { + public x5A(AbnfParser.CstNodes.Core.x5A value) + { + Value = value; + } + + public Core.x5A Value { get; } + } + } +} diff --git a/odata/AbnfParser/CstNodes/Core/Char.cs b/odata/AbnfParser/CstNodes/Core/Char.cs new file mode 100644 index 0000000000..f266b6f1ae --- /dev/null +++ b/odata/AbnfParser/CstNodes/Core/Char.cs @@ -0,0 +1,494 @@ +namespace AbnfParser.CstNodes.Core +{ + //// TODO do other core rules + + public abstract class Char + { + private Char() + { + } + } + + public sealed class x01 + { + private x01() + { + } + + public static x01 Instance { get; } = new x01(); + } + + //// TODO fill in the rest + + public sealed class x41 + { + private x41() + { + } + + public static x41 Instance { get; } = new x41(); + } + + public sealed class x42 + { + private x42() + { + } + + public static x42 Instance { get; } = new x42(); + } + + public sealed class x43 + { + private x43() + { + } + + public static x43 Instance { get; } = new x43(); + } + + public sealed class x44 + { + private x44() + { + } + + public static x44 Instance { get; } = new x44(); + } + + public sealed class x45 + { + private x45() + { + } + + public static x45 Instance { get; } = new x45(); + } + + public sealed class x46 + { + private x46() + { + } + + public static x46 Instance { get; } = new x46(); + } + + public sealed class x47 + { + private x47() + { + } + + public static x47 Instance { get; } = new x47(); + } + + public sealed class x48 + { + private x48() + { + } + + public static x48 Instance { get; } = new x48(); + } + + public sealed class x49 + { + private x49() + { + } + + public static x49 Instance { get; } = new x49(); + } + + public sealed class x4A + { + private x4A() + { + } + + public static x4A Instance { get; } = new x4A(); + } + + public sealed class x4B + { + private x4B() + { + } + + public static x4B Instance { get; } = new x4B(); + } + + public sealed class x4C + { + private x4C() + { + } + + public static x4C Instance { get; } = new x4C(); + } + + public sealed class x4D + { + private x4D() + { + } + + public static x4D Instance { get; } = new x4D(); + } + + public sealed class x4E + { + private x4E() + { + } + + public static x4E Instance { get; } = new x4E(); + } + + public sealed class x4F + { + private x4F() + { + } + + public static x4F Instance { get; } = new x4F(); + } + + public sealed class x50 + { + private x50() + { + } + + public static x50 Instance { get; } = new x50(); + } + + public sealed class x51 + { + private x51() + { + } + + public static x51 Instance { get; } = new x51(); + } + + public sealed class x52 + { + private x52() + { + } + + public static x52 Instance { get; } = new x52(); + } + + public sealed class x53 + { + private x53() + { + } + + public static x53 Instance { get; } = new x53(); + } + + public sealed class x54 + { + private x54() + { + } + + public static x54 Instance { get; } = new x54(); + } + + public sealed class x55 + { + private x55() + { + } + + public static x55 Instance { get; } = new x55(); + } + + public sealed class x56 + { + private x56() + { + } + + public static x56 Instance { get; } = new x56(); + } + + public sealed class x57 + { + private x57() + { + } + + public static x57 Instance { get; } = new x57(); + } + + public sealed class x58 + { + private x58() + { + } + + public static x58 Instance { get; } = new x58(); + } + + public sealed class x59 + { + private x59() + { + } + + public static x59 Instance { get; } = new x59(); + } + + public sealed class x5A + { + private x5A() + { + } + + public static x5A Instance { get; } = new x5A(); + } + + //// TODO fill in the rest + + public sealed class x61 + { + private x61() + { + } + + public static x61 Instance { get; } = new x61(); + } + + public sealed class x62 + { + private x62() + { + } + + public static x62 Instance { get; } = new x62(); + } + + public sealed class x63 + { + private x63() + { + } + + public static x63 Instance { get; } = new x63(); + } + + public sealed class x64 + { + private x64() + { + } + + public static x64 Instance { get; } = new x64(); + } + + public sealed class x65 + { + private x65() + { + } + + public static x65 Instance { get; } = new x65(); + } + + public sealed class x66 + { + private x66() + { + } + + public static x66 Instance { get; } = new x66(); + } + + public sealed class x67 + { + private x67() + { + } + + public static x67 Instance { get; } = new x67(); + } + + public sealed class x68 + { + private x68() + { + } + + public static x68 Instance { get; } = new x68(); + } + + public sealed class x69 + { + private x69() + { + } + + public static x69 Instance { get; } = new x69(); + } + + public sealed class x6A + { + private x6A() + { + } + + public static x6A Instance { get; } = new x6A(); + } + + public sealed class x6B + { + private x6B() + { + } + + public static x6B Instance { get; } = new x6B(); + } + + public sealed class x6C + { + private x6C() + { + } + + public static x6C Instance { get; } = new x6C(); + } + + public sealed class x6D + { + private x6D() + { + } + + public static x6D Instance { get; } = new x6D(); + } + + public sealed class x6E + { + private x6E() + { + } + + public static x6E Instance { get; } = new x6E(); + } + + public sealed class x6F + { + private x6F() + { + } + + public static x6F Instance { get; } = new x6F(); + } + + public sealed class x70 + { + private x70() + { + } + + public static x70 Instance { get; } = new x70(); + } + + public sealed class x71 + { + private x71() + { + } + + public static x71 Instance { get; } = new x71(); + } + + public sealed class x72 + { + private x72() + { + } + + public static x72 Instance { get; } = new x72(); + } + + public sealed class x73 + { + private x73() + { + } + + public static x73 Instance { get; } = new x73(); + } + + public sealed class x74 + { + private x74() + { + } + + public static x74 Instance { get; } = new x74(); + } + + public sealed class x75 + { + private x75() + { + } + + public static x75 Instance { get; } = new x75(); + } + + public sealed class x76 + { + private x76() + { + } + + public static x76 Instance { get; } = new x76(); + } + + public sealed class x77 + { + private x77() + { + } + + public static x77 Instance { get; } = new x77(); + } + + public sealed class x78 + { + private x78() + { + } + + public static x78 Instance { get; } = new x78(); + } + + public sealed class x79 + { + private x79() + { + } + + public static x79 Instance { get; } = new x79(); + } + + public sealed class x7A + { + private x7A() + { + } + + public static x7A Instance { get; } = new x7A(); + } + + //// TODO fill in the rest +} diff --git a/odata/AbnfParser/CstNodes/Dash.cs b/odata/AbnfParser/CstNodes/Dash.cs new file mode 100644 index 0000000000..88b1c960d7 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Dash.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbnfParser.CstNodes +{ + internal class Dash + { + } +} diff --git a/odata/AbnfParser/CstNodes/Digit.cs b/odata/AbnfParser/CstNodes/Digit.cs new file mode 100644 index 0000000000..91f285ded0 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Digit.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbnfParser.CstNodes +{ + internal class Digit + { + } +} diff --git a/odata/AbnfParser/CstNodes/RuleList.cs b/odata/AbnfParser/CstNodes/RuleList.cs index 2b5cf406a9..dbaefea6e8 100644 --- a/odata/AbnfParser/CstNodes/RuleList.cs +++ b/odata/AbnfParser/CstNodes/RuleList.cs @@ -2,6 +2,9 @@ { using System.Collections.Generic; + /// + /// https://www.rfc-editor.org/rfc/rfc5234 + /// public sealed class RuleList { public RuleList(IEnumerable inners) diff --git a/odata/AbnfParser/CstNodes/RuleName.cs b/odata/AbnfParser/CstNodes/RuleName.cs index 0bb81b9bb0..1083ea50b1 100644 --- a/odata/AbnfParser/CstNodes/RuleName.cs +++ b/odata/AbnfParser/CstNodes/RuleName.cs @@ -1,6 +1,54 @@ -namespace AbnfParser.CstNodes +using AbnfParser.CstNodes.Core; +using System.Collections.Generic; + +namespace AbnfParser.CstNodes { public sealed class RuleName { + public RuleName(Alpha alpha, IEnumerable inners) + { + Alpha = alpha; + Inners = inners; + } + + public Alpha Alpha { get; } + public IEnumerable Inners { get; } + + public abstract class Inner + { + private Inner() + { + } + + public sealed class AlphaInner : Inner + { + public AlphaInner(Alpha alpha) + { + Alpha = alpha; + } + + public Alpha Alpha { get; } + } + + public sealed class DigitInner : Inner + { + public DigitInner(Digit digit) + { + Digit = digit; + } + + public Digit Digit { get; } + } + + public sealed class DashInner : Inner + { + public DashInner(Dash dash) + { + Dash = dash; + } + + public Dash Dash { get; } + } + } } } From cc54a816df338461fed480231f1e8eb8142b46c6 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 14:10:02 -0800 Subject: [PATCH 06/71] asdf --- odata/AbnfParser/CstNodes/Core/Alpha.cs | 260 ++++++++++++++++++++++++ 1 file changed, 260 insertions(+) diff --git a/odata/AbnfParser/CstNodes/Core/Alpha.cs b/odata/AbnfParser/CstNodes/Core/Alpha.cs index dce01f2e82..55a6434303 100644 --- a/odata/AbnfParser/CstNodes/Core/Alpha.cs +++ b/odata/AbnfParser/CstNodes/Core/Alpha.cs @@ -265,5 +265,265 @@ public x5A(AbnfParser.CstNodes.Core.x5A value) public Core.x5A Value { get; } } + + public sealed class x61 : Alpha + { + public x61(AbnfParser.CstNodes.Core.x61 value) + { + Value = value; + } + + public Core.x61 Value { get; } + } + + public sealed class x62 : Alpha + { + public x62(AbnfParser.CstNodes.Core.x62 value) + { + Value = value; + } + + public Core.x62 Value { get; } + } + + public sealed class x63 : Alpha + { + public x63(AbnfParser.CstNodes.Core.x63 value) + { + Value = value; + } + + public Core.x63 Value { get; } + } + + public sealed class x64 : Alpha + { + public x64(AbnfParser.CstNodes.Core.x64 value) + { + Value = value; + } + + public Core.x64 Value { get; } + } + + public sealed class x65 : Alpha + { + public x65(AbnfParser.CstNodes.Core.x65 value) + { + Value = value; + } + + public Core.x65 Value { get; } + } + + public sealed class x66 : Alpha + { + public x66(AbnfParser.CstNodes.Core.x66 value) + { + Value = value; + } + + public Core.x66 Value { get; } + } + + public sealed class x67 : Alpha + { + public x67(AbnfParser.CstNodes.Core.x67 value) + { + Value = value; + } + + public Core.x67 Value { get; } + } + + public sealed class x68 : Alpha + { + public x68(AbnfParser.CstNodes.Core.x68 value) + { + Value = value; + } + + public Core.x68 Value { get; } + } + + public sealed class x69 : Alpha + { + public x69(AbnfParser.CstNodes.Core.x69 value) + { + Value = value; + } + + public Core.x69 Value { get; } + } + + public sealed class x6A : Alpha + { + public x6A(AbnfParser.CstNodes.Core.x6A value) + { + Value = value; + } + + public Core.x6A Value { get; } + } + + public sealed class x6B : Alpha + { + public x6B(AbnfParser.CstNodes.Core.x6B value) + { + Value = value; + } + + public Core.x6B Value { get; } + } + + public sealed class x6C : Alpha + { + public x6C(AbnfParser.CstNodes.Core.x6C value) + { + Value = value; + } + + public Core.x6C Value { get; } + } + + public sealed class x6D : Alpha + { + public x6D(AbnfParser.CstNodes.Core.x6D value) + { + Value = value; + } + + public Core.x6D Value { get; } + } + + public sealed class x6E : Alpha + { + public x6E(AbnfParser.CstNodes.Core.x6E value) + { + Value = value; + } + + public Core.x6E Value { get; } + } + + public sealed class x6F : Alpha + { + public x6F(AbnfParser.CstNodes.Core.x6F value) + { + Value = value; + } + + public Core.x6F Value { get; } + } + + public sealed class x70 : Alpha + { + public x70(AbnfParser.CstNodes.Core.x70 value) + { + Value = value; + } + + public Core.x70 Value { get; } + } + + public sealed class x71 : Alpha + { + public x71(AbnfParser.CstNodes.Core.x71 value) + { + Value = value; + } + + public Core.x71 Value { get; } + } + + public sealed class x72 : Alpha + { + public x72(AbnfParser.CstNodes.Core.x72 value) + { + Value = value; + } + + public Core.x72 Value { get; } + } + + public sealed class x73 : Alpha + { + public x73(AbnfParser.CstNodes.Core.x73 value) + { + Value = value; + } + + public Core.x73 Value { get; } + } + + public sealed class x74 : Alpha + { + public x74(AbnfParser.CstNodes.Core.x74 value) + { + Value = value; + } + + public Core.x74 Value { get; } + } + + public sealed class x75 : Alpha + { + public x75(AbnfParser.CstNodes.Core.x75 value) + { + Value = value; + } + + public Core.x75 Value { get; } + } + + public sealed class x76 : Alpha + { + public x76(AbnfParser.CstNodes.Core.x76 value) + { + Value = value; + } + + public Core.x76 Value { get; } + } + + public sealed class x77 : Alpha + { + public x77(AbnfParser.CstNodes.Core.x77 value) + { + Value = value; + } + + public Core.x77 Value { get; } + } + + public sealed class x78 : Alpha + { + public x78(AbnfParser.CstNodes.Core.x78 value) + { + Value = value; + } + + public Core.x78 Value { get; } + } + + public sealed class x79 : Alpha + { + public x79(AbnfParser.CstNodes.Core.x79 value) + { + Value = value; + } + + public Core.x79 Value { get; } + } + + public sealed class x7A : Alpha + { + public x7A(AbnfParser.CstNodes.Core.x7A value) + { + Value = value; + } + + public Core.x7A Value { get; } + } } } From 9d1756a51a7336a54b1ed6ac9394416a46372535 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 14:23:08 -0800 Subject: [PATCH 07/71] asdf --- odata/AbnfParser/CstNodes/Core/Char.cs | 125 ++++++++++++++++++++++++ odata/AbnfParser/CstNodes/Core/Digit.cs | 109 +++++++++++++++++++++ odata/AbnfParser/CstNodes/Dash.cs | 12 --- odata/AbnfParser/CstNodes/DefinedAs.cs | 34 +++++++ odata/AbnfParser/CstNodes/Digit.cs | 12 --- odata/AbnfParser/CstNodes/RuleName.cs | 4 +- 6 files changed, 270 insertions(+), 26 deletions(-) create mode 100644 odata/AbnfParser/CstNodes/Core/Digit.cs delete mode 100644 odata/AbnfParser/CstNodes/Dash.cs delete mode 100644 odata/AbnfParser/CstNodes/Digit.cs diff --git a/odata/AbnfParser/CstNodes/Core/Char.cs b/odata/AbnfParser/CstNodes/Core/Char.cs index f266b6f1ae..27f5d682fe 100644 --- a/odata/AbnfParser/CstNodes/Core/Char.cs +++ b/odata/AbnfParser/CstNodes/Core/Char.cs @@ -20,6 +20,131 @@ private x01() //// TODO fill in the rest + public sealed class x2D + { + private x2D() + { + } + + public static x2D Instance { get; } = new x2D(); + } + + //// TODO fill in the rest + + public sealed class x2F + { + private x2F() + { + } + + public static x2F Instance { get; } = new x2F(); + } + + //// TODO fill in the rest + + public sealed class x30 + { + private x30() + { + } + + public static x30 Instance { get; } = new x30(); + } + + public sealed class x31 + { + private x31() + { + } + + public static x31 Instance { get; } = new x31(); + } + + public sealed class x32 + { + private x32() + { + } + + public static x32 Instance { get; } = new x32(); + } + + public sealed class x33 + { + private x33() + { + } + + public static x33 Instance { get; } = new x33(); + } + + public sealed class x34 + { + private x34() + { + } + + public static x34 Instance { get; } = new x34(); + } + + public sealed class x35 + { + private x35() + { + } + + public static x35 Instance { get; } = new x35(); + } + + public sealed class x36 + { + private x36() + { + } + + public static x36 Instance { get; } = new x36(); + } + + public sealed class x37 + { + private x37() + { + } + + public static x37 Instance { get; } = new x37(); + } + + public sealed class x38 + { + private x38() + { + } + + public static x38 Instance { get; } = new x38(); + } + + public sealed class x39 + { + private x39() + { + } + + public static x39 Instance { get; } = new x39(); + } + + //// TODO fill in the rest + + public sealed class x3D + { + private x3D() + { + } + + public static x3D Instance { get; } = new x3D(); + } + + //// TODO fill in the rest + public sealed class x41 { private x41() diff --git a/odata/AbnfParser/CstNodes/Core/Digit.cs b/odata/AbnfParser/CstNodes/Core/Digit.cs new file mode 100644 index 0000000000..ab3204ad24 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Core/Digit.cs @@ -0,0 +1,109 @@ +namespace AbnfParser.CstNodes.Core +{ + public abstract class Digit + { + private Digit() + { + } + + public sealed class x30 : Digit + { + public x30(Core.x30 value) + { + Value = value; + } + + public Core.x30 Value { get; } + } + + public sealed class x31 : Digit + { + public x31(Core.x31 value) + { + Value = value; + } + + public Core.x31 Value { get; } + } + + public sealed class x32 : Digit + { + public x32(Core.x32 value) + { + Value = value; + } + + public Core.x32 Value { get; } + } + + public sealed class x33 : Digit + { + public x33(Core.x33 value) + { + Value = value; + } + + public Core.x33 Value { get; } + } + + public sealed class x34 : Digit + { + public x34(Core.x34 value) + { + Value = value; + } + + public Core.x34 Value { get; } + } + + public sealed class x35 : Digit + { + public x35(Core.x35 value) + { + Value = value; + } + + public Core.x35 Value { get; } + } + + public sealed class x36 : Digit + { + public x36(Core.x36 value) + { + Value = value; + } + + public Core.x36 Value { get; } + } + + public sealed class x37 : Digit + { + public x37(Core.x37 value) + { + Value = value; + } + + public Core.x37 Value { get; } + } + + public sealed class x38 : Digit + { + public x38(Core.x38 value) + { + Value = value; + } + + public Core.x38 Value { get; } + } + + public sealed class x39 : Digit + { + public x39(Core.x39 value) + { + Value = value; + } + + public Core.x39 Value { get; } + } + } +} diff --git a/odata/AbnfParser/CstNodes/Dash.cs b/odata/AbnfParser/CstNodes/Dash.cs deleted file mode 100644 index 88b1c960d7..0000000000 --- a/odata/AbnfParser/CstNodes/Dash.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace AbnfParser.CstNodes -{ - internal class Dash - { - } -} diff --git a/odata/AbnfParser/CstNodes/DefinedAs.cs b/odata/AbnfParser/CstNodes/DefinedAs.cs index ab620a4d6c..8204f2040d 100644 --- a/odata/AbnfParser/CstNodes/DefinedAs.cs +++ b/odata/AbnfParser/CstNodes/DefinedAs.cs @@ -1,9 +1,43 @@ namespace AbnfParser.CstNodes { + using System.Collections.Generic; + + using AbnfParser.CstNodes.Core; + public abstract class DefinedAs { private DefinedAs() { } + + public sealed class Declaration : DefinedAs + { + public Declaration(IEnumerable prefixCwsps, x3D equals, IEnumerable suffixCwsps) + { + PrefixCwsps = prefixCwsps; + Equals = equals; + SuffixCwsps = suffixCwsps; + } + + public IEnumerable PrefixCwsps { get; } + public x3D Equals { get; } + public IEnumerable SuffixCwsps { get; } + } + + public sealed class Incremental : DefinedAs + { + public Incremental(IEnumerable prefixCwsps, x3D equals, x2F slash, IEnumerable suffixCwsps) + { + PrefixCwsps = prefixCwsps; + Equals = equals; + Slash = slash; + SuffixCwsps = suffixCwsps; + } + + public IEnumerable PrefixCwsps { get; } + public x3D Equals { get; } + public x2F Slash { get; } + public IEnumerable SuffixCwsps { get; } + } } } diff --git a/odata/AbnfParser/CstNodes/Digit.cs b/odata/AbnfParser/CstNodes/Digit.cs deleted file mode 100644 index 91f285ded0..0000000000 --- a/odata/AbnfParser/CstNodes/Digit.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace AbnfParser.CstNodes -{ - internal class Digit - { - } -} diff --git a/odata/AbnfParser/CstNodes/RuleName.cs b/odata/AbnfParser/CstNodes/RuleName.cs index 1083ea50b1..1b40048286 100644 --- a/odata/AbnfParser/CstNodes/RuleName.cs +++ b/odata/AbnfParser/CstNodes/RuleName.cs @@ -42,12 +42,12 @@ public DigitInner(Digit digit) public sealed class DashInner : Inner { - public DashInner(Dash dash) + public DashInner(x2D dash) { Dash = dash; } - public Dash Dash { get; } + public x2D Dash { get; } } } } From 557fb489fdfc5c60a2f885710854147a1ff2a333 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 14:30:40 -0800 Subject: [PATCH 08/71] asdf --- odata/AbnfParser/CstNodes/Alternation.cs | 6 +++++ odata/AbnfParser/CstNodes/Core/Char.cs | 22 ++++++++++++++++++ odata/AbnfParser/CstNodes/Core/Htab.cs | 12 ++++++++++ odata/AbnfParser/CstNodes/Core/Sp.cs | 12 ++++++++++ odata/AbnfParser/CstNodes/Core/Wsp.cs | 29 ++++++++++++++++++++++++ odata/AbnfParser/CstNodes/Cwsp.cs | 29 +++++++++++++++++++++++- odata/AbnfParser/CstNodes/Elements.cs | 10 ++++++++ 7 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 odata/AbnfParser/CstNodes/Alternation.cs create mode 100644 odata/AbnfParser/CstNodes/Core/Htab.cs create mode 100644 odata/AbnfParser/CstNodes/Core/Sp.cs create mode 100644 odata/AbnfParser/CstNodes/Core/Wsp.cs diff --git a/odata/AbnfParser/CstNodes/Alternation.cs b/odata/AbnfParser/CstNodes/Alternation.cs new file mode 100644 index 0000000000..9ba0bee58a --- /dev/null +++ b/odata/AbnfParser/CstNodes/Alternation.cs @@ -0,0 +1,6 @@ +namespace AbnfParser.CstNodes +{ + public sealed class Alternation + { + } +} diff --git a/odata/AbnfParser/CstNodes/Core/Char.cs b/odata/AbnfParser/CstNodes/Core/Char.cs index 27f5d682fe..b1ca364be3 100644 --- a/odata/AbnfParser/CstNodes/Core/Char.cs +++ b/odata/AbnfParser/CstNodes/Core/Char.cs @@ -20,6 +20,28 @@ private x01() //// TODO fill in the rest + public sealed class x09 + { + private x09() + { + } + + public static x09 Instance { get; } = new x09(); + } + + //// TODO fill in the rest + + public sealed class x20 + { + private x20() + { + } + + public static x20 Instance { get; } = new x20(); + } + + //// TODO fill in the rest + public sealed class x2D { private x2D() diff --git a/odata/AbnfParser/CstNodes/Core/Htab.cs b/odata/AbnfParser/CstNodes/Core/Htab.cs new file mode 100644 index 0000000000..b62d484610 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Core/Htab.cs @@ -0,0 +1,12 @@ +namespace AbnfParser.CstNodes.Core +{ + public sealed class Htab + { + public Htab(x09 value) + { + Value = value; + } + + public x09 Value { get; } + } +} diff --git a/odata/AbnfParser/CstNodes/Core/Sp.cs b/odata/AbnfParser/CstNodes/Core/Sp.cs new file mode 100644 index 0000000000..99d32eb8a3 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Core/Sp.cs @@ -0,0 +1,12 @@ +namespace AbnfParser.CstNodes.Core +{ + public sealed class Sp + { + public Sp(x20 value) + { + Value = value; + } + + public x20 Value { get; } + } +} diff --git a/odata/AbnfParser/CstNodes/Core/Wsp.cs b/odata/AbnfParser/CstNodes/Core/Wsp.cs new file mode 100644 index 0000000000..98f29f282c --- /dev/null +++ b/odata/AbnfParser/CstNodes/Core/Wsp.cs @@ -0,0 +1,29 @@ +namespace AbnfParser.CstNodes.Core +{ + public abstract class Wsp + { + private Wsp() + { + } + + public sealed class Space : Wsp + { + public Space(Sp sp) + { + Sp = sp; + } + + public Sp Sp { get; } + } + + public sealed class Tab : Wsp + { + public Tab(Htab htab) + { + Htab = htab; + } + + public Htab Htab { get; } + } + } +} diff --git a/odata/AbnfParser/CstNodes/Cwsp.cs b/odata/AbnfParser/CstNodes/Cwsp.cs index 26ea6a33bd..cfe0b6c724 100644 --- a/odata/AbnfParser/CstNodes/Cwsp.cs +++ b/odata/AbnfParser/CstNodes/Cwsp.cs @@ -1,6 +1,33 @@ namespace AbnfParser.CstNodes { - public class Cwsp + using AbnfParser.CstNodes.Core; + + public abstract class Cwsp { + private Cwsp() + { + } + + public sealed class WspOnly : Cwsp + { + public WspOnly(Wsp wsp) + { + Wsp = wsp; + } + + public Wsp Wsp { get; } + } + + public sealed class CnlAndWsp : Cwsp + { + public CnlAndWsp(Cnl cnl, Wsp wsp) + { + Cnl = cnl; + Wsp = wsp; + } + + public Cnl Cnl { get; } + public Wsp Wsp { get; } + } } } diff --git a/odata/AbnfParser/CstNodes/Elements.cs b/odata/AbnfParser/CstNodes/Elements.cs index affc34a340..588a836a78 100644 --- a/odata/AbnfParser/CstNodes/Elements.cs +++ b/odata/AbnfParser/CstNodes/Elements.cs @@ -1,6 +1,16 @@ namespace AbnfParser.CstNodes { + using System.Collections.Generic; + public sealed class Elements { + public Elements(Alternation alternation, IEnumerable cwsps) + { + Alternation = alternation; + Cwsps = cwsps; + } + + public Alternation Alternation { get; } + public IEnumerable Cwsps { get; } } } From 88eaddee16c187b1c6baccb5b8aa1570aa7f3fcb Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 14:35:47 -0800 Subject: [PATCH 09/71] asdf --- odata/AbnfParser/CstNodes/Cnl.cs | 27 +++++++++++++++++++++++++- odata/AbnfParser/CstNodes/Comment.cs | 6 ++++++ odata/AbnfParser/CstNodes/Core/Char.cs | 20 +++++++++++++++++++ odata/AbnfParser/CstNodes/Core/Cr.cs | 12 ++++++++++++ odata/AbnfParser/CstNodes/Core/Crlf.cs | 14 +++++++++++++ odata/AbnfParser/CstNodes/Core/Lf.cs | 12 ++++++++++++ 6 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 odata/AbnfParser/CstNodes/Comment.cs create mode 100644 odata/AbnfParser/CstNodes/Core/Cr.cs create mode 100644 odata/AbnfParser/CstNodes/Core/Crlf.cs create mode 100644 odata/AbnfParser/CstNodes/Core/Lf.cs diff --git a/odata/AbnfParser/CstNodes/Cnl.cs b/odata/AbnfParser/CstNodes/Cnl.cs index fa3328a874..eb09ba3666 100644 --- a/odata/AbnfParser/CstNodes/Cnl.cs +++ b/odata/AbnfParser/CstNodes/Cnl.cs @@ -1,6 +1,31 @@ namespace AbnfParser.CstNodes { - public class Cnl + using AbnfParser.CstNodes.Core; + + public abstract class Cnl { + private Cnl() + { + } + + public sealed class Comment : Cnl + { + public Comment(CstNodes.Comment value) + { + Value = value; + } + + public CstNodes.Comment Value { get; } + } + + public sealed class Newline : Cnl + { + public Newline(Crlf crlf) + { + Crlf = crlf; + } + + public Crlf Crlf { get; } + } } } diff --git a/odata/AbnfParser/CstNodes/Comment.cs b/odata/AbnfParser/CstNodes/Comment.cs new file mode 100644 index 0000000000..99df3607f6 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Comment.cs @@ -0,0 +1,6 @@ +namespace AbnfParser.CstNodes +{ + public sealed class Comment + { + } +} diff --git a/odata/AbnfParser/CstNodes/Core/Char.cs b/odata/AbnfParser/CstNodes/Core/Char.cs index b1ca364be3..3e78d296a1 100644 --- a/odata/AbnfParser/CstNodes/Core/Char.cs +++ b/odata/AbnfParser/CstNodes/Core/Char.cs @@ -29,6 +29,26 @@ private x09() public static x09 Instance { get; } = new x09(); } + public sealed class x0A + { + private x0A() + { + } + + public static x0A Instance { get; } = new x0A(); + } + + //// TODO fill in the rest + + public sealed class x0D + { + private x0D() + { + } + + public static x0D Instance { get; } = new x0D(); + } + //// TODO fill in the rest public sealed class x20 diff --git a/odata/AbnfParser/CstNodes/Core/Cr.cs b/odata/AbnfParser/CstNodes/Core/Cr.cs new file mode 100644 index 0000000000..6f990f22e8 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Core/Cr.cs @@ -0,0 +1,12 @@ +namespace AbnfParser.CstNodes.Core +{ + public sealed class Cr + { + public Cr(x0D x0D) + { + X0D = x0D; + } + + public x0D X0D { get; } + } +} diff --git a/odata/AbnfParser/CstNodes/Core/Crlf.cs b/odata/AbnfParser/CstNodes/Core/Crlf.cs new file mode 100644 index 0000000000..f272d23d60 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Core/Crlf.cs @@ -0,0 +1,14 @@ +namespace AbnfParser.CstNodes.Core +{ + public sealed class Crlf + { + public Crlf(Cr cr, Lf lf) + { + Cr = cr; + Lf = lf; + } + + public Cr Cr { get; } + public Lf Lf { get; } + } +} diff --git a/odata/AbnfParser/CstNodes/Core/Lf.cs b/odata/AbnfParser/CstNodes/Core/Lf.cs new file mode 100644 index 0000000000..899e6b3aae --- /dev/null +++ b/odata/AbnfParser/CstNodes/Core/Lf.cs @@ -0,0 +1,12 @@ +namespace AbnfParser.CstNodes.Core +{ + public sealed class Lf + { + public Lf(x0A x0A) + { + X0A = x0A; + } + + public x0A X0A { get; } + } +} From 46f91c0f9a822126b187e0bfc1d672ddce3b792e Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 14:44:54 -0800 Subject: [PATCH 10/71] asdf --- odata/AbnfParser/CstNodes/Alternation.cs | 28 +++++++++++++++ odata/AbnfParser/CstNodes/Comment.cs | 41 ++++++++++++++++++++++ odata/AbnfParser/CstNodes/Concatenation.cs | 29 +++++++++++++++ odata/AbnfParser/CstNodes/Core/Char.cs | 11 ++++++ odata/AbnfParser/CstNodes/Core/Vchar.cs | 10 ++++++ odata/AbnfParser/CstNodes/Repetition.cs | 12 +++++++ 6 files changed, 131 insertions(+) create mode 100644 odata/AbnfParser/CstNodes/Concatenation.cs create mode 100644 odata/AbnfParser/CstNodes/Core/Vchar.cs create mode 100644 odata/AbnfParser/CstNodes/Repetition.cs diff --git a/odata/AbnfParser/CstNodes/Alternation.cs b/odata/AbnfParser/CstNodes/Alternation.cs index 9ba0bee58a..74f67b3cec 100644 --- a/odata/AbnfParser/CstNodes/Alternation.cs +++ b/odata/AbnfParser/CstNodes/Alternation.cs @@ -1,6 +1,34 @@ namespace AbnfParser.CstNodes { + using System.Collections.Generic; + + using AbnfParser.CstNodes.Core; + public sealed class Alternation { + public Alternation(Concatenation concatenation, IEnumerable inners) + { + Concatenation = concatenation; + Inners = inners; + } + + public Concatenation Concatenation { get; } + public IEnumerable Inners { get; } + + public sealed class Inner + { + public Inner(IEnumerable prefixCwsps, x2F slash, IEnumerable suffixCwsps, Concatenation concatenation) + { + PrefixCwsps = prefixCwsps; + Slash = slash; + SuffixCwsps = suffixCwsps; + Concatenation = concatenation; + } + + public IEnumerable PrefixCwsps { get; } + public x2F Slash { get; } + public IEnumerable SuffixCwsps { get; } + public Concatenation Concatenation { get; } + } } } diff --git a/odata/AbnfParser/CstNodes/Comment.cs b/odata/AbnfParser/CstNodes/Comment.cs index 99df3607f6..a12bd7b3a8 100644 --- a/odata/AbnfParser/CstNodes/Comment.cs +++ b/odata/AbnfParser/CstNodes/Comment.cs @@ -1,6 +1,47 @@ namespace AbnfParser.CstNodes { + using System.Collections.Generic; + + using AbnfParser.CstNodes.Core; + public sealed class Comment { + public Comment(x3B semicolon, IEnumerable inners, Crlf crlf) + { + Semicolon = semicolon; + Inners = inners; + Crlf = crlf; + } + + public x3B Semicolon { get; } + public IEnumerable Inners { get; } + public Crlf Crlf { get; } + + public abstract class Inner + { + private Inner() + { + } + + public sealed class InnerWsp : Inner + { + public InnerWsp(Wsp wsp) + { + Wsp = wsp; + } + + public Wsp Wsp { get; } + } + + public sealed class InnerVchar : Inner + { + public InnerVchar(Vchar vchar) + { + Vchar = vchar; + } + + public Vchar Vchar { get; } + } + } } } diff --git a/odata/AbnfParser/CstNodes/Concatenation.cs b/odata/AbnfParser/CstNodes/Concatenation.cs new file mode 100644 index 0000000000..9f42d25e78 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Concatenation.cs @@ -0,0 +1,29 @@ +namespace AbnfParser.CstNodes +{ + using System.Collections.Generic; + + public sealed class Concatenation + { + public Concatenation(Repetition repetition, IEnumerable inners) + { + Repetition = repetition; + Inners = inners; + } + + public Repetition Repetition { get; } + public IEnumerable Inners { get; } + + public sealed class Inner + { + public Inner(IEnumerable cwsps, Repetition repetition) + { + //// TODO assert one or more + Cwsps = cwsps; + Repetition = repetition; + } + + public IEnumerable Cwsps { get; } + public Repetition Repetition { get; } + } + } +} diff --git a/odata/AbnfParser/CstNodes/Core/Char.cs b/odata/AbnfParser/CstNodes/Core/Char.cs index 3e78d296a1..035217c962 100644 --- a/odata/AbnfParser/CstNodes/Core/Char.cs +++ b/odata/AbnfParser/CstNodes/Core/Char.cs @@ -176,6 +176,17 @@ private x39() //// TODO fill in the rest + public sealed class x3B + { + private x3B() + { + } + + public static x3B Instance { get; } = new x3B(); + } + + //// TODO fill in the rest + public sealed class x3D { private x3D() diff --git a/odata/AbnfParser/CstNodes/Core/Vchar.cs b/odata/AbnfParser/CstNodes/Core/Vchar.cs new file mode 100644 index 0000000000..bd04e21f6e --- /dev/null +++ b/odata/AbnfParser/CstNodes/Core/Vchar.cs @@ -0,0 +1,10 @@ +namespace AbnfParser.CstNodes.Core +{ + public abstract class Vchar + { + private Vchar() + { + //// TODO implement this + } + } +} diff --git a/odata/AbnfParser/CstNodes/Repetition.cs b/odata/AbnfParser/CstNodes/Repetition.cs new file mode 100644 index 0000000000..91ce3c50f7 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Repetition.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbnfParser.CstNodes +{ + public class Repetition + { + } +} From 517c9fca3d5826de8d4e42c244ea3833060860c4 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 15:08:49 -0800 Subject: [PATCH 11/71] asdf --- odata/AbnfParser/CstNodes/CharVal.cs | 12 +++++ odata/AbnfParser/CstNodes/Core/Char.cs | 49 ++++++++++++++++++ odata/AbnfParser/CstNodes/Element.cs | 69 +++++++++++++++++++++++++ odata/AbnfParser/CstNodes/Group.cs | 29 +++++++++++ odata/AbnfParser/CstNodes/NumVal.cs | 12 +++++ odata/AbnfParser/CstNodes/Option.cs | 28 ++++++++++ odata/AbnfParser/CstNodes/ProseVal.cs | 12 +++++ odata/AbnfParser/CstNodes/Repeat.cs | 38 ++++++++++++++ odata/AbnfParser/CstNodes/Repetition.cs | 35 ++++++++++--- 9 files changed, 276 insertions(+), 8 deletions(-) create mode 100644 odata/AbnfParser/CstNodes/CharVal.cs create mode 100644 odata/AbnfParser/CstNodes/Element.cs create mode 100644 odata/AbnfParser/CstNodes/Group.cs create mode 100644 odata/AbnfParser/CstNodes/NumVal.cs create mode 100644 odata/AbnfParser/CstNodes/Option.cs create mode 100644 odata/AbnfParser/CstNodes/ProseVal.cs create mode 100644 odata/AbnfParser/CstNodes/Repeat.cs diff --git a/odata/AbnfParser/CstNodes/CharVal.cs b/odata/AbnfParser/CstNodes/CharVal.cs new file mode 100644 index 0000000000..7813658a57 --- /dev/null +++ b/odata/AbnfParser/CstNodes/CharVal.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbnfParser.CstNodes +{ + public class CharVal + { + } +} diff --git a/odata/AbnfParser/CstNodes/Core/Char.cs b/odata/AbnfParser/CstNodes/Core/Char.cs index 035217c962..e18f4a5075 100644 --- a/odata/AbnfParser/CstNodes/Core/Char.cs +++ b/odata/AbnfParser/CstNodes/Core/Char.cs @@ -62,6 +62,35 @@ private x20() //// TODO fill in the rest + public sealed class x28 + { + private x28() + { + } + + public static x28 Instance { get; } = new x28(); + } + + public sealed class x29 + { + private x29() + { + } + + public static x29 Instance { get; } = new x29(); + } + + public sealed class x2A + { + private x2A() + { + } + + public static x2A Instance { get; } = new x2A(); + } + + //// TODO fill in the rest + public sealed class x2D { private x2D() @@ -432,6 +461,26 @@ private x5A() public static x5A Instance { get; } = new x5A(); } + public sealed class x5B + { + private x5B() + { + } + + public static x5B Instance { get; } = new x5B(); + } + + //// TODO fill in the rest + + public sealed class x5D + { + private x5D() + { + } + + public static x5D Instance { get; } = new x5D(); + } + //// TODO fill in the rest public sealed class x61 diff --git a/odata/AbnfParser/CstNodes/Element.cs b/odata/AbnfParser/CstNodes/Element.cs new file mode 100644 index 0000000000..4e5b80945e --- /dev/null +++ b/odata/AbnfParser/CstNodes/Element.cs @@ -0,0 +1,69 @@ +namespace AbnfParser.CstNodes +{ + public abstract class Element + { + private Element() + { + } + + public sealed class RuleName : Element + { + public RuleName(CstNodes.RuleName value) + { + Value = value; + } + + public CstNodes.RuleName Value { get; } + } + + public sealed class Group : Element + { + public Group(CstNodes.Group value) + { + Value = value; + } + + public CstNodes.Group Value { get; } + } + + public sealed class Option : Element + { + public Option(CstNodes.Option value) + { + Value = value; + } + + public CstNodes.Option Value { get; } + } + + public sealed class CharVal : Element + { + public CharVal(CstNodes.CharVal value) + { + Value = value; + } + + public CstNodes.CharVal Value { get; } + } + + public sealed class NumVal : Element + { + public NumVal(CstNodes.NumVal value) + { + Value = value; + } + + public CstNodes.NumVal Value { get; } + } + + public sealed class ProseVal : Element + { + public ProseVal(CstNodes.ProseVal value) + { + Value = value; + } + + public CstNodes.ProseVal Value { get; } + } + } +} diff --git a/odata/AbnfParser/CstNodes/Group.cs b/odata/AbnfParser/CstNodes/Group.cs new file mode 100644 index 0000000000..acb17d6487 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Group.cs @@ -0,0 +1,29 @@ +namespace AbnfParser.CstNodes +{ + using System.Collections.Generic; + + using AbnfParser.CstNodes.Core; + + public sealed class Group + { + public Group( + x28 openParenthesis, + IEnumerable prefixCwsps, + Alternation alternation, + IEnumerable suffixCwsps, + x29 closeParenthesis) + { + OpenParenthesis = openParenthesis; + PrefixCwsps = prefixCwsps; + Alternation = alternation; + SuffixCwsps = suffixCwsps; + CloseParenthesis = closeParenthesis; + } + + public x28 OpenParenthesis { get; } + public IEnumerable PrefixCwsps { get; } + public Alternation Alternation { get; } + public IEnumerable SuffixCwsps { get; } + public x29 CloseParenthesis { get; } + } +} diff --git a/odata/AbnfParser/CstNodes/NumVal.cs b/odata/AbnfParser/CstNodes/NumVal.cs new file mode 100644 index 0000000000..ec2cce5882 --- /dev/null +++ b/odata/AbnfParser/CstNodes/NumVal.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbnfParser.CstNodes +{ + public class NumVal + { + } +} diff --git a/odata/AbnfParser/CstNodes/Option.cs b/odata/AbnfParser/CstNodes/Option.cs new file mode 100644 index 0000000000..94df0f0107 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Option.cs @@ -0,0 +1,28 @@ +namespace AbnfParser.CstNodes +{ + using AbnfParser.CstNodes.Core; + using System.Collections.Generic; + + public sealed class Option + { + public Option( + x5B openBracket, + IEnumerable prefixCwsps, + Alternation alternation, + IEnumerable suffixCwsps, + x5D closeBracket) + { + OpenBracket = openBracket; + PrefixCwsps = prefixCwsps; + Alternation = alternation; + SuffixCwsps = suffixCwsps; + CloseBracket = closeBracket; + } + + public x5B OpenBracket { get; } + public IEnumerable PrefixCwsps { get; } + public Alternation Alternation { get; } + public IEnumerable SuffixCwsps { get; } + public x5D CloseBracket { get; } + } +} diff --git a/odata/AbnfParser/CstNodes/ProseVal.cs b/odata/AbnfParser/CstNodes/ProseVal.cs new file mode 100644 index 0000000000..58d29ed23c --- /dev/null +++ b/odata/AbnfParser/CstNodes/ProseVal.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbnfParser.CstNodes +{ + public class ProseVal + { + } +} diff --git a/odata/AbnfParser/CstNodes/Repeat.cs b/odata/AbnfParser/CstNodes/Repeat.cs new file mode 100644 index 0000000000..b3be683ecb --- /dev/null +++ b/odata/AbnfParser/CstNodes/Repeat.cs @@ -0,0 +1,38 @@ +namespace AbnfParser.CstNodes +{ + using System.Collections.Generic; + + using AbnfParser.CstNodes.Core; + + public abstract class Repeat + { + private Repeat() + { + } + + public sealed class Count : Repeat + { + public Count(IEnumerable digits) + { + //// TODO assert one or more + Digits = digits; + } + + public IEnumerable Digits { get; } + } + + public sealed class Range : Repeat + { + public Range(IEnumerable prefixDigits, x2A asterisk, IEnumerable suffixDigits) + { + PrefixDigits = prefixDigits; + Asterisk = asterisk; + SuffixDigits = suffixDigits; + } + + public IEnumerable PrefixDigits { get; } + public x2A Asterisk { get; } + public IEnumerable SuffixDigits { get; } + } + } +} diff --git a/odata/AbnfParser/CstNodes/Repetition.cs b/odata/AbnfParser/CstNodes/Repetition.cs index 91ce3c50f7..2daa4e67fe 100644 --- a/odata/AbnfParser/CstNodes/Repetition.cs +++ b/odata/AbnfParser/CstNodes/Repetition.cs @@ -1,12 +1,31 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace AbnfParser.CstNodes +namespace AbnfParser.CstNodes { - public class Repetition + public abstract class Repetition { + private Repetition() + { + } + + public sealed class ElementOnly : Repetition + { + public ElementOnly(Element element) + { + Element = element; + } + + public Element Element { get; } + } + + public sealed class RepeatAndElement : Repetition + { + public RepeatAndElement(Repeat repeat, Element element) + { + Repeat = repeat; + Element = element; + } + + public Repeat Repeat { get; } + public Element Element { get; } + } } } From 860691bf2ee75ed9ccb2f2dffdad5cada49aeef1 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 15:21:23 -0800 Subject: [PATCH 12/71] asdf --- odata/AbnfParser/CstNodes/CharVal.cs | 41 ++++++++++++--- odata/AbnfParser/CstNodes/Core/Char.cs | 63 +++++++++++++++++++++++- odata/AbnfParser/CstNodes/Core/Dquote.cs | 12 +++++ odata/AbnfParser/CstNodes/NumVal.cs | 27 +++++++--- 4 files changed, 127 insertions(+), 16 deletions(-) create mode 100644 odata/AbnfParser/CstNodes/Core/Dquote.cs diff --git a/odata/AbnfParser/CstNodes/CharVal.cs b/odata/AbnfParser/CstNodes/CharVal.cs index 7813658a57..1faf277b42 100644 --- a/odata/AbnfParser/CstNodes/CharVal.cs +++ b/odata/AbnfParser/CstNodes/CharVal.cs @@ -1,12 +1,39 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace AbnfParser.CstNodes +namespace AbnfParser.CstNodes { + using System.Collections.Generic; + + using AbnfParser.CstNodes.Core; + public class CharVal { + public CharVal(Dquote openDquote, IEnumerable inners, Dquote closeDquote) + { + OpenDquote = openDquote; + Inners = inners; + CloseDquote = closeDquote; + } + + public Dquote OpenDquote { get; } + public IEnumerable Inners { get; } + public Dquote CloseDquote { get; } + + public abstract class Inner + { + private Inner() + { + } + + public sealed class x20 : Inner + { + public x20(Core.x20 value) + { + Value = value; + } + + public Core.x20 Value { get; } + } + + //// TODO do the rest + } } } diff --git a/odata/AbnfParser/CstNodes/Core/Char.cs b/odata/AbnfParser/CstNodes/Core/Char.cs index e18f4a5075..5ebefd205d 100644 --- a/odata/AbnfParser/CstNodes/Core/Char.cs +++ b/odata/AbnfParser/CstNodes/Core/Char.cs @@ -60,7 +60,68 @@ private x20() public static x20 Instance { get; } = new x20(); } - //// TODO fill in the rest + public sealed class x21 + { + private x21() + { + } + + public static x21 Instance { get; } = new x21(); + } + + public sealed class x22 + { + private x22() + { + } + + public static x22 Instance { get; } = new x22(); + } + + public sealed class x23 + { + private x23() + { + } + + public static x23 Instance { get; } = new x23(); + } + + public sealed class x24 + { + private x24() + { + } + + public static x24 Instance { get; } = new x24(); + } + + public sealed class x25 + { + private x25() + { + } + + public static x25 Instance { get; } = new x25(); + } + + public sealed class x26 + { + private x26() + { + } + + public static x26 Instance { get; } = new x26(); + } + + public sealed class x27 + { + private x27() + { + } + + public static x27 Instance { get; } = new x27(); + } public sealed class x28 { diff --git a/odata/AbnfParser/CstNodes/Core/Dquote.cs b/odata/AbnfParser/CstNodes/Core/Dquote.cs new file mode 100644 index 0000000000..dd5839e9d7 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Core/Dquote.cs @@ -0,0 +1,12 @@ +namespace AbnfParser.CstNodes.Core +{ + public sealed class Dquote + { + public Dquote(x22 value) + { + Value = value; + } + + public x22 Value { get; } + } +} diff --git a/odata/AbnfParser/CstNodes/NumVal.cs b/odata/AbnfParser/CstNodes/NumVal.cs index ec2cce5882..cf7a3e6204 100644 --- a/odata/AbnfParser/CstNodes/NumVal.cs +++ b/odata/AbnfParser/CstNodes/NumVal.cs @@ -1,12 +1,23 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace AbnfParser.CstNodes +namespace AbnfParser.CstNodes { - public class NumVal + public abstract class NumVal { + private NumVal() + { + } + + //// TODO do these + + public sealed class BinVal : NumVal + { + } + + public sealed class DecVal : NumVal + { + } + + public sealed class HexVal : NumVal + { + } } } From 274b1590345fc1ce0b687c790552f750c8775dbb Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 17:50:46 -0800 Subject: [PATCH 13/71] asdf --- odata/AbnfParser/CstNodes/BinVal.cs | 76 ++++++++++++++++++++++++++ odata/AbnfParser/CstNodes/Core/Bit.cs | 29 ++++++++++ odata/AbnfParser/CstNodes/Core/Char.cs | 11 +++- odata/AbnfParser/CstNodes/DecVal.cs | 6 ++ odata/AbnfParser/CstNodes/HexVal.cs | 6 ++ odata/AbnfParser/CstNodes/NumVal.cs | 20 ++++++- 6 files changed, 143 insertions(+), 5 deletions(-) create mode 100644 odata/AbnfParser/CstNodes/BinVal.cs create mode 100644 odata/AbnfParser/CstNodes/Core/Bit.cs create mode 100644 odata/AbnfParser/CstNodes/DecVal.cs create mode 100644 odata/AbnfParser/CstNodes/HexVal.cs diff --git a/odata/AbnfParser/CstNodes/BinVal.cs b/odata/AbnfParser/CstNodes/BinVal.cs new file mode 100644 index 0000000000..c83dc36088 --- /dev/null +++ b/odata/AbnfParser/CstNodes/BinVal.cs @@ -0,0 +1,76 @@ +namespace AbnfParser.CstNodes +{ + using AbnfParser.CstNodes.Core; + using System.Collections.Generic; + + public abstract class BinVal + { + private BinVal() + { + } + + public sealed class BitsOnly : BinVal + { + public BitsOnly(x62 b, IEnumerable bits) + { + B = b; + Bits = bits; //// TODO assert one or more + } + + public x62 B { get; } + public IEnumerable Bits { get; } + } + + public sealed class ConcatenatedBits : BinVal + { + public ConcatenatedBits(x62 b, IEnumerable bits, IEnumerable inners) + { + B = b; + Bits = bits; //// TODO assert one or more + Inners = inners; //// TODO assert one or more + } + + public x62 B { get; } + public IEnumerable Bits { get; } + public IEnumerable Inners { get; } + + public sealed class Inner + { + public Inner(x2E dot, IEnumerable bits) + { + Dot = dot; + Bits = bits; //// TODO assert one or more + } + + public x2E Dot { get; } + public IEnumerable Bits { get; } + } + } + + public sealed class Range : BinVal + { + public Range(x62 b, IEnumerable bits, IEnumerable inners) + { + B = b; + Bits = bits; //// TODO assert one or more + Inners = inners; //// TODO assert one or more + } + + public x62 B { get; } + public IEnumerable Bits { get; } + public IEnumerable Inners { get; } + + public sealed class Inner + { + public Inner(x2D dash, IEnumerable bits) + { + Dash = dash; + Bits = bits; //// TODO assert one or more + } + + public x2D Dash { get; } + public IEnumerable Bits { get; } + } + } + } +} diff --git a/odata/AbnfParser/CstNodes/Core/Bit.cs b/odata/AbnfParser/CstNodes/Core/Bit.cs new file mode 100644 index 0000000000..ada47798d4 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Core/Bit.cs @@ -0,0 +1,29 @@ +namespace AbnfParser.CstNodes.Core +{ + public abstract class Bit + { + private Bit() + { + } + + public sealed class Zero : Bit + { + public Zero(x30 value) + { + Value = value; + } + + public x30 Value { get; } + } + + public sealed class One : Bit + { + public One(x31 value) + { + Value = value; + } + + public x31 Value { get; } + } + } +} diff --git a/odata/AbnfParser/CstNodes/Core/Char.cs b/odata/AbnfParser/CstNodes/Core/Char.cs index 5ebefd205d..460e615027 100644 --- a/odata/AbnfParser/CstNodes/Core/Char.cs +++ b/odata/AbnfParser/CstNodes/Core/Char.cs @@ -161,7 +161,14 @@ private x2D() public static x2D Instance { get; } = new x2D(); } - //// TODO fill in the rest + public sealed class x2E + { + private x2E() + { + } + + public static x2E Instance { get; } = new x2E(); + } public sealed class x2F { @@ -172,8 +179,6 @@ private x2F() public static x2F Instance { get; } = new x2F(); } - //// TODO fill in the rest - public sealed class x30 { private x30() diff --git a/odata/AbnfParser/CstNodes/DecVal.cs b/odata/AbnfParser/CstNodes/DecVal.cs new file mode 100644 index 0000000000..c0ef5c26e4 --- /dev/null +++ b/odata/AbnfParser/CstNodes/DecVal.cs @@ -0,0 +1,6 @@ +namespace AbnfParser.CstNodes +{ + public class DecVal + { + } +} diff --git a/odata/AbnfParser/CstNodes/HexVal.cs b/odata/AbnfParser/CstNodes/HexVal.cs new file mode 100644 index 0000000000..6a6f8d09bb --- /dev/null +++ b/odata/AbnfParser/CstNodes/HexVal.cs @@ -0,0 +1,6 @@ +namespace AbnfParser.CstNodes +{ + public class HexVal + { + } +} diff --git a/odata/AbnfParser/CstNodes/NumVal.cs b/odata/AbnfParser/CstNodes/NumVal.cs index cf7a3e6204..acd8b208d7 100644 --- a/odata/AbnfParser/CstNodes/NumVal.cs +++ b/odata/AbnfParser/CstNodes/NumVal.cs @@ -6,18 +6,34 @@ private NumVal() { } - //// TODO do these - public sealed class BinVal : NumVal { + public BinVal(CstNodes.BinVal value) + { + Value = value; + } + + public CstNodes.BinVal Value { get; } } public sealed class DecVal : NumVal { + public DecVal(CstNodes.DecVal value) + { + Value = value; + } + + public CstNodes.DecVal Value { get; } } public sealed class HexVal : NumVal { + public HexVal(CstNodes.HexVal value) + { + Value = value; + } + + public CstNodes.HexVal Value { get; } } } } From 04815b622eb0e74d8e7bc0ee61083880cfd4e300 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 18:10:56 -0800 Subject: [PATCH 14/71] asdf --- odata/AbnfParser/CstNodes/Core/Char.cs | 18 +++++- odata/AbnfParser/CstNodes/Core/HexDig.cs | 79 ++++++++++++++++++++++++ odata/AbnfParser/CstNodes/DecVal.cs | 73 +++++++++++++++++++++- odata/AbnfParser/CstNodes/HexVal.cs | 72 ++++++++++++++++++++- odata/AbnfParser/CstNodes/ProseVal.cs | 31 +++++++--- 5 files changed, 262 insertions(+), 11 deletions(-) create mode 100644 odata/AbnfParser/CstNodes/Core/HexDig.cs diff --git a/odata/AbnfParser/CstNodes/Core/Char.cs b/odata/AbnfParser/CstNodes/Core/Char.cs index 460e615027..998c42e069 100644 --- a/odata/AbnfParser/CstNodes/Core/Char.cs +++ b/odata/AbnfParser/CstNodes/Core/Char.cs @@ -280,7 +280,14 @@ private x3B() public static x3B Instance { get; } = new x3B(); } - //// TODO fill in the rest + public sealed class x3C + { + private x3C() + { + } + + public static x3C Instance { get; } = new x3C(); + } public sealed class x3D { @@ -291,6 +298,15 @@ private x3D() public static x3D Instance { get; } = new x3D(); } + public sealed class x3E + { + private x3E() + { + } + + public static x3E Instance { get; } = new x3E(); + } + //// TODO fill in the rest public sealed class x41 diff --git a/odata/AbnfParser/CstNodes/Core/HexDig.cs b/odata/AbnfParser/CstNodes/Core/HexDig.cs new file mode 100644 index 0000000000..aa26f2e0a8 --- /dev/null +++ b/odata/AbnfParser/CstNodes/Core/HexDig.cs @@ -0,0 +1,79 @@ +namespace AbnfParser.CstNodes.Core +{ + public abstract class HexDig + { + private HexDig() + { + } + + public sealed class Digit : HexDig + { + public Digit(Core.Digit value) + { + Value = value; + } + + public Core.Digit Value { get; } + } + + public sealed class A : HexDig + { + public A(x41 value) + { + Value = value; + } + + public x41 Value { get; } + } + + public sealed class B : HexDig + { + public B(x42 value) + { + Value = value; + } + + public x42 Value { get; } + } + + public sealed class C : HexDig + { + public C(x43 value) + { + Value = value; + } + + public x43 Value { get; } + } + + public sealed class D : HexDig + { + public D(x44 value) + { + Value = value; + } + + public x44 Value { get; } + } + + public sealed class E : HexDig + { + public E(x45 value) + { + Value = value; + } + + public x45 Value { get; } + } + + public sealed class F : HexDig + { + public F(x46 value) + { + Value = value; + } + + public x46 Value { get; } + } + } +} diff --git a/odata/AbnfParser/CstNodes/DecVal.cs b/odata/AbnfParser/CstNodes/DecVal.cs index c0ef5c26e4..a5cf5a52fa 100644 --- a/odata/AbnfParser/CstNodes/DecVal.cs +++ b/odata/AbnfParser/CstNodes/DecVal.cs @@ -1,6 +1,77 @@ namespace AbnfParser.CstNodes { - public class DecVal + using System.Collections.Generic; + + using AbnfParser.CstNodes.Core; + + public abstract class DecVal { + private DecVal() + { + } + + public sealed class DecsOnly : DecVal + { + public DecsOnly(x64 d, IEnumerable digits) + { + D = d; + Digits = digits; //// TODO assert one or more + } + + public x64 D { get; } + public IEnumerable Digits { get; } + } + + public sealed class ConcatenatedDecs : DecVal + { + public ConcatenatedDecs(x64 d, IEnumerable digits, IEnumerable inners) + { + D = d; + Digits = digits; //// TODO assert one or more + Inners = inners; //// TODO assert one or more + } + + public x64 D { get; } + public IEnumerable Digits { get; } + public IEnumerable Inners { get; } + + public sealed class Inner + { + public Inner(x2E dot, IEnumerable digits) + { + Dot = dot; + Digits = digits; //// TODO assert one or more + } + + public x2E Dot { get; } + public IEnumerable Digits { get; } + } + } + + public sealed class Range : DecVal + { + public Range(x64 d, IEnumerable digits, IEnumerable inners) + { + D = d; + Digits = digits; //// TODO assert one or more + Inners = inners; //// TODO assert one or more + } + + public x64 D { get; } + public IEnumerable Digits { get; } + public IEnumerable Inners { get; } + + public sealed class Inner + { + public Inner(x2D dash, IEnumerable digits) + { + Dash = dash; + Digits = digits; //// TODO assert one or more + } + + public x2D Dash { get; } + public IEnumerable Digits { get; } + } + } } } diff --git a/odata/AbnfParser/CstNodes/HexVal.cs b/odata/AbnfParser/CstNodes/HexVal.cs index 6a6f8d09bb..d764e36801 100644 --- a/odata/AbnfParser/CstNodes/HexVal.cs +++ b/odata/AbnfParser/CstNodes/HexVal.cs @@ -1,6 +1,76 @@ namespace AbnfParser.CstNodes { - public class HexVal + using AbnfParser.CstNodes.Core; + using System.Collections.Generic; + + public abstract class HexVal { + private HexVal() + { + } + + public sealed class HexOnly : HexVal + { + public HexOnly(x78 x, IEnumerable hexDigs) + { + X = x; + HexDigs = hexDigs; //// TODO assert one or more + } + + public x78 X { get; } + public IEnumerable HexDigs { get; } + } + + public sealed class ConcatenatedHex : HexVal + { + public ConcatenatedHex(x78 x, IEnumerable hexDigs, IEnumerable inners) + { + X = x; + HexDigs = hexDigs; //// TODO assert one or more + Inners = inners; //// TODO assert one or more + } + + public x78 X { get; } + public IEnumerable HexDigs { get; } + public IEnumerable Inners { get; } + + public sealed class Inner + { + public Inner(x2E dot, IEnumerable hexDigs) + { + Dot = dot; + HexDigs = hexDigs; //// TODO assert one or more + } + + public x2E Dot { get; } + public IEnumerable HexDigs { get; } + } + } + + public sealed class Range : HexVal + { + public Range(x78 x, IEnumerable hexDigs, IEnumerable inners) + { + X = x; + HexDigs = hexDigs; //// TODO assert one or more + Inners = inners; //// TODO assert one or more + } + + public x78 X { get; } + public IEnumerable HexDigs { get; } + public IEnumerable Inners { get; } + + public sealed class Inner + { + public Inner(x2D dash, IEnumerable hexDigs) + { + Dash = dash; + HexDigs = hexDigs; //// TODO assert one or more + } + + public x2D Dash { get; } + public IEnumerable HexDigs { get; } + } + } } } diff --git a/odata/AbnfParser/CstNodes/ProseVal.cs b/odata/AbnfParser/CstNodes/ProseVal.cs index 58d29ed23c..9056d652cf 100644 --- a/odata/AbnfParser/CstNodes/ProseVal.cs +++ b/odata/AbnfParser/CstNodes/ProseVal.cs @@ -1,12 +1,27 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace AbnfParser.CstNodes +namespace AbnfParser.CstNodes { - public class ProseVal + using AbnfParser.CstNodes.Core; + + public abstract class ProseVal { + private ProseVal() + { + } + + public sealed class x20 : ProseVal + { + public x20(x3C lessThan, x20 value, x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public x3C LessThan { get; } + public x20 Value { get; } + public x3E GreaterThan { get; } + } + + //// TODO finish this } } From 23b984aaedb51e4ec4f0e6803ccebab14ebff799 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 18:20:07 -0800 Subject: [PATCH 15/71] asdf --- odata.tests/Test1.cs | 24 ++ odata/AbnfParser/CstNodes/Core/Char.cs | 371 ++++++++++++++++++++++++- 2 files changed, 386 insertions(+), 9 deletions(-) diff --git a/odata.tests/Test1.cs b/odata.tests/Test1.cs index 9ddb6a0368..db0ce5b6c4 100644 --- a/odata.tests/Test1.cs +++ b/odata.tests/Test1.cs @@ -27,5 +27,29 @@ public void TestMethod1() Assert.AreEqual(url, stringBuilder.ToString()); } + + [TestMethod] + public void Generate() + { + var start = 0x01; + var end = 0x7F; + + var builder = new StringBuilder(); + for (int i = start; i <= end; ++i) + { + var className = $"x{i:X2}"; + builder.AppendLine($"public sealed class {className}"); + builder.AppendLine("{"); + builder.AppendLine($"private {className}()"); + builder.AppendLine("{"); + builder.AppendLine("}"); + builder.AppendLine(); + builder.AppendLine($"public static {className} Instance {{ get; }} = new {className}();"); + builder.AppendLine("}"); + builder.AppendLine(); + } + + File.WriteAllText(@"C:\Users\gdebruin\code.txt", builder.ToString()); + } } } diff --git a/odata/AbnfParser/CstNodes/Core/Char.cs b/odata/AbnfParser/CstNodes/Core/Char.cs index 998c42e069..b6af7e02dc 100644 --- a/odata/AbnfParser/CstNodes/Core/Char.cs +++ b/odata/AbnfParser/CstNodes/Core/Char.cs @@ -18,7 +18,68 @@ private x01() public static x01 Instance { get; } = new x01(); } - //// TODO fill in the rest + public sealed class x02 + { + private x02() + { + } + + public static x02 Instance { get; } = new x02(); + } + + public sealed class x03 + { + private x03() + { + } + + public static x03 Instance { get; } = new x03(); + } + + public sealed class x04 + { + private x04() + { + } + + public static x04 Instance { get; } = new x04(); + } + + public sealed class x05 + { + private x05() + { + } + + public static x05 Instance { get; } = new x05(); + } + + public sealed class x06 + { + private x06() + { + } + + public static x06 Instance { get; } = new x06(); + } + + public sealed class x07 + { + private x07() + { + } + + public static x07 Instance { get; } = new x07(); + } + + public sealed class x08 + { + private x08() + { + } + + public static x08 Instance { get; } = new x08(); + } public sealed class x09 { @@ -38,7 +99,23 @@ private x0A() public static x0A Instance { get; } = new x0A(); } - //// TODO fill in the rest + public sealed class x0B + { + private x0B() + { + } + + public static x0B Instance { get; } = new x0B(); + } + + public sealed class x0C + { + private x0C() + { + } + + public static x0C Instance { get; } = new x0C(); + } public sealed class x0D { @@ -49,7 +126,167 @@ private x0D() public static x0D Instance { get; } = new x0D(); } - //// TODO fill in the rest + public sealed class x0E + { + private x0E() + { + } + + public static x0E Instance { get; } = new x0E(); + } + + public sealed class x0F + { + private x0F() + { + } + + public static x0F Instance { get; } = new x0F(); + } + + public sealed class x10 + { + private x10() + { + } + + public static x10 Instance { get; } = new x10(); + } + + public sealed class x11 + { + private x11() + { + } + + public static x11 Instance { get; } = new x11(); + } + + public sealed class x12 + { + private x12() + { + } + + public static x12 Instance { get; } = new x12(); + } + + public sealed class x13 + { + private x13() + { + } + + public static x13 Instance { get; } = new x13(); + } + + public sealed class x14 + { + private x14() + { + } + + public static x14 Instance { get; } = new x14(); + } + + public sealed class x15 + { + private x15() + { + } + + public static x15 Instance { get; } = new x15(); + } + + public sealed class x16 + { + private x16() + { + } + + public static x16 Instance { get; } = new x16(); + } + + public sealed class x17 + { + private x17() + { + } + + public static x17 Instance { get; } = new x17(); + } + + public sealed class x18 + { + private x18() + { + } + + public static x18 Instance { get; } = new x18(); + } + + public sealed class x19 + { + private x19() + { + } + + public static x19 Instance { get; } = new x19(); + } + + public sealed class x1A + { + private x1A() + { + } + + public static x1A Instance { get; } = new x1A(); + } + + public sealed class x1B + { + private x1B() + { + } + + public static x1B Instance { get; } = new x1B(); + } + + public sealed class x1C + { + private x1C() + { + } + + public static x1C Instance { get; } = new x1C(); + } + + public sealed class x1D + { + private x1D() + { + } + + public static x1D Instance { get; } = new x1D(); + } + + public sealed class x1E + { + private x1E() + { + } + + public static x1E Instance { get; } = new x1E(); + } + + public sealed class x1F + { + private x1F() + { + } + + public static x1F Instance { get; } = new x1F(); + } public sealed class x20 { @@ -150,7 +387,23 @@ private x2A() public static x2A Instance { get; } = new x2A(); } - //// TODO fill in the rest + public sealed class x2B + { + private x2B() + { + } + + public static x2B Instance { get; } = new x2B(); + } + + public sealed class x2C + { + private x2C() + { + } + + public static x2C Instance { get; } = new x2C(); + } public sealed class x2D { @@ -269,7 +522,14 @@ private x39() public static x39 Instance { get; } = new x39(); } - //// TODO fill in the rest + public sealed class x3A + { + private x3A() + { + } + + public static x3A Instance { get; } = new x3A(); + } public sealed class x3B { @@ -307,7 +567,23 @@ private x3E() public static x3E Instance { get; } = new x3E(); } - //// TODO fill in the rest + public sealed class x3F + { + private x3F() + { + } + + public static x3F Instance { get; } = new x3F(); + } + + public sealed class x40 + { + private x40() + { + } + + public static x40 Instance { get; } = new x40(); + } public sealed class x41 { @@ -552,7 +828,14 @@ private x5B() public static x5B Instance { get; } = new x5B(); } - //// TODO fill in the rest + public sealed class x5C + { + private x5C() + { + } + + public static x5C Instance { get; } = new x5C(); + } public sealed class x5D { @@ -563,7 +846,32 @@ private x5D() public static x5D Instance { get; } = new x5D(); } - //// TODO fill in the rest + public sealed class x5E + { + private x5E() + { + } + + public static x5E Instance { get; } = new x5E(); + } + + public sealed class x5F + { + private x5F() + { + } + + public static x5F Instance { get; } = new x5F(); + } + + public sealed class x60 + { + private x60() + { + } + + public static x60 Instance { get; } = new x60(); + } public sealed class x61 { @@ -799,5 +1107,50 @@ private x7A() public static x7A Instance { get; } = new x7A(); } - //// TODO fill in the rest + public sealed class x7B + { + private x7B() + { + } + + public static x7B Instance { get; } = new x7B(); + } + + public sealed class x7C + { + private x7C() + { + } + + public static x7C Instance { get; } = new x7C(); + } + + public sealed class x7D + { + private x7D() + { + } + + public static x7D Instance { get; } = new x7D(); + } + + public sealed class x7E + { + private x7E() + { + } + + public static x7E Instance { get; } = new x7E(); + } + + public sealed class x7F + { + private x7F() + { + } + + public static x7F Instance { get; } = new x7F(); + } + + } From 8de9dedfaa0287c47a3321cab23bbf8975f5fe5c Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 18:24:14 -0800 Subject: [PATCH 16/71] asdf --- odata.tests/Test1.cs | 11 +- odata/AbnfParser/CstNodes/CharVal.cs | 934 ++++++++++++++++- odata/AbnfParser/CstNodes/Core/Char.cs | 1273 +++++++++++++++++++++++- 3 files changed, 2210 insertions(+), 8 deletions(-) diff --git a/odata.tests/Test1.cs b/odata.tests/Test1.cs index db0ce5b6c4..efef255d6c 100644 --- a/odata.tests/Test1.cs +++ b/odata.tests/Test1.cs @@ -31,20 +31,21 @@ public void TestMethod1() [TestMethod] public void Generate() { - var start = 0x01; - var end = 0x7F; + var start = 0x23; + var end = 0x7E; var builder = new StringBuilder(); for (int i = start; i <= end; ++i) { var className = $"x{i:X2}"; - builder.AppendLine($"public sealed class {className}"); + builder.AppendLine($"public sealed class {className} : Inner"); builder.AppendLine("{"); - builder.AppendLine($"private {className}()"); + builder.AppendLine($"public {className}(Core.{className} value)"); builder.AppendLine("{"); + builder.AppendLine("Value = value;"); builder.AppendLine("}"); builder.AppendLine(); - builder.AppendLine($"public static {className} Instance {{ get; }} = new {className}();"); + builder.AppendLine($"public Core.{className} Value {{ get; }}"); builder.AppendLine("}"); builder.AppendLine(); } diff --git a/odata/AbnfParser/CstNodes/CharVal.cs b/odata/AbnfParser/CstNodes/CharVal.cs index 1faf277b42..bbe634b206 100644 --- a/odata/AbnfParser/CstNodes/CharVal.cs +++ b/odata/AbnfParser/CstNodes/CharVal.cs @@ -32,8 +32,938 @@ public x20(Core.x20 value) public Core.x20 Value { get; } } - - //// TODO do the rest + + public sealed class x21 : Inner + { + public x21(Core.x21 value) + { + Value = value; + } + + public Core.x21 Value { get; } + } + + public sealed class x23 : Inner + { + public x23(Core.x23 value) + { + Value = value; + } + + public Core.x23 Value { get; } + } + + public sealed class x24 : Inner + { + public x24(Core.x24 value) + { + Value = value; + } + + public Core.x24 Value { get; } + } + + public sealed class x25 : Inner + { + public x25(Core.x25 value) + { + Value = value; + } + + public Core.x25 Value { get; } + } + + public sealed class x26 : Inner + { + public x26(Core.x26 value) + { + Value = value; + } + + public Core.x26 Value { get; } + } + + public sealed class x27 : Inner + { + public x27(Core.x27 value) + { + Value = value; + } + + public Core.x27 Value { get; } + } + + public sealed class x28 : Inner + { + public x28(Core.x28 value) + { + Value = value; + } + + public Core.x28 Value { get; } + } + + public sealed class x29 : Inner + { + public x29(Core.x29 value) + { + Value = value; + } + + public Core.x29 Value { get; } + } + + public sealed class x2A : Inner + { + public x2A(Core.x2A value) + { + Value = value; + } + + public Core.x2A Value { get; } + } + + public sealed class x2B : Inner + { + public x2B(Core.x2B value) + { + Value = value; + } + + public Core.x2B Value { get; } + } + + public sealed class x2C : Inner + { + public x2C(Core.x2C value) + { + Value = value; + } + + public Core.x2C Value { get; } + } + + public sealed class x2D : Inner + { + public x2D(Core.x2D value) + { + Value = value; + } + + public Core.x2D Value { get; } + } + + public sealed class x2E : Inner + { + public x2E(Core.x2E value) + { + Value = value; + } + + public Core.x2E Value { get; } + } + + public sealed class x2F : Inner + { + public x2F(Core.x2F value) + { + Value = value; + } + + public Core.x2F Value { get; } + } + + public sealed class x30 : Inner + { + public x30(Core.x30 value) + { + Value = value; + } + + public Core.x30 Value { get; } + } + + public sealed class x31 : Inner + { + public x31(Core.x31 value) + { + Value = value; + } + + public Core.x31 Value { get; } + } + + public sealed class x32 : Inner + { + public x32(Core.x32 value) + { + Value = value; + } + + public Core.x32 Value { get; } + } + + public sealed class x33 : Inner + { + public x33(Core.x33 value) + { + Value = value; + } + + public Core.x33 Value { get; } + } + + public sealed class x34 : Inner + { + public x34(Core.x34 value) + { + Value = value; + } + + public Core.x34 Value { get; } + } + + public sealed class x35 : Inner + { + public x35(Core.x35 value) + { + Value = value; + } + + public Core.x35 Value { get; } + } + + public sealed class x36 : Inner + { + public x36(Core.x36 value) + { + Value = value; + } + + public Core.x36 Value { get; } + } + + public sealed class x37 : Inner + { + public x37(Core.x37 value) + { + Value = value; + } + + public Core.x37 Value { get; } + } + + public sealed class x38 : Inner + { + public x38(Core.x38 value) + { + Value = value; + } + + public Core.x38 Value { get; } + } + + public sealed class x39 : Inner + { + public x39(Core.x39 value) + { + Value = value; + } + + public Core.x39 Value { get; } + } + + public sealed class x3A : Inner + { + public x3A(Core.x3A value) + { + Value = value; + } + + public Core.x3A Value { get; } + } + + public sealed class x3B : Inner + { + public x3B(Core.x3B value) + { + Value = value; + } + + public Core.x3B Value { get; } + } + + public sealed class x3C : Inner + { + public x3C(Core.x3C value) + { + Value = value; + } + + public Core.x3C Value { get; } + } + + public sealed class x3D : Inner + { + public x3D(Core.x3D value) + { + Value = value; + } + + public Core.x3D Value { get; } + } + + public sealed class x3E : Inner + { + public x3E(Core.x3E value) + { + Value = value; + } + + public Core.x3E Value { get; } + } + + public sealed class x3F : Inner + { + public x3F(Core.x3F value) + { + Value = value; + } + + public Core.x3F Value { get; } + } + + public sealed class x40 : Inner + { + public x40(Core.x40 value) + { + Value = value; + } + + public Core.x40 Value { get; } + } + + public sealed class x41 : Inner + { + public x41(Core.x41 value) + { + Value = value; + } + + public Core.x41 Value { get; } + } + + public sealed class x42 : Inner + { + public x42(Core.x42 value) + { + Value = value; + } + + public Core.x42 Value { get; } + } + + public sealed class x43 : Inner + { + public x43(Core.x43 value) + { + Value = value; + } + + public Core.x43 Value { get; } + } + + public sealed class x44 : Inner + { + public x44(Core.x44 value) + { + Value = value; + } + + public Core.x44 Value { get; } + } + + public sealed class x45 : Inner + { + public x45(Core.x45 value) + { + Value = value; + } + + public Core.x45 Value { get; } + } + + public sealed class x46 : Inner + { + public x46(Core.x46 value) + { + Value = value; + } + + public Core.x46 Value { get; } + } + + public sealed class x47 : Inner + { + public x47(Core.x47 value) + { + Value = value; + } + + public Core.x47 Value { get; } + } + + public sealed class x48 : Inner + { + public x48(Core.x48 value) + { + Value = value; + } + + public Core.x48 Value { get; } + } + + public sealed class x49 : Inner + { + public x49(Core.x49 value) + { + Value = value; + } + + public Core.x49 Value { get; } + } + + public sealed class x4A : Inner + { + public x4A(Core.x4A value) + { + Value = value; + } + + public Core.x4A Value { get; } + } + + public sealed class x4B : Inner + { + public x4B(Core.x4B value) + { + Value = value; + } + + public Core.x4B Value { get; } + } + + public sealed class x4C : Inner + { + public x4C(Core.x4C value) + { + Value = value; + } + + public Core.x4C Value { get; } + } + + public sealed class x4D : Inner + { + public x4D(Core.x4D value) + { + Value = value; + } + + public Core.x4D Value { get; } + } + + public sealed class x4E : Inner + { + public x4E(Core.x4E value) + { + Value = value; + } + + public Core.x4E Value { get; } + } + + public sealed class x4F : Inner + { + public x4F(Core.x4F value) + { + Value = value; + } + + public Core.x4F Value { get; } + } + + public sealed class x50 : Inner + { + public x50(Core.x50 value) + { + Value = value; + } + + public Core.x50 Value { get; } + } + + public sealed class x51 : Inner + { + public x51(Core.x51 value) + { + Value = value; + } + + public Core.x51 Value { get; } + } + + public sealed class x52 : Inner + { + public x52(Core.x52 value) + { + Value = value; + } + + public Core.x52 Value { get; } + } + + public sealed class x53 : Inner + { + public x53(Core.x53 value) + { + Value = value; + } + + public Core.x53 Value { get; } + } + + public sealed class x54 : Inner + { + public x54(Core.x54 value) + { + Value = value; + } + + public Core.x54 Value { get; } + } + + public sealed class x55 : Inner + { + public x55(Core.x55 value) + { + Value = value; + } + + public Core.x55 Value { get; } + } + + public sealed class x56 : Inner + { + public x56(Core.x56 value) + { + Value = value; + } + + public Core.x56 Value { get; } + } + + public sealed class x57 : Inner + { + public x57(Core.x57 value) + { + Value = value; + } + + public Core.x57 Value { get; } + } + + public sealed class x58 : Inner + { + public x58(Core.x58 value) + { + Value = value; + } + + public Core.x58 Value { get; } + } + + public sealed class x59 : Inner + { + public x59(Core.x59 value) + { + Value = value; + } + + public Core.x59 Value { get; } + } + + public sealed class x5A : Inner + { + public x5A(Core.x5A value) + { + Value = value; + } + + public Core.x5A Value { get; } + } + + public sealed class x5B : Inner + { + public x5B(Core.x5B value) + { + Value = value; + } + + public Core.x5B Value { get; } + } + + public sealed class x5C : Inner + { + public x5C(Core.x5C value) + { + Value = value; + } + + public Core.x5C Value { get; } + } + + public sealed class x5D : Inner + { + public x5D(Core.x5D value) + { + Value = value; + } + + public Core.x5D Value { get; } + } + + public sealed class x5E : Inner + { + public x5E(Core.x5E value) + { + Value = value; + } + + public Core.x5E Value { get; } + } + + public sealed class x5F : Inner + { + public x5F(Core.x5F value) + { + Value = value; + } + + public Core.x5F Value { get; } + } + + public sealed class x60 : Inner + { + public x60(Core.x60 value) + { + Value = value; + } + + public Core.x60 Value { get; } + } + + public sealed class x61 : Inner + { + public x61(Core.x61 value) + { + Value = value; + } + + public Core.x61 Value { get; } + } + + public sealed class x62 : Inner + { + public x62(Core.x62 value) + { + Value = value; + } + + public Core.x62 Value { get; } + } + + public sealed class x63 : Inner + { + public x63(Core.x63 value) + { + Value = value; + } + + public Core.x63 Value { get; } + } + + public sealed class x64 : Inner + { + public x64(Core.x64 value) + { + Value = value; + } + + public Core.x64 Value { get; } + } + + public sealed class x65 : Inner + { + public x65(Core.x65 value) + { + Value = value; + } + + public Core.x65 Value { get; } + } + + public sealed class x66 : Inner + { + public x66(Core.x66 value) + { + Value = value; + } + + public Core.x66 Value { get; } + } + + public sealed class x67 : Inner + { + public x67(Core.x67 value) + { + Value = value; + } + + public Core.x67 Value { get; } + } + + public sealed class x68 : Inner + { + public x68(Core.x68 value) + { + Value = value; + } + + public Core.x68 Value { get; } + } + + public sealed class x69 : Inner + { + public x69(Core.x69 value) + { + Value = value; + } + + public Core.x69 Value { get; } + } + + public sealed class x6A : Inner + { + public x6A(Core.x6A value) + { + Value = value; + } + + public Core.x6A Value { get; } + } + + public sealed class x6B : Inner + { + public x6B(Core.x6B value) + { + Value = value; + } + + public Core.x6B Value { get; } + } + + public sealed class x6C : Inner + { + public x6C(Core.x6C value) + { + Value = value; + } + + public Core.x6C Value { get; } + } + + public sealed class x6D : Inner + { + public x6D(Core.x6D value) + { + Value = value; + } + + public Core.x6D Value { get; } + } + + public sealed class x6E : Inner + { + public x6E(Core.x6E value) + { + Value = value; + } + + public Core.x6E Value { get; } + } + + public sealed class x6F : Inner + { + public x6F(Core.x6F value) + { + Value = value; + } + + public Core.x6F Value { get; } + } + + public sealed class x70 : Inner + { + public x70(Core.x70 value) + { + Value = value; + } + + public Core.x70 Value { get; } + } + + public sealed class x71 : Inner + { + public x71(Core.x71 value) + { + Value = value; + } + + public Core.x71 Value { get; } + } + + public sealed class x72 : Inner + { + public x72(Core.x72 value) + { + Value = value; + } + + public Core.x72 Value { get; } + } + + public sealed class x73 : Inner + { + public x73(Core.x73 value) + { + Value = value; + } + + public Core.x73 Value { get; } + } + + public sealed class x74 : Inner + { + public x74(Core.x74 value) + { + Value = value; + } + + public Core.x74 Value { get; } + } + + public sealed class x75 : Inner + { + public x75(Core.x75 value) + { + Value = value; + } + + public Core.x75 Value { get; } + } + + public sealed class x76 : Inner + { + public x76(Core.x76 value) + { + Value = value; + } + + public Core.x76 Value { get; } + } + + public sealed class x77 : Inner + { + public x77(Core.x77 value) + { + Value = value; + } + + public Core.x77 Value { get; } + } + + public sealed class x78 : Inner + { + public x78(Core.x78 value) + { + Value = value; + } + + public Core.x78 Value { get; } + } + + public sealed class x79 : Inner + { + public x79(Core.x79 value) + { + Value = value; + } + + public Core.x79 Value { get; } + } + + public sealed class x7A : Inner + { + public x7A(Core.x7A value) + { + Value = value; + } + + public Core.x7A Value { get; } + } + + public sealed class x7B : Inner + { + public x7B(Core.x7B value) + { + Value = value; + } + + public Core.x7B Value { get; } + } + + public sealed class x7C : Inner + { + public x7C(Core.x7C value) + { + Value = value; + } + + public Core.x7C Value { get; } + } + + public sealed class x7D : Inner + { + public x7D(Core.x7D value) + { + Value = value; + } + + public Core.x7D Value { get; } + } + + public sealed class x7E : Inner + { + public x7E(Core.x7E value) + { + Value = value; + } + + public Core.x7E Value { get; } + } + + } } } diff --git a/odata/AbnfParser/CstNodes/Core/Char.cs b/odata/AbnfParser/CstNodes/Core/Char.cs index b6af7e02dc..12c56c5f50 100644 --- a/odata/AbnfParser/CstNodes/Core/Char.cs +++ b/odata/AbnfParser/CstNodes/Core/Char.cs @@ -1,12 +1,1283 @@ namespace AbnfParser.CstNodes.Core { - //// TODO do other core rules + //// TODO finish the core rules public abstract class Char { private Char() { } + public sealed class x01 : Char + { + public x01(Core.x01 value) + { + Value = value; + } + + public Core.x01 Value { get; } + } + + public sealed class x02 : Char + { + public x02(Core.x02 value) + { + Value = value; + } + + public Core.x02 Value { get; } + } + + public sealed class x03 : Char + { + public x03(Core.x03 value) + { + Value = value; + } + + public Core.x03 Value { get; } + } + + public sealed class x04 : Char + { + public x04(Core.x04 value) + { + Value = value; + } + + public Core.x04 Value { get; } + } + + public sealed class x05 : Char + { + public x05(Core.x05 value) + { + Value = value; + } + + public Core.x05 Value { get; } + } + + public sealed class x06 : Char + { + public x06(Core.x06 value) + { + Value = value; + } + + public Core.x06 Value { get; } + } + + public sealed class x07 : Char + { + public x07(Core.x07 value) + { + Value = value; + } + + public Core.x07 Value { get; } + } + + public sealed class x08 : Char + { + public x08(Core.x08 value) + { + Value = value; + } + + public Core.x08 Value { get; } + } + + public sealed class x09 : Char + { + public x09(Core.x09 value) + { + Value = value; + } + + public Core.x09 Value { get; } + } + + public sealed class x0A : Char + { + public x0A(Core.x0A value) + { + Value = value; + } + + public Core.x0A Value { get; } + } + + public sealed class x0B : Char + { + public x0B(Core.x0B value) + { + Value = value; + } + + public Core.x0B Value { get; } + } + + public sealed class x0C : Char + { + public x0C(Core.x0C value) + { + Value = value; + } + + public Core.x0C Value { get; } + } + + public sealed class x0D : Char + { + public x0D(Core.x0D value) + { + Value = value; + } + + public Core.x0D Value { get; } + } + + public sealed class x0E : Char + { + public x0E(Core.x0E value) + { + Value = value; + } + + public Core.x0E Value { get; } + } + + public sealed class x0F : Char + { + public x0F(Core.x0F value) + { + Value = value; + } + + public Core.x0F Value { get; } + } + + public sealed class x10 : Char + { + public x10(Core.x10 value) + { + Value = value; + } + + public Core.x10 Value { get; } + } + + public sealed class x11 : Char + { + public x11(Core.x11 value) + { + Value = value; + } + + public Core.x11 Value { get; } + } + + public sealed class x12 : Char + { + public x12(Core.x12 value) + { + Value = value; + } + + public Core.x12 Value { get; } + } + + public sealed class x13 : Char + { + public x13(Core.x13 value) + { + Value = value; + } + + public Core.x13 Value { get; } + } + + public sealed class x14 : Char + { + public x14(Core.x14 value) + { + Value = value; + } + + public Core.x14 Value { get; } + } + + public sealed class x15 : Char + { + public x15(Core.x15 value) + { + Value = value; + } + + public Core.x15 Value { get; } + } + + public sealed class x16 : Char + { + public x16(Core.x16 value) + { + Value = value; + } + + public Core.x16 Value { get; } + } + + public sealed class x17 : Char + { + public x17(Core.x17 value) + { + Value = value; + } + + public Core.x17 Value { get; } + } + + public sealed class x18 : Char + { + public x18(Core.x18 value) + { + Value = value; + } + + public Core.x18 Value { get; } + } + + public sealed class x19 : Char + { + public x19(Core.x19 value) + { + Value = value; + } + + public Core.x19 Value { get; } + } + + public sealed class x1A : Char + { + public x1A(Core.x1A value) + { + Value = value; + } + + public Core.x1A Value { get; } + } + + public sealed class x1B : Char + { + public x1B(Core.x1B value) + { + Value = value; + } + + public Core.x1B Value { get; } + } + + public sealed class x1C : Char + { + public x1C(Core.x1C value) + { + Value = value; + } + + public Core.x1C Value { get; } + } + + public sealed class x1D : Char + { + public x1D(Core.x1D value) + { + Value = value; + } + + public Core.x1D Value { get; } + } + + public sealed class x1E : Char + { + public x1E(Core.x1E value) + { + Value = value; + } + + public Core.x1E Value { get; } + } + + public sealed class x1F : Char + { + public x1F(Core.x1F value) + { + Value = value; + } + + public Core.x1F Value { get; } + } + + public sealed class x20 : Char + { + public x20(Core.x20 value) + { + Value = value; + } + + public Core.x20 Value { get; } + } + + public sealed class x21 : Char + { + public x21(Core.x21 value) + { + Value = value; + } + + public Core.x21 Value { get; } + } + + public sealed class x22 : Char + { + public x22(Core.x22 value) + { + Value = value; + } + + public Core.x22 Value { get; } + } + + public sealed class x23 : Char + { + public x23(Core.x23 value) + { + Value = value; + } + + public Core.x23 Value { get; } + } + + public sealed class x24 : Char + { + public x24(Core.x24 value) + { + Value = value; + } + + public Core.x24 Value { get; } + } + + public sealed class x25 : Char + { + public x25(Core.x25 value) + { + Value = value; + } + + public Core.x25 Value { get; } + } + + public sealed class x26 : Char + { + public x26(Core.x26 value) + { + Value = value; + } + + public Core.x26 Value { get; } + } + + public sealed class x27 : Char + { + public x27(Core.x27 value) + { + Value = value; + } + + public Core.x27 Value { get; } + } + + public sealed class x28 : Char + { + public x28(Core.x28 value) + { + Value = value; + } + + public Core.x28 Value { get; } + } + + public sealed class x29 : Char + { + public x29(Core.x29 value) + { + Value = value; + } + + public Core.x29 Value { get; } + } + + public sealed class x2A : Char + { + public x2A(Core.x2A value) + { + Value = value; + } + + public Core.x2A Value { get; } + } + + public sealed class x2B : Char + { + public x2B(Core.x2B value) + { + Value = value; + } + + public Core.x2B Value { get; } + } + + public sealed class x2C : Char + { + public x2C(Core.x2C value) + { + Value = value; + } + + public Core.x2C Value { get; } + } + + public sealed class x2D : Char + { + public x2D(Core.x2D value) + { + Value = value; + } + + public Core.x2D Value { get; } + } + + public sealed class x2E : Char + { + public x2E(Core.x2E value) + { + Value = value; + } + + public Core.x2E Value { get; } + } + + public sealed class x2F : Char + { + public x2F(Core.x2F value) + { + Value = value; + } + + public Core.x2F Value { get; } + } + + public sealed class x30 : Char + { + public x30(Core.x30 value) + { + Value = value; + } + + public Core.x30 Value { get; } + } + + public sealed class x31 : Char + { + public x31(Core.x31 value) + { + Value = value; + } + + public Core.x31 Value { get; } + } + + public sealed class x32 : Char + { + public x32(Core.x32 value) + { + Value = value; + } + + public Core.x32 Value { get; } + } + + public sealed class x33 : Char + { + public x33(Core.x33 value) + { + Value = value; + } + + public Core.x33 Value { get; } + } + + public sealed class x34 : Char + { + public x34(Core.x34 value) + { + Value = value; + } + + public Core.x34 Value { get; } + } + + public sealed class x35 : Char + { + public x35(Core.x35 value) + { + Value = value; + } + + public Core.x35 Value { get; } + } + + public sealed class x36 : Char + { + public x36(Core.x36 value) + { + Value = value; + } + + public Core.x36 Value { get; } + } + + public sealed class x37 : Char + { + public x37(Core.x37 value) + { + Value = value; + } + + public Core.x37 Value { get; } + } + + public sealed class x38 : Char + { + public x38(Core.x38 value) + { + Value = value; + } + + public Core.x38 Value { get; } + } + + public sealed class x39 : Char + { + public x39(Core.x39 value) + { + Value = value; + } + + public Core.x39 Value { get; } + } + + public sealed class x3A : Char + { + public x3A(Core.x3A value) + { + Value = value; + } + + public Core.x3A Value { get; } + } + + public sealed class x3B : Char + { + public x3B(Core.x3B value) + { + Value = value; + } + + public Core.x3B Value { get; } + } + + public sealed class x3C : Char + { + public x3C(Core.x3C value) + { + Value = value; + } + + public Core.x3C Value { get; } + } + + public sealed class x3D : Char + { + public x3D(Core.x3D value) + { + Value = value; + } + + public Core.x3D Value { get; } + } + + public sealed class x3E : Char + { + public x3E(Core.x3E value) + { + Value = value; + } + + public Core.x3E Value { get; } + } + + public sealed class x3F : Char + { + public x3F(Core.x3F value) + { + Value = value; + } + + public Core.x3F Value { get; } + } + + public sealed class x40 : Char + { + public x40(Core.x40 value) + { + Value = value; + } + + public Core.x40 Value { get; } + } + + public sealed class x41 : Char + { + public x41(Core.x41 value) + { + Value = value; + } + + public Core.x41 Value { get; } + } + + public sealed class x42 : Char + { + public x42(Core.x42 value) + { + Value = value; + } + + public Core.x42 Value { get; } + } + + public sealed class x43 : Char + { + public x43(Core.x43 value) + { + Value = value; + } + + public Core.x43 Value { get; } + } + + public sealed class x44 : Char + { + public x44(Core.x44 value) + { + Value = value; + } + + public Core.x44 Value { get; } + } + + public sealed class x45 : Char + { + public x45(Core.x45 value) + { + Value = value; + } + + public Core.x45 Value { get; } + } + + public sealed class x46 : Char + { + public x46(Core.x46 value) + { + Value = value; + } + + public Core.x46 Value { get; } + } + + public sealed class x47 : Char + { + public x47(Core.x47 value) + { + Value = value; + } + + public Core.x47 Value { get; } + } + + public sealed class x48 : Char + { + public x48(Core.x48 value) + { + Value = value; + } + + public Core.x48 Value { get; } + } + + public sealed class x49 : Char + { + public x49(Core.x49 value) + { + Value = value; + } + + public Core.x49 Value { get; } + } + + public sealed class x4A : Char + { + public x4A(Core.x4A value) + { + Value = value; + } + + public Core.x4A Value { get; } + } + + public sealed class x4B : Char + { + public x4B(Core.x4B value) + { + Value = value; + } + + public Core.x4B Value { get; } + } + + public sealed class x4C : Char + { + public x4C(Core.x4C value) + { + Value = value; + } + + public Core.x4C Value { get; } + } + + public sealed class x4D : Char + { + public x4D(Core.x4D value) + { + Value = value; + } + + public Core.x4D Value { get; } + } + + public sealed class x4E : Char + { + public x4E(Core.x4E value) + { + Value = value; + } + + public Core.x4E Value { get; } + } + + public sealed class x4F : Char + { + public x4F(Core.x4F value) + { + Value = value; + } + + public Core.x4F Value { get; } + } + + public sealed class x50 : Char + { + public x50(Core.x50 value) + { + Value = value; + } + + public Core.x50 Value { get; } + } + + public sealed class x51 : Char + { + public x51(Core.x51 value) + { + Value = value; + } + + public Core.x51 Value { get; } + } + + public sealed class x52 : Char + { + public x52(Core.x52 value) + { + Value = value; + } + + public Core.x52 Value { get; } + } + + public sealed class x53 : Char + { + public x53(Core.x53 value) + { + Value = value; + } + + public Core.x53 Value { get; } + } + + public sealed class x54 : Char + { + public x54(Core.x54 value) + { + Value = value; + } + + public Core.x54 Value { get; } + } + + public sealed class x55 : Char + { + public x55(Core.x55 value) + { + Value = value; + } + + public Core.x55 Value { get; } + } + + public sealed class x56 : Char + { + public x56(Core.x56 value) + { + Value = value; + } + + public Core.x56 Value { get; } + } + + public sealed class x57 : Char + { + public x57(Core.x57 value) + { + Value = value; + } + + public Core.x57 Value { get; } + } + + public sealed class x58 : Char + { + public x58(Core.x58 value) + { + Value = value; + } + + public Core.x58 Value { get; } + } + + public sealed class x59 : Char + { + public x59(Core.x59 value) + { + Value = value; + } + + public Core.x59 Value { get; } + } + + public sealed class x5A : Char + { + public x5A(Core.x5A value) + { + Value = value; + } + + public Core.x5A Value { get; } + } + + public sealed class x5B : Char + { + public x5B(Core.x5B value) + { + Value = value; + } + + public Core.x5B Value { get; } + } + + public sealed class x5C : Char + { + public x5C(Core.x5C value) + { + Value = value; + } + + public Core.x5C Value { get; } + } + + public sealed class x5D : Char + { + public x5D(Core.x5D value) + { + Value = value; + } + + public Core.x5D Value { get; } + } + + public sealed class x5E : Char + { + public x5E(Core.x5E value) + { + Value = value; + } + + public Core.x5E Value { get; } + } + + public sealed class x5F : Char + { + public x5F(Core.x5F value) + { + Value = value; + } + + public Core.x5F Value { get; } + } + + public sealed class x60 : Char + { + public x60(Core.x60 value) + { + Value = value; + } + + public Core.x60 Value { get; } + } + + public sealed class x61 : Char + { + public x61(Core.x61 value) + { + Value = value; + } + + public Core.x61 Value { get; } + } + + public sealed class x62 : Char + { + public x62(Core.x62 value) + { + Value = value; + } + + public Core.x62 Value { get; } + } + + public sealed class x63 : Char + { + public x63(Core.x63 value) + { + Value = value; + } + + public Core.x63 Value { get; } + } + + public sealed class x64 : Char + { + public x64(Core.x64 value) + { + Value = value; + } + + public Core.x64 Value { get; } + } + + public sealed class x65 : Char + { + public x65(Core.x65 value) + { + Value = value; + } + + public Core.x65 Value { get; } + } + + public sealed class x66 : Char + { + public x66(Core.x66 value) + { + Value = value; + } + + public Core.x66 Value { get; } + } + + public sealed class x67 : Char + { + public x67(Core.x67 value) + { + Value = value; + } + + public Core.x67 Value { get; } + } + + public sealed class x68 : Char + { + public x68(Core.x68 value) + { + Value = value; + } + + public Core.x68 Value { get; } + } + + public sealed class x69 : Char + { + public x69(Core.x69 value) + { + Value = value; + } + + public Core.x69 Value { get; } + } + + public sealed class x6A : Char + { + public x6A(Core.x6A value) + { + Value = value; + } + + public Core.x6A Value { get; } + } + + public sealed class x6B : Char + { + public x6B(Core.x6B value) + { + Value = value; + } + + public Core.x6B Value { get; } + } + + public sealed class x6C : Char + { + public x6C(Core.x6C value) + { + Value = value; + } + + public Core.x6C Value { get; } + } + + public sealed class x6D : Char + { + public x6D(Core.x6D value) + { + Value = value; + } + + public Core.x6D Value { get; } + } + + public sealed class x6E : Char + { + public x6E(Core.x6E value) + { + Value = value; + } + + public Core.x6E Value { get; } + } + + public sealed class x6F : Char + { + public x6F(Core.x6F value) + { + Value = value; + } + + public Core.x6F Value { get; } + } + + public sealed class x70 : Char + { + public x70(Core.x70 value) + { + Value = value; + } + + public Core.x70 Value { get; } + } + + public sealed class x71 : Char + { + public x71(Core.x71 value) + { + Value = value; + } + + public Core.x71 Value { get; } + } + + public sealed class x72 : Char + { + public x72(Core.x72 value) + { + Value = value; + } + + public Core.x72 Value { get; } + } + + public sealed class x73 : Char + { + public x73(Core.x73 value) + { + Value = value; + } + + public Core.x73 Value { get; } + } + + public sealed class x74 : Char + { + public x74(Core.x74 value) + { + Value = value; + } + + public Core.x74 Value { get; } + } + + public sealed class x75 : Char + { + public x75(Core.x75 value) + { + Value = value; + } + + public Core.x75 Value { get; } + } + + public sealed class x76 : Char + { + public x76(Core.x76 value) + { + Value = value; + } + + public Core.x76 Value { get; } + } + + public sealed class x77 : Char + { + public x77(Core.x77 value) + { + Value = value; + } + + public Core.x77 Value { get; } + } + + public sealed class x78 : Char + { + public x78(Core.x78 value) + { + Value = value; + } + + public Core.x78 Value { get; } + } + + public sealed class x79 : Char + { + public x79(Core.x79 value) + { + Value = value; + } + + public Core.x79 Value { get; } + } + + public sealed class x7A : Char + { + public x7A(Core.x7A value) + { + Value = value; + } + + public Core.x7A Value { get; } + } + + public sealed class x7B : Char + { + public x7B(Core.x7B value) + { + Value = value; + } + + public Core.x7B Value { get; } + } + + public sealed class x7C : Char + { + public x7C(Core.x7C value) + { + Value = value; + } + + public Core.x7C Value { get; } + } + + public sealed class x7D : Char + { + public x7D(Core.x7D value) + { + Value = value; + } + + public Core.x7D Value { get; } + } + + public sealed class x7E : Char + { + public x7E(Core.x7E value) + { + Value = value; + } + + public Core.x7E Value { get; } + } + + public sealed class x7F : Char + { + public x7F(Core.x7F value) + { + Value = value; + } + + public Core.x7F Value { get; } + } + + } public sealed class x01 From ada3f6787b87a4e26a9a18b40237b68e40eaaf26 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 18:25:50 -0800 Subject: [PATCH 17/71] asdf --- odata.tests/Test1.cs | 4 +- odata/AbnfParser/CstNodes/Core/Vchar.cs | 923 +++++++++++++++++++++++- 2 files changed, 924 insertions(+), 3 deletions(-) diff --git a/odata.tests/Test1.cs b/odata.tests/Test1.cs index efef255d6c..d2fd2d6214 100644 --- a/odata.tests/Test1.cs +++ b/odata.tests/Test1.cs @@ -31,14 +31,14 @@ public void TestMethod1() [TestMethod] public void Generate() { - var start = 0x23; + var start = 0x21; var end = 0x7E; var builder = new StringBuilder(); for (int i = start; i <= end; ++i) { var className = $"x{i:X2}"; - builder.AppendLine($"public sealed class {className} : Inner"); + builder.AppendLine($"public sealed class {className} : Vchar"); builder.AppendLine("{"); builder.AppendLine($"public {className}(Core.{className} value)"); builder.AppendLine("{"); diff --git a/odata/AbnfParser/CstNodes/Core/Vchar.cs b/odata/AbnfParser/CstNodes/Core/Vchar.cs index bd04e21f6e..6892b57eb0 100644 --- a/odata/AbnfParser/CstNodes/Core/Vchar.cs +++ b/odata/AbnfParser/CstNodes/Core/Vchar.cs @@ -4,7 +4,928 @@ public abstract class Vchar { private Vchar() { - //// TODO implement this } + + public sealed class x21 : Vchar + { + public x21(Core.x21 value) + { + Value = value; + } + + public Core.x21 Value { get; } + } + + public sealed class x22 : Vchar + { + public x22(Core.x22 value) + { + Value = value; + } + + public Core.x22 Value { get; } + } + + public sealed class x23 : Vchar + { + public x23(Core.x23 value) + { + Value = value; + } + + public Core.x23 Value { get; } + } + + public sealed class x24 : Vchar + { + public x24(Core.x24 value) + { + Value = value; + } + + public Core.x24 Value { get; } + } + + public sealed class x25 : Vchar + { + public x25(Core.x25 value) + { + Value = value; + } + + public Core.x25 Value { get; } + } + + public sealed class x26 : Vchar + { + public x26(Core.x26 value) + { + Value = value; + } + + public Core.x26 Value { get; } + } + + public sealed class x27 : Vchar + { + public x27(Core.x27 value) + { + Value = value; + } + + public Core.x27 Value { get; } + } + + public sealed class x28 : Vchar + { + public x28(Core.x28 value) + { + Value = value; + } + + public Core.x28 Value { get; } + } + + public sealed class x29 : Vchar + { + public x29(Core.x29 value) + { + Value = value; + } + + public Core.x29 Value { get; } + } + + public sealed class x2A : Vchar + { + public x2A(Core.x2A value) + { + Value = value; + } + + public Core.x2A Value { get; } + } + + public sealed class x2B : Vchar + { + public x2B(Core.x2B value) + { + Value = value; + } + + public Core.x2B Value { get; } + } + + public sealed class x2C : Vchar + { + public x2C(Core.x2C value) + { + Value = value; + } + + public Core.x2C Value { get; } + } + + public sealed class x2D : Vchar + { + public x2D(Core.x2D value) + { + Value = value; + } + + public Core.x2D Value { get; } + } + + public sealed class x2E : Vchar + { + public x2E(Core.x2E value) + { + Value = value; + } + + public Core.x2E Value { get; } + } + + public sealed class x2F : Vchar + { + public x2F(Core.x2F value) + { + Value = value; + } + + public Core.x2F Value { get; } + } + + public sealed class x30 : Vchar + { + public x30(Core.x30 value) + { + Value = value; + } + + public Core.x30 Value { get; } + } + + public sealed class x31 : Vchar + { + public x31(Core.x31 value) + { + Value = value; + } + + public Core.x31 Value { get; } + } + + public sealed class x32 : Vchar + { + public x32(Core.x32 value) + { + Value = value; + } + + public Core.x32 Value { get; } + } + + public sealed class x33 : Vchar + { + public x33(Core.x33 value) + { + Value = value; + } + + public Core.x33 Value { get; } + } + + public sealed class x34 : Vchar + { + public x34(Core.x34 value) + { + Value = value; + } + + public Core.x34 Value { get; } + } + + public sealed class x35 : Vchar + { + public x35(Core.x35 value) + { + Value = value; + } + + public Core.x35 Value { get; } + } + + public sealed class x36 : Vchar + { + public x36(Core.x36 value) + { + Value = value; + } + + public Core.x36 Value { get; } + } + + public sealed class x37 : Vchar + { + public x37(Core.x37 value) + { + Value = value; + } + + public Core.x37 Value { get; } + } + + public sealed class x38 : Vchar + { + public x38(Core.x38 value) + { + Value = value; + } + + public Core.x38 Value { get; } + } + + public sealed class x39 : Vchar + { + public x39(Core.x39 value) + { + Value = value; + } + + public Core.x39 Value { get; } + } + + public sealed class x3A : Vchar + { + public x3A(Core.x3A value) + { + Value = value; + } + + public Core.x3A Value { get; } + } + + public sealed class x3B : Vchar + { + public x3B(Core.x3B value) + { + Value = value; + } + + public Core.x3B Value { get; } + } + + public sealed class x3C : Vchar + { + public x3C(Core.x3C value) + { + Value = value; + } + + public Core.x3C Value { get; } + } + + public sealed class x3D : Vchar + { + public x3D(Core.x3D value) + { + Value = value; + } + + public Core.x3D Value { get; } + } + + public sealed class x3E : Vchar + { + public x3E(Core.x3E value) + { + Value = value; + } + + public Core.x3E Value { get; } + } + + public sealed class x3F : Vchar + { + public x3F(Core.x3F value) + { + Value = value; + } + + public Core.x3F Value { get; } + } + + public sealed class x40 : Vchar + { + public x40(Core.x40 value) + { + Value = value; + } + + public Core.x40 Value { get; } + } + + public sealed class x41 : Vchar + { + public x41(Core.x41 value) + { + Value = value; + } + + public Core.x41 Value { get; } + } + + public sealed class x42 : Vchar + { + public x42(Core.x42 value) + { + Value = value; + } + + public Core.x42 Value { get; } + } + + public sealed class x43 : Vchar + { + public x43(Core.x43 value) + { + Value = value; + } + + public Core.x43 Value { get; } + } + + public sealed class x44 : Vchar + { + public x44(Core.x44 value) + { + Value = value; + } + + public Core.x44 Value { get; } + } + + public sealed class x45 : Vchar + { + public x45(Core.x45 value) + { + Value = value; + } + + public Core.x45 Value { get; } + } + + public sealed class x46 : Vchar + { + public x46(Core.x46 value) + { + Value = value; + } + + public Core.x46 Value { get; } + } + + public sealed class x47 : Vchar + { + public x47(Core.x47 value) + { + Value = value; + } + + public Core.x47 Value { get; } + } + + public sealed class x48 : Vchar + { + public x48(Core.x48 value) + { + Value = value; + } + + public Core.x48 Value { get; } + } + + public sealed class x49 : Vchar + { + public x49(Core.x49 value) + { + Value = value; + } + + public Core.x49 Value { get; } + } + + public sealed class x4A : Vchar + { + public x4A(Core.x4A value) + { + Value = value; + } + + public Core.x4A Value { get; } + } + + public sealed class x4B : Vchar + { + public x4B(Core.x4B value) + { + Value = value; + } + + public Core.x4B Value { get; } + } + + public sealed class x4C : Vchar + { + public x4C(Core.x4C value) + { + Value = value; + } + + public Core.x4C Value { get; } + } + + public sealed class x4D : Vchar + { + public x4D(Core.x4D value) + { + Value = value; + } + + public Core.x4D Value { get; } + } + + public sealed class x4E : Vchar + { + public x4E(Core.x4E value) + { + Value = value; + } + + public Core.x4E Value { get; } + } + + public sealed class x4F : Vchar + { + public x4F(Core.x4F value) + { + Value = value; + } + + public Core.x4F Value { get; } + } + + public sealed class x50 : Vchar + { + public x50(Core.x50 value) + { + Value = value; + } + + public Core.x50 Value { get; } + } + + public sealed class x51 : Vchar + { + public x51(Core.x51 value) + { + Value = value; + } + + public Core.x51 Value { get; } + } + + public sealed class x52 : Vchar + { + public x52(Core.x52 value) + { + Value = value; + } + + public Core.x52 Value { get; } + } + + public sealed class x53 : Vchar + { + public x53(Core.x53 value) + { + Value = value; + } + + public Core.x53 Value { get; } + } + + public sealed class x54 : Vchar + { + public x54(Core.x54 value) + { + Value = value; + } + + public Core.x54 Value { get; } + } + + public sealed class x55 : Vchar + { + public x55(Core.x55 value) + { + Value = value; + } + + public Core.x55 Value { get; } + } + + public sealed class x56 : Vchar + { + public x56(Core.x56 value) + { + Value = value; + } + + public Core.x56 Value { get; } + } + + public sealed class x57 : Vchar + { + public x57(Core.x57 value) + { + Value = value; + } + + public Core.x57 Value { get; } + } + + public sealed class x58 : Vchar + { + public x58(Core.x58 value) + { + Value = value; + } + + public Core.x58 Value { get; } + } + + public sealed class x59 : Vchar + { + public x59(Core.x59 value) + { + Value = value; + } + + public Core.x59 Value { get; } + } + + public sealed class x5A : Vchar + { + public x5A(Core.x5A value) + { + Value = value; + } + + public Core.x5A Value { get; } + } + + public sealed class x5B : Vchar + { + public x5B(Core.x5B value) + { + Value = value; + } + + public Core.x5B Value { get; } + } + + public sealed class x5C : Vchar + { + public x5C(Core.x5C value) + { + Value = value; + } + + public Core.x5C Value { get; } + } + + public sealed class x5D : Vchar + { + public x5D(Core.x5D value) + { + Value = value; + } + + public Core.x5D Value { get; } + } + + public sealed class x5E : Vchar + { + public x5E(Core.x5E value) + { + Value = value; + } + + public Core.x5E Value { get; } + } + + public sealed class x5F : Vchar + { + public x5F(Core.x5F value) + { + Value = value; + } + + public Core.x5F Value { get; } + } + + public sealed class x60 : Vchar + { + public x60(Core.x60 value) + { + Value = value; + } + + public Core.x60 Value { get; } + } + + public sealed class x61 : Vchar + { + public x61(Core.x61 value) + { + Value = value; + } + + public Core.x61 Value { get; } + } + + public sealed class x62 : Vchar + { + public x62(Core.x62 value) + { + Value = value; + } + + public Core.x62 Value { get; } + } + + public sealed class x63 : Vchar + { + public x63(Core.x63 value) + { + Value = value; + } + + public Core.x63 Value { get; } + } + + public sealed class x64 : Vchar + { + public x64(Core.x64 value) + { + Value = value; + } + + public Core.x64 Value { get; } + } + + public sealed class x65 : Vchar + { + public x65(Core.x65 value) + { + Value = value; + } + + public Core.x65 Value { get; } + } + + public sealed class x66 : Vchar + { + public x66(Core.x66 value) + { + Value = value; + } + + public Core.x66 Value { get; } + } + + public sealed class x67 : Vchar + { + public x67(Core.x67 value) + { + Value = value; + } + + public Core.x67 Value { get; } + } + + public sealed class x68 : Vchar + { + public x68(Core.x68 value) + { + Value = value; + } + + public Core.x68 Value { get; } + } + + public sealed class x69 : Vchar + { + public x69(Core.x69 value) + { + Value = value; + } + + public Core.x69 Value { get; } + } + + public sealed class x6A : Vchar + { + public x6A(Core.x6A value) + { + Value = value; + } + + public Core.x6A Value { get; } + } + + public sealed class x6B : Vchar + { + public x6B(Core.x6B value) + { + Value = value; + } + + public Core.x6B Value { get; } + } + + public sealed class x6C : Vchar + { + public x6C(Core.x6C value) + { + Value = value; + } + + public Core.x6C Value { get; } + } + + public sealed class x6D : Vchar + { + public x6D(Core.x6D value) + { + Value = value; + } + + public Core.x6D Value { get; } + } + + public sealed class x6E : Vchar + { + public x6E(Core.x6E value) + { + Value = value; + } + + public Core.x6E Value { get; } + } + + public sealed class x6F : Vchar + { + public x6F(Core.x6F value) + { + Value = value; + } + + public Core.x6F Value { get; } + } + + public sealed class x70 : Vchar + { + public x70(Core.x70 value) + { + Value = value; + } + + public Core.x70 Value { get; } + } + + public sealed class x71 : Vchar + { + public x71(Core.x71 value) + { + Value = value; + } + + public Core.x71 Value { get; } + } + + public sealed class x72 : Vchar + { + public x72(Core.x72 value) + { + Value = value; + } + + public Core.x72 Value { get; } + } + + public sealed class x73 : Vchar + { + public x73(Core.x73 value) + { + Value = value; + } + + public Core.x73 Value { get; } + } + + public sealed class x74 : Vchar + { + public x74(Core.x74 value) + { + Value = value; + } + + public Core.x74 Value { get; } + } + + public sealed class x75 : Vchar + { + public x75(Core.x75 value) + { + Value = value; + } + + public Core.x75 Value { get; } + } + + public sealed class x76 : Vchar + { + public x76(Core.x76 value) + { + Value = value; + } + + public Core.x76 Value { get; } + } + + public sealed class x77 : Vchar + { + public x77(Core.x77 value) + { + Value = value; + } + + public Core.x77 Value { get; } + } + + public sealed class x78 : Vchar + { + public x78(Core.x78 value) + { + Value = value; + } + + public Core.x78 Value { get; } + } + + public sealed class x79 : Vchar + { + public x79(Core.x79 value) + { + Value = value; + } + + public Core.x79 Value { get; } + } + + public sealed class x7A : Vchar + { + public x7A(Core.x7A value) + { + Value = value; + } + + public Core.x7A Value { get; } + } + + public sealed class x7B : Vchar + { + public x7B(Core.x7B value) + { + Value = value; + } + + public Core.x7B Value { get; } + } + + public sealed class x7C : Vchar + { + public x7C(Core.x7C value) + { + Value = value; + } + + public Core.x7C Value { get; } + } + + } } From ed28e4682d4195b027d0c28cd1c8c0810d1efa8b Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 18:30:58 -0800 Subject: [PATCH 18/71] asdf --- odata.tests/Test1.cs | 10 +- odata/AbnfParser/CstNodes/ProseVal.cs | 836 +++++++++++++++++++++++++- 2 files changed, 838 insertions(+), 8 deletions(-) diff --git a/odata.tests/Test1.cs b/odata.tests/Test1.cs index d2fd2d6214..bfcf8515fa 100644 --- a/odata.tests/Test1.cs +++ b/odata.tests/Test1.cs @@ -31,21 +31,25 @@ public void TestMethod1() [TestMethod] public void Generate() { - var start = 0x21; + var start = 0x3F; var end = 0x7E; var builder = new StringBuilder(); for (int i = start; i <= end; ++i) { var className = $"x{i:X2}"; - builder.AppendLine($"public sealed class {className} : Vchar"); + builder.AppendLine($"public sealed class {className} : ProseVal"); builder.AppendLine("{"); - builder.AppendLine($"public {className}(Core.{className} value)"); + builder.AppendLine($"public {className}(Core.x3C lessThan, Core.{className} value, Core.x3E greaterThan)"); builder.AppendLine("{"); + builder.AppendLine("LessThan = lessThan;"); builder.AppendLine("Value = value;"); + builder.AppendLine("GreaterThan = greaterThan;"); builder.AppendLine("}"); builder.AppendLine(); + builder.AppendLine($"public Core.x3C LessThan {{ get; }}"); builder.AppendLine($"public Core.{className} Value {{ get; }}"); + builder.AppendLine($"public Core.x3E GreaterThan {{ get; }}"); builder.AppendLine("}"); builder.AppendLine(); } diff --git a/odata/AbnfParser/CstNodes/ProseVal.cs b/odata/AbnfParser/CstNodes/ProseVal.cs index 9056d652cf..0d1daa36c2 100644 --- a/odata/AbnfParser/CstNodes/ProseVal.cs +++ b/odata/AbnfParser/CstNodes/ProseVal.cs @@ -10,18 +10,844 @@ private ProseVal() public sealed class x20 : ProseVal { - public x20(x3C lessThan, x20 value, x3E greaterThan) + public x20(Core.x3C lessThan, Core.x20 value, Core.x3E greaterThan) { LessThan = lessThan; Value = value; GreaterThan = greaterThan; } - public x3C LessThan { get; } - public x20 Value { get; } - public x3E GreaterThan { get; } + public Core.x3C LessThan { get; } + public Core.x20 Value { get; } + public Core.x3E GreaterThan { get; } } - //// TODO finish this + public sealed class x21 : ProseVal + { + public x21(Core.x3C lessThan, Core.x21 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x21 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x22 : ProseVal + { + public x22(Core.x3C lessThan, Core.x22 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x22 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x23 : ProseVal + { + public x23(Core.x3C lessThan, Core.x23 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x23 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x24 : ProseVal + { + public x24(Core.x3C lessThan, Core.x24 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x24 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x25 : ProseVal + { + public x25(Core.x3C lessThan, Core.x25 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x25 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x26 : ProseVal + { + public x26(Core.x3C lessThan, Core.x26 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x26 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x27 : ProseVal + { + public x27(Core.x3C lessThan, Core.x27 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x27 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x28 : ProseVal + { + public x28(Core.x3C lessThan, Core.x28 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x28 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x29 : ProseVal + { + public x29(Core.x3C lessThan, Core.x29 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x29 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x2A : ProseVal + { + public x2A(Core.x3C lessThan, Core.x2A value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x2A Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x2B : ProseVal + { + public x2B(Core.x3C lessThan, Core.x2B value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x2B Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x2C : ProseVal + { + public x2C(Core.x3C lessThan, Core.x2C value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x2C Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x2D : ProseVal + { + public x2D(Core.x3C lessThan, Core.x2D value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x2D Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x2E : ProseVal + { + public x2E(Core.x3C lessThan, Core.x2E value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x2E Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x2F : ProseVal + { + public x2F(Core.x3C lessThan, Core.x2F value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x2F Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x30 : ProseVal + { + public x30(Core.x3C lessThan, Core.x30 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x30 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x31 : ProseVal + { + public x31(Core.x3C lessThan, Core.x31 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x31 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x32 : ProseVal + { + public x32(Core.x3C lessThan, Core.x32 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x32 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x33 : ProseVal + { + public x33(Core.x3C lessThan, Core.x33 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x33 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x34 : ProseVal + { + public x34(Core.x3C lessThan, Core.x34 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x34 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x35 : ProseVal + { + public x35(Core.x3C lessThan, Core.x35 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x35 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x36 : ProseVal + { + public x36(Core.x3C lessThan, Core.x36 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x36 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x37 : ProseVal + { + public x37(Core.x3C lessThan, Core.x37 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x37 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x38 : ProseVal + { + public x38(Core.x3C lessThan, Core.x38 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x38 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x39 : ProseVal + { + public x39(Core.x3C lessThan, Core.x39 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x39 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x3A : ProseVal + { + public x3A(Core.x3C lessThan, Core.x3A value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x3A Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x3B : ProseVal + { + public x3B(Core.x3C lessThan, Core.x3B value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x3B Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x3C : ProseVal + { + public x3C(Core.x3C lessThan, Core.x3C value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x3C Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x3D : ProseVal + { + public x3D(Core.x3C lessThan, Core.x3D value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x3D Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x3F : ProseVal + { + public x3F(Core.x3C lessThan, Core.x3F value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x3F Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x40 : ProseVal + { + public x40(Core.x3C lessThan, Core.x40 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x40 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x41 : ProseVal + { + public x41(Core.x3C lessThan, Core.x41 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x41 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x42 : ProseVal + { + public x42(Core.x3C lessThan, Core.x42 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x42 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x43 : ProseVal + { + public x43(Core.x3C lessThan, Core.x43 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x43 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x44 : ProseVal + { + public x44(Core.x3C lessThan, Core.x44 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x44 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x45 : ProseVal + { + public x45(Core.x3C lessThan, Core.x45 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x45 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x46 : ProseVal + { + public x46(Core.x3C lessThan, Core.x46 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x46 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x47 : ProseVal + { + public x47(Core.x3C lessThan, Core.x47 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x47 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x48 : ProseVal + { + public x48(Core.x3C lessThan, Core.x48 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x48 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x49 : ProseVal + { + public x49(Core.x3C lessThan, Core.x49 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x49 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x4A : ProseVal + { + public x4A(Core.x3C lessThan, Core.x4A value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x4A Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x4B : ProseVal + { + public x4B(Core.x3C lessThan, Core.x4B value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x4B Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x4C : ProseVal + { + public x4C(Core.x3C lessThan, Core.x4C value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x4C Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x4D : ProseVal + { + public x4D(Core.x3C lessThan, Core.x4D value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x4D Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x4E : ProseVal + { + public x4E(Core.x3C lessThan, Core.x4E value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x4E Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x4F : ProseVal + { + public x4F(Core.x3C lessThan, Core.x4F value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x4F Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x50 : ProseVal + { + public x50(Core.x3C lessThan, Core.x50 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x50 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x51 : ProseVal + { + public x51(Core.x3C lessThan, Core.x51 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x51 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x52 : ProseVal + { + public x52(Core.x3C lessThan, Core.x52 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x52 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x53 : ProseVal + { + public x53(Core.x3C lessThan, Core.x53 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x53 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x54 : ProseVal + { + public x54(Core.x3C lessThan, Core.x54 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x54 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x55 : ProseVal + { + public x55(Core.x3C lessThan, Core.x55 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x55 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x56 : ProseVal + { + public x56(Core.x3C lessThan, Core.x56 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x56 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x57 : ProseVal + { + public x57(Core.x3C lessThan, Core.x57 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x57 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x58 : ProseVal + { + public x58(Core.x3C lessThan, Core.x58 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x58 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x59 : ProseVal + { + public x59(Core.x3C lessThan, Core.x59 value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x59 Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x5A : ProseVal + { + public x5A(Core.x3C lessThan, Core.x5A value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x5A Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x5B : ProseVal + { + public x5B(Core.x3C lessThan, Core.x5B value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x5B Value { get; } + public Core.x3E GreaterThan { get; } + } + + public sealed class x5C : ProseVal + { + public x5C(Core.x3C lessThan, Core.x5C value, Core.x3E greaterThan) + { + LessThan = lessThan; + Value = value; + GreaterThan = greaterThan; + } + + public Core.x3C LessThan { get; } + public Core.x5C Value { get; } + public Core.x3E GreaterThan { get; } + } + + } } From 095e062ae02df2f6a377a31c976e2500e6e20814 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 19:10:04 -0800 Subject: [PATCH 19/71] asfd --- odata.tests/Test1.cs | 24 +- .../CombinatorParsers/Core/AlphaParser.cs | 269 ++++++ .../CombinatorParsers/Core/CharParser.cs | 899 ++++++++++++++++++ .../CombinatorParsers/Core/DigitParser.cs | 60 ++ .../CombinatorParsers/Core/HtabParser.cs | 12 + .../CombinatorParsers/Core/SpParser.cs | 12 + .../CombinatorParsers/Core/WspParser.cs | 20 + .../CombinatorParsers/CwspParser.cs | 10 + .../CombinatorParsers/DefinedAsParser.cs | 10 + .../CombinatorParsers/RuleListParser.cs | 13 + .../CombinatorParsers/RuleNameParser.cs | 34 + .../CombinatorParsers/RuleParser.cs | 10 + 12 files changed, 1357 insertions(+), 16 deletions(-) create mode 100644 odata/AbnfParser/CombinatorParsers/Core/AlphaParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/Core/CharParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/Core/DigitParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/Core/HtabParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/Core/SpParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/Core/WspParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/CwspParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/DefinedAsParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/RuleListParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/RuleNameParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/RuleParser.cs diff --git a/odata.tests/Test1.cs b/odata.tests/Test1.cs index bfcf8515fa..2faffd800f 100644 --- a/odata.tests/Test1.cs +++ b/odata.tests/Test1.cs @@ -31,27 +31,19 @@ public void TestMethod1() [TestMethod] public void Generate() { - var start = 0x3F; - var end = 0x7E; + var start = 0x61; + var end = 0x7A; var builder = new StringBuilder(); for (int i = start; i <= end; ++i) { var className = $"x{i:X2}"; - builder.AppendLine($"public sealed class {className} : ProseVal"); - builder.AppendLine("{"); - builder.AppendLine($"public {className}(Core.x3C lessThan, Core.{className} value, Core.x3E greaterThan)"); - builder.AppendLine("{"); - builder.AppendLine("LessThan = lessThan;"); - builder.AppendLine("Value = value;"); - builder.AppendLine("GreaterThan = greaterThan;"); - builder.AppendLine("}"); - builder.AppendLine(); - builder.AppendLine($"public Core.x3C LessThan {{ get; }}"); - builder.AppendLine($"public Core.{className} Value {{ get; }}"); - builder.AppendLine($"public Core.x3E GreaterThan {{ get; }}"); - builder.AppendLine("}"); - builder.AppendLine(); + /*builder.AppendLine($"public static Parser {className} {{ get; }} ="); + builder.AppendLine($"\tfrom value in {className}Parser.Instance"); + builder.AppendLine($"\tselect new Alpha.{className}(value);"); + builder.AppendLine();*/ + + builder.AppendLine($".Or({className})"); } File.WriteAllText(@"C:\Users\gdebruin\code.txt", builder.ToString()); diff --git a/odata/AbnfParser/CombinatorParsers/Core/AlphaParser.cs b/odata/AbnfParser/CombinatorParsers/Core/AlphaParser.cs new file mode 100644 index 0000000000..126685802c --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/Core/AlphaParser.cs @@ -0,0 +1,269 @@ +namespace AbnfParser.CombinatorParsers.Core +{ + using AbnfParser.CstNodes.Core; + using Sprache; + + public static class AlphaParser + { + public static Parser x41 { get; } = + from value in x41Parser.Instance + select new Alpha.x41(value); + + public static Parser x42 { get; } = + from value in x42Parser.Instance + select new Alpha.x42(value); + + public static Parser x43 { get; } = + from value in x43Parser.Instance + select new Alpha.x43(value); + + public static Parser x44 { get; } = + from value in x44Parser.Instance + select new Alpha.x44(value); + + public static Parser x45 { get; } = + from value in x45Parser.Instance + select new Alpha.x45(value); + + public static Parser x46 { get; } = + from value in x46Parser.Instance + select new Alpha.x46(value); + + public static Parser x47 { get; } = + from value in x47Parser.Instance + select new Alpha.x47(value); + + public static Parser x48 { get; } = + from value in x48Parser.Instance + select new Alpha.x48(value); + + public static Parser x49 { get; } = + from value in x49Parser.Instance + select new Alpha.x49(value); + + public static Parser x4A { get; } = + from value in x4AParser.Instance + select new Alpha.x4A(value); + + public static Parser x4B { get; } = + from value in x4BParser.Instance + select new Alpha.x4B(value); + + public static Parser x4C { get; } = + from value in x4CParser.Instance + select new Alpha.x4C(value); + + public static Parser x4D { get; } = + from value in x4DParser.Instance + select new Alpha.x4D(value); + + public static Parser x4E { get; } = + from value in x4EParser.Instance + select new Alpha.x4E(value); + + public static Parser x4F { get; } = + from value in x4FParser.Instance + select new Alpha.x4F(value); + + public static Parser x50 { get; } = + from value in x50Parser.Instance + select new Alpha.x50(value); + + public static Parser x51 { get; } = + from value in x51Parser.Instance + select new Alpha.x51(value); + + public static Parser x52 { get; } = + from value in x52Parser.Instance + select new Alpha.x52(value); + + public static Parser x53 { get; } = + from value in x53Parser.Instance + select new Alpha.x53(value); + + public static Parser x54 { get; } = + from value in x54Parser.Instance + select new Alpha.x54(value); + + public static Parser x55 { get; } = + from value in x55Parser.Instance + select new Alpha.x55(value); + + public static Parser x56 { get; } = + from value in x56Parser.Instance + select new Alpha.x56(value); + + public static Parser x57 { get; } = + from value in x57Parser.Instance + select new Alpha.x57(value); + + public static Parser x58 { get; } = + from value in x58Parser.Instance + select new Alpha.x58(value); + + public static Parser x59 { get; } = + from value in x59Parser.Instance + select new Alpha.x59(value); + + public static Parser x5A { get; } = + from value in x5AParser.Instance + select new Alpha.x5A(value); + + public static Parser x61 { get; } = + from value in x61Parser.Instance + select new Alpha.x61(value); + + public static Parser x62 { get; } = + from value in x62Parser.Instance + select new Alpha.x62(value); + + public static Parser x63 { get; } = + from value in x63Parser.Instance + select new Alpha.x63(value); + + public static Parser x64 { get; } = + from value in x64Parser.Instance + select new Alpha.x64(value); + + public static Parser x65 { get; } = + from value in x65Parser.Instance + select new Alpha.x65(value); + + public static Parser x66 { get; } = + from value in x66Parser.Instance + select new Alpha.x66(value); + + public static Parser x67 { get; } = + from value in x67Parser.Instance + select new Alpha.x67(value); + + public static Parser x68 { get; } = + from value in x68Parser.Instance + select new Alpha.x68(value); + + public static Parser x69 { get; } = + from value in x69Parser.Instance + select new Alpha.x69(value); + + public static Parser x6A { get; } = + from value in x6AParser.Instance + select new Alpha.x6A(value); + + public static Parser x6B { get; } = + from value in x6BParser.Instance + select new Alpha.x6B(value); + + public static Parser x6C { get; } = + from value in x6CParser.Instance + select new Alpha.x6C(value); + + public static Parser x6D { get; } = + from value in x6DParser.Instance + select new Alpha.x6D(value); + + public static Parser x6E { get; } = + from value in x6EParser.Instance + select new Alpha.x6E(value); + + public static Parser x6F { get; } = + from value in x6FParser.Instance + select new Alpha.x6F(value); + + public static Parser x70 { get; } = + from value in x70Parser.Instance + select new Alpha.x70(value); + + public static Parser x71 { get; } = + from value in x71Parser.Instance + select new Alpha.x71(value); + + public static Parser x72 { get; } = + from value in x72Parser.Instance + select new Alpha.x72(value); + + public static Parser x73 { get; } = + from value in x73Parser.Instance + select new Alpha.x73(value); + + public static Parser x74 { get; } = + from value in x74Parser.Instance + select new Alpha.x74(value); + + public static Parser x75 { get; } = + from value in x75Parser.Instance + select new Alpha.x75(value); + + public static Parser x76 { get; } = + from value in x76Parser.Instance + select new Alpha.x76(value); + + public static Parser x77 { get; } = + from value in x77Parser.Instance + select new Alpha.x77(value); + + public static Parser x78 { get; } = + from value in x78Parser.Instance + select new Alpha.x78(value); + + public static Parser x79 { get; } = + from value in x79Parser.Instance + select new Alpha.x79(value); + + public static Parser x7A { get; } = + from value in x7AParser.Instance + select new Alpha.x7A(value); + + public static Parser Instance { get; } = + x41 + .Or(x42).Or(x43) + .Or(x44) + .Or(x45) + .Or(x46) + .Or(x47) + .Or(x48) + .Or(x49) + .Or(x4A) + .Or(x4B) + .Or(x4C) + .Or(x4D) + .Or(x4E) + .Or(x4F) + .Or(x50) + .Or(x51) + .Or(x52) + .Or(x53) + .Or(x54) + .Or(x55) + .Or(x56) + .Or(x57) + .Or(x58) + .Or(x59) + .Or(x5A) + .Or(x61) + .Or(x62) + .Or(x63) + .Or(x64) + .Or(x65) + .Or(x66) + .Or(x67) + .Or(x68) + .Or(x69) + .Or(x6A) + .Or(x6B) + .Or(x6C) + .Or(x6D) + .Or(x6E) + .Or(x6F) + .Or(x70) + .Or(x71) + .Or(x72) + .Or(x73) + .Or(x74) + .Or(x75) + .Or(x76) + .Or(x77) + .Or(x78) + .Or(x79) + .Or(x7A); + } +} diff --git a/odata/AbnfParser/CombinatorParsers/Core/CharParser.cs b/odata/AbnfParser/CombinatorParsers/Core/CharParser.cs new file mode 100644 index 0000000000..b81c96f500 --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/Core/CharParser.cs @@ -0,0 +1,899 @@ +namespace AbnfParser.CombinatorParsers.Core +{ + using AbnfParser.CstNodes.Core; + using Sprache; + + public static class CharParser + { + //// TODO implement this + } + + public static class x01Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x01) + .Return(x01.Instance); + } + + public static class x02Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x02) + .Return(x02.Instance); + } + + public static class x03Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x03) + .Return(x03.Instance); + } + + public static class x04Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x04) + .Return(x04.Instance); + } + + public static class x05Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x05) + .Return(x05.Instance); + } + + public static class x06Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x06) + .Return(x06.Instance); + } + + public static class x07Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x07) + .Return(x07.Instance); + } + + public static class x08Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x08) + .Return(x08.Instance); + } + + public static class x09Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x09) + .Return(x09.Instance); + } + + public static class x0AParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x0A) + .Return(x0A.Instance); + } + + public static class x0BParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x0B) + .Return(x0B.Instance); + } + + public static class x0CParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x0C) + .Return(x0C.Instance); + } + + public static class x0DParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x0D) + .Return(x0D.Instance); + } + + public static class x0EParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x0E) + .Return(x0E.Instance); + } + + public static class x0FParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x0F) + .Return(x0F.Instance); + } + + public static class x10Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x10) + .Return(x10.Instance); + } + + public static class x11Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x11) + .Return(x11.Instance); + } + + public static class x12Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x12) + .Return(x12.Instance); + } + + public static class x13Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x13) + .Return(x13.Instance); + } + + public static class x14Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x14) + .Return(x14.Instance); + } + + public static class x15Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x15) + .Return(x15.Instance); + } + + public static class x16Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x16) + .Return(x16.Instance); + } + + public static class x17Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x17) + .Return(x17.Instance); + } + + public static class x18Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x18) + .Return(x18.Instance); + } + + public static class x19Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x19) + .Return(x19.Instance); + } + + public static class x1AParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x1A) + .Return(x1A.Instance); + } + + public static class x1BParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x1B) + .Return(x1B.Instance); + } + + public static class x1CParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x1C) + .Return(x1C.Instance); + } + + public static class x1DParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x1D) + .Return(x1D.Instance); + } + + public static class x1EParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x1E) + .Return(x1E.Instance); + } + + public static class x1FParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x1F) + .Return(x1F.Instance); + } + + public static class x20Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x20) + .Return(x20.Instance); + } + + public static class x21Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x21) + .Return(x21.Instance); + } + + public static class x22Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x22) + .Return(x22.Instance); + } + + public static class x23Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x23) + .Return(x23.Instance); + } + + public static class x24Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x24) + .Return(x24.Instance); + } + + public static class x25Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x25) + .Return(x25.Instance); + } + + public static class x26Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x26) + .Return(x26.Instance); + } + + public static class x27Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x27) + .Return(x27.Instance); + } + + public static class x28Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x28) + .Return(x28.Instance); + } + + public static class x29Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x29) + .Return(x29.Instance); + } + + public static class x2AParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x2A) + .Return(x2A.Instance); + } + + public static class x2BParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x2B) + .Return(x2B.Instance); + } + + public static class x2CParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x2C) + .Return(x2C.Instance); + } + + public static class x2DParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x2D) + .Return(x2D.Instance); + } + + public static class x2EParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x2E) + .Return(x2E.Instance); + } + + public static class x2FParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x2F) + .Return(x2F.Instance); + } + + public static class x30Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x30) + .Return(x30.Instance); + } + + public static class x31Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x31) + .Return(x31.Instance); + } + + public static class x32Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x32) + .Return(x32.Instance); + } + + public static class x33Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x33) + .Return(x33.Instance); + } + + public static class x34Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x34) + .Return(x34.Instance); + } + + public static class x35Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x35) + .Return(x35.Instance); + } + + public static class x36Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x36) + .Return(x36.Instance); + } + + public static class x37Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x37) + .Return(x37.Instance); + } + + public static class x38Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x38) + .Return(x38.Instance); + } + + public static class x39Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x39) + .Return(x39.Instance); + } + + public static class x3AParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x3A) + .Return(x3A.Instance); + } + + public static class x3BParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x3B) + .Return(x3B.Instance); + } + + public static class x3CParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x3C) + .Return(x3C.Instance); + } + + public static class x3DParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x3D) + .Return(x3D.Instance); + } + + public static class x3EParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x3E) + .Return(x3E.Instance); + } + + public static class x3FParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x3F) + .Return(x3F.Instance); + } + + public static class x40Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x40) + .Return(x40.Instance); + } + + public static class x41Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x41) + .Return(x41.Instance); + } + + public static class x42Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x42) + .Return(x42.Instance); + } + + public static class x43Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x43) + .Return(x43.Instance); + } + + public static class x44Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x44) + .Return(x44.Instance); + } + + public static class x45Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x45) + .Return(x45.Instance); + } + + public static class x46Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x46) + .Return(x46.Instance); + } + + public static class x47Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x47) + .Return(x47.Instance); + } + + public static class x48Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x48) + .Return(x48.Instance); + } + + public static class x49Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x49) + .Return(x49.Instance); + } + + public static class x4AParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x4A) + .Return(x4A.Instance); + } + + public static class x4BParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x4B) + .Return(x4B.Instance); + } + + public static class x4CParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x4C) + .Return(x4C.Instance); + } + + public static class x4DParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x4D) + .Return(x4D.Instance); + } + + public static class x4EParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x4E) + .Return(x4E.Instance); + } + + public static class x4FParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x4F) + .Return(x4F.Instance); + } + + public static class x50Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x50) + .Return(x50.Instance); + } + + public static class x51Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x51) + .Return(x51.Instance); + } + + public static class x52Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x52) + .Return(x52.Instance); + } + + public static class x53Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x53) + .Return(x53.Instance); + } + + public static class x54Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x54) + .Return(x54.Instance); + } + + public static class x55Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x55) + .Return(x55.Instance); + } + + public static class x56Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x56) + .Return(x56.Instance); + } + + public static class x57Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x57) + .Return(x57.Instance); + } + + public static class x58Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x58) + .Return(x58.Instance); + } + + public static class x59Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x59) + .Return(x59.Instance); + } + + public static class x5AParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x5A) + .Return(x5A.Instance); + } + + public static class x5BParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x5B) + .Return(x5B.Instance); + } + + public static class x5CParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x5C) + .Return(x5C.Instance); + } + + public static class x5DParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x5D) + .Return(x5D.Instance); + } + + public static class x5EParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x5E) + .Return(x5E.Instance); + } + + public static class x5FParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x5F) + .Return(x5F.Instance); + } + + public static class x60Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x60) + .Return(x60.Instance); + } + + public static class x61Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x61) + .Return(x61.Instance); + } + + public static class x62Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x62) + .Return(x62.Instance); + } + + public static class x63Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x63) + .Return(x63.Instance); + } + + public static class x64Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x64) + .Return(x64.Instance); + } + + public static class x65Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x65) + .Return(x65.Instance); + } + + public static class x66Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x66) + .Return(x66.Instance); + } + + public static class x67Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x67) + .Return(x67.Instance); + } + + public static class x68Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x68) + .Return(x68.Instance); + } + + public static class x69Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x69) + .Return(x69.Instance); + } + + public static class x6AParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x6A) + .Return(x6A.Instance); + } + + public static class x6BParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x6B) + .Return(x6B.Instance); + } + + public static class x6CParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x6C) + .Return(x6C.Instance); + } + + public static class x6DParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x6D) + .Return(x6D.Instance); + } + + public static class x6EParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x6E) + .Return(x6E.Instance); + } + + public static class x6FParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x6F) + .Return(x6F.Instance); + } + + public static class x70Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x70) + .Return(x70.Instance); + } + + public static class x71Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x71) + .Return(x71.Instance); + } + + public static class x72Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x72) + .Return(x72.Instance); + } + + public static class x73Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x73) + .Return(x73.Instance); + } + + public static class x74Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x74) + .Return(x74.Instance); + } + + public static class x75Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x75) + .Return(x75.Instance); + } + + public static class x76Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x76) + .Return(x76.Instance); + } + + public static class x77Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x77) + .Return(x77.Instance); + } + + public static class x78Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x78) + .Return(x78.Instance); + } + + public static class x79Parser + { + public static Parser Instance { get; } = Parse + .Char((char)0x79) + .Return(x79.Instance); + } + + public static class x7AParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x7A) + .Return(x7A.Instance); + } + + public static class x7BParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x7B) + .Return(x7B.Instance); + } + + public static class x7CParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x7C) + .Return(x7C.Instance); + } + + public static class x7DParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x7D) + .Return(x7D.Instance); + } + + public static class x7EParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x7E) + .Return(x7E.Instance); + } + + public static class x7FParser + { + public static Parser Instance { get; } = Parse + .Char((char)0x7F) + .Return(x7F.Instance); + } +} diff --git a/odata/AbnfParser/CombinatorParsers/Core/DigitParser.cs b/odata/AbnfParser/CombinatorParsers/Core/DigitParser.cs new file mode 100644 index 0000000000..eb62cfb768 --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/Core/DigitParser.cs @@ -0,0 +1,60 @@ +namespace AbnfParser.CombinatorParsers.Core +{ + using AbnfParser.CstNodes.Core; + using Sprache; + + public static class DigitParser + { + public static Parser x30 { get; } = + from value in x30Parser.Instance + select new Digit.x30(value); + + public static Parser x31 { get; } = + from value in x31Parser.Instance + select new Digit.x31(value); + + public static Parser x32 { get; } = + from value in x32Parser.Instance + select new Digit.x32(value); + + public static Parser x33 { get; } = + from value in x33Parser.Instance + select new Digit.x33(value); + + public static Parser x34 { get; } = + from value in x34Parser.Instance + select new Digit.x34(value); + + public static Parser x35 { get; } = + from value in x35Parser.Instance + select new Digit.x35(value); + + public static Parser x36 { get; } = + from value in x36Parser.Instance + select new Digit.x36(value); + + public static Parser x37 { get; } = + from value in x37Parser.Instance + select new Digit.x37(value); + + public static Parser x38 { get; } = + from value in x38Parser.Instance + select new Digit.x38(value); + + public static Parser x39 { get; } = + from value in x39Parser.Instance + select new Digit.x39(value); + + public static Parser Instance { get; } = + x30 + .Or(x31) + .Or(x32) + .Or(x33) + .Or(x34) + .Or(x35) + .Or(x36) + .Or(x37) + .Or(x38) + .Or(x39); + } +} diff --git a/odata/AbnfParser/CombinatorParsers/Core/HtabParser.cs b/odata/AbnfParser/CombinatorParsers/Core/HtabParser.cs new file mode 100644 index 0000000000..22e3952b9d --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/Core/HtabParser.cs @@ -0,0 +1,12 @@ +namespace AbnfParser.CombinatorParsers.Core +{ + using AbnfParser.CstNodes.Core; + using Sprache; + + public static class HtabParser + { + public static Parser Instance { get; } = + from value in x09Parser.Instance + select new Htab(value); + } +} diff --git a/odata/AbnfParser/CombinatorParsers/Core/SpParser.cs b/odata/AbnfParser/CombinatorParsers/Core/SpParser.cs new file mode 100644 index 0000000000..09e0b7222c --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/Core/SpParser.cs @@ -0,0 +1,12 @@ +namespace AbnfParser.CombinatorParsers.Core +{ + using AbnfParser.CstNodes.Core; + using Sprache; + + public static class SpParser + { + public static Parser Instance { get; } = + from value in x20Parser.Instance + select new Sp(value); + } +} diff --git a/odata/AbnfParser/CombinatorParsers/Core/WspParser.cs b/odata/AbnfParser/CombinatorParsers/Core/WspParser.cs new file mode 100644 index 0000000000..f2db5d43c8 --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/Core/WspParser.cs @@ -0,0 +1,20 @@ +namespace AbnfParser.CombinatorParsers.Core +{ + using AbnfParser.CstNodes.Core; + using Sprache; + + public static class WspParser + { + public static Parser Space { get; } = + from sp in SpParser.Instance + select new Wsp.Space(sp); + + public static Parser Tab { get; } = + from htab in HtabParser.Instance + select new Wsp.Tab(htab); + + public static Parser Instance { get; } = + Space + .Or(Tab); + } +} diff --git a/odata/AbnfParser/CombinatorParsers/CwspParser.cs b/odata/AbnfParser/CombinatorParsers/CwspParser.cs new file mode 100644 index 0000000000..3c328421ac --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/CwspParser.cs @@ -0,0 +1,10 @@ +namespace AbnfParser.CombinatorParsers +{ + using AbnfParser.CstNodes; + using Sprache; + + public static class CwspParser + { + public static Parser WspOnly { get; } + } +} diff --git a/odata/AbnfParser/CombinatorParsers/DefinedAsParser.cs b/odata/AbnfParser/CombinatorParsers/DefinedAsParser.cs new file mode 100644 index 0000000000..db477aac0a --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/DefinedAsParser.cs @@ -0,0 +1,10 @@ +namespace AbnfParser.CombinatorParsers +{ + using AbnfParser.CstNodes; + using Sprache; + + public static class DefinedAsParser + { + public static Parser Declaration { get; } + } +} diff --git a/odata/AbnfParser/CombinatorParsers/RuleListParser.cs b/odata/AbnfParser/CombinatorParsers/RuleListParser.cs new file mode 100644 index 0000000000..e65f6a90fb --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/RuleListParser.cs @@ -0,0 +1,13 @@ +namespace AbnfParser.CombinatorParsers +{ + using AbnfParser.CstNodes; + using Sprache; + + public static class RuleListParser + { + public static class Inner + { + public static Parser RuleInner { get; } + } + } +} diff --git a/odata/AbnfParser/CombinatorParsers/RuleNameParser.cs b/odata/AbnfParser/CombinatorParsers/RuleNameParser.cs new file mode 100644 index 0000000000..dcbd457ff9 --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/RuleNameParser.cs @@ -0,0 +1,34 @@ +namespace AbnfParser.CombinatorParsers +{ + using AbnfParser.CombinatorParsers.Core; + using AbnfParser.CstNodes; + using Sprache; + + public static class RuleNameParser + { + public static Parser Instance { get; } = + from alpha in AlphaParser.Instance + from inners in Parse.Many(InnerParser.Instance) + select new RuleName(alpha, inners); + + public static class InnerParser + { + public static Parser AlphaInner { get; } = + from alpha in AlphaParser.Instance + select new RuleName.Inner.AlphaInner(alpha); + + public static Parser DigitInner { get; } = + from digit in DigitParser.Instance + select new RuleName.Inner.DigitInner(digit); + + public static Parser DashInner { get; } = + from dash in x2DParser.Instance + select new RuleName.Inner.DashInner(dash); + + public static Parser Instance { get; } = + AlphaInner + .Or(DigitInner) + .Or(DashInner); + } + } +} diff --git a/odata/AbnfParser/CombinatorParsers/RuleParser.cs b/odata/AbnfParser/CombinatorParsers/RuleParser.cs new file mode 100644 index 0000000000..80ac2f3a78 --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/RuleParser.cs @@ -0,0 +1,10 @@ +namespace AbnfParser.CombinatorParsers +{ + using AbnfParser.CstNodes; + using Sprache; + + public static class RuleParser + { + public static Parser Instance { get; } + } +} From 4139e6a4d740d899326235b2575ecb626ff637d9 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 19:21:56 -0800 Subject: [PATCH 20/71] asfd --- odata.tests/Test1.cs | 8 +- .../AbnfParser/CombinatorParsers/CnlParser.cs | 10 + .../CombinatorParsers/CommentParser.cs | 27 + .../CombinatorParsers/Core/CrParser.cs | 12 + .../CombinatorParsers/Core/CrlfParser.cs | 10 + .../CombinatorParsers/Core/LfParser.cs | 12 + .../CombinatorParsers/Core/VcharParser.cs | 480 ++++++++++++++++++ .../CombinatorParsers/CwspParser.cs | 7 +- odata/AbnfParser/CstNodes/Core/Vchar.cs | 18 + 9 files changed, 579 insertions(+), 5 deletions(-) create mode 100644 odata/AbnfParser/CombinatorParsers/CnlParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/CommentParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/Core/CrParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/Core/CrlfParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/Core/LfParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/Core/VcharParser.cs diff --git a/odata.tests/Test1.cs b/odata.tests/Test1.cs index 2faffd800f..e39f188b85 100644 --- a/odata.tests/Test1.cs +++ b/odata.tests/Test1.cs @@ -31,16 +31,16 @@ public void TestMethod1() [TestMethod] public void Generate() { - var start = 0x61; - var end = 0x7A; + var start = 0x23; + var end = 0x7E; var builder = new StringBuilder(); for (int i = start; i <= end; ++i) { var className = $"x{i:X2}"; - /*builder.AppendLine($"public static Parser {className} {{ get; }} ="); + /*builder.AppendLine($"public static Parser {className} {{ get; }} ="); builder.AppendLine($"\tfrom value in {className}Parser.Instance"); - builder.AppendLine($"\tselect new Alpha.{className}(value);"); + builder.AppendLine($"\tselect new Vchar.{className}(value);"); builder.AppendLine();*/ builder.AppendLine($".Or({className})"); diff --git a/odata/AbnfParser/CombinatorParsers/CnlParser.cs b/odata/AbnfParser/CombinatorParsers/CnlParser.cs new file mode 100644 index 0000000000..9b8bbe3781 --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/CnlParser.cs @@ -0,0 +1,10 @@ +namespace AbnfParser.CombinatorParsers +{ + using AbnfParser.CstNodes; + using Sprache; + + public static class CnlParser + { + public static Parser Comment { get; } + } +} diff --git a/odata/AbnfParser/CombinatorParsers/CommentParser.cs b/odata/AbnfParser/CombinatorParsers/CommentParser.cs new file mode 100644 index 0000000000..c996df6e12 --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/CommentParser.cs @@ -0,0 +1,27 @@ +namespace AbnfParser.CombinatorParsers +{ + using AbnfParser.CombinatorParsers.Core; + using AbnfParser.CstNodes; + using AbnfParser.CstNodes.Core; + using Sprache; + + public static class CommentParser + { + public static Parser Instance { get; } + + public static class InnerParser + { + public static Parser InnerWsp { get; } = + from wsp in WspParser.Instance + select new Comment.Inner.InnerWsp(wsp); + + public static Parser InnerVchar { get; } = + from vchar in VcharParser.Instance + select new Comment.Inner.InnerVchar(vchar); + + public static Parser Instance { get; } = + InnerWsp + .Or(InnerVchar); + } + } +} diff --git a/odata/AbnfParser/CombinatorParsers/Core/CrParser.cs b/odata/AbnfParser/CombinatorParsers/Core/CrParser.cs new file mode 100644 index 0000000000..72695c0bca --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/Core/CrParser.cs @@ -0,0 +1,12 @@ +namespace AbnfParser.CombinatorParsers.Core +{ + using AbnfParser.CstNodes.Core; + using Sprache; + + public static class CrParser + { + public static Parser Instance { get; } = + from value in x0DParser.Instance + select new Cr(value); + } +} diff --git a/odata/AbnfParser/CombinatorParsers/Core/CrlfParser.cs b/odata/AbnfParser/CombinatorParsers/Core/CrlfParser.cs new file mode 100644 index 0000000000..43f831621e --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/Core/CrlfParser.cs @@ -0,0 +1,10 @@ +namespace AbnfParser.CombinatorParsers.Core +{ + using AbnfParser.CstNodes.Core; + using Sprache; + + public static class CrlfParser + { + public static Parser Instance { get; } + } +} diff --git a/odata/AbnfParser/CombinatorParsers/Core/LfParser.cs b/odata/AbnfParser/CombinatorParsers/Core/LfParser.cs new file mode 100644 index 0000000000..fca36b0458 --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/Core/LfParser.cs @@ -0,0 +1,12 @@ +namespace AbnfParser.CombinatorParsers.Core +{ + using AbnfParser.CstNodes.Core; + using Sprache; + + public static class LfParser + { + public static Parser Instance { get; } = + from value in x0AParser.Instance + select new Lf(value); + } +} diff --git a/odata/AbnfParser/CombinatorParsers/Core/VcharParser.cs b/odata/AbnfParser/CombinatorParsers/Core/VcharParser.cs new file mode 100644 index 0000000000..9934880b44 --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/Core/VcharParser.cs @@ -0,0 +1,480 @@ +namespace AbnfParser.CombinatorParsers.Core +{ + using AbnfParser.CstNodes.Core; + using Sprache; + + public static class VcharParser + { + public static Parser x21 { get; } = + from value in x21Parser.Instance + select new Vchar.x21(value); + + public static Parser x22 { get; } = + from value in x22Parser.Instance + select new Vchar.x22(value); + + public static Parser x23 { get; } = + from value in x23Parser.Instance + select new Vchar.x23(value); + + public static Parser x24 { get; } = + from value in x24Parser.Instance + select new Vchar.x24(value); + + public static Parser x25 { get; } = + from value in x25Parser.Instance + select new Vchar.x25(value); + + public static Parser x26 { get; } = + from value in x26Parser.Instance + select new Vchar.x26(value); + + public static Parser x27 { get; } = + from value in x27Parser.Instance + select new Vchar.x27(value); + + public static Parser x28 { get; } = + from value in x28Parser.Instance + select new Vchar.x28(value); + + public static Parser x29 { get; } = + from value in x29Parser.Instance + select new Vchar.x29(value); + + public static Parser x2A { get; } = + from value in x2AParser.Instance + select new Vchar.x2A(value); + + public static Parser x2B { get; } = + from value in x2BParser.Instance + select new Vchar.x2B(value); + + public static Parser x2C { get; } = + from value in x2CParser.Instance + select new Vchar.x2C(value); + + public static Parser x2D { get; } = + from value in x2DParser.Instance + select new Vchar.x2D(value); + + public static Parser x2E { get; } = + from value in x2EParser.Instance + select new Vchar.x2E(value); + + public static Parser x2F { get; } = + from value in x2FParser.Instance + select new Vchar.x2F(value); + + public static Parser x30 { get; } = + from value in x30Parser.Instance + select new Vchar.x30(value); + + public static Parser x31 { get; } = + from value in x31Parser.Instance + select new Vchar.x31(value); + + public static Parser x32 { get; } = + from value in x32Parser.Instance + select new Vchar.x32(value); + + public static Parser x33 { get; } = + from value in x33Parser.Instance + select new Vchar.x33(value); + + public static Parser x34 { get; } = + from value in x34Parser.Instance + select new Vchar.x34(value); + + public static Parser x35 { get; } = + from value in x35Parser.Instance + select new Vchar.x35(value); + + public static Parser x36 { get; } = + from value in x36Parser.Instance + select new Vchar.x36(value); + + public static Parser x37 { get; } = + from value in x37Parser.Instance + select new Vchar.x37(value); + + public static Parser x38 { get; } = + from value in x38Parser.Instance + select new Vchar.x38(value); + + public static Parser x39 { get; } = + from value in x39Parser.Instance + select new Vchar.x39(value); + + public static Parser x3A { get; } = + from value in x3AParser.Instance + select new Vchar.x3A(value); + + public static Parser x3B { get; } = + from value in x3BParser.Instance + select new Vchar.x3B(value); + + public static Parser x3C { get; } = + from value in x3CParser.Instance + select new Vchar.x3C(value); + + public static Parser x3D { get; } = + from value in x3DParser.Instance + select new Vchar.x3D(value); + + public static Parser x3E { get; } = + from value in x3EParser.Instance + select new Vchar.x3E(value); + + public static Parser x3F { get; } = + from value in x3FParser.Instance + select new Vchar.x3F(value); + + public static Parser x40 { get; } = + from value in x40Parser.Instance + select new Vchar.x40(value); + + public static Parser x41 { get; } = + from value in x41Parser.Instance + select new Vchar.x41(value); + + public static Parser x42 { get; } = + from value in x42Parser.Instance + select new Vchar.x42(value); + + public static Parser x43 { get; } = + from value in x43Parser.Instance + select new Vchar.x43(value); + + public static Parser x44 { get; } = + from value in x44Parser.Instance + select new Vchar.x44(value); + + public static Parser x45 { get; } = + from value in x45Parser.Instance + select new Vchar.x45(value); + + public static Parser x46 { get; } = + from value in x46Parser.Instance + select new Vchar.x46(value); + + public static Parser x47 { get; } = + from value in x47Parser.Instance + select new Vchar.x47(value); + + public static Parser x48 { get; } = + from value in x48Parser.Instance + select new Vchar.x48(value); + + public static Parser x49 { get; } = + from value in x49Parser.Instance + select new Vchar.x49(value); + + public static Parser x4A { get; } = + from value in x4AParser.Instance + select new Vchar.x4A(value); + + public static Parser x4B { get; } = + from value in x4BParser.Instance + select new Vchar.x4B(value); + + public static Parser x4C { get; } = + from value in x4CParser.Instance + select new Vchar.x4C(value); + + public static Parser x4D { get; } = + from value in x4DParser.Instance + select new Vchar.x4D(value); + + public static Parser x4E { get; } = + from value in x4EParser.Instance + select new Vchar.x4E(value); + + public static Parser x4F { get; } = + from value in x4FParser.Instance + select new Vchar.x4F(value); + + public static Parser x50 { get; } = + from value in x50Parser.Instance + select new Vchar.x50(value); + + public static Parser x51 { get; } = + from value in x51Parser.Instance + select new Vchar.x51(value); + + public static Parser x52 { get; } = + from value in x52Parser.Instance + select new Vchar.x52(value); + + public static Parser x53 { get; } = + from value in x53Parser.Instance + select new Vchar.x53(value); + + public static Parser x54 { get; } = + from value in x54Parser.Instance + select new Vchar.x54(value); + + public static Parser x55 { get; } = + from value in x55Parser.Instance + select new Vchar.x55(value); + + public static Parser x56 { get; } = + from value in x56Parser.Instance + select new Vchar.x56(value); + + public static Parser x57 { get; } = + from value in x57Parser.Instance + select new Vchar.x57(value); + + public static Parser x58 { get; } = + from value in x58Parser.Instance + select new Vchar.x58(value); + + public static Parser x59 { get; } = + from value in x59Parser.Instance + select new Vchar.x59(value); + + public static Parser x5A { get; } = + from value in x5AParser.Instance + select new Vchar.x5A(value); + + public static Parser x5B { get; } = + from value in x5BParser.Instance + select new Vchar.x5B(value); + + public static Parser x5C { get; } = + from value in x5CParser.Instance + select new Vchar.x5C(value); + + public static Parser x5D { get; } = + from value in x5DParser.Instance + select new Vchar.x5D(value); + + public static Parser x5E { get; } = + from value in x5EParser.Instance + select new Vchar.x5E(value); + + public static Parser x5F { get; } = + from value in x5FParser.Instance + select new Vchar.x5F(value); + + public static Parser x60 { get; } = + from value in x60Parser.Instance + select new Vchar.x60(value); + + public static Parser x61 { get; } = + from value in x61Parser.Instance + select new Vchar.x61(value); + + public static Parser x62 { get; } = + from value in x62Parser.Instance + select new Vchar.x62(value); + + public static Parser x63 { get; } = + from value in x63Parser.Instance + select new Vchar.x63(value); + + public static Parser x64 { get; } = + from value in x64Parser.Instance + select new Vchar.x64(value); + + public static Parser x65 { get; } = + from value in x65Parser.Instance + select new Vchar.x65(value); + + public static Parser x66 { get; } = + from value in x66Parser.Instance + select new Vchar.x66(value); + + public static Parser x67 { get; } = + from value in x67Parser.Instance + select new Vchar.x67(value); + + public static Parser x68 { get; } = + from value in x68Parser.Instance + select new Vchar.x68(value); + + public static Parser x69 { get; } = + from value in x69Parser.Instance + select new Vchar.x69(value); + + public static Parser x6A { get; } = + from value in x6AParser.Instance + select new Vchar.x6A(value); + + public static Parser x6B { get; } = + from value in x6BParser.Instance + select new Vchar.x6B(value); + + public static Parser x6C { get; } = + from value in x6CParser.Instance + select new Vchar.x6C(value); + + public static Parser x6D { get; } = + from value in x6DParser.Instance + select new Vchar.x6D(value); + + public static Parser x6E { get; } = + from value in x6EParser.Instance + select new Vchar.x6E(value); + + public static Parser x6F { get; } = + from value in x6FParser.Instance + select new Vchar.x6F(value); + + public static Parser x70 { get; } = + from value in x70Parser.Instance + select new Vchar.x70(value); + + public static Parser x71 { get; } = + from value in x71Parser.Instance + select new Vchar.x71(value); + + public static Parser x72 { get; } = + from value in x72Parser.Instance + select new Vchar.x72(value); + + public static Parser x73 { get; } = + from value in x73Parser.Instance + select new Vchar.x73(value); + + public static Parser x74 { get; } = + from value in x74Parser.Instance + select new Vchar.x74(value); + + public static Parser x75 { get; } = + from value in x75Parser.Instance + select new Vchar.x75(value); + + public static Parser x76 { get; } = + from value in x76Parser.Instance + select new Vchar.x76(value); + + public static Parser x77 { get; } = + from value in x77Parser.Instance + select new Vchar.x77(value); + + public static Parser x78 { get; } = + from value in x78Parser.Instance + select new Vchar.x78(value); + + public static Parser x79 { get; } = + from value in x79Parser.Instance + select new Vchar.x79(value); + + public static Parser x7A { get; } = + from value in x7AParser.Instance + select new Vchar.x7A(value); + + public static Parser x7B { get; } = + from value in x7BParser.Instance + select new Vchar.x7B(value); + + public static Parser x7C { get; } = + from value in x7CParser.Instance + select new Vchar.x7C(value); + + public static Parser x7D { get; } = + from value in x7DParser.Instance + select new Vchar.x7D(value); + + public static Parser x7E { get; } = + from value in x7EParser.Instance + select new Vchar.x7E(value); + + public static Parser Instance { get; } = + x21 + .Or(x22) + .Or(x23) + .Or(x24) + .Or(x25) + .Or(x26) + .Or(x27) + .Or(x28) + .Or(x29) + .Or(x2A) + .Or(x2B) + .Or(x2C) + .Or(x2D) + .Or(x2E) + .Or(x2F) + .Or(x30) + .Or(x31) + .Or(x32) + .Or(x33) + .Or(x34) + .Or(x35) + .Or(x36) + .Or(x37) + .Or(x38) + .Or(x39) + .Or(x3A) + .Or(x3B) + .Or(x3C) + .Or(x3D) + .Or(x3E) + .Or(x3F) + .Or(x40) + .Or(x41) + .Or(x42) + .Or(x43) + .Or(x44) + .Or(x45) + .Or(x46) + .Or(x47) + .Or(x48) + .Or(x49) + .Or(x4A) + .Or(x4B) + .Or(x4C) + .Or(x4D) + .Or(x4E) + .Or(x4F) + .Or(x50) + .Or(x51) + .Or(x52) + .Or(x53) + .Or(x54) + .Or(x55) + .Or(x56) + .Or(x57) + .Or(x58) + .Or(x59) + .Or(x5A) + .Or(x5B) + .Or(x5C) + .Or(x5D) + .Or(x5E) + .Or(x5F) + .Or(x60) + .Or(x61) + .Or(x62) + .Or(x63) + .Or(x64) + .Or(x65) + .Or(x66) + .Or(x67) + .Or(x68) + .Or(x69) + .Or(x6A) + .Or(x6B) + .Or(x6C) + .Or(x6D) + .Or(x6E) + .Or(x6F) + .Or(x70) + .Or(x71) + .Or(x72) + .Or(x73) + .Or(x74) + .Or(x75) + .Or(x76) + .Or(x77) + .Or(x78) + .Or(x79) + .Or(x7A) + .Or(x7B) + .Or(x7C) + .Or(x7D) + .Or(x7E); + } +} diff --git a/odata/AbnfParser/CombinatorParsers/CwspParser.cs b/odata/AbnfParser/CombinatorParsers/CwspParser.cs index 3c328421ac..961f4d4564 100644 --- a/odata/AbnfParser/CombinatorParsers/CwspParser.cs +++ b/odata/AbnfParser/CombinatorParsers/CwspParser.cs @@ -1,10 +1,15 @@ namespace AbnfParser.CombinatorParsers { + using AbnfParser.CombinatorParsers.Core; using AbnfParser.CstNodes; using Sprache; public static class CwspParser { - public static Parser WspOnly { get; } + public static Parser WspOnly { get; } = + from wsp in WspParser.Instance + select new Cwsp.WspOnly(wsp); + + public static Parser CnlAndWsp { get; } } } diff --git a/odata/AbnfParser/CstNodes/Core/Vchar.cs b/odata/AbnfParser/CstNodes/Core/Vchar.cs index 6892b57eb0..a8624fd3bf 100644 --- a/odata/AbnfParser/CstNodes/Core/Vchar.cs +++ b/odata/AbnfParser/CstNodes/Core/Vchar.cs @@ -926,6 +926,24 @@ public x7C(Core.x7C value) public Core.x7C Value { get; } } + public sealed class x7D : Vchar + { + public x7D(Core.x7D value) + { + Value = value; + } + + public Core.x7D Value { get; } + } + public sealed class x7E : Vchar + { + public x7E(Core.x7E value) + { + Value = value; + } + + public Core.x7E Value { get; } + } } } From 8fd29fe5d2a2316be6319185154c10e4df0b042d Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 19:32:33 -0800 Subject: [PATCH 21/71] ASD --- .../AbnfParser/CombinatorParsers/CnlParser.cs | 13 ++++++++++++- .../CombinatorParsers/CommentParser.cs | 6 +++++- .../CombinatorParsers/Core/CrlfParser.cs | 5 ++++- .../AbnfParser/CombinatorParsers/CwspParser.cs | 9 ++++++++- .../CombinatorParsers/DefinedAsParser.cs | 18 +++++++++++++++++- 5 files changed, 46 insertions(+), 5 deletions(-) diff --git a/odata/AbnfParser/CombinatorParsers/CnlParser.cs b/odata/AbnfParser/CombinatorParsers/CnlParser.cs index 9b8bbe3781..6961c6a12d 100644 --- a/odata/AbnfParser/CombinatorParsers/CnlParser.cs +++ b/odata/AbnfParser/CombinatorParsers/CnlParser.cs @@ -1,10 +1,21 @@ namespace AbnfParser.CombinatorParsers { + using AbnfParser.CombinatorParsers.Core; using AbnfParser.CstNodes; using Sprache; public static class CnlParser { - public static Parser Comment { get; } + public static Parser Comment { get; } = + from comment in CommentParser.Instance + select new Cnl.Comment(comment); + + public static Parser NewLine { get; } = + from crlf in CrlfParser.Instance + select new Cnl.Newline(crlf); + + public static Parser Instance { get; } = + Comment + .Or(NewLine); } } diff --git a/odata/AbnfParser/CombinatorParsers/CommentParser.cs b/odata/AbnfParser/CombinatorParsers/CommentParser.cs index c996df6e12..dba3fea30c 100644 --- a/odata/AbnfParser/CombinatorParsers/CommentParser.cs +++ b/odata/AbnfParser/CombinatorParsers/CommentParser.cs @@ -7,7 +7,11 @@ public static class CommentParser { - public static Parser Instance { get; } + public static Parser Instance { get; } = + from semicolon in x3BParser.Instance + from inners in Parse.Many(InnerParser.Instance) + from crlf in CrlfParser.Instance + select new Comment(semicolon, inners, crlf); public static class InnerParser { diff --git a/odata/AbnfParser/CombinatorParsers/Core/CrlfParser.cs b/odata/AbnfParser/CombinatorParsers/Core/CrlfParser.cs index 43f831621e..2fa623c34f 100644 --- a/odata/AbnfParser/CombinatorParsers/Core/CrlfParser.cs +++ b/odata/AbnfParser/CombinatorParsers/Core/CrlfParser.cs @@ -5,6 +5,9 @@ public static class CrlfParser { - public static Parser Instance { get; } + public static Parser Instance { get; } = + from cr in CrParser.Instance + from lf in LfParser.Instance + select new Crlf(cr, lf); } } diff --git a/odata/AbnfParser/CombinatorParsers/CwspParser.cs b/odata/AbnfParser/CombinatorParsers/CwspParser.cs index 961f4d4564..8b612da65d 100644 --- a/odata/AbnfParser/CombinatorParsers/CwspParser.cs +++ b/odata/AbnfParser/CombinatorParsers/CwspParser.cs @@ -10,6 +10,13 @@ public static class CwspParser from wsp in WspParser.Instance select new Cwsp.WspOnly(wsp); - public static Parser CnlAndWsp { get; } + public static Parser CnlAndWsp { get; } = + from cnl in CnlParser.Instance + from wsp in WspParser.Instance + select new Cwsp.CnlAndWsp(cnl, wsp); + + public static Parser Instance { get; } = + WspOnly + .Or(CnlAndWsp); } } diff --git a/odata/AbnfParser/CombinatorParsers/DefinedAsParser.cs b/odata/AbnfParser/CombinatorParsers/DefinedAsParser.cs index db477aac0a..9f05eed32b 100644 --- a/odata/AbnfParser/CombinatorParsers/DefinedAsParser.cs +++ b/odata/AbnfParser/CombinatorParsers/DefinedAsParser.cs @@ -1,10 +1,26 @@ namespace AbnfParser.CombinatorParsers { + using AbnfParser.CombinatorParsers.Core; using AbnfParser.CstNodes; using Sprache; public static class DefinedAsParser { - public static Parser Declaration { get; } + public static Parser Declaration { get; } = + from prefixCwsps in Parse.Many(CwspParser.Instance) + from @equals in x3DParser.Instance + from suffixCwsps in Parse.Many(CwspParser.Instance) + select new DefinedAs.Declaration(prefixCwsps, @equals, suffixCwsps); + + public static Parser Incremental { get; } = + from prefixCwsps in Parse.Many(CwspParser.Instance) + from @equals in x3DParser.Instance + from slash in x2FParser.Instance + from suffixCwsps in Parse.Many(CwspParser.Instance) + select new DefinedAs.Incremental(prefixCwsps, @equals, slash, suffixCwsps); + + public static Parser Instance { get; } = + Declaration + .Or(Incremental); } } From 2af8bed246b6e8507e4282bdbbab9b8b2ecc4d57 Mon Sep 17 00:00:00 2001 From: Garrett DeBruin Date: Wed, 4 Dec 2024 19:46:33 -0800 Subject: [PATCH 22/71] asdf --- odata.tests/Test1.cs | 4 +- .../CombinatorParsers/AlternationParser.cs | 15 + .../CombinatorParsers/CharValParser.cs | 484 ++++++++++++++++++ .../CombinatorParsers/ConcatenationParser.cs | 9 + .../CombinatorParsers/Core/OptionParser.cs | 16 + .../CombinatorParsers/ElementParser.cs | 21 + .../CombinatorParsers/ElementsParser.cs | 9 + .../CombinatorParsers/GroupParser.cs | 17 + .../CombinatorParsers/RepetitionParser.cs | 9 + 9 files changed, 582 insertions(+), 2 deletions(-) create mode 100644 odata/AbnfParser/CombinatorParsers/AlternationParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/CharValParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/ConcatenationParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/Core/OptionParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/ElementParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/ElementsParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/GroupParser.cs create mode 100644 odata/AbnfParser/CombinatorParsers/RepetitionParser.cs diff --git a/odata.tests/Test1.cs b/odata.tests/Test1.cs index e39f188b85..02a811a3b7 100644 --- a/odata.tests/Test1.cs +++ b/odata.tests/Test1.cs @@ -38,9 +38,9 @@ public void Generate() for (int i = start; i <= end; ++i) { var className = $"x{i:X2}"; - /*builder.AppendLine($"public static Parser {className} {{ get; }} ="); + /*builder.AppendLine($"public static Parser {className} {{ get; }} ="); builder.AppendLine($"\tfrom value in {className}Parser.Instance"); - builder.AppendLine($"\tselect new Vchar.{className}(value);"); + builder.AppendLine($"\tselect new CharVal.Inner.{className}(value);"); builder.AppendLine();*/ builder.AppendLine($".Or({className})"); diff --git a/odata/AbnfParser/CombinatorParsers/AlternationParser.cs b/odata/AbnfParser/CombinatorParsers/AlternationParser.cs new file mode 100644 index 0000000000..d9d9d710b8 --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/AlternationParser.cs @@ -0,0 +1,15 @@ +namespace AbnfParser.CombinatorParsers +{ + using AbnfParser.CstNodes; + using Sprache; + + public static class AlternationParser + { + public static Parser Instance { get; } + + public static class InnerParser + { + + } + } +} diff --git a/odata/AbnfParser/CombinatorParsers/CharValParser.cs b/odata/AbnfParser/CombinatorParsers/CharValParser.cs new file mode 100644 index 0000000000..2843798b43 --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/CharValParser.cs @@ -0,0 +1,484 @@ +namespace AbnfParser.CombinatorParsers +{ + using AbnfParser.CombinatorParsers.Core; + using AbnfParser.CstNodes; + using Sprache; + + public static class CharValParser + { + public static class InnerParser + { + public static Parser x20 { get; } = + from value in x20Parser.Instance + select new CharVal.Inner.x20(value); + + public static Parser x21 { get; } = + from value in x21Parser.Instance + select new CharVal.Inner.x21(value); + + public static Parser x23 { get; } = + from value in x23Parser.Instance + select new CharVal.Inner.x23(value); + + public static Parser x24 { get; } = + from value in x24Parser.Instance + select new CharVal.Inner.x24(value); + + public static Parser x25 { get; } = + from value in x25Parser.Instance + select new CharVal.Inner.x25(value); + + public static Parser x26 { get; } = + from value in x26Parser.Instance + select new CharVal.Inner.x26(value); + + public static Parser x27 { get; } = + from value in x27Parser.Instance + select new CharVal.Inner.x27(value); + + public static Parser x28 { get; } = + from value in x28Parser.Instance + select new CharVal.Inner.x28(value); + + public static Parser x29 { get; } = + from value in x29Parser.Instance + select new CharVal.Inner.x29(value); + + public static Parser x2A { get; } = + from value in x2AParser.Instance + select new CharVal.Inner.x2A(value); + + public static Parser x2B { get; } = + from value in x2BParser.Instance + select new CharVal.Inner.x2B(value); + + public static Parser x2C { get; } = + from value in x2CParser.Instance + select new CharVal.Inner.x2C(value); + + public static Parser x2D { get; } = + from value in x2DParser.Instance + select new CharVal.Inner.x2D(value); + + public static Parser x2E { get; } = + from value in x2EParser.Instance + select new CharVal.Inner.x2E(value); + + public static Parser x2F { get; } = + from value in x2FParser.Instance + select new CharVal.Inner.x2F(value); + + public static Parser x30 { get; } = + from value in x30Parser.Instance + select new CharVal.Inner.x30(value); + + public static Parser x31 { get; } = + from value in x31Parser.Instance + select new CharVal.Inner.x31(value); + + public static Parser x32 { get; } = + from value in x32Parser.Instance + select new CharVal.Inner.x32(value); + + public static Parser x33 { get; } = + from value in x33Parser.Instance + select new CharVal.Inner.x33(value); + + public static Parser x34 { get; } = + from value in x34Parser.Instance + select new CharVal.Inner.x34(value); + + public static Parser x35 { get; } = + from value in x35Parser.Instance + select new CharVal.Inner.x35(value); + + public static Parser x36 { get; } = + from value in x36Parser.Instance + select new CharVal.Inner.x36(value); + + public static Parser x37 { get; } = + from value in x37Parser.Instance + select new CharVal.Inner.x37(value); + + public static Parser x38 { get; } = + from value in x38Parser.Instance + select new CharVal.Inner.x38(value); + + public static Parser x39 { get; } = + from value in x39Parser.Instance + select new CharVal.Inner.x39(value); + + public static Parser x3A { get; } = + from value in x3AParser.Instance + select new CharVal.Inner.x3A(value); + + public static Parser x3B { get; } = + from value in x3BParser.Instance + select new CharVal.Inner.x3B(value); + + public static Parser x3C { get; } = + from value in x3CParser.Instance + select new CharVal.Inner.x3C(value); + + public static Parser x3D { get; } = + from value in x3DParser.Instance + select new CharVal.Inner.x3D(value); + + public static Parser x3E { get; } = + from value in x3EParser.Instance + select new CharVal.Inner.x3E(value); + + public static Parser x3F { get; } = + from value in x3FParser.Instance + select new CharVal.Inner.x3F(value); + + public static Parser x40 { get; } = + from value in x40Parser.Instance + select new CharVal.Inner.x40(value); + + public static Parser x41 { get; } = + from value in x41Parser.Instance + select new CharVal.Inner.x41(value); + + public static Parser x42 { get; } = + from value in x42Parser.Instance + select new CharVal.Inner.x42(value); + + public static Parser x43 { get; } = + from value in x43Parser.Instance + select new CharVal.Inner.x43(value); + + public static Parser x44 { get; } = + from value in x44Parser.Instance + select new CharVal.Inner.x44(value); + + public static Parser x45 { get; } = + from value in x45Parser.Instance + select new CharVal.Inner.x45(value); + + public static Parser x46 { get; } = + from value in x46Parser.Instance + select new CharVal.Inner.x46(value); + + public static Parser x47 { get; } = + from value in x47Parser.Instance + select new CharVal.Inner.x47(value); + + public static Parser x48 { get; } = + from value in x48Parser.Instance + select new CharVal.Inner.x48(value); + + public static Parser x49 { get; } = + from value in x49Parser.Instance + select new CharVal.Inner.x49(value); + + public static Parser x4A { get; } = + from value in x4AParser.Instance + select new CharVal.Inner.x4A(value); + + public static Parser x4B { get; } = + from value in x4BParser.Instance + select new CharVal.Inner.x4B(value); + + public static Parser x4C { get; } = + from value in x4CParser.Instance + select new CharVal.Inner.x4C(value); + + public static Parser x4D { get; } = + from value in x4DParser.Instance + select new CharVal.Inner.x4D(value); + + public static Parser x4E { get; } = + from value in x4EParser.Instance + select new CharVal.Inner.x4E(value); + + public static Parser x4F { get; } = + from value in x4FParser.Instance + select new CharVal.Inner.x4F(value); + + public static Parser x50 { get; } = + from value in x50Parser.Instance + select new CharVal.Inner.x50(value); + + public static Parser x51 { get; } = + from value in x51Parser.Instance + select new CharVal.Inner.x51(value); + + public static Parser x52 { get; } = + from value in x52Parser.Instance + select new CharVal.Inner.x52(value); + + public static Parser x53 { get; } = + from value in x53Parser.Instance + select new CharVal.Inner.x53(value); + + public static Parser x54 { get; } = + from value in x54Parser.Instance + select new CharVal.Inner.x54(value); + + public static Parser x55 { get; } = + from value in x55Parser.Instance + select new CharVal.Inner.x55(value); + + public static Parser x56 { get; } = + from value in x56Parser.Instance + select new CharVal.Inner.x56(value); + + public static Parser x57 { get; } = + from value in x57Parser.Instance + select new CharVal.Inner.x57(value); + + public static Parser x58 { get; } = + from value in x58Parser.Instance + select new CharVal.Inner.x58(value); + + public static Parser x59 { get; } = + from value in x59Parser.Instance + select new CharVal.Inner.x59(value); + + public static Parser x5A { get; } = + from value in x5AParser.Instance + select new CharVal.Inner.x5A(value); + + public static Parser x5B { get; } = + from value in x5BParser.Instance + select new CharVal.Inner.x5B(value); + + public static Parser x5C { get; } = + from value in x5CParser.Instance + select new CharVal.Inner.x5C(value); + + public static Parser x5D { get; } = + from value in x5DParser.Instance + select new CharVal.Inner.x5D(value); + + public static Parser x5E { get; } = + from value in x5EParser.Instance + select new CharVal.Inner.x5E(value); + + public static Parser x5F { get; } = + from value in x5FParser.Instance + select new CharVal.Inner.x5F(value); + + public static Parser x60 { get; } = + from value in x60Parser.Instance + select new CharVal.Inner.x60(value); + + public static Parser x61 { get; } = + from value in x61Parser.Instance + select new CharVal.Inner.x61(value); + + public static Parser x62 { get; } = + from value in x62Parser.Instance + select new CharVal.Inner.x62(value); + + public static Parser x63 { get; } = + from value in x63Parser.Instance + select new CharVal.Inner.x63(value); + + public static Parser x64 { get; } = + from value in x64Parser.Instance + select new CharVal.Inner.x64(value); + + public static Parser x65 { get; } = + from value in x65Parser.Instance + select new CharVal.Inner.x65(value); + + public static Parser x66 { get; } = + from value in x66Parser.Instance + select new CharVal.Inner.x66(value); + + public static Parser x67 { get; } = + from value in x67Parser.Instance + select new CharVal.Inner.x67(value); + + public static Parser x68 { get; } = + from value in x68Parser.Instance + select new CharVal.Inner.x68(value); + + public static Parser x69 { get; } = + from value in x69Parser.Instance + select new CharVal.Inner.x69(value); + + public static Parser x6A { get; } = + from value in x6AParser.Instance + select new CharVal.Inner.x6A(value); + + public static Parser x6B { get; } = + from value in x6BParser.Instance + select new CharVal.Inner.x6B(value); + + public static Parser x6C { get; } = + from value in x6CParser.Instance + select new CharVal.Inner.x6C(value); + + public static Parser x6D { get; } = + from value in x6DParser.Instance + select new CharVal.Inner.x6D(value); + + public static Parser x6E { get; } = + from value in x6EParser.Instance + select new CharVal.Inner.x6E(value); + + public static Parser x6F { get; } = + from value in x6FParser.Instance + select new CharVal.Inner.x6F(value); + + public static Parser x70 { get; } = + from value in x70Parser.Instance + select new CharVal.Inner.x70(value); + + public static Parser x71 { get; } = + from value in x71Parser.Instance + select new CharVal.Inner.x71(value); + + public static Parser x72 { get; } = + from value in x72Parser.Instance + select new CharVal.Inner.x72(value); + + public static Parser x73 { get; } = + from value in x73Parser.Instance + select new CharVal.Inner.x73(value); + + public static Parser x74 { get; } = + from value in x74Parser.Instance + select new CharVal.Inner.x74(value); + + public static Parser x75 { get; } = + from value in x75Parser.Instance + select new CharVal.Inner.x75(value); + + public static Parser x76 { get; } = + from value in x76Parser.Instance + select new CharVal.Inner.x76(value); + + public static Parser x77 { get; } = + from value in x77Parser.Instance + select new CharVal.Inner.x77(value); + + public static Parser x78 { get; } = + from value in x78Parser.Instance + select new CharVal.Inner.x78(value); + + public static Parser x79 { get; } = + from value in x79Parser.Instance + select new CharVal.Inner.x79(value); + + public static Parser x7A { get; } = + from value in x7AParser.Instance + select new CharVal.Inner.x7A(value); + + public static Parser x7B { get; } = + from value in x7BParser.Instance + select new CharVal.Inner.x7B(value); + + public static Parser x7C { get; } = + from value in x7CParser.Instance + select new CharVal.Inner.x7C(value); + + public static Parser x7D { get; } = + from value in x7DParser.Instance + select new CharVal.Inner.x7D(value); + + public static Parser x7E { get; } = + from value in x7EParser.Instance + select new CharVal.Inner.x7E(value); + + public static Parser Instance { get; } = + x20 + .Or(x21) + .Or(x23) + .Or(x24) + .Or(x25) + .Or(x26) + .Or(x27) + .Or(x28) + .Or(x29) + .Or(x2A) + .Or(x2B) + .Or(x2C) + .Or(x2D) + .Or(x2E) + .Or(x2F) + .Or(x30) + .Or(x31) + .Or(x32) + .Or(x33) + .Or(x34) + .Or(x35) + .Or(x36) + .Or(x37) + .Or(x38) + .Or(x39) + .Or(x3A) + .Or(x3B) + .Or(x3C) + .Or(x3D) + .Or(x3E) + .Or(x3F) + .Or(x40) + .Or(x41) + .Or(x42) + .Or(x43) + .Or(x44) + .Or(x45) + .Or(x46) + .Or(x47) + .Or(x48) + .Or(x49) + .Or(x4A) + .Or(x4B) + .Or(x4C) + .Or(x4D) + .Or(x4E) + .Or(x4F) + .Or(x50) + .Or(x51) + .Or(x52) + .Or(x53) + .Or(x54) + .Or(x55) + .Or(x56) + .Or(x57) + .Or(x58) + .Or(x59) + .Or(x5A) + .Or(x5B) + .Or(x5C) + .Or(x5D) + .Or(x5E) + .Or(x5F) + .Or(x60) + .Or(x61) + .Or(x62) + .Or(x63) + .Or(x64) + .Or(x65) + .Or(x66) + .Or(x67) + .Or(x68) + .Or(x69) + .Or(x6A) + .Or(x6B) + .Or(x6C) + .Or(x6D) + .Or(x6E) + .Or(x6F) + .Or(x70) + .Or(x71) + .Or(x72) + .Or(x73) + .Or(x74) + .Or(x75) + .Or(x76) + .Or(x77) + .Or(x78) + .Or(x79) + .Or(x7A) + .Or(x7B) + .Or(x7C) + .Or(x7D) + .Or(x7E); + } + } +} diff --git a/odata/AbnfParser/CombinatorParsers/ConcatenationParser.cs b/odata/AbnfParser/CombinatorParsers/ConcatenationParser.cs new file mode 100644 index 0000000000..a1122c36d7 --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/ConcatenationParser.cs @@ -0,0 +1,9 @@ +namespace AbnfParser.CombinatorParsers +{ + using AbnfParser.CstNodes; + using Sprache; + + public static class ConcatenationParser + { + } +} diff --git a/odata/AbnfParser/CombinatorParsers/Core/OptionParser.cs b/odata/AbnfParser/CombinatorParsers/Core/OptionParser.cs new file mode 100644 index 0000000000..dbc13855e0 --- /dev/null +++ b/odata/AbnfParser/CombinatorParsers/Core/OptionParser.cs @@ -0,0 +1,16 @@ +namespace AbnfParser.CombinatorParsers.Core +{ + using AbnfParser.CstNodes; + using Sprache; + + public static class OptionParser + { + public static Parser