Sha256: 8c9db3051ce8b43a9cc95ca6d32bd6473ae599bf2b9a8caeca09fbe9bcf9f635

Contents?: true

Size: 785 Bytes

Versions: 14

Compression:

Stored size: 785 Bytes

Contents

# -*- coding: utf-8 -*- #

module Rouge
  module Lexers
    class JSON < RegexLexer
      title 'JSON'
      desc "JavaScript Object Notation (json.org)"
      tag 'json'
      filenames '*.json'
      mimetypes 'application/json', 'application/vnd.api+json',
                'application/hal+json'

      state :root do
        rule /\s+/m, Text::Whitespace
        rule /"/, Str::Double, :string
        rule /(?:true|false|null)\b/, Keyword::Constant
        rule /[{},:\[\]]/, Punctuation
        rule /-?(?:0|[1-9]\d*)\.\d+(?:e[+-]?\d+)?/i, Num::Float
        rule /-?(?:0|[1-9]\d*)(?:e[+-]?\d+)?/i, Num::Integer
      end

      state :string do
        rule /[^\\"]+/, Str::Double
        rule /\\./, Str::Escape
        rule /"/, Str::Double, :pop!
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 5 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/rouge-2.2.1/lib/rouge/lexers/json.rb
rouge-3.2.1 lib/rouge/lexers/json.rb
rouge-3.2.0 lib/rouge/lexers/json.rb
rouge_ecl-1.0.0 lib/rouge/lexers/json.rb
rouge_ecl-0.0.1 lib/rouge/lexers/json.rb
rouge-3.1.1 lib/rouge/lexers/json.rb
rouge-3.1.0 lib/rouge/lexers/json.rb
rouge-3.0.0 lib/rouge/lexers/json.rb
rouge-2.2.1 lib/rouge/lexers/json.rb
rouge-2.2.0 lib/rouge/lexers/json.rb
rougegal-2.1.2 lib/rouge/lexers/json.rb
tdiary-5.0.5 vendor/bundle/gems/rouge-2.1.1/lib/rouge/lexers/json.rb
rouge-2.1.1 lib/rouge/lexers/json.rb
rouge-2.1.0 lib/rouge/lexers/json.rb