Ruby regex syntax sugar not supported
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
vim (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
The syntax highlighting for Ruby does not highlight regular expressions, but rather highlights the regular expressions as if it were Ruby code. Highlighting might help to remind a programmer to close a regex. In special, a double slash at appended to an expression neither marks the beginning of a NL delimited comment, nor is it a syntactical error. Ruby interprets the former slash as a division sign and the latter as marking the beginning of a multi-line regular expression. Unfortunately, English sentences are valid regular expressions. The unintended regular expression thus continues till the next forward slash.
Example erronous code:
puts "Hello, World!" //Classic <- Meant to be a comment
puts "Ruby considers this line, and most of the next one, to be part of a multi-line regular expression"
puts "A regular expression is not a valid divisor. Ruby performs type checks /after/ parsing"
And the debugging output:
sample:3: unknown regexp options - aftr
sample:3: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
sample:3: unterminated string meets end of file
ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: vim-nox 2:7.3.547-6ubuntu5
ProcVersionSign
Uname: Linux 3.8.0-25-generic i686
ApportVersion: 2.9.2-0ubuntu8.1
Architecture: i386
Date: Thu Jul 4 12:54:06 2013
EcryptfsInUse: Yes
InstallationDate: Installed on 2013-03-05 (120 days ago)
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Release i386 (20121017.2)
MarkForUpload: True
ProcEnviron:
TERM=xterm
PATH=(custom, no user)
XDG_RUNTIME_
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: vim
UpgradeStatus: Upgraded to raring on 2013-05-06 (59 days ago)