summaryrefslogtreecommitdiff
path: root/lib/coderay/scanners/json.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-03-26 03:00:18 +0000
committermurphy <murphy@rubychan.de>2010-03-26 03:00:18 +0000
commit5daa248eb972fb6c1a07fdf74999cb40a51451aa (patch)
treeeda07e53202aa269ccd4b870c76b7c59d9f18298 /lib/coderay/scanners/json.rb
parentd9ce3ae240d851e1b64ab4d610e46b3f8c8e35d9 (diff)
downloadcoderay-5daa248eb972fb6c1a07fdf74999cb40a51451aa.tar.gz
Cleanup of JSON Scanner.
Diffstat (limited to 'lib/coderay/scanners/json.rb')
-rw-r--r--lib/coderay/scanners/json.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/coderay/scanners/json.rb b/lib/coderay/scanners/json.rb
index a9926b2..163ec46 100644
--- a/lib/coderay/scanners/json.rb
+++ b/lib/coderay/scanners/json.rb
@@ -1,6 +1,7 @@
module CodeRay
module Scanners
+ # Scanner for JSON (JavaScript Object Notation).
class JSON < Scanner
include Streamable
@@ -11,13 +12,15 @@ module Scanners
KINDS_NOT_LOC = [
:float, :char, :content, :delimiter,
:error, :integer, :operator, :value,
- ]
+ ] # :nodoc:
- CONSTANTS = %w( true false null )
- IDENT_KIND = WordList.new(:key).add(CONSTANTS, :value)
+ CONSTANTS = %w( true false null ) # :nodoc:
+ IDENT_KIND = WordList.new(:key).add(CONSTANTS, :value) # :nodoc:
- ESCAPE = / [bfnrt\\"\/] /x
- UNICODE_ESCAPE = / u[a-fA-F0-9]{4} /x
+ ESCAPE = / [bfnrt\\"\/] /x # :nodoc:
+ UNICODE_ESCAPE = / u[a-fA-F0-9]{4} /x # :nodoc:
+
+ protected
def scan_tokens tokens, options
@@ -89,7 +92,7 @@ module Scanners
end
match ||= matched
- if $DEBUG and not kind
+ if $CODERAY_DEBUG and not kind
raise_inspect 'Error token %p in line %d' %
[[match, kind], line], tokens
end