diff --git a/_rsrch/microbench/typedbuilders/typedbuilders_test.go b/_rsrch/microbench/typedbuilders/typedbuilders_test.go index 500217dd3ac2683dddcb24af908e2fce5ba3b0f0..e8b05359c8a003fd5f81c5f883b18b28eb0aa5bc 100644 --- a/_rsrch/microbench/typedbuilders/typedbuilders_test.go +++ b/_rsrch/microbench/typedbuilders/typedbuilders_test.go @@ -1,6 +1,6 @@ /* Designing how the user should interact with, build, and mutate data - when using natively-typed/generated code for DMS3LD-Schema-based structures... + when using natively-typed/generated code for LD-Schema-based structures... is nontrivial. We have to account for the distinction between nullable and optional/absent fields. diff --git a/adl/rot13adl/example_test.go b/adl/rot13adl/example_test.go index 4b6270c8bcc92b95d25d7cfffcc238206d9535d0..30c0be86e48713fd28ca576faa007c4e5ac760b6 100644 --- a/adl/rot13adl/example_test.go +++ b/adl/rot13adl/example_test.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "gitlab.dms3.io/dms3/public/go-cid" + "gitlab.dms3.io/dms3/go-cid" "gitlab.dms3.io/ld/go-ld-prime/adl/rot13adl" "gitlab.dms3.io/ld/go-ld-prime/codec/dagjson" @@ -90,7 +90,7 @@ func ExampleCreatingViaADL() { // Create a NodeBuilder for the ADL -- the high-level synthesized thing (not the substrate). nb := rot13adl.Prototype.Node.NewBuilder() - // Create a ADL node via its builder. This is just like creating any other node in DMS3LD. + // Create a ADL node via its builder. This is just like creating any other node in LD. nb.AssignString("woohoo") n := nb.Build() @@ -99,7 +99,7 @@ func ExampleCreatingViaADL() { fmt.Printf("adl view value: %q\n", must.String(n)) // We can get the substrate view and examine that as a node too. - // (This requires a cast to see that we have an ADL, though. Not all DMS3LD nodes have a 'Substrate' property.) + // (This requires a cast to see that we have an ADL, though. Not all LD nodes have a 'Substrate' property.) substrateNode := n.(rot13adl.R13String).Substrate() fmt.Printf("substrate node kind: %v\n", substrateNode.Kind()) fmt.Printf("substrate value: %q\n", must.String(substrateNode)) @@ -134,7 +134,7 @@ func ExampleCreatingViaADL() { // There will be several ways to do this (it hinges around "the signalling problem", // discussed in https://gitlab.dms3.io/ld/specs/issues/130 ): // -// The first way is to use DMS3LD Schemas, which provide a signalling mechanism +// The first way is to use LD Schemas, which provide a signalling mechanism // by leaning on the schema, and the matching of shape of surrounding data to the schema, // as a way to determine where an ADL is expected to appear. // diff --git a/adl/rot13adl/rot13node.go b/adl/rot13adl/rot13node.go index 84311a08fbeff65a181cf5b8f79a1de7b1e2b877..8658dc5c5bc3a7a8779ea6839443556fc8df1788 100644 --- a/adl/rot13adl/rot13node.go +++ b/adl/rot13adl/rot13node.go @@ -7,7 +7,7 @@ There are several ways to move data in and out of the ADL: - - treat it like a regular DMS3LD map: + - treat it like a regular LD map: - using the exported NodePrototype can be used to get a NodeBuilder which can accept keys and values; - using the resulting Node and doing lookup operations on it like a regular map; - load up raw substrate data and `Reify()` it into the synthesized form, and *then* treat it like a regular map: diff --git a/adl/rot13adl/rot13node_test.go b/adl/rot13adl/rot13node_test.go index 32f4d314b9656471adc93e943675ecba5e73ab98..be355a14ea2c66b6339ecc94ea750748c1a90557 100644 --- a/adl/rot13adl/rot13node_test.go +++ b/adl/rot13adl/rot13node_test.go @@ -71,7 +71,7 @@ func TestInspectingSubstrate(t *testing.T) { sn := n.(R13String).Substrate() // TODO: It's unfortunate this is only available as a concrete type cast: we should probably make a standard feature detection interface with `Substrate()`. // Is it reasonable to make this part of a standard feature detection pattern, - // and make that interface reside in the main DMS3LD package? Or in an `adl` package that contains such standard interfaces? + // and make that interface reside in the main LD package? Or in an `adl` package that contains such standard interfaces? ss, err := sn.AsString() Wish(t, err, ShouldEqual, nil) Wish(t, ss, ShouldEqual, "nopq") diff --git a/adl/rot13adl/rot13prototypes.go b/adl/rot13adl/rot13prototypes.go index 7f15c605ff45aab960fb823cbf7ae565c94ac0f5..2509b93592efcad072a680a485da9480f81eb3cf 100644 --- a/adl/rot13adl/rot13prototypes.go +++ b/adl/rot13adl/rot13prototypes.go @@ -24,7 +24,7 @@ type prototype struct { SubstrateRoot _Substrate__Prototype } -// REVIEW: In ADLs that use codegenerated substrate types defined by an DMS3LD Schema, the `Prototype.SubstrateRoot` field... +// REVIEW: In ADLs that use codegenerated substrate types defined by an LD Schema, the `Prototype.SubstrateRoot` field... // should it be a `_SubstrateRoot__Prototype`, or a `_SubstrateRoot__ReprPrototype`? // Probably the latter, because the only thing an external user of this package should be interested in is how to read data into memory in an optimal path. // But does this answer all questions? Codegen ReprPrototypes currently still return the type-level node from their Build method! diff --git a/adl/rot13adl/rot13reification.go b/adl/rot13adl/rot13reification.go index ea5ece7ec9f6d7ed254b8fa67f52c2d9d75c2fcf..4764de26ede90b2234cca4a1957b09ca9662d870 100644 --- a/adl/rot13adl/rot13reification.go +++ b/adl/rot13adl/rot13reification.go @@ -42,7 +42,7 @@ import ( // func Reify(maybeSubstrateRoot ld.Node) (ld.Node, error) { // Reify is often very easy to implement, - // especially if you have an DMS3LD Schema that specifies the shape of the substrate data: + // especially if you have an LD Schema that specifies the shape of the substrate data: // We can just check if the data in maybeSubstrateRoot happens to already be exactly the right type, // and if so, take very direct shortcuts because we already know its been validated in shape; // otherwise, we create a new piece of memory for our native substrate memory layout, diff --git a/codec/dagcbor/roundtripCidlink_test.go b/codec/dagcbor/roundtripCidlink_test.go index 7bfd1d5c0befde6b2c1eb4a7d8fd7ac81f67fe7f..a6cf21eda9d24dbafa0668c1b95d287deed6749b 100644 --- a/codec/dagcbor/roundtripCidlink_test.go +++ b/codec/dagcbor/roundtripCidlink_test.go @@ -7,7 +7,7 @@ import ( . "github.com/warpfork/go-wish" - cid "gitlab.dms3.io/dms3/public/go-cid" + cid "gitlab.dms3.io/dms3/go-cid" ld "gitlab.dms3.io/ld/go-ld-prime" cidlink "gitlab.dms3.io/ld/go-ld-prime/linking/cid" basicnode "gitlab.dms3.io/ld/go-ld-prime/node/basic" diff --git a/codec/dagcbor/roundtrip_test.go b/codec/dagcbor/roundtrip_test.go index 1fd2fb36f05bb7353888e3cbb63d1aab5a2253a8..416c03f3921e42c9b64980ea4c38079a7f835f8a 100644 --- a/codec/dagcbor/roundtrip_test.go +++ b/codec/dagcbor/roundtrip_test.go @@ -7,7 +7,7 @@ import ( "testing" . "github.com/warpfork/go-wish" - cid "gitlab.dms3.io/dms3/public/go-cid" + cid "gitlab.dms3.io/dms3/go-cid" "gitlab.dms3.io/ld/go-ld-prime/fluent" cidlink "gitlab.dms3.io/ld/go-ld-prime/linking/cid" diff --git a/codec/dagcbor/unmarshal.go b/codec/dagcbor/unmarshal.go index bea8577e6599f1b5b33285103cf062d238f6955c..723f644ea3bf2fc68ebdacb313dd2f3db60781d4 100644 --- a/codec/dagcbor/unmarshal.go +++ b/codec/dagcbor/unmarshal.go @@ -7,14 +7,14 @@ import ( "github.com/polydawn/refmt/shared" "github.com/polydawn/refmt/tok" - cid "gitlab.dms3.io/dms3/public/go-cid" + cid "gitlab.dms3.io/dms3/go-cid" ld "gitlab.dms3.io/ld/go-ld-prime" cidlink "gitlab.dms3.io/ld/go-ld-prime/linking/cid" ) var ( - ErrInvalidMultibase = errors.New("invalid multibase on DMS3LD link") + ErrInvalidMultibase = errors.New("invalid multibase on LD link") ErrAllocationBudgetExceeded = errors.New("message structure demanded too many resources to process") ) diff --git a/codec/dagjson/roundtripCidlink_test.go b/codec/dagjson/roundtripCidlink_test.go index ac8fda6ee66f1db01ccfcdda4a5f2e5aff90f7bd..5c200e698d5831439d442cd335cc7f33150ddb64 100644 --- a/codec/dagjson/roundtripCidlink_test.go +++ b/codec/dagjson/roundtripCidlink_test.go @@ -8,7 +8,7 @@ import ( . "github.com/warpfork/go-wish" - cid "gitlab.dms3.io/dms3/public/go-cid" + cid "gitlab.dms3.io/dms3/go-cid" ld "gitlab.dms3.io/ld/go-ld-prime" cidlink "gitlab.dms3.io/ld/go-ld-prime/linking/cid" basicnode "gitlab.dms3.io/ld/go-ld-prime/node/basic" diff --git a/codec/dagjson/unmarshal.go b/codec/dagjson/unmarshal.go index 9ace418ed0a37a0feb1e54c641177d0fc2ccb10c..1c91e34ef8f1141365f0d38276ece4c7c1162b1f 100644 --- a/codec/dagjson/unmarshal.go +++ b/codec/dagjson/unmarshal.go @@ -6,7 +6,7 @@ import ( "github.com/polydawn/refmt/shared" "github.com/polydawn/refmt/tok" - cid "gitlab.dms3.io/dms3/public/go-cid" + cid "gitlab.dms3.io/dms3/go-cid" ld "gitlab.dms3.io/ld/go-ld-prime" cidlink "gitlab.dms3.io/ld/go-ld-prime/linking/cid" diff --git a/codec/jst/jst.go b/codec/jst/jst.go index 3bc7b5899d378d6de3682dc5cdfbbc4f64660445..3451c784021d4873b28f3f7e19b1ae462ad14487 100644 --- a/codec/jst/jst.go +++ b/codec/jst/jst.go @@ -27,7 +27,7 @@ The overall nature of detecting traits of the data (particularly, size) means JSON Tables cannot be created streamingly; we have to process the entire structure first, and only then can we begin to output correctly aligned data. - (It's for this reason that this is implemented over DMS3LD Nodes, and would be somewhat painful to implement using just refmt Tokens -- we'd end up buffering *all* the tokens anyway, and wanting to build an index, etc.) + (It's for this reason that this is implemented over LD Nodes, and would be somewhat painful to implement using just refmt Tokens -- we'd end up buffering *all* the tokens anyway, and wanting to build an index, etc.) There's no unmarshal functions because unmarshal is just... regular JSON unmarshal. */ diff --git a/codec/raw/codec.go b/codec/raw/codec.go index 70b7d1b62afef4ad6d71b984f7f97ba1e0633654..835ae54a7143a0d2bc8110cc684452696e26d62d 100644 --- a/codec/raw/codec.go +++ b/codec/raw/codec.go @@ -1,4 +1,4 @@ -// Package raw implements DMS3LD's raw codec, which simply writes and reads a Node +// Package raw implements LD's raw codec, which simply writes and reads a Node // which can be represented as bytes. // // The codec can be used with any node which supports AsBytes and AssignBytes. diff --git a/codec/raw/codec_test.go b/codec/raw/codec_test.go index 27e5e13f2bb1392ed0d63d6895236d4d6048a440..b4ffc9b5f0e8528705ed1feeba082f8dc0fe0237 100644 --- a/codec/raw/codec_test.go +++ b/codec/raw/codec_test.go @@ -7,7 +7,7 @@ import ( "testing" qt "github.com/frankban/quicktest" - "gitlab.dms3.io/dms3/public/go-cid" + "gitlab.dms3.io/dms3/go-cid" ld "gitlab.dms3.io/ld/go-ld-prime" cidlink "gitlab.dms3.io/ld/go-ld-prime/linking/cid" basicnode "gitlab.dms3.io/ld/go-ld-prime/node/basic" diff --git a/doc.go b/doc.go index 084db1aacb827d506ea80023fa8d5ae85eeaff83..4195f54aba78da1947dcdb41339195620b3cfb9a 100644 --- a/doc.go +++ b/doc.go @@ -1,7 +1,7 @@ -// go-ld-prime is a series of go interfaces for manipulating DMS3LD data. +// go-ld-prime is a series of go interfaces for manipulating LD data. // // See https://gitlab.dms3.io/ld/specs for more information about the basics -// of "What is DMS3LD?". +// of "What is LD?". // // See https://gitlab.dms3.io/ld/go-ld-prime/tree/master/doc/README.md // for more documentation about go-ld-prime's architecture and usage. @@ -14,7 +14,7 @@ // // These types provide a generic description of the data model. // -// A Node is a piece of DMS3LD data which can be inspected. +// A Node is a piece of LD data which can be inspected. // A NodeAssembler is used to create Nodes. // (A NodeBuilder is just like a NodeAssembler, but allocates memory // (whereas a NodeAssembler just fills up memory; using these carefully @@ -57,7 +57,7 @@ // automatic link loading) and visiting // - must -- helpful functions for streamlining error handling // - fluent -- alternative Node interfaces that flip errors to panics -// - schema -- interfaces for working with DMS3LD Schemas and Nodes +// - schema -- interfaces for working with LD Schemas and Nodes // which use Schema types and constraints // // Note that since interfaces in this package are the core of the library, diff --git a/equal.go b/equal.go index 3a6bfdbcaa2e4401083916d9df03ba919275e6af..811534a0afc1d3401a63cd9917c1983926b58fec 100644 --- a/equal.go +++ b/equal.go @@ -1,6 +1,6 @@ package ld -// DeepEqual reports whether x and y are "deeply equal" as DMS3LD nodes. +// DeepEqual reports whether x and y are "deeply equal" as LD nodes. // This is similar to reflect.DeepEqual, but based around the Node interface. // // Two nodes must have the same kind to be deeply equal. @@ -12,7 +12,7 @@ package ld // // Note that Links are compared in a shallow way, without being followed. // This will generally be enough, as it's rare to have two different links to the -// same DMS3LD data by using a different codec or multihash type. +// same LD data by using a different codec or multihash type. // // Two nodes of recursive kinds (map, list) // must have the same length to be deeply equal. diff --git a/equal_test.go b/equal_test.go index 1a06d22c43d8e6ec40b1c9d680675697adb3ea75..86ebc88721055c4d8ea7a80e2f0e5bc464d148d4 100644 --- a/equal_test.go +++ b/equal_test.go @@ -3,7 +3,7 @@ package ld_test import ( "testing" - "gitlab.dms3.io/dms3/public/go-cid" + "gitlab.dms3.io/dms3/go-cid" ld "gitlab.dms3.io/ld/go-ld-prime" "gitlab.dms3.io/ld/go-ld-prime/fluent/qp" cidlink "gitlab.dms3.io/ld/go-ld-prime/linking/cid" diff --git a/errors.go b/errors.go index df180c240e3a6b1313e17b7bab2926fd4efddbbd..f3f06319439fd60b15ee99bb33bddb16ea0f3f1a 100644 --- a/errors.go +++ b/errors.go @@ -135,7 +135,7 @@ func (e ErrHashMismatch) Error() string { return fmt.Sprintf("hash mismatch! %v (actual) != %v (expected)", e.Actual, e.Expected) } -// ErrUnmatchable is the error raised when processing data with DMS3LD Schemas and +// ErrUnmatchable is the error raised when processing data with LD Schemas and // finding data which cannot be matched into the schema. // It will be returned by NodeAssemblers and NodeBuilders when they are fed unmatchable data. // As a result, it will also often be seen returned from unmarshalling diff --git a/fluent/qp/qp.go b/fluent/qp/qp.go index bafd412c714fac5fc90e1d87153903625137b421..e4d192a853495a4ea7bd73e8326c8f150d99060c 100644 --- a/fluent/qp/qp.go +++ b/fluent/qp/qp.go @@ -1,4 +1,4 @@ -// qp helps to quickly build DMS3LD nodes. +// qp helps to quickly build LD nodes. // // It contains top-level Build funcs, such as BuildMap and BuildList, which // return the final node as well as an error. @@ -9,7 +9,7 @@ // Finally, functions like MapEntry and ListEntry allow inserting into maps and // lists. // -// These all use the same DMS3LD interfaces such as NodePrototype and +// These all use the same LD interfaces such as NodePrototype and // NodeAssembler, but with some magic to reduce verbosity. package qp diff --git a/fluent/reflect.go b/fluent/reflect.go index 63983119d85c34590b890f50b00e0c9bd6a164a7..2394b408a9e818b7ecc053f373f0068c04d2f577 100644 --- a/fluent/reflect.go +++ b/fluent/reflect.go @@ -9,8 +9,8 @@ import ( ) // Reflect creates a new Node by looking at a golang value with reflection -// and converting it into DMS3LD Data Model. -// This is a quick-and-dirty way to get data into the DMS3LD Data Model; +// and converting it into LD Data Model. +// This is a quick-and-dirty way to get data into the LD Data Model; // it's useful for rapid prototyping and demos, // but note that this feature is not intended to be suitable for "production" use // due to low performance and lack of configurability. @@ -21,9 +21,9 @@ import ( // No type information from the golang value will be observable in the result. // // The reflection will walk over any golang value, but is not configurable. -// Golang maps become DMS3LD maps; golang slices and arrays become DMS3LD lists; -// and golang structs become DMS3LD maps too. -// When converting golang structs to DMS3LD maps, the field names will become the map keys. +// Golang maps become LD maps; golang slices and arrays become LD lists; +// and golang structs become LD maps too. +// When converting golang structs to LD maps, the field names will become the map keys. // Pointers and interfaces will be traversed transparently and are not visible in the output. // // An error will be returned if the process of assembling the Node returns any errors @@ -39,9 +39,9 @@ import ( // (This function is a shortcut for calling that method on a Reflector struct with default configuration.) // // Performance remarks: performance of this function will generally be poor. -// In general, creating data in golang types and then *flipping* it to DMS3LD form +// In general, creating data in golang types and then *flipping* it to LD form // involves handling the data at least twice, and so will always be slower -// than just creating the same data in DMS3LD form programmatically directly. +// than just creating the same data in LD form programmatically directly. // In particular, reflection is generally not fast, and this feature has // not been optimized for either speed nor allocation avoidance. // Other features in the fluent package will typically out-perform this, diff --git a/go.mod b/go.mod index a8ab34805cc5be3848c70db8a3ac47eb463a75b9..c5c7c8fa6d5e976be052628042a65161545e93cc 100644 --- a/go.mod +++ b/go.mod @@ -8,5 +8,5 @@ require ( github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1 github.com/smartystreets/goconvey v1.6.4 // indirect github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a - gitlab.dms3.io/dms3/public/go-cid v0.0.2 + gitlab.dms3.io/dms3/go-cid v0.0.3 ) diff --git a/go.sum b/go.sum index 230f36933b375b241bf6f81ba74ed399c053df4f..c11e5b69595f7c223e44ce838bbacbd881c81ba2 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,8 @@ github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0b github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a h1:G++j5e0OC488te356JvdhaM8YS6nMsjLAYF7JxCv07w= github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= -gitlab.dms3.io/dms3/public/go-cid v0.0.2 h1:DLI843W/j0Khbx2gLo1B+8YZPGybMeK5k6R8cSOxvr0= -gitlab.dms3.io/dms3/public/go-cid v0.0.2/go.mod h1:GQw3gc4CSrFY+aX6M+OBQDlg0p5/eQJoRrayaZzkAOQ= +gitlab.dms3.io/dms3/go-cid v0.0.3 h1:5qZ1sl1Bi26naLz7Vsc8fjWcJKX8bR6njt3WPCteXac= +gitlab.dms3.io/dms3/go-cid v0.0.3/go.mod h1:qT/Q1NZD31UnWQ+rwsQgzGrrsQhpq7dYSlXf7ulDgtk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g= diff --git a/kind.go b/kind.go index ef5ebd8b1a6534c330c4e2512e986cea10561500..720ed8b3953148f9bc2c7b8534540a465dd5ce62 100644 --- a/kind.go +++ b/kind.go @@ -1,6 +1,6 @@ package ld -// Kind represents the primitive kind in the DMS3LD data model. +// Kind represents the primitive kind in the LD data model. // All of these kinds map directly onto serializable data. // // Note that Kind contains the concept of "map", but not "struct" diff --git a/link.go b/link.go index 5784cc5b3a4d33e2881afe6408853ccbfd73355f..c7585bff0ed5982506a433e8db2cac00e07b473a 100644 --- a/link.go +++ b/link.go @@ -4,13 +4,13 @@ import ( "context" ) -// Link is a special kind of value in DMS3LD which can be "loaded" to access more nodes. +// Link is a special kind of value in LD which can be "loaded" to access more nodes. // -// Nodes can be a Link: "link" is one of the kinds in the DMS3LD Data Model; +// Nodes can be a Link: "link" is one of the kinds in the LD Data Model; // and accordingly there is an `ld.Kind_Link` enum value, and Node has an `AsLink` method. // -// Links are considered a scalar value in the DMS3LD Data Model, -// but when "loaded", the result can be any other DMS3LD kind: +// Links are considered a scalar value in the LD Data Model, +// but when "loaded", the result can be any other LD kind: // maps, lists, strings, etc. // // Link is an interface in the go-ld-prime implementation, diff --git a/linking/cid/cidLink.go b/linking/cid/cidLink.go index 647a75be96e38ac1b51e903ba3e44789203d114b..3137881ddd8f4ecc7c1fa99d97b425411f56e98e 100644 --- a/linking/cid/cidLink.go +++ b/linking/cid/cidLink.go @@ -4,7 +4,7 @@ import ( "fmt" multihash "github.com/multiformats/go-multihash" - cid "gitlab.dms3.io/dms3/public/go-cid" + cid "gitlab.dms3.io/dms3/go-cid" ld "gitlab.dms3.io/ld/go-ld-prime" ) @@ -14,7 +14,7 @@ var ( ) // Link implements the ld.Link interface using a CID. -// See https://gitlab.dms3.io/dms3/public/go-cid for more information about CIDs. +// See https://gitlab.dms3.io/dms3/go-cid for more information about CIDs. // // When using this value, typically you'll use it as `Link`, and not `*Link`. // This includes when handling the value as an `ld.Link` interface -- the non-pointer form is typically preferable. diff --git a/linkingExamples_test.go b/linkingExamples_test.go index 48679479a37af96441e26da31b6e0e4e94755e0b..d1d41a3ffd18900c7afd9ed147934b30c88888ad 100644 --- a/linkingExamples_test.go +++ b/linkingExamples_test.go @@ -3,7 +3,7 @@ package ld_test import ( "fmt" - "gitlab.dms3.io/dms3/public/go-cid" + "gitlab.dms3.io/dms3/go-cid" ld "gitlab.dms3.io/ld/go-ld-prime" _ "gitlab.dms3.io/ld/go-ld-prime/codec/dagcbor" @@ -13,7 +13,7 @@ import ( "gitlab.dms3.io/ld/go-ld-prime/storage" ) -// storage is a map where we'll store serialized DMS3LD data. +// storage is a map where we'll store serialized LD data. // // ExampleLinkSystem_Store will put data into this; // ExampleLinkSystem_Load will read out from it. diff --git a/linksystem.go b/linksystem.go index 8ee65d1ffa0a062bbb2bbc71116a689c7c43e0fe..7e843e9bd830a0c2b180e99e2eb32788b8f7dc93 100644 --- a/linksystem.go +++ b/linksystem.go @@ -7,7 +7,7 @@ import ( ) // LinkSystem is a struct that composes all the individual functions -// needed to load and store content addressed data using DMS3LD -- +// needed to load and store content addressed data using LD -- // encoding functions, hashing functions, and storage connections -- // and then offers the operations a user wants -- Store and Load -- as methods. // @@ -70,9 +70,9 @@ type ( // you'll need to figure out how to transform that golang structure into an ld.Node tree first. // // It may be useful to understand "multicodecs" when working with Encoders. - // In DMS3LD, a system called "multicodecs" is typically used to describe encoding foramts. + // In LD, a system called "multicodecs" is typically used to describe encoding foramts. // A "multicodec indicator" is a number which describes an encoding; - // the Link implementations used in DMS3LD (CIDs) store a multicodec indicator in the Link; + // the Link implementations used in LD (CIDs) store a multicodec indicator in the Link; // and in this library, a multicodec registry exists in the `codec` package, // and can be used to associate a multicodec indicator number with an Encoder function. // The default EncoderChooser in a LinkSystem will use this multicodec registry to select Encoder functions. @@ -113,7 +113,7 @@ type ( // // Some libraries might provide a "blockstore" object that has these as methods; // it may also have more methods (like enumeration features, GC features, etc), -// but DMS3LD doesn't generally concern itself with those. +// but LD doesn't generally concern itself with those. // We just need these key things, so we can "put" and "get". // // The functions are a tad more complicated than "put" and "get" so that they have good mechanical sympathy. @@ -139,7 +139,7 @@ type ( // // Reads are cancellable by cancelling the LinkContext.Context. // - // Other parts of the DMS3LD library suite (such as the traversal package, and all its functions) + // Other parts of the LD library suite (such as the traversal package, and all its functions) // will typically take a Context as a parameter or piece of config from the caller, // and will pass that down through the LinkContext, meaning this can be used to // carry information as well as cancellation control all the way through the system. @@ -169,7 +169,7 @@ type ( // // Writes are cancellable by cancelling the LinkContext.Context. // - // Other parts of the DMS3LD library suite (such as the traversal package, and all its functions) + // Other parts of the LD library suite (such as the traversal package, and all its functions) // will typically take a Context as a parameter or piece of config from the caller, // and will pass that down through the LinkContext, meaning this can be used to // carry information as well as cancellation control all the way through the system. diff --git a/multicodec/defaultRegistry.go b/multicodec/defaultRegistry.go index b9219278120b0b96f3dffed82aef3c43081f4c49..eae2136b1a9386a20d41788986e82e2aa4945290 100644 --- a/multicodec/defaultRegistry.go +++ b/multicodec/defaultRegistry.go @@ -26,7 +26,7 @@ var DefaultRegistry = Registry{} // The encoder functions registered can be subsequently looked up using LookupEncoder. // It is a shortcut to the RegisterEncoder method on the global DefaultRegistry. // -// Packages which implement an DMS3LD codec and have a multicodec number associated with them +// Packages which implement an LD codec and have a multicodec number associated with them // are encouraged to register themselves at package init time using this function. // (Doing this at package init time ensures the default global registry is populated // without causing race conditions for application code.) @@ -73,7 +73,7 @@ func ListEncoders() []uint64 { // The decoder functions registered can be subsequently looked up using LookupDecoder. // It is a shortcut to the RegisterDecoder method on the global DefaultRegistry. // -// Packages which implement an DMS3LD codec and have a multicodec number associated with them +// Packages which implement an LD codec and have a multicodec number associated with them // are encouraged to register themselves in this map at package init time. // (Doing this at package init time ensures the default global registry is populated // without causing race conditions for application code.) diff --git a/node.go b/node.go index 8676266e758111597172427e17c739cc96922a44..891024c77476d20d805fd91f9e3ff6dcf2b36ddb 100644 --- a/node.go +++ b/node.go @@ -1,10 +1,10 @@ package ld -// Node represents a value in DMS3LD. Any point in a tree of data is a node: +// Node represents a value in LD. Any point in a tree of data is a node: // scalar values (like int64, string, etc) are nodes, and // so are recursive values (like map and list). // -// Nodes and kinds are described in the DMS3LD specs at +// Nodes and kinds are described in the LD specs at // https://gitlab.dms3.io/ld/specs/blob/master/data-model-layer/data-model.md . // // Methods on the Node interface cover the superset of all possible methods for @@ -122,7 +122,7 @@ type Node interface { // before itr.Done becomes true. // // List iteration is ordered, and indices yielded during iteration will range from 0 to Node.Length-1. - // (The DMS3LD Data Model definition of lists only defines that it is an ordered list of elements; + // (The LD Data Model definition of lists only defines that it is an ordered list of elements; // the definition does not include a concept of sparseness, so the indices are always sequential.) ListIterator() ListIterator @@ -166,7 +166,7 @@ type Node interface { } // ADL represents an Advanced Data Layout, a special kind of Node which -// implements custom logic while still behaving like an DMS3LD node. +// implements custom logic while still behaving like an LD node. // // For more details, see the docs at // https://gitlab.dms3.io/ld/specs/blob/master/schemas/authoring-guide.md. @@ -183,17 +183,17 @@ type ADL interface { // // A NodePrototype may also provide other information about implementation; // such information is specific to this library ("prototype" isn't a concept -// you'll find in the DMS3LD Specifications), and is usually provided through +// you'll find in the LD Specifications), and is usually provided through // feature-detection interfaces (for example, see NodePrototypeSupportingAmend). // -// Generic algorithms for working with DMS3LD Nodes make use of NodePrototype +// Generic algorithms for working with LD Nodes make use of NodePrototype // to get builders for new nodes when creating data, and can also use the // feature-detection interfaces to help decide what kind of operations // will be optimal to use on a given node implementation. // // Note that NodePrototype is not the same as schema.Type. // NodePrototype is a (golang-specific!) way to reflect upon the implementation -// and in-memory layout of some DMS3LD data. +// and in-memory layout of some LD data. // schema.Type is information about how a group of nodes is related in a schema // (if they have one!) and the rules that the type mandates the node must follow. // (Every node must have a prototype; but schema types are an optional feature.) diff --git a/node/bindnode/api.go b/node/bindnode/api.go index 47fda8407d4002d0d662edec0db5556ed5dca5b5..494d0cb4d6f74eb93a10b3a7c930c46608e3ca1f 100644 --- a/node/bindnode/api.go +++ b/node/bindnode/api.go @@ -9,7 +9,7 @@ import ( ) // Prototype implements a schema.TypedPrototype given a Go pointer type and an -// DMS3LD schema type. Note that the result is also an ld.NodePrototype. +// LD schema type. Note that the result is also an ld.NodePrototype. // // If both the Go type and schema type are supplied, it is assumed that they are // compatible with one another. @@ -49,7 +49,7 @@ func Prototype(ptrType interface{}, schemaType schema.Type) schema.TypedPrototyp } // Wrap implements a schema.TypedNode given a non-nil pointer to a Go value and an -// DMS3LD schema type. Note that the result is also an ld.Node. +// LD schema type. Note that the result is also an ld.Node. // // Wrap is meant to be used when one already has a Go value with data. // As such, ptrVal must not be nil. diff --git a/node/bindnode/infer.go b/node/bindnode/infer.go index ec473acdb04f223124304d68418b824ac6d96730..e70604e1d45b97361c1be4ac518c905754d088b4 100644 --- a/node/bindnode/infer.go +++ b/node/bindnode/infer.go @@ -46,7 +46,7 @@ func inferGoType(typ schema.Type) reflect.Type { vtyp = reflect.PtrTo(vtyp) } // We need an extra field to keep the map ordered, - // since DMS3LD maps must have stable iteration order. + // since LD maps must have stable iteration order. // We could sort when iterating, but that's expensive. // Keeping the insertion order is easy and intuitive. // @@ -82,7 +82,7 @@ func inferGoType(typ schema.Type) reflect.Type { panic(fmt.Sprintf("%T\n", typ)) } -// from DMS3LD Schema field names like "foo" to Go field names like "Foo". +// from LD Schema field names like "foo" to Go field names like "Foo". func fieldNameFromSchema(name string) string { return strings.Title(name) } diff --git a/node/bindnode/node.go b/node/bindnode/node.go index 0373eaecf2c49e6e4b1a7e6f021050e0761227a4..c0f32ddf0e8189f84e72828dd80295b4fe1f384e 100644 --- a/node/bindnode/node.go +++ b/node/bindnode/node.go @@ -147,7 +147,7 @@ func (w *_node) LookupByString(key string) (ld.Node, error) { } // TODO: Error/panic if fval.IsNil() && !typ.ValueIsNullable()? // Otherwise we could have two non-equal Go values (nil map, - // non-nil-but-empty map) which represent the exact same DMS3LD + // non-nil-but-empty map) which represent the exact same LD // node when the field is not nullable. if typ.ValueIsNullable() { if fval.IsNil() { diff --git a/node/gendemo/doc.go b/node/gendemo/doc.go index 2fb79d2f4a671e6ad04d81fb683e28d17b404fe3..cf608843d91c2a8c944a568617d1456b365b464d 100644 --- a/node/gendemo/doc.go +++ b/node/gendemo/doc.go @@ -10,7 +10,7 @@ // // The input info for the code generation is in `gen.go` file. // (This is currently wired directly in code; in the future, the same instructions -// will be extracted to an DMS3LD Schema file and standard tools will be used to process it.) +// will be extracted to an LD Schema file and standard tools will be used to process it.) // The code generation is triggered by `go:generate` comments in the `doc.go` file. //go:generate go run gen.go diff --git a/node/gendemo/ldsch_types.go b/node/gendemo/ldsch_types.go index cafd1d938f6ffd76994fa1fc28427d1285e07787..9a6844f3475057092e8c582f04fede410feaa743 100644 --- a/node/gendemo/ldsch_types.go +++ b/node/gendemo/ldsch_types.go @@ -32,11 +32,11 @@ type typeSlab struct { // --- type definitions follow --- -// Int matches the DMS3LD Schema type "Int". It has int kind. +// Int matches the LD Schema type "Int". It has int kind. type Int = *_Int type _Int struct{ x int64 } -// Map__String__Msg3 matches the DMS3LD Schema type "Map__String__Msg3". It has map kind. +// Map__String__Msg3 matches the LD Schema type "Map__String__Msg3". It has map kind. type Map__String__Msg3 = *_Map__String__Msg3 type _Map__String__Msg3 struct { m map[_String]*_Msg3 @@ -47,7 +47,7 @@ type _Map__String__Msg3__entry struct { v _Msg3 } -// Msg3 matches the DMS3LD Schema type "Msg3". It has Struct type-kind, and may be interrogated like map kind. +// Msg3 matches the LD Schema type "Msg3". It has Struct type-kind, and may be interrogated like map kind. type Msg3 = *_Msg3 type _Msg3 struct { whee _Int @@ -55,6 +55,6 @@ type _Msg3 struct { waga _Int } -// String matches the DMS3LD Schema type "String". It has string kind. +// String matches the LD Schema type "String". It has string kind. type String = *_String type _String struct{ x string } diff --git a/node/tests/marshalBenchmarks.go b/node/tests/marshalBenchmarks.go index 522692b187aa9e9f88692cd0b8df87b534f22a4e..f4fab86d4cead3c80a54dac750b1427504fe0528 100644 --- a/node/tests/marshalBenchmarks.go +++ b/node/tests/marshalBenchmarks.go @@ -19,7 +19,7 @@ import ( // This does mean we're measuring a bunch of stuff that has nothing to do // with the core operations of the Node/NodeBuilder interface. // We do this so that: -// - we get a reasonable picture of how much time is spent in the DMS3LD Data Model +// - we get a reasonable picture of how much time is spent in the LD Data Model // versus how much time is spent in the serialization efforts; // - we can make direct comparisons to the standard library json marshalling // and unmarshalling, thus having a back-of-the-envelope baseline to compare. diff --git a/node/tests/unmarshalBenchmarks.go b/node/tests/unmarshalBenchmarks.go index 3ab2262ba7f851fd14912af06104dda69e036ee9..a86f4cce2a3377acbdbe30309242fa11e6c8727d 100644 --- a/node/tests/unmarshalBenchmarks.go +++ b/node/tests/unmarshalBenchmarks.go @@ -17,7 +17,7 @@ import ( // This does mean we're measuring a bunch of stuff that has nothing to do // with the core operations of the Node/NodeBuilder interface. // We do this so that: -// - we get a reasonable picture of how much time is spent in the DMS3LD Data Model +// - we get a reasonable picture of how much time is spent in the LD Data Model // versus how much time is spent in the serialization efforts; // - we can make direct comparisons to the standard library json marshalling // and unmarshalling, thus having a back-of-the-envelope baseline to compare. diff --git a/path.go b/path.go index 15f583fbd4ad940941839518e73acdb61094db69..c9e947020495571a167c232484566bbec92584af 100644 --- a/path.go +++ b/path.go @@ -13,7 +13,7 @@ import ( // // (Note that Paths are useful as an instruction for traversing from // *one* Node to *one* other Node; to do a walk from one Node and visit -// *several* Nodes based on some sort of pattern, look to DMS3LD Selectors, +// *several* Nodes based on some sort of pattern, look to LD Selectors, // and the 'traversal/selector' package in this project.) // // Path values are always relative. @@ -27,15 +27,15 @@ import ( // in UTF-8 encoding and use NFC normalization, but all operations // will regard the string as its constituent eight-bit bytes. // -// There are no illegal or magical characters in DMS3LD Paths +// There are no illegal or magical characters in LD Paths // (in particular, do not mistake them for UNIX system paths). -// DMS3LD Paths can only go down: that is, each segment must traverse one node. +// LD Paths can only go down: that is, each segment must traverse one node. // There is no ".." which means "go up"; // and there is no "." which means "stay here". -// DMS3LD Paths have no magic behavior around characters such as "~". -// DMS3LD Paths do not have a concept of "globs" nor behave specially +// LD Paths have no magic behavior around characters such as "~". +// LD Paths do not have a concept of "globs" nor behave specially // for a path segment string of "*" (but you may wish to see 'Selectors' -// for globbing-like features that traverse over DMS3LD data). +// for globbing-like features that traverse over LD data). // // An empty string is a valid PathSegment. // (This leads to some unfortunate complications when wishing to represent @@ -55,7 +55,7 @@ import ( // In golang, this doesn't pose particular difficulty, but note this would be // of marked concern for languages which have "C-style nul-terminated strings". // -// For an DMS3LD Path to be represented as a string, an encoding system +// For an LD Path to be represented as a string, an encoding system // including escaping is necessary. At present, there is not a single // canonical specification for such an escaping; we expect to decide one // in the future, but this is not yet settled and done. @@ -83,7 +83,7 @@ func NewPathNocopy(segments []PathSegment) Path { return Path{segments} } -// ParsePath converts a string to an DMS3LD Path, doing a basic parsing of the +// ParsePath converts a string to an LD Path, doing a basic parsing of the // string using "/" as a delimiter to produce a segmented Path. // This is a handy, but not a general-purpose nor spec-compliant (!), // way to create a Path: it cannot represent all valid paths. diff --git a/schema/dmt/ldsch_types.go b/schema/dmt/ldsch_types.go index a3d08d4b3dc52bf874434c76ca5b188eb0f9cbc0..5138a8d1c159d8bb78e20bb0390d26df6ccf1cb6 100644 --- a/schema/dmt/ldsch_types.go +++ b/schema/dmt/ldsch_types.go @@ -142,7 +142,7 @@ type typeSlab struct { // --- type definitions follow --- -// AnyScalar matches the DMS3LD Schema type "AnyScalar". +// AnyScalar matches the LD Schema type "AnyScalar". // AnyScalar has Union typekind, which means its data model behaviors are that of a map kind. type AnyScalar = *_AnyScalar type _AnyScalar struct { @@ -163,15 +163,15 @@ func (_Bytes) _AnyScalar__member() {} func (_Int) _AnyScalar__member() {} func (_Float) _AnyScalar__member() {} -// Bool matches the DMS3LD Schema type "Bool". It has bool kind. +// Bool matches the LD Schema type "Bool". It has bool kind. type Bool = *_Bool type _Bool struct{ x bool } -// Bytes matches the DMS3LD Schema type "Bytes". It has bytes kind. +// Bytes matches the LD Schema type "Bytes". It has bytes kind. type Bytes = *_Bytes type _Bytes struct{ x []byte } -// EnumRepresentation matches the DMS3LD Schema type "EnumRepresentation". +// EnumRepresentation matches the LD Schema type "EnumRepresentation". // EnumRepresentation has Union typekind, which means its data model behaviors are that of a map kind. type EnumRepresentation = *_EnumRepresentation type _EnumRepresentation struct { @@ -186,7 +186,7 @@ type _EnumRepresentation__iface interface { func (_EnumRepresentation_String) _EnumRepresentation__member() {} func (_EnumRepresentation_Int) _EnumRepresentation__member() {} -// EnumRepresentation_Int matches the DMS3LD Schema type "EnumRepresentation_Int". It has map kind. +// EnumRepresentation_Int matches the LD Schema type "EnumRepresentation_Int". It has map kind. type EnumRepresentation_Int = *_EnumRepresentation_Int type _EnumRepresentation_Int struct { m map[_EnumValue]*_Int @@ -197,7 +197,7 @@ type _EnumRepresentation_Int__entry struct { v _Int } -// EnumRepresentation_String matches the DMS3LD Schema type "EnumRepresentation_String". It has map kind. +// EnumRepresentation_String matches the LD Schema type "EnumRepresentation_String". It has map kind. type EnumRepresentation_String = *_EnumRepresentation_String type _EnumRepresentation_String struct { m map[_EnumValue]*_String @@ -208,23 +208,23 @@ type _EnumRepresentation_String__entry struct { v _String } -// EnumValue matches the DMS3LD Schema type "EnumValue". It has string kind. +// EnumValue matches the LD Schema type "EnumValue". It has string kind. type EnumValue = *_EnumValue type _EnumValue struct{ x string } -// FieldName matches the DMS3LD Schema type "FieldName". It has string kind. +// FieldName matches the LD Schema type "FieldName". It has string kind. type FieldName = *_FieldName type _FieldName struct{ x string } -// Float matches the DMS3LD Schema type "Float". It has float kind. +// Float matches the LD Schema type "Float". It has float kind. type Float = *_Float type _Float struct{ x float64 } -// Int matches the DMS3LD Schema type "Int". It has int kind. +// Int matches the LD Schema type "Int". It has int kind. type Int = *_Int type _Int struct{ x int64 } -// ListRepresentation matches the DMS3LD Schema type "ListRepresentation". +// ListRepresentation matches the LD Schema type "ListRepresentation". // ListRepresentation has Union typekind, which means its data model behaviors are that of a map kind. type ListRepresentation = *_ListRepresentation type _ListRepresentation struct { @@ -237,24 +237,24 @@ type _ListRepresentation__iface interface { func (_ListRepresentation_List) _ListRepresentation__member() {} -// ListRepresentation_List matches the DMS3LD Schema type "ListRepresentation_List". It has Struct type-kind, and may be interrogated like map kind. +// ListRepresentation_List matches the LD Schema type "ListRepresentation_List". It has Struct type-kind, and may be interrogated like map kind. type ListRepresentation_List = *_ListRepresentation_List type _ListRepresentation_List struct { } -// List__FieldName matches the DMS3LD Schema type "List__FieldName". It has list kind. +// List__FieldName matches the LD Schema type "List__FieldName". It has list kind. type List__FieldName = *_List__FieldName type _List__FieldName struct { x []_FieldName } -// List__TypeName matches the DMS3LD Schema type "List__TypeName". It has list kind. +// List__TypeName matches the LD Schema type "List__TypeName". It has list kind. type List__TypeName = *_List__TypeName type _List__TypeName struct { x []_TypeName } -// MapRepresentation matches the DMS3LD Schema type "MapRepresentation". +// MapRepresentation matches the LD Schema type "MapRepresentation". // MapRepresentation has Union typekind, which means its data model behaviors are that of a map kind. type MapRepresentation = *_MapRepresentation type _MapRepresentation struct { @@ -271,24 +271,24 @@ func (_MapRepresentation_Map) _MapRepresentation__member() {} func (_MapRepresentation_Stringpairs) _MapRepresentation__member() {} func (_MapRepresentation_Listpairs) _MapRepresentation__member() {} -// MapRepresentation_Listpairs matches the DMS3LD Schema type "MapRepresentation_Listpairs". It has Struct type-kind, and may be interrogated like map kind. +// MapRepresentation_Listpairs matches the LD Schema type "MapRepresentation_Listpairs". It has Struct type-kind, and may be interrogated like map kind. type MapRepresentation_Listpairs = *_MapRepresentation_Listpairs type _MapRepresentation_Listpairs struct { } -// MapRepresentation_Map matches the DMS3LD Schema type "MapRepresentation_Map". It has Struct type-kind, and may be interrogated like map kind. +// MapRepresentation_Map matches the LD Schema type "MapRepresentation_Map". It has Struct type-kind, and may be interrogated like map kind. type MapRepresentation_Map = *_MapRepresentation_Map type _MapRepresentation_Map struct { } -// MapRepresentation_Stringpairs matches the DMS3LD Schema type "MapRepresentation_Stringpairs". It has Struct type-kind, and may be interrogated like map kind. +// MapRepresentation_Stringpairs matches the LD Schema type "MapRepresentation_Stringpairs". It has Struct type-kind, and may be interrogated like map kind. type MapRepresentation_Stringpairs = *_MapRepresentation_Stringpairs type _MapRepresentation_Stringpairs struct { innerDelim _String entryDelim _String } -// Map__EnumValue__Unit matches the DMS3LD Schema type "Map__EnumValue__Unit". It has map kind. +// Map__EnumValue__Unit matches the LD Schema type "Map__EnumValue__Unit". It has map kind. type Map__EnumValue__Unit = *_Map__EnumValue__Unit type _Map__EnumValue__Unit struct { m map[_EnumValue]*_Unit @@ -299,7 +299,7 @@ type _Map__EnumValue__Unit__entry struct { v _Unit } -// Map__FieldName__StructField matches the DMS3LD Schema type "Map__FieldName__StructField". It has map kind. +// Map__FieldName__StructField matches the LD Schema type "Map__FieldName__StructField". It has map kind. type Map__FieldName__StructField = *_Map__FieldName__StructField type _Map__FieldName__StructField struct { m map[_FieldName]*_StructField @@ -310,7 +310,7 @@ type _Map__FieldName__StructField__entry struct { v _StructField } -// Map__FieldName__StructRepresentation_Map_FieldDetails matches the DMS3LD Schema type "Map__FieldName__StructRepresentation_Map_FieldDetails". It has map kind. +// Map__FieldName__StructRepresentation_Map_FieldDetails matches the LD Schema type "Map__FieldName__StructRepresentation_Map_FieldDetails". It has map kind. type Map__FieldName__StructRepresentation_Map_FieldDetails = *_Map__FieldName__StructRepresentation_Map_FieldDetails type _Map__FieldName__StructRepresentation_Map_FieldDetails struct { m map[_FieldName]*_StructRepresentation_Map_FieldDetails @@ -321,7 +321,7 @@ type _Map__FieldName__StructRepresentation_Map_FieldDetails__entry struct { v _StructRepresentation_Map_FieldDetails } -// Map__String__TypeName matches the DMS3LD Schema type "Map__String__TypeName". It has map kind. +// Map__String__TypeName matches the LD Schema type "Map__String__TypeName". It has map kind. type Map__String__TypeName = *_Map__String__TypeName type _Map__String__TypeName struct { m map[_String]*_TypeName @@ -332,7 +332,7 @@ type _Map__String__TypeName__entry struct { v _TypeName } -// Map__TypeName__Int matches the DMS3LD Schema type "Map__TypeName__Int". It has map kind. +// Map__TypeName__Int matches the LD Schema type "Map__TypeName__Int". It has map kind. type Map__TypeName__Int = *_Map__TypeName__Int type _Map__TypeName__Int struct { m map[_String]*_Int @@ -343,17 +343,17 @@ type _Map__TypeName__Int__entry struct { v _Int } -// RepresentationKind matches the DMS3LD Schema type "RepresentationKind". It has string kind. +// RepresentationKind matches the LD Schema type "RepresentationKind". It has string kind. type RepresentationKind = *_RepresentationKind type _RepresentationKind struct{ x string } -// Schema matches the DMS3LD Schema type "Schema". It has Struct type-kind, and may be interrogated like map kind. +// Schema matches the LD Schema type "Schema". It has Struct type-kind, and may be interrogated like map kind. type Schema = *_Schema type _Schema struct { types _SchemaMap } -// SchemaMap matches the DMS3LD Schema type "SchemaMap". It has map kind. +// SchemaMap matches the LD Schema type "SchemaMap". It has map kind. type SchemaMap = *_SchemaMap type _SchemaMap struct { m map[_TypeName]*_TypeDefn @@ -364,11 +364,11 @@ type _SchemaMap__entry struct { v _TypeDefn } -// String matches the DMS3LD Schema type "String". It has string kind. +// String matches the LD Schema type "String". It has string kind. type String = *_String type _String struct{ x string } -// StructField matches the DMS3LD Schema type "StructField". It has Struct type-kind, and may be interrogated like map kind. +// StructField matches the LD Schema type "StructField". It has Struct type-kind, and may be interrogated like map kind. type StructField = *_StructField type _StructField struct { typ _TypeNameOrInlineDefn @@ -376,7 +376,7 @@ type _StructField struct { nullable _Bool } -// StructRepresentation matches the DMS3LD Schema type "StructRepresentation". +// StructRepresentation matches the LD Schema type "StructRepresentation". // StructRepresentation has Union typekind, which means its data model behaviors are that of a map kind. type StructRepresentation = *_StructRepresentation type _StructRepresentation struct { @@ -397,61 +397,61 @@ func (_StructRepresentation_Stringpairs) _StructRepresentation__member() {} func (_StructRepresentation_Stringjoin) _StructRepresentation__member() {} func (_StructRepresentation_Listpairs) _StructRepresentation__member() {} -// StructRepresentation_Listpairs matches the DMS3LD Schema type "StructRepresentation_Listpairs". It has Struct type-kind, and may be interrogated like map kind. +// StructRepresentation_Listpairs matches the LD Schema type "StructRepresentation_Listpairs". It has Struct type-kind, and may be interrogated like map kind. type StructRepresentation_Listpairs = *_StructRepresentation_Listpairs type _StructRepresentation_Listpairs struct { } -// StructRepresentation_Map matches the DMS3LD Schema type "StructRepresentation_Map". It has Struct type-kind, and may be interrogated like map kind. +// StructRepresentation_Map matches the LD Schema type "StructRepresentation_Map". It has Struct type-kind, and may be interrogated like map kind. type StructRepresentation_Map = *_StructRepresentation_Map type _StructRepresentation_Map struct { fields _Map__FieldName__StructRepresentation_Map_FieldDetails__Maybe } -// StructRepresentation_Map_FieldDetails matches the DMS3LD Schema type "StructRepresentation_Map_FieldDetails". It has Struct type-kind, and may be interrogated like map kind. +// StructRepresentation_Map_FieldDetails matches the LD Schema type "StructRepresentation_Map_FieldDetails". It has Struct type-kind, and may be interrogated like map kind. type StructRepresentation_Map_FieldDetails = *_StructRepresentation_Map_FieldDetails type _StructRepresentation_Map_FieldDetails struct { rename _String__Maybe implicit _AnyScalar__Maybe } -// StructRepresentation_Stringjoin matches the DMS3LD Schema type "StructRepresentation_Stringjoin". It has Struct type-kind, and may be interrogated like map kind. +// StructRepresentation_Stringjoin matches the LD Schema type "StructRepresentation_Stringjoin". It has Struct type-kind, and may be interrogated like map kind. type StructRepresentation_Stringjoin = *_StructRepresentation_Stringjoin type _StructRepresentation_Stringjoin struct { join _String fieldOrder _List__FieldName__Maybe } -// StructRepresentation_Stringpairs matches the DMS3LD Schema type "StructRepresentation_Stringpairs". It has Struct type-kind, and may be interrogated like map kind. +// StructRepresentation_Stringpairs matches the LD Schema type "StructRepresentation_Stringpairs". It has Struct type-kind, and may be interrogated like map kind. type StructRepresentation_Stringpairs = *_StructRepresentation_Stringpairs type _StructRepresentation_Stringpairs struct { innerDelim _String entryDelim _String } -// StructRepresentation_Tuple matches the DMS3LD Schema type "StructRepresentation_Tuple". It has Struct type-kind, and may be interrogated like map kind. +// StructRepresentation_Tuple matches the LD Schema type "StructRepresentation_Tuple". It has Struct type-kind, and may be interrogated like map kind. type StructRepresentation_Tuple = *_StructRepresentation_Tuple type _StructRepresentation_Tuple struct { fieldOrder _List__FieldName__Maybe } -// TypeBool matches the DMS3LD Schema type "TypeBool". It has Struct type-kind, and may be interrogated like map kind. +// TypeBool matches the LD Schema type "TypeBool". It has Struct type-kind, and may be interrogated like map kind. type TypeBool = *_TypeBool type _TypeBool struct { } -// TypeBytes matches the DMS3LD Schema type "TypeBytes". It has Struct type-kind, and may be interrogated like map kind. +// TypeBytes matches the LD Schema type "TypeBytes". It has Struct type-kind, and may be interrogated like map kind. type TypeBytes = *_TypeBytes type _TypeBytes struct { } -// TypeCopy matches the DMS3LD Schema type "TypeCopy". It has Struct type-kind, and may be interrogated like map kind. +// TypeCopy matches the LD Schema type "TypeCopy". It has Struct type-kind, and may be interrogated like map kind. type TypeCopy = *_TypeCopy type _TypeCopy struct { fromType _TypeName } -// TypeDefn matches the DMS3LD Schema type "TypeDefn". +// TypeDefn matches the LD Schema type "TypeDefn". // TypeDefn has Union typekind, which means its data model behaviors are that of a map kind. type TypeDefn = *_TypeDefn type _TypeDefn struct { @@ -486,7 +486,7 @@ func (_TypeStruct) _TypeDefn__member() {} func (_TypeEnum) _TypeDefn__member() {} func (_TypeCopy) _TypeDefn__member() {} -// TypeDefnInline matches the DMS3LD Schema type "TypeDefnInline". +// TypeDefnInline matches the LD Schema type "TypeDefnInline". // TypeDefnInline has Union typekind, which means its data model behaviors are that of a map kind. type TypeDefnInline = *_TypeDefnInline type _TypeDefnInline struct { @@ -499,30 +499,30 @@ type _TypeDefnInline__iface interface { func (_TypeMap) _TypeDefnInline__member() {} func (_TypeList) _TypeDefnInline__member() {} -// TypeEnum matches the DMS3LD Schema type "TypeEnum". It has Struct type-kind, and may be interrogated like map kind. +// TypeEnum matches the LD Schema type "TypeEnum". It has Struct type-kind, and may be interrogated like map kind. type TypeEnum = *_TypeEnum type _TypeEnum struct { members _Map__EnumValue__Unit representation _EnumRepresentation } -// TypeFloat matches the DMS3LD Schema type "TypeFloat". It has Struct type-kind, and may be interrogated like map kind. +// TypeFloat matches the LD Schema type "TypeFloat". It has Struct type-kind, and may be interrogated like map kind. type TypeFloat = *_TypeFloat type _TypeFloat struct { } -// TypeInt matches the DMS3LD Schema type "TypeInt". It has Struct type-kind, and may be interrogated like map kind. +// TypeInt matches the LD Schema type "TypeInt". It has Struct type-kind, and may be interrogated like map kind. type TypeInt = *_TypeInt type _TypeInt struct { } -// TypeLink matches the DMS3LD Schema type "TypeLink". It has Struct type-kind, and may be interrogated like map kind. +// TypeLink matches the LD Schema type "TypeLink". It has Struct type-kind, and may be interrogated like map kind. type TypeLink = *_TypeLink type _TypeLink struct { expectedType _TypeName__Maybe } -// TypeList matches the DMS3LD Schema type "TypeList". It has Struct type-kind, and may be interrogated like map kind. +// TypeList matches the LD Schema type "TypeList". It has Struct type-kind, and may be interrogated like map kind. type TypeList = *_TypeList type _TypeList struct { valueType _TypeNameOrInlineDefn @@ -530,7 +530,7 @@ type _TypeList struct { representation _ListRepresentation } -// TypeMap matches the DMS3LD Schema type "TypeMap". It has Struct type-kind, and may be interrogated like map kind. +// TypeMap matches the LD Schema type "TypeMap". It has Struct type-kind, and may be interrogated like map kind. type TypeMap = *_TypeMap type _TypeMap struct { keyType _TypeName @@ -539,11 +539,11 @@ type _TypeMap struct { representation _MapRepresentation } -// TypeName matches the DMS3LD Schema type "TypeName". It has string kind. +// TypeName matches the LD Schema type "TypeName". It has string kind. type TypeName = *_TypeName type _TypeName struct{ x string } -// TypeNameOrInlineDefn matches the DMS3LD Schema type "TypeNameOrInlineDefn". +// TypeNameOrInlineDefn matches the LD Schema type "TypeNameOrInlineDefn". // TypeNameOrInlineDefn has Union typekind, which means its data model behaviors are that of a map kind. type TypeNameOrInlineDefn = *_TypeNameOrInlineDefn type _TypeNameOrInlineDefn struct { @@ -558,26 +558,26 @@ type _TypeNameOrInlineDefn__iface interface { func (_TypeName) _TypeNameOrInlineDefn__member() {} func (_TypeDefnInline) _TypeNameOrInlineDefn__member() {} -// TypeString matches the DMS3LD Schema type "TypeString". It has Struct type-kind, and may be interrogated like map kind. +// TypeString matches the LD Schema type "TypeString". It has Struct type-kind, and may be interrogated like map kind. type TypeString = *_TypeString type _TypeString struct { } -// TypeStruct matches the DMS3LD Schema type "TypeStruct". It has Struct type-kind, and may be interrogated like map kind. +// TypeStruct matches the LD Schema type "TypeStruct". It has Struct type-kind, and may be interrogated like map kind. type TypeStruct = *_TypeStruct type _TypeStruct struct { fields _Map__FieldName__StructField representation _StructRepresentation } -// TypeUnion matches the DMS3LD Schema type "TypeUnion". It has Struct type-kind, and may be interrogated like map kind. +// TypeUnion matches the LD Schema type "TypeUnion". It has Struct type-kind, and may be interrogated like map kind. type TypeUnion = *_TypeUnion type _TypeUnion struct { members _List__TypeName representation _UnionRepresentation } -// UnionRepresentation matches the DMS3LD Schema type "UnionRepresentation". +// UnionRepresentation matches the LD Schema type "UnionRepresentation". // UnionRepresentation has Union typekind, which means its data model behaviors are that of a map kind. type UnionRepresentation = *_UnionRepresentation type _UnionRepresentation struct { @@ -600,13 +600,13 @@ func (_UnionRepresentation_Inline) _UnionRepresentation__member() {} func (_UnionRepresentation_StringPrefix) _UnionRepresentation__member() {} func (_UnionRepresentation_BytePrefix) _UnionRepresentation__member() {} -// UnionRepresentation_BytePrefix matches the DMS3LD Schema type "UnionRepresentation_BytePrefix". It has Struct type-kind, and may be interrogated like map kind. +// UnionRepresentation_BytePrefix matches the LD Schema type "UnionRepresentation_BytePrefix". It has Struct type-kind, and may be interrogated like map kind. type UnionRepresentation_BytePrefix = *_UnionRepresentation_BytePrefix type _UnionRepresentation_BytePrefix struct { discriminantTable _Map__TypeName__Int } -// UnionRepresentation_Envelope matches the DMS3LD Schema type "UnionRepresentation_Envelope". It has Struct type-kind, and may be interrogated like map kind. +// UnionRepresentation_Envelope matches the LD Schema type "UnionRepresentation_Envelope". It has Struct type-kind, and may be interrogated like map kind. type UnionRepresentation_Envelope = *_UnionRepresentation_Envelope type _UnionRepresentation_Envelope struct { discriminantKey _String @@ -614,14 +614,14 @@ type _UnionRepresentation_Envelope struct { discriminantTable _Map__String__TypeName } -// UnionRepresentation_Inline matches the DMS3LD Schema type "UnionRepresentation_Inline". It has Struct type-kind, and may be interrogated like map kind. +// UnionRepresentation_Inline matches the LD Schema type "UnionRepresentation_Inline". It has Struct type-kind, and may be interrogated like map kind. type UnionRepresentation_Inline = *_UnionRepresentation_Inline type _UnionRepresentation_Inline struct { discriminantKey _String discriminantTable _Map__String__TypeName } -// UnionRepresentation_Keyed matches the DMS3LD Schema type "UnionRepresentation_Keyed". It has map kind. +// UnionRepresentation_Keyed matches the LD Schema type "UnionRepresentation_Keyed". It has map kind. type UnionRepresentation_Keyed = *_UnionRepresentation_Keyed type _UnionRepresentation_Keyed struct { m map[_String]*_TypeName @@ -632,7 +632,7 @@ type _UnionRepresentation_Keyed__entry struct { v _TypeName } -// UnionRepresentation_Kinded matches the DMS3LD Schema type "UnionRepresentation_Kinded". It has map kind. +// UnionRepresentation_Kinded matches the LD Schema type "UnionRepresentation_Kinded". It has map kind. type UnionRepresentation_Kinded = *_UnionRepresentation_Kinded type _UnionRepresentation_Kinded struct { m map[_RepresentationKind]*_TypeName @@ -643,13 +643,13 @@ type _UnionRepresentation_Kinded__entry struct { v _TypeName } -// UnionRepresentation_StringPrefix matches the DMS3LD Schema type "UnionRepresentation_StringPrefix". It has Struct type-kind, and may be interrogated like map kind. +// UnionRepresentation_StringPrefix matches the LD Schema type "UnionRepresentation_StringPrefix". It has Struct type-kind, and may be interrogated like map kind. type UnionRepresentation_StringPrefix = *_UnionRepresentation_StringPrefix type _UnionRepresentation_StringPrefix struct { discriminantTable _Map__String__TypeName } -// Unit matches the DMS3LD Schema type "Unit". It has Struct type-kind, and may be interrogated like map kind. +// Unit matches the LD Schema type "Unit". It has Struct type-kind, and may be interrogated like map kind. type Unit = *_Unit type _Unit struct { } diff --git a/schema/dmt/typereference.go b/schema/dmt/typereference.go index adfa946a99e23b3159e9669f54204f074daf6688..969f772d358b14a18e487ef16c2857abe9de7f44 100644 --- a/schema/dmt/typereference.go +++ b/schema/dmt/typereference.go @@ -5,7 +5,7 @@ import "fmt" // TypeReference is a string that's either a TypeName or a computed string from an InlineDefn. // This string is often useful as a map key. // -// The computed string for an InlineDefn happens to match the DMS3LD Schema DSL syntax, +// The computed string for an InlineDefn happens to match the LD Schema DSL syntax, // but it would be very odd for any code to depend on that detail. type TypeReference string diff --git a/schema/gen/go/adjunctCfg.go b/schema/gen/go/adjunctCfg.go index 9640d98adbb05ad01f190872b6874ff2e98b6b3e..0624e1cb5db1a93804f9b67b39096de3431febab 100644 --- a/schema/gen/go/adjunctCfg.go +++ b/schema/gen/go/adjunctCfg.go @@ -5,14 +5,14 @@ import ( "reflect" "strings" - dms3ld "gitlab.dms3.io/ld/go-ld-prime" + ld "gitlab.dms3.io/ld/go-ld-prime" basicnode "gitlab.dms3.io/ld/go-ld-prime/node/basic" "gitlab.dms3.io/ld/go-ld-prime/schema" ) // This entire file is placeholder-quality implementations. // -// The AdjunctCfg struct should be replaced with an DMS3LD Schema-specified thing! +// The AdjunctCfg struct should be replaced with an LD Schema-specified thing! // The values in the unionMemlayout field should be an enum; // etcetera! @@ -104,7 +104,7 @@ func init() { // Get the basic node sizes via basicnode. for _, tk := range []struct { typeKind schema.TypeKind - prototype dms3ld.NodePrototype + prototype ld.NodePrototype }{ {schema.TypeKind_Bool, basicnode.Prototype.Bool}, {schema.TypeKind_Int, basicnode.Prototype.Int}, diff --git a/schema/gen/go/externUtil.go b/schema/gen/go/externUtil.go index cddf28b48003795cc444a19d88fc279e2a412b75..7f0d556d021e7949dba41406623f074968c2dce5 100644 --- a/schema/gen/go/externUtil.go +++ b/schema/gen/go/externUtil.go @@ -20,7 +20,7 @@ func getExternTypes(pth string) (map[string]struct{}, error) { types := make(map[string]struct{}) for _, pack := range packs { for fname, f := range pack.Files { - if strings.HasPrefix(path.Base(fname), "dms3ldsch_") { + if strings.HasPrefix(path.Base(fname), "ldsch_") { continue } for _, d := range f.Decls { diff --git a/schema/gen/go/genBoolReprBool.go b/schema/gen/go/genBoolReprBool.go index e61c6190eda0b5169834bae6f40d7809f27100a8..fd2e9abe4a28658d1b08b7de2f9116a4d8c2d89c 100644 --- a/schema/gen/go/genBoolReprBool.go +++ b/schema/gen/go/genBoolReprBool.go @@ -49,7 +49,7 @@ func (g boolReprBoolReprGenerator) EmitNodeType(w io.Writer) { } func (g boolReprBoolReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } func (boolReprBoolReprGenerator) EmitNodeMethodKind(io.Writer) {} diff --git a/schema/gen/go/genBytesReprBytes.go b/schema/gen/go/genBytesReprBytes.go index 71c4ae81ae5e818b910b8eca49846066264bdcc3..20e92c40bd2a11a255daa9b16bb0ea7ea83273e2 100644 --- a/schema/gen/go/genBytesReprBytes.go +++ b/schema/gen/go/genBytesReprBytes.go @@ -49,7 +49,7 @@ func (g bytesReprBytesReprGenerator) EmitNodeType(w io.Writer) { } func (g bytesReprBytesReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } func (bytesReprBytesReprGenerator) EmitNodeMethodKind(io.Writer) {} diff --git a/schema/gen/go/genFloatReprFloat.go b/schema/gen/go/genFloatReprFloat.go index b642422dbd4b31fc5aa5865c7d02233c8e164f3c..d7c4c850f8519774c1464920a1c1020b16a800cf 100644 --- a/schema/gen/go/genFloatReprFloat.go +++ b/schema/gen/go/genFloatReprFloat.go @@ -49,7 +49,7 @@ func (g float64ReprFloatReprGenerator) EmitNodeType(w io.Writer) { } func (g float64ReprFloatReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } func (float64ReprFloatReprGenerator) EmitNodeMethodKind(io.Writer) {} diff --git a/schema/gen/go/genIntReprInt.go b/schema/gen/go/genIntReprInt.go index 9b02341c55bc9a267e50b60107e7f6d3d19a77b2..7179881c434b873ff25e1804fa0783c4336ca42b 100644 --- a/schema/gen/go/genIntReprInt.go +++ b/schema/gen/go/genIntReprInt.go @@ -49,7 +49,7 @@ func (g intReprIntReprGenerator) EmitNodeType(w io.Writer) { } func (g intReprIntReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } func (intReprIntReprGenerator) EmitNodeMethodKind(io.Writer) {} diff --git a/schema/gen/go/genLink.go b/schema/gen/go/genLink.go index adf39b394b1256390fac80a81446c47b76443957..117904184d8d44fb5735c5ac6e1db018c02e7754 100644 --- a/schema/gen/go/genLink.go +++ b/schema/gen/go/genLink.go @@ -52,7 +52,7 @@ func (g linkGenerator) EmitTypedNodeMethodType(w io.Writer) { // Bonus feature for some links (conforms to the schema.TypedLinkNode interface): if g.Type.HasReferencedType() { doTemplate(` - func ({{ .Type | TypeSymbol }}) LinkTargetNodePrototype() dms3ld.NodePrototype { + func ({{ .Type | TypeSymbol }}) LinkTargetNodePrototype() ld.NodePrototype { return Type.{{ .Type | TypeSymbol }}__Repr } `, w, g.AdjCfg, g) diff --git a/schema/gen/go/genLinkReprLink.go b/schema/gen/go/genLinkReprLink.go index c4b630d9a514527ff75bb8c71fa3597089730562..5a2717d16a98d34027c6ca89706b2ef5c5c200eb 100644 --- a/schema/gen/go/genLinkReprLink.go +++ b/schema/gen/go/genLinkReprLink.go @@ -49,7 +49,7 @@ func (g linkReprLinkReprGenerator) EmitNodeType(w io.Writer) { } func (g linkReprLinkReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } func (linkReprLinkReprGenerator) EmitNodeMethodKind(io.Writer) {} diff --git a/schema/gen/go/genList.go b/schema/gen/go/genList.go index 7b92516b99cf628dcf2de0ec55c5f3a6c77a54f3..80530f9e83ba8efab0814ea0cc4bc36e5df98f1d 100644 --- a/schema/gen/go/genList.go +++ b/schema/gen/go/genList.go @@ -22,7 +22,7 @@ func (g listGenerator) EmitNativeType(w io.Writer) { // Lists are a pretty straightforward struct enclosing a slice. doTemplate(` {{- if Comments -}} - // {{ .Type | TypeSymbol }} matches the DMS3LD Schema type "{{ .Type.Name }}". It has {{ .Kind }} kind. + // {{ .Type | TypeSymbol }} matches the LD Schema type "{{ .Type.Name }}". It has {{ .Kind }} kind. {{- end}} type {{ .Type | TypeSymbol }} = *_{{ .Type | TypeSymbol }} type _{{ .Type | TypeSymbol }} struct { @@ -74,7 +74,7 @@ func (g listGenerator) EmitNativeAccessors(w io.Writer) { `, w, g.AdjCfg, g) // Generate a speciated iterator. - // The main advantage of this over the general dms3ld.ListIterator is of course keeping types visible (and concrete, to the compiler's eyes in optimizations, too). + // The main advantage of this over the general ld.ListIterator is of course keeping types visible (and concrete, to the compiler's eyes in optimizations, too). // It also elides the error return from the iterator's Next method. (Overreads will result in -1 as an index and nil values; this is both easily avoidable, and unambiguous if you do goof and hit it.) doTemplate(` func (n {{ .Type | TypeSymbol }}) Iterator() *{{ .Type | TypeSymbol }}__Itr { @@ -144,14 +144,14 @@ func (g listGenerator) EmitNodeTypeAssertions(w io.Writer) { func (g listGenerator) EmitNodeMethodLookupByIndex(w io.Writer) { doTemplate(` - func (n {{ .Type | TypeSymbol }}) LookupByIndex(idx int64) (dms3ld.Node, error) { + func (n {{ .Type | TypeSymbol }}) LookupByIndex(idx int64) (ld.Node, error) { if n.Length() <= idx { - return nil, dms3ld.ErrNotExists{Segment: dms3ld.PathSegmentOfInt(idx)} + return nil, ld.ErrNotExists{Segment: ld.PathSegmentOfInt(idx)} } v := &n.x[idx] {{- if .Type.ValueIsNullable }} if v.m == schema.Maybe_Null { - return dms3ld.Null, nil + return ld.Null, nil } return {{ if not (MaybeUsesPtr .Type.ValueType) }}&{{end}}v.v, nil {{- else}} @@ -165,7 +165,7 @@ func (g listGenerator) EmitNodeMethodLookupByNode(w io.Writer) { // LookupByNode will procede by coercing to int64 if it can; or fail; those are really the only options. // REVIEW: how much coercion is done by other types varies quite wildly. so we should figure out if that inconsistency is acceptable, and at least document it if so. doTemplate(` - func (n {{ .Type | TypeSymbol }}) LookupByNode(k dms3ld.Node) (dms3ld.Node, error) { + func (n {{ .Type | TypeSymbol }}) LookupByNode(k ld.Node) (ld.Node, error) { idx, err := k.AsInt() if err != nil { return nil, err @@ -177,7 +177,7 @@ func (g listGenerator) EmitNodeMethodLookupByNode(w io.Writer) { func (g listGenerator) EmitNodeMethodListIterator(w io.Writer) { doTemplate(` - func (n {{ .Type | TypeSymbol }}) ListIterator() dms3ld.ListIterator { + func (n {{ .Type | TypeSymbol }}) ListIterator() ld.ListIterator { return &_{{ .Type | TypeSymbol }}__ListItr{n, 0} } @@ -186,16 +186,16 @@ func (g listGenerator) EmitNodeMethodListIterator(w io.Writer) { idx int } - func (itr *_{{ .Type | TypeSymbol }}__ListItr) Next() (idx int64, v dms3ld.Node, _ error) { + func (itr *_{{ .Type | TypeSymbol }}__ListItr) Next() (idx int64, v ld.Node, _ error) { if itr.idx >= len(itr.n.x) { - return -1, nil, dms3ld.ErrIteratorOverread{} + return -1, nil, ld.ErrIteratorOverread{} } idx = int64(itr.idx) x := &itr.n.x[itr.idx] {{- if .Type.ValueIsNullable }} switch x.m { case schema.Maybe_Null: - v = dms3ld.Null + v = ld.Null case schema.Maybe_Value: v = {{ if not (MaybeUsesPtr .Type.ValueType) }}&{{end}}x.v } diff --git a/schema/gen/go/genListReprList.go b/schema/gen/go/genListReprList.go index f7fb814b9c57ae4597bcaa6066c7cfedd78eca65..c25c9d3639a910262823043f169fa20151789a31 100644 --- a/schema/gen/go/genListReprList.go +++ b/schema/gen/go/genListReprList.go @@ -63,7 +63,7 @@ func (g listReprListReprGenerator) EmitNodeType(w io.Writer) { func (g listReprListReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } @@ -72,9 +72,9 @@ func (g listReprListReprGenerator) EmitNodeMethodLookupByNode(w io.Writer) { // REVIEW: these unchecked casts are definitely safe at compile time, but I'm not sure if the compiler considers that provable, // so we should investigate if there's any runtime checks injected here that waste time. If so: write this with more gsloc to avoid :( doTemplate(` - func (nr *_{{ .Type | TypeSymbol }}__Repr) LookupByNode(k dms3ld.Node) (dms3ld.Node, error) { + func (nr *_{{ .Type | TypeSymbol }}__Repr) LookupByNode(k ld.Node) (ld.Node, error) { v, err := ({{ .Type | TypeSymbol }})(nr).LookupByNode(k) - if err != nil || v == dms3ld.Null { + if err != nil || v == ld.Null { return v, err } return v.({{ .Type.ValueType | TypeSymbol}}).Representation(), nil @@ -85,9 +85,9 @@ func (g listReprListReprGenerator) EmitNodeMethodLookupByNode(w io.Writer) { func (g listReprListReprGenerator) EmitNodeMethodLookupByIndex(w io.Writer) { doTemplate(` - func (nr *_{{ .Type | TypeSymbol }}__Repr) LookupByIndex(idx int64) (dms3ld.Node, error) { + func (nr *_{{ .Type | TypeSymbol }}__Repr) LookupByIndex(idx int64) (ld.Node, error) { v, err := ({{ .Type | TypeSymbol }})(nr).LookupByIndex(idx) - if err != nil || v == dms3ld.Null { + if err != nil || v == ld.Null { return v, err } return v.({{ .Type.ValueType | TypeSymbol}}).Representation(), nil @@ -98,15 +98,15 @@ func (g listReprListReprGenerator) EmitNodeMethodLookupByIndex(w io.Writer) { func (g listReprListReprGenerator) EmitNodeMethodListIterator(w io.Writer) { // FUTURE: trying to get this to share the preallocated memory if we get iterators wedged into their node slab will be ... fun. doTemplate(` - func (nr *_{{ .Type | TypeSymbol }}__Repr) ListIterator() dms3ld.ListIterator { + func (nr *_{{ .Type | TypeSymbol }}__Repr) ListIterator() ld.ListIterator { return &_{{ .Type | TypeSymbol }}__ReprListItr{({{ .Type | TypeSymbol }})(nr), 0} } type _{{ .Type | TypeSymbol }}__ReprListItr _{{ .Type | TypeSymbol }}__ListItr - func (itr *_{{ .Type | TypeSymbol }}__ReprListItr) Next() (idx int64, v dms3ld.Node, err error) { + func (itr *_{{ .Type | TypeSymbol }}__ReprListItr) Next() (idx int64, v ld.Node, err error) { idx, v, err = (*_{{ .Type | TypeSymbol }}__ListItr)(itr).Next() - if err != nil || v == dms3ld.Null { + if err != nil || v == ld.Null { return } return idx, v.({{ .Type.ValueType | TypeSymbol}}).Representation(), nil diff --git a/schema/gen/go/genMap.go b/schema/gen/go/genMap.go index 65abf14c08636f1059360af36c8417985ada0552..47d46ca3ebe0277527e2182323aa9d62eb2ee8c5 100644 --- a/schema/gen/go/genMap.go +++ b/schema/gen/go/genMap.go @@ -26,7 +26,7 @@ func (g mapGenerator) EmitNativeType(w io.Writer) { // The value in 'm' is a pointer into 't' (except when it's a maybe; maybes are already pointers). doTemplate(` {{- if Comments -}} - // {{ .Type | TypeSymbol }} matches the DMS3LD Schema type "{{ .Type.Name }}". It has {{ .Kind }} kind. + // {{ .Type | TypeSymbol }} matches the LD Schema type "{{ .Type.Name }}". It has {{ .Kind }} kind. {{- end}} type {{ .Type | TypeSymbol }} = *_{{ .Type | TypeSymbol }} type _{{ .Type | TypeSymbol }} struct { @@ -89,7 +89,7 @@ func (g mapGenerator) EmitNativeAccessors(w io.Writer) { `, w, g.AdjCfg, g) // Generate a speciated iterator. - // The main advantage of this over the general dms3ld.MapIterator is of course keeping types visible (and concrete, to the compiler's eyes in optimizations, too). + // The main advantage of this over the general ld.MapIterator is of course keeping types visible (and concrete, to the compiler's eyes in optimizations, too). // It also elides the error return from the iterator's Next method. (Overreads will result in nil keys; this is both easily avoidable, and unambiguous if you do goof and hit it.) doTemplate(` func (n {{ .Type | TypeSymbol }}) Iterator() *{{ .Type | TypeSymbol }}__Itr { @@ -165,7 +165,7 @@ func (g mapGenerator) EmitNodeMethodLookupByString(w io.Writer) { // For that to work out, it means if the key type doesn't have a string type kind, we must be willing to reach into its representation and use the fromString there. // If the key type *does* have a string kind at the type level, we'll use that; no need to consider going through the representation. doTemplate(` - func (n {{ .Type | TypeSymbol }}) LookupByString(k string) (dms3ld.Node, error) { + func (n {{ .Type | TypeSymbol }}) LookupByString(k string) (ld.Node, error) { var k2 _{{ .Type.KeyType | TypeSymbol }} {{- if eq .Type.KeyType.TypeKind.String "String" }} if err := (_{{ .Type.KeyType | TypeSymbol }}__Prototype{}).fromString(&k2, k); err != nil { @@ -178,11 +178,11 @@ func (g mapGenerator) EmitNodeMethodLookupByString(w io.Writer) { {{- end}} v, exists := n.m[k2] if !exists { - return nil, dms3ld.ErrNotExists{Segment: dms3ld.PathSegmentOfString(k)} + return nil, ld.ErrNotExists{Segment: ld.PathSegmentOfString(k)} } {{- if .Type.ValueIsNullable }} if v.m == schema.Maybe_Null { - return dms3ld.Null, nil + return ld.Null, nil } return {{ if not (MaybeUsesPtr .Type.ValueType) }}&{{end}}v.v, nil {{- else}} @@ -198,19 +198,19 @@ func (g mapGenerator) EmitNodeMethodLookupByNode(w io.Writer) { // if you used a Node here, you should've meant it. // REVIEW: by comparison structs will coerce anything stringish silently...! so we should figure out if that inconsistency is acceptable, and at least document it if so. doTemplate(` - func (n {{ .Type | TypeSymbol }}) LookupByNode(k dms3ld.Node) (dms3ld.Node, error) { + func (n {{ .Type | TypeSymbol }}) LookupByNode(k ld.Node) (ld.Node, error) { k2, ok := k.({{ .Type.KeyType | TypeSymbol }}) if !ok { panic("todo invalid key type error") - // 'dms3ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}", Key:&_String{k}}' doesn't quite cut it: need room to explain the type, and it's not guaranteed k can be turned into a string at all + // 'ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}", Key:&_String{k}}' doesn't quite cut it: need room to explain the type, and it's not guaranteed k can be turned into a string at all } v, exists := n.m[*k2] if !exists { - return nil, dms3ld.ErrNotExists{Segment: dms3ld.PathSegmentOfString(k2.String())} + return nil, ld.ErrNotExists{Segment: ld.PathSegmentOfString(k2.String())} } {{- if .Type.ValueIsNullable }} if v.m == schema.Maybe_Null { - return dms3ld.Null, nil + return ld.Null, nil } return {{ if not (MaybeUsesPtr .Type.ValueType) }}&{{end}}v.v, nil {{- else}} @@ -222,7 +222,7 @@ func (g mapGenerator) EmitNodeMethodLookupByNode(w io.Writer) { func (g mapGenerator) EmitNodeMethodMapIterator(w io.Writer) { doTemplate(` - func (n {{ .Type | TypeSymbol }}) MapIterator() dms3ld.MapIterator { + func (n {{ .Type | TypeSymbol }}) MapIterator() ld.MapIterator { return &_{{ .Type | TypeSymbol }}__MapItr{n, 0} } @@ -231,16 +231,16 @@ func (g mapGenerator) EmitNodeMethodMapIterator(w io.Writer) { idx int } - func (itr *_{{ .Type | TypeSymbol }}__MapItr) Next() (k dms3ld.Node, v dms3ld.Node, _ error) { + func (itr *_{{ .Type | TypeSymbol }}__MapItr) Next() (k ld.Node, v ld.Node, _ error) { if itr.idx >= len(itr.n.t) { - return nil, nil, dms3ld.ErrIteratorOverread{} + return nil, nil, ld.ErrIteratorOverread{} } x := &itr.n.t[itr.idx] k = &x.k {{- if .Type.ValueIsNullable }} switch x.v.m { case schema.Maybe_Null: - v = dms3ld.Null + v = ld.Null case schema.Maybe_Value: v = {{ if not (MaybeUsesPtr .Type.ValueType) }}&{{end}}x.v.v } diff --git a/schema/gen/go/genMapReprMap.go b/schema/gen/go/genMapReprMap.go index 57a087c4f2fed4a3963708e885f05ba335c9fcdf..d81acc9e17fabf54ebd49235beefc20a15f9fc68 100644 --- a/schema/gen/go/genMapReprMap.go +++ b/schema/gen/go/genMapReprMap.go @@ -62,15 +62,15 @@ func (g mapReprMapReprGenerator) EmitNodeType(w io.Writer) { } func (g mapReprMapReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } func (g mapReprMapReprGenerator) EmitNodeMethodLookupByString(w io.Writer) { doTemplate(` - func (nr *_{{ .Type | TypeSymbol }}__Repr) LookupByString(k string) (dms3ld.Node, error) { + func (nr *_{{ .Type | TypeSymbol }}__Repr) LookupByString(k string) (ld.Node, error) { v, err := ({{ .Type | TypeSymbol }})(nr).LookupByString(k) - if err != nil || v == dms3ld.Null { + if err != nil || v == ld.Null { return v, err } return v.({{ .Type.ValueType | TypeSymbol}}).Representation(), nil @@ -82,9 +82,9 @@ func (g mapReprMapReprGenerator) EmitNodeMethodLookupByNode(w io.Writer) { // REVIEW: these unchecked casts are definitely safe at compile time, but I'm not sure if the compiler considers that provable, // so we should investigate if there's any runtime checks injected here that waste time. If so: write this with more gsloc to avoid :( doTemplate(` - func (nr *_{{ .Type | TypeSymbol }}__Repr) LookupByNode(k dms3ld.Node) (dms3ld.Node, error) { + func (nr *_{{ .Type | TypeSymbol }}__Repr) LookupByNode(k ld.Node) (ld.Node, error) { v, err := ({{ .Type | TypeSymbol }})(nr).LookupByNode(k) - if err != nil || v == dms3ld.Null { + if err != nil || v == ld.Null { return v, err } return v.({{ .Type.ValueType | TypeSymbol}}).Representation(), nil @@ -94,15 +94,15 @@ func (g mapReprMapReprGenerator) EmitNodeMethodLookupByNode(w io.Writer) { func (g mapReprMapReprGenerator) EmitNodeMethodMapIterator(w io.Writer) { // FUTURE: trying to get this to share the preallocated memory if we get iterators wedged into their node slab will be ... fun. doTemplate(` - func (nr *_{{ .Type | TypeSymbol }}__Repr) MapIterator() dms3ld.MapIterator { + func (nr *_{{ .Type | TypeSymbol }}__Repr) MapIterator() ld.MapIterator { return &_{{ .Type | TypeSymbol }}__ReprMapItr{({{ .Type | TypeSymbol }})(nr), 0} } type _{{ .Type | TypeSymbol }}__ReprMapItr _{{ .Type | TypeSymbol }}__MapItr - func (itr *_{{ .Type | TypeSymbol }}__ReprMapItr) Next() (k dms3ld.Node, v dms3ld.Node, err error) { + func (itr *_{{ .Type | TypeSymbol }}__ReprMapItr) Next() (k ld.Node, v ld.Node, err error) { k, v, err = (*_{{ .Type | TypeSymbol }}__MapItr)(itr).Next() - if err != nil || v == dms3ld.Null { + if err != nil || v == ld.Null { return } return k, v.({{ .Type.ValueType | TypeSymbol}}).Representation(), nil diff --git a/schema/gen/go/genStringReprString.go b/schema/gen/go/genStringReprString.go index 2eef4b14774f0229826e2ef3e65224804b32f769..77f7f91d92d7c34bfb4e1cb2f5bf5e153a5ae907 100644 --- a/schema/gen/go/genStringReprString.go +++ b/schema/gen/go/genStringReprString.go @@ -49,7 +49,7 @@ func (g stringReprStringReprGenerator) EmitNodeType(w io.Writer) { } func (g stringReprStringReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } func (stringReprStringReprGenerator) EmitNodeMethodKind(io.Writer) {} diff --git a/schema/gen/go/genStruct.go b/schema/gen/go/genStruct.go index f709c6fdd8a2261cd7993d2c688d32c9e84fc087..90bfc0dc296531e6a183ff9e3b77e89d74a0fb0a 100644 --- a/schema/gen/go/genStruct.go +++ b/schema/gen/go/genStruct.go @@ -21,7 +21,7 @@ func (structGenerator) IsRepr() bool { return false } // hint used in some gener func (g structGenerator) EmitNativeType(w io.Writer) { doTemplate(` {{- if Comments -}} - // {{ .Type | TypeSymbol }} matches the DMS3LD Schema type "{{ .Type.Name }}". It has {{ .Type.TypeKind }} type-kind, and may be interrogated like {{ .Kind }} kind. + // {{ .Type | TypeSymbol }} matches the LD Schema type "{{ .Type.Name }}". It has {{ .Type.TypeKind }} type-kind, and may be interrogated like {{ .Kind }} kind. {{- end}} type {{ .Type | TypeSymbol }} = *_{{ .Type | TypeSymbol }} type _{{ .Type | TypeSymbol }} struct { @@ -95,18 +95,18 @@ func (g structGenerator) EmitNodeTypeAssertions(w io.Writer) { func (g structGenerator) EmitNodeMethodLookupByString(w io.Writer) { doTemplate(` - func (n {{ .Type | TypeSymbol }}) LookupByString(key string) (dms3ld.Node, error) { + func (n {{ .Type | TypeSymbol }}) LookupByString(key string) (ld.Node, error) { switch key { {{- range $field := .Type.Fields }} case "{{ $field.Name }}": {{- if $field.IsOptional }} if n.{{ $field | FieldSymbolLower }}.m == schema.Maybe_Absent { - return dms3ld.Absent, nil + return ld.Absent, nil } {{- end}} {{- if $field.IsNullable }} if n.{{ $field | FieldSymbolLower }}.m == schema.Maybe_Null { - return dms3ld.Null, nil + return ld.Null, nil } {{- end}} {{- if $field.IsMaybe }} @@ -116,7 +116,7 @@ func (g structGenerator) EmitNodeMethodLookupByString(w io.Writer) { {{- end}} {{- end}} default: - return nil, schema.ErrNoSuchField{Type: nil /*TODO*/, Field: dms3ld.PathSegmentOfString(key)} + return nil, schema.ErrNoSuchField{Type: nil /*TODO*/, Field: ld.PathSegmentOfString(key)} } } `, w, g.AdjCfg, g) @@ -124,7 +124,7 @@ func (g structGenerator) EmitNodeMethodLookupByString(w io.Writer) { func (g structGenerator) EmitNodeMethodLookupByNode(w io.Writer) { doTemplate(` - func (n {{ .Type | TypeSymbol }}) LookupByNode(key dms3ld.Node) (dms3ld.Node, error) { + func (n {{ .Type | TypeSymbol }}) LookupByNode(key ld.Node) (ld.Node, error) { ks, err := key.AsString() if err != nil { return nil, err @@ -138,7 +138,7 @@ func (g structGenerator) EmitNodeMethodMapIterator(w io.Writer) { // Note that the typed iterator will report absent fields. // The representation iterator (if has one) however will skip those. doTemplate(` - func (n {{ .Type | TypeSymbol }}) MapIterator() dms3ld.MapIterator { + func (n {{ .Type | TypeSymbol }}) MapIterator() ld.MapIterator { return &_{{ .Type | TypeSymbol }}__MapItr{n, 0} } @@ -147,12 +147,12 @@ func (g structGenerator) EmitNodeMethodMapIterator(w io.Writer) { idx int } - func (itr *_{{ .Type | TypeSymbol }}__MapItr) Next() (k dms3ld.Node, v dms3ld.Node, _ error) { + func (itr *_{{ .Type | TypeSymbol }}__MapItr) Next() (k ld.Node, v ld.Node, _ error) { {{- if not .Type.Fields }} - return nil, nil, dms3ld.ErrIteratorOverread{} + return nil, nil, ld.ErrIteratorOverread{} {{ else -}} if itr.idx >= {{ len .Type.Fields }} { - return nil, nil, dms3ld.ErrIteratorOverread{} + return nil, nil, ld.ErrIteratorOverread{} } switch itr.idx { {{- $type := .Type -}} {{- /* ranging modifies dot, unhelpfully */ -}} @@ -161,13 +161,13 @@ func (g structGenerator) EmitNodeMethodMapIterator(w io.Writer) { k = &fieldName__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }} {{- if $field.IsOptional }} if itr.n.{{ $field | FieldSymbolLower }}.m == schema.Maybe_Absent { - v = dms3ld.Absent + v = ld.Absent break } {{- end}} {{- if $field.IsNullable }} if itr.n.{{ $field | FieldSymbolLower }}.m == schema.Maybe_Null { - v = dms3ld.Null + v = ld.Null break } {{- end}} @@ -292,7 +292,7 @@ func (g structBuilderGenerator) EmitNodeAssemblerMethodAssignNode(w io.Writer) { // // We do not set m=midvalue in phase 3 -- it shouldn't matter unless you're trying to pull off concurrent access, which is wrong and unsafe regardless. doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__Assembler) AssignNode(v dms3ld.Node) error { + func (na *_{{ .Type | TypeSymbol }}__Assembler) AssignNode(v ld.Node) error { if v.IsNull() { return na.AssignNull() } @@ -314,8 +314,8 @@ func (g structBuilderGenerator) EmitNodeAssemblerMethodAssignNode(w io.Writer) { *na.m = schema.Maybe_Value return nil } - if v.Kind() != dms3ld.Kind_Map { - return dms3ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}", MethodName: "AssignNode", AppropriateKind: dms3ld.KindSet_JustMap, ActualKind: v.Kind()} + if v.Kind() != ld.Kind_Map { + return ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}", MethodName: "AssignNode", AppropriateKind: ld.KindSet_JustMap, ActualKind: v.Kind()} } itr := v.MapIterator() for !itr.Done() { @@ -407,7 +407,7 @@ func (g structBuilderGenerator) emitMapAssemblerChildTidyHelper(w io.Writer) { func (g structBuilderGenerator) emitMapAssemblerMethods(w io.Writer) { // FUTURE: some of the setup of the child assemblers could probably be DRY'd up. doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__Assembler) AssembleEntry(k string) (dms3ld.NodeAssembler, error) { + func (ma *_{{ .Type | TypeSymbol }}__Assembler) AssembleEntry(k string) (ld.NodeAssembler, error) { switch ma.state { case maState_initial: // carry on @@ -428,7 +428,7 @@ func (g structBuilderGenerator) emitMapAssemblerMethods(w io.Writer) { {{- range $i, $field := .Type.Fields }} case "{{ $field.Name }}": if ma.s & fieldBit__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }} != 0 { - return nil, dms3ld.ErrRepeatedMapKey{Key: &fieldName__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }}} + return nil, ld.ErrRepeatedMapKey{Key: &fieldName__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }}} } ma.s += fieldBit__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }} ma.state = maState_midValue @@ -447,9 +447,9 @@ func (g structBuilderGenerator) emitMapAssemblerMethods(w io.Writer) { {{- end}} } {{- end}} - return nil, dms3ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}", Key:&_String{k}} + return nil, ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}", Key:&_String{k}} } - func (ma *_{{ .Type | TypeSymbol }}__Assembler) AssembleKey() dms3ld.NodeAssembler { + func (ma *_{{ .Type | TypeSymbol }}__Assembler) AssembleKey() ld.NodeAssembler { switch ma.state { case maState_initial: // carry on @@ -467,7 +467,7 @@ func (g structBuilderGenerator) emitMapAssemblerMethods(w io.Writer) { ma.state = maState_midKey return (*_{{ .Type | TypeSymbol }}__KeyAssembler)(ma) } - func (ma *_{{ .Type | TypeSymbol }}__Assembler) AssembleValue() dms3ld.NodeAssembler { + func (ma *_{{ .Type | TypeSymbol }}__Assembler) AssembleValue() ld.NodeAssembler { switch ma.state { case maState_initial: panic("invalid state: AssembleValue cannot be called when no key is primed") @@ -516,7 +516,7 @@ func (g structBuilderGenerator) emitMapAssemblerMethods(w io.Writer) { panic("invalid state: Finish cannot be called on an assembler that's already finished") } if ma.s & fieldBits__{{ $type | TypeSymbol }}_sufficient != fieldBits__{{ $type | TypeSymbol }}_sufficient { - err := dms3ld.ErrMissingRequiredField{Missing: make([]string, 0)} + err := ld.ErrMissingRequiredField{Missing: make([]string, 0)} {{- range $i, $field := .Type.Fields }} {{- if not $field.IsMaybe}} if ma.s & fieldBit__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }} == 0 { @@ -530,10 +530,10 @@ func (g structBuilderGenerator) emitMapAssemblerMethods(w io.Writer) { *ma.m = schema.Maybe_Value return nil } - func (ma *_{{ .Type | TypeSymbol }}__Assembler) KeyPrototype() dms3ld.NodePrototype { + func (ma *_{{ .Type | TypeSymbol }}__Assembler) KeyPrototype() ld.NodePrototype { return _String__Prototype{} } - func (ma *_{{ .Type | TypeSymbol }}__Assembler) ValuePrototype(k string) dms3ld.NodePrototype { + func (ma *_{{ .Type | TypeSymbol }}__Assembler) ValuePrototype(k string) ld.NodePrototype { panic("todo structbuilder mapassembler valueprototype") } `, w, g.AdjCfg, g) @@ -565,14 +565,14 @@ func (g structBuilderGenerator) emitKeyAssembler(w io.Writer) { {{- range $i, $field := .Type.Fields }} case "{{ $field.Name }}": if ka.s & fieldBit__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }} != 0 { - return dms3ld.ErrRepeatedMapKey{Key: &fieldName__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }}} + return ld.ErrRepeatedMapKey{Key: &fieldName__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }}} } ka.s += fieldBit__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }} ka.state = maState_expectValue ka.f = {{ $i }} {{- end}} default: - return dms3ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}", Key:&_String{k}} + return ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}", Key:&_String{k}} } return nil } @@ -580,14 +580,14 @@ func (g structBuilderGenerator) emitKeyAssembler(w io.Writer) { stubs.EmitNodeAssemblerMethodAssignBytes(w) stubs.EmitNodeAssemblerMethodAssignLink(w) doTemplate(` - func (ka *_{{ .Type | TypeSymbol }}__KeyAssembler) AssignNode(v dms3ld.Node) error { + func (ka *_{{ .Type | TypeSymbol }}__KeyAssembler) AssignNode(v ld.Node) error { if v2, err := v.AsString(); err != nil { return err } else { return ka.AssignString(v2) } } - func (_{{ .Type | TypeSymbol }}__KeyAssembler) Prototype() dms3ld.NodePrototype { + func (_{{ .Type | TypeSymbol }}__KeyAssembler) Prototype() ld.NodePrototype { return _String__Prototype{} } `, w, g.AdjCfg, g) diff --git a/schema/gen/go/genStructReprMap.go b/schema/gen/go/genStructReprMap.go index d2b035d55a947e15621b1402a314f6400999b7c4..bdeec4f10096fd6f3bfbdddee8be351f9a83a514 100644 --- a/schema/gen/go/genStructReprMap.go +++ b/schema/gen/go/genStructReprMap.go @@ -74,25 +74,25 @@ func (g structReprMapReprGenerator) EmitNodeType(w io.Writer) { func (g structReprMapReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } func (g structReprMapReprGenerator) EmitNodeMethodLookupByString(w io.Writer) { // Similar to the type-level method, except any absent fields also return ErrNotExists. doTemplate(` - func (n *_{{ .Type | TypeSymbol }}__Repr) LookupByString(key string) (dms3ld.Node, error) { + func (n *_{{ .Type | TypeSymbol }}__Repr) LookupByString(key string) (ld.Node, error) { switch key { {{- range $field := .Type.Fields }} case "{{ $field | $field.Parent.RepresentationStrategy.GetFieldKey }}": {{- if $field.IsOptional }} if n.{{ $field | FieldSymbolLower }}.m == schema.Maybe_Absent { - return dms3ld.Absent, dms3ld.ErrNotExists{Segment: dms3ld.PathSegmentOfString(key)} + return ld.Absent, ld.ErrNotExists{Segment: ld.PathSegmentOfString(key)} } {{- end}} {{- if $field.IsNullable }} if n.{{ $field | FieldSymbolLower }}.m == schema.Maybe_Null { - return dms3ld.Null, nil + return ld.Null, nil } {{- end}} {{- if $field.IsMaybe }} @@ -102,7 +102,7 @@ func (g structReprMapReprGenerator) EmitNodeMethodLookupByString(w io.Writer) { {{- end}} {{- end}} default: - return nil, schema.ErrNoSuchField{Type: nil /*TODO*/, Field: dms3ld.PathSegmentOfString(key)} + return nil, schema.ErrNoSuchField{Type: nil /*TODO*/, Field: ld.PathSegmentOfString(key)} } } `, w, g.AdjCfg, g) @@ -110,7 +110,7 @@ func (g structReprMapReprGenerator) EmitNodeMethodLookupByString(w io.Writer) { func (g structReprMapReprGenerator) EmitNodeMethodLookupByNode(w io.Writer) { doTemplate(` - func (n *_{{ .Type | TypeSymbol }}__Repr) LookupByNode(key dms3ld.Node) (dms3ld.Node, error) { + func (n *_{{ .Type | TypeSymbol }}__Repr) LookupByNode(key ld.Node) (ld.Node, error) { ks, err := key.AsString() if err != nil { return nil, err @@ -153,7 +153,7 @@ func (g structReprMapReprGenerator) EmitNodeMethodMapIterator(w io.Writer) { // Now: finally we can get on with the actual templating. doTemplate(` - func (n *_{{ .Type | TypeSymbol }}__Repr) MapIterator() dms3ld.MapIterator { + func (n *_{{ .Type | TypeSymbol }}__Repr) MapIterator() ld.MapIterator { {{- if .HaveTrailingOptionals }} end := {{ len .Type.Fields }}`+ func() string { // this next part was too silly in templates due to lack of reverse ranging. @@ -179,14 +179,14 @@ func (g structReprMapReprGenerator) EmitNodeMethodMapIterator(w io.Writer) { {{if .HaveTrailingOptionals }}end int{{end}} } - func (itr *_{{ .Type | TypeSymbol }}__ReprMapItr) Next() (k dms3ld.Node, v dms3ld.Node, _ error) { + func (itr *_{{ .Type | TypeSymbol }}__ReprMapItr) Next() (k ld.Node, v ld.Node, _ error) { {{- if not .Type.Fields }} {{- /* TODO: deduplicate all these methods which just error */ -}} - return nil, nil, dms3ld.ErrIteratorOverread{} + return nil, nil, ld.ErrIteratorOverread{} {{ else -}} {{ if .HaveOptionals }}advance:{{end -}} if itr.idx >= {{ len .Type.Fields }} { - return nil, nil, dms3ld.ErrIteratorOverread{} + return nil, nil, ld.ErrIteratorOverread{} } switch itr.idx { {{- $type := .Type -}} {{- /* ranging modifies dot, unhelpfully */ -}} @@ -201,7 +201,7 @@ func (g structReprMapReprGenerator) EmitNodeMethodMapIterator(w io.Writer) { {{- end}} {{- if $field.IsNullable }} if itr.n.{{ $field | FieldSymbolLower }}.m == schema.Maybe_Null { - v = dms3ld.Null + v = ld.Null break } {{- end}} @@ -342,7 +342,7 @@ func (g structReprMapReprBuilderGenerator) EmitNodeAssemblerMethodAssignNode(w i // // We do not set m=midvalue in phase 3 -- it shouldn't matter unless you're trying to pull off concurrent access, which is wrong and unsafe regardless. doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) AssignNode(v dms3ld.Node) error { + func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) AssignNode(v ld.Node) error { if v.IsNull() { return na.AssignNull() } @@ -364,8 +364,8 @@ func (g structReprMapReprBuilderGenerator) EmitNodeAssemblerMethodAssignNode(w i *na.m = schema.Maybe_Value return nil } - if v.Kind() != dms3ld.Kind_Map { - return dms3ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}.Repr", MethodName: "AssignNode", AppropriateKind: dms3ld.KindSet_JustMap, ActualKind: v.Kind()} + if v.Kind() != ld.Kind_Map { + return ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}.Repr", MethodName: "AssignNode", AppropriateKind: ld.KindSet_JustMap, ActualKind: v.Kind()} } itr := v.MapIterator() for !itr.Done() { @@ -445,7 +445,7 @@ func (g structReprMapReprBuilderGenerator) emitMapAssemblerChildTidyHelper(w io. func (g structReprMapReprBuilderGenerator) emitMapAssemblerMethods(w io.Writer) { // FUTURE: some of the setup of the child assemblers could probably be DRY'd up. doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleEntry(k string) (dms3ld.NodeAssembler, error) { + func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleEntry(k string) (ld.NodeAssembler, error) { switch ma.state { case maState_initial: // carry on @@ -466,7 +466,7 @@ func (g structReprMapReprBuilderGenerator) emitMapAssemblerMethods(w io.Writer) {{- range $i, $field := .Type.Fields }} case "{{ $field | $type.RepresentationStrategy.GetFieldKey }}": if ma.s & fieldBit__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }} != 0 { - return nil, dms3ld.ErrRepeatedMapKey{Key: &fieldName__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }}_serial} + return nil, ld.ErrRepeatedMapKey{Key: &fieldName__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }}_serial} } ma.s += fieldBit__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }} ma.state = maState_midValue @@ -484,9 +484,9 @@ func (g structReprMapReprBuilderGenerator) emitMapAssemblerMethods(w io.Writer) default: } {{- end}} - return nil, dms3ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}.Repr", Key:&_String{k}} + return nil, ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}.Repr", Key:&_String{k}} } - func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleKey() dms3ld.NodeAssembler { + func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleKey() ld.NodeAssembler { switch ma.state { case maState_initial: // carry on @@ -504,7 +504,7 @@ func (g structReprMapReprBuilderGenerator) emitMapAssemblerMethods(w io.Writer) ma.state = maState_midKey return (*_{{ .Type | TypeSymbol }}__ReprKeyAssembler)(ma) } - func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleValue() dms3ld.NodeAssembler { + func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleValue() ld.NodeAssembler { switch ma.state { case maState_initial: panic("invalid state: AssembleValue cannot be called when no key is primed") @@ -551,7 +551,7 @@ func (g structReprMapReprBuilderGenerator) emitMapAssemblerMethods(w io.Writer) panic("invalid state: Finish cannot be called on an assembler that's already finished") } if ma.s & fieldBits__{{ $type | TypeSymbol }}_sufficient != fieldBits__{{ $type | TypeSymbol }}_sufficient { - err := dms3ld.ErrMissingRequiredField{Missing: make([]string, 0)} + err := ld.ErrMissingRequiredField{Missing: make([]string, 0)} {{- range $i, $field := .Type.Fields }} {{- if not $field.IsMaybe}} if ma.s & fieldBit__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }} == 0 { @@ -569,10 +569,10 @@ func (g structReprMapReprBuilderGenerator) emitMapAssemblerMethods(w io.Writer) *ma.m = schema.Maybe_Value return nil } - func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) KeyPrototype() dms3ld.NodePrototype { + func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) KeyPrototype() ld.NodePrototype { return _String__Prototype{} } - func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) ValuePrototype(k string) dms3ld.NodePrototype { + func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) ValuePrototype(k string) ld.NodePrototype { panic("todo structbuilder mapassembler repr valueprototype") } `, w, g.AdjCfg, g) @@ -605,7 +605,7 @@ func (g structReprMapReprBuilderGenerator) emitKeyAssembler(w io.Writer) { {{- range $i, $field := .Type.Fields }} case "{{ $field | $type.RepresentationStrategy.GetFieldKey }}": if ka.s & fieldBit__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }} != 0 { - return dms3ld.ErrRepeatedMapKey{Key: &fieldName__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }}_serial} + return ld.ErrRepeatedMapKey{Key: &fieldName__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }}_serial} } ka.s += fieldBit__{{ $type | TypeSymbol }}_{{ $field | FieldSymbolUpper }} ka.state = maState_expectValue @@ -614,20 +614,20 @@ func (g structReprMapReprBuilderGenerator) emitKeyAssembler(w io.Writer) { {{- end }} } {{- end }} - return dms3ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}.Repr", Key:&_String{k}} + return ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}.Repr", Key:&_String{k}} } `, w, g.AdjCfg, g) stubs.EmitNodeAssemblerMethodAssignBytes(w) stubs.EmitNodeAssemblerMethodAssignLink(w) doTemplate(` - func (ka *_{{ .Type | TypeSymbol }}__ReprKeyAssembler) AssignNode(v dms3ld.Node) error { + func (ka *_{{ .Type | TypeSymbol }}__ReprKeyAssembler) AssignNode(v ld.Node) error { if v2, err := v.AsString(); err != nil { return err } else { return ka.AssignString(v2) } } - func (_{{ .Type | TypeSymbol }}__ReprKeyAssembler) Prototype() dms3ld.NodePrototype { + func (_{{ .Type | TypeSymbol }}__ReprKeyAssembler) Prototype() ld.NodePrototype { return _String__Prototype{} } `, w, g.AdjCfg, g) diff --git a/schema/gen/go/genStructReprStringjoin.go b/schema/gen/go/genStructReprStringjoin.go index 6dfac2fd897189e3c58bde6f1b23848c12b48458..8dd7623e1a51bcc859ea81ee163144dbe6d95b59 100644 --- a/schema/gen/go/genStructReprStringjoin.go +++ b/schema/gen/go/genStructReprStringjoin.go @@ -59,7 +59,7 @@ func (g structReprStringjoinReprGenerator) EmitNodeType(w io.Writer) { func (g structReprStringjoinReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } @@ -153,12 +153,12 @@ func (g structReprStringjoinReprBuilderGenerator) EmitNodeBuilderMethods(w io.Wr func (_{{ .Type | TypeSymbol }}__ReprPrototype) fromString(w *_{{ .Type | TypeSymbol }}, v string) error { ss, err := mixins.SplitExact(v, "{{ .Type.RepresentationStrategy.GetDelim }}", {{ len .Type.Fields }}) if err != nil { - return dms3ld.ErrUnmatchable{TypeName:"{{ .PkgName }}.{{ .Type.Name }}.Repr", Reason: err} + return ld.ErrUnmatchable{TypeName:"{{ .PkgName }}.{{ .Type.Name }}.Repr", Reason: err} } {{- $dot := . -}} {{- /* ranging modifies dot, unhelpfully */ -}} {{- range $i, $field := .Type.Fields }} if err := (_{{ $field.Type | TypeSymbol }}__ReprPrototype{}).fromString(&w.{{ $field | FieldSymbolLower }}, ss[{{ $i }}]); err != nil { - return dms3ld.ErrUnmatchable{TypeName:"{{ $dot.PkgName }}.{{ $dot.Type.Name }}.Repr", Reason: err} + return ld.ErrUnmatchable{TypeName:"{{ $dot.PkgName }}.{{ $dot.Type.Name }}.Repr", Reason: err} } {{- end}} return nil @@ -208,7 +208,7 @@ func (g structReprStringjoinReprBuilderGenerator) EmitNodeAssemblerMethodAssignN // 2. is it our own type? Handle specially -- we might be able to do efficient things. // 3. is it the right kind to morph into us? Do so. doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) AssignNode(v dms3ld.Node) error { + func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) AssignNode(v ld.Node) error { if v.IsNull() { return na.AssignNull() } diff --git a/schema/gen/go/genStructReprTuple.go b/schema/gen/go/genStructReprTuple.go index 8e3322d45179baa80fa92d451857276e77c124e6..cfb2abbd20c55e0787426a6b90defa967fcec837 100644 --- a/schema/gen/go/genStructReprTuple.go +++ b/schema/gen/go/genStructReprTuple.go @@ -72,24 +72,24 @@ func (g structReprTupleReprGenerator) EmitNodeType(w io.Writer) { func (g structReprTupleReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } func (g structReprTupleReprGenerator) EmitNodeMethodLookupByIndex(w io.Writer) { doTemplate(` - func (n *_{{ .Type | TypeSymbol }}__Repr) LookupByIndex(idx int64) (dms3ld.Node, error) { + func (n *_{{ .Type | TypeSymbol }}__Repr) LookupByIndex(idx int64) (ld.Node, error) { switch idx { {{- range $i, $field := .Type.Fields }} case {{ $i }}: {{- if $field.IsOptional }} if n.{{ $field | FieldSymbolLower }}.m == schema.Maybe_Absent { - return dms3ld.Absent, dms3ld.ErrNotExists{Segment: dms3ld.PathSegmentOfInt(idx)} + return ld.Absent, ld.ErrNotExists{Segment: ld.PathSegmentOfInt(idx)} } {{- end}} {{- if $field.IsNullable }} if n.{{ $field | FieldSymbolLower }}.m == schema.Maybe_Null { - return dms3ld.Null, nil + return ld.Null, nil } {{- end}} {{- if $field.IsMaybe }} @@ -99,7 +99,7 @@ func (g structReprTupleReprGenerator) EmitNodeMethodLookupByIndex(w io.Writer) { {{- end}} {{- end}} default: - return nil, schema.ErrNoSuchField{Type: nil /*TODO*/, Field: dms3ld.PathSegmentOfInt(idx)} + return nil, schema.ErrNoSuchField{Type: nil /*TODO*/, Field: ld.PathSegmentOfInt(idx)} } } `, w, g.AdjCfg, g) @@ -107,7 +107,7 @@ func (g structReprTupleReprGenerator) EmitNodeMethodLookupByIndex(w io.Writer) { func (g structReprTupleReprGenerator) EmitNodeMethodLookupByNode(w io.Writer) { doTemplate(` - func (n *_{{ .Type | TypeSymbol }}__Repr) LookupByNode(key dms3ld.Node) (dms3ld.Node, error) { + func (n *_{{ .Type | TypeSymbol }}__Repr) LookupByNode(key ld.Node) (ld.Node, error) { ki, err := key.AsInt() if err != nil { return nil, err @@ -144,7 +144,7 @@ func (g structReprTupleReprGenerator) EmitNodeMethodListIterator(w io.Writer) { // Now: finally we can get on with the actual templating. doTemplate(` - func (n *_{{ .Type | TypeSymbol }}__Repr) ListIterator() dms3ld.ListIterator { + func (n *_{{ .Type | TypeSymbol }}__Repr) ListIterator() ld.ListIterator { {{- if .HaveTrailingOptionals }} end := {{ len .Type.Fields }}`+ func() string { // this next part was too silly in templates due to lack of reverse ranging. @@ -170,9 +170,9 @@ func (g structReprTupleReprGenerator) EmitNodeMethodListIterator(w io.Writer) { {{if .HaveTrailingOptionals }}end int{{end}} } - func (itr *_{{ .Type | TypeSymbol }}__ReprListItr) Next() (idx int64, v dms3ld.Node, err error) { + func (itr *_{{ .Type | TypeSymbol }}__ReprListItr) Next() (idx int64, v ld.Node, err error) { if itr.idx >= {{ len .Type.Fields }} { - return -1, nil, dms3ld.ErrIteratorOverread{} + return -1, nil, ld.ErrIteratorOverread{} } switch itr.idx { {{- range $i, $field := .Type.Fields }} @@ -180,12 +180,12 @@ func (g structReprTupleReprGenerator) EmitNodeMethodListIterator(w io.Writer) { idx = int64(itr.idx) {{- if $field.IsOptional }} if itr.n.{{ $field | FieldSymbolLower }}.m == schema.Maybe_Absent { - return -1, nil, dms3ld.ErrIteratorOverread{} + return -1, nil, ld.ErrIteratorOverread{} } {{- end}} {{- if $field.IsNullable }} if itr.n.{{ $field | FieldSymbolLower }}.m == schema.Maybe_Null { - v = dms3ld.Null + v = ld.Null break } {{- end}} @@ -312,7 +312,7 @@ func (g structReprTupleReprBuilderGenerator) EmitNodeAssemblerType(w io.Writer) func (g structReprTupleReprBuilderGenerator) EmitNodeAssemblerMethodBeginList(w io.Writer) { // Future: This could do something strict with the sizehint; it currently ignores it. doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) BeginList(int64) (dms3ld.ListAssembler, error) { + func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) BeginList(int64) (ld.ListAssembler, error) { switch *na.m { case schema.Maybe_Value, schema.Maybe_Null: panic("invalid state: cannot assign into assembler that's already finished") @@ -380,7 +380,7 @@ func (g structReprTupleReprBuilderGenerator) emitListAssemblerChildTidyHelper(w } func (g structReprTupleReprBuilderGenerator) emitListAssemblerChildListAssemblerMethods(w io.Writer) { doTemplate(` - func (la *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleValue() dms3ld.NodeAssembler { + func (la *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleValue() ld.NodeAssembler { switch la.state { case laState_initial: // carry on @@ -392,7 +392,7 @@ func (g structReprTupleReprBuilderGenerator) emitListAssemblerChildListAssembler panic("invalid state: AssembleValue cannot be called on an assembler that's already finished") } if la.f >= {{ len .Type.Fields }} { - return _ErrorThunkAssembler{schema.ErrNoSuchField{Type: nil /*TODO*/, Field: dms3ld.PathSegmentOfInt({{ len .Type.Fields }})}} + return _ErrorThunkAssembler{schema.ErrNoSuchField{Type: nil /*TODO*/, Field: ld.PathSegmentOfInt({{ len .Type.Fields }})}} } la.state = laState_midValue switch la.f { @@ -436,7 +436,7 @@ func (g structReprTupleReprBuilderGenerator) emitListAssemblerChildListAssembler } `, w, g.AdjCfg, g) doTemplate(` - func (la *_{{ .Type | TypeSymbol }}__ReprAssembler) ValuePrototype(_ int64) dms3ld.NodePrototype { + func (la *_{{ .Type | TypeSymbol }}__ReprAssembler) ValuePrototype(_ int64) ld.NodePrototype { panic("todo structbuilder tuplerepr valueprototype") } `, w, g.AdjCfg, g) diff --git a/schema/gen/go/genUnion.go b/schema/gen/go/genUnion.go index 30b5b28a41f5518e7981ab8c1988d5c00ce4da53..22c91139c568b4821ca9c21288d1ffc9e4fb5e2e 100644 --- a/schema/gen/go/genUnion.go +++ b/schema/gen/go/genUnion.go @@ -49,7 +49,7 @@ func (g unionGenerator) EmitNativeType(w io.Writer) { // and since we do it in that one case, it's just as well to do it uniformly. doTemplate(` {{- if Comments -}} - // {{ .Type | TypeSymbol }} matches the DMS3LD Schema type "{{ .Type.Name }}". + // {{ .Type | TypeSymbol }} matches the LD Schema type "{{ .Type.Name }}". // {{ .Type | TypeSymbol }} has {{ .Type.TypeKind }} typekind, which means its data model behaviors are that of a {{ .Kind }} kind. {{- end}} type {{ .Type | TypeSymbol }} = *_{{ .Type | TypeSymbol }} @@ -151,25 +151,25 @@ func (g unionGenerator) EmitNodeTypeAssertions(w io.Writer) { func (g unionGenerator) EmitNodeMethodLookupByString(w io.Writer) { doTemplate(` - func (n {{ .Type | TypeSymbol }}) LookupByString(key string) (dms3ld.Node, error) { + func (n {{ .Type | TypeSymbol }}) LookupByString(key string) (ld.Node, error) { switch key { {{- range $i, $member := .Type.Members }} case "{{ $member.Name }}": {{- if (eq (dot.AdjCfg.UnionMemlayout dot.Type) "embedAll") }} if n.tag != {{ add $i 1 }} { - return nil, dms3ld.ErrNotExists{Segment: dms3ld.PathSegmentOfString(key)} + return nil, ld.ErrNotExists{Segment: ld.PathSegmentOfString(key)} } return &n.x{{ add $i 1 }}, nil {{- else if (eq (dot.AdjCfg.UnionMemlayout dot.Type) "interface") }} if n2, ok := n.x.({{ $member | TypeSymbol }}); ok { return n2, nil } else { - return nil, dms3ld.ErrNotExists{Segment: dms3ld.PathSegmentOfString(key)} + return nil, ld.ErrNotExists{Segment: ld.PathSegmentOfString(key)} } {{- end}} {{- end}} default: - return nil, schema.ErrNoSuchField{Type: nil /*TODO*/, Field: dms3ld.PathSegmentOfString(key)} + return nil, schema.ErrNoSuchField{Type: nil /*TODO*/, Field: ld.PathSegmentOfString(key)} } } `, w, g.AdjCfg, g) @@ -177,7 +177,7 @@ func (g unionGenerator) EmitNodeMethodLookupByString(w io.Writer) { func (g unionGenerator) EmitNodeMethodLookupByNode(w io.Writer) { doTemplate(` - func (n {{ .Type | TypeSymbol }}) LookupByNode(key dms3ld.Node) (dms3ld.Node, error) { + func (n {{ .Type | TypeSymbol }}) LookupByNode(key ld.Node) (ld.Node, error) { ks, err := key.AsString() if err != nil { return nil, err @@ -190,7 +190,7 @@ func (g unionGenerator) EmitNodeMethodLookupByNode(w io.Writer) { func (g unionGenerator) EmitNodeMethodMapIterator(w io.Writer) { // This is kind of a hilarious "iterator": it has to count all the way up to... 1. doTemplate(` - func (n {{ .Type | TypeSymbol }}) MapIterator() dms3ld.MapIterator { + func (n {{ .Type | TypeSymbol }}) MapIterator() ld.MapIterator { return &_{{ .Type | TypeSymbol }}__MapItr{n, false} } @@ -199,9 +199,9 @@ func (g unionGenerator) EmitNodeMethodMapIterator(w io.Writer) { done bool } - func (itr *_{{ .Type | TypeSymbol }}__MapItr) Next() (k dms3ld.Node, v dms3ld.Node, _ error) { + func (itr *_{{ .Type | TypeSymbol }}__MapItr) Next() (k ld.Node, v ld.Node, _ error) { if itr.done { - return nil, nil, dms3ld.ErrIteratorOverread{} + return nil, nil, ld.ErrIteratorOverread{} } {{- if (eq (.AdjCfg.UnionMemlayout .Type) "embedAll") }} switch itr.n.tag { @@ -356,7 +356,7 @@ func (g unionBuilderGenerator) EmitNodeAssemblerMethodAssignNode(w io.Writer) { // // DRY: this turns out to be textually identical to the method for structs! (At least, for now. It could/should probably be optimized to get to the point faster in phase 3.) doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__Assembler) AssignNode(v dms3ld.Node) error { + func (na *_{{ .Type | TypeSymbol }}__Assembler) AssignNode(v ld.Node) error { if v.IsNull() { return na.AssignNull() } @@ -378,8 +378,8 @@ func (g unionBuilderGenerator) EmitNodeAssemblerMethodAssignNode(w io.Writer) { *na.m = schema.Maybe_Value return nil } - if v.Kind() != dms3ld.Kind_Map { - return dms3ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}", MethodName: "AssignNode", AppropriateKind: dms3ld.KindSet_JustMap, ActualKind: v.Kind()} + if v.Kind() != ld.Kind_Map { + return ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}", MethodName: "AssignNode", AppropriateKind: ld.KindSet_JustMap, ActualKind: v.Kind()} } itr := v.MapIterator() for !itr.Done() { @@ -446,7 +446,7 @@ func (g unionBuilderGenerator) emitMapAssemblerMethods(w io.Writer) { // Note that calling AssembleEntry again when it's not for the first entry *returns* an error; it doesn't panic. // This is subtle but important: trying to add more data than is acceptable is a data mismatch, not a system misuse, and must error accordingly politely. doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__Assembler) AssembleEntry(k string) (dms3ld.NodeAssembler, error) { + func (ma *_{{ .Type | TypeSymbol }}__Assembler) AssembleEntry(k string) (ld.NodeAssembler, error) { switch ma.state { case maState_initial: // carry on @@ -488,7 +488,7 @@ func (g unionBuilderGenerator) emitMapAssemblerMethods(w io.Writer) { {{- end}} {{- end}} } - return nil, dms3ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}", Key:&_String{k}} + return nil, ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}", Key:&_String{k}} } `, w, g.AdjCfg, g) @@ -500,7 +500,7 @@ func (g unionBuilderGenerator) emitMapAssemblerMethods(w io.Writer) { // and we don't want to make this call unchainable for everyone everywhere, either, so it can't be rewritten to have an immmediate error return. // The transition to midKey state is particularly irritating because it means this assembler will be perma-wedged; but I see no alternative. doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__Assembler) AssembleKey() dms3ld.NodeAssembler { + func (ma *_{{ .Type | TypeSymbol }}__Assembler) AssembleKey() ld.NodeAssembler { switch ma.state { case maState_initial: // carry on @@ -524,7 +524,7 @@ func (g unionBuilderGenerator) emitMapAssemblerMethods(w io.Writer) { // and some of the logical continuity bounces through state in the form of 'ma.ca'. // The potential to DRY up some of this should be plentiful, but it's a bit heady. doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__Assembler) AssembleValue() dms3ld.NodeAssembler { + func (ma *_{{ .Type | TypeSymbol }}__Assembler) AssembleValue() ld.NodeAssembler { switch ma.state { case maState_initial: panic("invalid state: AssembleValue cannot be called when no key is primed") @@ -590,10 +590,10 @@ func (g unionBuilderGenerator) emitMapAssemblerMethods(w io.Writer) { `, w, g.AdjCfg, g) doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__Assembler) KeyPrototype() dms3ld.NodePrototype { + func (ma *_{{ .Type | TypeSymbol }}__Assembler) KeyPrototype() ld.NodePrototype { return _String__Prototype{} } - func (ma *_{{ .Type | TypeSymbol }}__Assembler) ValuePrototype(k string) dms3ld.NodePrototype { + func (ma *_{{ .Type | TypeSymbol }}__Assembler) ValuePrototype(k string) ld.NodePrototype { switch k { {{- range $i, $member := .Type.Members }} case "{{ $member.Name }}": @@ -641,20 +641,20 @@ func (g unionBuilderGenerator) emitKeyAssembler(w io.Writer) { return nil {{- end}} } - return dms3ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}", Key:&_String{k}} // TODO: error quality: ErrInvalidUnionDiscriminant ? + return ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}", Key:&_String{k}} // TODO: error quality: ErrInvalidUnionDiscriminant ? } `, w, g.AdjCfg, g) stubs.EmitNodeAssemblerMethodAssignBytes(w) stubs.EmitNodeAssemblerMethodAssignLink(w) doTemplate(` - func (ka *_{{ .Type | TypeSymbol }}__KeyAssembler) AssignNode(v dms3ld.Node) error { + func (ka *_{{ .Type | TypeSymbol }}__KeyAssembler) AssignNode(v ld.Node) error { if v2, err := v.AsString(); err != nil { return err } else { return ka.AssignString(v2) } } - func (_{{ .Type | TypeSymbol }}__KeyAssembler) Prototype() dms3ld.NodePrototype { + func (_{{ .Type | TypeSymbol }}__KeyAssembler) Prototype() ld.NodePrototype { return _String__Prototype{} } `, w, g.AdjCfg, g) diff --git a/schema/gen/go/genUnionReprKeyed.go b/schema/gen/go/genUnionReprKeyed.go index 4eee7b71ff69d22e4e13eba1631ed3e78326ba2a..55a2f2c44404ebfaa9ff15bc197dbd4261fa5c69 100644 --- a/schema/gen/go/genUnionReprKeyed.go +++ b/schema/gen/go/genUnionReprKeyed.go @@ -73,32 +73,32 @@ func (g unionReprKeyedReprGenerator) EmitNodeType(w io.Writer) { func (g unionReprKeyedReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } func (g unionReprKeyedReprGenerator) EmitNodeMethodLookupByString(w io.Writer) { // Similar to the type-level method, except uses discriminant values as keys instead of the member type names. doTemplate(` - func (n *_{{ .Type | TypeSymbol }}__Repr) LookupByString(key string) (dms3ld.Node, error) { + func (n *_{{ .Type | TypeSymbol }}__Repr) LookupByString(key string) (ld.Node, error) { switch key { {{- range $i, $member := .Type.Members }} case "{{ $member | dot.Type.RepresentationStrategy.GetDiscriminant }}": {{- if (eq (dot.AdjCfg.UnionMemlayout dot.Type) "embedAll") }} if n.tag != {{ add $i 1 }} { - return nil, dms3ld.ErrNotExists{Segment: dms3ld.PathSegmentOfString(key)} + return nil, ld.ErrNotExists{Segment: ld.PathSegmentOfString(key)} } return n.x{{ add $i 1 }}.Representation(), nil {{- else if (eq (dot.AdjCfg.UnionMemlayout dot.Type) "interface") }} if n2, ok := n.x.({{ $member | TypeSymbol }}); ok { return n2.Representation(), nil } else { - return nil, dms3ld.ErrNotExists{Segment: dms3ld.PathSegmentOfString(key)} + return nil, ld.ErrNotExists{Segment: ld.PathSegmentOfString(key)} } {{- end}} {{- end}} default: - return nil, schema.ErrNoSuchField{Type: nil /*TODO*/, Field: dms3ld.PathSegmentOfString(key)} + return nil, schema.ErrNoSuchField{Type: nil /*TODO*/, Field: ld.PathSegmentOfString(key)} } } `, w, g.AdjCfg, g) @@ -106,7 +106,7 @@ func (g unionReprKeyedReprGenerator) EmitNodeMethodLookupByString(w io.Writer) { func (g unionReprKeyedReprGenerator) EmitNodeMethodLookupByNode(w io.Writer) { doTemplate(` - func (n *_{{ .Type | TypeSymbol }}__Repr) LookupByNode(key dms3ld.Node) (dms3ld.Node, error) { + func (n *_{{ .Type | TypeSymbol }}__Repr) LookupByNode(key ld.Node) (ld.Node, error) { ks, err := key.AsString() if err != nil { return nil, err @@ -119,7 +119,7 @@ func (g unionReprKeyedReprGenerator) EmitNodeMethodLookupByNode(w io.Writer) { func (g unionReprKeyedReprGenerator) EmitNodeMethodMapIterator(w io.Writer) { // Similar to the type-level method, except yields discriminant values as keys instead of the member type names. doTemplate(` - func (n *_{{ .Type | TypeSymbol }}__Repr) MapIterator() dms3ld.MapIterator { + func (n *_{{ .Type | TypeSymbol }}__Repr) MapIterator() ld.MapIterator { return &_{{ .Type | TypeSymbol }}__ReprMapItr{n, false} } @@ -128,9 +128,9 @@ func (g unionReprKeyedReprGenerator) EmitNodeMethodMapIterator(w io.Writer) { done bool } - func (itr *_{{ .Type | TypeSymbol }}__ReprMapItr) Next() (k dms3ld.Node, v dms3ld.Node, _ error) { + func (itr *_{{ .Type | TypeSymbol }}__ReprMapItr) Next() (k ld.Node, v ld.Node, _ error) { if itr.done { - return nil, nil, dms3ld.ErrIteratorOverread{} + return nil, nil, ld.ErrIteratorOverread{} } {{- if (eq (.AdjCfg.UnionMemlayout .Type) "embedAll") }} switch itr.n.tag { @@ -251,7 +251,7 @@ func (g unionReprKeyedReprBuilderGenerator) EmitNodeAssemblerMethodAssignNull(w func (g unionReprKeyedReprBuilderGenerator) EmitNodeAssemblerMethodAssignNode(w io.Writer) { // DRY: this is once again not-coincidentally very nearly equal to the type-level method. Would be good to dedup them... after we do the get-to-the-point-in-phase-3 improvement. doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) AssignNode(v dms3ld.Node) error { + func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) AssignNode(v ld.Node) error { if v.IsNull() { return na.AssignNull() } @@ -273,8 +273,8 @@ func (g unionReprKeyedReprBuilderGenerator) EmitNodeAssemblerMethodAssignNode(w *na.m = schema.Maybe_Value return nil } - if v.Kind() != dms3ld.Kind_Map { - return dms3ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}.Repr", MethodName: "AssignNode", AppropriateKind: dms3ld.KindSet_JustMap, ActualKind: v.Kind()} + if v.Kind() != ld.Kind_Map { + return ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}.Repr", MethodName: "AssignNode", AppropriateKind: ld.KindSet_JustMap, ActualKind: v.Kind()} } itr := v.MapIterator() for !itr.Done() { @@ -320,7 +320,7 @@ func (g unionReprKeyedReprBuilderGenerator) emitMapAssemblerMethods(w io.Writer) // DRY: the number of times these `ma.state` switches are appearing is truly intense! This is starting to look like one of them most important things to shrink the GSLOC/ASM size of! doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleEntry(k string) (dms3ld.NodeAssembler, error) { + func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleEntry(k string) (ld.NodeAssembler, error) { switch ma.state { case maState_initial: // carry on @@ -362,12 +362,12 @@ func (g unionReprKeyedReprBuilderGenerator) emitMapAssemblerMethods(w io.Writer) {{- end}} } {{- end}} - return nil, dms3ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}.Repr", Key:&_String{k}} + return nil, ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}.Repr", Key:&_String{k}} } `, w, g.AdjCfg, g) doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleKey() dms3ld.NodeAssembler { + func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleKey() ld.NodeAssembler { switch ma.state { case maState_initial: // carry on @@ -388,7 +388,7 @@ func (g unionReprKeyedReprBuilderGenerator) emitMapAssemblerMethods(w io.Writer) `, w, g.AdjCfg, g) doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleValue() dms3ld.NodeAssembler { + func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) AssembleValue() ld.NodeAssembler { switch ma.state { case maState_initial: panic("invalid state: AssembleValue cannot be called when no key is primed") @@ -452,10 +452,10 @@ func (g unionReprKeyedReprBuilderGenerator) emitMapAssemblerMethods(w io.Writer) `, w, g.AdjCfg, g) doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) KeyPrototype() dms3ld.NodePrototype { + func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) KeyPrototype() ld.NodePrototype { return _String__Prototype{} } - func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) ValuePrototype(k string) dms3ld.NodePrototype { + func (ma *_{{ .Type | TypeSymbol }}__ReprAssembler) ValuePrototype(k string) ld.NodePrototype { switch k { {{- range $i, $member := .Type.Members }} case "{{ $member.Name }}": @@ -502,20 +502,20 @@ func (g unionReprKeyedReprBuilderGenerator) emitKeyAssembler(w io.Writer) { return nil {{- end}} } - return dms3ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}.Repr", Key:&_String{k}} // TODO: error quality: ErrInvalidUnionDiscriminant ? + return ld.ErrInvalidKey{TypeName:"{{ .PkgName }}.{{ .Type.Name }}.Repr", Key:&_String{k}} // TODO: error quality: ErrInvalidUnionDiscriminant ? } `, w, g.AdjCfg, g) stubs.EmitNodeAssemblerMethodAssignBytes(w) stubs.EmitNodeAssemblerMethodAssignLink(w) doTemplate(` - func (ka *_{{ .Type | TypeSymbol }}__ReprKeyAssembler) AssignNode(v dms3ld.Node) error { + func (ka *_{{ .Type | TypeSymbol }}__ReprKeyAssembler) AssignNode(v ld.Node) error { if v2, err := v.AsString(); err != nil { return err } else { return ka.AssignString(v2) } } - func (_{{ .Type | TypeSymbol }}__ReprKeyAssembler) Prototype() dms3ld.NodePrototype { + func (_{{ .Type | TypeSymbol }}__ReprKeyAssembler) Prototype() ld.NodePrototype { return _String__Prototype{} } `, w, g.AdjCfg, g) diff --git a/schema/gen/go/genUnionReprKinded.go b/schema/gen/go/genUnionReprKinded.go index 05944032e23198625b2396b7bead0984d89f1c3f..88f7f5a6b4c66fd4aa6f1fdd8adf6e784594af6f 100644 --- a/schema/gen/go/genUnionReprKinded.go +++ b/schema/gen/go/genUnionReprKinded.go @@ -65,13 +65,13 @@ func (g unionKindedReprGenerator) EmitNodeType(w io.Writer) { func (g unionKindedReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } func (g unionKindedReprGenerator) EmitNodeMethodKind(w io.Writer) { doTemplate(` - func (n *_{{ .Type | TypeSymbol }}__Repr) Kind() dms3ld.Kind { + func (n *_{{ .Type | TypeSymbol }}__Repr) Kind() ld.Kind { {{- if (eq (.AdjCfg.UnionMemlayout .Type) "embedAll") }} switch n.tag { {{- range $i, $member := .Type.Members }} @@ -115,7 +115,7 @@ func kindedUnionNodeMethodTemplateMunge( errorClause := `return ` + nopeSentinel if !nopeSentinelOnly { - errorClause += `, dms3ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}.Repr", MethodName: "` + methodName + `", AppropriateKind: ` + appropriateKind + `, ActualKind: n.Kind()}` + errorClause += `, ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}.Repr", MethodName: "` + methodName + `", AppropriateKind: ` + appropriateKind + `, ActualKind: n.Kind()}` } return ` func (n *_{{ .Type | TypeSymbol }}__Repr) ` + methodSig + ` { @@ -150,11 +150,11 @@ func kindedUnionNodeMethodTemplateMunge( func (g unionKindedReprGenerator) EmitNodeMethodLookupByString(w io.Writer) { doTemplate(kindedUnionNodeMethodTemplateMunge( `LookupByString`, - `LookupByString(key string) (dms3ld.Node, error)`, + `LookupByString(key string) (ld.Node, error)`, `{{- if .Type.RepresentationStrategy.GetMember (Kind "map") }}`, `{{- if eq $member.RepresentationBehavior.String "map" }}`, `.LookupByString(key)`, - `dms3ld.KindSet_JustMap`, + `ld.KindSet_JustMap`, `nil`, false, ), w, g.AdjCfg, g) @@ -163,11 +163,11 @@ func (g unionKindedReprGenerator) EmitNodeMethodLookupByString(w io.Writer) { func (g unionKindedReprGenerator) EmitNodeMethodLookupByIndex(w io.Writer) { doTemplate(kindedUnionNodeMethodTemplateMunge( `LookupByIndex`, - `LookupByIndex(idx int64) (dms3ld.Node, error)`, + `LookupByIndex(idx int64) (ld.Node, error)`, `{{- if .Type.RepresentationStrategy.GetMember (Kind "list") }}`, `{{- if eq $member.RepresentationBehavior.String "list" }}`, `.LookupByIndex(idx)`, - `dms3ld.KindSet_JustList`, + `ld.KindSet_JustList`, `nil`, false, ), w, g.AdjCfg, g) @@ -176,11 +176,11 @@ func (g unionKindedReprGenerator) EmitNodeMethodLookupByIndex(w io.Writer) { func (g unionKindedReprGenerator) EmitNodeMethodLookupByNode(w io.Writer) { doTemplate(kindedUnionNodeMethodTemplateMunge( `LookupByNode`, - `LookupByNode(key dms3ld.Node) (dms3ld.Node, error)`, + `LookupByNode(key ld.Node) (ld.Node, error)`, `{{- if or (.Type.RepresentationStrategy.GetMember (Kind "map")) (.Type.RepresentationStrategy.GetMember (Kind "list")) }}`, `{{- if or (eq $member.RepresentationBehavior.String "map") (eq $member.RepresentationBehavior.String "list") }}`, `.LookupByNode(key)`, - `dms3ld.KindSet_Recursive`, + `ld.KindSet_Recursive`, `nil`, false, ), w, g.AdjCfg, g) @@ -189,11 +189,11 @@ func (g unionKindedReprGenerator) EmitNodeMethodLookupByNode(w io.Writer) { func (g unionKindedReprGenerator) EmitNodeMethodLookupBySegment(w io.Writer) { doTemplate(kindedUnionNodeMethodTemplateMunge( `LookupBySegment`, - `LookupBySegment(seg dms3ld.PathSegment) (dms3ld.Node, error)`, + `LookupBySegment(seg ld.PathSegment) (ld.Node, error)`, `{{- if or (.Type.RepresentationStrategy.GetMember (Kind "map")) (.Type.RepresentationStrategy.GetMember (Kind "list")) }}`, `{{- if or (eq $member.RepresentationBehavior.String "map") (eq $member.RepresentationBehavior.String "list") }}`, `.LookupBySegment(seg)`, - `dms3ld.KindSet_Recursive`, + `ld.KindSet_Recursive`, `nil`, false, ), w, g.AdjCfg, g) @@ -202,11 +202,11 @@ func (g unionKindedReprGenerator) EmitNodeMethodLookupBySegment(w io.Writer) { func (g unionKindedReprGenerator) EmitNodeMethodMapIterator(w io.Writer) { doTemplate(kindedUnionNodeMethodTemplateMunge( `MapIterator`, - `MapIterator() dms3ld.MapIterator`, + `MapIterator() ld.MapIterator`, `{{- if .Type.RepresentationStrategy.GetMember (Kind "map") }}`, `{{- if eq $member.RepresentationBehavior.String "map" }}`, `.MapIterator()`, - `dms3ld.KindSet_JustMap`, + `ld.KindSet_JustMap`, `nil`, true, ), w, g.AdjCfg, g) @@ -215,11 +215,11 @@ func (g unionKindedReprGenerator) EmitNodeMethodMapIterator(w io.Writer) { func (g unionKindedReprGenerator) EmitNodeMethodListIterator(w io.Writer) { doTemplate(kindedUnionNodeMethodTemplateMunge( `ListIterator`, - `ListIterator() dms3ld.ListIterator`, + `ListIterator() ld.ListIterator`, `{{- if .Type.RepresentationStrategy.GetMember (Kind "list") }}`, `{{- if eq $member.RepresentationBehavior.String "list" }}`, `.ListIterator()`, - `dms3ld.KindSet_JustList`, + `ld.KindSet_JustList`, `nil`, true, ), w, g.AdjCfg, g) @@ -232,7 +232,7 @@ func (g unionKindedReprGenerator) EmitNodeMethodLength(w io.Writer) { `{{- if or (.Type.RepresentationStrategy.GetMember (Kind "map")) (.Type.RepresentationStrategy.GetMember (Kind "list")) }}`, `{{- if or (eq $member.RepresentationBehavior.String "map") (eq $member.RepresentationBehavior.String "list") }}`, `.Length()`, - `dms3ld.KindSet_Recursive`, + `ld.KindSet_Recursive`, `-1`, true, ), w, g.AdjCfg, g) @@ -261,7 +261,7 @@ func (g unionKindedReprGenerator) EmitNodeMethodAsBool(w io.Writer) { `{{- if .Type.RepresentationStrategy.GetMember (Kind "bool") }}`, `{{- if eq $member.RepresentationBehavior.String "bool" }}`, `.AsBool()`, - `dms3ld.KindSet_JustBool`, + `ld.KindSet_JustBool`, `false`, false, ), w, g.AdjCfg, g) @@ -274,7 +274,7 @@ func (g unionKindedReprGenerator) EmitNodeMethodAsInt(w io.Writer) { `{{- if .Type.RepresentationStrategy.GetMember (Kind "int") }}`, `{{- if eq $member.RepresentationBehavior.String "int" }}`, `.AsInt()`, - `dms3ld.KindSet_JustInt`, + `ld.KindSet_JustInt`, `0`, false, ), w, g.AdjCfg, g) @@ -287,7 +287,7 @@ func (g unionKindedReprGenerator) EmitNodeMethodAsFloat(w io.Writer) { `{{- if .Type.RepresentationStrategy.GetMember (Kind "float") }}`, `{{- if eq $member.RepresentationBehavior.String "float" }}`, `.AsFloat()`, - `dms3ld.KindSet_JustFloat`, + `ld.KindSet_JustFloat`, `0`, false, ), w, g.AdjCfg, g) @@ -300,7 +300,7 @@ func (g unionKindedReprGenerator) EmitNodeMethodAsString(w io.Writer) { `{{- if .Type.RepresentationStrategy.GetMember (Kind "string") }}`, `{{- if eq $member.RepresentationBehavior.String "string" }}`, `.AsString()`, - `dms3ld.KindSet_JustString`, + `ld.KindSet_JustString`, `""`, false, ), w, g.AdjCfg, g) @@ -313,7 +313,7 @@ func (g unionKindedReprGenerator) EmitNodeMethodAsBytes(w io.Writer) { `{{- if .Type.RepresentationStrategy.GetMember (Kind "bytes") }}`, `{{- if eq $member.RepresentationBehavior.String "bytes" }}`, `.AsBytes()`, - `dms3ld.KindSet_JustBytes`, + `ld.KindSet_JustBytes`, `nil`, false, ), w, g.AdjCfg, g) @@ -322,11 +322,11 @@ func (g unionKindedReprGenerator) EmitNodeMethodAsBytes(w io.Writer) { func (g unionKindedReprGenerator) EmitNodeMethodAsLink(w io.Writer) { doTemplate(kindedUnionNodeMethodTemplateMunge( `AsLink`, - `AsLink() (dms3ld.Link, error)`, + `AsLink() (ld.Link, error)`, `{{- if .Type.RepresentationStrategy.GetMember (Kind "link") }}`, `{{- if eq $member.RepresentationBehavior.String "link" }}`, `.AsLink()`, - `dms3ld.KindSet_JustLink`, + `ld.KindSet_JustLink`, `nil`, false, ), w, g.AdjCfg, g) @@ -467,7 +467,7 @@ func kindedUnionNodeAssemblerMethodTemplateMunge( func (g unionKindedReprBuilderGenerator) EmitNodeAssemblerMethodBeginMap(w io.Writer) { doTemplate(kindedUnionNodeAssemblerMethodTemplateMunge( `BeginMap`, - `BeginMap(sizeHint int64) (dms3ld.MapAssembler, error)`, + `BeginMap(sizeHint int64) (ld.MapAssembler, error)`, `{{- if eq $member.RepresentationBehavior.String "map" }}`, `.BeginMap(sizeHint)`, true, @@ -476,7 +476,7 @@ func (g unionKindedReprBuilderGenerator) EmitNodeAssemblerMethodBeginMap(w io.Wr func (g unionKindedReprBuilderGenerator) EmitNodeAssemblerMethodBeginList(w io.Writer) { doTemplate(kindedUnionNodeAssemblerMethodTemplateMunge( `BeginList`, - `BeginList(sizeHint int64) (dms3ld.ListAssembler, error)`, + `BeginList(sizeHint int64) (ld.ListAssembler, error)`, `{{- if eq $member.RepresentationBehavior.String "list" }}`, `.BeginList(sizeHint)`, true, @@ -540,7 +540,7 @@ func (g unionKindedReprBuilderGenerator) EmitNodeAssemblerMethodAssignBytes(w io func (g unionKindedReprBuilderGenerator) EmitNodeAssemblerMethodAssignLink(w io.Writer) { doTemplate(kindedUnionNodeAssemblerMethodTemplateMunge( `AssignLink`, - `AssignLink(v dms3ld.Link) error `, + `AssignLink(v ld.Link) error `, `{{- if eq $member.RepresentationBehavior.String "link" }}`, `.AssignLink(v)`, false, @@ -555,7 +555,7 @@ func (g unionKindedReprBuilderGenerator) EmitNodeAssemblerMethodAssignNode(w io. // Errors are problematic again, same as is noted in kindedUnionNodeAssemblerMethodTemplateMunge. // We also end up returning errors with other method names due to how we delegate; unfortunate. doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) AssignNode(v dms3ld.Node) error { + func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) AssignNode(v ld.Node) error { if v.IsNull() { return na.AssignNull() } @@ -578,22 +578,22 @@ func (g unionKindedReprBuilderGenerator) EmitNodeAssemblerMethodAssignNode(w io. return nil } switch v.Kind() { - case dms3ld.Kind_Bool: + case ld.Kind_Bool: v2, _ := v.AsBool() return na.AssignBool(v2) - case dms3ld.Kind_Int: + case ld.Kind_Int: v2, _ := v.AsInt() return na.AssignInt(v2) - case dms3ld.Kind_Float: + case ld.Kind_Float: v2, _ := v.AsFloat() return na.AssignFloat(v2) - case dms3ld.Kind_String: + case ld.Kind_String: v2, _ := v.AsString() return na.AssignString(v2) - case dms3ld.Kind_Bytes: + case ld.Kind_Bytes: v2, _ := v.AsBytes() return na.AssignBytes(v2) - case dms3ld.Kind_Map: + case ld.Kind_Map: na, err := na.BeginMap(v.Length()) if err != nil { return err @@ -612,7 +612,7 @@ func (g unionKindedReprBuilderGenerator) EmitNodeAssemblerMethodAssignNode(w io. } } return na.Finish() - case dms3ld.Kind_List: + case ld.Kind_List: na, err := na.BeginList(v.Length()) if err != nil { return err @@ -628,7 +628,7 @@ func (g unionKindedReprBuilderGenerator) EmitNodeAssemblerMethodAssignNode(w io. } } return na.Finish() - case dms3ld.Kind_Link: + case ld.Kind_Link: v2, _ := v.AsLink() return na.AssignLink(v2) default: @@ -639,7 +639,7 @@ func (g unionKindedReprBuilderGenerator) EmitNodeAssemblerMethodAssignNode(w io. } func (g unionKindedReprBuilderGenerator) EmitNodeAssemblerMethodPrototype(w io.Writer) { doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) Prototype() dms3ld.NodePrototype { + func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) Prototype() ld.NodePrototype { return _{{ .Type | TypeSymbol }}__ReprPrototype{} } `, w, g.AdjCfg, g) diff --git a/schema/gen/go/genUnionReprStringprefix.go b/schema/gen/go/genUnionReprStringprefix.go index 3625e3abb191f4d3e733961a36affcfc82ec026c..efa2b51cee664cddfbfecac9b746a39f337e37b7 100644 --- a/schema/gen/go/genUnionReprStringprefix.go +++ b/schema/gen/go/genUnionReprStringprefix.go @@ -69,7 +69,7 @@ func (g unionReprStringprefixReprGenerator) EmitNodeType(w io.Writer) { func (g unionReprStringprefixReprGenerator) EmitNodeTypeAssertions(w io.Writer) { doTemplate(` - var _ dms3ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} + var _ ld.Node = &_{{ .Type | TypeSymbol }}__Repr{} `, w, g.AdjCfg, g) } @@ -154,7 +154,7 @@ func (g unionReprStringprefixReprBuilderGenerator) EmitNodeBuilderMethods(w io.W func (_{{ .Type | TypeSymbol }}__ReprPrototype) fromString(w *_{{ .Type | TypeSymbol }}, v string) error { ss := mixins.SplitN(v, "{{ .Type.RepresentationStrategy.GetDelim }}", 2) if len(ss) != 2 { - return dms3ld.ErrUnmatchable{TypeName:"{{ .PkgName }}.{{ .Type.Name }}.Repr"}.Reasonf("expecting a stringprefix union but found no delimiter in the value") + return ld.ErrUnmatchable{TypeName:"{{ .PkgName }}.{{ .Type.Name }}.Repr"}.Reasonf("expecting a stringprefix union but found no delimiter in the value") } switch ss[0] { {{- range $i, $member := .Type.Members }} @@ -162,20 +162,20 @@ func (g unionReprStringprefixReprBuilderGenerator) EmitNodeBuilderMethods(w io.W {{- if (eq (dot.AdjCfg.UnionMemlayout dot.Type) "embedAll") }} w.tag = {{ add $i 1 }} if err := (_{{ $member | TypeSymbol }}__ReprPrototype{}).fromString(&w.x{{ add $i 1 }}, ss[1]); err != nil { - return dms3ld.ErrUnmatchable{TypeName:"{{ dot.PkgName }}.{{ dot.Type.Name }}.Repr", Reason: err} + return ld.ErrUnmatchable{TypeName:"{{ dot.PkgName }}.{{ dot.Type.Name }}.Repr", Reason: err} } return nil {{- else if (eq (dot.AdjCfg.UnionMemlayout dot.Type) "interface") }} var n2 _{{ $member | TypeSymbol }} if err := (_{{ $member | TypeSymbol }}__ReprPrototype{}).fromString(&n2, ss[1]); err != nil { - return dms3ld.ErrUnmatchable{TypeName:"{{ dot.PkgName }}.{{ dot.Type.Name }}.Repr", Reason: err} + return ld.ErrUnmatchable{TypeName:"{{ dot.PkgName }}.{{ dot.Type.Name }}.Repr", Reason: err} } w.x = &n2 return nil {{- end}} {{- end}} default: - return schema.ErrNoSuchField{Type: nil /*TODO*/, Field: dms3ld.PathSegmentOfString(ss[0])} + return schema.ErrNoSuchField{Type: nil /*TODO*/, Field: ld.PathSegmentOfString(ss[0])} } } `, w, g.AdjCfg, g) @@ -225,7 +225,7 @@ func (g unionReprStringprefixReprBuilderGenerator) EmitNodeAssemblerMethodAssign // 3. is it the right kind to morph into us? Do so. // TODO:DRY: this is identical to other string-repr-on-non-string-type. doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) AssignNode(v dms3ld.Node) error { + func (na *_{{ .Type | TypeSymbol }}__ReprAssembler) AssignNode(v ld.Node) error { if v.IsNull() { return na.AssignNull() } diff --git a/schema/gen/go/generate.go b/schema/gen/go/generate.go index 8128b6231c1ae6a6eeca40f4e3871d9ce007d927..e8992f1c91dd850c5d577f9786607207b2835593 100644 --- a/schema/gen/go/generate.go +++ b/schema/gen/go/generate.go @@ -15,10 +15,10 @@ import ( // Generate takes a typesystem and the adjunct config for codegen, // and emits generated code in the given path with the given package name. // -// All of the files produced will match the pattern "dms3ldsch.*.gen.go". +// All of the files produced will match the pattern "ldsch.*.gen.go". func Generate(pth string, pkgName string, ts schema.TypeSystem, adjCfg *AdjunctCfg) { // Emit fixed bits. - withFile(filepath.Join(pth, "dms3ldsch_minima.go"), func(f io.Writer) { + withFile(filepath.Join(pth, "ldsch_minima.go"), func(f io.Writer) { EmitInternalEnums(pkgName, f) }) @@ -88,14 +88,14 @@ func Generate(pth string, pkgName string, ts schema.TypeSystem, adjCfg *AdjunctC } // Emit a file with the type table, and the golang type defns for each type. - withFile(filepath.Join(pth, "dms3ldsch_types.go"), func(f io.Writer) { + withFile(filepath.Join(pth, "ldsch_types.go"), func(f io.Writer) { // Emit headers, import statements, etc. fmt.Fprintf(f, "package %s\n\n", pkgName) fmt.Fprintf(f, doNotEditComment+"\n\n") fmt.Fprintf(f, "import (\n") - fmt.Fprintf(f, "\tdms3ld \"gitlab.dms3.io/ld/go-ld-prime\"\n") // referenced for links + fmt.Fprintf(f, "\tld \"gitlab.dms3.io/ld/go-ld-prime\"\n") // referenced for links fmt.Fprintf(f, ")\n") - fmt.Fprintf(f, "var _ dms3ld.Node = nil // suppress errors when this dependency is not referenced\n") + fmt.Fprintf(f, "var _ ld.Node = nil // suppress errors when this dependency is not referenced\n") // Emit the type table. EmitTypeTable(pkgName, ts, adjCfg, f) @@ -112,12 +112,12 @@ func Generate(pth string, pkgName string, ts schema.TypeSystem, adjCfg *AdjunctC // Emit a file with all the Node/NodeBuilder/NodeAssembler boilerplate. // Also includes typedefs for representation-level data. // Also includes the MaybeT boilerplate. - withFile(filepath.Join(pth, "dms3ldsch_satisfaction.go"), func(f io.Writer) { + withFile(filepath.Join(pth, "ldsch_satisfaction.go"), func(f io.Writer) { // Emit headers, import statements, etc. fmt.Fprintf(f, "package %s\n\n", pkgName) fmt.Fprintf(f, doNotEditComment+"\n\n") fmt.Fprintf(f, "import (\n") - fmt.Fprintf(f, "\tdms3ld \"gitlab.dms3.io/ld/go-ld-prime\"\n") // referenced everywhere. + fmt.Fprintf(f, "\tld \"gitlab.dms3.io/ld/go-ld-prime\"\n") // referenced everywhere. fmt.Fprintf(f, "\t\"gitlab.dms3.io/ld/go-ld-prime/node/mixins\"\n") // referenced by node implementation guts. fmt.Fprintf(f, "\t\"gitlab.dms3.io/ld/go-ld-prime/schema\"\n") // referenced by maybes (and surprisingly little else). fmt.Fprintf(f, ")\n\n") diff --git a/schema/gen/go/generators.go b/schema/gen/go/generators.go index b3ceaa0b69a2fe6b903c513c6cc7caea1e9fdd75..e3317543d9a897c72f8104f09a052ee4bfdf089e 100644 --- a/schema/gen/go/generators.go +++ b/schema/gen/go/generators.go @@ -84,7 +84,7 @@ func EmitFileHeader(packageName string, w io.Writer) { fmt.Fprintf(w, "package %s\n\n", packageName) fmt.Fprintf(w, doNotEditComment+"\n\n") fmt.Fprintf(w, "import (\n") - fmt.Fprintf(w, "\tdms3ld \"gitlab.dms3.io/ld/go-ld-prime\"\n") + fmt.Fprintf(w, "\tld \"gitlab.dms3.io/ld/go-ld-prime\"\n") fmt.Fprintf(w, "\t\"gitlab.dms3.io/ld/go-ld-prime/node/mixins\"\n") fmt.Fprintf(w, "\t\"gitlab.dms3.io/ld/go-ld-prime/schema\"\n") fmt.Fprintf(w, ")\n\n") diff --git a/schema/gen/go/genpartsCommon.go b/schema/gen/go/genpartsCommon.go index a474ae53aad5df11023a1fe6c109dcd4a604a22a..e3a089afbcc4316cb61aa7b520f3c8e679e7e656 100644 --- a/schema/gen/go/genpartsCommon.go +++ b/schema/gen/go/genpartsCommon.go @@ -13,7 +13,7 @@ import ( // The codegen do-not-edit warning comment. // Follows the pattern in https://golang.org/s/generatedcode / https://github.com/golang/go/issues/13560#issuecomment-288457920 . // Should appear somewhere near the top of every file (though precise order doesn't matter). -const doNotEditComment = `// Code generated by go-dms3ld-prime gengo. DO NOT EDIT.` +const doNotEditComment = `// Code generated by go-ld-prime gengo. DO NOT EDIT.` // emitNativeMaybe turns out to be completely agnostic to pretty much everything; // it doesn't vary by kind at all, and has never yet ended up needing specialization. @@ -34,12 +34,12 @@ func emitNativeMaybe(w io.Writer, adjCfg *AdjunctCfg, data interface{}) { func (m Maybe{{ .Type | TypeSymbol }}) Exists() bool { return m.m == schema.Maybe_Value } - func (m Maybe{{ .Type | TypeSymbol }}) AsNode() dms3ld.Node { + func (m Maybe{{ .Type | TypeSymbol }}) AsNode() ld.Node { switch m.m { case schema.Maybe_Absent: - return dms3ld.Absent + return ld.Absent case schema.Maybe_Null: - return dms3ld.Null + return ld.Null case schema.Maybe_Value: return {{if not (MaybeUsesPtr .Type) }}&{{end}}m.v default: @@ -61,7 +61,7 @@ func emitNativeType_scalar(w io.Writer, adjCfg *AdjunctCfg, data interface{}) { // which is desirable because the compiler then ensures our validate methods can't be evaded. doTemplate(` {{- if Comments -}} - // {{ .Type | TypeSymbol }} matches the DMS3LD Schema type "{{ .Type.Name }}". It has {{ .Kind }} kind. + // {{ .Type | TypeSymbol }} matches the LD Schema type "{{ .Type.Name }}". It has {{ .Kind }} kind. {{- end}} type {{ .Type | TypeSymbol }} = *_{{ .Type | TypeSymbol }} type _{{ .Type | TypeSymbol }} struct{ x {{ .Kind | KindPrim }} } @@ -95,7 +95,7 @@ func emitNativeBuilder_scalar(w io.Writer, adjCfg *AdjunctCfg, data interface{}) func emitNodeTypeAssertions_typical(w io.Writer, adjCfg *AdjunctCfg, data interface{}) { doTemplate(` - var _ dms3ld.Node = ({{ .Type | TypeSymbol }})(&_{{ .Type | TypeSymbol }}{}) + var _ ld.Node = ({{ .Type | TypeSymbol }})(&_{{ .Type | TypeSymbol }}{}) var _ schema.TypedNode = ({{ .Type | TypeSymbol }})(&_{{ .Type | TypeSymbol }}{}) `, w, adjCfg, data) } @@ -110,7 +110,7 @@ func emitNodeMethodAsKind_scalar(w io.Writer, adjCfg *AdjunctCfg, data interface func emitNodeMethodPrototype_typical(w io.Writer, adjCfg *AdjunctCfg, data interface{}) { doTemplate(` - func ({{ if .IsRepr }}_{{end}}{{ .Type | TypeSymbol }}{{ if .IsRepr }}__Repr{{end}}) Prototype() dms3ld.NodePrototype { + func ({{ if .IsRepr }}_{{end}}{{ .Type | TypeSymbol }}{{ if .IsRepr }}__Repr{{end}}) Prototype() ld.NodePrototype { return _{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Prototype{} } `, w, adjCfg, data) @@ -122,7 +122,7 @@ func emitNodePrototypeType_typical(w io.Writer, adjCfg *AdjunctCfg, data interfa doTemplate(` type _{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Prototype struct{} - func (_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Prototype) NewBuilder() dms3ld.NodeBuilder { + func (_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Prototype) NewBuilder() ld.NodeBuilder { var nb _{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Builder nb.Reset() return &nb @@ -142,7 +142,7 @@ func emitNodePrototypeType_typical(w io.Writer, adjCfg *AdjunctCfg, data interfa // and two, mixins are also used in the repr generators, and it wouldn't be all sane for this method to end up also on reprs. func emitTypicalTypedNodeMethodRepresentation(w io.Writer, adjCfg *AdjunctCfg, data interface{}) { doTemplate(` - func (n {{ .Type | TypeSymbol }}) Representation() dms3ld.Node { + func (n {{ .Type | TypeSymbol }}) Representation() ld.Node { return (*_{{ .Type | TypeSymbol }}__Repr)(n) } `, w, adjCfg, data) @@ -161,7 +161,7 @@ func emitEmitNodeBuilderType_typical(w io.Writer, adjCfg *AdjunctCfg, data inter // We count on the zero value of any addntl non-common fields of the assembler being correct. func emitNodeBuilderMethods_typical(w io.Writer, adjCfg *AdjunctCfg, data interface{}) { doTemplate(` - func (nb *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Builder) Build() dms3ld.Node { + func (nb *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Builder) Build() ld.Node { if *nb.m != schema.Maybe_Value { panic("invalid state: cannot call Build on an assembler that's not finished") } @@ -258,7 +258,7 @@ func emitNodeAssemblerMethodAssignNode_scalar(w io.Writer, adjCfg *AdjunctCfg, d // 2. is it our own type? Handle specially -- we might be able to do efficient things. // 3. is it the right kind to morph into us? Do so. doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__Assembler) AssignNode(v dms3ld.Node) error { + func (na *_{{ .Type | TypeSymbol }}__Assembler) AssignNode(v ld.Node) error { if v.IsNull() { return na.AssignNull() } diff --git a/schema/gen/go/genpartsList.go b/schema/gen/go/genpartsList.go index 1ce32de652e85e362794fa56563800f171aa546b..4e73454b577e20d4d60e934e0ae52a4513c8ba26 100644 --- a/schema/gen/go/genpartsList.go +++ b/schema/gen/go/genpartsList.go @@ -25,7 +25,7 @@ func emitNodeAssemblerMethodBeginList_listoid(w io.Writer, adjCfg *AdjunctCfg, d // Would also want to examine if that makes desirable trades in gsloc/asmsize/speed/debuggability. // Only seems to apply to case of list-repr-list, so unclear if worth the effort. doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) BeginList(sizeHint int64) (dms3ld.ListAssembler, error) { + func (na *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) BeginList(sizeHint int64) (ld.ListAssembler, error) { switch *na.m { case schema.Maybe_Value, schema.Maybe_Null: panic("invalid state: cannot assign into assembler that's already finished") @@ -60,7 +60,7 @@ func emitNodeAssemblerMethodAssignNode_listoid(w io.Writer, adjCfg *AdjunctCfg, // This works easily for both type-level and representational nodes because // any divergences that have to do with the child value are nicely hidden behind `AssembleValue`. doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) AssignNode(v dms3ld.Node) error { + func (na *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) AssignNode(v ld.Node) error { if v.IsNull() { return na.AssignNull() } @@ -82,8 +82,8 @@ func emitNodeAssemblerMethodAssignNode_listoid(w io.Writer, adjCfg *AdjunctCfg, *na.m = schema.Maybe_Value return nil } - if v.Kind() != dms3ld.Kind_List { - return dms3ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}{{ if .IsRepr }}.Repr{{end}}", MethodName: "AssignNode", AppropriateKind: dms3ld.KindSet_JustList, ActualKind: v.Kind()} + if v.Kind() != ld.Kind_List { + return ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}{{ if .IsRepr }}.Repr{{end}}", MethodName: "AssignNode", AppropriateKind: ld.KindSet_JustList, ActualKind: v.Kind()} } itr := v.ListIterator() for !itr.Done() { @@ -154,7 +154,7 @@ func emitNodeAssemblerHelper_listoid_listAssemblerMethods(w io.Writer, adjCfg *A // DRY(nope): Can this be extracted to a shared function in the output? // Same story as the tidy helper -- it touches `la.va` concretely in several places, and that blocks extraction. doTemplate(` - func (la *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) AssembleValue() dms3ld.NodeAssembler { + func (la *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) AssembleValue() ld.NodeAssembler { switch la.state { case laState_initial: // carry on @@ -199,7 +199,7 @@ func emitNodeAssemblerHelper_listoid_listAssemblerMethods(w io.Writer, adjCfg *A } `, w, adjCfg, data) doTemplate(` - func (la *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) ValuePrototype(_ int64) dms3ld.NodePrototype { + func (la *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) ValuePrototype(_ int64) ld.NodePrototype { return _{{ .Type.ValueType | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Prototype{} } `, w, adjCfg, data) diff --git a/schema/gen/go/genpartsMap.go b/schema/gen/go/genpartsMap.go index e9ebf497652ca3fe74475290ded8485edc3548db..40d9aa29c85a7b291be549e95aa63c44df6ff1db 100644 --- a/schema/gen/go/genpartsMap.go +++ b/schema/gen/go/genpartsMap.go @@ -16,7 +16,7 @@ func emitNodeAssemblerMethodBeginMap_mapoid(w io.Writer, adjCfg *AdjunctCfg, dat // This allocation only happens if the 'w' ptr is nil, which means we're being used on a Maybe; // otherwise, the 'w' ptr should already be set, and we fill that memory location without allocating, as usual. doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) BeginMap(sizeHint int64) (dms3ld.MapAssembler, error) { + func (na *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) BeginMap(sizeHint int64) (ld.MapAssembler, error) { switch *na.m { case schema.Maybe_Value, schema.Maybe_Null: panic("invalid state: cannot assign into assembler that's already finished") @@ -50,7 +50,7 @@ func emitNodeAssemblerMethodAssignNode_mapoid(w io.Writer, adjCfg *AdjunctCfg, d // This works easily for both type-level and representational nodes because // any divergences that have to do with the child value are nicely hidden behind `AssembleKey` and `AssembleValue`. doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) AssignNode(v dms3ld.Node) error { + func (na *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) AssignNode(v ld.Node) error { if v.IsNull() { return na.AssignNull() } @@ -72,8 +72,8 @@ func emitNodeAssemblerMethodAssignNode_mapoid(w io.Writer, adjCfg *AdjunctCfg, d *na.m = schema.Maybe_Value return nil } - if v.Kind() != dms3ld.Kind_Map { - return dms3ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}{{ if .IsRepr }}.Repr{{end}}", MethodName: "AssignNode", AppropriateKind: dms3ld.KindSet_JustMap, ActualKind: v.Kind()} + if v.Kind() != ld.Kind_Map { + return ld.ErrWrongKind{TypeName: "{{ .PkgName }}.{{ .Type.Name }}{{ if .IsRepr }}.Repr{{end}}", MethodName: "AssignNode", AppropriateKind: ld.KindSet_JustMap, ActualKind: v.Kind()} } itr := v.MapIterator() for !itr.Done() { @@ -200,7 +200,7 @@ func emitNodeAssemblerHelper_mapoid_mapAssemblerMethods(w io.Writer, adjCfg *Adj // except for the fact they need to call the valueFinishTidy function, which is another one of those points that blocks extraction because we strongly don't want virtual functions calls there. // Maybe the templates can be textually dedup'd more, though, at least. doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) AssembleEntry(k string) (dms3ld.NodeAssembler, error) { + func (ma *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) AssembleEntry(k string) (ld.NodeAssembler, error) { switch ma.state { case maState_initial: // carry on @@ -227,7 +227,7 @@ func emitNodeAssemblerHelper_mapoid_mapAssemblerMethods(w io.Writer, adjCfg *Adj } {{- end}} if _, exists := ma.w.m[k2]; exists { - return nil, dms3ld.ErrRepeatedMapKey{Key: &k2} + return nil, ld.ErrRepeatedMapKey{Key: &k2} } ma.w.t = append(ma.w.t, _{{ .Type | TypeSymbol }}__entry{k: k2}) tz := &ma.w.t[len(ma.w.t)-1] @@ -248,7 +248,7 @@ func emitNodeAssemblerHelper_mapoid_mapAssemblerMethods(w io.Writer, adjCfg *Adj } `, w, adjCfg, data) doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) AssembleKey() dms3ld.NodeAssembler { + func (ma *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) AssembleKey() ld.NodeAssembler { switch ma.state { case maState_initial: // carry on @@ -271,7 +271,7 @@ func emitNodeAssemblerHelper_mapoid_mapAssemblerMethods(w io.Writer, adjCfg *Adj } `, w, adjCfg, data) doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) AssembleValue() dms3ld.NodeAssembler { + func (ma *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) AssembleValue() ld.NodeAssembler { switch ma.state { case maState_initial: panic("invalid state: AssembleValue cannot be called when no key is primed") @@ -312,10 +312,10 @@ func emitNodeAssemblerHelper_mapoid_mapAssemblerMethods(w io.Writer, adjCfg *Adj } `, w, adjCfg, data) doTemplate(` - func (ma *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) KeyPrototype() dms3ld.NodePrototype { + func (ma *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) KeyPrototype() ld.NodePrototype { return _{{ .Type.KeyType | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Prototype{} } - func (ma *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) ValuePrototype(_ string) dms3ld.NodePrototype { + func (ma *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) ValuePrototype(_ string) ld.NodePrototype { return _{{ .Type.ValueType | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Prototype{} } `, w, adjCfg, data) diff --git a/schema/gen/go/genpartsMinima.go b/schema/gen/go/genpartsMinima.go index 9e865cdf8d682db1dd8cd75755e338b4d222fdda..fa6f1bf91910e26fee4c2d8e9e27fec37d953de5 100644 --- a/schema/gen/go/genpartsMinima.go +++ b/schema/gen/go/genpartsMinima.go @@ -65,23 +65,23 @@ func EmitInternalEnums(packageName string, w io.Writer) { `)) // We occasionally need this erroring thunk to be able to snake an error out from some assembly processes. - // It implements all of dms3ld.NodeAssembler, but all of its methods return errors when used. + // It implements all of ld.NodeAssembler, but all of its methods return errors when used. fmt.Fprint(w, wish.Dedent(` type _ErrorThunkAssembler struct { e error } - func (ea _ErrorThunkAssembler) BeginMap(_ int64) (dms3ld.MapAssembler, error) { return nil, ea.e } - func (ea _ErrorThunkAssembler) BeginList(_ int64) (dms3ld.ListAssembler, error) { return nil, ea.e } + func (ea _ErrorThunkAssembler) BeginMap(_ int64) (ld.MapAssembler, error) { return nil, ea.e } + func (ea _ErrorThunkAssembler) BeginList(_ int64) (ld.ListAssembler, error) { return nil, ea.e } func (ea _ErrorThunkAssembler) AssignNull() error { return ea.e } func (ea _ErrorThunkAssembler) AssignBool(bool) error { return ea.e } func (ea _ErrorThunkAssembler) AssignInt(int64) error { return ea.e } func (ea _ErrorThunkAssembler) AssignFloat(float64) error { return ea.e } func (ea _ErrorThunkAssembler) AssignString(string) error { return ea.e } func (ea _ErrorThunkAssembler) AssignBytes([]byte) error { return ea.e } - func (ea _ErrorThunkAssembler) AssignLink(dms3ld.Link) error { return ea.e } - func (ea _ErrorThunkAssembler) AssignNode(dms3ld.Node) error { return ea.e } - func (ea _ErrorThunkAssembler) Prototype() dms3ld.NodePrototype { + func (ea _ErrorThunkAssembler) AssignLink(ld.Link) error { return ea.e } + func (ea _ErrorThunkAssembler) AssignNode(ld.Node) error { return ea.e } + func (ea _ErrorThunkAssembler) Prototype() ld.NodePrototype { panic(fmt.Errorf("cannot get prototype from error-carrying assembler: already derailed with error: %w", ea.e)) } `)) diff --git a/schema/gen/go/genpartsStrictoid.go b/schema/gen/go/genpartsStrictoid.go index 8f053878ec5b43b879abe08cced923c2eed2df97..24e8a2859673f91999d3521b59a465f211568bf0 100644 --- a/schema/gen/go/genpartsStrictoid.go +++ b/schema/gen/go/genpartsStrictoid.go @@ -16,7 +16,7 @@ func emitNodeAssemblerMethodBeginMap_strictoid(w io.Writer, adjCfg *AdjunctCfg, // otherwise, the 'w' ptr should already be set, and we fill that memory location without allocating, as usual. // (Note that the Maybe we're talking about here is for us, not our children: so it applies on unions too.) doTemplate(` - func (na *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) BeginMap(int64) (dms3ld.MapAssembler, error) { + func (na *_{{ .Type | TypeSymbol }}__{{ if .IsRepr }}Repr{{end}}Assembler) BeginMap(int64) (ld.MapAssembler, error) { switch *na.m { case schema.Maybe_Value, schema.Maybe_Null: panic("invalid state: cannot assign into assembler that's already finished") diff --git a/schema/gen/go/mixins/boolGenMixin.go b/schema/gen/go/mixins/boolGenMixin.go index 276bad871b5b9de6b1fc55dda0bb13ef7d09ae03..2212e68e1b553d931d346054b2ee68ceed407a9c 100644 --- a/schema/gen/go/mixins/boolGenMixin.go +++ b/schema/gen/go/mixins/boolGenMixin.go @@ -3,7 +3,7 @@ package mixins import ( "io" - dms3ld "gitlab.dms3.io/ld/go-ld-prime" + ld "gitlab.dms3.io/ld/go-ld-prime" ) type BoolTraits struct { @@ -12,57 +12,57 @@ type BoolTraits struct { TypeSymbol string // see doc in kindTraitsGenerator } -func (BoolTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_Bool +func (BoolTraits) Kind() ld.Kind { + return ld.Kind_Bool } func (g BoolTraits) EmitNodeMethodKind(w io.Writer) { doTemplate(` - func ({{ .TypeSymbol }}) Kind() dms3ld.Kind { - return dms3ld.Kind_Bool + func ({{ .TypeSymbol }}) Kind() ld.Kind { + return ld.Kind_Bool } `, w, g) } func (g BoolTraits) EmitNodeMethodLookupByString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodLookupByString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodLookupByString(w) } func (g BoolTraits) EmitNodeMethodLookupByNode(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodLookupByNode(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodLookupByNode(w) } func (g BoolTraits) EmitNodeMethodLookupByIndex(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodLookupByIndex(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodLookupByIndex(w) } func (g BoolTraits) EmitNodeMethodLookupBySegment(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodLookupBySegment(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodLookupBySegment(w) } func (g BoolTraits) EmitNodeMethodMapIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodMapIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodMapIterator(w) } func (g BoolTraits) EmitNodeMethodListIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodListIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodListIterator(w) } func (g BoolTraits) EmitNodeMethodLength(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodLength(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodLength(w) } func (g BoolTraits) EmitNodeMethodIsAbsent(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodIsAbsent(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodIsAbsent(w) } func (g BoolTraits) EmitNodeMethodIsNull(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodIsNull(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodIsNull(w) } func (g BoolTraits) EmitNodeMethodAsInt(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodAsInt(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodAsInt(w) } func (g BoolTraits) EmitNodeMethodAsFloat(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodAsFloat(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodAsFloat(w) } func (g BoolTraits) EmitNodeMethodAsString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodAsString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodAsString(w) } func (g BoolTraits) EmitNodeMethodAsBytes(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodAsBytes(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodAsBytes(w) } func (g BoolTraits) EmitNodeMethodAsLink(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bool}.emitNodeMethodAsLink(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bool}.emitNodeMethodAsLink(w) } type BoolAssemblerTraits struct { @@ -71,33 +71,33 @@ type BoolAssemblerTraits struct { AppliedPrefix string // see doc in kindAssemblerTraitsGenerator } -func (BoolAssemblerTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_Bool +func (BoolAssemblerTraits) Kind() ld.Kind { + return ld.Kind_Bool } func (g BoolAssemblerTraits) EmitNodeAssemblerMethodBeginMap(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bool}.emitNodeAssemblerMethodBeginMap(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bool}.emitNodeAssemblerMethodBeginMap(w) } func (g BoolAssemblerTraits) EmitNodeAssemblerMethodBeginList(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bool}.emitNodeAssemblerMethodBeginList(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bool}.emitNodeAssemblerMethodBeginList(w) } func (g BoolAssemblerTraits) EmitNodeAssemblerMethodAssignNull(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bool}.emitNodeAssemblerMethodAssignNull(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bool}.emitNodeAssemblerMethodAssignNull(w) } func (g BoolAssemblerTraits) EmitNodeAssemblerMethodAssignInt(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bool}.emitNodeAssemblerMethodAssignInt(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bool}.emitNodeAssemblerMethodAssignInt(w) } func (g BoolAssemblerTraits) EmitNodeAssemblerMethodAssignFloat(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bool}.emitNodeAssemblerMethodAssignFloat(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bool}.emitNodeAssemblerMethodAssignFloat(w) } func (g BoolAssemblerTraits) EmitNodeAssemblerMethodAssignString(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bool}.emitNodeAssemblerMethodAssignString(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bool}.emitNodeAssemblerMethodAssignString(w) } func (g BoolAssemblerTraits) EmitNodeAssemblerMethodAssignBytes(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bool}.emitNodeAssemblerMethodAssignBytes(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bool}.emitNodeAssemblerMethodAssignBytes(w) } func (g BoolAssemblerTraits) EmitNodeAssemblerMethodAssignLink(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bool}.emitNodeAssemblerMethodAssignLink(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bool}.emitNodeAssemblerMethodAssignLink(w) } func (g BoolAssemblerTraits) EmitNodeAssemblerMethodPrototype(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bool}.emitNodeAssemblerMethodPrototype(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bool}.emitNodeAssemblerMethodPrototype(w) } diff --git a/schema/gen/go/mixins/bytesGenMixin.go b/schema/gen/go/mixins/bytesGenMixin.go index 403a9f8607ff0be0a28f6c17257728bb161d273d..e2946d17124e707ffc69896f7705a64b77701084 100644 --- a/schema/gen/go/mixins/bytesGenMixin.go +++ b/schema/gen/go/mixins/bytesGenMixin.go @@ -3,7 +3,7 @@ package mixins import ( "io" - dms3ld "gitlab.dms3.io/ld/go-ld-prime" + ld "gitlab.dms3.io/ld/go-ld-prime" ) type BytesTraits struct { @@ -12,57 +12,57 @@ type BytesTraits struct { TypeSymbol string // see doc in kindTraitsGenerator } -func (BytesTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_Bytes +func (BytesTraits) Kind() ld.Kind { + return ld.Kind_Bytes } func (g BytesTraits) EmitNodeMethodKind(w io.Writer) { doTemplate(` - func ({{ .TypeSymbol }}) Kind() dms3ld.Kind { - return dms3ld.Kind_Bytes + func ({{ .TypeSymbol }}) Kind() ld.Kind { + return ld.Kind_Bytes } `, w, g) } func (g BytesTraits) EmitNodeMethodLookupByString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodLookupByString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodLookupByString(w) } func (g BytesTraits) EmitNodeMethodLookupByNode(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodLookupByNode(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodLookupByNode(w) } func (g BytesTraits) EmitNodeMethodLookupByIndex(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodLookupByIndex(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodLookupByIndex(w) } func (g BytesTraits) EmitNodeMethodLookupBySegment(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodLookupBySegment(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodLookupBySegment(w) } func (g BytesTraits) EmitNodeMethodMapIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodMapIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodMapIterator(w) } func (g BytesTraits) EmitNodeMethodListIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodListIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodListIterator(w) } func (g BytesTraits) EmitNodeMethodLength(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodLength(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodLength(w) } func (g BytesTraits) EmitNodeMethodIsAbsent(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodIsAbsent(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodIsAbsent(w) } func (g BytesTraits) EmitNodeMethodIsNull(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodIsNull(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodIsNull(w) } func (g BytesTraits) EmitNodeMethodAsBool(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodAsBool(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodAsBool(w) } func (g BytesTraits) EmitNodeMethodAsInt(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodAsInt(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodAsInt(w) } func (g BytesTraits) EmitNodeMethodAsFloat(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodAsFloat(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodAsFloat(w) } func (g BytesTraits) EmitNodeMethodAsString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodAsString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodAsString(w) } func (g BytesTraits) EmitNodeMethodAsLink(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Bytes}.emitNodeMethodAsLink(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Bytes}.emitNodeMethodAsLink(w) } type BytesAssemblerTraits struct { @@ -71,33 +71,33 @@ type BytesAssemblerTraits struct { AppliedPrefix string // see doc in kindAssemblerTraitsGenerator } -func (BytesAssemblerTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_Bytes +func (BytesAssemblerTraits) Kind() ld.Kind { + return ld.Kind_Bytes } func (g BytesAssemblerTraits) EmitNodeAssemblerMethodBeginMap(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bytes}.emitNodeAssemblerMethodBeginMap(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bytes}.emitNodeAssemblerMethodBeginMap(w) } func (g BytesAssemblerTraits) EmitNodeAssemblerMethodBeginList(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bytes}.emitNodeAssemblerMethodBeginList(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bytes}.emitNodeAssemblerMethodBeginList(w) } func (g BytesAssemblerTraits) EmitNodeAssemblerMethodAssignNull(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bytes}.emitNodeAssemblerMethodAssignNull(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bytes}.emitNodeAssemblerMethodAssignNull(w) } func (g BytesAssemblerTraits) EmitNodeAssemblerMethodAssignBool(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bytes}.emitNodeAssemblerMethodAssignBool(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bytes}.emitNodeAssemblerMethodAssignBool(w) } func (g BytesAssemblerTraits) EmitNodeAssemblerMethodAssignInt(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bytes}.emitNodeAssemblerMethodAssignInt(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bytes}.emitNodeAssemblerMethodAssignInt(w) } func (g BytesAssemblerTraits) EmitNodeAssemblerMethodAssignFloat(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bytes}.emitNodeAssemblerMethodAssignFloat(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bytes}.emitNodeAssemblerMethodAssignFloat(w) } func (g BytesAssemblerTraits) EmitNodeAssemblerMethodAssignString(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bytes}.emitNodeAssemblerMethodAssignString(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bytes}.emitNodeAssemblerMethodAssignString(w) } func (g BytesAssemblerTraits) EmitNodeAssemblerMethodAssignLink(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bytes}.emitNodeAssemblerMethodAssignLink(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bytes}.emitNodeAssemblerMethodAssignLink(w) } func (g BytesAssemblerTraits) EmitNodeAssemblerMethodPrototype(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Bytes}.emitNodeAssemblerMethodPrototype(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Bytes}.emitNodeAssemblerMethodPrototype(w) } diff --git a/schema/gen/go/mixins/floatGenMixin.go b/schema/gen/go/mixins/floatGenMixin.go index ee9f2ba229a7b04e184f291261bdd34fda3b3360..e8e2f179f6518a877845265f164c0537bfc6fdde 100644 --- a/schema/gen/go/mixins/floatGenMixin.go +++ b/schema/gen/go/mixins/floatGenMixin.go @@ -3,7 +3,7 @@ package mixins import ( "io" - dms3ld "gitlab.dms3.io/ld/go-ld-prime" + ld "gitlab.dms3.io/ld/go-ld-prime" ) type FloatTraits struct { @@ -12,57 +12,57 @@ type FloatTraits struct { TypeSymbol string // see doc in kindTraitsGenerator } -func (FloatTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_Float +func (FloatTraits) Kind() ld.Kind { + return ld.Kind_Float } func (g FloatTraits) EmitNodeMethodKind(w io.Writer) { doTemplate(` - func ({{ .TypeSymbol }}) Kind() dms3ld.Kind { - return dms3ld.Kind_Float + func ({{ .TypeSymbol }}) Kind() ld.Kind { + return ld.Kind_Float } `, w, g) } func (g FloatTraits) EmitNodeMethodLookupByString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodLookupByString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodLookupByString(w) } func (g FloatTraits) EmitNodeMethodLookupByNode(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodLookupByNode(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodLookupByNode(w) } func (g FloatTraits) EmitNodeMethodLookupByIndex(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodLookupByIndex(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodLookupByIndex(w) } func (g FloatTraits) EmitNodeMethodLookupBySegment(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodLookupBySegment(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodLookupBySegment(w) } func (g FloatTraits) EmitNodeMethodMapIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodMapIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodMapIterator(w) } func (g FloatTraits) EmitNodeMethodListIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodListIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodListIterator(w) } func (g FloatTraits) EmitNodeMethodLength(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodLength(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodLength(w) } func (g FloatTraits) EmitNodeMethodIsAbsent(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodIsAbsent(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodIsAbsent(w) } func (g FloatTraits) EmitNodeMethodIsNull(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodIsNull(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodIsNull(w) } func (g FloatTraits) EmitNodeMethodAsBool(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodAsBool(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodAsBool(w) } func (g FloatTraits) EmitNodeMethodAsInt(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodAsInt(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodAsInt(w) } func (g FloatTraits) EmitNodeMethodAsString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodAsString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodAsString(w) } func (g FloatTraits) EmitNodeMethodAsBytes(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodAsBytes(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodAsBytes(w) } func (g FloatTraits) EmitNodeMethodAsLink(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Float}.emitNodeMethodAsLink(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Float}.emitNodeMethodAsLink(w) } type FloatAssemblerTraits struct { @@ -71,33 +71,33 @@ type FloatAssemblerTraits struct { AppliedPrefix string // see doc in kindAssemblerTraitsGenerator } -func (FloatAssemblerTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_Float +func (FloatAssemblerTraits) Kind() ld.Kind { + return ld.Kind_Float } func (g FloatAssemblerTraits) EmitNodeAssemblerMethodBeginMap(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Float}.emitNodeAssemblerMethodBeginMap(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodBeginMap(w) } func (g FloatAssemblerTraits) EmitNodeAssemblerMethodBeginList(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Float}.emitNodeAssemblerMethodBeginList(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodBeginList(w) } func (g FloatAssemblerTraits) EmitNodeAssemblerMethodAssignNull(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Float}.emitNodeAssemblerMethodAssignNull(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodAssignNull(w) } func (g FloatAssemblerTraits) EmitNodeAssemblerMethodAssignBool(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Float}.emitNodeAssemblerMethodAssignBool(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodAssignBool(w) } func (g FloatAssemblerTraits) EmitNodeAssemblerMethodAssignInt(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Float}.emitNodeAssemblerMethodAssignInt(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodAssignInt(w) } func (g FloatAssemblerTraits) EmitNodeAssemblerMethodAssignString(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Float}.emitNodeAssemblerMethodAssignString(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodAssignString(w) } func (g FloatAssemblerTraits) EmitNodeAssemblerMethodAssignBytes(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Float}.emitNodeAssemblerMethodAssignBytes(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodAssignBytes(w) } func (g FloatAssemblerTraits) EmitNodeAssemblerMethodAssignLink(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Float}.emitNodeAssemblerMethodAssignLink(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodAssignLink(w) } func (g FloatAssemblerTraits) EmitNodeAssemblerMethodPrototype(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Float}.emitNodeAssemblerMethodPrototype(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Float}.emitNodeAssemblerMethodPrototype(w) } diff --git a/schema/gen/go/mixins/intGenMixin.go b/schema/gen/go/mixins/intGenMixin.go index b6b1670bab9c31a6b2706ce4e160e14ba2d9dba6..6a1e33e42cc7ed33368593a2438f071c88d57c2d 100644 --- a/schema/gen/go/mixins/intGenMixin.go +++ b/schema/gen/go/mixins/intGenMixin.go @@ -3,7 +3,7 @@ package mixins import ( "io" - dms3ld "gitlab.dms3.io/ld/go-ld-prime" + ld "gitlab.dms3.io/ld/go-ld-prime" ) type IntTraits struct { @@ -12,57 +12,57 @@ type IntTraits struct { TypeSymbol string // see doc in kindTraitsGenerator } -func (IntTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_Int +func (IntTraits) Kind() ld.Kind { + return ld.Kind_Int } func (g IntTraits) EmitNodeMethodKind(w io.Writer) { doTemplate(` - func ({{ .TypeSymbol }}) Kind() dms3ld.Kind { - return dms3ld.Kind_Int + func ({{ .TypeSymbol }}) Kind() ld.Kind { + return ld.Kind_Int } `, w, g) } func (g IntTraits) EmitNodeMethodLookupByString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodLookupByString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodLookupByString(w) } func (g IntTraits) EmitNodeMethodLookupByNode(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodLookupByNode(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodLookupByNode(w) } func (g IntTraits) EmitNodeMethodLookupByIndex(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodLookupByIndex(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodLookupByIndex(w) } func (g IntTraits) EmitNodeMethodLookupBySegment(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodLookupBySegment(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodLookupBySegment(w) } func (g IntTraits) EmitNodeMethodMapIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodMapIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodMapIterator(w) } func (g IntTraits) EmitNodeMethodListIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodListIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodListIterator(w) } func (g IntTraits) EmitNodeMethodLength(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodLength(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodLength(w) } func (g IntTraits) EmitNodeMethodIsAbsent(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodIsAbsent(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodIsAbsent(w) } func (g IntTraits) EmitNodeMethodIsNull(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodIsNull(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodIsNull(w) } func (g IntTraits) EmitNodeMethodAsBool(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodAsBool(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodAsBool(w) } func (g IntTraits) EmitNodeMethodAsFloat(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodAsFloat(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodAsFloat(w) } func (g IntTraits) EmitNodeMethodAsString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodAsString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodAsString(w) } func (g IntTraits) EmitNodeMethodAsBytes(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodAsBytes(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodAsBytes(w) } func (g IntTraits) EmitNodeMethodAsLink(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Int}.emitNodeMethodAsLink(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Int}.emitNodeMethodAsLink(w) } type IntAssemblerTraits struct { @@ -71,33 +71,33 @@ type IntAssemblerTraits struct { AppliedPrefix string // see doc in kindAssemblerTraitsGenerator } -func (IntAssemblerTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_Int +func (IntAssemblerTraits) Kind() ld.Kind { + return ld.Kind_Int } func (g IntAssemblerTraits) EmitNodeAssemblerMethodBeginMap(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Int}.emitNodeAssemblerMethodBeginMap(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Int}.emitNodeAssemblerMethodBeginMap(w) } func (g IntAssemblerTraits) EmitNodeAssemblerMethodBeginList(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Int}.emitNodeAssemblerMethodBeginList(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Int}.emitNodeAssemblerMethodBeginList(w) } func (g IntAssemblerTraits) EmitNodeAssemblerMethodAssignNull(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Int}.emitNodeAssemblerMethodAssignNull(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Int}.emitNodeAssemblerMethodAssignNull(w) } func (g IntAssemblerTraits) EmitNodeAssemblerMethodAssignBool(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Int}.emitNodeAssemblerMethodAssignBool(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Int}.emitNodeAssemblerMethodAssignBool(w) } func (g IntAssemblerTraits) EmitNodeAssemblerMethodAssignFloat(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Int}.emitNodeAssemblerMethodAssignFloat(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Int}.emitNodeAssemblerMethodAssignFloat(w) } func (g IntAssemblerTraits) EmitNodeAssemblerMethodAssignString(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Int}.emitNodeAssemblerMethodAssignString(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Int}.emitNodeAssemblerMethodAssignString(w) } func (g IntAssemblerTraits) EmitNodeAssemblerMethodAssignBytes(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Int}.emitNodeAssemblerMethodAssignBytes(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Int}.emitNodeAssemblerMethodAssignBytes(w) } func (g IntAssemblerTraits) EmitNodeAssemblerMethodAssignLink(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Int}.emitNodeAssemblerMethodAssignLink(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Int}.emitNodeAssemblerMethodAssignLink(w) } func (g IntAssemblerTraits) EmitNodeAssemblerMethodPrototype(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Int}.emitNodeAssemblerMethodPrototype(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Int}.emitNodeAssemblerMethodPrototype(w) } diff --git a/schema/gen/go/mixins/kindTraits.go b/schema/gen/go/mixins/kindTraits.go index 9bbbdc59ad200e4d5aa9439364d391e20aa750a4..e75eb7630a181a9e8918848f32e858bf105ad557 100644 --- a/schema/gen/go/mixins/kindTraits.go +++ b/schema/gen/go/mixins/kindTraits.go @@ -3,7 +3,7 @@ package mixins import ( "io" - dms3ld "gitlab.dms3.io/ld/go-ld-prime" + ld "gitlab.dms3.io/ld/go-ld-prime" ) // kindTraitsGenerator is the center of all the other mixins, @@ -28,77 +28,77 @@ type kindTraitsGenerator struct { PkgName string TypeName string // as will be printed in messages (e.g. can be goosed up a bit, like "Thing.Repr" instead of "_Thing__Repr"). TypeSymbol string // the identifier in code (sometimes is munged internals like "_Thing__Repr" corresponding to no publicly admitted schema.Type.Name). - Kind dms3ld.Kind + Kind ld.Kind } func (g kindTraitsGenerator) emitNodeMethodLookupByString(w io.Writer) { - if dms3ld.KindSet_JustMap.Contains(g.Kind) { + if ld.KindSet_JustMap.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` - func ({{ .TypeSymbol }}) LookupByString(string) (dms3ld.Node, error) { + func ({{ .TypeSymbol }}) LookupByString(string) (ld.Node, error) { return mixins.{{ .Kind.String | title }}{TypeName: "{{ .PkgName }}.{{ .TypeName }}"}.LookupByString("") } `, w, g) } func (g kindTraitsGenerator) emitNodeMethodLookupByNode(w io.Writer) { - if dms3ld.KindSet_JustMap.Contains(g.Kind) { + if ld.KindSet_JustMap.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` - func ({{ .TypeSymbol }}) LookupByNode(dms3ld.Node) (dms3ld.Node, error) { + func ({{ .TypeSymbol }}) LookupByNode(ld.Node) (ld.Node, error) { return mixins.{{ .Kind.String | title }}{TypeName: "{{ .PkgName }}.{{ .TypeName }}"}.LookupByNode(nil) } `, w, g) } func (g kindTraitsGenerator) emitNodeMethodLookupByIndex(w io.Writer) { - if dms3ld.KindSet_JustList.Contains(g.Kind) { + if ld.KindSet_JustList.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` - func ({{ .TypeSymbol }}) LookupByIndex(idx int64) (dms3ld.Node, error) { + func ({{ .TypeSymbol }}) LookupByIndex(idx int64) (ld.Node, error) { return mixins.{{ .Kind.String | title }}{TypeName: "{{ .PkgName }}.{{ .TypeName }}"}.LookupByIndex(0) } `, w, g) } func (g kindTraitsGenerator) emitNodeMethodLookupBySegment(w io.Writer) { - if dms3ld.KindSet_Recursive.Contains(g.Kind) { + if ld.KindSet_Recursive.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` - func ({{ .TypeSymbol }}) LookupBySegment(seg dms3ld.PathSegment) (dms3ld.Node, error) { + func ({{ .TypeSymbol }}) LookupBySegment(seg ld.PathSegment) (ld.Node, error) { return mixins.{{ .Kind.String | title }}{TypeName: "{{ .PkgName }}.{{ .TypeName }}"}.LookupBySegment(seg) } `, w, g) } func (g kindTraitsGenerator) emitNodeMethodMapIterator(w io.Writer) { - if dms3ld.KindSet_JustMap.Contains(g.Kind) { + if ld.KindSet_JustMap.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` - func ({{ .TypeSymbol }}) MapIterator() dms3ld.MapIterator { + func ({{ .TypeSymbol }}) MapIterator() ld.MapIterator { return nil } `, w, g) } func (g kindTraitsGenerator) emitNodeMethodListIterator(w io.Writer) { - if dms3ld.KindSet_JustList.Contains(g.Kind) { + if ld.KindSet_JustList.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` - func ({{ .TypeSymbol }}) ListIterator() dms3ld.ListIterator { + func ({{ .TypeSymbol }}) ListIterator() ld.ListIterator { return nil } `, w, g) } func (g kindTraitsGenerator) emitNodeMethodLength(w io.Writer) { - if dms3ld.KindSet_Recursive.Contains(g.Kind) { + if ld.KindSet_Recursive.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` @@ -125,7 +125,7 @@ func (g kindTraitsGenerator) emitNodeMethodIsNull(w io.Writer) { } func (g kindTraitsGenerator) emitNodeMethodAsBool(w io.Writer) { - if dms3ld.KindSet_JustBool.Contains(g.Kind) { + if ld.KindSet_JustBool.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` @@ -136,7 +136,7 @@ func (g kindTraitsGenerator) emitNodeMethodAsBool(w io.Writer) { } func (g kindTraitsGenerator) emitNodeMethodAsInt(w io.Writer) { - if dms3ld.KindSet_JustInt.Contains(g.Kind) { + if ld.KindSet_JustInt.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` @@ -147,7 +147,7 @@ func (g kindTraitsGenerator) emitNodeMethodAsInt(w io.Writer) { } func (g kindTraitsGenerator) emitNodeMethodAsFloat(w io.Writer) { - if dms3ld.KindSet_JustFloat.Contains(g.Kind) { + if ld.KindSet_JustFloat.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` @@ -158,7 +158,7 @@ func (g kindTraitsGenerator) emitNodeMethodAsFloat(w io.Writer) { } func (g kindTraitsGenerator) emitNodeMethodAsString(w io.Writer) { - if dms3ld.KindSet_JustString.Contains(g.Kind) { + if ld.KindSet_JustString.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` @@ -169,7 +169,7 @@ func (g kindTraitsGenerator) emitNodeMethodAsString(w io.Writer) { } func (g kindTraitsGenerator) emitNodeMethodAsBytes(w io.Writer) { - if dms3ld.KindSet_JustBytes.Contains(g.Kind) { + if ld.KindSet_JustBytes.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` @@ -180,11 +180,11 @@ func (g kindTraitsGenerator) emitNodeMethodAsBytes(w io.Writer) { } func (g kindTraitsGenerator) emitNodeMethodAsLink(w io.Writer) { - if dms3ld.KindSet_JustLink.Contains(g.Kind) { + if ld.KindSet_JustLink.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` - func ({{ .TypeSymbol }}) AsLink() (dms3ld.Link, error) { + func ({{ .TypeSymbol }}) AsLink() (ld.Link, error) { return mixins.{{ .Kind.String | title }}{TypeName: "{{ .PkgName }}.{{ .TypeName }}"}.AsLink() } `, w, g) @@ -196,7 +196,7 @@ type kindAssemblerTraitsGenerator struct { PkgName string TypeName string // as will be printed in messages (e.g. can be goosed up a bit, like "Thing.Repr" instead of "_Thing__Repr"). AppliedPrefix string // the prefix of what to attach methods to... this one is a little wild: should probably be either "_{{ .Type | TypeSymbol }}__" or "_{{ .Type | TypeSymbol }}__Repr", and we'll just add the words "Builder" and "Assembler". - Kind dms3ld.Kind + Kind ld.Kind } // bailed on extracting a common emitNodeBuilderType: too many variations in content and pointer placement to be worth it. @@ -208,29 +208,29 @@ type kindAssemblerTraitsGenerator struct { // - to still be ready for boatloads of exceptions if the representation isn't directly castable to and from the type-level node. func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodBeginMap(w io.Writer) { - if dms3ld.KindSet_JustMap.Contains(g.Kind) { + if ld.KindSet_JustMap.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` - func ({{ .AppliedPrefix }}Assembler) BeginMap(sizeHint int64) (dms3ld.MapAssembler, error) { + func ({{ .AppliedPrefix }}Assembler) BeginMap(sizeHint int64) (ld.MapAssembler, error) { return mixins.{{ .Kind.String | title }}Assembler{TypeName: "{{ .PkgName }}.{{ .TypeName }}"}.BeginMap(0) } `, w, g) } func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodBeginList(w io.Writer) { - if dms3ld.KindSet_JustList.Contains(g.Kind) { + if ld.KindSet_JustList.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` - func ({{ .AppliedPrefix }}Assembler) BeginList(sizeHint int64) (dms3ld.ListAssembler, error) { + func ({{ .AppliedPrefix }}Assembler) BeginList(sizeHint int64) (ld.ListAssembler, error) { return mixins.{{ .Kind.String | title }}Assembler{TypeName: "{{ .PkgName }}.{{ .TypeName }}"}.BeginList(0) } `, w, g) } func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignNull(w io.Writer) { - if dms3ld.KindSet_JustNull.Contains(g.Kind) { + if ld.KindSet_JustNull.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` @@ -241,7 +241,7 @@ func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignNull(w io.Wri } func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignBool(w io.Writer) { - if dms3ld.KindSet_JustBool.Contains(g.Kind) { + if ld.KindSet_JustBool.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` @@ -252,7 +252,7 @@ func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignBool(w io.Wri } func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignInt(w io.Writer) { - if dms3ld.KindSet_JustInt.Contains(g.Kind) { + if ld.KindSet_JustInt.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` @@ -263,7 +263,7 @@ func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignInt(w io.Writ } func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignFloat(w io.Writer) { - if dms3ld.KindSet_JustFloat.Contains(g.Kind) { + if ld.KindSet_JustFloat.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` @@ -274,7 +274,7 @@ func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignFloat(w io.Wr } func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignString(w io.Writer) { - if dms3ld.KindSet_JustString.Contains(g.Kind) { + if ld.KindSet_JustString.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` @@ -285,7 +285,7 @@ func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignString(w io.W } func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignBytes(w io.Writer) { - if dms3ld.KindSet_JustBytes.Contains(g.Kind) { + if ld.KindSet_JustBytes.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` @@ -296,11 +296,11 @@ func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignBytes(w io.Wr } func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignLink(w io.Writer) { - if dms3ld.KindSet_JustLink.Contains(g.Kind) { + if ld.KindSet_JustLink.Contains(g.Kind) { panic("gen internals error: you should've overriden this") } doTemplate(` - func ({{ .AppliedPrefix }}Assembler) AssignLink(dms3ld.Link) error { + func ({{ .AppliedPrefix }}Assembler) AssignLink(ld.Link) error { return mixins.{{ .Kind.String | title }}Assembler{TypeName: "{{ .PkgName }}.{{ .TypeName }}"}.AssignLink(nil) } `, w, g) @@ -310,7 +310,7 @@ func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodAssignLink(w io.Wri func (g kindAssemblerTraitsGenerator) emitNodeAssemblerMethodPrototype(w io.Writer) { doTemplate(` - func ({{ .AppliedPrefix }}Assembler) Prototype() dms3ld.NodePrototype { + func ({{ .AppliedPrefix }}Assembler) Prototype() ld.NodePrototype { return {{ .AppliedPrefix }}Prototype{} } `, w, g) diff --git a/schema/gen/go/mixins/linkGenMixin.go b/schema/gen/go/mixins/linkGenMixin.go index 531e60c1637f2cfe0479aa3195889408d76a01da..47d46aeb5925c8cefb9a4958a378c112742ee542 100644 --- a/schema/gen/go/mixins/linkGenMixin.go +++ b/schema/gen/go/mixins/linkGenMixin.go @@ -3,7 +3,7 @@ package mixins import ( "io" - dms3ld "gitlab.dms3.io/ld/go-ld-prime" + ld "gitlab.dms3.io/ld/go-ld-prime" ) type LinkTraits struct { @@ -12,57 +12,57 @@ type LinkTraits struct { TypeSymbol string // see doc in kindTraitsGenerator } -func (LinkTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_Link +func (LinkTraits) Kind() ld.Kind { + return ld.Kind_Link } func (g LinkTraits) EmitNodeMethodKind(w io.Writer) { doTemplate(` - func ({{ .TypeSymbol }}) Kind() dms3ld.Kind { - return dms3ld.Kind_Link + func ({{ .TypeSymbol }}) Kind() ld.Kind { + return ld.Kind_Link } `, w, g) } func (g LinkTraits) EmitNodeMethodLookupByString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodLookupByString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodLookupByString(w) } func (g LinkTraits) EmitNodeMethodLookupByNode(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodLookupByNode(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodLookupByNode(w) } func (g LinkTraits) EmitNodeMethodLookupByIndex(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodLookupByIndex(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodLookupByIndex(w) } func (g LinkTraits) EmitNodeMethodLookupBySegment(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodLookupBySegment(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodLookupBySegment(w) } func (g LinkTraits) EmitNodeMethodMapIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodMapIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodMapIterator(w) } func (g LinkTraits) EmitNodeMethodListIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodListIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodListIterator(w) } func (g LinkTraits) EmitNodeMethodLength(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodLength(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodLength(w) } func (g LinkTraits) EmitNodeMethodIsAbsent(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodIsAbsent(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodIsAbsent(w) } func (g LinkTraits) EmitNodeMethodIsNull(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodIsNull(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodIsNull(w) } func (g LinkTraits) EmitNodeMethodAsBool(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodAsBool(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodAsBool(w) } func (g LinkTraits) EmitNodeMethodAsInt(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodAsInt(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodAsInt(w) } func (g LinkTraits) EmitNodeMethodAsFloat(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodAsFloat(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodAsFloat(w) } func (g LinkTraits) EmitNodeMethodAsString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodAsString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodAsString(w) } func (g LinkTraits) EmitNodeMethodAsBytes(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Link}.emitNodeMethodAsBytes(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Link}.emitNodeMethodAsBytes(w) } type LinkAssemblerTraits struct { @@ -71,33 +71,33 @@ type LinkAssemblerTraits struct { AppliedPrefix string // see doc in kindAssemblerTraitsGenerator } -func (LinkAssemblerTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_Link +func (LinkAssemblerTraits) Kind() ld.Kind { + return ld.Kind_Link } func (g LinkAssemblerTraits) EmitNodeAssemblerMethodBeginMap(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Link}.emitNodeAssemblerMethodBeginMap(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Link}.emitNodeAssemblerMethodBeginMap(w) } func (g LinkAssemblerTraits) EmitNodeAssemblerMethodBeginList(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Link}.emitNodeAssemblerMethodBeginList(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Link}.emitNodeAssemblerMethodBeginList(w) } func (g LinkAssemblerTraits) EmitNodeAssemblerMethodAssignNull(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Link}.emitNodeAssemblerMethodAssignNull(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Link}.emitNodeAssemblerMethodAssignNull(w) } func (g LinkAssemblerTraits) EmitNodeAssemblerMethodAssignBool(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Link}.emitNodeAssemblerMethodAssignBool(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Link}.emitNodeAssemblerMethodAssignBool(w) } func (g LinkAssemblerTraits) EmitNodeAssemblerMethodAssignInt(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Link}.emitNodeAssemblerMethodAssignInt(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Link}.emitNodeAssemblerMethodAssignInt(w) } func (g LinkAssemblerTraits) EmitNodeAssemblerMethodAssignFloat(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Link}.emitNodeAssemblerMethodAssignFloat(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Link}.emitNodeAssemblerMethodAssignFloat(w) } func (g LinkAssemblerTraits) EmitNodeAssemblerMethodAssignString(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Link}.emitNodeAssemblerMethodAssignString(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Link}.emitNodeAssemblerMethodAssignString(w) } func (g LinkAssemblerTraits) EmitNodeAssemblerMethodAssignBytes(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Link}.emitNodeAssemblerMethodAssignBytes(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Link}.emitNodeAssemblerMethodAssignBytes(w) } func (g LinkAssemblerTraits) EmitNodeAssemblerMethodPrototype(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Link}.emitNodeAssemblerMethodPrototype(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Link}.emitNodeAssemblerMethodPrototype(w) } diff --git a/schema/gen/go/mixins/listGenMixin.go b/schema/gen/go/mixins/listGenMixin.go index 416ea4e5c040874f2c1048db8775dd62afb819f4..9e01deeae9dfca4f6ad6846fc021c7be19c752b4 100644 --- a/schema/gen/go/mixins/listGenMixin.go +++ b/schema/gen/go/mixins/listGenMixin.go @@ -3,7 +3,7 @@ package mixins import ( "io" - dms3ld "gitlab.dms3.io/ld/go-ld-prime" + ld "gitlab.dms3.io/ld/go-ld-prime" ) type ListTraits struct { @@ -12,56 +12,56 @@ type ListTraits struct { TypeSymbol string // see doc in kindTraitsGenerator } -func (ListTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_List +func (ListTraits) Kind() ld.Kind { + return ld.Kind_List } func (g ListTraits) EmitNodeMethodKind(w io.Writer) { doTemplate(` - func ({{ .TypeSymbol }}) Kind() dms3ld.Kind { - return dms3ld.Kind_List + func ({{ .TypeSymbol }}) Kind() ld.Kind { + return ld.Kind_List } `, w, g) } func (g ListTraits) EmitNodeMethodLookupByString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_List}.emitNodeMethodLookupByString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_List}.emitNodeMethodLookupByString(w) } func (g ListTraits) EmitNodeMethodLookupBySegment(w io.Writer) { doTemplate(` - func (n {{ .TypeSymbol }}) LookupBySegment(seg dms3ld.PathSegment) (dms3ld.Node, error) { + func (n {{ .TypeSymbol }}) LookupBySegment(seg ld.PathSegment) (ld.Node, error) { i, err := seg.Index() if err != nil { - return nil, dms3ld.ErrInvalidSegmentForList{TypeName: "{{ .PkgName }}.{{ .TypeName }}", TroubleSegment: seg, Reason: err} + return nil, ld.ErrInvalidSegmentForList{TypeName: "{{ .PkgName }}.{{ .TypeName }}", TroubleSegment: seg, Reason: err} } return n.LookupByIndex(i) } `, w, g) } func (g ListTraits) EmitNodeMethodMapIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_List}.emitNodeMethodMapIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_List}.emitNodeMethodMapIterator(w) } func (g ListTraits) EmitNodeMethodIsAbsent(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_List}.emitNodeMethodIsAbsent(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_List}.emitNodeMethodIsAbsent(w) } func (g ListTraits) EmitNodeMethodIsNull(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_List}.emitNodeMethodIsNull(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_List}.emitNodeMethodIsNull(w) } func (g ListTraits) EmitNodeMethodAsBool(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_List}.emitNodeMethodAsBool(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_List}.emitNodeMethodAsBool(w) } func (g ListTraits) EmitNodeMethodAsInt(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_List}.emitNodeMethodAsInt(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_List}.emitNodeMethodAsInt(w) } func (g ListTraits) EmitNodeMethodAsFloat(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_List}.emitNodeMethodAsFloat(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_List}.emitNodeMethodAsFloat(w) } func (g ListTraits) EmitNodeMethodAsString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_List}.emitNodeMethodAsString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_List}.emitNodeMethodAsString(w) } func (g ListTraits) EmitNodeMethodAsBytes(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_List}.emitNodeMethodAsBytes(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_List}.emitNodeMethodAsBytes(w) } func (g ListTraits) EmitNodeMethodAsLink(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_List}.emitNodeMethodAsLink(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_List}.emitNodeMethodAsLink(w) } type ListAssemblerTraits struct { @@ -70,33 +70,33 @@ type ListAssemblerTraits struct { AppliedPrefix string // see doc in kindAssemblerTraitsGenerator } -func (ListAssemblerTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_List +func (ListAssemblerTraits) Kind() ld.Kind { + return ld.Kind_List } func (g ListAssemblerTraits) EmitNodeAssemblerMethodBeginMap(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_List}.emitNodeAssemblerMethodBeginMap(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_List}.emitNodeAssemblerMethodBeginMap(w) } func (g ListAssemblerTraits) EmitNodeAssemblerMethodAssignNull(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_List}.emitNodeAssemblerMethodAssignNull(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_List}.emitNodeAssemblerMethodAssignNull(w) } func (g ListAssemblerTraits) EmitNodeAssemblerMethodAssignBool(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_List}.emitNodeAssemblerMethodAssignBool(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_List}.emitNodeAssemblerMethodAssignBool(w) } func (g ListAssemblerTraits) EmitNodeAssemblerMethodAssignInt(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_List}.emitNodeAssemblerMethodAssignInt(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_List}.emitNodeAssemblerMethodAssignInt(w) } func (g ListAssemblerTraits) EmitNodeAssemblerMethodAssignFloat(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_List}.emitNodeAssemblerMethodAssignFloat(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_List}.emitNodeAssemblerMethodAssignFloat(w) } func (g ListAssemblerTraits) EmitNodeAssemblerMethodAssignString(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_List}.emitNodeAssemblerMethodAssignString(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_List}.emitNodeAssemblerMethodAssignString(w) } func (g ListAssemblerTraits) EmitNodeAssemblerMethodAssignBytes(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_List}.emitNodeAssemblerMethodAssignBytes(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_List}.emitNodeAssemblerMethodAssignBytes(w) } func (g ListAssemblerTraits) EmitNodeAssemblerMethodAssignLink(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_List}.emitNodeAssemblerMethodAssignLink(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_List}.emitNodeAssemblerMethodAssignLink(w) } func (g ListAssemblerTraits) EmitNodeAssemblerMethodPrototype(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_List}.emitNodeAssemblerMethodPrototype(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_List}.emitNodeAssemblerMethodPrototype(w) } diff --git a/schema/gen/go/mixins/mapGenMixin.go b/schema/gen/go/mixins/mapGenMixin.go index 303d21e48805f4505a325491fce7426ca74032a4..e0600de1a89359425349adf46122a668ffcf93c8 100644 --- a/schema/gen/go/mixins/mapGenMixin.go +++ b/schema/gen/go/mixins/mapGenMixin.go @@ -3,7 +3,7 @@ package mixins import ( "io" - dms3ld "gitlab.dms3.io/ld/go-ld-prime" + ld "gitlab.dms3.io/ld/go-ld-prime" ) type MapTraits struct { @@ -12,52 +12,52 @@ type MapTraits struct { TypeSymbol string // see doc in kindTraitsGenerator } -func (MapTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_Map +func (MapTraits) Kind() ld.Kind { + return ld.Kind_Map } func (g MapTraits) EmitNodeMethodKind(w io.Writer) { doTemplate(` - func ({{ .TypeSymbol }}) Kind() dms3ld.Kind { - return dms3ld.Kind_Map + func ({{ .TypeSymbol }}) Kind() ld.Kind { + return ld.Kind_Map } `, w, g) } func (g MapTraits) EmitNodeMethodLookupByIndex(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Map}.emitNodeMethodLookupByIndex(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Map}.emitNodeMethodLookupByIndex(w) } func (g MapTraits) EmitNodeMethodLookupBySegment(w io.Writer) { doTemplate(` - func (n {{ .TypeSymbol }}) LookupBySegment(seg dms3ld.PathSegment) (dms3ld.Node, error) { + func (n {{ .TypeSymbol }}) LookupBySegment(seg ld.PathSegment) (ld.Node, error) { return n.LookupByString(seg.String()) } `, w, g) } func (g MapTraits) EmitNodeMethodListIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Map}.emitNodeMethodListIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Map}.emitNodeMethodListIterator(w) } func (g MapTraits) EmitNodeMethodIsAbsent(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Map}.emitNodeMethodIsAbsent(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Map}.emitNodeMethodIsAbsent(w) } func (g MapTraits) EmitNodeMethodIsNull(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Map}.emitNodeMethodIsNull(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Map}.emitNodeMethodIsNull(w) } func (g MapTraits) EmitNodeMethodAsBool(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Map}.emitNodeMethodAsBool(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Map}.emitNodeMethodAsBool(w) } func (g MapTraits) EmitNodeMethodAsInt(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Map}.emitNodeMethodAsInt(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Map}.emitNodeMethodAsInt(w) } func (g MapTraits) EmitNodeMethodAsFloat(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Map}.emitNodeMethodAsFloat(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Map}.emitNodeMethodAsFloat(w) } func (g MapTraits) EmitNodeMethodAsString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Map}.emitNodeMethodAsString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Map}.emitNodeMethodAsString(w) } func (g MapTraits) EmitNodeMethodAsBytes(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Map}.emitNodeMethodAsBytes(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Map}.emitNodeMethodAsBytes(w) } func (g MapTraits) EmitNodeMethodAsLink(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_Map}.emitNodeMethodAsLink(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_Map}.emitNodeMethodAsLink(w) } type MapAssemblerTraits struct { @@ -66,33 +66,33 @@ type MapAssemblerTraits struct { AppliedPrefix string // see doc in kindAssemblerTraitsGenerator } -func (MapAssemblerTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_Map +func (MapAssemblerTraits) Kind() ld.Kind { + return ld.Kind_Map } func (g MapAssemblerTraits) EmitNodeAssemblerMethodBeginList(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Map}.emitNodeAssemblerMethodBeginList(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Map}.emitNodeAssemblerMethodBeginList(w) } func (g MapAssemblerTraits) EmitNodeAssemblerMethodAssignNull(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Map}.emitNodeAssemblerMethodAssignNull(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Map}.emitNodeAssemblerMethodAssignNull(w) } func (g MapAssemblerTraits) EmitNodeAssemblerMethodAssignBool(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Map}.emitNodeAssemblerMethodAssignBool(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Map}.emitNodeAssemblerMethodAssignBool(w) } func (g MapAssemblerTraits) EmitNodeAssemblerMethodAssignInt(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Map}.emitNodeAssemblerMethodAssignInt(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Map}.emitNodeAssemblerMethodAssignInt(w) } func (g MapAssemblerTraits) EmitNodeAssemblerMethodAssignFloat(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Map}.emitNodeAssemblerMethodAssignFloat(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Map}.emitNodeAssemblerMethodAssignFloat(w) } func (g MapAssemblerTraits) EmitNodeAssemblerMethodAssignString(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Map}.emitNodeAssemblerMethodAssignString(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Map}.emitNodeAssemblerMethodAssignString(w) } func (g MapAssemblerTraits) EmitNodeAssemblerMethodAssignBytes(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Map}.emitNodeAssemblerMethodAssignBytes(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Map}.emitNodeAssemblerMethodAssignBytes(w) } func (g MapAssemblerTraits) EmitNodeAssemblerMethodAssignLink(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Map}.emitNodeAssemblerMethodAssignLink(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Map}.emitNodeAssemblerMethodAssignLink(w) } func (g MapAssemblerTraits) EmitNodeAssemblerMethodPrototype(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_Map}.emitNodeAssemblerMethodPrototype(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_Map}.emitNodeAssemblerMethodPrototype(w) } diff --git a/schema/gen/go/mixins/stringGenMixin.go b/schema/gen/go/mixins/stringGenMixin.go index 94caece7fb648197ad8cbff6d9a521eafbb30a65..cc556def8079609af519ec5061d2211cf274023b 100644 --- a/schema/gen/go/mixins/stringGenMixin.go +++ b/schema/gen/go/mixins/stringGenMixin.go @@ -3,7 +3,7 @@ package mixins import ( "io" - dms3ld "gitlab.dms3.io/ld/go-ld-prime" + ld "gitlab.dms3.io/ld/go-ld-prime" ) type StringTraits struct { @@ -12,57 +12,57 @@ type StringTraits struct { TypeSymbol string // see doc in kindTraitsGenerator } -func (StringTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_String +func (StringTraits) Kind() ld.Kind { + return ld.Kind_String } func (g StringTraits) EmitNodeMethodKind(w io.Writer) { doTemplate(` - func ({{ .TypeSymbol }}) Kind() dms3ld.Kind { - return dms3ld.Kind_String + func ({{ .TypeSymbol }}) Kind() ld.Kind { + return ld.Kind_String } `, w, g) } func (g StringTraits) EmitNodeMethodLookupByString(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodLookupByString(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodLookupByString(w) } func (g StringTraits) EmitNodeMethodLookupByNode(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodLookupByNode(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodLookupByNode(w) } func (g StringTraits) EmitNodeMethodLookupByIndex(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodLookupByIndex(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodLookupByIndex(w) } func (g StringTraits) EmitNodeMethodLookupBySegment(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodLookupBySegment(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodLookupBySegment(w) } func (g StringTraits) EmitNodeMethodMapIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodMapIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodMapIterator(w) } func (g StringTraits) EmitNodeMethodListIterator(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodListIterator(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodListIterator(w) } func (g StringTraits) EmitNodeMethodLength(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodLength(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodLength(w) } func (g StringTraits) EmitNodeMethodIsAbsent(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodIsAbsent(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodIsAbsent(w) } func (g StringTraits) EmitNodeMethodIsNull(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodIsNull(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodIsNull(w) } func (g StringTraits) EmitNodeMethodAsBool(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodAsBool(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodAsBool(w) } func (g StringTraits) EmitNodeMethodAsInt(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodAsInt(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodAsInt(w) } func (g StringTraits) EmitNodeMethodAsFloat(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodAsFloat(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodAsFloat(w) } func (g StringTraits) EmitNodeMethodAsBytes(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodAsBytes(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodAsBytes(w) } func (g StringTraits) EmitNodeMethodAsLink(w io.Writer) { - kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, dms3ld.Kind_String}.emitNodeMethodAsLink(w) + kindTraitsGenerator{g.PkgName, g.TypeName, g.TypeSymbol, ld.Kind_String}.emitNodeMethodAsLink(w) } type StringAssemblerTraits struct { @@ -71,33 +71,33 @@ type StringAssemblerTraits struct { AppliedPrefix string // see doc in kindAssemblerTraitsGenerator } -func (StringAssemblerTraits) Kind() dms3ld.Kind { - return dms3ld.Kind_String +func (StringAssemblerTraits) Kind() ld.Kind { + return ld.Kind_String } func (g StringAssemblerTraits) EmitNodeAssemblerMethodBeginMap(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_String}.emitNodeAssemblerMethodBeginMap(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_String}.emitNodeAssemblerMethodBeginMap(w) } func (g StringAssemblerTraits) EmitNodeAssemblerMethodBeginList(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_String}.emitNodeAssemblerMethodBeginList(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_String}.emitNodeAssemblerMethodBeginList(w) } func (g StringAssemblerTraits) EmitNodeAssemblerMethodAssignNull(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_String}.emitNodeAssemblerMethodAssignNull(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_String}.emitNodeAssemblerMethodAssignNull(w) } func (g StringAssemblerTraits) EmitNodeAssemblerMethodAssignBool(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_String}.emitNodeAssemblerMethodAssignBool(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_String}.emitNodeAssemblerMethodAssignBool(w) } func (g StringAssemblerTraits) EmitNodeAssemblerMethodAssignInt(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_String}.emitNodeAssemblerMethodAssignInt(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_String}.emitNodeAssemblerMethodAssignInt(w) } func (g StringAssemblerTraits) EmitNodeAssemblerMethodAssignFloat(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_String}.emitNodeAssemblerMethodAssignFloat(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_String}.emitNodeAssemblerMethodAssignFloat(w) } func (g StringAssemblerTraits) EmitNodeAssemblerMethodAssignBytes(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_String}.emitNodeAssemblerMethodAssignBytes(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_String}.emitNodeAssemblerMethodAssignBytes(w) } func (g StringAssemblerTraits) EmitNodeAssemblerMethodAssignLink(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_String}.emitNodeAssemblerMethodAssignLink(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_String}.emitNodeAssemblerMethodAssignLink(w) } func (g StringAssemblerTraits) EmitNodeAssemblerMethodPrototype(w io.Writer) { - kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, dms3ld.Kind_String}.emitNodeAssemblerMethodPrototype(w) + kindAssemblerTraitsGenerator{g.PkgName, g.TypeName, g.AppliedPrefix, ld.Kind_String}.emitNodeAssemblerMethodPrototype(w) } diff --git a/schema/gen/go/templateUtil.go b/schema/gen/go/templateUtil.go index 9c47c7639f833dbab01f52b964b2645387f22ad6..79e8eebef1e0082349de71924f3ffd6542adffd9 100644 --- a/schema/gen/go/templateUtil.go +++ b/schema/gen/go/templateUtil.go @@ -7,7 +7,7 @@ import ( wish "github.com/warpfork/go-wish" - dms3ld "gitlab.dms3.io/ld/go-ld-prime" + ld "gitlab.dms3.io/ld/go-ld-prime" ) func doTemplate(tmplstr string, w io.Writer, adjCfg *AdjunctCfg, data interface{}) { @@ -31,74 +31,74 @@ func doTemplate(tmplstr string, w io.Writer, adjCfg *AdjunctCfg, data interface{ // (This may seem silly, but empirically, I found myself writing a dummy line to store the value of dot before endering a range clause >20 times; that's plenty.) "dot": func() interface{} { return data }, - "KindPrim": func(k dms3ld.Kind) string { + "KindPrim": func(k ld.Kind) string { switch k { - case dms3ld.Kind_Map: + case ld.Kind_Map: panic("this isn't useful for non-scalars") - case dms3ld.Kind_List: + case ld.Kind_List: panic("this isn't useful for non-scalars") - case dms3ld.Kind_Null: + case ld.Kind_Null: panic("this isn't useful for null") - case dms3ld.Kind_Bool: + case ld.Kind_Bool: return "bool" - case dms3ld.Kind_Int: + case ld.Kind_Int: return "int64" - case dms3ld.Kind_Float: + case ld.Kind_Float: return "float64" - case dms3ld.Kind_String: + case ld.Kind_String: return "string" - case dms3ld.Kind_Bytes: + case ld.Kind_Bytes: return "[]byte" - case dms3ld.Kind_Link: - return "dms3ld.Link" + case ld.Kind_Link: + return "ld.Link" default: panic("invalid enumeration value!") } }, - "Kind": func(s string) dms3ld.Kind { + "Kind": func(s string) ld.Kind { switch s { case "map": - return dms3ld.Kind_Map + return ld.Kind_Map case "list": - return dms3ld.Kind_List + return ld.Kind_List case "null": - return dms3ld.Kind_Null + return ld.Kind_Null case "bool": - return dms3ld.Kind_Bool + return ld.Kind_Bool case "int": - return dms3ld.Kind_Int + return ld.Kind_Int case "float": - return dms3ld.Kind_Float + return ld.Kind_Float case "string": - return dms3ld.Kind_String + return ld.Kind_String case "bytes": - return dms3ld.Kind_Bytes + return ld.Kind_Bytes case "link": - return dms3ld.Kind_Link + return ld.Kind_Link default: panic("invalid enumeration value!") } }, - "KindSymbol": func(k dms3ld.Kind) string { + "KindSymbol": func(k ld.Kind) string { switch k { - case dms3ld.Kind_Map: - return "dms3ld.Kind_Map" - case dms3ld.Kind_List: - return "dms3ld.Kind_List" - case dms3ld.Kind_Null: - return "dms3ld.Kind_Null" - case dms3ld.Kind_Bool: - return "dms3ld.Kind_Bool" - case dms3ld.Kind_Int: - return "dms3ld.Kind_Int" - case dms3ld.Kind_Float: - return "dms3ld.Kind_Float" - case dms3ld.Kind_String: - return "dms3ld.Kind_String" - case dms3ld.Kind_Bytes: - return "dms3ld.Kind_Bytes" - case dms3ld.Kind_Link: - return "dms3ld.Kind_Link" + case ld.Kind_Map: + return "ld.Kind_Map" + case ld.Kind_List: + return "ld.Kind_List" + case ld.Kind_Null: + return "ld.Kind_Null" + case ld.Kind_Bool: + return "ld.Kind_Bool" + case ld.Kind_Int: + return "ld.Kind_Int" + case ld.Kind_Float: + return "ld.Kind_Float" + case ld.Kind_String: + return "ld.Kind_String" + case ld.Kind_Bytes: + return "ld.Kind_Bytes" + case ld.Kind_Link: + return "ld.Kind_Link" default: panic("invalid enumeration value!") } diff --git a/schema/gen/go/testEngine_disabled_test.go b/schema/gen/go/testEngine_disabled_test.go index 229e6247ac796934897c0ddc7b165eaa9ce3368e..916d3a882496eb2842b5a71aeb4c38e7ced1fa1d 100644 --- a/schema/gen/go/testEngine_disabled_test.go +++ b/schema/gen/go/testEngine_disabled_test.go @@ -46,6 +46,6 @@ func buildGennedCode(t *testing.T, prefix string, pkgName string) { } -func fnPrototypeByName(prefix string) func(string) dms3ld.NodePrototype { +func fnPrototypeByName(prefix string) func(string) ld.NodePrototype { return nil // unused } diff --git a/schema/gen/go/testEngine_nocgo_test.go b/schema/gen/go/testEngine_nocgo_test.go index 84734d188f0067402b81dc1d4e743d1ce2ab78e6..729c1a11488368e42397653d24753d97deed3c66 100644 --- a/schema/gen/go/testEngine_nocgo_test.go +++ b/schema/gen/go/testEngine_nocgo_test.go @@ -60,6 +60,6 @@ func buildGennedCode(t *testing.T, prefix string, pkgName string) { t.Skip("behavioral tests for generated code skipped: cgo is required for these tests") } -func fnPrototypeByName(prefix string) func(string) dms3ld.NodePrototype { +func fnPrototypeByName(prefix string) func(string) ld.NodePrototype { return nil // unused } diff --git a/schema/gen/go/testEngine_plugin_test.go b/schema/gen/go/testEngine_plugin_test.go index fe412786a723ca2e90e5893732ed36d9db894cd2..baaf1996e5291600af596591fa0707f87e090bef 100644 --- a/schema/gen/go/testEngine_plugin_test.go +++ b/schema/gen/go/testEngine_plugin_test.go @@ -35,7 +35,7 @@ func buildGennedCode(t *testing.T, prefix string, _ string) { } } -func fnPrototypeByName(prefix string) func(string) dms3ld.NodePrototype { +func fnPrototypeByName(prefix string) func(string) ld.NodePrototype { plg, err := plugin.Open(objPath(prefix)) if err != nil { panic(err) // Panic because if this was going to flunk, we expected it to flunk earlier when we ran 'go build'. @@ -44,5 +44,5 @@ func fnPrototypeByName(prefix string) func(string) dms3ld.NodePrototype { if err != nil { panic(err) } - return sym.(func(string) dms3ld.NodePrototype) + return sym.(func(string) ld.NodePrototype) } diff --git a/schema/gen/go/testEngine_test.go b/schema/gen/go/testEngine_test.go index 9f687c7b827559caef7bdea4b7ddfa9cce53c73f..571d6885977e8d28a245eeeebccf8d47c18764d6 100644 --- a/schema/gen/go/testEngine_test.go +++ b/schema/gen/go/testEngine_test.go @@ -6,6 +6,7 @@ import ( "path/filepath" "testing" + ld "gitlab.dms3.io/ld/go-ld-prime" "gitlab.dms3.io/ld/go-ld-prime/node/tests" "gitlab.dms3.io/ld/go-ld-prime/schema" ) @@ -18,15 +19,15 @@ type genAndCompileEngine struct { adjCfg AdjunctCfg - prototypeByName func(string) dms3ld.NodePrototype + prototypeByName func(string) ld.NodePrototype } -var tmpGenBuildDir = filepath.Join(os.TempDir(), "go-dms3ld-prime-gengo") +var tmpGenBuildDir = filepath.Join(os.TempDir(), "go-ld-prime-gengo") func (e *genAndCompileEngine) Init(t *testing.T, ts schema.TypeSystem) { // Make directories for the package we're about to generate. // They will live in a temporary directory, usually - // /tmp/go-dms3ld-prime-gengo on Linux. It can be removed at any time. + // /tmp/go-ld-prime-gengo on Linux. It can be removed at any time. // We don't by default because it's nicer to let go's builds of things cache. // If you change the names of types, though, you'll have garbage files leftover, // and that's currently a manual cleanup problem. Sorry. @@ -50,7 +51,7 @@ func (e *genAndCompileEngine) Init(t *testing.T, ts schema.TypeSystem) { import "gitlab.dms3.io/ld/go-ld-prime" - func GetPrototypeByName(name string) dms3ld.NodePrototype { + func GetPrototypeByName(name string) ld.NodePrototype { switch name { {{- range . }} case "{{ .Name }}": @@ -75,6 +76,6 @@ func (e *genAndCompileEngine) Init(t *testing.T, ts schema.TypeSystem) { e.prototypeByName = fnPrototypeByName(e.prefix) } -func (e *genAndCompileEngine) PrototypeByName(name string) dms3ld.NodePrototype { +func (e *genAndCompileEngine) PrototypeByName(name string) ld.NodePrototype { return e.prototypeByName(name) } diff --git a/schema/kind.go b/schema/kind.go index b2210a6184d0611fff24e8a7b6375c5d3f98cee2..62b3d10b91d0e71832e8f69a16e0fc5d853d418e 100644 --- a/schema/kind.go +++ b/schema/kind.go @@ -4,7 +4,7 @@ import ( ld "gitlab.dms3.io/ld/go-ld-prime" ) -// TypeKind is an enum of kind in the DMS3LD Schema system. +// TypeKind is an enum of kind in the LD Schema system. // // Note that schema.TypeKind is distinct from ld.Kind! // Schema kinds include concepts such as "struct" and "enum", which are diff --git a/schema/schema2/kind.go b/schema/schema2/kind.go index b2210a6184d0611fff24e8a7b6375c5d3f98cee2..62b3d10b91d0e71832e8f69a16e0fc5d853d418e 100644 --- a/schema/schema2/kind.go +++ b/schema/schema2/kind.go @@ -4,7 +4,7 @@ import ( ld "gitlab.dms3.io/ld/go-ld-prime" ) -// TypeKind is an enum of kind in the DMS3LD Schema system. +// TypeKind is an enum of kind in the LD Schema system. // // Note that schema.TypeKind is distinct from ld.Kind! // Schema kinds include concepts such as "struct" and "enum", which are diff --git a/schema/schema2/type.go b/schema/schema2/type.go index c72164aed1617dc0c22408e8b0475352e8f7c438..b6f8f0436f4aeae484190454de6fc941ba972c8a 100644 --- a/schema/schema2/type.go +++ b/schema/schema2/type.go @@ -70,7 +70,7 @@ type Type interface { TypeKind() TypeKind // RepresentationBehavior returns a description of how the representation - // of this type will behave in terms of the DMS3LD Data Model. + // of this type will behave in terms of the LD Data Model. // This property varies based on the representation strategy of a type. // // In one case, the representation behavior cannot be known statically, diff --git a/schema/schema2/type_map.go b/schema/schema2/type_map.go index 547d87b95001de70943b793fac5819232cea034d..51496762270d828c43956fd647b84d98fa0f8e93 100644 --- a/schema/schema2/type_map.go +++ b/schema/schema2/type_map.go @@ -38,7 +38,7 @@ func (t TypeMap) RepresentationBehavior() ld.Kind { // KeyType returns the Type of the map keys. // // Note that map keys will must always be some type which is representable as a -// string in the DMS3LD Data Model (e.g. either TypeString or TypeEnum). +// string in the LD Data Model (e.g. either TypeString or TypeEnum). func (t *TypeMap) KeyType() Type { return t.ts.types[t.dmt.FieldKeyType().TypeReference()] } diff --git a/schema/type.go b/schema/type.go index 0e9bbd2ed5b19f63966337ae6dc1d04dba77e453..a6b151d6712200c94dd0e7814bce03743d9e2e80 100644 --- a/schema/type.go +++ b/schema/type.go @@ -75,7 +75,7 @@ type Type interface { TypeKind() TypeKind // RepresentationBehavior returns a description of how the representation - // of this type will behave in terms of the DMS3LD Data Model. + // of this type will behave in terms of the LD Data Model. // This property varies based on the representation strategy of a type. // // In one case, the representation behavior cannot be known statically, diff --git a/schema/typeMethods.go b/schema/typeMethods.go index 621fd1188965d624f9575aef24439f44842cfb18..91a394d7207f44cda68ef14b78e6c33b33fbe016 100644 --- a/schema/typeMethods.go +++ b/schema/typeMethods.go @@ -92,7 +92,7 @@ func (t TypeMap) IsAnonymous() bool { // KeyType returns the Type of the map keys. // // Note that map keys will must always be some type which is representable as a -// string in the DMS3LD Data Model (e.g. either TypeString or TypeEnum). +// string in the LD Data Model (e.g. either TypeString or TypeEnum). func (t TypeMap) KeyType() Type { return t.universe.namedTypes[t.keyType] } diff --git a/traversal/focus_test.go b/traversal/focus_test.go index fafa89a430a36fc9499a807c2cf52a618bec89c7..502c8d5665a246ec27adfdc2ce0e98599ff9a4a7 100644 --- a/traversal/focus_test.go +++ b/traversal/focus_test.go @@ -6,7 +6,7 @@ import ( . "github.com/warpfork/go-wish" - "gitlab.dms3.io/dms3/public/go-cid" + "gitlab.dms3.io/dms3/go-cid" "gitlab.dms3.io/ld/go-ld-prime" _ "gitlab.dms3.io/ld/go-ld-prime/codec/dagjson" "gitlab.dms3.io/ld/go-ld-prime/fluent" diff --git a/traversal/selector/selector.go b/traversal/selector/selector.go index e4d55e2d39c3467d096a20541a44844325e0a44a..40a7c065ab5726862171394e14a15e9da397e95a 100644 --- a/traversal/selector/selector.go +++ b/traversal/selector/selector.go @@ -6,8 +6,8 @@ import ( ld "gitlab.dms3.io/ld/go-ld-prime" ) -// Selector is the programmatic representation of an DMS3LD Selector Node -// and can be applied to traverse a given DMS3LD DAG +// Selector is the programmatic representation of an LD Selector Node +// and can be applied to traverse a given LD DAG type Selector interface { Interests() []ld.PathSegment // returns the segments we're likely interested in **or nil** if we're a high-cardinality or expression based matcher and need all segments proposed to us. Explore(ld.Node, ld.PathSegment) Selector // explore one step -- iteration comes from outside (either whole node, or by following suggestions of Interests). returns nil if no interest. you have to traverse to the next node yourself (the selector doesn't do it for you because you might be considering multiple selection reasons at the same time). @@ -25,12 +25,12 @@ type ParseContext struct { parentStack []ParsedParent } -// ParseSelector creates a Selector that can be traversed from an DMS3LD Selector node +// ParseSelector creates a Selector that can be traversed from an LD Selector node func ParseSelector(n ld.Node) (Selector, error) { return ParseContext{}.ParseSelector(n) } -// ParseSelector creates a Selector from an DMS3LD Selector Node with the given context +// ParseSelector creates a Selector from an LD Selector Node with the given context func (pc ParseContext) ParseSelector(n ld.Node) (Selector, error) { if n.Kind() != ld.Kind_Map { return nil, fmt.Errorf("selector spec parse rejected: selector is a keyed union and thus must be a map")