Work on ast.schema and related.
This commit is contained in:
		
							parent
							
								
									29a2d77b6f
								
							
						
					
					
						commit
						41693788fc
					
				| @ -9,22 +9,52 @@ $defs: | |||||||
|     type: object |     type: object | ||||||
|     additionalProperties: false |     additionalProperties: false | ||||||
|     description: A definition of a node type. |     description: A definition of a node type. | ||||||
|  |     oneOf: | ||||||
|  |       - $ref: "#/$defs/StructNodeDefinition" | ||||||
|  |       - $ref: "#/$defs/EnumNodeDefinition" | ||||||
|  |       - $ref: "#/$defs/LeafEnumNodeDefinition" | ||||||
|  |   StructNodeDefinition: | ||||||
|  |     type: object | ||||||
|  |     additionalProperties: false | ||||||
|  |     description: A description of a Struct node to be built. | ||||||
|     properties: |     properties: | ||||||
|  |       type: | ||||||
|  |         const: struct | ||||||
|       children: |       children: | ||||||
|         type: array |  | ||||||
|         description: Ordered child fields for this node. |         description: Ordered child fields for this node. | ||||||
|         items: |         items: | ||||||
|           $ref: "#/$defs/StructChildDefinition" |           $ref: "#/$defs/StructChildDefinition" | ||||||
|  |     required: | ||||||
|  |       - children | ||||||
|  |   EnumNodeDefinition: | ||||||
|  |     type: object | ||||||
|  |     additionalProperties: false | ||||||
|  |     description: A description of an Enum node to be built. | ||||||
|  |     properties: | ||||||
|  |       type: | ||||||
|  |         const: enum | ||||||
|       rules: |       rules: | ||||||
|         type: array |         type: array | ||||||
|         description: Alternative parse rules that build this node. |         description: Alternative parse rules that build this node. | ||||||
|         items: |         items: | ||||||
|           $ref: "#/$defs/EnumChildDefinition" |           $ref: "#/$defs/EnumChildDefinition" | ||||||
|     oneOf: |     required: | ||||||
|       - required: |       - rules | ||||||
|           - "children" |   LeafEnumNodeDefinition: | ||||||
|       - required: |     type: object | ||||||
|           - "rules" |     additionalProperties: false | ||||||
|  |     description: A description of a leaf-enum node to be built. | ||||||
|  |     properties: | ||||||
|  |       type: | ||||||
|  |         const: leaf_enum | ||||||
|  |       rules: | ||||||
|  |         type: array | ||||||
|  |         description: Alternative parse rules that build this node. | ||||||
|  |         items: | ||||||
|  |           $ref: "#/$defs/LeafEnumChildDefinition" | ||||||
|  |     required: | ||||||
|  |       - type | ||||||
|  |       - rules | ||||||
|   StructChildDefinition: |   StructChildDefinition: | ||||||
|     description: A definition of a node's child. Either a bare child name (string) in snake case, or an object. |     description: A definition of a node's child. Either a bare child name (string) in snake case, or an object. | ||||||
|     oneOf: |     oneOf: | ||||||
| @ -93,6 +123,10 @@ $defs: | |||||||
|     oneOf: |     oneOf: | ||||||
|       - $ref: "#/$defs/BuildSingleTypeChild" |       - $ref: "#/$defs/BuildSingleTypeChild" | ||||||
|       - $ref: "#/$defs/BuildBooleanChild" |       - $ref: "#/$defs/BuildBooleanChild" | ||||||
|  |       - $ref: "#/$defs/BuildStringChild" | ||||||
|  |       - $ref: "#/$defs/BuildDoubleChild" | ||||||
|  |       - $ref: "#/$defs/BuildIntChild" | ||||||
|  |       - $ref: "#/$defs/BuildLongChild" | ||||||
|   BuildSingleTypeChild: |   BuildSingleTypeChild: | ||||||
|     type: object |     type: object | ||||||
|     additionalProperties: false |     additionalProperties: false | ||||||
| @ -117,6 +151,54 @@ $defs: | |||||||
|         type: string |         type: string | ||||||
|         enum: |         enum: | ||||||
|           - rule_present |           - rule_present | ||||||
|  |       from: | ||||||
|  |         type: string | ||||||
|  |         enum:  | ||||||
|  |           - parse_whole_pair | ||||||
|  |   BuildStringChild: | ||||||
|  |     type: object | ||||||
|  |     additionalProperties: false | ||||||
|  |     description: A definition for building a string child. | ||||||
|  |     properties:  | ||||||
|  |       type: | ||||||
|  |         const: string | ||||||
|  |       from: | ||||||
|  |         type: string | ||||||
|  |         enum: | ||||||
|  |           - whole_pair | ||||||
|  |   BuildDoubleChild: | ||||||
|  |     type: object | ||||||
|  |     additionalProperties: false | ||||||
|  |     description: A definition for building a Double child. | ||||||
|  |     properties:  | ||||||
|  |       type: | ||||||
|  |         const: f64 | ||||||
|  |       from: | ||||||
|  |         type: string | ||||||
|  |         enum: | ||||||
|  |           - parse_whole_pair | ||||||
|  |   BuildIntChild: | ||||||
|  |     type: object | ||||||
|  |     additionalProperties: false | ||||||
|  |     description: A definition for building an Int child. | ||||||
|  |     properties:  | ||||||
|  |       type: | ||||||
|  |         const: i32 | ||||||
|  |       from: | ||||||
|  |         type: string | ||||||
|  |         enum: | ||||||
|  |           - parse_number_base | ||||||
|  |   BuildLongChild: | ||||||
|  |     type: object | ||||||
|  |     additionalProperties: false | ||||||
|  |     description: A definition for building a Long child. | ||||||
|  |     properties:  | ||||||
|  |       type: | ||||||
|  |         const: i64 | ||||||
|  |       from: | ||||||
|  |         type: string | ||||||
|  |         enum: | ||||||
|  |           - parse_number_base | ||||||
|   EnumChildDefinition: |   EnumChildDefinition: | ||||||
|     description: A definition of an enum node's child. Either a bare rule (string) in Pascal case, or an object. |     description: A definition of an enum node's child. Either a bare rule (string) in Pascal case, or an object. | ||||||
|     oneOf: |     oneOf: | ||||||
| @ -135,3 +217,28 @@ $defs: | |||||||
|     required: |     required: | ||||||
|       - rule |       - rule | ||||||
|       - build |       - build | ||||||
|  |   LeafEnumChildDefinition: | ||||||
|  |     description: A definition of a leaf-enum node's child. Either a bare rule-string in Pascal case, or an object. | ||||||
|  |     oneOf: | ||||||
|  |       - type: string | ||||||
|  |         description: Shorthand where the rule name maps onto an empty enum rule. | ||||||
|  |       - $ref: "#/$defs/LongLeafEnumChildDefinitionWrapper" | ||||||
|  |   LongLeafEnumChildDefinitionWrapper: | ||||||
|  |     type: object | ||||||
|  |     description: Single-key object mapping the child-name to its spec. | ||||||
|  |     minProperties: 1 | ||||||
|  |     maxProperties: 1 | ||||||
|  |     additionalProperties: false | ||||||
|  |     patternProperties: | ||||||
|  |       "^([A-Z][a-z0-9]*)*$": | ||||||
|  |         $ref: "#/$defs/LongLeafEnumChildDefinition" | ||||||
|  |   LongLeafEnumChildDefinition: | ||||||
|  |     type: object | ||||||
|  |     additionalProperties: false | ||||||
|  |     description: A format for specifying more specific information about a leaf-enum child. | ||||||
|  |     properties: | ||||||
|  |       child: | ||||||
|  |         type: boolean | ||||||
|  |         description: If true, a node of the same name is built as the lone member of the enum child. | ||||||
|  |     required: | ||||||
|  |       - child | ||||||
| @ -622,19 +622,23 @@ NumberLiteral: | |||||||
| IntLiteral: | IntLiteral: | ||||||
|   children: |   children: | ||||||
|     - number_base |     - number_base | ||||||
|  |     - literal: | ||||||
|  |         build: | ||||||
|  |           type: i32 | ||||||
|  |           from: parse_number_base | ||||||
| LongLiteral: | LongLiteral: | ||||||
|   children: |   children: | ||||||
|     - number_base |     - number_base | ||||||
|  |     - literal: | ||||||
|  |         build: | ||||||
|  |           type: i64 | ||||||
|  |           from: parse_number_base | ||||||
| DoubleLiteral: | DoubleLiteral: | ||||||
|   children: |   children: | ||||||
|     - double_whole |     - literal: | ||||||
|     - double_fractional |         build:  | ||||||
| DoubleWhole: |           type: f64 | ||||||
|   children: |           from: parse_whole_pair | ||||||
|     - decimal_base |  | ||||||
| DoubleFractional: |  | ||||||
|   children: |  | ||||||
|     - decimal_base |  | ||||||
| NumberBase: | NumberBase: | ||||||
|   rules: |   rules: | ||||||
|     - BinaryBase |     - BinaryBase | ||||||
|  | |||||||
| @ -823,11 +823,7 @@ IntLiteral = { NumberBase } | |||||||
| 
 | 
 | ||||||
| LongLiteral = ${ NumberBase ~ "L" } | LongLiteral = ${ NumberBase ~ "L" } | ||||||
| 
 | 
 | ||||||
| DoubleLiteral = ${ DoubleWhole ~ "." ~ DoubleFractional } | DoubleLiteral = @{ DecimalBase ~ "." ~ DecimalBase} | ||||||
| 
 |  | ||||||
| DoubleWhole = { DecimalBase } |  | ||||||
| 
 |  | ||||||
| DoubleFractional = { DecimalBase } |  | ||||||
| 
 | 
 | ||||||
| NumberBase = { | NumberBase = { | ||||||
|       BinaryBase |       BinaryBase | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Jesse Brault
						Jesse Brault