ctaggart / froto

Froto: F# Protocol Buffers
MIT License
146 stars 27 forks source link

Enum in message body error #93

Closed kevmal closed 5 years ago

kevmal commented 5 years ago

This sample from the proto3 user guide,

syntax = "proto3";

message SearchRequest {
  string query = 1;
  int32 page_number = 2;
  int32 result_per_page = 3;
  enum Corpus {
    UNIVERSAL = 0;
    WEB = 1;
    IMAGES = 2;
    LOCAL = 3;
    NEWS = 4;
    PRODUCTS = 5;
    VIDEO = 6;
  }
  Corpus corpus = 4;
}

Fails with error


System.FormatException: Error in Ln: 7 Col: 15
  enum Corpus {
              ^
Expecting: newline, tab, ' ', '/*', '//' or '='

   at Froto.Parser.Parse.resultOrFail[a,b](ParserResult`2 parserResult)
   at Froto.Parser.Parse.fromFileWithParser[a](FSharpFunc`2 parser, String fileName)
   at Froto.Parser.Parse.fromFile(String fileName)
   at <StartupCode$FSI_0006>.$FSI_0006.main@()
Stopped due to error```
7sharp9 commented 5 years ago

I should be able to look into this.

jhugard commented 5 years ago

Take a look at Parser.fs:485… probably just need to move the pField parser in to the end of the list. I’ll also try to look into this shortly…

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10


From: Dave Thomas notifications@github.com Sent: Friday, October 5, 2018 2:15:36 AM To: ctaggart/froto Cc: Subscribed Subject: Re: [ctaggart/froto] Enum in message body error (#93)

I should be able to look into this.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/ctaggart/froto/issues/93#issuecomment-427298984, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAPT0qgcLCuf7_hDk9AcPY4ZsS2Ms6-Aks5uhyM4gaJpZM4XIjM2.

jhugard commented 5 years ago

The previous fix was a band-aid that would break in other ways. @kevmal, can you please try PR #107?

ctaggart commented 5 years ago

I'll be pushing 0.7.x to NuGet soon. Please reopen if this is still an issue.