Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Request: Strict/complete proto2 compliance #8

Closed
jhugard opened this issue Jan 16, 2016 · 1 comment · Fixed by #13
Closed

Request: Strict/complete proto2 compliance #8

jhugard opened this issue Jan 16, 2016 · 1 comment · Fixed by #13
Milestone

Comments

@jhugard
Copy link
Collaborator

jhugard commented Jan 16, 2016

Froto appears to only parse a subset of the proto2 language, and allows a looser syntax. Requesting the parser be tightened up to match the official protoc compiler: handle the complete syntax and produce errors in the same cases, in order to provide better compatibility.

  • Support enum as a top-level construct (outside any message)
  • Support "group" keyword in a message
  • Support "one of" keyword in a message
  • Support "map" keyword in a message
  • Support "extensions" keyword in a message
  • Support "reserved" keyword in a message
  • Support options on enum, enumItem
  • Support alternate option syntax; e.g. option (myOpt) = { fieldA : 1, fieldB: "test" };
  • Tighten up intLit to support proto2 octal (code uses pint32, which parses "0o77", but not "077")
  • Same thing for strLit; can't recall the specifics, but don't think Froto handles all proto2 escape sequences
  • Parse out strong literal types for constants (intLit, floatLit, boolLit, and strLit), rather than parsing all of those as string values.
  • Tighten up identifier parser; can't recall the specifics, but IIRC Froto allows invalid identifiers

I've been hacking my own F#/FParsec parser and am almost done: have support for all the above w/tests, and only a few productions remaining (iirc, "service" and "extends"). Using this as a learning experience. Once I've implemented proto3 syntax (using an FParsec state and rejection of invalid items when in proto3 mode), I should probably circle back and fork Froto to help implement the above, if you're open to contributions :-).

@jhugard jhugard changed the title [Req] Strict/complete proto2 compliance Request: Strict/complete proto2 compliance Jan 16, 2016
@ctaggart
Copy link
Owner

I'm totally open to contributions! In fact, I was just cleaning stuff up to tackle this. I'm glad you beat me to it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants