I’ve been running into this problem with gems and plugins recently
when using ruby 1.9.1p0.
A review of syntax.y from ruby 1.8.7 and 1.9.1 shows the grammar rule
for then no longer includes the literal symbol ‘:’. This change
causes commonly used idioms for case expressions and loops to fail.
These no longer work:
case
when CONDITION :
BODY
end
while BOOLEAN :
BODY
end
until BOOLEAN :
BODY
end
for NAME in EXPRESSION :
BODY
end
Am I mistaken? Is this a feature?
This is the question I asked the Ruby language group (redmine.ruby-
lang.org Bug #1389) which produced this response:
It was an “accidental” feature in the first place. It’s been removed
to simplify the new hash literal syntax.
At this point, I’ve found problems with rubyist-aasm and attachment-
fu. No extensive search here just trying the plugins/gems I’ve used.
So, if you’re trying to work with ruby 1.9 and you’re seeing error
messages that look like:
attachment_fu.rb:106: syntax error, unexpected tIDENTIFIER, expecting
keyword_then or ‘,’ or ‘;’ or ‘\n’
search out the ‘:’ and replace it with ‘then’