From 81ee35212774f6d3faacbbce5bcabbf3aaba3064 Mon Sep 17 00:00:00 2001 From: murphy Date: Sun, 9 Jul 2006 22:24:43 +0000 Subject: [BUG] Fixed bug in Ruby-Scanner (input ends with unfinished escape in string) (thanks to bovi again.) Test case added. --- lib/coderay/scanners/ruby.rb | 2 ++ test/ruby/open-string.in.rb | 1 + test/ruby/open-string.out.raydebug | 2 ++ 3 files changed, 5 insertions(+) create mode 100644 test/ruby/open-string.in.rb create mode 100644 test/ruby/open-string.out.raydebug diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb index 6e08a1f..2a415eb 100644 --- a/lib/coderay/scanners/ruby.rb +++ b/lib/coderay/scanners/ruby.rb @@ -118,6 +118,8 @@ module Scanners case m = getch when state.delim, '\\' tokens << [match + m, :char] + when nil + tokens << [match, :error] else tokens << [match + m, :content] end diff --git a/test/ruby/open-string.in.rb b/test/ruby/open-string.in.rb new file mode 100644 index 0000000..897afad --- /dev/null +++ b/test/ruby/open-string.in.rb @@ -0,0 +1 @@ +'\ diff --git a/test/ruby/open-string.out.raydebug b/test/ruby/open-string.out.raydebug new file mode 100644 index 0000000..f288618 --- /dev/null +++ b/test/ruby/open-string.out.raydebug @@ -0,0 +1,2 @@ +string \ No newline at end of file -- cgit v1.2.1