codekingpro/portable-devtools
114k
1// Copyright 2016 The Go Authors. All rights reserved.2// Use of this source code is governed by a BSD-style3// license that can be found in the LICENSE file.4 5//go:build !goexperiment.jsonv26 7package json8 9import "unicode/utf8"10 11// safeSet holds the value true if the ASCII character with the given array12// position can be represented inside a JSON string without any further13// escaping.14//15// All values are true except for the ASCII control characters (0-31), the16// double quote ("), and the backslash character ("\").17var safeSet = [utf8.RuneSelf]bool{18 ' ': true,19 '!': true,20 '"': false,21 '#': true,22 '$': true,23 '%': true,24 '&': true,25 '\'': true,26 '(': true,27 ')': true,28 '*': true,29 '+': true,30 ',': true,31 '-': true,32 '.': true,33 '/': true,34 '0': true,35 '1': true,36 '2': true,37 '3': true,38 '4': true,39 '5': true,40 '6': true,41 '7': true,42 '8': true,43 '9': true,44 ':': true,45 ';': true,46 '<': true,47 '=': true,48 '>': true,49 '?': true,50 '@': true,51 'A': true,52 'B': true,53 'C': true,54 'D': true,55 'E': true,56 'F': true,57 'G': true,58 'H': true,59 'I': true,60 'J': true,61 'K': true,62 'L': true,63 'M': true,64 'N': true,65 'O': true,66 'P': true,67 'Q': true,68 'R': true,69 'S': true,70 'T': true,71 'U': true,72 'V': true,73 'W': true,74 'X': true,75 'Y': true,76 'Z': true,77 '[': true,78 '\\': false,79 ']': true,80 '^': true,81 '_': true,82 '`': true,83 'a': true,84 'b': true,85 'c': true,86 'd': true,87 'e': true,88 'f': true,89 'g': true,90 'h': true,91 'i': true,92 'j': true,93 'k': true,94 'l': true,95 'm': true,96 'n': true,97 'o': true,98 'p': true,99 'q': true,100 'r': true,101 's': true,102 't': true,103 'u': true,104 'v': true,105 'w': true,106 'x': true,107 'y': true,108 'z': true,109 '{': true,110 '|': true,111 '}': true,112 '~': true,113 '\u007f': true,114}115 116// htmlSafeSet holds the value true if the ASCII character with the given117// array position can be safely represented inside a JSON string, embedded118// inside of HTML <script> tags, without any additional escaping.119//120// All values are true except for the ASCII control characters (0-31), the121// double quote ("), the backslash character ("\"), HTML opening and closing122// tags ("<" and ">"), and the ampersand ("&").123var htmlSafeSet = [utf8.RuneSelf]bool{124 ' ': true,125 '!': true,126 '"': false,127 '#': true,128 '$': true,129 '%': true,130 '&': false,131 '\'': true,132 '(': true,133 ')': true,134 '*': true,135 '+': true,136 ',': true,137 '-': true,138 '.': true,139 '/': true,140 '0': true,141 '1': true,142 '2': true,143 '3': true,144 '4': true,145 '5': true,146 '6': true,147 '7': true,148 '8': true,149 '9': true,150 ':': true,151 ';': true,152 '<': false,153 '=': true,154 '>': false,155 '?': true,156 '@': true,157 'A': true,158 'B': true,159 'C': true,160 'D': true,161 'E': true,162 'F': true,163 'G': true,164 'H': true,165 'I': true,166 'J': true,167 'K': true,168 'L': true,169 'M': true,170 'N': true,171 'O': true,172 'P': true,173 'Q': true,174 'R': true,175 'S': true,176 'T': true,177 'U': true,178 'V': true,179 'W': true,180 'X': true,181 'Y': true,182 'Z': true,183 '[': true,184 '\\': false,185 ']': true,186 '^': true,187 '_': true,188 '`': true,189 'a': true,190 'b': true,191 'c': true,192 'd': true,193 'e': true,194 'f': true,195 'g': true,196 'h': true,197 'i': true,198 'j': true,199 'k': true,200 'l': true,201 'm': true,202 'n': true,203 'o': true,204 'p': true,205 'q': true,206 'r': true,207 's': true,208 't': true,209 'u': true,210 'v': true,211 'w': true,212 'x': true,213 'y': true,214 'z': true,215 '{': true,216 '|': true,217 '}': true,218 '~': true,219 '\u007f': true,220}221 