aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2012-07-24 11:49:29 -0500
committerJoshua Peek <josh@joshpeek.com>2012-07-24 11:49:29 -0500
commite5d302459fd718ca26a1d9477a1c5220092a8fd1 (patch)
tree4272e2a095201e2366fd0af48a3a9a6c65d29924 /lib
parent7aac87681bf62632c0b0007526134ce23eaa8310 (diff)
Fix tokenzing empty strings
Diffstat (limited to 'lib')
-rw-r--r--lib/linguist/tokenizer.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/linguist/tokenizer.rb b/lib/linguist/tokenizer.rb
index bf05dcd..ed06a9f 100644
--- a/lib/linguist/tokenizer.rb
+++ b/lib/linguist/tokenizer.rb
@@ -64,9 +64,17 @@ module Linguist
# Skip single or double quoted strings
elsif s.scan(/"/)
- s.skip_until(/[^\\]"/)
+ if s.peek(1) == "\""
+ s.getch
+ else
+ s.skip_until(/[^\\]"/)
+ end
elsif s.scan(/'/)
- s.skip_until(/[^\\]'/)
+ if s.peek(1) == "'"
+ s.getch
+ else
+ s.skip_until(/[^\\]'/)
+ end
# Skip number literals
elsif s.scan(/(0x)?\d(\d|\.)*/)