Regenerate schema
This commit is contained in:
parent
edece399be
commit
71acd4c951
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "20231021"
|
version = "20231026"
|
||||||
author = "Emery Hemingway"
|
author = "Emery Hemingway"
|
||||||
description = "data model and serialization format"
|
description = "data model and serialization format"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
## This module implements Nim code generation from Preserves schemas.
|
## This module implements Nim code generation from Preserves schemas.
|
||||||
# This module imports code that it generates! After making any changes here
|
# This module imports code that it generates! After making any changes here
|
||||||
# the schema module must be regenerated!
|
# the schema module must be regenerated!
|
||||||
# nim c --path:.. -r ./preserves_schema_nim ../../../preserves/schema/schema.bin
|
# nim c --path:../../../nim --path:.. -r ./preserves_schema_nim ../../../preserves/schema/schema.bin
|
||||||
|
|
||||||
import std/[hashes, strutils, sets, tables]
|
import std/[hashes, strutils, sets, tables]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
import ../preserves, std/tables
|
import
|
||||||
|
preserves, std/tables
|
||||||
|
|
||||||
type
|
type
|
||||||
Ref* {.preservesRecord: "ref".} = object
|
Ref* {.preservesRecord: "ref".} = object
|
||||||
|
@ -7,26 +8,26 @@ type
|
||||||
`name`*: Symbol
|
`name`*: Symbol
|
||||||
|
|
||||||
ModulePath* = seq[Symbol]
|
ModulePath* = seq[Symbol]
|
||||||
Bundle* {.preservesRecord: "bundle".} = ref object
|
Bundle* {.acyclic, preservesRecord: "bundle".} = ref object
|
||||||
`modules`*: Modules
|
`modules`*: Modules
|
||||||
|
|
||||||
CompoundPatternKind* {.pure.} = enum
|
CompoundPatternKind* {.pure.} = enum
|
||||||
`rec`, `tuple`, `tuplePrefix`, `dict`
|
`rec`, `tuple`, `tuplePrefix`, `dict`
|
||||||
CompoundPatternRec* {.preservesRecord: "rec".} = ref object
|
CompoundPatternRec* {.acyclic, preservesRecord: "rec".} = ref object
|
||||||
`label`*: NamedPattern
|
`label`*: NamedPattern
|
||||||
`fields`*: NamedPattern
|
`fields`*: NamedPattern
|
||||||
|
|
||||||
CompoundPatternTuple* {.preservesRecord: "tuple".} = ref object
|
CompoundPatternTuple* {.acyclic, preservesRecord: "tuple".} = ref object
|
||||||
`patterns`*: seq[NamedPattern]
|
`patterns`*: seq[NamedPattern]
|
||||||
|
|
||||||
CompoundPatternTuplePrefix* {.preservesRecord: "tuplePrefix".} = ref object
|
CompoundPatternTuplePrefix* {.acyclic, preservesRecord: "tuplePrefix".} = ref object
|
||||||
`fixed`*: seq[NamedPattern]
|
`fixed`*: seq[NamedPattern]
|
||||||
`variable`*: NamedSimplePattern
|
`variable`*: NamedSimplePattern
|
||||||
|
|
||||||
CompoundPatternDict* {.preservesRecord: "dict".} = ref object
|
CompoundPatternDict* {.acyclic, preservesRecord: "dict".} = ref object
|
||||||
`entries`*: DictionaryEntries
|
`entries`*: DictionaryEntries
|
||||||
|
|
||||||
`CompoundPattern`* {.preservesOr.} = ref object
|
`CompoundPattern`* {.acyclic, preservesOr.} = ref object
|
||||||
case orKind*: CompoundPatternKind
|
case orKind*: CompoundPatternKind
|
||||||
of CompoundPatternKind.`rec`:
|
of CompoundPatternKind.`rec`:
|
||||||
`rec`*: CompoundPatternRec
|
`rec`*: CompoundPatternRec
|
||||||
|
@ -60,7 +61,7 @@ type
|
||||||
DictionaryEntries* = Table[Preserve[void], NamedSimplePattern]
|
DictionaryEntries* = Table[Preserve[void], NamedSimplePattern]
|
||||||
NamedPatternKind* {.pure.} = enum
|
NamedPatternKind* {.pure.} = enum
|
||||||
`named`, `anonymous`
|
`named`, `anonymous`
|
||||||
`NamedPattern`* {.preservesOr.} = ref object
|
`NamedPattern`* {.acyclic, preservesOr.} = ref object
|
||||||
case orKind*: NamedPatternKind
|
case orKind*: NamedPatternKind
|
||||||
of NamedPatternKind.`named`:
|
of NamedPatternKind.`named`:
|
||||||
`named`*: Binding
|
`named`*: Binding
|
||||||
|
@ -74,23 +75,23 @@ type
|
||||||
SimplePatternAtom* {.preservesRecord: "atom".} = object
|
SimplePatternAtom* {.preservesRecord: "atom".} = object
|
||||||
`atomKind`*: AtomKind
|
`atomKind`*: AtomKind
|
||||||
|
|
||||||
SimplePatternEmbedded* {.preservesRecord: "embedded".} = ref object
|
SimplePatternEmbedded* {.acyclic, preservesRecord: "embedded".} = ref object
|
||||||
`interface`*: SimplePattern
|
`interface`*: SimplePattern
|
||||||
|
|
||||||
SimplePatternLit* {.preservesRecord: "lit".} = object
|
SimplePatternLit* {.preservesRecord: "lit".} = object
|
||||||
`value`*: Preserve[void]
|
`value`*: Preserve[void]
|
||||||
|
|
||||||
SimplePatternSeqof* {.preservesRecord: "seqof".} = ref object
|
SimplePatternSeqof* {.acyclic, preservesRecord: "seqof".} = ref object
|
||||||
`pattern`*: SimplePattern
|
`pattern`*: SimplePattern
|
||||||
|
|
||||||
SimplePatternSetof* {.preservesRecord: "setof".} = ref object
|
SimplePatternSetof* {.acyclic, preservesRecord: "setof".} = ref object
|
||||||
`pattern`*: SimplePattern
|
`pattern`*: SimplePattern
|
||||||
|
|
||||||
SimplePatternDictof* {.preservesRecord: "dictof".} = ref object
|
SimplePatternDictof* {.acyclic, preservesRecord: "dictof".} = ref object
|
||||||
`key`*: SimplePattern
|
`key`*: SimplePattern
|
||||||
`value`*: SimplePattern
|
`value`*: SimplePattern
|
||||||
|
|
||||||
`SimplePattern`* {.preservesOr.} = ref object
|
`SimplePattern`* {.acyclic, preservesOr.} = ref object
|
||||||
case orKind*: SimplePatternKind
|
case orKind*: SimplePatternKind
|
||||||
of SimplePatternKind.`any`:
|
of SimplePatternKind.`any`:
|
||||||
`any`* {.preservesLiteral: "any".}: bool
|
`any`* {.preservesLiteral: "any".}: bool
|
||||||
|
@ -119,7 +120,7 @@ type
|
||||||
|
|
||||||
NamedSimplePatternKind* {.pure.} = enum
|
NamedSimplePatternKind* {.pure.} = enum
|
||||||
`named`, `anonymous`
|
`named`, `anonymous`
|
||||||
`NamedSimplePattern`* {.preservesOr.} = ref object
|
`NamedSimplePattern`* {.acyclic, preservesOr.} = ref object
|
||||||
case orKind*: NamedSimplePatternKind
|
case orKind*: NamedSimplePatternKind
|
||||||
of NamedSimplePatternKind.`named`:
|
of NamedSimplePatternKind.`named`:
|
||||||
`named`*: Binding
|
`named`*: Binding
|
||||||
|
@ -130,23 +131,23 @@ type
|
||||||
|
|
||||||
DefinitionKind* {.pure.} = enum
|
DefinitionKind* {.pure.} = enum
|
||||||
`or`, `and`, `Pattern`
|
`or`, `and`, `Pattern`
|
||||||
DefinitionOrField0* {.preservesTuple.} = ref object
|
DefinitionOrField0* {.acyclic, preservesTuple.} = ref object
|
||||||
`pattern0`*: NamedAlternative
|
`pattern0`*: NamedAlternative
|
||||||
`pattern1`*: NamedAlternative
|
`pattern1`*: NamedAlternative
|
||||||
`patternN`* {.preservesTupleTail.}: seq[NamedAlternative]
|
`patternN`* {.preservesTupleTail.}: seq[NamedAlternative]
|
||||||
|
|
||||||
DefinitionOr* {.preservesRecord: "or".} = ref object
|
DefinitionOr* {.acyclic, preservesRecord: "or".} = ref object
|
||||||
`field0`*: DefinitionOrField0
|
`field0`*: DefinitionOrField0
|
||||||
|
|
||||||
DefinitionAndField0* {.preservesTuple.} = ref object
|
DefinitionAndField0* {.acyclic, preservesTuple.} = ref object
|
||||||
`pattern0`*: NamedPattern
|
`pattern0`*: NamedPattern
|
||||||
`pattern1`*: NamedPattern
|
`pattern1`*: NamedPattern
|
||||||
`patternN`* {.preservesTupleTail.}: seq[NamedPattern]
|
`patternN`* {.preservesTupleTail.}: seq[NamedPattern]
|
||||||
|
|
||||||
DefinitionAnd* {.preservesRecord: "and".} = ref object
|
DefinitionAnd* {.acyclic, preservesRecord: "and".} = ref object
|
||||||
`field0`*: DefinitionAndField0
|
`field0`*: DefinitionAndField0
|
||||||
|
|
||||||
`Definition`* {.preservesOr.} = ref object
|
`Definition`* {.acyclic, preservesOr.} = ref object
|
||||||
case orKind*: DefinitionKind
|
case orKind*: DefinitionKind
|
||||||
of DefinitionKind.`or`:
|
of DefinitionKind.`or`:
|
||||||
`or`*: DefinitionOr
|
`or`*: DefinitionOr
|
||||||
|
@ -158,21 +159,21 @@ type
|
||||||
`pattern`*: Pattern
|
`pattern`*: Pattern
|
||||||
|
|
||||||
|
|
||||||
NamedAlternative* {.preservesTuple.} = ref object
|
NamedAlternative* {.acyclic, preservesTuple.} = ref object
|
||||||
`variantLabel`*: string
|
`variantLabel`*: string
|
||||||
`pattern`*: Pattern
|
`pattern`*: Pattern
|
||||||
|
|
||||||
SchemaField0* {.preservesDictionary.} = ref object
|
SchemaField0* {.acyclic, preservesDictionary.} = ref object
|
||||||
`version`* {.preservesLiteral: "1".}: tuple[]
|
|
||||||
`embeddedType`*: EmbeddedTypeName
|
|
||||||
`definitions`*: Definitions
|
`definitions`*: Definitions
|
||||||
|
`embeddedType`*: EmbeddedTypeName
|
||||||
|
`version`* {.preservesLiteral: "1".}: tuple[]
|
||||||
|
|
||||||
Schema* {.preservesRecord: "schema".} = ref object
|
Schema* {.acyclic, preservesRecord: "schema".} = ref object
|
||||||
`field0`*: SchemaField0
|
`field0`*: SchemaField0
|
||||||
|
|
||||||
PatternKind* {.pure.} = enum
|
PatternKind* {.pure.} = enum
|
||||||
`SimplePattern`, `CompoundPattern`
|
`SimplePattern`, `CompoundPattern`
|
||||||
`Pattern`* {.preservesOr.} = ref object
|
`Pattern`* {.acyclic, preservesOr.} = ref object
|
||||||
case orKind*: PatternKind
|
case orKind*: PatternKind
|
||||||
of PatternKind.`SimplePattern`:
|
of PatternKind.`SimplePattern`:
|
||||||
`simplepattern`*: SimplePattern
|
`simplepattern`*: SimplePattern
|
||||||
|
@ -181,7 +182,7 @@ type
|
||||||
`compoundpattern`*: CompoundPattern
|
`compoundpattern`*: CompoundPattern
|
||||||
|
|
||||||
|
|
||||||
Binding* {.preservesRecord: "named".} = ref object
|
Binding* {.acyclic, preservesRecord: "named".} = ref object
|
||||||
`name`*: Symbol
|
`name`*: Symbol
|
||||||
`pattern`*: SimplePattern
|
`pattern`*: SimplePattern
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue