Subject: bug#15874: 24.3.50; exit! not properly font-locked in ruby-mode

From: Dmitry Gutov <[email-masked]>
Date: Thu, 05 Dec 2013 00:33:06 +0200

On 04.12.2013 21:20, Stefan Monnier wrote:
>> I'm not sure we want to move `!' to the symbol syntax class.
>
> How is the Ruby lexing done w.r.t identifiers and ! (and ?) ?

There's no special handling: ? is considered a part of whatever token 
it's adjacent to (even when the token follows it, ex. "?wut"), and ! is 
considered a separate token.

The former is usually harmless, as far as indentation and syntax 
highlighting are concerned (*), but not considering ! a part of 
preceding token makes us mishandle the (rare, to be sure) method names 
like "else!" and "end!".

(*) Counterexample:

irb(main):013:0> def foo?
irb(main):014:1> 42
irb(main):015:1> end
=> nil
irb(main):016:0> begin; foo?end
=> 42

We don't treat "end" in "begin; foo?end" as a keyword, but ideally, we 
should.