Commit Graph

21 Commits

Author SHA1 Message Date
Erik Arvidsson
bcdba6f79e Revert "Direct recursive struct" 2015-09-22 17:01:05 -04:00
Erik Arvidsson
a4a29fca7b NomDL codegen: Disallow Defs when we get a recursive go struct
go does not allow recursive struct types

Issue #320
2015-09-22 16:53:58 -04:00
Erik Arvidsson
9e7fa76506 NomDL Codegen: Partial support for recursive types
When computing if a Map/Set key contains another Map/Set/List we need
to ensure that we are not hitting a recursive type or we hit an i-loop.

Partial fix for #320
2015-09-22 09:17:14 -04:00
Erik Arvidsson
2769353a55 NomDL Codegen: Do not create a Def if non comparable
Due to limitations in Go we cannot create a Def for a Map or Set that
has a key that is a Map, Set or a List. This is because the key if a Go
map needs to be a comparable and maps and slices are not comparable.
2015-09-21 19:04:53 -04:00
Erik Arvidsson
8358bfe33a NomDL Codegen: Title case field names for go
Fixes #311
2015-09-21 13:29:16 -04:00
Erik Arvidsson
6e369b85cd NomDL: Change command line to process all .noms files
The codegen.go command line utility now detects the package name from
the file that it was invoked from if `--package` was not provided.

It also processes all `.noms` files in the current directory in case
the `--in` flag was not provided.
2015-09-21 12:19:14 -04:00
Erik Arvidsson
91ac2ef236 NomDL: Ref support
A Ref has a SetValue(v, cs) and a GetValue(cs)

Fixes #306
2015-09-18 17:02:41 -04:00
Erik Arvidsson
b52ba691e6 NomDL CodeGen: Struct should use Map for now
This is so that we can transition awapy from nongen

Fixes #312
2015-09-17 18:44:49 -04:00
Erik Arvidsson
bbe396fb94 Merge pull request #308 from arv/set-extras
NomDL: Codegen for Set extras
2015-09-17 17:25:59 -04:00
Erik Arvidsson
f64f6ae81c NomDL: CodeGen for Map extras
This adds Iter, IterAll and Filter to Maps

Issue #303
2015-09-17 17:20:49 -04:00
Erik Arvidsson
175cc7ccc1 NomDL: Codegen for Set extras
This adds Iter, IterAll and Filter to Sets

Issue #303
2015-09-17 16:49:22 -04:00
Erik Arvidsson
24f1f58042 Build fix - run godep again 2015-09-17 14:30:09 -04:00
Erik Arvidsson
5a83b23f29 NomDL: Codegen for List extras
Adds Iter, IterAll and Filter to the List(T) types

Depends on PR #298

Issue #303
2015-09-17 14:24:36 -04:00
Erik Arvidsson
e10e6224b0 Codegen for NomDL
This adds a new codegen that reads .noms files and generates Go
API for these types

Issue #304
2015-09-17 14:01:49 -04:00
Chris Masone
8660c518db Add comments to NomDL
Both // and /* */ comments are supported, per your C/C++ expectations.

Closes issue #293
2015-09-15 16:42:04 -07:00
Chris Masone
e74897c418 Fix error message in grammar.peg 2015-09-15 09:16:08 -07:00
Chris Masone
b2f02c0405 Get rid of UnionKind
As arv pointed out, the parser should no longer generate TypeRefs
of UnionKind, so I made it stop doing that. Getting rid of UnionKind
has the side effect of making UnionDesc no longer capable of satisfying
TypeDesc, so one can no longer create a TypeRef that holds a UnionDesc.
That's correct for production, but I'd been using Field structs (which
contain a TypeRef) to define my test cases. Since I still need to test
that the parser correctly handles named union fields in structs, and
Field structs are no longer capable of expressing that, I needed to
create a new testField struct and some attendant types to allow me
to write all my test cases.
2015-09-15 09:12:46 -07:00
Chris Masone
d0340a1160 Make named union fields in structs syntactic sugar
Arv pointed out that there's really no difference between a named
union struct field and a struct field whose type is a struct that
contains only an anonymous union. This patch makes the parser replace
the TypeRef of UnionKind in each named union field with a TypeRef of
StructKind that contains only an anon union.

Fixes Issue #286
2015-09-14 16:31:35 -07:00
Chris Masone
24cfa4423c Go back to using []Field in struct definitions 2015-09-14 16:02:05 -07:00
Chris Masone
64b39a2715 Check for duplicate names in struct, union definitions
These should be disallowed, so disallow them. This also makes
us use a map for fields and choices, which is probably the right
way to store that information in Noms anyway. This patch means
we'll be on better footing for converting datastructures to Noms.

Towards issue #281
2015-09-14 10:58:44 -07:00
Chris Masone
d1fc897b28 Moved parser code to nomdl/parse 2015-09-11 17:08:33 -07:00