Racc error on new 1.9 hash syntax

racc 1.4.6 does not understand when parsing " in: value "

F:/Ruby19/lib/ruby/gems/1.9.1/gems/racc-1.4.6/lib/racc/parser.rb:347:in
`on_error’: (Racc::ParseError)
parse error on value “in” (kIN)

On Sun, Jan 17, 2010 at 12:37:42AM +0900, Michel D. wrote:

racc 1.4.6 does not understand when parsing " in: value "

F:/Ruby19/lib/ruby/gems/1.9.1/gems/racc-1.4.6/lib/racc/parser.rb:347:in
`on_error’: (Racc::ParseError)
parse error on value “in” (kIN)

Racc doesn’t actually understand how to parse anything. Someone must
write a grammar that racc uses to generate a parser.

You are seeing an error with the grammar file, not with Racc. What gem
are you using where you see this error? Can we get a larger stack
trace?

Aaron P. wrote:

On Sun, Jan 17, 2010 at 12:37:42AM +0900, Michel D. wrote:

racc 1.4.6 does not understand when parsing " in: value "

F:/Ruby19/lib/ruby/gems/1.9.1/gems/racc-1.4.6/lib/racc/parser.rb:347:in
`on_error’: (Racc::ParseError)
parse error on value “in” (kIN)

Racc doesn’t actually understand how to parse anything. Someone must
write a grammar that racc uses to generate a parser.

You are seeing an error with the grammar file, not with Racc. What gem
are you using where you see this error? Can we get a larger stack
trace?

Thanks for your answer.

It comes from flog via ruby-parser (flay gives the same error):

F:/Ruby19/lib/ruby/gems/1.9.1/gems/racc-1.4.6/lib/racc/parser.rb:347:in
on_error': (Racc::ParseError) parse error on value "in" (kIN) from F:/Ruby19/lib/ruby/gems/1.9.1/gems/racc-1.4.6/lib/racc/parser.rb:99:in_racc_do_parse_c’
from
F:/Ruby19/lib/ruby/gems/1.9.1/gems/racc-1.4.6/lib/racc/parser.rb:99:in
do_parse' from F:/Ruby19/lib/ruby/gems/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_parser_extras.rb:749:inprocess’
from
F:/Ruby19/lib/ruby/gems/1.9.1/gems/flog-2.4.0/lib/flog.rb:176:in block in flog' from F:/Ruby19/lib/ruby/gems/1.9.1/gems/flog-2.4.0/lib/flog.rb:170:ineach’
from
F:/Ruby19/lib/ruby/gems/1.9.1/gems/flog-2.4.0/lib/flog.rb:170:in flog' from F:/Ruby19/lib/ruby/gems/1.9.1/gems/flog-2.4.0/bin/flog:11:in<top
(required)>’
from F:/Ruby19/bin/flog:19:in load' from F:/Ruby19/bin/flog:19:in
Of course, ‘in’ is also a keyword. When using a key which is not a
keyword, the error happens when parsing the colon.

On Jan 17, 2010, at 19:44 , Michel D. wrote:

It comes from flog via ruby-parser (flay gives the same error):

ruby_parser doesn’t parse 1.9 syntax.

Ryan D. wrote:

On Jan 17, 2010, at 19:44 , Michel D. wrote:

It comes from flog via ruby-parser (flay gives the same error):

ruby_parser doesn’t parse 1.9 syntax.

@Ryan : OK, thanks. But what about flog ? Should we just forget it ?

On Jan 18, 2010, at 03:07 , Michel D. wrote:

Ryan D. wrote:

On Jan 17, 2010, at 19:44 , Michel D. wrote:

It comes from flog via ruby-parser (flay gives the same error):

ruby_parser doesn’t parse 1.9 syntax.

@Ryan : OK, thanks. But what about flog ? Should we just forget it ?

Flog and flay both use ruby_parser to do their work.

So far I haven’t had any motivation to get ruby_parser working with
1.9’s syntax changes. I am bribable tho. :smiley:

Ryan D. wrote:

On Jan 18, 2010, at 03:07 , Michel D. wrote:

Ryan D. wrote:

On Jan 17, 2010, at 19:44 , Michel D. wrote:

It comes from flog via ruby-parser (flay gives the same error):

ruby_parser doesn’t parse 1.9 syntax.

@Ryan : OK, thanks. But what about flog ? Should we just forget it ?

Flog and flay both use ruby_parser to do their work.

So far I haven’t had any motivation to get ruby_parser working with
1.9’s syntax changes. I am bribable tho. :smiley:

The funny fact is that I changed the syntax in my project to please
Saikuro !
There is a saying in French “you cannot please everybody and your wife
!”.
M.

A simple preliminary rake task passing files through
gsub!(/(\w+):\s+/, ‘\1 =>’)
solves the problem. It is easier than changing ruby_parser…

Actually, it is quite strange/funny to be able to write hashes like

if: true, raise: SyntaxError

M.