Eric Promislow of ActiveState has contributed a modification for
the Ruby lexer that handles interpolated expressions and ?<ch> better.
Committed to CVS.

  Neil

  Eric's description:

1. Interpolated strings are now lexed as expressions, and not as strings.

Example code:

 var = "x + y = #{x + y}\n"

Before, lexed as:
 var: identifier
   =: operator
"...": string

After:
 var: identifier
   =: operator
<<"x + y = >>: string
   #{ : operator
    x : identifier
    + : operator
    x : identifier
    } : operator
<<\n">>: string

The "<<" and ">>" things are used to delimit strings.

Caveat:

The lexer currently supports a limit of 5 nested occurrences of #{ and
} within a string.
Once it hits the 6th occurrence of "#{" it stays in string mode.  In a
full analysis of the
standard Ruby library I never found code that used more than 2 nested
levels of #{ and }.

The lexer also doesn't always handle changes to code in the middle of
a multi-line
sequence between "#{" and "}".  I vaguely recalling finding one
occurrence of this in the
standard Ruby library.  This is a scintilla lexer synchronization bug,
and the fix would
entail matching { and } chars, and moving back through the buffer any
time I find an unmatched
"}".

2. The old lexer didn't handle ?<ch> as a numeric value (e.g. <<?0> == 48>>
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to