Bug in SciTE 2.20 for Windows - ruby 1.9 syntax highlighting

11 views
Skip to first unread message

ctraut

unread,
Aug 9, 2010, 10:10:53 AM8/9/10
to scite-interest
Hey guys,

I hope this is the right place to post this.
I'm using SciTE 2.20 on Windows XP and I noticed a bug in the Ruby
syntax highlighting.
Ruby 1.9 introduced a new, shorter syntax for declaring hash literals,
so instead of:

h = { :name => 'test', :age => 1 }

you can also use this short version:

h = { name: 'test', age: 1 }

This works reasonably well in SciTE, but when you use reserved
keywords as keys in the hash (which is allowed), the highlighter gets
confused.
So even though this is valid Ruby 1.9 code, it is not properly
highlighted (and also triggers an indent in the next line):

h = { class: 'test', if: 1 }

Neil Hodgson

unread,
Aug 10, 2010, 9:48:19 AM8/10/10
to scite-i...@googlegroups.com
ctraut:

> I hope this is the right place to post this.

There is a bug tracker at
https://sourceforge.net/tracker/?group_id=2439&atid=352439

> This works reasonably well in SciTE, but when you use reserved
> keywords as keys in the hash (which is allowed), the highlighter gets
> confused.

It would be difficult to find all occurrences of this since I would
expect Ruby to allow calls and nested hashes and similar so there'd
have to be some sort of stack. Maybe the people that work on the Ruby
lexer will be able to do this but its likely to be too much effort for
an unusual case.

Neil

Reply all
Reply to author
Forward
0 new messages