// ------------------------------------------------------------------------ // Project active2 // Active Thing (activething.com) git.activething.com/go // // File name active.go // Created by DEV // Modified 21/04/2024 // // Copyright 2024 activething.com // ------------------------------------------------------------------------ // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------ package cjson import "unicode/utf8" var ( G = struct { Hex string JSONChars [utf8.RuneSelf]CharAtt NullValue []byte EmptyValue []byte ZeroValue []byte TrueValue []byte FalseValue []byte FloatNaN []byte FloatInfPos []byte FloatInfNeg []byte } { Hex: "0123456789abcdef", JSONChars: initJSONChars(), NullValue: []byte{'n', 'u', 'l', 'l'}, ZeroValue: []byte{'0'}, EmptyValue: []byte{'"','"'}, TrueValue: []byte{'"','t', 'r', 'u', 'e','"'}, FalseValue: []byte{'"','f', 'a', 'l', 's', 'e','"'}, FloatNaN: []byte{'"', 'N', 'a', 'N', '"'}, FloatInfPos: []byte{'"', 'I', 'n', 'f', '"'}, FloatInfNeg: []byte{'"', '-', 'I', 'n', 'f', '"'}, } ) func initJSONChars() [utf8.RuneSelf]CharAtt { var tb = [utf8.RuneSelf]CharAtt{ '"': CharAttAllUnsafe, '&': CharAttHtmlUnsafe, '<': CharAttHtmlUnsafe, '>': CharAttHtmlUnsafe, '\\': CharAttAllUnsafe, } for i := 0; i <= 31; i++ { tb[i] = CharAttAllUnsafe } return tb }