yoheimuta / go-protoparser

Yet another Go package which parses a Protocol Buffer file (proto2+proto3)
MIT License
181 stars 21 forks source link

error parsring if file ends with comment _and_ no newline #49

Closed kung-foo closed 4 years ago

kung-foo commented 4 years ago
2019/12/11 13:34:59 Lexer encountered the error "found "\x00" but expected [
] at /go/pkg/mod/github.com/yoheimuta/go-protoparser/v4@v4.0.0/internal/lexer/scanner/comment.go:12"

Looks like https://github.com/yoheimuta/go-protoparser/blob/master/internal/lexer/scanner/comment.go#L9-L17 is a bit too strict

yoheimuta commented 4 years ago

@kung-foo Thank you for your suggestion!

I agree with you. Besides, I guess allowing the comment with no newline wouldn't bother anyone.

I fixed it.

kung-foo commented 4 years ago

This only came up because I selected a large part of a proto file and commented it out for testing. Not because I usually write comments at the bottom of a file :)

yoheimuta commented 4 years ago

@kung-foo That makes sense! Thank you for your clear explanation.