ABNF-Actions =
  to-language     'JSON'
  to-fileTypes    ['json']
  to-scopeName    'source.json'
  to-description  'JSON parser'

  to-locname    '' ; must be clear
  to-typename   '' ; must be clear

result = value

value =
    '{' ws object--OBJECT(val) ws '}'
  / '[' ws array--ARRAY(val) ws ']'
  / '"' *char--STRING(val, unescape) '"'
  / number--pending(val)
  / 'true' to--true(val)
  / 'false' to--false(val)
  / 'null' to--null(val)

number = [ '-' ] int (
    frac [ exp ] to--type(FLOAT)
    / exp to--type(FLOAT)
    / to--type(INT)
  )

exp = "E" [ '-' / '+' ] 1*DIGIT

frac = '.' 1*DIGIT

int = '0' / ( %x31-39 *DIGIT )

object =
  ws [ property *( ws ',' ws property ) ] ws

property =
 '"' *char--STRING(key, unescape) '"' ws ':' ws value

array = *( ws value ws ',' ws) [value]

char =
  unescaped / '\' (
    '"' /          ; quotation mark  U+0022
    '\' /          ; reverse solidus U+005C
    '/' /          ; solidus         U+002F
    'b' /          ; backspace       U+0008
    'f' /          ; form feed       U+000C
    'n' /          ; line feed       U+000A
    'r' /          ; carriage return U+000D
    't' /          ; tab             U+0009
    'u' 4HEXDIG    ; uXXXX           U+XXXX
  )

unescaped = %x20-21 / %x23-5B / %x5D-10FFFF

ws =
  *(
    %x20 /   ; Space
    %x09 /   ; Horizontal tab
    %x0A /   ; Line feed or New line
    %x0D     ; Carriage return
  )

DIGIT   = %x30-39 ; 0-9

HEXDIG  = DIGIT / %x41-5A / %x61-7A
