ruby/racc

Better error message in case of empty Parser class

Closed this issue · 6 comments

v0dro commented

If the Parser class is empty and does not contain any rules, racc fails to generate the parser Ruby file.

This is an unexpected error and should ideally be done away with.

Every grammar needs a start rule. If there is no start rule, what code do you propose the generated parser should contain?

v0dro commented

Ah yes. I'm sorry you have a point.

Then how about having an informative error message incase of an empty Parser class stating that the class cannot be left empty?

v0dro commented

It currently shows this: racc: lib/rubex/parser.racc: parser.racc:3: unexpected token 'end'

Sounds good to me. Are you using Racc 1.4.14 or 2.0.0-dev?

v0dro commented

1.4.14

I have pushed a fix for this to master.