github.com/cockroachdb/cockroachdb-parser@v0.23.3-0.20240213214944-911057d40c9a/pkg/util/json/tables.go (about) 1 // Copyright 2019 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 // Copyright 2016 The Go Authors. All rights reserved. 12 // Use of this source code is governed by a BSD-style 13 // license that can be found in the LICENSE file. 14 15 // Copied from https://github.com/golang/go/blob/master/src/encoding/json/tables.go 16 17 package json 18 19 import "unicode/utf8" 20 21 // safeSet holds the value true if the ASCII character with the given array 22 // position can be represented inside a JSON string without any further 23 // escaping. 24 // 25 // All values are true except for the ASCII control characters (0-31), the 26 // double quote ("), and the backslash character ("\"). 27 var safeSet = [utf8.RuneSelf]bool{ 28 ' ': true, 29 '!': true, 30 '"': false, 31 '#': true, 32 '$': true, 33 '%': true, 34 '&': true, 35 '\'': true, 36 '(': true, 37 ')': true, 38 '*': true, 39 '+': true, 40 ',': true, 41 '-': true, 42 '.': true, 43 '/': true, 44 '0': true, 45 '1': true, 46 '2': true, 47 '3': true, 48 '4': true, 49 '5': true, 50 '6': true, 51 '7': true, 52 '8': true, 53 '9': true, 54 ':': true, 55 ';': true, 56 '<': true, 57 '=': true, 58 '>': true, 59 '?': true, 60 '@': true, 61 'A': true, 62 'B': true, 63 'C': true, 64 'D': true, 65 'E': true, 66 'F': true, 67 'G': true, 68 'H': true, 69 'I': true, 70 'J': true, 71 'K': true, 72 'L': true, 73 'M': true, 74 'N': true, 75 'O': true, 76 'P': true, 77 'Q': true, 78 'R': true, 79 'S': true, 80 'T': true, 81 'U': true, 82 'V': true, 83 'W': true, 84 'X': true, 85 'Y': true, 86 'Z': true, 87 '[': true, 88 '\\': false, 89 ']': true, 90 '^': true, 91 '_': true, 92 '`': true, 93 'a': true, 94 'b': true, 95 'c': true, 96 'd': true, 97 'e': true, 98 'f': true, 99 'g': true, 100 'h': true, 101 'i': true, 102 'j': true, 103 'k': true, 104 'l': true, 105 'm': true, 106 'n': true, 107 'o': true, 108 'p': true, 109 'q': true, 110 'r': true, 111 's': true, 112 't': true, 113 'u': true, 114 'v': true, 115 'w': true, 116 'x': true, 117 'y': true, 118 'z': true, 119 '{': true, 120 '|': true, 121 '}': true, 122 '~': true, 123 '\u007f': true, 124 }