Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not work with gtfs-realtime.proto #24

Closed
mbflex opened this issue May 18, 2013 · 3 comments
Closed

does not work with gtfs-realtime.proto #24

mbflex opened this issue May 18, 2013 · 3 comments

Comments

@mbflex
Copy link

mbflex commented May 18, 2013

Google defined the so-called GTFS-realtime interface in 2011.
https://developers.google.com/transit/gtfs-realtime/

The interface is implemented using protocol buffers. The proto file can be found here:
https://developers.google.com/transit/gtfs-realtime/gtfs-realtime-proto

I try to use ProtoBuf.js to work with this proto file:

var ProtoBuf = require("protobufjs");
var builder = ProtoBuf.protoFromFile("gtfs-realtime.proto");

This causes an error:
...ProtoBuf.js:572
throw(new Error("Illegal top level declaration: "+toke
^
Error: Illegal top level declaration: syntax
at ProtoBuf.DotProto.Parser.Parser.parse (..ProtoBuf.js:572:31)
at Object.ProtoBuf.protoFromString (..ProtoBuf.js:2592:33)
at Object.ProtoBuf.protoFromFile (..ProtoBuf.js:2634:53)
at Object. (..test.js:6:24)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)

@dcodeIO
Copy link
Member

dcodeIO commented May 18, 2013

There seem to be two statements that are not understood by ProtoBuf.js yet: syntax = "proto2"; and extensions 1000 to 1999;. You can try to remove or comment-out those until I get some time to fix the parser to just ignore it.

@ghost ghost assigned dcodeIO May 18, 2013
@mbflex
Copy link
Author

mbflex commented May 18, 2013

You can try to remove or comment-out

Thanks, seems to work so far.
Thanks for the nice library. I just started to work with your stuff. Except for the reported issue, your library works fine for me.

@dcodeIO
Copy link
Member

dcodeIO commented May 28, 2013

I've added the required ignores and a test case to validate that it'll compile without modifications.

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

No branches or pull requests

2 participants