summaryrefslogtreecommitdiff
path: root/lib/coderay
diff options
context:
space:
mode:
Diffstat (limited to 'lib/coderay')
-rw-r--r--lib/coderay/scanners/sql.rb19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/coderay/scanners/sql.rb b/lib/coderay/scanners/sql.rb
index 9ba0b4d..126c95d 100644
--- a/lib/coderay/scanners/sql.rb
+++ b/lib/coderay/scanners/sql.rb
@@ -50,7 +50,7 @@ module CodeRay module Scanners
kind = nil
match = nil
-
+
if state == :initial
if scan(/ \s+ | \\\n /x)
@@ -58,10 +58,10 @@ module CodeRay module Scanners
elsif scan(/^(?:--\s?|#).*/)
kind = :comment
-
+
elsif scan(%r! /\* (?: .*? \*/ | .* ) !mx)
kind = :comment
-
+
elsif scan(/ [-+*\/=<>;,!&^|()\[\]{}~%] | \.(?!\d) /x)
kind = :operator
@@ -88,7 +88,7 @@ module CodeRay module Scanners
elsif scan(/\d[fF]|\d*\.\d+(?:[eE][+-]?\d+)?|\d+[eE][+-]?\d+/)
kind = :float
-
+
else
getch
kind = :error
@@ -144,16 +144,19 @@ module CodeRay module Scanners
end
match ||= matched
-# raise [match, kind], tokens if kind == :error
+ unless kind
+ raise_inspect 'Error token %p in line %d' %
+ [[match, kind], line], tokens, state
+ end
+ raise_inspect 'Empty token', tokens unless match
tokens << [match, kind]
end
-# RAILS_DEFAULT_LOGGER.info tokens.inspect
tokens
end
-
+
end
-
+
end end \ No newline at end of file