Skip to content
This repository was archived by the owner on May 27, 2022. It is now read-only.
This repository was archived by the owner on May 27, 2022. It is now read-only.

Unable to compile protos with nested messages of the same name #24

@schmichael

Description

@schmichael

Google's protoc can compile the following just fine as the duplicate message Xs are in different enclosing messages:

message A {
    optional B b = 1;
    optional C c = 2;

    message B {
        optional X x = 1;
        message X {
            optional bool wat = 1;
        }
    }
    message C {
        optional X x = 1;
        message X {
            optional bool wat = 1;
        }
    }
}

palm 0.1.2 produces the following:

p.proto...                                                            [FAIL]
Traceback (most recent call last):
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/main.py", line 24, in run
    r = parser.parse(source)
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/baseparser.py", line 32, in parse
    return processor( value, data )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 32, in __call__
    result = dispatchList( self, tags, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 59, in dispatchList
    return map( dispatch, [source]*len(taglist), taglist, [buffer]*len(taglist))
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 54, in dispatch
    return function( tag, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/parse.py", line 63, in message
    dispatchList(self, subtags, buffer)
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 59, in dispatchList
    return map( dispatch, [source]*len(taglist), taglist, [buffer]*len(taglist))
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 54, in dispatch
    return function( tag, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/parse.py", line 88, in message_body
    return dispatchList(self, subtags, buffer)
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 59, in dispatchList
    return map( dispatch, [source]*len(taglist), taglist, [buffer]*len(taglist))
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 54, in dispatch
    return function( tag, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/parse.py", line 63, in message
    dispatchList(self, subtags, buffer)
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 59, in dispatchList
    return map( dispatch, [source]*len(taglist), taglist, [buffer]*len(taglist))
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 54, in dispatch
    return function( tag, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/parse.py", line 88, in message_body
    return dispatchList(self, subtags, buffer)
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 59, in dispatchList
    return map( dispatch, [source]*len(taglist), taglist, [buffer]*len(taglist))
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 54, in dispatch
    return function( tag, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/parse.py", line 63, in message
    dispatchList(self, subtags, buffer)
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 59, in dispatchList
    return map( dispatch, [source]*len(taglist), taglist, [buffer]*len(taglist))
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 54, in dispatch
    return function( tag, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/parse.py", line 83, in message_label
    raise ProtoParseError(start, stop, buffer, "message %s already defined" % self.current_message)
ProtoParseError: [line 1] message 2-X already defined

palm 0.1.5 produces the following:

p.proto...                                                            [FAIL]
Traceback (most recent call last):
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/main.py", line 36, in run
    r = parser.parse(source)
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/baseparser.py", line 32, in parse
    return processor( value, data )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 32, in __call__
    result = dispatchList( self, tags, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 59, in dispatchList
    return map( dispatch, [source]*len(taglist), taglist, [buffer]*len(taglist))
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 54, in dispatch
    return function( tag, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/parse.py", line 81, in message
    dispatchList(self, subtags, buffer)
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 59, in dispatchList
    return map( dispatch, [source]*len(taglist), taglist, [buffer]*len(taglist))
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 54, in dispatch
    return function( tag, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/parse.py", line 106, in message_body
    return dispatchList(self, subtags, buffer)
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 59, in dispatchList
    return map( dispatch, [source]*len(taglist), taglist, [buffer]*len(taglist))
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 54, in dispatch
    return function( tag, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/parse.py", line 81, in message
    dispatchList(self, subtags, buffer)
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 59, in dispatchList
    return map( dispatch, [source]*len(taglist), taglist, [buffer]*len(taglist))
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 54, in dispatch
    return function( tag, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/parse.py", line 106, in message_body
    return dispatchList(self, subtags, buffer)
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 59, in dispatchList
    return map( dispatch, [source]*len(taglist), taglist, [buffer]*len(taglist))
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 54, in dispatch
    return function( tag, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/parse.py", line 81, in message
    dispatchList(self, subtags, buffer)
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 59, in dispatchList
    return map( dispatch, [source]*len(taglist), taglist, [buffer]*len(taglist))
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/simpleparse/dispatchprocessor.py", line 54, in dispatch
    return function( tag, buffer )
  File "/home/schmichael/src/ua/pyreactor-client/lib/python2.6/site-packages/palm/palmc/parse.py", line 101, in message_label
    raise ProtoParseError(start, stop, buffer, "message %s already defined" % self.current_message)
ProtoParseError: [line 1] message 2-X already defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions