summaryrefslogtreecommitdiff
path: root/lib/coderay/scanners
diff options
context:
space:
mode:
Diffstat (limited to 'lib/coderay/scanners')
-rw-r--r--lib/coderay/scanners/c.rb6
-rw-r--r--lib/coderay/scanners/delphi.rb6
-rw-r--r--lib/coderay/scanners/html.rb2
-rw-r--r--lib/coderay/scanners/ruby.rb6
4 files changed, 15 insertions, 5 deletions
diff --git a/lib/coderay/scanners/c.rb b/lib/coderay/scanners/c.rb
index ae7ef83..ae0af73 100644
--- a/lib/coderay/scanners/c.rb
+++ b/lib/coderay/scanners/c.rb
@@ -135,7 +135,11 @@ module CodeRay module Scanners
end
match ||= matched
- raise_inspect [match, kind], tokens if kind == :error
+ if $DEBUG and (not kind or kind == :error)
+ raise_inspect 'Error token %p in line %d' %
+ [[match, kind], line], tokens
+ end
+ raise_inspect 'Empty token', tokens unless match
tokens << [match, kind]
diff --git a/lib/coderay/scanners/delphi.rb b/lib/coderay/scanners/delphi.rb
index 77c3839..d02c632 100644
--- a/lib/coderay/scanners/delphi.rb
+++ b/lib/coderay/scanners/delphi.rb
@@ -109,7 +109,11 @@ module CodeRay module Scanners
end
match ||= matched
- raise [match, kind], tokens if kind == :error
+ if $DEBUG and (not kind or kind == :error)
+ raise_inspect 'Error token %p in line %d' %
+ [[match, kind], line], tokens
+ end
+ raise_inspect 'Empty token', tokens unless match
tokens << [match, kind]
diff --git a/lib/coderay/scanners/html.rb b/lib/coderay/scanners/html.rb
index a1efa9e..e8eea61 100644
--- a/lib/coderay/scanners/html.rb
+++ b/lib/coderay/scanners/html.rb
@@ -145,7 +145,7 @@ module CodeRay module Scanners
match ||= matched
if $DEBUG and (not kind or kind == :error)
raise_inspect 'Error token %p in line %d' %
- [[match, kind], line], tokens
+ [[match, kind], line], tokens
end
raise_inspect 'Empty token', tokens unless match
diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb
index 8127944..1dbcb17 100644
--- a/lib/coderay/scanners/ruby.rb
+++ b/lib/coderay/scanners/ruby.rb
@@ -366,9 +366,11 @@ module CodeRay module Scanners
fancy_allowed = fancy_allowed == :set
last_token_dot = last_token_dot == :set
- if $DEBUG
- raise_inspect 'error token %p in line %d' % [[match, type], line], tokens if not type or type == :error
+ if $DEBUG and (not kind or kind == :error)
+ raise_inspect 'Error token %p in line %d' %
+ [[match, kind], line], tokens
end
+ raise_inspect 'Empty token', tokens unless match
tokens << [match, type]