github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library@v0.2.0/JSON_Values/JSON_Values.go (about) 1 // Package JSON_Values 2 // Dafny module JSON_Values compiled into Go 3 4 package JSON_Values 5 6 import ( 7 os "os" 8 9 m_Actions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Actions" 10 m_Base64 "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64" 11 m_Base64Lemmas "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Base64Lemmas" 12 m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" 13 m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" 14 m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" 15 m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" 16 m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" 17 m_FloatCompare "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FloatCompare" 18 m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" 19 m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" 20 m_GetOpt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GetOpt" 21 m_HexStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/HexStrings" 22 m_JSON_Errors "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Errors" 23 m_JSON_Utils_Cursors "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Cursors" 24 m_JSON_Utils_Lexers_Core "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Lexers_Core" 25 m_JSON_Utils_Lexers_Strings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Lexers_Strings" 26 m_JSON_Utils_Parsers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Parsers" 27 m_JSON_Utils_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Seq" 28 m_JSON_Utils_Str "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Str" 29 m_JSON_Utils_Str_CharStrConversion "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Str_CharStrConversion" 30 m_JSON_Utils_Str_CharStrEscaping "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Str_CharStrEscaping" 31 m_JSON_Utils_Vectors "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Vectors" 32 m_JSON_Utils_Views_Core "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Views_Core" 33 m_JSON_Utils_Views_Writers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Views_Writers" 34 m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" 35 m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" 36 m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" 37 m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" 38 m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" 39 m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" 40 m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" 41 m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" 42 m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" 43 m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" 44 m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" 45 m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" 46 m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" 47 m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" 48 m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" 49 m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" 50 m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" 51 m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" 52 m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" 53 m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" 54 m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" 55 m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" 56 m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" 57 m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" 58 _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" 59 ) 60 61 var _ = os.Args 62 var _ _dafny.Dummy__ 63 var _ m__System.Dummy__ 64 var _ m_Wrappers.Dummy__ 65 var _ m_Relations.Dummy__ 66 var _ m_Seq_MergeSort.Dummy__ 67 var _ m__Math.Dummy__ 68 var _ m_Seq.Dummy__ 69 var _ m_BoundedInts.Dummy__ 70 var _ m__Unicode.Dummy__ 71 var _ m_Functions.Dummy__ 72 var _ m_Utf8EncodingForm.Dummy__ 73 var _ m_Utf16EncodingForm.Dummy__ 74 var _ m_UnicodeStrings.Dummy__ 75 var _ m_FileIO.Dummy__ 76 var _ m_GeneralInternals.Dummy__ 77 var _ m_MulInternalsNonlinear.Dummy__ 78 var _ m_MulInternals.Dummy__ 79 var _ m_Mul.Dummy__ 80 var _ m_ModInternalsNonlinear.Dummy__ 81 var _ m_DivInternalsNonlinear.Dummy__ 82 var _ m_ModInternals.Dummy__ 83 var _ m_DivInternals.Dummy__ 84 var _ m_DivMod.Dummy__ 85 var _ m_Power.Dummy__ 86 var _ m_Logarithm.Dummy__ 87 var _ m_StandardLibraryInterop.Dummy__ 88 var _ m_StandardLibrary_UInt.Dummy__ 89 var _ m_StandardLibrary_Sequence.Dummy__ 90 var _ m_StandardLibrary_String.Dummy__ 91 var _ m_StandardLibrary.Dummy__ 92 var _ m_Streams.Dummy__ 93 var _ m_Sorting.Dummy__ 94 var _ m_HexStrings.Dummy__ 95 var _ m_GetOpt.Dummy__ 96 var _ m_FloatCompare.Dummy__ 97 var _ m_Base64.Dummy__ 98 var _ m_Base64Lemmas.Dummy__ 99 var _ m_Actions.Dummy__ 100 var _ m_JSON_Utils_Views_Core.Dummy__ 101 var _ m_JSON_Utils_Views_Writers.Dummy__ 102 var _ m_JSON_Utils_Lexers_Core.Dummy__ 103 var _ m_JSON_Utils_Lexers_Strings.Dummy__ 104 var _ m_JSON_Utils_Cursors.Dummy__ 105 var _ m_JSON_Utils_Parsers.Dummy__ 106 var _ m_JSON_Utils_Str_CharStrConversion.Dummy__ 107 var _ m_JSON_Utils_Str_CharStrEscaping.Dummy__ 108 var _ m_JSON_Utils_Str.Dummy__ 109 var _ m_JSON_Utils_Seq.Dummy__ 110 var _ m_JSON_Utils_Vectors.Dummy__ 111 var _ m_JSON_Errors.Dummy__ 112 113 type Dummy__ struct{} 114 115 // Definition of class Default__ 116 type Default__ struct { 117 dummy byte 118 } 119 120 func New_Default___() *Default__ { 121 _this := Default__{} 122 123 return &_this 124 } 125 126 type CompanionStruct_Default___ struct { 127 } 128 129 var Companion_Default___ = CompanionStruct_Default___{} 130 131 func (_this *Default__) Equals(other *Default__) bool { 132 return _this == other 133 } 134 135 func (_this *Default__) EqualsGeneric(x interface{}) bool { 136 other, ok := x.(*Default__) 137 return ok && _this.Equals(other) 138 } 139 140 func (*Default__) String() string { 141 return "JSON_Values.Default__" 142 } 143 func (_this *Default__) ParentTraits_() []*_dafny.TraitID { 144 return [](*_dafny.TraitID){} 145 } 146 147 var _ _dafny.TraitOffspring = &Default__{} 148 149 func (_static *CompanionStruct_Default___) Int(n _dafny.Int) Decimal { 150 return Companion_Decimal_.Create_Decimal_(n, _dafny.Zero) 151 } 152 153 // End of class Default__ 154 155 // Definition of datatype Decimal 156 type Decimal struct { 157 Data_Decimal_ 158 } 159 160 func (_this Decimal) Get_() Data_Decimal_ { 161 return _this.Data_Decimal_ 162 } 163 164 type Data_Decimal_ interface { 165 isDecimal() 166 } 167 168 type CompanionStruct_Decimal_ struct { 169 } 170 171 var Companion_Decimal_ = CompanionStruct_Decimal_{} 172 173 type Decimal_Decimal struct { 174 N _dafny.Int 175 E10 _dafny.Int 176 } 177 178 func (Decimal_Decimal) isDecimal() {} 179 180 func (CompanionStruct_Decimal_) Create_Decimal_(N _dafny.Int, E10 _dafny.Int) Decimal { 181 return Decimal{Decimal_Decimal{N, E10}} 182 } 183 184 func (_this Decimal) Is_Decimal() bool { 185 _, ok := _this.Get_().(Decimal_Decimal) 186 return ok 187 } 188 189 func (CompanionStruct_Decimal_) Default() Decimal { 190 return Companion_Decimal_.Create_Decimal_(_dafny.Zero, _dafny.Zero) 191 } 192 193 func (_this Decimal) Dtor_n() _dafny.Int { 194 return _this.Get_().(Decimal_Decimal).N 195 } 196 197 func (_this Decimal) Dtor_e10() _dafny.Int { 198 return _this.Get_().(Decimal_Decimal).E10 199 } 200 201 func (_this Decimal) String() string { 202 switch data := _this.Get_().(type) { 203 case nil: 204 return "null" 205 case Decimal_Decimal: 206 { 207 return "Values.Decimal.Decimal" + "(" + _dafny.String(data.N) + ", " + _dafny.String(data.E10) + ")" 208 } 209 default: 210 { 211 return "<unexpected>" 212 } 213 } 214 } 215 216 func (_this Decimal) Equals(other Decimal) bool { 217 switch data1 := _this.Get_().(type) { 218 case Decimal_Decimal: 219 { 220 data2, ok := other.Get_().(Decimal_Decimal) 221 return ok && data1.N.Cmp(data2.N) == 0 && data1.E10.Cmp(data2.E10) == 0 222 } 223 default: 224 { 225 return false // unexpected 226 } 227 } 228 } 229 230 func (_this Decimal) EqualsGeneric(other interface{}) bool { 231 typed, ok := other.(Decimal) 232 return ok && _this.Equals(typed) 233 } 234 235 func Type_Decimal_() _dafny.TypeDescriptor { 236 return type_Decimal_{} 237 } 238 239 type type_Decimal_ struct { 240 } 241 242 func (_this type_Decimal_) Default() interface{} { 243 return Companion_Decimal_.Default() 244 } 245 246 func (_this type_Decimal_) String() string { 247 return "JSON_Values.Decimal" 248 } 249 func (_this Decimal) ParentTraits_() []*_dafny.TraitID { 250 return [](*_dafny.TraitID){} 251 } 252 253 var _ _dafny.TraitOffspring = Decimal{} 254 255 // End of datatype Decimal 256 257 // Definition of datatype JSON 258 type JSON struct { 259 Data_JSON_ 260 } 261 262 func (_this JSON) Get_() Data_JSON_ { 263 return _this.Data_JSON_ 264 } 265 266 type Data_JSON_ interface { 267 isJSON() 268 } 269 270 type CompanionStruct_JSON_ struct { 271 } 272 273 var Companion_JSON_ = CompanionStruct_JSON_{} 274 275 type JSON_Null struct { 276 } 277 278 func (JSON_Null) isJSON() {} 279 280 func (CompanionStruct_JSON_) Create_Null_() JSON { 281 return JSON{JSON_Null{}} 282 } 283 284 func (_this JSON) Is_Null() bool { 285 _, ok := _this.Get_().(JSON_Null) 286 return ok 287 } 288 289 type JSON_Bool struct { 290 B bool 291 } 292 293 func (JSON_Bool) isJSON() {} 294 295 func (CompanionStruct_JSON_) Create_Bool_(B bool) JSON { 296 return JSON{JSON_Bool{B}} 297 } 298 299 func (_this JSON) Is_Bool() bool { 300 _, ok := _this.Get_().(JSON_Bool) 301 return ok 302 } 303 304 type JSON_String struct { 305 Str _dafny.Sequence 306 } 307 308 func (JSON_String) isJSON() {} 309 310 func (CompanionStruct_JSON_) Create_String_(Str _dafny.Sequence) JSON { 311 return JSON{JSON_String{Str}} 312 } 313 314 func (_this JSON) Is_String() bool { 315 _, ok := _this.Get_().(JSON_String) 316 return ok 317 } 318 319 type JSON_Number struct { 320 Num Decimal 321 } 322 323 func (JSON_Number) isJSON() {} 324 325 func (CompanionStruct_JSON_) Create_Number_(Num Decimal) JSON { 326 return JSON{JSON_Number{Num}} 327 } 328 329 func (_this JSON) Is_Number() bool { 330 _, ok := _this.Get_().(JSON_Number) 331 return ok 332 } 333 334 type JSON_Object struct { 335 Obj _dafny.Sequence 336 } 337 338 func (JSON_Object) isJSON() {} 339 340 func (CompanionStruct_JSON_) Create_Object_(Obj _dafny.Sequence) JSON { 341 return JSON{JSON_Object{Obj}} 342 } 343 344 func (_this JSON) Is_Object() bool { 345 _, ok := _this.Get_().(JSON_Object) 346 return ok 347 } 348 349 type JSON_Array struct { 350 Arr _dafny.Sequence 351 } 352 353 func (JSON_Array) isJSON() {} 354 355 func (CompanionStruct_JSON_) Create_Array_(Arr _dafny.Sequence) JSON { 356 return JSON{JSON_Array{Arr}} 357 } 358 359 func (_this JSON) Is_Array() bool { 360 _, ok := _this.Get_().(JSON_Array) 361 return ok 362 } 363 364 func (CompanionStruct_JSON_) Default() JSON { 365 return Companion_JSON_.Create_Null_() 366 } 367 368 func (_this JSON) Dtor_b() bool { 369 return _this.Get_().(JSON_Bool).B 370 } 371 372 func (_this JSON) Dtor_str() _dafny.Sequence { 373 return _this.Get_().(JSON_String).Str 374 } 375 376 func (_this JSON) Dtor_num() Decimal { 377 return _this.Get_().(JSON_Number).Num 378 } 379 380 func (_this JSON) Dtor_obj() _dafny.Sequence { 381 return _this.Get_().(JSON_Object).Obj 382 } 383 384 func (_this JSON) Dtor_arr() _dafny.Sequence { 385 return _this.Get_().(JSON_Array).Arr 386 } 387 388 func (_this JSON) String() string { 389 switch data := _this.Get_().(type) { 390 case nil: 391 return "null" 392 case JSON_Null: 393 { 394 return "Values.JSON.Null" 395 } 396 case JSON_Bool: 397 { 398 return "Values.JSON.Bool" + "(" + _dafny.String(data.B) + ")" 399 } 400 case JSON_String: 401 { 402 return "Values.JSON.String" + "(" + _dafny.String(data.Str) + ")" 403 } 404 case JSON_Number: 405 { 406 return "Values.JSON.Number" + "(" + _dafny.String(data.Num) + ")" 407 } 408 case JSON_Object: 409 { 410 return "Values.JSON.Object" + "(" + _dafny.String(data.Obj) + ")" 411 } 412 case JSON_Array: 413 { 414 return "Values.JSON.Array" + "(" + _dafny.String(data.Arr) + ")" 415 } 416 default: 417 { 418 return "<unexpected>" 419 } 420 } 421 } 422 423 func (_this JSON) Equals(other JSON) bool { 424 switch data1 := _this.Get_().(type) { 425 case JSON_Null: 426 { 427 _, ok := other.Get_().(JSON_Null) 428 return ok 429 } 430 case JSON_Bool: 431 { 432 data2, ok := other.Get_().(JSON_Bool) 433 return ok && data1.B == data2.B 434 } 435 case JSON_String: 436 { 437 data2, ok := other.Get_().(JSON_String) 438 return ok && data1.Str.Equals(data2.Str) 439 } 440 case JSON_Number: 441 { 442 data2, ok := other.Get_().(JSON_Number) 443 return ok && data1.Num.Equals(data2.Num) 444 } 445 case JSON_Object: 446 { 447 data2, ok := other.Get_().(JSON_Object) 448 return ok && data1.Obj.Equals(data2.Obj) 449 } 450 case JSON_Array: 451 { 452 data2, ok := other.Get_().(JSON_Array) 453 return ok && data1.Arr.Equals(data2.Arr) 454 } 455 default: 456 { 457 return false // unexpected 458 } 459 } 460 } 461 462 func (_this JSON) EqualsGeneric(other interface{}) bool { 463 typed, ok := other.(JSON) 464 return ok && _this.Equals(typed) 465 } 466 467 func Type_JSON_() _dafny.TypeDescriptor { 468 return type_JSON_{} 469 } 470 471 type type_JSON_ struct { 472 } 473 474 func (_this type_JSON_) Default() interface{} { 475 return Companion_JSON_.Default() 476 } 477 478 func (_this type_JSON_) String() string { 479 return "JSON_Values.JSON" 480 } 481 func (_this JSON) ParentTraits_() []*_dafny.TraitID { 482 return [](*_dafny.TraitID){} 483 } 484 485 var _ _dafny.TraitOffspring = JSON{} 486 487 // End of datatype JSON