diff options
Diffstat (limited to 'lib/coderay')
-rw-r--r-- | lib/coderay/scanners/java.rb | 2 | ||||
-rw-r--r-- | lib/coderay/scanners/json.rb | 8 |
2 files changed, 3 insertions, 7 deletions
diff --git a/lib/coderay/scanners/java.rb b/lib/coderay/scanners/java.rb index 2dfb1b6..e4a7421 100644 --- a/lib/coderay/scanners/java.rb +++ b/lib/coderay/scanners/java.rb @@ -149,7 +149,7 @@ module Scanners elsif scan(/\\./m) kind = :content elsif scan(/ \\ | $ /x) - tokens << [:close, :delimiter] + tokens << [:close, state] kind = :error state = :initial else 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 |