Module: JSON::Next

Defined in:
lib/json/next/commata.rb,
lib/json/next/pattern.rb,
lib/json/next/version.rb

Defined Under Namespace

Classes: Commata

Constant Summary collapse

BACKTICK_ML_QUOTE =
%< ` (?<backtick_ml_quote>
        (?:
          \\\\. | [^`]
        )*
    )
  `
>
SINGLE_QUOTE =
%< ' (?<single_quote>
      (?:
         \\\\. | [^']
      )*
    )
 '
>
DOUBLE_QUOTE =
%< " (?<double_quote>
      (?:
        \\\\. | [^"]
      )*
    )
  "
>
CLANG_ML_COMMENT =

comments

%< /\\*
    .*?
   \\*/
>
CLANG_COMMENT =
%<  //
    .*?
    (?:
      \\n | $
    )
>
SHELL_COMMENT =
%<  [#]
    .*?
    (?:
      \\n | $
    )
>
KEYWORDS =
%<
  (?:
     true | false | null
  )
  (?=
      [^\\w_$] | $
  )
>
IDENTIFIER =
%<
  (?<identifier>
     [a-zA-Z_$]
     [\\w_$]*
  )
>
IDENTIFIER_EXTENDED =

note: allow extra chars for identifier (extended)

e.g. allow dash (-) e.g:
  babel-preset-es2015
  core-js
  cross-spawn
  eslint-config-jquery
and others
%<
  (?<identifier>
     [a-zA-Z_$]
     [\\w_$\\-]*
  )
>
TRAILING_COMMA =
%<
  (?<trailing_comma>,)
  (?=
    \\s*
    [}\\]]
  )
>
UNESCAPE_MAP =
{
  %<\\"> => %<">,     ## "\\\"" => "\"",
  %<\\`> => %<`>,     ## "\\`"  => "`",
  %<\\'> => %<'>      ## "\\'"  => "'"
}
ML_ESCAPE_MAP =
{
  %<\n> => %<\\n>,    ## "\n" => "\\n",
  %<\r> => %<\\r>,    ## "\r" => "\\r",
  %<\t> => %<\\t>,    ## "\t" => "\\t",
  %<">  => %<\\">     ## "\"" => "\\\""
}
MAJOR =

todo: namespace inside version or something - why? why not??

1
MINOR =
2
PATCH =
1
VERSION =
[MAJOR,MINOR,PATCH].join('.')

Class Method Summary collapse

Class Method Details



15
16
17
# File 'lib/json/next/version.rb', line 15

def self.banner
  "json-next/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
end

.rootObject



19
20
21
# File 'lib/json/next/version.rb', line 19

def self.root
  "#{File.expand_path( File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) )}"
end

.versionObject



11
12
13
# File 'lib/json/next/version.rb', line 11

def self.version
  VERSION
end