Closed WebDrake closed 8 years ago
Whoops. I had something extremely similar to this, on a local branch... but I like your error messages and tests better.
One question about the error messages -- when I tried to verify they were working correctly, I got some rather weird compiler output. For example if I tried
mixin ProtocolBufferFromString!syntaxNoEquals;
(... i.e. the first of the incorrect cases in the unittests), I got as compiler output:
/usr/include/d/std/exception.d(535): Error: uncaught CTFE exception object.Throwable("")
import/dproto/dproto.d(38): called from here: ParseProtoSchema("<none>", "\x0a syntax \"proto2\";\x0a ")
import/dproto/dproto.d(38): Error: argument to mixin must be a string, not (ParseProtoSchema("<none>", "\x0a syntax \"proto2\";\x0a ").toD()) of type string
import/dproto/unittests.d(916): Error: mixin dproto.unittests.__unittestL889_44.ProtocolBufferFromString!"\x0a syntax \"proto2\";\x0a " error instantiating
ldc2 failed with exit code 1.
... which was not the nice error message I'd tried to write. Note, I'm using ldc 0.17.1 to build, on Ubuntu 16.04.
I meant to raise this after pushing the patch, but you were quicker than I expected with the merge button :-)
Hah, sorry. Itchy trigger finger I guess.
I have a local commit that adds an error message in that particular spot, so it should fix the issue.
This enables support for the syntax statement described in the proto2 and proto3 spec: https://developers.google.com/protocol-buffers/docs/reference/proto2-spec#syntax https://developers.google.com/protocol-buffers/docs/reference/proto3-spec#syntax
ProtoPackage
has been extended with a newsyntax
field to store the new information now read byParseProtoSchema
.No effort has been made to do anything other than read the statement; future uses of the syntax information have been left for future work.
Fixes msoucy/dproto#92.