This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 97631 - Wrong syntax highlighting (striking out) of after-backslash characters in single-quote string
Summary: Wrong syntax highlighting (striking out) of after-backslash characters in sin...
Status: RESOLVED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Torbjorn Norbye
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-11 18:14 UTC by Martin Krauskopf
Modified: 2007-07-03 14:43 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Krauskopf 2007-03-11 18:14:27 UTC
Single-quoted string literals should not be treated specially. Just \' and \\
are escaped.

Try to put into the editor e.g.:

puts 'Tom\'s computer is slow.' # correct usage, incorrect syntax highlighting
puts '{x,y,q} \\ {x,y,z} = {q}' # correct u., correct h.
puts '{x,y,q} \ {x,y,z} = {q}' # I think correct u., incorrect h.

\<whatever_char> is struck out. Maybe it is some feature I do not understand to?
Comment 1 Torbjorn Norbye 2007-03-13 23:33:11 UTC
Thanks - fixed. It was handling \" instead of \'.

Regarding highlighting of \<whatever_char>:  The idea here is to give the user a clue that the characters 
are not being escaped.

Ruby allows you to do \n. In a single-quoted string, this will emit two characters, not a single newline 
character. So it's trying to tell you there's no substitution happening here. I think that's probably going to 
be more helpful than annoying; from a quick look I haven't seen a lot of source code which is doing \x 
printing. (You could always use a double \\ to avoid the issue.)
Comment 2 Martin Krauskopf 2007-03-14 10:48:21 UTC
I think the annoying could be the usage of regular expression group references
where single quoted string are handy. Statements like:

  puts "three two one".gsub(/(\w+) (\w+) (\w+)/, '\3 \2 \1')

looks little odd then and seems to be common when working with regexps.
Comment 3 Jiri Kovalsky 2007-07-03 14:12:40 UTC
Reassigning this issue to newly created 'ruby' component.
Comment 4 Jiri Kovalsky 2007-07-03 14:43:26 UTC
Changing target milestone of all resolved Ruby issues from TBD to 6.0 Beta 1 build.