github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library@v0.2.0/JSON_Utils_Lexers_Strings/JSON_Utils_Lexers_Strings.go (about) 1 // Package JSON_Utils_Lexers_Strings 2 // Dafny module JSON_Utils_Lexers_Strings compiled into Go 3 4 package JSON_Utils_Lexers_Strings 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_Utils_Lexers_Core "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Lexers_Core" 23 m_JSON_Utils_Views_Core "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Views_Core" 24 m_JSON_Utils_Views_Writers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/JSON_Utils_Views_Writers" 25 m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" 26 m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" 27 m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" 28 m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" 29 m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" 30 m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" 31 m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" 32 m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" 33 m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" 34 m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" 35 m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" 36 m_Sorting "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Sorting" 37 m_StandardLibrary "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary" 38 m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" 39 m_StandardLibrary_Sequence "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_Sequence" 40 m_StandardLibrary_String "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_String" 41 m_StandardLibrary_UInt "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibrary_UInt" 42 m_Streams "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Streams" 43 m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" 44 m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" 45 m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" 46 m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" 47 m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" 48 m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" 49 _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" 50 ) 51 52 var _ = os.Args 53 var _ _dafny.Dummy__ 54 var _ m__System.Dummy__ 55 var _ m_Wrappers.Dummy__ 56 var _ m_Relations.Dummy__ 57 var _ m_Seq_MergeSort.Dummy__ 58 var _ m__Math.Dummy__ 59 var _ m_Seq.Dummy__ 60 var _ m_BoundedInts.Dummy__ 61 var _ m__Unicode.Dummy__ 62 var _ m_Functions.Dummy__ 63 var _ m_Utf8EncodingForm.Dummy__ 64 var _ m_Utf16EncodingForm.Dummy__ 65 var _ m_UnicodeStrings.Dummy__ 66 var _ m_FileIO.Dummy__ 67 var _ m_GeneralInternals.Dummy__ 68 var _ m_MulInternalsNonlinear.Dummy__ 69 var _ m_MulInternals.Dummy__ 70 var _ m_Mul.Dummy__ 71 var _ m_ModInternalsNonlinear.Dummy__ 72 var _ m_DivInternalsNonlinear.Dummy__ 73 var _ m_ModInternals.Dummy__ 74 var _ m_DivInternals.Dummy__ 75 var _ m_DivMod.Dummy__ 76 var _ m_Power.Dummy__ 77 var _ m_Logarithm.Dummy__ 78 var _ m_StandardLibraryInterop.Dummy__ 79 var _ m_StandardLibrary_UInt.Dummy__ 80 var _ m_StandardLibrary_Sequence.Dummy__ 81 var _ m_StandardLibrary_String.Dummy__ 82 var _ m_StandardLibrary.Dummy__ 83 var _ m_Streams.Dummy__ 84 var _ m_Sorting.Dummy__ 85 var _ m_HexStrings.Dummy__ 86 var _ m_GetOpt.Dummy__ 87 var _ m_FloatCompare.Dummy__ 88 var _ m_Base64.Dummy__ 89 var _ m_Base64Lemmas.Dummy__ 90 var _ m_Actions.Dummy__ 91 var _ m_JSON_Utils_Views_Core.Dummy__ 92 var _ m_JSON_Utils_Views_Writers.Dummy__ 93 var _ m_JSON_Utils_Lexers_Core.Dummy__ 94 95 type Dummy__ struct{} 96 97 // Definition of class Default__ 98 type Default__ struct { 99 dummy byte 100 } 101 102 func New_Default___() *Default__ { 103 _this := Default__{} 104 105 return &_this 106 } 107 108 type CompanionStruct_Default___ struct { 109 } 110 111 var Companion_Default___ = CompanionStruct_Default___{} 112 113 func (_this *Default__) Equals(other *Default__) bool { 114 return _this == other 115 } 116 117 func (_this *Default__) EqualsGeneric(x interface{}) bool { 118 other, ok := x.(*Default__) 119 return ok && _this.Equals(other) 120 } 121 122 func (*Default__) String() string { 123 return "JSON_Utils_Lexers_Strings.Default__" 124 } 125 func (_this *Default__) ParentTraits_() []*_dafny.TraitID { 126 return [](*_dafny.TraitID){} 127 } 128 129 var _ _dafny.TraitOffspring = &Default__{} 130 131 func (_static *CompanionStruct_Default___) StringBody(escaped bool, byte_ int16) m_JSON_Utils_Lexers_Core.LexerResult { 132 if (byte_) == (int16(_dafny.Char('\\'))) { 133 return m_JSON_Utils_Lexers_Core.Companion_LexerResult_.Create_Partial_(!(escaped)) 134 } else if ((byte_) == (int16(_dafny.Char('"')))) && (!(escaped)) { 135 return m_JSON_Utils_Lexers_Core.Companion_LexerResult_.Create_Accept_() 136 } else { 137 return m_JSON_Utils_Lexers_Core.Companion_LexerResult_.Create_Partial_(false) 138 } 139 } 140 func (_static *CompanionStruct_Default___) String(st StringLexerState, byte_ int16) m_JSON_Utils_Lexers_Core.LexerResult { 141 var _source0 StringLexerState = st 142 _ = _source0 143 { 144 if _source0.Is_Start() { 145 if (byte_) == (int16(_dafny.Char('"'))) { 146 return m_JSON_Utils_Lexers_Core.Companion_LexerResult_.Create_Partial_(Companion_StringLexerState_.Create_Body_(false)) 147 } else { 148 return m_JSON_Utils_Lexers_Core.Companion_LexerResult_.Create_Reject_(_dafny.SeqOfString("String must start with double quote")) 149 } 150 } 151 } 152 { 153 if _source0.Is_End() { 154 return m_JSON_Utils_Lexers_Core.Companion_LexerResult_.Create_Accept_() 155 } 156 } 157 { 158 var _0_escaped bool = _source0.Get_().(StringLexerState_Body).Escaped 159 _ = _0_escaped 160 if (byte_) == (int16(_dafny.Char('\\'))) { 161 return m_JSON_Utils_Lexers_Core.Companion_LexerResult_.Create_Partial_(Companion_StringLexerState_.Create_Body_(!(_0_escaped))) 162 } else if ((byte_) == (int16(_dafny.Char('"')))) && (!(_0_escaped)) { 163 return m_JSON_Utils_Lexers_Core.Companion_LexerResult_.Create_Partial_(Companion_StringLexerState_.Create_End_()) 164 } else { 165 return m_JSON_Utils_Lexers_Core.Companion_LexerResult_.Create_Partial_(Companion_StringLexerState_.Create_Body_(false)) 166 } 167 } 168 } 169 func (_static *CompanionStruct_Default___) StringBodyLexerStart() bool { 170 return false 171 } 172 func (_static *CompanionStruct_Default___) StringLexerStart() StringLexerState { 173 return Companion_StringLexerState_.Create_Start_() 174 } 175 176 // End of class Default__ 177 178 // Definition of datatype StringLexerState 179 type StringLexerState struct { 180 Data_StringLexerState_ 181 } 182 183 func (_this StringLexerState) Get_() Data_StringLexerState_ { 184 return _this.Data_StringLexerState_ 185 } 186 187 type Data_StringLexerState_ interface { 188 isStringLexerState() 189 } 190 191 type CompanionStruct_StringLexerState_ struct { 192 } 193 194 var Companion_StringLexerState_ = CompanionStruct_StringLexerState_{} 195 196 type StringLexerState_Start struct { 197 } 198 199 func (StringLexerState_Start) isStringLexerState() {} 200 201 func (CompanionStruct_StringLexerState_) Create_Start_() StringLexerState { 202 return StringLexerState{StringLexerState_Start{}} 203 } 204 205 func (_this StringLexerState) Is_Start() bool { 206 _, ok := _this.Get_().(StringLexerState_Start) 207 return ok 208 } 209 210 type StringLexerState_Body struct { 211 Escaped bool 212 } 213 214 func (StringLexerState_Body) isStringLexerState() {} 215 216 func (CompanionStruct_StringLexerState_) Create_Body_(Escaped bool) StringLexerState { 217 return StringLexerState{StringLexerState_Body{Escaped}} 218 } 219 220 func (_this StringLexerState) Is_Body() bool { 221 _, ok := _this.Get_().(StringLexerState_Body) 222 return ok 223 } 224 225 type StringLexerState_End struct { 226 } 227 228 func (StringLexerState_End) isStringLexerState() {} 229 230 func (CompanionStruct_StringLexerState_) Create_End_() StringLexerState { 231 return StringLexerState{StringLexerState_End{}} 232 } 233 234 func (_this StringLexerState) Is_End() bool { 235 _, ok := _this.Get_().(StringLexerState_End) 236 return ok 237 } 238 239 func (CompanionStruct_StringLexerState_) Default() StringLexerState { 240 return Companion_StringLexerState_.Create_Start_() 241 } 242 243 func (_this StringLexerState) Dtor_escaped() bool { 244 return _this.Get_().(StringLexerState_Body).Escaped 245 } 246 247 func (_this StringLexerState) String() string { 248 switch data := _this.Get_().(type) { 249 case nil: 250 return "null" 251 case StringLexerState_Start: 252 { 253 return "Strings.StringLexerState.Start" 254 } 255 case StringLexerState_Body: 256 { 257 return "Strings.StringLexerState.Body" + "(" + _dafny.String(data.Escaped) + ")" 258 } 259 case StringLexerState_End: 260 { 261 return "Strings.StringLexerState.End" 262 } 263 default: 264 { 265 return "<unexpected>" 266 } 267 } 268 } 269 270 func (_this StringLexerState) Equals(other StringLexerState) bool { 271 switch data1 := _this.Get_().(type) { 272 case StringLexerState_Start: 273 { 274 _, ok := other.Get_().(StringLexerState_Start) 275 return ok 276 } 277 case StringLexerState_Body: 278 { 279 data2, ok := other.Get_().(StringLexerState_Body) 280 return ok && data1.Escaped == data2.Escaped 281 } 282 case StringLexerState_End: 283 { 284 _, ok := other.Get_().(StringLexerState_End) 285 return ok 286 } 287 default: 288 { 289 return false // unexpected 290 } 291 } 292 } 293 294 func (_this StringLexerState) EqualsGeneric(other interface{}) bool { 295 typed, ok := other.(StringLexerState) 296 return ok && _this.Equals(typed) 297 } 298 299 func Type_StringLexerState_() _dafny.TypeDescriptor { 300 return type_StringLexerState_{} 301 } 302 303 type type_StringLexerState_ struct { 304 } 305 306 func (_this type_StringLexerState_) Default() interface{} { 307 return Companion_StringLexerState_.Default() 308 } 309 310 func (_this type_StringLexerState_) String() string { 311 return "JSON_Utils_Lexers_Strings.StringLexerState" 312 } 313 func (_this StringLexerState) ParentTraits_() []*_dafny.TraitID { 314 return [](*_dafny.TraitID){} 315 } 316 317 var _ _dafny.TraitOffspring = StringLexerState{} 318 319 // End of datatype StringLexerState