Export to GitHub

protobuf-dt - issue #93

Options with a Message type result in a syntax error


Posted on Aug 4, 2011 by Grumpy Rhino

What steps will reproduce the problem? 1. Create a proto file with the following:

import "descriptor.proto";

extend google.protobuf.FieldOptions { optional StructuredOption so = 50000; }

message StructuredOption { optional int32 foo = 1; optional int32 bar = 2; }

message Optioned { optional int32 foobar = 1[(so)= { foo: 1, bar: 2 } ]; }

  1. Observe that the option "so" results in a syntax error.

What is the expected output? What do you see instead?

The message type option should not result in a syntax error.

What version of the product are you using? On what operating system?

1.0.0.201108021004 Eclipse 3.7 PDE Windows 7 x64

Please provide any additional information below.

While custom options are not yet fully supported, Message type options should not be reported as a syntax error.

Comment #1

Posted on Aug 4, 2011 by Grumpy Rhino

Here is what I believe to be a complete syntax for a String Formatted Protocol Buffer option. Notably this include no content validation, just structural.

I have not yet tested this addition / mod to the grammar:

ValueRef: ProtobufStringSerializedFormRef | LiteralRef | BooleanRef | NumberRef | StringRef | Nan;

ProtobufStringSerializedFormRef: protobufstring=ProtobufStringSerializedForm:

ProtobufStringSerializedForm: '{' ( message+=MessageFieldSerializedForm | enumeration+=EnumFieldSerializedForm | direct+=DirectFieldSerializedForm )+ '}';

DirectFieldSerializedForm: ( (QualifiedName | '[' QualifiedName ']' ) ':' ValueRef);

EnumFieldSerializedForm: ( (QualifiedName | '[' QualifiedName ']' ) ':' ID);

MessageFieldSerializedForm: ( (QualifiedName | '[' QualifiedName ']' ) ':' ProtobufStringSerializedForm);

Comment #2

Posted on Aug 4, 2011 by Grumpy Cat

(No comment was entered for this change.)

Comment #3

Posted on Aug 16, 2011 by Grumpy Rhino

This is the last defect keeping my team from switching over to the plugin from ours. Has anyway else had a chance to think on it?

I had trouble getting the grammar statements above to mesh with the existing grammar

Comment #4

Posted on Aug 16, 2011 by Grumpy Cat

I haven't had the chance to work on this issue yet. I'll try my best to work on this next week. Hopefully by the end of the week we'll have a fix :)

Once again, thanks for reporting this issue, and for offering a solution!

Comment #5

Posted on Aug 19, 2011 by Grumpy Cat

r7e20ea18d7b6

The fix only includes syntax for options of type Message, based on the given example. Semantic checks will be added once custom options are supported.

Status: Fixed

Labels:
Type-Defect Priority-Medium Milestone-Release-1.0.1