diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2013-07-21 16:43:19 +0200 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2013-07-21 16:43:19 +0200 |
commit | ea107396fdd72cdbbaf4820d09a87bd879ba7e6c (patch) | |
tree | dbba0af92a52e6733dbd300da285a875ee7e94d4 /lib/coderay/encoders/lint.rb | |
parent | 59ca07b0d1a1710ab729636ea00de4b638f56110 (diff) | |
download | coderay-ea107396fdd72cdbbaf4820d09a87bd879ba7e6c.tar.gz |
check token kinds in Lint encoders
Diffstat (limited to 'lib/coderay/encoders/lint.rb')
-rw-r--r-- | lib/coderay/encoders/lint.rb | 4 |
1 files changed, 3 insertions, 1 deletions
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 |