Merge pull request #2716 from github/faster-string-tokenizer

Use negative lookbehind when tokenizing string literals
This commit is contained in:
Arfon Smith
2015-11-05 08:40:34 -08:00

View File

@@ -86,13 +86,13 @@ module Linguist
if s.peek(1) == "\""
s.getch
else
s.skip_until(/[^\\]"/)
s.skip_until(/(?<!\\)"/)
end
elsif s.scan(/'/)
if s.peek(1) == "'"
s.getch
else
s.skip_until(/[^\\]'/)
s.skip_until(/(?<!\\)'/)
end
# Skip number literals