On 2006-12-01, George Ogata <george.ogata / gmail.com> wrote: > On 11/30/06, Jeremy Henty <jeremy / chaos.org.uk> wrote: >> >> A slightly better fix is to add a ';' as well to convince the major >> mode that the statement has ended, otherwise it adds extra >> indentation to the next line. >> >> def foo >> x /= y # / ; >> bar >> end > > Hmm, my ruby-mode doesn't seem to need the ';'. I'm using the CVS > HEAD version with XEmacs 21.4.19. Mine definitely does need it. I'm using stock Ruby 1.8.5 and GNU Emacs 21.4 . >> I wonder how the Ruby parser decides that /= is an operator and not >> the start of a regexp? > > It's just the way the grammar is defined. "Mommy, why is the sky blue?" "Hush child, it's just the way the physics is defined." :-) > For it to be a regexp, you'd need parens on the call to #x. Hmm, so after an identifier the parser tries to parse an infix operator trying to parse an expression, whereas after an open paren there can't be an infix operator so it parses "/=" as the start of a regexp? If so, I wonder how easy it would be to fix the emacs major mode to do the same thing? Thanks for your help. Regards, Jeremy Henty