From 4b59abc989cd2955e75fd7707638209180d25853 Mon Sep 17 00:00:00 2001 From: Jesse Brault Date: Tue, 23 Sep 2025 14:14:42 -0500 Subject: [PATCH] Update schema for ast gen. --- src/parser/ast.schema.yaml | 149 ++++++++++++++++++------------------- src/parser/ast.yaml | 2 +- 2 files changed, 74 insertions(+), 77 deletions(-) diff --git a/src/parser/ast.schema.yaml b/src/parser/ast.schema.yaml index 30292db..40bed17 100644 --- a/src/parser/ast.schema.yaml +++ b/src/parser/ast.schema.yaml @@ -35,8 +35,8 @@ $defs: - $ref: "#/$defs/ProductionDefinition" - $ref: "#/$defs/NodeProductionDefinition" - $ref: "#/$defs/PolymorphicTypeDefinition" - - $ref: "#/$defs/PolymorphicBuildDefinition" # deprecated - $ref: "#/$defs/PolymorphicEnumLoopBuildDefinition" + - $ref: "#/$defs/PolymorphicPassThroughDefinition" # Struct StructNodeDefinition: @@ -171,7 +171,7 @@ $defs: additionalProperties: false properties: boolean: - $ref: "#/$defs/StructChildMemberBuildBooleanProps"' + $ref: "#/$defs/StructChildMemberBuildBooleanProps" required: - boolean StructChildMemberBuildBooleanProps: @@ -331,80 +331,6 @@ $defs: required: - kind - # Polymorphic Build - PolymorphicBuildDefinition: - type: object - additionalProperties: false - properties: - polymorphic_build: - type: object - $ref: "#/$defs/PolymorphicBuildProps" - required: - - polymorphic_build - PolymorphicBuildProps: - type: object - additionalProperties: false - properties: - return_type: - type: string - alternatives: - type: array - items: - $ref: "#/$defs/PolymorphicBuildAlternative" - required: - - return_type - - alternatives - PolymorphicBuildAlternative: - type: object - additionalProperties: false - properties: - test: - type: object - additionalProperties: false - properties: - number_of_pairs: - type: string - required: - - number_of_pairs - action: - type: object - additionalProperties: false - oneOf: - - $ref: "#/$defs/PolymorphicBuildAlternativeBuild" - - $ref: "#/$defs/PolymorphicBuildAlternativeReturnBuild" - required: - - test - - action - PolymorphicBuildAlternativeBuild: - type: object - additionalProperties: false - properties: - build: - type: object - properties: - enum_variant: - type: string - children: - type: array - items: - $ref: "#/$defs/StructChildHash" - required: - - build - PolymorphicBuildAlternativeReturnBuild: - type: object - additionalProperties: false - properties: - return_build: - type: object - additionalProperties: false - properties: - kind: - type: string - required: - - kind - required: - - return_build - # Polymorphic Enum Loop Build PolymorphicEnumLoopBuildDefinition: type: object @@ -512,6 +438,77 @@ $defs: required: - on_each + # Polymorphic Pass Through + PolymorphicPassThroughDefinition: + type: object + additionalProperties: false + properties: + polymorphic_pass_through: + $ref: "#/$defs/PolymorphicPassThroughProps" + required: + - polymorphic_pass_through + PolymorphicPassThroughProps: + type: object + additionalProperties: false + properties: + build: + type: object + additionalProperties: false + properties: + kind: + type: string + required: + - kind + variants: + type: array + items: + $ref: "#/$defs/PolymorphicPassThroughVariantHash" + required: + - build + - variants + PolymorphicPassThroughVariantHash: + type: object + additionalProperties: false + minProperties: 1 + maxProperties: 1 + patternProperties: + "^([A-Z][a-z]*)*$": + $ref: "#/$defs/PolymorphicPassThroughVariantProps" + PolymorphicPassThroughVariantProps: + type: object + additionalProperties: false + oneOf: + - $ref: "#/$defs/PolymorphicPassThroughVariantInner" + - $ref: "#/$defs/PolymorphicPassThroughVariantPassThrough" + PolymorphicPassThroughVariantInner: + type: object + additionalProperties: false + properties: + inner: + type: object + additionalProperties: false + properties: + kind: + type: string + required: + - kind + required: + - inner + PolymorphicPassThroughVariantPassThrough: + type: object + additionalProperties: false + properties: + pass_through: + type: object + additionalProperties: false + properties: + kind: + type: string + required: + - kind + required: + - pass_through + # Production ProductionDefinition: type: object diff --git a/src/parser/ast.yaml b/src/parser/ast.yaml index da89d98..db62005 100644 --- a/src/parser/ast.yaml +++ b/src/parser/ast.yaml @@ -1028,7 +1028,7 @@ ObjectIndex: children: - expression PrimaryExpression: - polymorphic_type: # TODO: polymorphic pass through + polymorphic_pass_through: build: kind: Expression variants: