Ruby regex syntax sugar not supported

Bug #1197803 reported by Bjartur Thorlacius
6
This bug affects 1 person
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
ProcVersionSignature: Ubuntu 3.8.0-25.37-generic 3.8.13
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_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: vim
UpgradeStatus: Upgraded to raring on 2013-05-06 (59 days ago)

Revision history for this message
Bjartur Thorlacius (svartman95) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.