Ruby supports multi-line strings, for both single and double-quoted strings.
str = "This
a valid string."
str = 'So
Any implementation should deal with the following edge case:
# This comment contains a single quote: '
str = 'This
string \'should\' be
highlighted, including the escaped quotes'
The way rainbow's parser works is by generating all possible matches for a regex and discarding those that intersect another regex. In this case, the regex to match a multi-line string will most likely start by picking up the single quote in the comment.
This has nothing to do with comments, per se. It would also trip up if, say, there were a single quote in a double-quoted string immediately preceding a single-quoted string.
This actually applies for other languages as well, but Ruby doesn't inherit from the generic patterns right now. Originally I was processing comments first. This allowed multiline strings to work pretty well, but I changed the order to fix #2.
I've been working on adding tests so that I will feel more comfortable making changes without having to worry about breaking other things. If you open up tests/index.html in a browser you can see. In fact it would be great to have some for Ruby as well.
Actually this seems to work in the generic patterns perhaps not intentionally ha.
Hmm. I'll see if I can use that to make it work for Ruby. What if you put the multi-line string immediately after the comment?
test = 'blah blah
blah de blah'