Skip to content

Instantly share code, notes, and snippets.

@dmj
Created March 7, 2022 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmj/63e7707f0cac5645ef98d9bf506c8508 to your computer and use it in GitHub Desktop.
Save dmj/63e7707f0cac5645ef98d9bf506c8508 to your computer and use it in GitHub Desktop.
@literalws = right
json = ~ value ~
value = string | number | object | array | "true" | "false" | "null"
string = `"` { anyUnicodeCharacterExceptQuoteOrBackslashOrControlCharacter | `\"` | `\\` | `\/` | `\b` | `\f` | `\n` | `\r` | `\t` | `\u` fourHexadecimalDigits } `"`
anyUnicodeCharacterExceptQuoteOrBackslashOrControlCharacter = ! /["\\]/ alphabet
alphabet = /[\u0009\u000A\u000D\u0020-\uD7FF#\uE000-\uFFFD\u10000-\u10FFFF]/
fourHexadecimalDigits = /[0-9A-Fa-f]{4}/
digit = /[0-9]/
digitOneThroughNine = /[1-9]/
number = [ "-" ] ( "0" | digitOneThroughNine { digit } ) [ "." { digit }+ ] [ ( "e" | "E" ) [ "+" | "-" ] { digit }+ ]
object = "{" [ pair { "," pair } ] "}"
pair = string ":" value ~
array = "[" [ value { "," value } ] "]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment