mycoolmc / protobuf-dt

Automatically exported from code.google.com/p/protobuf-dt
0 stars 0 forks source link

Options with a Message type result in a syntax error #93

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 } ];
}

2. 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.

Original issue reported on code.google.com by compuwar...@gmail.com on 4 Aug 2011 at 3:25

GoogleCodeExporter commented 9 years ago
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);

Original comment by compuwar...@gmail.com on 4 Aug 2011 at 3:36

GoogleCodeExporter commented 9 years ago

Original comment by alr...@google.com on 4 Aug 2011 at 6:32

GoogleCodeExporter commented 9 years ago
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

Original comment by compuwar...@gmail.com on 16 Aug 2011 at 2:02

GoogleCodeExporter commented 9 years ago
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! 

Original comment by alr...@google.com on 16 Aug 2011 at 3:29

GoogleCodeExporter commented 9 years ago
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.

Original comment by alr...@google.com on 19 Aug 2011 at 9:26