summaryrefslogtreecommitdiff
path: root/lib/coderay/scanners/json.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/coderay/scanners/json.rb')
-rw-r--r--lib/coderay/scanners/json.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/coderay/scanners/json.rb b/lib/coderay/scanners/json.rb
index 163ec46..ca74ff3 100644
--- a/lib/coderay/scanners/json.rb
+++ b/lib/coderay/scanners/json.rb
@@ -14,9 +14,6 @@ module Scanners
:error, :integer, :operator, :value,
] # :nodoc:
- CONSTANTS = %w( true false null ) # :nodoc:
- IDENT_KIND = WordList.new(:key).add(CONSTANTS, :value) # :nodoc:
-
ESCAPE = / [bfnrt\\"\/] /x # :nodoc:
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} /x # :nodoc:
@@ -26,7 +23,6 @@ module Scanners
state = :initial
stack = []
- string_delimiter = nil
key_expected = false
until eos?
@@ -50,7 +46,7 @@ module Scanners
when '}', ']' then stack.pop # no error recovery, but works for valid JSON
end
elsif match = scan(/ true | false | null /x)
- kind = IDENT_KIND[match]
+ kind = :value
elsif match = scan(/-?(?:0|[1-9]\d*)/)
kind = :integer
if scan(/\.\d+(?:[eE][-+]?\d+)?|[eE][-+]?\d+/)
@@ -79,7 +75,7 @@ module Scanners
elsif scan(/\\./m)
kind = :content
elsif scan(/ \\ | $ /x)
- tokens << [:close, :delimiter]
+ tokens << [:close, state]
kind = :error
state = :initial
else