summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2013-07-21 16:44:00 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2013-07-21 16:44:00 +0200
commitb266cb62e4fc08b31dfa1b9a2700e5d555d13afb (patch)
tree8e88175ab9bf9d63eb504ce666b0e0aca0c0f895 /lib/coderay/encoders
parent5c23a731ca55729fc65630eca3b37a5b1a71e5b1 (diff)
parentea107396fdd72cdbbaf4820d09a87bd879ba7e6c (diff)
downloadcoderay-b266cb62e4fc08b31dfa1b9a2700e5d555d13afb.tar.gz
Merge branch 'master' into fix-cache-attack
Diffstat (limited to 'lib/coderay/encoders')
-rw-r--r--lib/coderay/encoders/debug_lint.rb3
-rw-r--r--lib/coderay/encoders/lint.rb4
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/coderay/encoders/debug_lint.rb b/lib/coderay/encoders/debug_lint.rb
index 2c14186..a4eba2c 100644
--- a/lib/coderay/encoders/debug_lint.rb
+++ b/lib/coderay/encoders/debug_lint.rb
@@ -18,7 +18,8 @@ module Encoders
register_for :debug_lint
def text_token text, kind
- raise Lint::EmptyToken, 'empty token' if text.empty?
+ raise Lint::EmptyToken, 'empty token for %p' % [kind] if text.empty?
+ raise Lint::UnknownTokenKind, 'unknown token kind %p (text was %p)' % [kind, text] unless TokenKinds.has_key? kind
super
end
diff --git a/lib/coderay/encoders/lint.rb b/lib/coderay/encoders/lint.rb
index 4601e90..88c8bd1 100644
--- a/lib/coderay/encoders/lint.rb
+++ b/lib/coderay/encoders/lint.rb
@@ -17,10 +17,12 @@ module Encoders
InvalidTokenStream = Class.new StandardError
EmptyToken = Class.new InvalidTokenStream
+ UnknownTokenKind = Class.new InvalidTokenStream
IncorrectTokenGroupNesting = Class.new InvalidTokenStream
def text_token text, kind
- raise EmptyToken, 'empty token' if text.empty?
+ raise EmptyToken, 'empty token for %p' % [kind] if text.empty?
+ raise UnknownTokenKind, 'unknown token kind %p (text was %p)' % [kind, text] unless TokenKinds.has_key? kind
end
def begin_group kind