Can be D keywords escaped by additional prefix/suffix?
denizzzka opened this issue · comments
Try to compile very common OSM .proto file same as described here: #75 (comment)
/usr/include/dmd/phobos/std/exception.d(558,25): Error: uncaught CTFE exception object.Throwable("Reserved word: version")
/usr/include/dmd/phobos/std/exception.d(558,17): thrown from here
../../.dub/packages/dproto-master/import/dproto/dproto.d(27,24): called from here: ParseProtoSchema("osmformat.proto", "/** Copyright (c) 2010 Scott A. Crosby. <scott@sacrosby.com>\x0a\x0a This program is free software: you can
(Probably, associated with #75)
Can be "version" and other keywords escaped by additional prefix/suffix or something like?
So, an issue is that a pathological proto file would cause some issues like in #50 :
message Foo {
required string version_ = 1;
required string version = 2;
}
The consensus in #d was to have it error, though it's a good point that it would cause existing proto files to break. I'm really tempted to ignore the potential conflict, because honestly if someone's writing a file that convoluted they're kind of bringing it on themselves...
Suffix can be adjustable.
Usage:
mixin(ParseProtoSchema("<none>", `option dproto_reserved_fmt = "%s_"; ` ~ import("osmformat.proto")).toD());