[TxMt] Ruby Bundle: Problem with Interpolated Regexp's

Gerrit Kaiser lists at gerritkaiser.de
Wed Jan 30 01:52:40 UTC 2008


Hi List,
I've encountered some issues with Ruby Regexp's and interpolation,  
specifically  Embedded code with #{}.
Ruby allows embedded code inside Regexp literals, but the Ruby Bundle  
doesn't seem to recognise that fully. So I've changed the scope  
selector for the “Embedded Code…” snippet to
(string.quoted.double.ruby|string.interpolated.ruby| 
string.regexp.classic.ruby|string.regexp.mod-r.ruby) - string source
to make it behave like it should.
Unfortunately I don't know enough about TextMate Language Grammars to  
correct the erroneous Syntax Highlighting (i assume in the  
interpolated_ruby section.
Here's the current situation:

/#{code}/, %r{#{code}} - #{} gets correctly highlighted as  
source.ruby.embedded.source
/[#{}]/ doesn't get highlighted (incorrectly)

There's also the /o option to regex which changes how #{} blocks are  
interpolated, but that can probably be ignored.

Would be great if someone with more language-grammar-fu could correct  
that.
—G


More information about the textmate mailing list