diff --git a/Makefile b/Makefile index 2c4166d..4598cb6 100644 --- a/Makefile +++ b/Makefile @@ -16,9 +16,6 @@ FILES= \ semgrep_output_$(VER).ts \ semgrep_output_$(VER).jsonschema \ semgrep_output_$(VER).proto \ - ast_generic_$(VER).py \ - ast_generic_$(VER)_j.ml \ - ast_generic_$(VER)_j.mli \ Language.ml \ Language.mli \ lang.json \ diff --git a/ast_generic_v1.atd b/ast_generic_v1.atd deleted file mode 100644 index 991ea75..0000000 --- a/ast_generic_v1.atd +++ /dev/null @@ -1,1031 +0,0 @@ -(* Yoann Padioleau - * - * Copyright (C) 2021-2023 r2c - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation, with the - * special exception on linking described in file license.txt. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file - * license.txt for more details. -*) - -(*****************************************************************************) -(* Prelude *) -(*****************************************************************************) -(* Type definitions for the generic AST in the ATD format. - * See semgrep-core/src/core/ast/AST_generic.ml for more information on - * the generic AST. - * See https://github.com/ahrefs/atd for more information on ATD. - * - * The definitions in this file are used to export the generic AST to JSON - * so that other languages (e.g., Python, Javascript) can leverage the - * generic AST. Those definitions can also be exported in a typed form to - * other typed languages (e.g., Java, Scala, Typescript, Mypy), which - * provides stronger guarantees when working on the generic AST. - * - * DO NOT MODIFY THIS FILE. The "API" defined here should be stable - * across multiple versions of Semgrep. If you really want to change - * things, you'll have to define an AST_generic_v2.atd - * - * If you do modify this file, please do not use the 'option' type in non-optional - * fields. Prefer 'nullable' if possible. - * For example '?foo: int option;' is fine, but not 'foo: int option;' - * Prefer in that case 'foo: int nullable'. - * This is because the 'option' type is not supported by atdpy because there - * is no real option type in Python/Mypy. - * - * history: process to atd-ify AST_generic.ml: - * - add [] around variants - * - add () around tuple types - * - s/and/type for mutually recursive types - * - remove ref types - * - s/wrap/wrap_ - *) - -(*****************************************************************************) -(* Parse_info *) -(*****************************************************************************) -(* start of "atd-ification" of pfff/h_program-lang/Parse_info.ml *) - -type token_location = { - str: string; (* the content of the "token" *) - charpos: int; (* byte position, 0-based *) - line: int; (* 1-based *) - column: int; (* 0-based *) - filename: string; -} - -type token = [ - | OriginTok of token_location - | FakeTok of string -] - -(*****************************************************************************) -(* Token (leaf) *) -(*****************************************************************************) -(* start of "atd-ification" of semgrep-core/src/core/ast/AST_generic.ml *) - -type tok = token - -(* a shortcut to annotate some information with position information *) -(* atd: 'wrap' is a predefined type name in ATD, hence the '_' here *) -type 'a wrap_ = ('a * tok) - -(* use for round(), square[], curly{}, and angle<> brackets. *) -type 'a bracket = (tok * 'a * tok) - -(* semicolon (FakeTok in languages that do not require them (e.g., Python))*) -type sc = tok - -(* an AST element not yet handled *) -type todo_kind = string wrap_ - -(*****************************************************************************) -(* Names *) -(*****************************************************************************) -type ident = string wrap_ - -(* usually separated by a '.', but can be used also with '::' separators *) -type dotted_ident = ident list (* at least 1 element *) - -(* module_name can also be used for a package name or a namespace *) -type module_name = [ - | DottedName of dotted_ident (* ex: Python *) - (* in FileName the '/' is similar to the '.' in DottedName *) - | FileName of string wrap_ (* ex: Js import, C #include, Go import *) - ] - -(* A single unique id: sid (uid would be a better name, but it usually - * means "user id" for people). See Naming_AST.ml for more information. -*) -type sid = int (* a single unique gensym'ed number *) - -type resolved_name = (resolved_name_kind * sid) - -(* EXPERIMENTAL *) -type resolved_name_kind = [ - | Global - | Local - | Param - | ImportedEntity of dotted_ident - | ImportedModule of module_name - | OtherResolvedNameKind of string - ] - -type name = [ - | Id of (ident * id_info) - | IdQualified of qualified_info - ] - -type qualified_info = { - name_last : (ident * type_arguments nullable); - ?name_middle : qualifier option; - (* ::, Ruby, C++, also '`' abuse for PolyVariant in OCaml *) - ?name_top : tok option; - name_info : id_info; -} - -type qualifier = [ - (* Java/C++/Rust *) - | QDots of (ident * type_arguments nullable) list - (* Ruby/Lua *) - | QExpr of (expr * tok) - ] - -(*****************************************************************************) -(* Naming/typing *) -(*****************************************************************************) - -(* EXPERIMENTAL *) -type id_info = { - ?id_resolved: resolved_name option; (* variable tagger (naming) *) - ?id_type: type_ option; (* type checker (typing) *) - ?id_svalue: svalue option; (* constant propagation *) -} - -(*****************************************************************************) -(* Expression *) -(*****************************************************************************) - -type expr = [ - (* basic (atomic) values *) - | L of literal - - (* composite values *) - | Container of (container_operator * expr list bracket) - | Comprehension of (container_operator * comprehension bracket) - - (* And-type (field.vinit should be a Some) *) - | Record of field list bracket - - (* Or-type (could be used instead of Container, Cons, Nil, etc.). - * (ab)used also for polymorphic variants where qualifier is QTop with - * the '`' token. - *) - | Constructor of (name * expr list bracket) - - | N of name - - | IdSpecial of special wrap_ - - (* operators and function application *) - | Call of (expr * arguments) - - (* 'type_' below is usually a TyN or TyArray (or TyExpr). - * Note that certain languages do not have a 'new' keyword - * (e.g., Python, Scala 3), instead certain 'Call' are really 'New'. - *) - | New of (tok (* 'new' (can be fake) *) * type_ * arguments) - - (* (XHP, JSX, TSX), could be transpiled also *) - | Xml of xml - - (* IntepolatedString of expr list is simulated with a - * Call(IdSpecial (Concat ...)) *) - - (* The left part should be an lvalue (Id, DotAccess, ArrayAccess, Deref) - * but it can also be a pattern (Tuple, Container, even Record). - *) - | Assign of (expr * tok (* '=', '<-' in OCaml. ':=' Go is AssignOp (Eq) *) * - expr) - - | AssignOp of (expr * operator wrap_ * expr) - | LetPattern of (pattern * expr) - - (* can be used for Record, Class, or Module access depending on expr. *) - | DotAccess of (expr * tok (* ., ::, ->, # *) * field_name) - - (* in Js ArrayAccess is also abused to perform DotAccess (..., FDynamic) *) - | ArrayAccess of (expr * expr bracket) - - | SliceAccess of ( - expr - * (expr nullable (* lower *) - * expr nullable (* upper *) - * expr nullable (* step *)) bracket - ) - - (* very special value *) - | Lambda of function_definition - (* usually an argument of a New (used in Java, Javascript) *) - | AnonClass of class_definition - - (* a.k.a ternary expression, or regular if in OCaml *) - | Conditional of (expr * expr * expr) - - | Yield of (tok * expr nullable * bool) (* 'from' for Python *) - | Await of (tok * expr) - - | Cast of (type_ * expr) - | Seq of expr list (* at least 2 elements *) - - | Ref of (tok (* &, address of *) * expr) - | DeRef of (tok (* '*' in C, '!' or '<-' in OCaml, ^ in Reason *) * expr) - - (* in theory we removed all semgrep-specific constructs but some - * languages support ellipsis (e.g., Python) *) - | Ellipsis of tok - - | ParenExpr of expr bracket - (* Dual of ExprStmt. OCaml/Ruby/Scala/... have just expressions, - * not separate statements *) - | StmtExpr of stmt - - | OtherExpr of (todo_kind * any list) - ] - -type literal = [ - | Bool of bool wrap_ - (* the numbers are an option because OCaml numbers (e.g., 63bits int) - * may not be able to represent all numbers. - *) - | Int of int nullable wrap_ | Float of float nullable wrap_ - | Char of string wrap_ | String of string wrap_ - | Regexp of (string wrap_ bracket (* // *) - * string wrap_ nullable (* modifiers *)) - | Atom of (tok * string wrap_) (* Ruby *) - | Unit of tok (* a.k.a Void *) | Null of tok | Undefined of tok (* JS *) - | Imag of string wrap_ (* Go, Python *) | Ratio of string wrap_ (* Ruby *) - ] - -(* The type of an unknown constant. *) -type const_type = [ Cbool | Cint | Cstr | Cany ] - -(* semantic value: set by the svalue propagation algorithm *) -type svalue = [ Lit of literal | Cst of const_type | Sym of expr | NotCst ] - -type container_operator = [ - | Array - | List | Set - | Dict (* a.k.a Hash or Map (combine with Tuple to get Key/value pair) *) - | Tuple - ] - -(* For Python/HCL (and Haskell later). The 'expr' can be a 'Tuple' to - * represent a Key/Value pair (like in Container). *) -type comprehension = (expr * for_or_if_comp list) - -(* at least one element *) -type for_or_if_comp = [ - | CompFor of (tok (*'for'*) * pattern * tok (* 'in' *) * expr) - | CompIf of (tok (*'if'*) * expr) -] - -type field_name = [ - | FN of name - (* for PHP/JS fields (even though JS use ArrayAccess for that), or Ruby - * or C++ ArrowStarAccess ->* - *) - | FDynamic of expr -] - -(* EXPERIMENTAL *) -type special = [ - (* special vars *) - | This | Super (* called 'base' in C# *) - | Cls (* similar to `self`, but indicating the type of the class, not the instance *) - | Self | Parent (* different from This/Super? *) - - (* special calls *) - | Eval - | Typeof (* for C? and Go in switch x.(type) *) - | Instanceof | Sizeof (* takes a ArgType *) - | Defined (* defined? in Ruby, other? *) - - (* used for interpolated strings constructs *) - | ConcatString of concat_string_kind - | EncodedString of string (* only for Python for now (e.g., b"foo") *) - | InterpolatedElement - - (* "Inline" the content of a var containing a list (a.k.a a Splat in Ruby). - * Used in a Container or Call argument context. - * The corresponding constructor in a parameter context is ParamRest. - *) - | Spread (* ...x in JS, *x in Python/Ruby *) - (* Similar to Spread, but for a var containing a hashtbl. - * The corresponding constructor in a parameter context is ParamHashSplat. - *) - | HashSplat (* **x in Python/Ruby - * (not to confused with Pow below which is a Binary op *) - - | ForOf (* Javascript, for generators, used in ForEach *) - - (* used for unary and binary operations *) - | Op of operator - | IncrDecr of (incr_decr * prefix_postfix) - (* JS: `require('foo')` *) - | Require - | OtherSpecial of string - ] - -(* mostly binary operators. - * Note that Mod can be used for %style string formatting in Python. - * Note that Plus can also be used for string concatenations in Go/??. -*) -type operator = [ - | Plus (* unary too *) | Minus (* unary too *) - | Mult | Div | Mod - | Pow (* ** binary op; for unary see HashSplat above *) - | FloorDiv | MatMult (* Python *) - | LSL | LSR | ASR (* L = logic, A = Arithmetic, SL = shift left *) - | BitOr | BitXor | BitAnd | BitNot (* unary *) | BitClear (* Go *) - | And | Or (* also shortcut operator *) | Xor (* PHP*) - | Not (* unary *) - | Eq (* '=' in OCaml, '==' in Go/... *) - | NotEq - | PhysEq (* '==' in OCaml, '===' in JS/... *) - | NotPhysEq - | Lt | LtE | Gt | GtE - | Cmp (* <=>, PHP *) - | Concat (* '.' PHP, '..' Lua *) - | Append (* x[] = ... in PHP, just in AssignOp *) - | RegexpMatch (* =~, Ruby (and Perl) *) - | NotMatch (* !~ Ruby *) - | Range (* .. or ..., Ruby, one arg can be nil for endless range *) - | RangeInclusive (* '..=' in Rust *) - | NotNullPostfix (* ! in Typescript, postfix operator *) - | Length (* '#' in Lua *) - | Elvis (* ?: in Kotlin, can compare possible null value *) - | Nullish (* ?? in Javascript *) - | In (* in: checks that value belongs to a collection *) | NotIn (* !in *) - | Is (* is: checks value has type *) | NotIs (* !is: *) - (* Shell & and | *) - | Background - | Pipe - | LDA - | RDA - | LSA - | RSA - ] - -type incr_decr = [Incr | Decr] (* '++', '--' *) - -type prefix_postfix = [Prefix | Postfix] - -(* EXPERIMENTAL *) -type concat_string_kind = [ - (* many languages do not require a special syntax to use interpolated - * strings e.g. simply "this is {a}". Javascript uses backquotes. - *) - | InterpolatedConcat (* Javascript/PHP/Ruby/Perl *) - (* many languages have a binary Concat operator to concatenate strings, - * but some languages also allow the simple juxtaposition of multiple - * strings to be concatenated, e.g. "hello" "world" in Python. - *) - | SequenceConcat (* Python/C *) - (* Python requires the special f"" syntax to use interpolated strings, - * and some semgrep users may want to explicitely match only f-strings, - * which is why we record this information here. - *) - | FString of string(* Python *) - (* Javascript uses a special syntax called tagged template literals, e.g., - * foo`template string = ${id}`. - *) - | TaggedTemplateLiteral - ] - -(* this is for JSX/TSX in javascript land *) -type xml = { - xml_kind: xml_kind; - xml_attrs: xml_attribute list; - xml_body: xml_body list; -} - -type xml_kind = [ - | XmlClassic of (tok (*'<'*) * ident * tok (*'>'*) * tok) (*''*) - | XmlSingleton of (tok (*'<'*) * ident * tok) (* '/>', with xml_body = [] *) - (* React/JS specific *) - | XmlFragment of (tok (* '<>' *) * tok) (* '', with xml_attrs = [] *) - ] - -type xml_attribute = [ - | XmlAttr of (ident * tok (* = *) * xml_attr_value) - (* jsx: usually a Spread operation, e.g., *) - | XmlAttrExpr of expr bracket - ] - -(* either a String or a bracketed expr, but right now we just use expr *) -type xml_attr_value = expr - -type xml_body = [ - | XmlText of string wrap_ - (* this can be None when people abuse {} to put comments in it *) - | XmlExpr of expr nullable bracket - | XmlXml of xml - ] - -(* brackets can be fake '()' for OCaml/Ruby *) -type arguments = argument list bracket - -type argument = [ - (* regular argument *) - | Arg of expr (* can be Call (IdSpecial Spread, Id foo) *) - (* keyword argument *) - | ArgKwd of (ident * expr) - (* optional keyword argument - can occur in target code without being - specified in the pattern *) - | ArgKwdOptional of (ident * expr) - (* type argument for New, instanceof/sizeof/typeof, C macros *) - | ArgType of type_ - | OtherArg of (todo_kind * any list) - ] - -(*****************************************************************************) -(* Statement *) -(*****************************************************************************) - -type stmt = [ - | ExprStmt of (expr * sc) (* fake tok in Python, but also in JS/Go with ASI*) - - | Block of stmt list bracket (* can be fake {} in Python where use layout *) - - | If of (tok (* 'if' or 'elif' *) * condition * stmt * stmt nullable) - | While of (tok * condition * stmt) - - | Return of (tok * expr nullable * sc) - - | DoWhile of (tok * stmt * expr) - | For of (tok (* 'for', 'foreach'*) * for_header * stmt) - - (* The expr can be None for Go and Ruby. *) - | Switch of (tok (* 'switch' or also 'select' in Go *) - * condition nullable - * case_and_body list) - - | Continue of (tok * label_ident * sc) - | Break of (tok * label_ident * sc) - - | Label of (label * stmt) - | Goto of (tok * label) - - | Throw of (tok (* 'raise' in OCaml, 'throw' in Java/PHP *) * expr * sc) - | Try of (tok * stmt * catch list * finally nullable) - | WithUsingResource of (tok (* 'with' in Python, 'using' in C# *) - * stmt list - * stmt) - | Assert of (tok * arguments * sc) - - | DefStmt of definition - | DirectiveStmt of directive - - | OtherStmt of (todo_kind * any list) - ] - -type condition = [ - | Cond of expr - | OtherCond of (todo_kind * any list) -] - -type case_and_body = [ - | CasesAndBody of (case list * stmt) - ] - -type case = [ - | Case of (tok * pattern) - | Default of tok - (* For Go, expr can contain some Assign bindings. *) - | CaseEqualExpr of (tok * expr) - | OtherCase of (todo_kind * any list) - ] - -type catch = (tok (* 'catch', 'except' in Python *) * catch_exn * stmt) - -type catch_exn = [ - | CatchPattern of pattern - (* for Java/C++/PHP/etc. *) - | CatchParam of parameter_classic - | OtherCatch of (todo_kind * any list) -] - -type finally = (tok (* 'finally' *) * stmt) - -type label = ident - -type label_ident = [ - | LNone (* C/Python *) - | LId of label (* Java/Go *) - | LInt of int wrap_ (* PHP *) - | LDynamic of expr (* PHP, woohoo, dynamic break! bailout for CFG *) - ] - -type for_header = [ - | ForClassic of (for_var_or_expr list (* init *) * - expr nullable (* cond *) * - expr nullable) (* next *) - | ForEach of for_each - (* Scala *) - | MultiForEach of multi_for_each list - - | ForIn of (for_var_or_expr list (* init *) * - expr list) (* pattern 'in' expr *) - ] - -type for_var_or_expr = [ - | ForInitVar of (entity * variable_definition) - | ForInitExpr of expr - ] - -type for_each = - (pattern - * tok (* 'in' Python, 'range' Go, 'as' PHP, '' Java *) - * expr) (* pattern 'in' expr *) - -type multi_for_each = [ - | FE of for_each - | FECond of (for_each * tok * expr) -] - -(*****************************************************************************) -(* Pattern *) -(*****************************************************************************) -(* This is quite similar to expr. A few constructs in expr have - * equivalent here prefixed with Pat (e.g., PaLiteral, PatId). -*) - -type pattern = [ - | PatLiteral of literal - (* Or-Type, used also to match OCaml exceptions *) - (* Used with Rust path expressions, with an empty pattern list *) - | PatConstructor of (name * pattern list) - (* And-Type*) - | PatRecord of (dotted_ident * pattern) list bracket - - | PatId of (ident * id_info) (* Usually Local/Param, Global in toplevel let*) - - (* special cases of PatConstructor *) - | PatTuple of pattern list bracket (* at least 2 elements *) - | PatList of pattern list bracket - | PatKeyVal of (pattern * pattern) (* a kind of PatTuple *) - - (* special case of PatId *) - | PatWildcard of tok - - (* OCaml *) - | PatDisj of (pattern * pattern) (* also abused for catch in Java *) - | PatTyped of (pattern * type_) - | PatWhen of (pattern * expr) - | PatAs of (pattern * (ident * id_info)) - - (* For Go also in switch x.(type) { case int: ... } *) - | PatType of type_ - - | OtherPat of (todo_kind * any list) - ] - -(*****************************************************************************) -(* Type *) -(*****************************************************************************) - -type type_ = [ - | TyN of name - (* covers tuples, list, etc. *) - | TyApply of (type_ * type_arguments) - - | TyFun of (parameter list * type_ (* return type *)) - - (* a special case of TApply, also a special case of TPointer *) - | TyArray of ((* const_expr *) expr nullable bracket * type_) - | TyTuple of type_ list bracket - - | TyVar of ident (* type variable in polymorphic types (not a typedef) *) - | TyAny of tok (* anonymous type, '_' in OCaml *) - - | TyPointer of (tok * type_) - | TyRef of (tok * type_) (* C++/Rust *) - - | TyQuestion of (type_ * tok) (* a.k.a option type *) - | TyRest of (tok * type_) (* '...foo' e.g. in a typescript tuple type *) - - (* intersection types, used for Java Cast, and in Typescript *) - | TyAnd of (type_ * tok (* & *) * type_) - (* union types in Typescript *) - | TyOr of (type_ * tok (* | *) * type_) - - (* Anonymous record type, a.k.a shape in PHP/Hack. See also AndType. - * Most record types are defined via a TypeDef and are then referenced - * via a TyName. Here we have flexible record types (a.k.a. rows in OCaml). - *) - | TyRecordAnon of (class_kind wrap_ (* 'struct/shape', fake in other *) - * field list bracket) - - (* For languages such as Python which abuse expr to represent types.*) - | TyExpr of expr - | OtherType of (todo_kind * any list) - ] - -type type_arguments = type_argument list bracket - -type type_argument = [ - | TA of type_ - (* Java only *) - | TAWildcard of ( - tok (* '?' *) - * (bool wrap_ (* extends|super, true=super *) * type_) nullable - ) - (* C++/Rust (Rust restrict expr to literals and ConstBlock) *) - | TAExpr of expr - | OtherTypeArg of (todo_kind * any list) -] - -(*****************************************************************************) -(* Attribute *) -(*****************************************************************************) -(* a.k.a decorators, annotations *) - -type attribute = [ - | KeywordAttr of keyword_attribute wrap_ - (* for general @annotations. *) - | NamedAttr of (tok (* @ *) * name * arguments) - - | OtherAttribute of (todo_kind * any list) - ] - -type keyword_attribute = [ - | Static | Volatile | Extern - (* for class fields *) - | Public | Private | Protected - | Abstract | Final - | Override (* override *) - (* for classes (mostly for JVM languages) *) - (* Scala 'case class', Java 'record', Kotlin 'data class' *) - | RecordClass - (* '@interface' in Java, 'annotation class' in Kotlin *) - | AnnotationClass - | EnumClass - (* for Scala and Java *) - | SealedClass - (* for vars (JS) *) - | Var | Let - (* for fields (kinda types) *) - | Mutable | Const (* a.k.a 'readonly' in Typescript *) - | Optional (* Typescript '?' *) | NotNull (* Typescript '!' *) - (* for functions *) - | Recursive | MutuallyRecursive - | Generator (* '*' in JS *) | Async - | Inline - (* for methods *) - | Ctor | Dtor - | Getter | Setter - (* Rust *) - | Unsafe - | DefaultImpl (* unstable, RFC 1210 *) - (* Scala and Swift *) - | Lazy - (* Swift *) - | Throws | Rethrows - | OtherKeyword of string - ] - -(*****************************************************************************) -(* Definitions *) -(*****************************************************************************) -(* definition (or just declaration sometimes) *) - -type definition = (entity * definition_kind) - -type entity = { - (* In Ruby you can define a class with a qualified name as in - * class A::B::C, and even dynamically. - * In C++ you can define a method with a class qualifier outside a class, - * hence the use of entity_name below and not just ident. - *) - name: entity_name; - attrs: attribute list; - tparams: type_parameters; -} - -type entity_name = [ - | EN of name - | EDynamic of expr - | EPattern of pattern - - | OtherEntity of (todo_kind * any list) -] - -type definition_kind = [ - (* can be used also for methods, nested functions, lambdas. *) - | FuncDef of function_definition - (* can be used also for constants. *) - | VarDef of variable_definition - - | ClassDef of class_definition - - (* just inside a ClassDef with EnumClass *) - | EnumEntryDef of enum_entry_definition - - | TypeDef of type_definition - - | ModuleDef of module_definition - | MacroDef of macro_definition - - (* in a header file (e.g., .mli in OCaml or 'module sig') *) - | Signature of type_ - - (* Only used inside a function. - * Needed for languages without local VarDef (e.g., Python/PHP) - * where the first use is also its declaration. In that case when we - * want to access a global we need to disambiguate with creating a new - * local. - *) - | UseOuterDecl of tok (* 'global' or 'nonlocal' in Python, 'use' in PHP *) - - | OtherDef of (todo_kind * any list) - ] - - -(* template/generics/polymorphic-type *) -type type_parameter = [ - | TP of type_parameter_classic - - | OtherTypeParam of (todo_kind * any list) -] - -type type_parameter_classic = { - (* note: in Scala the ident can be a wildcard.*) - tp_id : ident; - tp_attrs : attribute list; - (* upper type bounds (must-be-a-subtype-of) *) - tp_bounds : type_ list; - (* for Rust/C++. Similar to parameter_classic, but with type here. *) - tp_default : type_ nullable; - (* declaration-site variance (Kotlin/Hack/Scala) *) - tp_variance : variance wrap_ nullable; -} - -(* TODO bracket *) -type type_parameters = type_parameter list - -(* less: have also Invariant? *) -type variance = [ - (* '+' in Scala/Hack, 'out' in C#/Kotlin *) - | Covariant - (* '-' in Scala/Hack, 'in' in C#/Kotlin *) - | Contravariant -] - -(* ------------------------------------------------------------------------- *) -(* Function (or method) definition *) -(* ------------------------------------------------------------------------- *) - -type function_definition = { - fkind: function_kind wrap_; - fparams: parameters; - frettype: type_ nullable; (* return type *) - fbody: function_body; -} - -type function_kind = [ - | Function - | Method - | LambdaKind - (* a.k.a short lambdas *) - | Arrow - (* for Scala *) - | BlockCases - ] - -type parameters = parameter list - -type parameter = [ - | ParamClassic of parameter_classic - - | ParamPattern of pattern (* in OCaml, but also now JS, and Python2 *) - - | ParamRest of (tok (* '...' in JS, '*' in Python *) * parameter_classic) - | ParamHashSplat of (tok (* '**' in Python *) * parameter_classic) - - | OtherParam of (todo_kind * any list) - ] - - -type parameter_classic = { - pname: ident nullable; - ptype: type_ nullable; - pdefault: expr nullable; - - pattrs: attribute list; - - (* naming *) - pinfo: id_info; (* Always Param *) -} - -type function_body = [ - (* usually just a Block (where the brackets are fake in Ruby/Python/...) *) - | FBStmt of stmt - (* used for short lambdas in JS/Python, or regular func in OCaml/... *) - | FBExpr of expr - (* C/C++ prototypes or interface method declarations in Go/Java/... *) - | FBDecl of sc - (* Partial *) - | FBNothing -] - -(* ------------------------------------------------------------------------- *) -(* Variable definition *) -(* ------------------------------------------------------------------------- *) -(* Also used for constant_definition with attrs = [Const]. - * Also used for field definition in a class (and record). -*) - -type variable_definition = { - ?vinit: expr option; - ?vtype: type_ option; -} - -(* ------------------------------------------------------------------------- *) -(* Type definition *) -(* ------------------------------------------------------------------------- *) - -type type_definition = { - tbody: type_definition_kind; -} - -type type_definition_kind = [ - (* Algrebraic data types (ADTs), and basic enums. - * For enum class see class_definition *) - | OrType of or_type_element list - (* Record definitions (for struct/class, see class_definition). - * The fields will be defined via a DefStmt (VarDef variable_definition) - * where the field.vtype should be defined. - *) - | AndType of field list bracket - - (* a.k.a typedef in C (and alias type in Go) *) - | AliasType of type_ - (* Haskell/Hack/Go ('type x foo' vs 'type x = foo' in Go) *) - | NewType of type_ - (* OCaml/Rust *) - | AbstractType of tok (* usually a fake token *) - | Exception of (ident (* same name than entity *) * type_ list) - - | OtherTypeKind of (todo_kind * any list) - ] - - -type or_type_element = [ - (* OCaml *) - | OrConstructor of (ident * type_ list) - (* C *) - | OrEnum of (ident * expr nullable) - (* Java? *) - | OrUnion of (ident * type_) - - | OtherOr of (todo_kind * any list) - ] - -(* ------------------------------------------------------------------------- *) -(* Object/struct/record/class field definition *) -(* ------------------------------------------------------------------------- *) - -(* Field definition and use, for classes, objects, and records. - * note: I don't call it field_definition because it's used both to - * define the shape of a field (a definition), and when creating - * an actual field (a value). -*) -type field = [ - | F of stmt -] - -(* ------------------------------------------------------------------------- *) -(* Class definition *) -(* ------------------------------------------------------------------------- *) - -type class_definition = { - ckind: class_kind wrap_; - - (* usually just one parent, and type_ should be a TyN *) - cextends: class_parent list; - (* class_kind in type_ must be Interface *) - cimplements: type_ list; - (* class_kind in type_ is usually a Trait *) - cmixins: type_ list; (* PHP 'uses' *) - - (* for Java Record or Scala Classes; we could transpile them into fields *) - cparams: parameters; - cbody: field list bracket; -} - -type class_kind = [ - | Class - | Interface - | Trait - (* Kotlin, Scala *) - | Object - ] - -(* A parent can have arguments in Scala/Java/Kotlin (because constructors - * can be defined in the class header via cparams and then this class - * header can call its parent constructor using those cparams). - *) -type class_parent = (type_ * arguments nullable) - -(* ------------------------------------------------------------------------- *) -(* Enum entry *) -(* ------------------------------------------------------------------------- *) -(* for EnumClass, complex enums-as-classes in Java/Kotlin/Scala? *) -type enum_entry_definition = { - (* the enum identifier is in the corresponding entity *) - ee_args : arguments nullable; - ee_body : field list bracket nullable; -} - -(* ------------------------------------------------------------------------- *) -(* Module definition *) -(* ------------------------------------------------------------------------- *) - -type module_definition = { - mbody: module_definition_kind; -} - -type module_definition_kind = [ - | ModuleAlias of dotted_ident - | ModuleStruct of (dotted_ident nullable * item list) - - | OtherModule of (todo_kind * any list) - ] - -(* ------------------------------------------------------------------------- *) -(* Macro definition *) -(* ------------------------------------------------------------------------- *) -(* Used by cpp in C/C++ *) - -type macro_definition = { - macroparams: ident list; - macrobody: any list; -} - -(*****************************************************************************) -(* Directives (Module import/export, package) *) -(*****************************************************************************) - -type directive = [ - | ImportFrom of ( - tok (* 'import'/'from' for Python, 'include' for C *) - * module_name - * import_from_kind list - ) - - | ImportAs of (tok * module_name * alias nullable) (* as name *) - | ImportAll of (tok * module_name * tok) (* '.' in Go, '*' in Java/Python *) - - (* packages are different from modules in that multiple files can reuse - * the same package name; they are agglomarated in the same package - *) - | Package of (tok * dotted_ident) (* a.k.a namespace *) - (* for languages such as C++/PHP with scoped namespaces *) - | PackageEnd of tok - - | Pragma of (ident * any list) - - | OtherDirective of (todo_kind * any list) - ] - -(* ... as name *) -type alias = (ident * id_info) - -type import_from_kind = [ - | Direct of alias - | Aliased of (ident * alias) - ] - -(*****************************************************************************) -(* Toplevel *) -(*****************************************************************************) -type item = stmt - -type program = item list - -(*****************************************************************************) -(* Any *) -(*****************************************************************************) - -(* EXPERIMENTAL *) -type any = [ - | E of expr - | S of stmt - | T of type_ - | P of pattern - | At of attribute - | Fld of field - | Ar of argument - | Pa of parameter - | Ta of type_argument - | Tp of type_parameter - | Ce of catch_exn - | Cs of case - | ForOrIfComp of for_or_if_comp - | En of entity - (* misc *) - | I of ident - | Modn of module_name - | Di of dotted_ident - | Lbli of label_ident - | Str of string wrap_ - | Tk of tok - | TodoK of todo_kind - | Anys of (any list) - ] diff --git a/ast_generic_v1.py b/ast_generic_v1.py deleted file mode 100644 index 1a69cbd..0000000 --- a/ast_generic_v1.py +++ /dev/null @@ -1,10096 +0,0 @@ -"""Generated by atdpy from type definitions in ast_generic_v1.atd. - -This implements classes for the types defined in 'ast_generic_v1.atd', providing -methods and functions to convert data from/to JSON. -""" - -# Disable flake8 entirely on this file: -# flake8: noqa - -# Import annotations to allow forward references -from __future__ import annotations -from dataclasses import dataclass, field -from typing import Any, Callable, Dict, List, NoReturn, Optional, Tuple, Union - -import json - -############################################################################ -# Private functions -############################################################################ - - -def _atd_missing_json_field(type_name: str, json_field_name: str) -> NoReturn: - raise ValueError(f"missing field '{json_field_name}'" - f" in JSON object of type '{type_name}'") - - -def _atd_bad_json(expected_type: str, json_value: Any) -> NoReturn: - value_str = str(json_value) - if len(value_str) > 200: - value_str = value_str[:200] + '…' - - raise ValueError(f"incompatible JSON value where" - f" type '{expected_type}' was expected: '{value_str}'") - - -def _atd_bad_python(expected_type: str, json_value: Any) -> NoReturn: - value_str = str(json_value) - if len(value_str) > 200: - value_str = value_str[:200] + '…' - - raise ValueError(f"incompatible Python value where" - f" type '{expected_type}' was expected: '{value_str}'") - - -def _atd_read_unit(x: Any) -> None: - if x is None: - return x - else: - _atd_bad_json('unit', x) - - -def _atd_read_bool(x: Any) -> bool: - if isinstance(x, bool): - return x - else: - _atd_bad_json('bool', x) - - -def _atd_read_int(x: Any) -> int: - if isinstance(x, int): - return x - else: - _atd_bad_json('int', x) - - -def _atd_read_float(x: Any) -> float: - if isinstance(x, (int, float)): - return x - else: - _atd_bad_json('float', x) - - -def _atd_read_string(x: Any) -> str: - if isinstance(x, str): - return x - else: - _atd_bad_json('str', x) - - -def _atd_read_list( - read_elt: Callable[[Any], Any] - ) -> Callable[[List[Any]], List[Any]]: - def read_list(elts: List[Any]) -> List[Any]: - if isinstance(elts, list): - return [read_elt(elt) for elt in elts] - else: - _atd_bad_json('array', elts) - return read_list - - -def _atd_read_assoc_array_into_dict( - read_key: Callable[[Any], Any], - read_value: Callable[[Any], Any], - ) -> Callable[[List[Any]], Dict[Any, Any]]: - def read_assoc(elts: List[List[Any]]) -> Dict[str, Any]: - if isinstance(elts, list): - return {read_key(elt[0]): read_value(elt[1]) for elt in elts} - else: - _atd_bad_json('array', elts) - raise AssertionError('impossible') # keep mypy happy - return read_assoc - - -def _atd_read_assoc_object_into_dict( - read_value: Callable[[Any], Any] - ) -> Callable[[Dict[str, Any]], Dict[str, Any]]: - def read_assoc(elts: Dict[str, Any]) -> Dict[str, Any]: - if isinstance(elts, dict): - return {_atd_read_string(k): read_value(v) - for k, v in elts.items()} - else: - _atd_bad_json('object', elts) - raise AssertionError('impossible') # keep mypy happy - return read_assoc - - -def _atd_read_assoc_object_into_list( - read_value: Callable[[Any], Any] - ) -> Callable[[Dict[str, Any]], List[Tuple[str, Any]]]: - def read_assoc(elts: Dict[str, Any]) -> List[Tuple[str, Any]]: - if isinstance(elts, dict): - return [(_atd_read_string(k), read_value(v)) - for k, v in elts.items()] - else: - _atd_bad_json('object', elts) - raise AssertionError('impossible') # keep mypy happy - return read_assoc - - -def _atd_read_nullable(read_elt: Callable[[Any], Any]) \ - -> Callable[[Optional[Any]], Optional[Any]]: - def read_nullable(x: Any) -> Any: - if x is None: - return None - else: - return read_elt(x) - return read_nullable - - -def _atd_read_option(read_elt: Callable[[Any], Any]) \ - -> Callable[[Optional[Any]], Optional[Any]]: - def read_option(x: Any) -> Any: - if x == 'None': - return None - elif isinstance(x, List) and len(x) == 2 and x[0] == 'Some': - return read_elt(x[1]) - else: - _atd_bad_json('option', x) - raise AssertionError('impossible') # keep mypy happy - return read_option - - -def _atd_write_unit(x: Any) -> None: - if x is None: - return x - else: - _atd_bad_python('unit', x) - - -def _atd_write_bool(x: Any) -> bool: - if isinstance(x, bool): - return x - else: - _atd_bad_python('bool', x) - - -def _atd_write_int(x: Any) -> int: - if isinstance(x, int): - return x - else: - _atd_bad_python('int', x) - - -def _atd_write_float(x: Any) -> float: - if isinstance(x, (int, float)): - return x - else: - _atd_bad_python('float', x) - - -def _atd_write_string(x: Any) -> str: - if isinstance(x, str): - return x - else: - _atd_bad_python('str', x) - - -def _atd_write_list( - write_elt: Callable[[Any], Any] - ) -> Callable[[List[Any]], List[Any]]: - def write_list(elts: List[Any]) -> List[Any]: - if isinstance(elts, list): - return [write_elt(elt) for elt in elts] - else: - _atd_bad_python('list', elts) - return write_list - - -def _atd_write_assoc_dict_to_array( - write_key: Callable[[Any], Any], - write_value: Callable[[Any], Any] - ) -> Callable[[Dict[Any, Any]], List[Tuple[Any, Any]]]: - def write_assoc(elts: Dict[str, Any]) -> List[Tuple[str, Any]]: - if isinstance(elts, dict): - return [(write_key(k), write_value(v)) for k, v in elts.items()] - else: - _atd_bad_python('Dict[str, ]]', elts) - raise AssertionError('impossible') # keep mypy happy - return write_assoc - - -def _atd_write_assoc_dict_to_object( - write_value: Callable[[Any], Any] - ) -> Callable[[Dict[str, Any]], Dict[str, Any]]: - def write_assoc(elts: Dict[str, Any]) -> Dict[str, Any]: - if isinstance(elts, dict): - return {_atd_write_string(k): write_value(v) - for k, v in elts.items()} - else: - _atd_bad_python('Dict[str, ]', elts) - raise AssertionError('impossible') # keep mypy happy - return write_assoc - - -def _atd_write_assoc_list_to_object( - write_value: Callable[[Any], Any], - ) -> Callable[[List[Any]], Dict[str, Any]]: - def write_assoc(elts: List[List[Any]]) -> Dict[str, Any]: - if isinstance(elts, list): - return {_atd_write_string(elt[0]): write_value(elt[1]) - for elt in elts} - else: - _atd_bad_python('List[Tuple[, ]]', elts) - raise AssertionError('impossible') # keep mypy happy - return write_assoc - - -def _atd_write_nullable(write_elt: Callable[[Any], Any]) \ - -> Callable[[Optional[Any]], Optional[Any]]: - def write_nullable(x: Any) -> Any: - if x is None: - return None - else: - return write_elt(x) - return write_nullable - - -def _atd_write_option(write_elt: Callable[[Any], Any]) \ - -> Callable[[Optional[Any]], Optional[Any]]: - def write_option(x: Any) -> Any: - if x is None: - return 'None' - else: - return ['Some', write_elt(x)] - return write_option - - -############################################################################ -# Public classes -############################################################################ - - -@dataclass -class Class: - """Original type: class_kind = [ ... | Class | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Class' - - @staticmethod - def to_json() -> Any: - return 'Class' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Interface: - """Original type: class_kind = [ ... | Interface | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Interface' - - @staticmethod - def to_json() -> Any: - return 'Interface' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Trait: - """Original type: class_kind = [ ... | Trait | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Trait' - - @staticmethod - def to_json() -> Any: - return 'Trait' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Object: - """Original type: class_kind = [ ... | Object | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Object' - - @staticmethod - def to_json() -> Any: - return 'Object' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ClassKind: - """Original type: class_kind = [ ... ]""" - - value: Union[Class, Interface, Trait, Object] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ClassKind': - if isinstance(x, str): - if x == 'Class': - return cls(Class()) - if x == 'Interface': - return cls(Interface()) - if x == 'Trait': - return cls(Trait()) - if x == 'Object': - return cls(Object()) - _atd_bad_json('ClassKind', x) - _atd_bad_json('ClassKind', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'ClassKind': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class InterpolatedConcat: - """Original type: concat_string_kind = [ ... | InterpolatedConcat | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'InterpolatedConcat' - - @staticmethod - def to_json() -> Any: - return 'InterpolatedConcat' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class SequenceConcat: - """Original type: concat_string_kind = [ ... | SequenceConcat | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'SequenceConcat' - - @staticmethod - def to_json() -> Any: - return 'SequenceConcat' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FString: - """Original type: concat_string_kind = [ ... | FString of ... | ... ]""" - - value: str - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'FString' - - def to_json(self) -> Any: - return ['FString', _atd_write_string(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TaggedTemplateLiteral: - """Original type: concat_string_kind = [ ... | TaggedTemplateLiteral | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TaggedTemplateLiteral' - - @staticmethod - def to_json() -> Any: - return 'TaggedTemplateLiteral' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ConcatStringKind: - """Original type: concat_string_kind = [ ... ]""" - - value: Union[InterpolatedConcat, SequenceConcat, FString, TaggedTemplateLiteral] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ConcatStringKind': - if isinstance(x, str): - if x == 'InterpolatedConcat': - return cls(InterpolatedConcat()) - if x == 'SequenceConcat': - return cls(SequenceConcat()) - if x == 'TaggedTemplateLiteral': - return cls(TaggedTemplateLiteral()) - _atd_bad_json('ConcatStringKind', x) - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'FString': - return cls(FString(_atd_read_string(x[1]))) - _atd_bad_json('ConcatStringKind', x) - _atd_bad_json('ConcatStringKind', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'ConcatStringKind': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Cbool: - """Original type: const_type = [ ... | Cbool | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Cbool' - - @staticmethod - def to_json() -> Any: - return 'Cbool' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Cint: - """Original type: const_type = [ ... | Cint | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Cint' - - @staticmethod - def to_json() -> Any: - return 'Cint' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Cstr: - """Original type: const_type = [ ... | Cstr | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Cstr' - - @staticmethod - def to_json() -> Any: - return 'Cstr' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Cany: - """Original type: const_type = [ ... | Cany | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Cany' - - @staticmethod - def to_json() -> Any: - return 'Cany' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ConstType: - """Original type: const_type = [ ... ]""" - - value: Union[Cbool, Cint, Cstr, Cany] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ConstType': - if isinstance(x, str): - if x == 'Cbool': - return cls(Cbool()) - if x == 'Cint': - return cls(Cint()) - if x == 'Cstr': - return cls(Cstr()) - if x == 'Cany': - return cls(Cany()) - _atd_bad_json('ConstType', x) - _atd_bad_json('ConstType', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'ConstType': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Array: - """Original type: container_operator = [ ... | Array | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Array' - - @staticmethod - def to_json() -> Any: - return 'Array' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class List_: - """Original type: container_operator = [ ... | List | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'List_' - - @staticmethod - def to_json() -> Any: - return 'List' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Set: - """Original type: container_operator = [ ... | Set | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Set' - - @staticmethod - def to_json() -> Any: - return 'Set' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Dict_: - """Original type: container_operator = [ ... | Dict | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Dict_' - - @staticmethod - def to_json() -> Any: - return 'Dict' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Tuple_: - """Original type: container_operator = [ ... | Tuple | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Tuple_' - - @staticmethod - def to_json() -> Any: - return 'Tuple' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ContainerOperator: - """Original type: container_operator = [ ... ]""" - - value: Union[Array, List_, Set, Dict_, Tuple_] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ContainerOperator': - if isinstance(x, str): - if x == 'Array': - return cls(Array()) - if x == 'List': - return cls(List_()) - if x == 'Set': - return cls(Set()) - if x == 'Dict': - return cls(Dict_()) - if x == 'Tuple': - return cls(Tuple_()) - _atd_bad_json('ContainerOperator', x) - _atd_bad_json('ContainerOperator', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'ContainerOperator': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Function: - """Original type: function_kind = [ ... | Function | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Function' - - @staticmethod - def to_json() -> Any: - return 'Function' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Method: - """Original type: function_kind = [ ... | Method | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Method' - - @staticmethod - def to_json() -> Any: - return 'Method' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class LambdaKind: - """Original type: function_kind = [ ... | LambdaKind | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'LambdaKind' - - @staticmethod - def to_json() -> Any: - return 'LambdaKind' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Arrow: - """Original type: function_kind = [ ... | Arrow | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Arrow' - - @staticmethod - def to_json() -> Any: - return 'Arrow' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class BlockCases: - """Original type: function_kind = [ ... | BlockCases | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'BlockCases' - - @staticmethod - def to_json() -> Any: - return 'BlockCases' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FunctionKind: - """Original type: function_kind = [ ... ]""" - - value: Union[Function, Method, LambdaKind, Arrow, BlockCases] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'FunctionKind': - if isinstance(x, str): - if x == 'Function': - return cls(Function()) - if x == 'Method': - return cls(Method()) - if x == 'LambdaKind': - return cls(LambdaKind()) - if x == 'Arrow': - return cls(Arrow()) - if x == 'BlockCases': - return cls(BlockCases()) - _atd_bad_json('FunctionKind', x) - _atd_bad_json('FunctionKind', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'FunctionKind': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Incr: - """Original type: incr_decr = [ ... | Incr | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Incr' - - @staticmethod - def to_json() -> Any: - return 'Incr' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Decr: - """Original type: incr_decr = [ ... | Decr | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Decr' - - @staticmethod - def to_json() -> Any: - return 'Decr' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class IncrDecr: - """Original type: incr_decr = [ ... ]""" - - value: Union[Incr, Decr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'IncrDecr': - if isinstance(x, str): - if x == 'Incr': - return cls(Incr()) - if x == 'Decr': - return cls(Decr()) - _atd_bad_json('IncrDecr', x) - _atd_bad_json('IncrDecr', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'IncrDecr': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Static: - """Original type: keyword_attribute = [ ... | Static | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Static' - - @staticmethod - def to_json() -> Any: - return 'Static' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Volatile: - """Original type: keyword_attribute = [ ... | Volatile | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Volatile' - - @staticmethod - def to_json() -> Any: - return 'Volatile' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Extern: - """Original type: keyword_attribute = [ ... | Extern | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Extern' - - @staticmethod - def to_json() -> Any: - return 'Extern' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Public: - """Original type: keyword_attribute = [ ... | Public | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Public' - - @staticmethod - def to_json() -> Any: - return 'Public' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Private: - """Original type: keyword_attribute = [ ... | Private | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Private' - - @staticmethod - def to_json() -> Any: - return 'Private' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Protected: - """Original type: keyword_attribute = [ ... | Protected | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Protected' - - @staticmethod - def to_json() -> Any: - return 'Protected' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Abstract: - """Original type: keyword_attribute = [ ... | Abstract | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Abstract' - - @staticmethod - def to_json() -> Any: - return 'Abstract' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Final: - """Original type: keyword_attribute = [ ... | Final | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Final' - - @staticmethod - def to_json() -> Any: - return 'Final' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Override: - """Original type: keyword_attribute = [ ... | Override | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Override' - - @staticmethod - def to_json() -> Any: - return 'Override' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class RecordClass: - """Original type: keyword_attribute = [ ... | RecordClass | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'RecordClass' - - @staticmethod - def to_json() -> Any: - return 'RecordClass' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class AnnotationClass: - """Original type: keyword_attribute = [ ... | AnnotationClass | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'AnnotationClass' - - @staticmethod - def to_json() -> Any: - return 'AnnotationClass' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class EnumClass: - """Original type: keyword_attribute = [ ... | EnumClass | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'EnumClass' - - @staticmethod - def to_json() -> Any: - return 'EnumClass' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class SealedClass: - """Original type: keyword_attribute = [ ... | SealedClass | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'SealedClass' - - @staticmethod - def to_json() -> Any: - return 'SealedClass' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Var: - """Original type: keyword_attribute = [ ... | Var | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Var' - - @staticmethod - def to_json() -> Any: - return 'Var' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Let: - """Original type: keyword_attribute = [ ... | Let | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Let' - - @staticmethod - def to_json() -> Any: - return 'Let' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Mutable: - """Original type: keyword_attribute = [ ... | Mutable | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Mutable' - - @staticmethod - def to_json() -> Any: - return 'Mutable' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Const: - """Original type: keyword_attribute = [ ... | Const | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Const' - - @staticmethod - def to_json() -> Any: - return 'Const' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Optional_: - """Original type: keyword_attribute = [ ... | Optional | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Optional_' - - @staticmethod - def to_json() -> Any: - return 'Optional' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class NotNull: - """Original type: keyword_attribute = [ ... | NotNull | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'NotNull' - - @staticmethod - def to_json() -> Any: - return 'NotNull' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Recursive: - """Original type: keyword_attribute = [ ... | Recursive | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Recursive' - - @staticmethod - def to_json() -> Any: - return 'Recursive' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class MutuallyRecursive: - """Original type: keyword_attribute = [ ... | MutuallyRecursive | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'MutuallyRecursive' - - @staticmethod - def to_json() -> Any: - return 'MutuallyRecursive' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Generator: - """Original type: keyword_attribute = [ ... | Generator | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Generator' - - @staticmethod - def to_json() -> Any: - return 'Generator' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Async: - """Original type: keyword_attribute = [ ... | Async | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Async' - - @staticmethod - def to_json() -> Any: - return 'Async' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Inline: - """Original type: keyword_attribute = [ ... | Inline | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Inline' - - @staticmethod - def to_json() -> Any: - return 'Inline' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Ctor: - """Original type: keyword_attribute = [ ... | Ctor | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Ctor' - - @staticmethod - def to_json() -> Any: - return 'Ctor' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Dtor: - """Original type: keyword_attribute = [ ... | Dtor | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Dtor' - - @staticmethod - def to_json() -> Any: - return 'Dtor' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Getter: - """Original type: keyword_attribute = [ ... | Getter | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Getter' - - @staticmethod - def to_json() -> Any: - return 'Getter' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Setter: - """Original type: keyword_attribute = [ ... | Setter | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Setter' - - @staticmethod - def to_json() -> Any: - return 'Setter' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Unsafe: - """Original type: keyword_attribute = [ ... | Unsafe | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Unsafe' - - @staticmethod - def to_json() -> Any: - return 'Unsafe' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class DefaultImpl: - """Original type: keyword_attribute = [ ... | DefaultImpl | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'DefaultImpl' - - @staticmethod - def to_json() -> Any: - return 'DefaultImpl' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Lazy: - """Original type: keyword_attribute = [ ... | Lazy | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Lazy' - - @staticmethod - def to_json() -> Any: - return 'Lazy' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Throws: - """Original type: keyword_attribute = [ ... | Throws | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Throws' - - @staticmethod - def to_json() -> Any: - return 'Throws' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Rethrows: - """Original type: keyword_attribute = [ ... | Rethrows | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Rethrows' - - @staticmethod - def to_json() -> Any: - return 'Rethrows' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherKeyword: - """Original type: keyword_attribute = [ ... | OtherKeyword of ... | ... ]""" - - value: str - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherKeyword' - - def to_json(self) -> Any: - return ['OtherKeyword', _atd_write_string(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class KeywordAttribute: - """Original type: keyword_attribute = [ ... ]""" - - value: Union[Static, Volatile, Extern, Public, Private, Protected, Abstract, Final, Override, RecordClass, AnnotationClass, EnumClass, SealedClass, Var, Let, Mutable, Const, Optional_, NotNull, Recursive, MutuallyRecursive, Generator, Async, Inline, Ctor, Dtor, Getter, Setter, Unsafe, DefaultImpl, Lazy, Throws, Rethrows, OtherKeyword] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'KeywordAttribute': - if isinstance(x, str): - if x == 'Static': - return cls(Static()) - if x == 'Volatile': - return cls(Volatile()) - if x == 'Extern': - return cls(Extern()) - if x == 'Public': - return cls(Public()) - if x == 'Private': - return cls(Private()) - if x == 'Protected': - return cls(Protected()) - if x == 'Abstract': - return cls(Abstract()) - if x == 'Final': - return cls(Final()) - if x == 'Override': - return cls(Override()) - if x == 'RecordClass': - return cls(RecordClass()) - if x == 'AnnotationClass': - return cls(AnnotationClass()) - if x == 'EnumClass': - return cls(EnumClass()) - if x == 'SealedClass': - return cls(SealedClass()) - if x == 'Var': - return cls(Var()) - if x == 'Let': - return cls(Let()) - if x == 'Mutable': - return cls(Mutable()) - if x == 'Const': - return cls(Const()) - if x == 'Optional': - return cls(Optional_()) - if x == 'NotNull': - return cls(NotNull()) - if x == 'Recursive': - return cls(Recursive()) - if x == 'MutuallyRecursive': - return cls(MutuallyRecursive()) - if x == 'Generator': - return cls(Generator()) - if x == 'Async': - return cls(Async()) - if x == 'Inline': - return cls(Inline()) - if x == 'Ctor': - return cls(Ctor()) - if x == 'Dtor': - return cls(Dtor()) - if x == 'Getter': - return cls(Getter()) - if x == 'Setter': - return cls(Setter()) - if x == 'Unsafe': - return cls(Unsafe()) - if x == 'DefaultImpl': - return cls(DefaultImpl()) - if x == 'Lazy': - return cls(Lazy()) - if x == 'Throws': - return cls(Throws()) - if x == 'Rethrows': - return cls(Rethrows()) - _atd_bad_json('KeywordAttribute', x) - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'OtherKeyword': - return cls(OtherKeyword(_atd_read_string(x[1]))) - _atd_bad_json('KeywordAttribute', x) - _atd_bad_json('KeywordAttribute', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'KeywordAttribute': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Plus: - """Original type: operator = [ ... | Plus | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Plus' - - @staticmethod - def to_json() -> Any: - return 'Plus' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Minus: - """Original type: operator = [ ... | Minus | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Minus' - - @staticmethod - def to_json() -> Any: - return 'Minus' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Mult: - """Original type: operator = [ ... | Mult | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Mult' - - @staticmethod - def to_json() -> Any: - return 'Mult' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Div: - """Original type: operator = [ ... | Div | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Div' - - @staticmethod - def to_json() -> Any: - return 'Div' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Mod: - """Original type: operator = [ ... | Mod | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Mod' - - @staticmethod - def to_json() -> Any: - return 'Mod' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Pow: - """Original type: operator = [ ... | Pow | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Pow' - - @staticmethod - def to_json() -> Any: - return 'Pow' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FloorDiv: - """Original type: operator = [ ... | FloorDiv | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'FloorDiv' - - @staticmethod - def to_json() -> Any: - return 'FloorDiv' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class MatMult: - """Original type: operator = [ ... | MatMult | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'MatMult' - - @staticmethod - def to_json() -> Any: - return 'MatMult' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class LSL: - """Original type: operator = [ ... | LSL | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'LSL' - - @staticmethod - def to_json() -> Any: - return 'LSL' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class LSR: - """Original type: operator = [ ... | LSR | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'LSR' - - @staticmethod - def to_json() -> Any: - return 'LSR' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ASR: - """Original type: operator = [ ... | ASR | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ASR' - - @staticmethod - def to_json() -> Any: - return 'ASR' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class BitOr: - """Original type: operator = [ ... | BitOr | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'BitOr' - - @staticmethod - def to_json() -> Any: - return 'BitOr' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class BitXor: - """Original type: operator = [ ... | BitXor | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'BitXor' - - @staticmethod - def to_json() -> Any: - return 'BitXor' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class BitAnd: - """Original type: operator = [ ... | BitAnd | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'BitAnd' - - @staticmethod - def to_json() -> Any: - return 'BitAnd' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class BitNot: - """Original type: operator = [ ... | BitNot | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'BitNot' - - @staticmethod - def to_json() -> Any: - return 'BitNot' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class BitClear: - """Original type: operator = [ ... | BitClear | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'BitClear' - - @staticmethod - def to_json() -> Any: - return 'BitClear' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class And: - """Original type: operator = [ ... | And | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'And' - - @staticmethod - def to_json() -> Any: - return 'And' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Or: - """Original type: operator = [ ... | Or | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Or' - - @staticmethod - def to_json() -> Any: - return 'Or' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Xor: - """Original type: operator = [ ... | Xor | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Xor' - - @staticmethod - def to_json() -> Any: - return 'Xor' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Not: - """Original type: operator = [ ... | Not | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Not' - - @staticmethod - def to_json() -> Any: - return 'Not' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Eq: - """Original type: operator = [ ... | Eq | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Eq' - - @staticmethod - def to_json() -> Any: - return 'Eq' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class NotEq: - """Original type: operator = [ ... | NotEq | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'NotEq' - - @staticmethod - def to_json() -> Any: - return 'NotEq' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PhysEq: - """Original type: operator = [ ... | PhysEq | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PhysEq' - - @staticmethod - def to_json() -> Any: - return 'PhysEq' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class NotPhysEq: - """Original type: operator = [ ... | NotPhysEq | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'NotPhysEq' - - @staticmethod - def to_json() -> Any: - return 'NotPhysEq' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Lt: - """Original type: operator = [ ... | Lt | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Lt' - - @staticmethod - def to_json() -> Any: - return 'Lt' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class LtE: - """Original type: operator = [ ... | LtE | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'LtE' - - @staticmethod - def to_json() -> Any: - return 'LtE' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Gt: - """Original type: operator = [ ... | Gt | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Gt' - - @staticmethod - def to_json() -> Any: - return 'Gt' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class GtE: - """Original type: operator = [ ... | GtE | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'GtE' - - @staticmethod - def to_json() -> Any: - return 'GtE' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Cmp: - """Original type: operator = [ ... | Cmp | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Cmp' - - @staticmethod - def to_json() -> Any: - return 'Cmp' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Concat: - """Original type: operator = [ ... | Concat | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Concat' - - @staticmethod - def to_json() -> Any: - return 'Concat' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Append: - """Original type: operator = [ ... | Append | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Append' - - @staticmethod - def to_json() -> Any: - return 'Append' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class RegexpMatch: - """Original type: operator = [ ... | RegexpMatch | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'RegexpMatch' - - @staticmethod - def to_json() -> Any: - return 'RegexpMatch' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class NotMatch: - """Original type: operator = [ ... | NotMatch | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'NotMatch' - - @staticmethod - def to_json() -> Any: - return 'NotMatch' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Range: - """Original type: operator = [ ... | Range | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Range' - - @staticmethod - def to_json() -> Any: - return 'Range' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class RangeInclusive: - """Original type: operator = [ ... | RangeInclusive | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'RangeInclusive' - - @staticmethod - def to_json() -> Any: - return 'RangeInclusive' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class NotNullPostfix: - """Original type: operator = [ ... | NotNullPostfix | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'NotNullPostfix' - - @staticmethod - def to_json() -> Any: - return 'NotNullPostfix' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Length: - """Original type: operator = [ ... | Length | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Length' - - @staticmethod - def to_json() -> Any: - return 'Length' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Elvis: - """Original type: operator = [ ... | Elvis | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Elvis' - - @staticmethod - def to_json() -> Any: - return 'Elvis' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Nullish: - """Original type: operator = [ ... | Nullish | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Nullish' - - @staticmethod - def to_json() -> Any: - return 'Nullish' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class In: - """Original type: operator = [ ... | In | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'In' - - @staticmethod - def to_json() -> Any: - return 'In' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class NotIn: - """Original type: operator = [ ... | NotIn | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'NotIn' - - @staticmethod - def to_json() -> Any: - return 'NotIn' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Is: - """Original type: operator = [ ... | Is | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Is' - - @staticmethod - def to_json() -> Any: - return 'Is' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class NotIs: - """Original type: operator = [ ... | NotIs | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'NotIs' - - @staticmethod - def to_json() -> Any: - return 'NotIs' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Background: - """Original type: operator = [ ... | Background | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Background' - - @staticmethod - def to_json() -> Any: - return 'Background' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Pipe: - """Original type: operator = [ ... | Pipe | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Pipe' - - @staticmethod - def to_json() -> Any: - return 'Pipe' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class LDA: - """Original type: operator = [ ... | LDA | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'LDA' - - @staticmethod - def to_json() -> Any: - return 'LDA' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class RDA: - """Original type: operator = [ ... | RDA | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'RDA' - - @staticmethod - def to_json() -> Any: - return 'RDA' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class LSA: - """Original type: operator = [ ... | LSA | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'LSA' - - @staticmethod - def to_json() -> Any: - return 'LSA' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class RSA: - """Original type: operator = [ ... | RSA | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'RSA' - - @staticmethod - def to_json() -> Any: - return 'RSA' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Operator: - """Original type: operator = [ ... ]""" - - value: Union[Plus, Minus, Mult, Div, Mod, Pow, FloorDiv, MatMult, LSL, LSR, ASR, BitOr, BitXor, BitAnd, BitNot, BitClear, And, Or, Xor, Not, Eq, NotEq, PhysEq, NotPhysEq, Lt, LtE, Gt, GtE, Cmp, Concat, Append, RegexpMatch, NotMatch, Range, RangeInclusive, NotNullPostfix, Length, Elvis, Nullish, In, NotIn, Is, NotIs, Background, Pipe, LDA, RDA, LSA, RSA] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Operator': - if isinstance(x, str): - if x == 'Plus': - return cls(Plus()) - if x == 'Minus': - return cls(Minus()) - if x == 'Mult': - return cls(Mult()) - if x == 'Div': - return cls(Div()) - if x == 'Mod': - return cls(Mod()) - if x == 'Pow': - return cls(Pow()) - if x == 'FloorDiv': - return cls(FloorDiv()) - if x == 'MatMult': - return cls(MatMult()) - if x == 'LSL': - return cls(LSL()) - if x == 'LSR': - return cls(LSR()) - if x == 'ASR': - return cls(ASR()) - if x == 'BitOr': - return cls(BitOr()) - if x == 'BitXor': - return cls(BitXor()) - if x == 'BitAnd': - return cls(BitAnd()) - if x == 'BitNot': - return cls(BitNot()) - if x == 'BitClear': - return cls(BitClear()) - if x == 'And': - return cls(And()) - if x == 'Or': - return cls(Or()) - if x == 'Xor': - return cls(Xor()) - if x == 'Not': - return cls(Not()) - if x == 'Eq': - return cls(Eq()) - if x == 'NotEq': - return cls(NotEq()) - if x == 'PhysEq': - return cls(PhysEq()) - if x == 'NotPhysEq': - return cls(NotPhysEq()) - if x == 'Lt': - return cls(Lt()) - if x == 'LtE': - return cls(LtE()) - if x == 'Gt': - return cls(Gt()) - if x == 'GtE': - return cls(GtE()) - if x == 'Cmp': - return cls(Cmp()) - if x == 'Concat': - return cls(Concat()) - if x == 'Append': - return cls(Append()) - if x == 'RegexpMatch': - return cls(RegexpMatch()) - if x == 'NotMatch': - return cls(NotMatch()) - if x == 'Range': - return cls(Range()) - if x == 'RangeInclusive': - return cls(RangeInclusive()) - if x == 'NotNullPostfix': - return cls(NotNullPostfix()) - if x == 'Length': - return cls(Length()) - if x == 'Elvis': - return cls(Elvis()) - if x == 'Nullish': - return cls(Nullish()) - if x == 'In': - return cls(In()) - if x == 'NotIn': - return cls(NotIn()) - if x == 'Is': - return cls(Is()) - if x == 'NotIs': - return cls(NotIs()) - if x == 'Background': - return cls(Background()) - if x == 'Pipe': - return cls(Pipe()) - if x == 'LDA': - return cls(LDA()) - if x == 'RDA': - return cls(RDA()) - if x == 'LSA': - return cls(LSA()) - if x == 'RSA': - return cls(RSA()) - _atd_bad_json('Operator', x) - _atd_bad_json('Operator', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Operator': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Prefix: - """Original type: prefix_postfix = [ ... | Prefix | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Prefix' - - @staticmethod - def to_json() -> Any: - return 'Prefix' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Postfix: - """Original type: prefix_postfix = [ ... | Postfix | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Postfix' - - @staticmethod - def to_json() -> Any: - return 'Postfix' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PrefixPostfix: - """Original type: prefix_postfix = [ ... ]""" - - value: Union[Prefix, Postfix] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'PrefixPostfix': - if isinstance(x, str): - if x == 'Prefix': - return cls(Prefix()) - if x == 'Postfix': - return cls(Postfix()) - _atd_bad_json('PrefixPostfix', x) - _atd_bad_json('PrefixPostfix', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'PrefixPostfix': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Sid: - """Original type: sid""" - - value: int - - @classmethod - def from_json(cls, x: Any) -> 'Sid': - return cls(_atd_read_int(x)) - - def to_json(self) -> Any: - return _atd_write_int(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Sid': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class This: - """Original type: special = [ ... | This | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'This' - - @staticmethod - def to_json() -> Any: - return 'This' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Super: - """Original type: special = [ ... | Super | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Super' - - @staticmethod - def to_json() -> Any: - return 'Super' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Cls: - """Original type: special = [ ... | Cls | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Cls' - - @staticmethod - def to_json() -> Any: - return 'Cls' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Self: - """Original type: special = [ ... | Self | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Self' - - @staticmethod - def to_json() -> Any: - return 'Self' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Parent: - """Original type: special = [ ... | Parent | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Parent' - - @staticmethod - def to_json() -> Any: - return 'Parent' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Eval: - """Original type: special = [ ... | Eval | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Eval' - - @staticmethod - def to_json() -> Any: - return 'Eval' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Typeof: - """Original type: special = [ ... | Typeof | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Typeof' - - @staticmethod - def to_json() -> Any: - return 'Typeof' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Instanceof: - """Original type: special = [ ... | Instanceof | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Instanceof' - - @staticmethod - def to_json() -> Any: - return 'Instanceof' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Sizeof: - """Original type: special = [ ... | Sizeof | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Sizeof' - - @staticmethod - def to_json() -> Any: - return 'Sizeof' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Defined: - """Original type: special = [ ... | Defined | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Defined' - - @staticmethod - def to_json() -> Any: - return 'Defined' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ConcatString: - """Original type: special = [ ... | ConcatString of ... | ... ]""" - - value: ConcatStringKind - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ConcatString' - - def to_json(self) -> Any: - return ['ConcatString', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class EncodedString: - """Original type: special = [ ... | EncodedString of ... | ... ]""" - - value: str - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'EncodedString' - - def to_json(self) -> Any: - return ['EncodedString', _atd_write_string(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class InterpolatedElement: - """Original type: special = [ ... | InterpolatedElement | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'InterpolatedElement' - - @staticmethod - def to_json() -> Any: - return 'InterpolatedElement' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Spread: - """Original type: special = [ ... | Spread | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Spread' - - @staticmethod - def to_json() -> Any: - return 'Spread' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class HashSplat: - """Original type: special = [ ... | HashSplat | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'HashSplat' - - @staticmethod - def to_json() -> Any: - return 'HashSplat' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ForOf: - """Original type: special = [ ... | ForOf | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ForOf' - - @staticmethod - def to_json() -> Any: - return 'ForOf' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Op: - """Original type: special = [ ... | Op of ... | ... ]""" - - value: Operator - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Op' - - def to_json(self) -> Any: - return ['Op', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class IncrDecr_: - """Original type: special = [ ... | IncrDecr of ... | ... ]""" - - value: Tuple[IncrDecr, PrefixPostfix] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'IncrDecr_' - - def to_json(self) -> Any: - return ['IncrDecr', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Require: - """Original type: special = [ ... | Require | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Require' - - @staticmethod - def to_json() -> Any: - return 'Require' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherSpecial: - """Original type: special = [ ... | OtherSpecial of ... | ... ]""" - - value: str - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherSpecial' - - def to_json(self) -> Any: - return ['OtherSpecial', _atd_write_string(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Special: - """Original type: special = [ ... ]""" - - value: Union[This, Super, Cls, Self, Parent, Eval, Typeof, Instanceof, Sizeof, Defined, ConcatString, EncodedString, InterpolatedElement, Spread, HashSplat, ForOf, Op, IncrDecr_, Require, OtherSpecial] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Special': - if isinstance(x, str): - if x == 'This': - return cls(This()) - if x == 'Super': - return cls(Super()) - if x == 'Cls': - return cls(Cls()) - if x == 'Self': - return cls(Self()) - if x == 'Parent': - return cls(Parent()) - if x == 'Eval': - return cls(Eval()) - if x == 'Typeof': - return cls(Typeof()) - if x == 'Instanceof': - return cls(Instanceof()) - if x == 'Sizeof': - return cls(Sizeof()) - if x == 'Defined': - return cls(Defined()) - if x == 'InterpolatedElement': - return cls(InterpolatedElement()) - if x == 'Spread': - return cls(Spread()) - if x == 'HashSplat': - return cls(HashSplat()) - if x == 'ForOf': - return cls(ForOf()) - if x == 'Require': - return cls(Require()) - _atd_bad_json('Special', x) - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'ConcatString': - return cls(ConcatString(ConcatStringKind.from_json(x[1]))) - if cons == 'EncodedString': - return cls(EncodedString(_atd_read_string(x[1]))) - if cons == 'Op': - return cls(Op(Operator.from_json(x[1]))) - if cons == 'IncrDecr': - return cls(IncrDecr_((lambda x: (IncrDecr.from_json(x[0]), PrefixPostfix.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'OtherSpecial': - return cls(OtherSpecial(_atd_read_string(x[1]))) - _atd_bad_json('Special', x) - _atd_bad_json('Special', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Special': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TokenLocation: - """Original type: token_location = { ... }""" - - str: str - charpos: int - line: int - column: int - filename: str - - @classmethod - def from_json(cls, x: Any) -> 'TokenLocation': - if isinstance(x, dict): - return cls( - str=_atd_read_string(x['str']) if 'str' in x else _atd_missing_json_field('TokenLocation', 'str'), - charpos=_atd_read_int(x['charpos']) if 'charpos' in x else _atd_missing_json_field('TokenLocation', 'charpos'), - line=_atd_read_int(x['line']) if 'line' in x else _atd_missing_json_field('TokenLocation', 'line'), - column=_atd_read_int(x['column']) if 'column' in x else _atd_missing_json_field('TokenLocation', 'column'), - filename=_atd_read_string(x['filename']) if 'filename' in x else _atd_missing_json_field('TokenLocation', 'filename'), - ) - else: - _atd_bad_json('TokenLocation', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['str'] = _atd_write_string(self.str) - res['charpos'] = _atd_write_int(self.charpos) - res['line'] = _atd_write_int(self.line) - res['column'] = _atd_write_int(self.column) - res['filename'] = _atd_write_string(self.filename) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'TokenLocation': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OriginTok: - """Original type: token = [ ... | OriginTok of ... | ... ]""" - - value: TokenLocation - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OriginTok' - - def to_json(self) -> Any: - return ['OriginTok', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FakeTok: - """Original type: token = [ ... | FakeTok of ... | ... ]""" - - value: str - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'FakeTok' - - def to_json(self) -> Any: - return ['FakeTok', _atd_write_string(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Token: - """Original type: token = [ ... ]""" - - value: Union[OriginTok, FakeTok] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Token': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'OriginTok': - return cls(OriginTok(TokenLocation.from_json(x[1]))) - if cons == 'FakeTok': - return cls(FakeTok(_atd_read_string(x[1]))) - _atd_bad_json('Token', x) - _atd_bad_json('Token', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Token': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Tok: - """Original type: tok""" - - value: Token - - @classmethod - def from_json(cls, x: Any) -> 'Tok': - return cls(Token.from_json(x)) - - def to_json(self) -> Any: - return (lambda x: x.to_json())(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Tok': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class BoolWrap: - """Original type: _bool_wrap""" - - value: Tuple[bool, Tok] - - @classmethod - def from_json(cls, x: Any) -> 'BoolWrap': - return cls((lambda x: (_atd_read_bool(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [_atd_write_bool(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'BoolWrap': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ClassKindWrap: - """Original type: _class_kind_wrap""" - - value: Tuple[ClassKind, Tok] - - @classmethod - def from_json(cls, x: Any) -> 'ClassKindWrap': - return cls((lambda x: (ClassKind.from_json(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'ClassKindWrap': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FloatNullableWrap: - """Original type: _float_nullable_wrap""" - - value: Tuple[Optional[float], Tok] - - @classmethod - def from_json(cls, x: Any) -> 'FloatNullableWrap': - return cls((lambda x: (_atd_read_nullable(_atd_read_float)(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [_atd_write_nullable(_atd_write_float)(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'FloatNullableWrap': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FunctionKindWrap: - """Original type: _function_kind_wrap""" - - value: Tuple[FunctionKind, Tok] - - @classmethod - def from_json(cls, x: Any) -> 'FunctionKindWrap': - return cls((lambda x: (FunctionKind.from_json(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'FunctionKindWrap': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class IntWrap: - """Original type: _int_wrap""" - - value: Tuple[int, Tok] - - @classmethod - def from_json(cls, x: Any) -> 'IntWrap': - return cls((lambda x: (_atd_read_int(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [_atd_write_int(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'IntWrap': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class KeywordAttributeWrap: - """Original type: _keyword_attribute_wrap""" - - value: Tuple[KeywordAttribute, Tok] - - @classmethod - def from_json(cls, x: Any) -> 'KeywordAttributeWrap': - return cls((lambda x: (KeywordAttribute.from_json(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'KeywordAttributeWrap': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OperatorWrap: - """Original type: _operator_wrap""" - - value: Tuple[Operator, Tok] - - @classmethod - def from_json(cls, x: Any) -> 'OperatorWrap': - return cls((lambda x: (Operator.from_json(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'OperatorWrap': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class SpecialWrap: - """Original type: _special_wrap""" - - value: Tuple[Special, Tok] - - @classmethod - def from_json(cls, x: Any) -> 'SpecialWrap': - return cls((lambda x: (Special.from_json(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'SpecialWrap': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class StringWrap: - """Original type: _string_wrap""" - - value: Tuple[str, Tok] - - @classmethod - def from_json(cls, x: Any) -> 'StringWrap': - return cls((lambda x: (_atd_read_string(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [_atd_write_string(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'StringWrap': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class StringWrapBracket: - """Original type: _string_wrap_bracket""" - - value: Tuple[Tok, StringWrap, Tok] - - @classmethod - def from_json(cls, x: Any) -> 'StringWrapBracket': - return cls((lambda x: (Tok.from_json(x[0]), StringWrap.from_json(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'StringWrapBracket': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class XB40703a: - """Original type: _x_b40703a""" - - value: Tuple[Optional[int], Tok] - - @classmethod - def from_json(cls, x: Any) -> 'XB40703a': - return cls((lambda x: (_atd_read_nullable(_atd_read_int)(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [_atd_write_nullable(_atd_write_int)(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'XB40703a': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Ident: - """Original type: ident""" - - value: StringWrap - - @classmethod - def from_json(cls, x: Any) -> 'Ident': - return cls(StringWrap.from_json(x)) - - def to_json(self) -> Any: - return (lambda x: x.to_json())(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Ident': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class DottedIdent: - """Original type: dotted_ident""" - - value: List[Ident] - - @classmethod - def from_json(cls, x: Any) -> 'DottedIdent': - return cls(_atd_read_list(Ident.from_json)(x)) - - def to_json(self) -> Any: - return _atd_write_list((lambda x: x.to_json()))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'DottedIdent': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Label: - """Original type: label""" - - value: Ident - - @classmethod - def from_json(cls, x: Any) -> 'Label': - return cls(Ident.from_json(x)) - - def to_json(self) -> Any: - return (lambda x: x.to_json())(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Label': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Bool: - """Original type: literal = [ ... | Bool of ... | ... ]""" - - value: BoolWrap - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Bool' - - def to_json(self) -> Any: - return ['Bool', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Int: - """Original type: literal = [ ... | Int of ... | ... ]""" - - value: XB40703a - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Int' - - def to_json(self) -> Any: - return ['Int', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Float: - """Original type: literal = [ ... | Float of ... | ... ]""" - - value: FloatNullableWrap - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Float' - - def to_json(self) -> Any: - return ['Float', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Char: - """Original type: literal = [ ... | Char of ... | ... ]""" - - value: StringWrap - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Char' - - def to_json(self) -> Any: - return ['Char', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class String: - """Original type: literal = [ ... | String of ... | ... ]""" - - value: StringWrap - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'String' - - def to_json(self) -> Any: - return ['String', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Regexp: - """Original type: literal = [ ... | Regexp of ... | ... ]""" - - value: Tuple[StringWrapBracket, Optional[StringWrap]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Regexp' - - def to_json(self) -> Any: - return ['Regexp', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_nullable((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Atom: - """Original type: literal = [ ... | Atom of ... | ... ]""" - - value: Tuple[Tok, StringWrap] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Atom' - - def to_json(self) -> Any: - return ['Atom', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Unit: - """Original type: literal = [ ... | Unit of ... | ... ]""" - - value: Tok - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Unit' - - def to_json(self) -> Any: - return ['Unit', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Null: - """Original type: literal = [ ... | Null of ... | ... ]""" - - value: Tok - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Null' - - def to_json(self) -> Any: - return ['Null', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Undefined: - """Original type: literal = [ ... | Undefined of ... | ... ]""" - - value: Tok - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Undefined' - - def to_json(self) -> Any: - return ['Undefined', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Imag: - """Original type: literal = [ ... | Imag of ... | ... ]""" - - value: StringWrap - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Imag' - - def to_json(self) -> Any: - return ['Imag', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Ratio: - """Original type: literal = [ ... | Ratio of ... | ... ]""" - - value: StringWrap - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Ratio' - - def to_json(self) -> Any: - return ['Ratio', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Literal: - """Original type: literal = [ ... ]""" - - value: Union[Bool, Int, Float, Char, String, Regexp, Atom, Unit, Null, Undefined, Imag, Ratio] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Literal': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'Bool': - return cls(Bool(BoolWrap.from_json(x[1]))) - if cons == 'Int': - return cls(Int(XB40703a.from_json(x[1]))) - if cons == 'Float': - return cls(Float(FloatNullableWrap.from_json(x[1]))) - if cons == 'Char': - return cls(Char(StringWrap.from_json(x[1]))) - if cons == 'String': - return cls(String(StringWrap.from_json(x[1]))) - if cons == 'Regexp': - return cls(Regexp((lambda x: (StringWrapBracket.from_json(x[0]), _atd_read_nullable(StringWrap.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'Atom': - return cls(Atom((lambda x: (Tok.from_json(x[0]), StringWrap.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'Unit': - return cls(Unit(Tok.from_json(x[1]))) - if cons == 'Null': - return cls(Null(Tok.from_json(x[1]))) - if cons == 'Undefined': - return cls(Undefined(Tok.from_json(x[1]))) - if cons == 'Imag': - return cls(Imag(StringWrap.from_json(x[1]))) - if cons == 'Ratio': - return cls(Ratio(StringWrap.from_json(x[1]))) - _atd_bad_json('Literal', x) - _atd_bad_json('Literal', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Literal': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class DottedName: - """Original type: module_name = [ ... | DottedName of ... | ... ]""" - - value: DottedIdent - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'DottedName' - - def to_json(self) -> Any: - return ['DottedName', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FileName: - """Original type: module_name = [ ... | FileName of ... | ... ]""" - - value: StringWrap - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'FileName' - - def to_json(self) -> Any: - return ['FileName', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ModuleName: - """Original type: module_name = [ ... ]""" - - value: Union[DottedName, FileName] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ModuleName': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'DottedName': - return cls(DottedName(DottedIdent.from_json(x[1]))) - if cons == 'FileName': - return cls(FileName(StringWrap.from_json(x[1]))) - _atd_bad_json('ModuleName', x) - _atd_bad_json('ModuleName', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'ModuleName': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Global: - """Original type: resolved_name_kind = [ ... | Global | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Global' - - @staticmethod - def to_json() -> Any: - return 'Global' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Local: - """Original type: resolved_name_kind = [ ... | Local | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Local' - - @staticmethod - def to_json() -> Any: - return 'Local' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Param: - """Original type: resolved_name_kind = [ ... | Param | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Param' - - @staticmethod - def to_json() -> Any: - return 'Param' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ImportedEntity: - """Original type: resolved_name_kind = [ ... | ImportedEntity of ... | ... ]""" - - value: DottedIdent - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ImportedEntity' - - def to_json(self) -> Any: - return ['ImportedEntity', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ImportedModule: - """Original type: resolved_name_kind = [ ... | ImportedModule of ... | ... ]""" - - value: ModuleName - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ImportedModule' - - def to_json(self) -> Any: - return ['ImportedModule', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherResolvedNameKind: - """Original type: resolved_name_kind = [ ... | OtherResolvedNameKind of ... | ... ]""" - - value: str - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherResolvedNameKind' - - def to_json(self) -> Any: - return ['OtherResolvedNameKind', _atd_write_string(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ResolvedNameKind: - """Original type: resolved_name_kind = [ ... ]""" - - value: Union[Global, Local, Param, ImportedEntity, ImportedModule, OtherResolvedNameKind] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ResolvedNameKind': - if isinstance(x, str): - if x == 'Global': - return cls(Global()) - if x == 'Local': - return cls(Local()) - if x == 'Param': - return cls(Param()) - _atd_bad_json('ResolvedNameKind', x) - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'ImportedEntity': - return cls(ImportedEntity(DottedIdent.from_json(x[1]))) - if cons == 'ImportedModule': - return cls(ImportedModule(ModuleName.from_json(x[1]))) - if cons == 'OtherResolvedNameKind': - return cls(OtherResolvedNameKind(_atd_read_string(x[1]))) - _atd_bad_json('ResolvedNameKind', x) - _atd_bad_json('ResolvedNameKind', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'ResolvedNameKind': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ResolvedName: - """Original type: resolved_name""" - - value: Tuple[ResolvedNameKind, Sid] - - @classmethod - def from_json(cls, x: Any) -> 'ResolvedName': - return cls((lambda x: (ResolvedNameKind.from_json(x[0]), Sid.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'ResolvedName': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Sc: - """Original type: sc""" - - value: Tok - - @classmethod - def from_json(cls, x: Any) -> 'Sc': - return cls(Tok.from_json(x)) - - def to_json(self) -> Any: - return (lambda x: x.to_json())(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Sc': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TodoKind: - """Original type: todo_kind""" - - value: StringWrap - - @classmethod - def from_json(cls, x: Any) -> 'TodoKind': - return cls(StringWrap.from_json(x)) - - def to_json(self) -> Any: - return (lambda x: x.to_json())(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'TodoKind': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Covariant: - """Original type: variance = [ ... | Covariant | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Covariant' - - @staticmethod - def to_json() -> Any: - return 'Covariant' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Contravariant: - """Original type: variance = [ ... | Contravariant | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Contravariant' - - @staticmethod - def to_json() -> Any: - return 'Contravariant' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Variance: - """Original type: variance = [ ... ]""" - - value: Union[Covariant, Contravariant] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Variance': - if isinstance(x, str): - if x == 'Covariant': - return cls(Covariant()) - if x == 'Contravariant': - return cls(Contravariant()) - _atd_bad_json('Variance', x) - _atd_bad_json('Variance', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Variance': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class VarianceWrap: - """Original type: _variance_wrap""" - - value: Tuple[Variance, Tok] - - @classmethod - def from_json(cls, x: Any) -> 'VarianceWrap': - return cls((lambda x: (Variance.from_json(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'VarianceWrap': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class XmlClassic: - """Original type: xml_kind = [ ... | XmlClassic of ... | ... ]""" - - value: Tuple[Tok, Ident, Tok, Tok] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'XmlClassic' - - def to_json(self) -> Any: - return ['XmlClassic', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2]), (lambda x: x.to_json())(x[3])] if isinstance(x, tuple) and len(x) == 4 else _atd_bad_python('tuple of length 4', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class XmlSingleton: - """Original type: xml_kind = [ ... | XmlSingleton of ... | ... ]""" - - value: Tuple[Tok, Ident, Tok] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'XmlSingleton' - - def to_json(self) -> Any: - return ['XmlSingleton', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class XmlFragment: - """Original type: xml_kind = [ ... | XmlFragment of ... | ... ]""" - - value: Tuple[Tok, Tok] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'XmlFragment' - - def to_json(self) -> Any: - return ['XmlFragment', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class XmlKind: - """Original type: xml_kind = [ ... ]""" - - value: Union[XmlClassic, XmlSingleton, XmlFragment] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'XmlKind': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'XmlClassic': - return cls(XmlClassic((lambda x: (Tok.from_json(x[0]), Ident.from_json(x[1]), Tok.from_json(x[2]), Tok.from_json(x[3])) if isinstance(x, list) and len(x) == 4 else _atd_bad_json('array of length 4', x))(x[1]))) - if cons == 'XmlSingleton': - return cls(XmlSingleton((lambda x: (Tok.from_json(x[0]), Ident.from_json(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'XmlFragment': - return cls(XmlFragment((lambda x: (Tok.from_json(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('XmlKind', x) - _atd_bad_json('XmlKind', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'XmlKind': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ArgumentListBracket: - """Original type: _argument_list_bracket""" - - value: Tuple[Tok, List[Argument], Tok] - - @classmethod - def from_json(cls, x: Any) -> 'ArgumentListBracket': - return cls((lambda x: (Tok.from_json(x[0]), _atd_read_list(Argument.from_json)(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'ArgumentListBracket': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Bracket0ecc50b: - """Original type: _bracket_0ecc50b""" - - value: Tuple[Tok, Tuple[Optional[Expr], Optional[Expr], Optional[Expr]], Tok] - - @classmethod - def from_json(cls, x: Any) -> 'Bracket0ecc50b': - return cls((lambda x: (Tok.from_json(x[0]), (lambda x: (_atd_read_nullable(Expr.from_json)(x[0]), _atd_read_nullable(Expr.from_json)(x[1]), _atd_read_nullable(Expr.from_json)(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: [_atd_write_nullable((lambda x: x.to_json()))(x[0]), _atd_write_nullable((lambda x: x.to_json()))(x[1]), _atd_write_nullable((lambda x: x.to_json()))(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Bracket0ecc50b': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ComprehensionBracket: - """Original type: _comprehension_bracket""" - - value: Tuple[Tok, Comprehension, Tok] - - @classmethod - def from_json(cls, x: Any) -> 'ComprehensionBracket': - return cls((lambda x: (Tok.from_json(x[0]), Comprehension.from_json(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'ComprehensionBracket': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class DottedIdentPatternListBracket: - """Original type: _dotted_ident_pattern_list_bracket""" - - value: Tuple[Tok, List[Tuple[DottedIdent, Pattern]], Tok] - - @classmethod - def from_json(cls, x: Any) -> 'DottedIdentPatternListBracket': - return cls((lambda x: (Tok.from_json(x[0]), _atd_read_list((lambda x: (DottedIdent.from_json(x[0]), Pattern.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x)))(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x)))(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'DottedIdentPatternListBracket': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ExprBracket: - """Original type: _expr_bracket""" - - value: Tuple[Tok, Expr, Tok] - - @classmethod - def from_json(cls, x: Any) -> 'ExprBracket': - return cls((lambda x: (Tok.from_json(x[0]), Expr.from_json(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'ExprBracket': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ExprListBracket: - """Original type: _expr_list_bracket""" - - value: Tuple[Tok, List[Expr], Tok] - - @classmethod - def from_json(cls, x: Any) -> 'ExprListBracket': - return cls((lambda x: (Tok.from_json(x[0]), _atd_read_list(Expr.from_json)(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'ExprListBracket': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ExprNullableBracket: - """Original type: _expr_nullable_bracket""" - - value: Tuple[Tok, Optional[Expr], Tok] - - @classmethod - def from_json(cls, x: Any) -> 'ExprNullableBracket': - return cls((lambda x: (Tok.from_json(x[0]), _atd_read_nullable(Expr.from_json)(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_nullable((lambda x: x.to_json()))(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'ExprNullableBracket': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class FieldListBracket: - """Original type: _field_list_bracket""" - - value: Tuple[Tok, List[Field], Tok] - - @classmethod - def from_json(cls, x: Any) -> 'FieldListBracket': - return cls((lambda x: (Tok.from_json(x[0]), _atd_read_list(Field.from_json)(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'FieldListBracket': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class PatternListBracket: - """Original type: _pattern_list_bracket""" - - value: Tuple[Tok, List[Pattern], Tok] - - @classmethod - def from_json(cls, x: Any) -> 'PatternListBracket': - return cls((lambda x: (Tok.from_json(x[0]), _atd_read_list(Pattern.from_json)(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'PatternListBracket': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class StmtListBracket: - """Original type: _stmt_list_bracket""" - - value: Tuple[Tok, List[Stmt], Tok] - - @classmethod - def from_json(cls, x: Any) -> 'StmtListBracket': - return cls((lambda x: (Tok.from_json(x[0]), _atd_read_list(Stmt.from_json)(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'StmtListBracket': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class TypeArgumentListBracket: - """Original type: _type_argument_list_bracket""" - - value: Tuple[Tok, List[TypeArgument], Tok] - - @classmethod - def from_json(cls, x: Any) -> 'TypeArgumentListBracket': - return cls((lambda x: (Tok.from_json(x[0]), _atd_read_list(TypeArgument.from_json)(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'TypeArgumentListBracket': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class TypeListBracket: - """Original type: _type_list_bracket""" - - value: Tuple[Tok, List[Type], Tok] - - @classmethod - def from_json(cls, x: Any) -> 'TypeListBracket': - return cls((lambda x: (Tok.from_json(x[0]), _atd_read_list(Type.from_json)(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'TypeListBracket': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Alias: - """Original type: alias""" - - value: Tuple[Ident, IdInfo] - - @classmethod - def from_json(cls, x: Any) -> 'Alias': - return cls((lambda x: (Ident.from_json(x[0]), IdInfo.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Alias': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class E: - """Original type: any = [ ... | E of ... | ... ]""" - - value: Expr - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'E' - - def to_json(self) -> Any: - return ['E', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class S: - """Original type: any = [ ... | S of ... | ... ]""" - - value: Stmt - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'S' - - def to_json(self) -> Any: - return ['S', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class T: - """Original type: any = [ ... | T of ... | ... ]""" - - value: Type - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'T' - - def to_json(self) -> Any: - return ['T', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class P: - """Original type: any = [ ... | P of ... | ... ]""" - - value: Pattern - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'P' - - def to_json(self) -> Any: - return ['P', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class At: - """Original type: any = [ ... | At of ... | ... ]""" - - value: Attribute - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'At' - - def to_json(self) -> Any: - return ['At', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Fld: - """Original type: any = [ ... | Fld of ... | ... ]""" - - value: Field - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Fld' - - def to_json(self) -> Any: - return ['Fld', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Ar: - """Original type: any = [ ... | Ar of ... | ... ]""" - - value: Argument - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Ar' - - def to_json(self) -> Any: - return ['Ar', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Pa: - """Original type: any = [ ... | Pa of ... | ... ]""" - - value: Parameter - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Pa' - - def to_json(self) -> Any: - return ['Pa', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Ta: - """Original type: any = [ ... | Ta of ... | ... ]""" - - value: TypeArgument - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Ta' - - def to_json(self) -> Any: - return ['Ta', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Tp: - """Original type: any = [ ... | Tp of ... | ... ]""" - - value: TypeParameter - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Tp' - - def to_json(self) -> Any: - return ['Tp', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Ce: - """Original type: any = [ ... | Ce of ... | ... ]""" - - value: CatchExn - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Ce' - - def to_json(self) -> Any: - return ['Ce', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Cs: - """Original type: any = [ ... | Cs of ... | ... ]""" - - value: Case - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Cs' - - def to_json(self) -> Any: - return ['Cs', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ForOrIfComp_: - """Original type: any = [ ... | ForOrIfComp of ... | ... ]""" - - value: ForOrIfComp - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ForOrIfComp_' - - def to_json(self) -> Any: - return ['ForOrIfComp', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class En: - """Original type: any = [ ... | En of ... | ... ]""" - - value: Entity - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'En' - - def to_json(self) -> Any: - return ['En', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class I: - """Original type: any = [ ... | I of ... | ... ]""" - - value: Ident - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'I' - - def to_json(self) -> Any: - return ['I', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Modn: - """Original type: any = [ ... | Modn of ... | ... ]""" - - value: ModuleName - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Modn' - - def to_json(self) -> Any: - return ['Modn', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Di: - """Original type: any = [ ... | Di of ... | ... ]""" - - value: DottedIdent - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Di' - - def to_json(self) -> Any: - return ['Di', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Lbli: - """Original type: any = [ ... | Lbli of ... | ... ]""" - - value: LabelIdent - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Lbli' - - def to_json(self) -> Any: - return ['Lbli', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Str: - """Original type: any = [ ... | Str of ... | ... ]""" - - value: StringWrap - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Str' - - def to_json(self) -> Any: - return ['Str', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Tk: - """Original type: any = [ ... | Tk of ... | ... ]""" - - value: Tok - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Tk' - - def to_json(self) -> Any: - return ['Tk', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TodoK: - """Original type: any = [ ... | TodoK of ... | ... ]""" - - value: TodoKind - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TodoK' - - def to_json(self) -> Any: - return ['TodoK', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Anys: - """Original type: any = [ ... | Anys of ... | ... ]""" - - value: Tuple[List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Anys' - - def to_json(self) -> Any: - return ['Anys', (lambda x: [_atd_write_list((lambda x: x.to_json()))(x[0])] if isinstance(x, tuple) and len(x) == 1 else _atd_bad_python('tuple of length 1', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Any_: - """Original type: any = [ ... ]""" - - value: Union[E, S, T, P, At, Fld, Ar, Pa, Ta, Tp, Ce, Cs, ForOrIfComp_, En, I, Modn, Di, Lbli, Str, Tk, TodoK, Anys] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Any_': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'E': - return cls(E(Expr.from_json(x[1]))) - if cons == 'S': - return cls(S(Stmt.from_json(x[1]))) - if cons == 'T': - return cls(T(Type.from_json(x[1]))) - if cons == 'P': - return cls(P(Pattern.from_json(x[1]))) - if cons == 'At': - return cls(At(Attribute.from_json(x[1]))) - if cons == 'Fld': - return cls(Fld(Field.from_json(x[1]))) - if cons == 'Ar': - return cls(Ar(Argument.from_json(x[1]))) - if cons == 'Pa': - return cls(Pa(Parameter.from_json(x[1]))) - if cons == 'Ta': - return cls(Ta(TypeArgument.from_json(x[1]))) - if cons == 'Tp': - return cls(Tp(TypeParameter.from_json(x[1]))) - if cons == 'Ce': - return cls(Ce(CatchExn.from_json(x[1]))) - if cons == 'Cs': - return cls(Cs(Case.from_json(x[1]))) - if cons == 'ForOrIfComp': - return cls(ForOrIfComp_(ForOrIfComp.from_json(x[1]))) - if cons == 'En': - return cls(En(Entity.from_json(x[1]))) - if cons == 'I': - return cls(I(Ident.from_json(x[1]))) - if cons == 'Modn': - return cls(Modn(ModuleName.from_json(x[1]))) - if cons == 'Di': - return cls(Di(DottedIdent.from_json(x[1]))) - if cons == 'Lbli': - return cls(Lbli(LabelIdent.from_json(x[1]))) - if cons == 'Str': - return cls(Str(StringWrap.from_json(x[1]))) - if cons == 'Tk': - return cls(Tk(Tok.from_json(x[1]))) - if cons == 'TodoK': - return cls(TodoK(TodoKind.from_json(x[1]))) - if cons == 'Anys': - return cls(Anys((lambda x: (_atd_read_list(Any_.from_json)(x[0])) if isinstance(x, list) and len(x) == 1 else _atd_bad_json('array of length 1', x))(x[1]))) - _atd_bad_json('Any_', x) - _atd_bad_json('Any_', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Any_': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Arg: - """Original type: argument = [ ... | Arg of ... | ... ]""" - - value: Expr - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Arg' - - def to_json(self) -> Any: - return ['Arg', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ArgKwd: - """Original type: argument = [ ... | ArgKwd of ... | ... ]""" - - value: Tuple[Ident, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ArgKwd' - - def to_json(self) -> Any: - return ['ArgKwd', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ArgKwdOptional: - """Original type: argument = [ ... | ArgKwdOptional of ... | ... ]""" - - value: Tuple[Ident, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ArgKwdOptional' - - def to_json(self) -> Any: - return ['ArgKwdOptional', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ArgType: - """Original type: argument = [ ... | ArgType of ... | ... ]""" - - value: Type - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ArgType' - - def to_json(self) -> Any: - return ['ArgType', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherArg: - """Original type: argument = [ ... | OtherArg of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherArg' - - def to_json(self) -> Any: - return ['OtherArg', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Argument: - """Original type: argument = [ ... ]""" - - value: Union[Arg, ArgKwd, ArgKwdOptional, ArgType, OtherArg] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Argument': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'Arg': - return cls(Arg(Expr.from_json(x[1]))) - if cons == 'ArgKwd': - return cls(ArgKwd((lambda x: (Ident.from_json(x[0]), Expr.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'ArgKwdOptional': - return cls(ArgKwdOptional((lambda x: (Ident.from_json(x[0]), Expr.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'ArgType': - return cls(ArgType(Type.from_json(x[1]))) - if cons == 'OtherArg': - return cls(OtherArg((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('Argument', x) - _atd_bad_json('Argument', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Argument': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Arguments: - """Original type: arguments""" - - value: ArgumentListBracket - - @classmethod - def from_json(cls, x: Any) -> 'Arguments': - return cls(ArgumentListBracket.from_json(x)) - - def to_json(self) -> Any: - return (lambda x: x.to_json())(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Arguments': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class KeywordAttr: - """Original type: attribute = [ ... | KeywordAttr of ... | ... ]""" - - value: KeywordAttributeWrap - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'KeywordAttr' - - def to_json(self) -> Any: - return ['KeywordAttr', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class NamedAttr: - """Original type: attribute = [ ... | NamedAttr of ... | ... ]""" - - value: Tuple[Tok, Name, Arguments] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'NamedAttr' - - def to_json(self) -> Any: - return ['NamedAttr', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherAttribute: - """Original type: attribute = [ ... | OtherAttribute of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherAttribute' - - def to_json(self) -> Any: - return ['OtherAttribute', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Attribute: - """Original type: attribute = [ ... ]""" - - value: Union[KeywordAttr, NamedAttr, OtherAttribute] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Attribute': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'KeywordAttr': - return cls(KeywordAttr(KeywordAttributeWrap.from_json(x[1]))) - if cons == 'NamedAttr': - return cls(NamedAttr((lambda x: (Tok.from_json(x[0]), Name.from_json(x[1]), Arguments.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'OtherAttribute': - return cls(OtherAttribute((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('Attribute', x) - _atd_bad_json('Attribute', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Attribute': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Case_: - """Original type: case = [ ... | Case of ... | ... ]""" - - value: Tuple[Tok, Pattern] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Case_' - - def to_json(self) -> Any: - return ['Case', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Default: - """Original type: case = [ ... | Default of ... | ... ]""" - - value: Tok - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Default' - - def to_json(self) -> Any: - return ['Default', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class CaseEqualExpr: - """Original type: case = [ ... | CaseEqualExpr of ... | ... ]""" - - value: Tuple[Tok, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'CaseEqualExpr' - - def to_json(self) -> Any: - return ['CaseEqualExpr', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherCase: - """Original type: case = [ ... | OtherCase of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherCase' - - def to_json(self) -> Any: - return ['OtherCase', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Case: - """Original type: case = [ ... ]""" - - value: Union[Case_, Default, CaseEqualExpr, OtherCase] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Case': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'Case': - return cls(Case_((lambda x: (Tok.from_json(x[0]), Pattern.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'Default': - return cls(Default(Tok.from_json(x[1]))) - if cons == 'CaseEqualExpr': - return cls(CaseEqualExpr((lambda x: (Tok.from_json(x[0]), Expr.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'OtherCase': - return cls(OtherCase((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('Case', x) - _atd_bad_json('Case', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Case': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class CasesAndBody: - """Original type: case_and_body = [ ... | CasesAndBody of ... | ... ]""" - - value: Tuple[List[Case], Stmt] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'CasesAndBody' - - def to_json(self) -> Any: - return ['CasesAndBody', (lambda x: [_atd_write_list((lambda x: x.to_json()))(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class CaseAndBody: - """Original type: case_and_body = [ ... ]""" - - value: Union[CasesAndBody] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'CaseAndBody': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'CasesAndBody': - return cls(CasesAndBody((lambda x: (_atd_read_list(Case.from_json)(x[0]), Stmt.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('CaseAndBody', x) - _atd_bad_json('CaseAndBody', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'CaseAndBody': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Catch: - """Original type: catch""" - - value: Tuple[Tok, CatchExn, Stmt] - - @classmethod - def from_json(cls, x: Any) -> 'Catch': - return cls((lambda x: (Tok.from_json(x[0]), CatchExn.from_json(x[1]), Stmt.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Catch': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class CatchPattern: - """Original type: catch_exn = [ ... | CatchPattern of ... | ... ]""" - - value: Pattern - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'CatchPattern' - - def to_json(self) -> Any: - return ['CatchPattern', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class CatchParam: - """Original type: catch_exn = [ ... | CatchParam of ... | ... ]""" - - value: ParameterClassic - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'CatchParam' - - def to_json(self) -> Any: - return ['CatchParam', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherCatch: - """Original type: catch_exn = [ ... | OtherCatch of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherCatch' - - def to_json(self) -> Any: - return ['OtherCatch', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class CatchExn: - """Original type: catch_exn = [ ... ]""" - - value: Union[CatchPattern, CatchParam, OtherCatch] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'CatchExn': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'CatchPattern': - return cls(CatchPattern(Pattern.from_json(x[1]))) - if cons == 'CatchParam': - return cls(CatchParam(ParameterClassic.from_json(x[1]))) - if cons == 'OtherCatch': - return cls(OtherCatch((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('CatchExn', x) - _atd_bad_json('CatchExn', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'CatchExn': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ClassDefinition: - """Original type: class_definition = { ... }""" - - ckind: ClassKindWrap - cextends: List[ClassParent] - cimplements: List[Type] - cmixins: List[Type] - cparams: Parameters - cbody: FieldListBracket - - @classmethod - def from_json(cls, x: Any) -> 'ClassDefinition': - if isinstance(x, dict): - return cls( - ckind=ClassKindWrap.from_json(x['ckind']) if 'ckind' in x else _atd_missing_json_field('ClassDefinition', 'ckind'), - cextends=_atd_read_list(ClassParent.from_json)(x['cextends']) if 'cextends' in x else _atd_missing_json_field('ClassDefinition', 'cextends'), - cimplements=_atd_read_list(Type.from_json)(x['cimplements']) if 'cimplements' in x else _atd_missing_json_field('ClassDefinition', 'cimplements'), - cmixins=_atd_read_list(Type.from_json)(x['cmixins']) if 'cmixins' in x else _atd_missing_json_field('ClassDefinition', 'cmixins'), - cparams=Parameters.from_json(x['cparams']) if 'cparams' in x else _atd_missing_json_field('ClassDefinition', 'cparams'), - cbody=FieldListBracket.from_json(x['cbody']) if 'cbody' in x else _atd_missing_json_field('ClassDefinition', 'cbody'), - ) - else: - _atd_bad_json('ClassDefinition', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['ckind'] = (lambda x: x.to_json())(self.ckind) - res['cextends'] = _atd_write_list((lambda x: x.to_json()))(self.cextends) - res['cimplements'] = _atd_write_list((lambda x: x.to_json()))(self.cimplements) - res['cmixins'] = _atd_write_list((lambda x: x.to_json()))(self.cmixins) - res['cparams'] = (lambda x: x.to_json())(self.cparams) - res['cbody'] = (lambda x: x.to_json())(self.cbody) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'ClassDefinition': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ClassParent: - """Original type: class_parent""" - - value: Tuple[Type, Optional[Arguments]] - - @classmethod - def from_json(cls, x: Any) -> 'ClassParent': - return cls((lambda x: (Type.from_json(x[0]), _atd_read_nullable(Arguments.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_nullable((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'ClassParent': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Comprehension: - """Original type: comprehension""" - - value: Tuple[Expr, List[ForOrIfComp]] - - @classmethod - def from_json(cls, x: Any) -> 'Comprehension': - return cls((lambda x: (Expr.from_json(x[0]), _atd_read_list(ForOrIfComp.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Comprehension': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Cond: - """Original type: condition = [ ... | Cond of ... | ... ]""" - - value: Expr - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Cond' - - def to_json(self) -> Any: - return ['Cond', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherCond: - """Original type: condition = [ ... | OtherCond of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherCond' - - def to_json(self) -> Any: - return ['OtherCond', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Condition: - """Original type: condition = [ ... ]""" - - value: Union[Cond, OtherCond] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Condition': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'Cond': - return cls(Cond(Expr.from_json(x[1]))) - if cons == 'OtherCond': - return cls(OtherCond((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('Condition', x) - _atd_bad_json('Condition', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Condition': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Definition: - """Original type: definition""" - - value: Tuple[Entity, DefinitionKind] - - @classmethod - def from_json(cls, x: Any) -> 'Definition': - return cls((lambda x: (Entity.from_json(x[0]), DefinitionKind.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Definition': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class FuncDef: - """Original type: definition_kind = [ ... | FuncDef of ... | ... ]""" - - value: FunctionDefinition - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'FuncDef' - - def to_json(self) -> Any: - return ['FuncDef', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class VarDef: - """Original type: definition_kind = [ ... | VarDef of ... | ... ]""" - - value: VariableDefinition - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'VarDef' - - def to_json(self) -> Any: - return ['VarDef', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ClassDef: - """Original type: definition_kind = [ ... | ClassDef of ... | ... ]""" - - value: ClassDefinition - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ClassDef' - - def to_json(self) -> Any: - return ['ClassDef', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class EnumEntryDef: - """Original type: definition_kind = [ ... | EnumEntryDef of ... | ... ]""" - - value: EnumEntryDefinition - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'EnumEntryDef' - - def to_json(self) -> Any: - return ['EnumEntryDef', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TypeDef: - """Original type: definition_kind = [ ... | TypeDef of ... | ... ]""" - - value: TypeDefinition - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TypeDef' - - def to_json(self) -> Any: - return ['TypeDef', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ModuleDef: - """Original type: definition_kind = [ ... | ModuleDef of ... | ... ]""" - - value: ModuleDefinition - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ModuleDef' - - def to_json(self) -> Any: - return ['ModuleDef', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class MacroDef: - """Original type: definition_kind = [ ... | MacroDef of ... | ... ]""" - - value: MacroDefinition - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'MacroDef' - - def to_json(self) -> Any: - return ['MacroDef', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Signature: - """Original type: definition_kind = [ ... | Signature of ... | ... ]""" - - value: Type - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Signature' - - def to_json(self) -> Any: - return ['Signature', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class UseOuterDecl: - """Original type: definition_kind = [ ... | UseOuterDecl of ... | ... ]""" - - value: Tok - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'UseOuterDecl' - - def to_json(self) -> Any: - return ['UseOuterDecl', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherDef: - """Original type: definition_kind = [ ... | OtherDef of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherDef' - - def to_json(self) -> Any: - return ['OtherDef', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class DefinitionKind: - """Original type: definition_kind = [ ... ]""" - - value: Union[FuncDef, VarDef, ClassDef, EnumEntryDef, TypeDef, ModuleDef, MacroDef, Signature, UseOuterDecl, OtherDef] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'DefinitionKind': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'FuncDef': - return cls(FuncDef(FunctionDefinition.from_json(x[1]))) - if cons == 'VarDef': - return cls(VarDef(VariableDefinition.from_json(x[1]))) - if cons == 'ClassDef': - return cls(ClassDef(ClassDefinition.from_json(x[1]))) - if cons == 'EnumEntryDef': - return cls(EnumEntryDef(EnumEntryDefinition.from_json(x[1]))) - if cons == 'TypeDef': - return cls(TypeDef(TypeDefinition.from_json(x[1]))) - if cons == 'ModuleDef': - return cls(ModuleDef(ModuleDefinition.from_json(x[1]))) - if cons == 'MacroDef': - return cls(MacroDef(MacroDefinition.from_json(x[1]))) - if cons == 'Signature': - return cls(Signature(Type.from_json(x[1]))) - if cons == 'UseOuterDecl': - return cls(UseOuterDecl(Tok.from_json(x[1]))) - if cons == 'OtherDef': - return cls(OtherDef((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('DefinitionKind', x) - _atd_bad_json('DefinitionKind', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'DefinitionKind': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ImportFrom: - """Original type: directive = [ ... | ImportFrom of ... | ... ]""" - - value: Tuple[Tok, ModuleName, List[ImportFromKind]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ImportFrom' - - def to_json(self) -> Any: - return ['ImportFrom', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), _atd_write_list((lambda x: x.to_json()))(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ImportAs: - """Original type: directive = [ ... | ImportAs of ... | ... ]""" - - value: Tuple[Tok, ModuleName, Optional[Alias]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ImportAs' - - def to_json(self) -> Any: - return ['ImportAs', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), _atd_write_nullable((lambda x: x.to_json()))(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ImportAll: - """Original type: directive = [ ... | ImportAll of ... | ... ]""" - - value: Tuple[Tok, ModuleName, Tok] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ImportAll' - - def to_json(self) -> Any: - return ['ImportAll', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Package: - """Original type: directive = [ ... | Package of ... | ... ]""" - - value: Tuple[Tok, DottedIdent] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Package' - - def to_json(self) -> Any: - return ['Package', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PackageEnd: - """Original type: directive = [ ... | PackageEnd of ... | ... ]""" - - value: Tok - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PackageEnd' - - def to_json(self) -> Any: - return ['PackageEnd', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Pragma: - """Original type: directive = [ ... | Pragma of ... | ... ]""" - - value: Tuple[Ident, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Pragma' - - def to_json(self) -> Any: - return ['Pragma', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherDirective: - """Original type: directive = [ ... | OtherDirective of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherDirective' - - def to_json(self) -> Any: - return ['OtherDirective', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Directive: - """Original type: directive = [ ... ]""" - - value: Union[ImportFrom, ImportAs, ImportAll, Package, PackageEnd, Pragma, OtherDirective] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Directive': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'ImportFrom': - return cls(ImportFrom((lambda x: (Tok.from_json(x[0]), ModuleName.from_json(x[1]), _atd_read_list(ImportFromKind.from_json)(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'ImportAs': - return cls(ImportAs((lambda x: (Tok.from_json(x[0]), ModuleName.from_json(x[1]), _atd_read_nullable(Alias.from_json)(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'ImportAll': - return cls(ImportAll((lambda x: (Tok.from_json(x[0]), ModuleName.from_json(x[1]), Tok.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'Package': - return cls(Package((lambda x: (Tok.from_json(x[0]), DottedIdent.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'PackageEnd': - return cls(PackageEnd(Tok.from_json(x[1]))) - if cons == 'Pragma': - return cls(Pragma((lambda x: (Ident.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'OtherDirective': - return cls(OtherDirective((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('Directive', x) - _atd_bad_json('Directive', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Directive': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Entity: - """Original type: entity = { ... }""" - - name: EntityName - attrs: List[Attribute] - tparams: TypeParameters - - @classmethod - def from_json(cls, x: Any) -> 'Entity': - if isinstance(x, dict): - return cls( - name=EntityName.from_json(x['name']) if 'name' in x else _atd_missing_json_field('Entity', 'name'), - attrs=_atd_read_list(Attribute.from_json)(x['attrs']) if 'attrs' in x else _atd_missing_json_field('Entity', 'attrs'), - tparams=TypeParameters.from_json(x['tparams']) if 'tparams' in x else _atd_missing_json_field('Entity', 'tparams'), - ) - else: - _atd_bad_json('Entity', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['name'] = (lambda x: x.to_json())(self.name) - res['attrs'] = _atd_write_list((lambda x: x.to_json()))(self.attrs) - res['tparams'] = (lambda x: x.to_json())(self.tparams) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'Entity': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class EN: - """Original type: entity_name = [ ... | EN of ... | ... ]""" - - value: Name - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'EN' - - def to_json(self) -> Any: - return ['EN', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class EDynamic: - """Original type: entity_name = [ ... | EDynamic of ... | ... ]""" - - value: Expr - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'EDynamic' - - def to_json(self) -> Any: - return ['EDynamic', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class EPattern: - """Original type: entity_name = [ ... | EPattern of ... | ... ]""" - - value: Pattern - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'EPattern' - - def to_json(self) -> Any: - return ['EPattern', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherEntity: - """Original type: entity_name = [ ... | OtherEntity of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherEntity' - - def to_json(self) -> Any: - return ['OtherEntity', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class EntityName: - """Original type: entity_name = [ ... ]""" - - value: Union[EN, EDynamic, EPattern, OtherEntity] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'EntityName': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'EN': - return cls(EN(Name.from_json(x[1]))) - if cons == 'EDynamic': - return cls(EDynamic(Expr.from_json(x[1]))) - if cons == 'EPattern': - return cls(EPattern(Pattern.from_json(x[1]))) - if cons == 'OtherEntity': - return cls(OtherEntity((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('EntityName', x) - _atd_bad_json('EntityName', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'EntityName': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class EnumEntryDefinition: - """Original type: enum_entry_definition = { ... }""" - - ee_args: Optional[Arguments] - ee_body: Optional[FieldListBracket] - - @classmethod - def from_json(cls, x: Any) -> 'EnumEntryDefinition': - if isinstance(x, dict): - return cls( - ee_args=_atd_read_nullable(Arguments.from_json)(x['ee_args']) if 'ee_args' in x else _atd_missing_json_field('EnumEntryDefinition', 'ee_args'), - ee_body=_atd_read_nullable(FieldListBracket.from_json)(x['ee_body']) if 'ee_body' in x else _atd_missing_json_field('EnumEntryDefinition', 'ee_body'), - ) - else: - _atd_bad_json('EnumEntryDefinition', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['ee_args'] = _atd_write_nullable((lambda x: x.to_json()))(self.ee_args) - res['ee_body'] = _atd_write_nullable((lambda x: x.to_json()))(self.ee_body) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'EnumEntryDefinition': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class L: - """Original type: expr = [ ... | L of ... | ... ]""" - - value: Literal - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'L' - - def to_json(self) -> Any: - return ['L', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Container: - """Original type: expr = [ ... | Container of ... | ... ]""" - - value: Tuple[ContainerOperator, ExprListBracket] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Container' - - def to_json(self) -> Any: - return ['Container', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Comprehension_: - """Original type: expr = [ ... | Comprehension of ... | ... ]""" - - value: Tuple[ContainerOperator, ComprehensionBracket] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Comprehension_' - - def to_json(self) -> Any: - return ['Comprehension', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Record: - """Original type: expr = [ ... | Record of ... | ... ]""" - - value: FieldListBracket - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Record' - - def to_json(self) -> Any: - return ['Record', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Constructor: - """Original type: expr = [ ... | Constructor of ... | ... ]""" - - value: Tuple[Name, ExprListBracket] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Constructor' - - def to_json(self) -> Any: - return ['Constructor', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class N: - """Original type: expr = [ ... | N of ... | ... ]""" - - value: Name - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'N' - - def to_json(self) -> Any: - return ['N', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class IdSpecial: - """Original type: expr = [ ... | IdSpecial of ... | ... ]""" - - value: SpecialWrap - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'IdSpecial' - - def to_json(self) -> Any: - return ['IdSpecial', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Call: - """Original type: expr = [ ... | Call of ... | ... ]""" - - value: Tuple[Expr, Arguments] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Call' - - def to_json(self) -> Any: - return ['Call', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class New: - """Original type: expr = [ ... | New of ... | ... ]""" - - value: Tuple[Tok, Type, Arguments] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'New' - - def to_json(self) -> Any: - return ['New', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Xml_: - """Original type: expr = [ ... | Xml of ... | ... ]""" - - value: Xml - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Xml_' - - def to_json(self) -> Any: - return ['Xml', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Assign: - """Original type: expr = [ ... | Assign of ... | ... ]""" - - value: Tuple[Expr, Tok, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Assign' - - def to_json(self) -> Any: - return ['Assign', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class AssignOp: - """Original type: expr = [ ... | AssignOp of ... | ... ]""" - - value: Tuple[Expr, OperatorWrap, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'AssignOp' - - def to_json(self) -> Any: - return ['AssignOp', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class LetPattern: - """Original type: expr = [ ... | LetPattern of ... | ... ]""" - - value: Tuple[Pattern, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'LetPattern' - - def to_json(self) -> Any: - return ['LetPattern', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class DotAccess: - """Original type: expr = [ ... | DotAccess of ... | ... ]""" - - value: Tuple[Expr, Tok, FieldName] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'DotAccess' - - def to_json(self) -> Any: - return ['DotAccess', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ArrayAccess: - """Original type: expr = [ ... | ArrayAccess of ... | ... ]""" - - value: Tuple[Expr, ExprBracket] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ArrayAccess' - - def to_json(self) -> Any: - return ['ArrayAccess', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class SliceAccess: - """Original type: expr = [ ... | SliceAccess of ... | ... ]""" - - value: Tuple[Expr, Bracket0ecc50b] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'SliceAccess' - - def to_json(self) -> Any: - return ['SliceAccess', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Lambda: - """Original type: expr = [ ... | Lambda of ... | ... ]""" - - value: FunctionDefinition - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Lambda' - - def to_json(self) -> Any: - return ['Lambda', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class AnonClass: - """Original type: expr = [ ... | AnonClass of ... | ... ]""" - - value: ClassDefinition - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'AnonClass' - - def to_json(self) -> Any: - return ['AnonClass', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Conditional: - """Original type: expr = [ ... | Conditional of ... | ... ]""" - - value: Tuple[Expr, Expr, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Conditional' - - def to_json(self) -> Any: - return ['Conditional', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Yield: - """Original type: expr = [ ... | Yield of ... | ... ]""" - - value: Tuple[Tok, Optional[Expr], bool] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Yield' - - def to_json(self) -> Any: - return ['Yield', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_nullable((lambda x: x.to_json()))(x[1]), _atd_write_bool(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Await: - """Original type: expr = [ ... | Await of ... | ... ]""" - - value: Tuple[Tok, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Await' - - def to_json(self) -> Any: - return ['Await', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Cast: - """Original type: expr = [ ... | Cast of ... | ... ]""" - - value: Tuple[Type, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Cast' - - def to_json(self) -> Any: - return ['Cast', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Seq: - """Original type: expr = [ ... | Seq of ... | ... ]""" - - value: List[Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Seq' - - def to_json(self) -> Any: - return ['Seq', _atd_write_list((lambda x: x.to_json()))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Ref: - """Original type: expr = [ ... | Ref of ... | ... ]""" - - value: Tuple[Tok, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Ref' - - def to_json(self) -> Any: - return ['Ref', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class DeRef: - """Original type: expr = [ ... | DeRef of ... | ... ]""" - - value: Tuple[Tok, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'DeRef' - - def to_json(self) -> Any: - return ['DeRef', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Ellipsis: - """Original type: expr = [ ... | Ellipsis of ... | ... ]""" - - value: Tok - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Ellipsis' - - def to_json(self) -> Any: - return ['Ellipsis', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ParenExpr: - """Original type: expr = [ ... | ParenExpr of ... | ... ]""" - - value: ExprBracket - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ParenExpr' - - def to_json(self) -> Any: - return ['ParenExpr', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class StmtExpr: - """Original type: expr = [ ... | StmtExpr of ... | ... ]""" - - value: Stmt - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'StmtExpr' - - def to_json(self) -> Any: - return ['StmtExpr', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherExpr: - """Original type: expr = [ ... | OtherExpr of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherExpr' - - def to_json(self) -> Any: - return ['OtherExpr', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Expr: - """Original type: expr = [ ... ]""" - - value: Union[L, Container, Comprehension_, Record, Constructor, N, IdSpecial, Call, New, Xml_, Assign, AssignOp, LetPattern, DotAccess, ArrayAccess, SliceAccess, Lambda, AnonClass, Conditional, Yield, Await, Cast, Seq, Ref, DeRef, Ellipsis, ParenExpr, StmtExpr, OtherExpr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Expr': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'L': - return cls(L(Literal.from_json(x[1]))) - if cons == 'Container': - return cls(Container((lambda x: (ContainerOperator.from_json(x[0]), ExprListBracket.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'Comprehension': - return cls(Comprehension_((lambda x: (ContainerOperator.from_json(x[0]), ComprehensionBracket.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'Record': - return cls(Record(FieldListBracket.from_json(x[1]))) - if cons == 'Constructor': - return cls(Constructor((lambda x: (Name.from_json(x[0]), ExprListBracket.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'N': - return cls(N(Name.from_json(x[1]))) - if cons == 'IdSpecial': - return cls(IdSpecial(SpecialWrap.from_json(x[1]))) - if cons == 'Call': - return cls(Call((lambda x: (Expr.from_json(x[0]), Arguments.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'New': - return cls(New((lambda x: (Tok.from_json(x[0]), Type.from_json(x[1]), Arguments.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'Xml': - return cls(Xml_(Xml.from_json(x[1]))) - if cons == 'Assign': - return cls(Assign((lambda x: (Expr.from_json(x[0]), Tok.from_json(x[1]), Expr.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'AssignOp': - return cls(AssignOp((lambda x: (Expr.from_json(x[0]), OperatorWrap.from_json(x[1]), Expr.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'LetPattern': - return cls(LetPattern((lambda x: (Pattern.from_json(x[0]), Expr.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'DotAccess': - return cls(DotAccess((lambda x: (Expr.from_json(x[0]), Tok.from_json(x[1]), FieldName.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'ArrayAccess': - return cls(ArrayAccess((lambda x: (Expr.from_json(x[0]), ExprBracket.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'SliceAccess': - return cls(SliceAccess((lambda x: (Expr.from_json(x[0]), Bracket0ecc50b.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'Lambda': - return cls(Lambda(FunctionDefinition.from_json(x[1]))) - if cons == 'AnonClass': - return cls(AnonClass(ClassDefinition.from_json(x[1]))) - if cons == 'Conditional': - return cls(Conditional((lambda x: (Expr.from_json(x[0]), Expr.from_json(x[1]), Expr.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'Yield': - return cls(Yield((lambda x: (Tok.from_json(x[0]), _atd_read_nullable(Expr.from_json)(x[1]), _atd_read_bool(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'Await': - return cls(Await((lambda x: (Tok.from_json(x[0]), Expr.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'Cast': - return cls(Cast((lambda x: (Type.from_json(x[0]), Expr.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'Seq': - return cls(Seq(_atd_read_list(Expr.from_json)(x[1]))) - if cons == 'Ref': - return cls(Ref((lambda x: (Tok.from_json(x[0]), Expr.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'DeRef': - return cls(DeRef((lambda x: (Tok.from_json(x[0]), Expr.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'Ellipsis': - return cls(Ellipsis(Tok.from_json(x[1]))) - if cons == 'ParenExpr': - return cls(ParenExpr(ExprBracket.from_json(x[1]))) - if cons == 'StmtExpr': - return cls(StmtExpr(Stmt.from_json(x[1]))) - if cons == 'OtherExpr': - return cls(OtherExpr((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('Expr', x) - _atd_bad_json('Expr', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Expr': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class F: - """Original type: field = [ ... | F of ... | ... ]""" - - value: Stmt - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'F' - - def to_json(self) -> Any: - return ['F', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Field: - """Original type: field = [ ... ]""" - - value: Union[F] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Field': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'F': - return cls(F(Stmt.from_json(x[1]))) - _atd_bad_json('Field', x) - _atd_bad_json('Field', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Field': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class FN: - """Original type: field_name = [ ... | FN of ... | ... ]""" - - value: Name - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'FN' - - def to_json(self) -> Any: - return ['FN', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FDynamic: - """Original type: field_name = [ ... | FDynamic of ... | ... ]""" - - value: Expr - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'FDynamic' - - def to_json(self) -> Any: - return ['FDynamic', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FieldName: - """Original type: field_name = [ ... ]""" - - value: Union[FN, FDynamic] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'FieldName': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'FN': - return cls(FN(Name.from_json(x[1]))) - if cons == 'FDynamic': - return cls(FDynamic(Expr.from_json(x[1]))) - _atd_bad_json('FieldName', x) - _atd_bad_json('FieldName', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'FieldName': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Finally: - """Original type: finally""" - - value: Tuple[Tok, Stmt] - - @classmethod - def from_json(cls, x: Any) -> 'Finally': - return cls((lambda x: (Tok.from_json(x[0]), Stmt.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Finally': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ForEach: - """Original type: for_each""" - - value: Tuple[Pattern, Tok, Expr] - - @classmethod - def from_json(cls, x: Any) -> 'ForEach': - return cls((lambda x: (Pattern.from_json(x[0]), Tok.from_json(x[1]), Expr.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x)) - - def to_json(self) -> Any: - return (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'ForEach': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ForClassic: - """Original type: for_header = [ ... | ForClassic of ... | ... ]""" - - value: Tuple[List[ForVarOrExpr], Optional[Expr], Optional[Expr]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ForClassic' - - def to_json(self) -> Any: - return ['ForClassic', (lambda x: [_atd_write_list((lambda x: x.to_json()))(x[0]), _atd_write_nullable((lambda x: x.to_json()))(x[1]), _atd_write_nullable((lambda x: x.to_json()))(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ForEach_: - """Original type: for_header = [ ... | ForEach of ... | ... ]""" - - value: ForEach - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ForEach_' - - def to_json(self) -> Any: - return ['ForEach', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class MultiForEach_: - """Original type: for_header = [ ... | MultiForEach of ... | ... ]""" - - value: List[MultiForEach] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'MultiForEach_' - - def to_json(self) -> Any: - return ['MultiForEach', _atd_write_list((lambda x: x.to_json()))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ForIn: - """Original type: for_header = [ ... | ForIn of ... | ... ]""" - - value: Tuple[List[ForVarOrExpr], List[Expr]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ForIn' - - def to_json(self) -> Any: - return ['ForIn', (lambda x: [_atd_write_list((lambda x: x.to_json()))(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ForHeader: - """Original type: for_header = [ ... ]""" - - value: Union[ForClassic, ForEach_, MultiForEach_, ForIn] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ForHeader': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'ForClassic': - return cls(ForClassic((lambda x: (_atd_read_list(ForVarOrExpr.from_json)(x[0]), _atd_read_nullable(Expr.from_json)(x[1]), _atd_read_nullable(Expr.from_json)(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'ForEach': - return cls(ForEach_(ForEach.from_json(x[1]))) - if cons == 'MultiForEach': - return cls(MultiForEach_(_atd_read_list(MultiForEach.from_json)(x[1]))) - if cons == 'ForIn': - return cls(ForIn((lambda x: (_atd_read_list(ForVarOrExpr.from_json)(x[0]), _atd_read_list(Expr.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('ForHeader', x) - _atd_bad_json('ForHeader', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'ForHeader': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class CompFor: - """Original type: for_or_if_comp = [ ... | CompFor of ... | ... ]""" - - value: Tuple[Tok, Pattern, Tok, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'CompFor' - - def to_json(self) -> Any: - return ['CompFor', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2]), (lambda x: x.to_json())(x[3])] if isinstance(x, tuple) and len(x) == 4 else _atd_bad_python('tuple of length 4', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class CompIf: - """Original type: for_or_if_comp = [ ... | CompIf of ... | ... ]""" - - value: Tuple[Tok, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'CompIf' - - def to_json(self) -> Any: - return ['CompIf', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ForOrIfComp: - """Original type: for_or_if_comp = [ ... ]""" - - value: Union[CompFor, CompIf] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ForOrIfComp': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'CompFor': - return cls(CompFor((lambda x: (Tok.from_json(x[0]), Pattern.from_json(x[1]), Tok.from_json(x[2]), Expr.from_json(x[3])) if isinstance(x, list) and len(x) == 4 else _atd_bad_json('array of length 4', x))(x[1]))) - if cons == 'CompIf': - return cls(CompIf((lambda x: (Tok.from_json(x[0]), Expr.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('ForOrIfComp', x) - _atd_bad_json('ForOrIfComp', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'ForOrIfComp': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ForInitVar: - """Original type: for_var_or_expr = [ ... | ForInitVar of ... | ... ]""" - - value: Tuple[Entity, VariableDefinition] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ForInitVar' - - def to_json(self) -> Any: - return ['ForInitVar', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ForInitExpr: - """Original type: for_var_or_expr = [ ... | ForInitExpr of ... | ... ]""" - - value: Expr - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ForInitExpr' - - def to_json(self) -> Any: - return ['ForInitExpr', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ForVarOrExpr: - """Original type: for_var_or_expr = [ ... ]""" - - value: Union[ForInitVar, ForInitExpr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ForVarOrExpr': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'ForInitVar': - return cls(ForInitVar((lambda x: (Entity.from_json(x[0]), VariableDefinition.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'ForInitExpr': - return cls(ForInitExpr(Expr.from_json(x[1]))) - _atd_bad_json('ForVarOrExpr', x) - _atd_bad_json('ForVarOrExpr', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'ForVarOrExpr': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class FBStmt: - """Original type: function_body = [ ... | FBStmt of ... | ... ]""" - - value: Stmt - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'FBStmt' - - def to_json(self) -> Any: - return ['FBStmt', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FBExpr: - """Original type: function_body = [ ... | FBExpr of ... | ... ]""" - - value: Expr - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'FBExpr' - - def to_json(self) -> Any: - return ['FBExpr', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FBDecl: - """Original type: function_body = [ ... | FBDecl of ... | ... ]""" - - value: Sc - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'FBDecl' - - def to_json(self) -> Any: - return ['FBDecl', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FBNothing: - """Original type: function_body = [ ... | FBNothing | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'FBNothing' - - @staticmethod - def to_json() -> Any: - return 'FBNothing' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FunctionBody: - """Original type: function_body = [ ... ]""" - - value: Union[FBStmt, FBExpr, FBDecl, FBNothing] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'FunctionBody': - if isinstance(x, str): - if x == 'FBNothing': - return cls(FBNothing()) - _atd_bad_json('FunctionBody', x) - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'FBStmt': - return cls(FBStmt(Stmt.from_json(x[1]))) - if cons == 'FBExpr': - return cls(FBExpr(Expr.from_json(x[1]))) - if cons == 'FBDecl': - return cls(FBDecl(Sc.from_json(x[1]))) - _atd_bad_json('FunctionBody', x) - _atd_bad_json('FunctionBody', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'FunctionBody': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class FunctionDefinition: - """Original type: function_definition = { ... }""" - - fkind: FunctionKindWrap - fparams: Parameters - frettype: Optional[Type] - fbody: FunctionBody - - @classmethod - def from_json(cls, x: Any) -> 'FunctionDefinition': - if isinstance(x, dict): - return cls( - fkind=FunctionKindWrap.from_json(x['fkind']) if 'fkind' in x else _atd_missing_json_field('FunctionDefinition', 'fkind'), - fparams=Parameters.from_json(x['fparams']) if 'fparams' in x else _atd_missing_json_field('FunctionDefinition', 'fparams'), - frettype=_atd_read_nullable(Type.from_json)(x['frettype']) if 'frettype' in x else _atd_missing_json_field('FunctionDefinition', 'frettype'), - fbody=FunctionBody.from_json(x['fbody']) if 'fbody' in x else _atd_missing_json_field('FunctionDefinition', 'fbody'), - ) - else: - _atd_bad_json('FunctionDefinition', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['fkind'] = (lambda x: x.to_json())(self.fkind) - res['fparams'] = (lambda x: x.to_json())(self.fparams) - res['frettype'] = _atd_write_nullable((lambda x: x.to_json()))(self.frettype) - res['fbody'] = (lambda x: x.to_json())(self.fbody) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'FunctionDefinition': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class IdInfo: - """Original type: id_info = { ... }""" - - id_resolved: Optional[ResolvedName] = None - id_type: Optional[Type] = None - id_svalue: Optional[Svalue] = None - - @classmethod - def from_json(cls, x: Any) -> 'IdInfo': - if isinstance(x, dict): - return cls( - id_resolved=ResolvedName.from_json(x['id_resolved']) if 'id_resolved' in x else None, - id_type=Type.from_json(x['id_type']) if 'id_type' in x else None, - id_svalue=Svalue.from_json(x['id_svalue']) if 'id_svalue' in x else None, - ) - else: - _atd_bad_json('IdInfo', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - if self.id_resolved is not None: - res['id_resolved'] = (lambda x: x.to_json())(self.id_resolved) - if self.id_type is not None: - res['id_type'] = (lambda x: x.to_json())(self.id_type) - if self.id_svalue is not None: - res['id_svalue'] = (lambda x: x.to_json())(self.id_svalue) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'IdInfo': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Direct: - """Original type: import_from_kind = [ ... | Direct of ... | ... ]""" - - value: Alias - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Direct' - - def to_json(self) -> Any: - return ['Direct', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Aliased: - """Original type: import_from_kind = [ ... | Aliased of ... | ... ]""" - - value: Tuple[Ident, Alias] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Aliased' - - def to_json(self) -> Any: - return ['Aliased', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ImportFromKind: - """Original type: import_from_kind = [ ... ]""" - - value: Union[Direct, Aliased] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ImportFromKind': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'Direct': - return cls(Direct(Alias.from_json(x[1]))) - if cons == 'Aliased': - return cls(Aliased((lambda x: (Ident.from_json(x[0]), Alias.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('ImportFromKind', x) - _atd_bad_json('ImportFromKind', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'ImportFromKind': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Item: - """Original type: item""" - - value: Stmt - - @classmethod - def from_json(cls, x: Any) -> 'Item': - return cls(Stmt.from_json(x)) - - def to_json(self) -> Any: - return (lambda x: x.to_json())(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Item': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class LNone: - """Original type: label_ident = [ ... | LNone | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'LNone' - - @staticmethod - def to_json() -> Any: - return 'LNone' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class LId: - """Original type: label_ident = [ ... | LId of ... | ... ]""" - - value: Label - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'LId' - - def to_json(self) -> Any: - return ['LId', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class LInt: - """Original type: label_ident = [ ... | LInt of ... | ... ]""" - - value: IntWrap - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'LInt' - - def to_json(self) -> Any: - return ['LInt', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class LDynamic: - """Original type: label_ident = [ ... | LDynamic of ... | ... ]""" - - value: Expr - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'LDynamic' - - def to_json(self) -> Any: - return ['LDynamic', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class LabelIdent: - """Original type: label_ident = [ ... ]""" - - value: Union[LNone, LId, LInt, LDynamic] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'LabelIdent': - if isinstance(x, str): - if x == 'LNone': - return cls(LNone()) - _atd_bad_json('LabelIdent', x) - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'LId': - return cls(LId(Label.from_json(x[1]))) - if cons == 'LInt': - return cls(LInt(IntWrap.from_json(x[1]))) - if cons == 'LDynamic': - return cls(LDynamic(Expr.from_json(x[1]))) - _atd_bad_json('LabelIdent', x) - _atd_bad_json('LabelIdent', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'LabelIdent': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class MacroDefinition: - """Original type: macro_definition = { ... }""" - - macroparams: List[Ident] - macrobody: List[Any_] - - @classmethod - def from_json(cls, x: Any) -> 'MacroDefinition': - if isinstance(x, dict): - return cls( - macroparams=_atd_read_list(Ident.from_json)(x['macroparams']) if 'macroparams' in x else _atd_missing_json_field('MacroDefinition', 'macroparams'), - macrobody=_atd_read_list(Any_.from_json)(x['macrobody']) if 'macrobody' in x else _atd_missing_json_field('MacroDefinition', 'macrobody'), - ) - else: - _atd_bad_json('MacroDefinition', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['macroparams'] = _atd_write_list((lambda x: x.to_json()))(self.macroparams) - res['macrobody'] = _atd_write_list((lambda x: x.to_json()))(self.macrobody) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'MacroDefinition': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ModuleDefinition: - """Original type: module_definition = { ... }""" - - mbody: ModuleDefinitionKind - - @classmethod - def from_json(cls, x: Any) -> 'ModuleDefinition': - if isinstance(x, dict): - return cls( - mbody=ModuleDefinitionKind.from_json(x['mbody']) if 'mbody' in x else _atd_missing_json_field('ModuleDefinition', 'mbody'), - ) - else: - _atd_bad_json('ModuleDefinition', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['mbody'] = (lambda x: x.to_json())(self.mbody) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'ModuleDefinition': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ModuleAlias: - """Original type: module_definition_kind = [ ... | ModuleAlias of ... | ... ]""" - - value: DottedIdent - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ModuleAlias' - - def to_json(self) -> Any: - return ['ModuleAlias', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ModuleStruct: - """Original type: module_definition_kind = [ ... | ModuleStruct of ... | ... ]""" - - value: Tuple[Optional[DottedIdent], List[Item]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ModuleStruct' - - def to_json(self) -> Any: - return ['ModuleStruct', (lambda x: [_atd_write_nullable((lambda x: x.to_json()))(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherModule: - """Original type: module_definition_kind = [ ... | OtherModule of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherModule' - - def to_json(self) -> Any: - return ['OtherModule', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ModuleDefinitionKind: - """Original type: module_definition_kind = [ ... ]""" - - value: Union[ModuleAlias, ModuleStruct, OtherModule] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'ModuleDefinitionKind': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'ModuleAlias': - return cls(ModuleAlias(DottedIdent.from_json(x[1]))) - if cons == 'ModuleStruct': - return cls(ModuleStruct((lambda x: (_atd_read_nullable(DottedIdent.from_json)(x[0]), _atd_read_list(Item.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'OtherModule': - return cls(OtherModule((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('ModuleDefinitionKind', x) - _atd_bad_json('ModuleDefinitionKind', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'ModuleDefinitionKind': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class FE: - """Original type: multi_for_each = [ ... | FE of ... | ... ]""" - - value: ForEach - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'FE' - - def to_json(self) -> Any: - return ['FE', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class FECond: - """Original type: multi_for_each = [ ... | FECond of ... | ... ]""" - - value: Tuple[ForEach, Tok, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'FECond' - - def to_json(self) -> Any: - return ['FECond', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class MultiForEach: - """Original type: multi_for_each = [ ... ]""" - - value: Union[FE, FECond] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'MultiForEach': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'FE': - return cls(FE(ForEach.from_json(x[1]))) - if cons == 'FECond': - return cls(FECond((lambda x: (ForEach.from_json(x[0]), Tok.from_json(x[1]), Expr.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - _atd_bad_json('MultiForEach', x) - _atd_bad_json('MultiForEach', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'MultiForEach': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Id: - """Original type: name = [ ... | Id of ... | ... ]""" - - value: Tuple[Ident, IdInfo] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Id' - - def to_json(self) -> Any: - return ['Id', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class IdQualified: - """Original type: name = [ ... | IdQualified of ... | ... ]""" - - value: QualifiedInfo - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'IdQualified' - - def to_json(self) -> Any: - return ['IdQualified', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Name: - """Original type: name = [ ... ]""" - - value: Union[Id, IdQualified] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Name': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'Id': - return cls(Id((lambda x: (Ident.from_json(x[0]), IdInfo.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'IdQualified': - return cls(IdQualified(QualifiedInfo.from_json(x[1]))) - _atd_bad_json('Name', x) - _atd_bad_json('Name', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Name': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class OrConstructor: - """Original type: or_type_element = [ ... | OrConstructor of ... | ... ]""" - - value: Tuple[Ident, List[Type]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OrConstructor' - - def to_json(self) -> Any: - return ['OrConstructor', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OrEnum: - """Original type: or_type_element = [ ... | OrEnum of ... | ... ]""" - - value: Tuple[Ident, Optional[Expr]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OrEnum' - - def to_json(self) -> Any: - return ['OrEnum', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_nullable((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OrUnion: - """Original type: or_type_element = [ ... | OrUnion of ... | ... ]""" - - value: Tuple[Ident, Type] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OrUnion' - - def to_json(self) -> Any: - return ['OrUnion', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherOr: - """Original type: or_type_element = [ ... | OtherOr of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherOr' - - def to_json(self) -> Any: - return ['OtherOr', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OrTypeElement: - """Original type: or_type_element = [ ... ]""" - - value: Union[OrConstructor, OrEnum, OrUnion, OtherOr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'OrTypeElement': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'OrConstructor': - return cls(OrConstructor((lambda x: (Ident.from_json(x[0]), _atd_read_list(Type.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'OrEnum': - return cls(OrEnum((lambda x: (Ident.from_json(x[0]), _atd_read_nullable(Expr.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'OrUnion': - return cls(OrUnion((lambda x: (Ident.from_json(x[0]), Type.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'OtherOr': - return cls(OtherOr((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('OrTypeElement', x) - _atd_bad_json('OrTypeElement', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'OrTypeElement': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ParamClassic: - """Original type: parameter = [ ... | ParamClassic of ... | ... ]""" - - value: ParameterClassic - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ParamClassic' - - def to_json(self) -> Any: - return ['ParamClassic', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ParamPattern: - """Original type: parameter = [ ... | ParamPattern of ... | ... ]""" - - value: Pattern - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ParamPattern' - - def to_json(self) -> Any: - return ['ParamPattern', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ParamRest: - """Original type: parameter = [ ... | ParamRest of ... | ... ]""" - - value: Tuple[Tok, ParameterClassic] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ParamRest' - - def to_json(self) -> Any: - return ['ParamRest', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class ParamHashSplat: - """Original type: parameter = [ ... | ParamHashSplat of ... | ... ]""" - - value: Tuple[Tok, ParameterClassic] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ParamHashSplat' - - def to_json(self) -> Any: - return ['ParamHashSplat', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherParam: - """Original type: parameter = [ ... | OtherParam of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherParam' - - def to_json(self) -> Any: - return ['OtherParam', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Parameter: - """Original type: parameter = [ ... ]""" - - value: Union[ParamClassic, ParamPattern, ParamRest, ParamHashSplat, OtherParam] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Parameter': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'ParamClassic': - return cls(ParamClassic(ParameterClassic.from_json(x[1]))) - if cons == 'ParamPattern': - return cls(ParamPattern(Pattern.from_json(x[1]))) - if cons == 'ParamRest': - return cls(ParamRest((lambda x: (Tok.from_json(x[0]), ParameterClassic.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'ParamHashSplat': - return cls(ParamHashSplat((lambda x: (Tok.from_json(x[0]), ParameterClassic.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'OtherParam': - return cls(OtherParam((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('Parameter', x) - _atd_bad_json('Parameter', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Parameter': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ParameterClassic: - """Original type: parameter_classic = { ... }""" - - pname: Optional[Ident] - ptype: Optional[Type] - pdefault: Optional[Expr] - pattrs: List[Attribute] - pinfo: IdInfo - - @classmethod - def from_json(cls, x: Any) -> 'ParameterClassic': - if isinstance(x, dict): - return cls( - pname=_atd_read_nullable(Ident.from_json)(x['pname']) if 'pname' in x else _atd_missing_json_field('ParameterClassic', 'pname'), - ptype=_atd_read_nullable(Type.from_json)(x['ptype']) if 'ptype' in x else _atd_missing_json_field('ParameterClassic', 'ptype'), - pdefault=_atd_read_nullable(Expr.from_json)(x['pdefault']) if 'pdefault' in x else _atd_missing_json_field('ParameterClassic', 'pdefault'), - pattrs=_atd_read_list(Attribute.from_json)(x['pattrs']) if 'pattrs' in x else _atd_missing_json_field('ParameterClassic', 'pattrs'), - pinfo=IdInfo.from_json(x['pinfo']) if 'pinfo' in x else _atd_missing_json_field('ParameterClassic', 'pinfo'), - ) - else: - _atd_bad_json('ParameterClassic', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['pname'] = _atd_write_nullable((lambda x: x.to_json()))(self.pname) - res['ptype'] = _atd_write_nullable((lambda x: x.to_json()))(self.ptype) - res['pdefault'] = _atd_write_nullable((lambda x: x.to_json()))(self.pdefault) - res['pattrs'] = _atd_write_list((lambda x: x.to_json()))(self.pattrs) - res['pinfo'] = (lambda x: x.to_json())(self.pinfo) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'ParameterClassic': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Parameters: - """Original type: parameters""" - - value: List[Parameter] - - @classmethod - def from_json(cls, x: Any) -> 'Parameters': - return cls(_atd_read_list(Parameter.from_json)(x)) - - def to_json(self) -> Any: - return _atd_write_list((lambda x: x.to_json()))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Parameters': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class PatLiteral: - """Original type: pattern = [ ... | PatLiteral of ... | ... ]""" - - value: Literal - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PatLiteral' - - def to_json(self) -> Any: - return ['PatLiteral', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PatConstructor: - """Original type: pattern = [ ... | PatConstructor of ... | ... ]""" - - value: Tuple[Name, List[Pattern]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PatConstructor' - - def to_json(self) -> Any: - return ['PatConstructor', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PatRecord: - """Original type: pattern = [ ... | PatRecord of ... | ... ]""" - - value: DottedIdentPatternListBracket - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PatRecord' - - def to_json(self) -> Any: - return ['PatRecord', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PatId: - """Original type: pattern = [ ... | PatId of ... | ... ]""" - - value: Tuple[Ident, IdInfo] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PatId' - - def to_json(self) -> Any: - return ['PatId', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PatTuple: - """Original type: pattern = [ ... | PatTuple of ... | ... ]""" - - value: PatternListBracket - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PatTuple' - - def to_json(self) -> Any: - return ['PatTuple', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PatList: - """Original type: pattern = [ ... | PatList of ... | ... ]""" - - value: PatternListBracket - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PatList' - - def to_json(self) -> Any: - return ['PatList', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PatKeyVal: - """Original type: pattern = [ ... | PatKeyVal of ... | ... ]""" - - value: Tuple[Pattern, Pattern] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PatKeyVal' - - def to_json(self) -> Any: - return ['PatKeyVal', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PatWildcard: - """Original type: pattern = [ ... | PatWildcard of ... | ... ]""" - - value: Tok - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PatWildcard' - - def to_json(self) -> Any: - return ['PatWildcard', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PatDisj: - """Original type: pattern = [ ... | PatDisj of ... | ... ]""" - - value: Tuple[Pattern, Pattern] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PatDisj' - - def to_json(self) -> Any: - return ['PatDisj', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PatTyped: - """Original type: pattern = [ ... | PatTyped of ... | ... ]""" - - value: Tuple[Pattern, Type] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PatTyped' - - def to_json(self) -> Any: - return ['PatTyped', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PatWhen: - """Original type: pattern = [ ... | PatWhen of ... | ... ]""" - - value: Tuple[Pattern, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PatWhen' - - def to_json(self) -> Any: - return ['PatWhen', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PatAs: - """Original type: pattern = [ ... | PatAs of ... | ... ]""" - - value: Tuple[Pattern, Tuple[Ident, IdInfo]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PatAs' - - def to_json(self) -> Any: - return ['PatAs', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class PatType: - """Original type: pattern = [ ... | PatType of ... | ... ]""" - - value: Type - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'PatType' - - def to_json(self) -> Any: - return ['PatType', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherPat: - """Original type: pattern = [ ... | OtherPat of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherPat' - - def to_json(self) -> Any: - return ['OtherPat', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Pattern: - """Original type: pattern = [ ... ]""" - - value: Union[PatLiteral, PatConstructor, PatRecord, PatId, PatTuple, PatList, PatKeyVal, PatWildcard, PatDisj, PatTyped, PatWhen, PatAs, PatType, OtherPat] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Pattern': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'PatLiteral': - return cls(PatLiteral(Literal.from_json(x[1]))) - if cons == 'PatConstructor': - return cls(PatConstructor((lambda x: (Name.from_json(x[0]), _atd_read_list(Pattern.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'PatRecord': - return cls(PatRecord(DottedIdentPatternListBracket.from_json(x[1]))) - if cons == 'PatId': - return cls(PatId((lambda x: (Ident.from_json(x[0]), IdInfo.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'PatTuple': - return cls(PatTuple(PatternListBracket.from_json(x[1]))) - if cons == 'PatList': - return cls(PatList(PatternListBracket.from_json(x[1]))) - if cons == 'PatKeyVal': - return cls(PatKeyVal((lambda x: (Pattern.from_json(x[0]), Pattern.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'PatWildcard': - return cls(PatWildcard(Tok.from_json(x[1]))) - if cons == 'PatDisj': - return cls(PatDisj((lambda x: (Pattern.from_json(x[0]), Pattern.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'PatTyped': - return cls(PatTyped((lambda x: (Pattern.from_json(x[0]), Type.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'PatWhen': - return cls(PatWhen((lambda x: (Pattern.from_json(x[0]), Expr.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'PatAs': - return cls(PatAs((lambda x: (Pattern.from_json(x[0]), (lambda x: (Ident.from_json(x[0]), IdInfo.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'PatType': - return cls(PatType(Type.from_json(x[1]))) - if cons == 'OtherPat': - return cls(OtherPat((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('Pattern', x) - _atd_bad_json('Pattern', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Pattern': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class QualifiedInfo: - """Original type: qualified_info = { ... }""" - - name_last: Tuple[Ident, Optional[TypeArguments]] - name_info: IdInfo - name_middle: Optional[Qualifier] = None - name_top: Optional[Tok] = None - - @classmethod - def from_json(cls, x: Any) -> 'QualifiedInfo': - if isinstance(x, dict): - return cls( - name_last=(lambda x: (Ident.from_json(x[0]), _atd_read_nullable(TypeArguments.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x['name_last']) if 'name_last' in x else _atd_missing_json_field('QualifiedInfo', 'name_last'), - name_info=IdInfo.from_json(x['name_info']) if 'name_info' in x else _atd_missing_json_field('QualifiedInfo', 'name_info'), - name_middle=Qualifier.from_json(x['name_middle']) if 'name_middle' in x else None, - name_top=Tok.from_json(x['name_top']) if 'name_top' in x else None, - ) - else: - _atd_bad_json('QualifiedInfo', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['name_last'] = (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_nullable((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.name_last) - res['name_info'] = (lambda x: x.to_json())(self.name_info) - if self.name_middle is not None: - res['name_middle'] = (lambda x: x.to_json())(self.name_middle) - if self.name_top is not None: - res['name_top'] = (lambda x: x.to_json())(self.name_top) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'QualifiedInfo': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class QDots: - """Original type: qualifier = [ ... | QDots of ... | ... ]""" - - value: List[Tuple[Ident, Optional[TypeArguments]]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'QDots' - - def to_json(self) -> Any: - return ['QDots', _atd_write_list((lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_nullable((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x)))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class QExpr: - """Original type: qualifier = [ ... | QExpr of ... | ... ]""" - - value: Tuple[Expr, Tok] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'QExpr' - - def to_json(self) -> Any: - return ['QExpr', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Qualifier: - """Original type: qualifier = [ ... ]""" - - value: Union[QDots, QExpr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Qualifier': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'QDots': - return cls(QDots(_atd_read_list((lambda x: (Ident.from_json(x[0]), _atd_read_nullable(TypeArguments.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x)))(x[1]))) - if cons == 'QExpr': - return cls(QExpr((lambda x: (Expr.from_json(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('Qualifier', x) - _atd_bad_json('Qualifier', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Qualifier': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class ExprStmt: - """Original type: stmt = [ ... | ExprStmt of ... | ... ]""" - - value: Tuple[Expr, Sc] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'ExprStmt' - - def to_json(self) -> Any: - return ['ExprStmt', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Block: - """Original type: stmt = [ ... | Block of ... | ... ]""" - - value: StmtListBracket - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Block' - - def to_json(self) -> Any: - return ['Block', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class If: - """Original type: stmt = [ ... | If of ... | ... ]""" - - value: Tuple[Tok, Condition, Stmt, Optional[Stmt]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'If' - - def to_json(self) -> Any: - return ['If', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2]), _atd_write_nullable((lambda x: x.to_json()))(x[3])] if isinstance(x, tuple) and len(x) == 4 else _atd_bad_python('tuple of length 4', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class While: - """Original type: stmt = [ ... | While of ... | ... ]""" - - value: Tuple[Tok, Condition, Stmt] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'While' - - def to_json(self) -> Any: - return ['While', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Return: - """Original type: stmt = [ ... | Return of ... | ... ]""" - - value: Tuple[Tok, Optional[Expr], Sc] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Return' - - def to_json(self) -> Any: - return ['Return', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_nullable((lambda x: x.to_json()))(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class DoWhile: - """Original type: stmt = [ ... | DoWhile of ... | ... ]""" - - value: Tuple[Tok, Stmt, Expr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'DoWhile' - - def to_json(self) -> Any: - return ['DoWhile', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class For: - """Original type: stmt = [ ... | For of ... | ... ]""" - - value: Tuple[Tok, ForHeader, Stmt] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'For' - - def to_json(self) -> Any: - return ['For', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Switch: - """Original type: stmt = [ ... | Switch of ... | ... ]""" - - value: Tuple[Tok, Optional[Condition], List[CaseAndBody]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Switch' - - def to_json(self) -> Any: - return ['Switch', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_nullable((lambda x: x.to_json()))(x[1]), _atd_write_list((lambda x: x.to_json()))(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Continue: - """Original type: stmt = [ ... | Continue of ... | ... ]""" - - value: Tuple[Tok, LabelIdent, Sc] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Continue' - - def to_json(self) -> Any: - return ['Continue', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Break: - """Original type: stmt = [ ... | Break of ... | ... ]""" - - value: Tuple[Tok, LabelIdent, Sc] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Break' - - def to_json(self) -> Any: - return ['Break', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Label_: - """Original type: stmt = [ ... | Label of ... | ... ]""" - - value: Tuple[Label, Stmt] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Label_' - - def to_json(self) -> Any: - return ['Label', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Goto: - """Original type: stmt = [ ... | Goto of ... | ... ]""" - - value: Tuple[Tok, Label] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Goto' - - def to_json(self) -> Any: - return ['Goto', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Throw: - """Original type: stmt = [ ... | Throw of ... | ... ]""" - - value: Tuple[Tok, Expr, Sc] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Throw' - - def to_json(self) -> Any: - return ['Throw', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Try: - """Original type: stmt = [ ... | Try of ... | ... ]""" - - value: Tuple[Tok, Stmt, List[Catch], Optional[Finally]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Try' - - def to_json(self) -> Any: - return ['Try', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), _atd_write_list((lambda x: x.to_json()))(x[2]), _atd_write_nullable((lambda x: x.to_json()))(x[3])] if isinstance(x, tuple) and len(x) == 4 else _atd_bad_python('tuple of length 4', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class WithUsingResource: - """Original type: stmt = [ ... | WithUsingResource of ... | ... ]""" - - value: Tuple[Tok, List[Stmt], Stmt] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'WithUsingResource' - - def to_json(self) -> Any: - return ['WithUsingResource', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Assert: - """Original type: stmt = [ ... | Assert of ... | ... ]""" - - value: Tuple[Tok, Arguments, Sc] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Assert' - - def to_json(self) -> Any: - return ['Assert', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class DefStmt: - """Original type: stmt = [ ... | DefStmt of ... | ... ]""" - - value: Definition - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'DefStmt' - - def to_json(self) -> Any: - return ['DefStmt', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class DirectiveStmt: - """Original type: stmt = [ ... | DirectiveStmt of ... | ... ]""" - - value: Directive - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'DirectiveStmt' - - def to_json(self) -> Any: - return ['DirectiveStmt', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherStmt: - """Original type: stmt = [ ... | OtherStmt of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherStmt' - - def to_json(self) -> Any: - return ['OtherStmt', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Stmt: - """Original type: stmt = [ ... ]""" - - value: Union[ExprStmt, Block, If, While, Return, DoWhile, For, Switch, Continue, Break, Label_, Goto, Throw, Try, WithUsingResource, Assert, DefStmt, DirectiveStmt, OtherStmt] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Stmt': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'ExprStmt': - return cls(ExprStmt((lambda x: (Expr.from_json(x[0]), Sc.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'Block': - return cls(Block(StmtListBracket.from_json(x[1]))) - if cons == 'If': - return cls(If((lambda x: (Tok.from_json(x[0]), Condition.from_json(x[1]), Stmt.from_json(x[2]), _atd_read_nullable(Stmt.from_json)(x[3])) if isinstance(x, list) and len(x) == 4 else _atd_bad_json('array of length 4', x))(x[1]))) - if cons == 'While': - return cls(While((lambda x: (Tok.from_json(x[0]), Condition.from_json(x[1]), Stmt.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'Return': - return cls(Return((lambda x: (Tok.from_json(x[0]), _atd_read_nullable(Expr.from_json)(x[1]), Sc.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'DoWhile': - return cls(DoWhile((lambda x: (Tok.from_json(x[0]), Stmt.from_json(x[1]), Expr.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'For': - return cls(For((lambda x: (Tok.from_json(x[0]), ForHeader.from_json(x[1]), Stmt.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'Switch': - return cls(Switch((lambda x: (Tok.from_json(x[0]), _atd_read_nullable(Condition.from_json)(x[1]), _atd_read_list(CaseAndBody.from_json)(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'Continue': - return cls(Continue((lambda x: (Tok.from_json(x[0]), LabelIdent.from_json(x[1]), Sc.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'Break': - return cls(Break((lambda x: (Tok.from_json(x[0]), LabelIdent.from_json(x[1]), Sc.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'Label': - return cls(Label_((lambda x: (Label.from_json(x[0]), Stmt.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'Goto': - return cls(Goto((lambda x: (Tok.from_json(x[0]), Label.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'Throw': - return cls(Throw((lambda x: (Tok.from_json(x[0]), Expr.from_json(x[1]), Sc.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'Try': - return cls(Try((lambda x: (Tok.from_json(x[0]), Stmt.from_json(x[1]), _atd_read_list(Catch.from_json)(x[2]), _atd_read_nullable(Finally.from_json)(x[3])) if isinstance(x, list) and len(x) == 4 else _atd_bad_json('array of length 4', x))(x[1]))) - if cons == 'WithUsingResource': - return cls(WithUsingResource((lambda x: (Tok.from_json(x[0]), _atd_read_list(Stmt.from_json)(x[1]), Stmt.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'Assert': - return cls(Assert((lambda x: (Tok.from_json(x[0]), Arguments.from_json(x[1]), Sc.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'DefStmt': - return cls(DefStmt(Definition.from_json(x[1]))) - if cons == 'DirectiveStmt': - return cls(DirectiveStmt(Directive.from_json(x[1]))) - if cons == 'OtherStmt': - return cls(OtherStmt((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('Stmt', x) - _atd_bad_json('Stmt', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Stmt': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Lit: - """Original type: svalue = [ ... | Lit of ... | ... ]""" - - value: Literal - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Lit' - - def to_json(self) -> Any: - return ['Lit', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Cst: - """Original type: svalue = [ ... | Cst of ... | ... ]""" - - value: ConstType - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Cst' - - def to_json(self) -> Any: - return ['Cst', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Sym: - """Original type: svalue = [ ... | Sym of ... | ... ]""" - - value: Expr - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Sym' - - def to_json(self) -> Any: - return ['Sym', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class NotCst: - """Original type: svalue = [ ... | NotCst | ... ]""" - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'NotCst' - - @staticmethod - def to_json() -> Any: - return 'NotCst' - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Svalue: - """Original type: svalue = [ ... ]""" - - value: Union[Lit, Cst, Sym, NotCst] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Svalue': - if isinstance(x, str): - if x == 'NotCst': - return cls(NotCst()) - _atd_bad_json('Svalue', x) - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'Lit': - return cls(Lit(Literal.from_json(x[1]))) - if cons == 'Cst': - return cls(Cst(ConstType.from_json(x[1]))) - if cons == 'Sym': - return cls(Sym(Expr.from_json(x[1]))) - _atd_bad_json('Svalue', x) - _atd_bad_json('Svalue', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Svalue': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class TyN: - """Original type: type_ = [ ... | TyN of ... | ... ]""" - - value: Name - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyN' - - def to_json(self) -> Any: - return ['TyN', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyApply: - """Original type: type_ = [ ... | TyApply of ... | ... ]""" - - value: Tuple[Type, TypeArguments] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyApply' - - def to_json(self) -> Any: - return ['TyApply', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyFun: - """Original type: type_ = [ ... | TyFun of ... | ... ]""" - - value: Tuple[List[Parameter], Type] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyFun' - - def to_json(self) -> Any: - return ['TyFun', (lambda x: [_atd_write_list((lambda x: x.to_json()))(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyArray: - """Original type: type_ = [ ... | TyArray of ... | ... ]""" - - value: Tuple[ExprNullableBracket, Type] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyArray' - - def to_json(self) -> Any: - return ['TyArray', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyTuple: - """Original type: type_ = [ ... | TyTuple of ... | ... ]""" - - value: TypeListBracket - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyTuple' - - def to_json(self) -> Any: - return ['TyTuple', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyVar: - """Original type: type_ = [ ... | TyVar of ... | ... ]""" - - value: Ident - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyVar' - - def to_json(self) -> Any: - return ['TyVar', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyAny: - """Original type: type_ = [ ... | TyAny of ... | ... ]""" - - value: Tok - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyAny' - - def to_json(self) -> Any: - return ['TyAny', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyPointer: - """Original type: type_ = [ ... | TyPointer of ... | ... ]""" - - value: Tuple[Tok, Type] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyPointer' - - def to_json(self) -> Any: - return ['TyPointer', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyRef: - """Original type: type_ = [ ... | TyRef of ... | ... ]""" - - value: Tuple[Tok, Type] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyRef' - - def to_json(self) -> Any: - return ['TyRef', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyQuestion: - """Original type: type_ = [ ... | TyQuestion of ... | ... ]""" - - value: Tuple[Type, Tok] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyQuestion' - - def to_json(self) -> Any: - return ['TyQuestion', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyRest: - """Original type: type_ = [ ... | TyRest of ... | ... ]""" - - value: Tuple[Tok, Type] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyRest' - - def to_json(self) -> Any: - return ['TyRest', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyAnd: - """Original type: type_ = [ ... | TyAnd of ... | ... ]""" - - value: Tuple[Type, Tok, Type] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyAnd' - - def to_json(self) -> Any: - return ['TyAnd', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyOr: - """Original type: type_ = [ ... | TyOr of ... | ... ]""" - - value: Tuple[Type, Tok, Type] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyOr' - - def to_json(self) -> Any: - return ['TyOr', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyRecordAnon: - """Original type: type_ = [ ... | TyRecordAnon of ... | ... ]""" - - value: Tuple[ClassKindWrap, FieldListBracket] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyRecordAnon' - - def to_json(self) -> Any: - return ['TyRecordAnon', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TyExpr: - """Original type: type_ = [ ... | TyExpr of ... | ... ]""" - - value: Expr - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TyExpr' - - def to_json(self) -> Any: - return ['TyExpr', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherType: - """Original type: type_ = [ ... | OtherType of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherType' - - def to_json(self) -> Any: - return ['OtherType', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Type: - """Original type: type_ = [ ... ]""" - - value: Union[TyN, TyApply, TyFun, TyArray, TyTuple, TyVar, TyAny, TyPointer, TyRef, TyQuestion, TyRest, TyAnd, TyOr, TyRecordAnon, TyExpr, OtherType] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'Type': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'TyN': - return cls(TyN(Name.from_json(x[1]))) - if cons == 'TyApply': - return cls(TyApply((lambda x: (Type.from_json(x[0]), TypeArguments.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'TyFun': - return cls(TyFun((lambda x: (_atd_read_list(Parameter.from_json)(x[0]), Type.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'TyArray': - return cls(TyArray((lambda x: (ExprNullableBracket.from_json(x[0]), Type.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'TyTuple': - return cls(TyTuple(TypeListBracket.from_json(x[1]))) - if cons == 'TyVar': - return cls(TyVar(Ident.from_json(x[1]))) - if cons == 'TyAny': - return cls(TyAny(Tok.from_json(x[1]))) - if cons == 'TyPointer': - return cls(TyPointer((lambda x: (Tok.from_json(x[0]), Type.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'TyRef': - return cls(TyRef((lambda x: (Tok.from_json(x[0]), Type.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'TyQuestion': - return cls(TyQuestion((lambda x: (Type.from_json(x[0]), Tok.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'TyRest': - return cls(TyRest((lambda x: (Tok.from_json(x[0]), Type.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'TyAnd': - return cls(TyAnd((lambda x: (Type.from_json(x[0]), Tok.from_json(x[1]), Type.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'TyOr': - return cls(TyOr((lambda x: (Type.from_json(x[0]), Tok.from_json(x[1]), Type.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'TyRecordAnon': - return cls(TyRecordAnon((lambda x: (ClassKindWrap.from_json(x[0]), FieldListBracket.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'TyExpr': - return cls(TyExpr(Expr.from_json(x[1]))) - if cons == 'OtherType': - return cls(OtherType((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('Type', x) - _atd_bad_json('Type', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'Type': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class TA: - """Original type: type_argument = [ ... | TA of ... | ... ]""" - - value: Type - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TA' - - def to_json(self) -> Any: - return ['TA', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TAWildcard: - """Original type: type_argument = [ ... | TAWildcard of ... | ... ]""" - - value: Tuple[Tok, Optional[Tuple[BoolWrap, Type]]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TAWildcard' - - def to_json(self) -> Any: - return ['TAWildcard', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_nullable((lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x)))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TAExpr: - """Original type: type_argument = [ ... | TAExpr of ... | ... ]""" - - value: Expr - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TAExpr' - - def to_json(self) -> Any: - return ['TAExpr', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherTypeArg: - """Original type: type_argument = [ ... | OtherTypeArg of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherTypeArg' - - def to_json(self) -> Any: - return ['OtherTypeArg', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TypeArgument: - """Original type: type_argument = [ ... ]""" - - value: Union[TA, TAWildcard, TAExpr, OtherTypeArg] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'TypeArgument': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'TA': - return cls(TA(Type.from_json(x[1]))) - if cons == 'TAWildcard': - return cls(TAWildcard((lambda x: (Tok.from_json(x[0]), _atd_read_nullable((lambda x: (BoolWrap.from_json(x[0]), Type.from_json(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x)))(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'TAExpr': - return cls(TAExpr(Expr.from_json(x[1]))) - if cons == 'OtherTypeArg': - return cls(OtherTypeArg((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('TypeArgument', x) - _atd_bad_json('TypeArgument', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'TypeArgument': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class TypeArguments: - """Original type: type_arguments""" - - value: TypeArgumentListBracket - - @classmethod - def from_json(cls, x: Any) -> 'TypeArguments': - return cls(TypeArgumentListBracket.from_json(x)) - - def to_json(self) -> Any: - return (lambda x: x.to_json())(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'TypeArguments': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class TypeDefinition: - """Original type: type_definition = { ... }""" - - tbody: TypeDefinitionKind - - @classmethod - def from_json(cls, x: Any) -> 'TypeDefinition': - if isinstance(x, dict): - return cls( - tbody=TypeDefinitionKind.from_json(x['tbody']) if 'tbody' in x else _atd_missing_json_field('TypeDefinition', 'tbody'), - ) - else: - _atd_bad_json('TypeDefinition', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['tbody'] = (lambda x: x.to_json())(self.tbody) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'TypeDefinition': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class OrType: - """Original type: type_definition_kind = [ ... | OrType of ... | ... ]""" - - value: List[OrTypeElement] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OrType' - - def to_json(self) -> Any: - return ['OrType', _atd_write_list((lambda x: x.to_json()))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class AndType: - """Original type: type_definition_kind = [ ... | AndType of ... | ... ]""" - - value: FieldListBracket - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'AndType' - - def to_json(self) -> Any: - return ['AndType', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class AliasType: - """Original type: type_definition_kind = [ ... | AliasType of ... | ... ]""" - - value: Type - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'AliasType' - - def to_json(self) -> Any: - return ['AliasType', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class NewType: - """Original type: type_definition_kind = [ ... | NewType of ... | ... ]""" - - value: Type - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'NewType' - - def to_json(self) -> Any: - return ['NewType', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class AbstractType: - """Original type: type_definition_kind = [ ... | AbstractType of ... | ... ]""" - - value: Tok - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'AbstractType' - - def to_json(self) -> Any: - return ['AbstractType', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Exception: - """Original type: type_definition_kind = [ ... | Exception of ... | ... ]""" - - value: Tuple[Ident, List[Type]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'Exception' - - def to_json(self) -> Any: - return ['Exception', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherTypeKind: - """Original type: type_definition_kind = [ ... | OtherTypeKind of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherTypeKind' - - def to_json(self) -> Any: - return ['OtherTypeKind', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TypeDefinitionKind: - """Original type: type_definition_kind = [ ... ]""" - - value: Union[OrType, AndType, AliasType, NewType, AbstractType, Exception, OtherTypeKind] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'TypeDefinitionKind': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'OrType': - return cls(OrType(_atd_read_list(OrTypeElement.from_json)(x[1]))) - if cons == 'AndType': - return cls(AndType(FieldListBracket.from_json(x[1]))) - if cons == 'AliasType': - return cls(AliasType(Type.from_json(x[1]))) - if cons == 'NewType': - return cls(NewType(Type.from_json(x[1]))) - if cons == 'AbstractType': - return cls(AbstractType(Tok.from_json(x[1]))) - if cons == 'Exception': - return cls(Exception((lambda x: (Ident.from_json(x[0]), _atd_read_list(Type.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - if cons == 'OtherTypeKind': - return cls(OtherTypeKind((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('TypeDefinitionKind', x) - _atd_bad_json('TypeDefinitionKind', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'TypeDefinitionKind': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class TP: - """Original type: type_parameter = [ ... | TP of ... | ... ]""" - - value: TypeParameterClassic - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'TP' - - def to_json(self) -> Any: - return ['TP', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class OtherTypeParam: - """Original type: type_parameter = [ ... | OtherTypeParam of ... | ... ]""" - - value: Tuple[TodoKind, List[Any_]] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'OtherTypeParam' - - def to_json(self) -> Any: - return ['OtherTypeParam', (lambda x: [(lambda x: x.to_json())(x[0]), _atd_write_list((lambda x: x.to_json()))(x[1])] if isinstance(x, tuple) and len(x) == 2 else _atd_bad_python('tuple of length 2', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class TypeParameter: - """Original type: type_parameter = [ ... ]""" - - value: Union[TP, OtherTypeParam] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'TypeParameter': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'TP': - return cls(TP(TypeParameterClassic.from_json(x[1]))) - if cons == 'OtherTypeParam': - return cls(OtherTypeParam((lambda x: (TodoKind.from_json(x[0]), _atd_read_list(Any_.from_json)(x[1])) if isinstance(x, list) and len(x) == 2 else _atd_bad_json('array of length 2', x))(x[1]))) - _atd_bad_json('TypeParameter', x) - _atd_bad_json('TypeParameter', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'TypeParameter': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class TypeParameterClassic: - """Original type: type_parameter_classic = { ... }""" - - tp_id: Ident - tp_attrs: List[Attribute] - tp_bounds: List[Type] - tp_default: Optional[Type] - tp_variance: Optional[VarianceWrap] - - @classmethod - def from_json(cls, x: Any) -> 'TypeParameterClassic': - if isinstance(x, dict): - return cls( - tp_id=Ident.from_json(x['tp_id']) if 'tp_id' in x else _atd_missing_json_field('TypeParameterClassic', 'tp_id'), - tp_attrs=_atd_read_list(Attribute.from_json)(x['tp_attrs']) if 'tp_attrs' in x else _atd_missing_json_field('TypeParameterClassic', 'tp_attrs'), - tp_bounds=_atd_read_list(Type.from_json)(x['tp_bounds']) if 'tp_bounds' in x else _atd_missing_json_field('TypeParameterClassic', 'tp_bounds'), - tp_default=_atd_read_nullable(Type.from_json)(x['tp_default']) if 'tp_default' in x else _atd_missing_json_field('TypeParameterClassic', 'tp_default'), - tp_variance=_atd_read_nullable(VarianceWrap.from_json)(x['tp_variance']) if 'tp_variance' in x else _atd_missing_json_field('TypeParameterClassic', 'tp_variance'), - ) - else: - _atd_bad_json('TypeParameterClassic', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['tp_id'] = (lambda x: x.to_json())(self.tp_id) - res['tp_attrs'] = _atd_write_list((lambda x: x.to_json()))(self.tp_attrs) - res['tp_bounds'] = _atd_write_list((lambda x: x.to_json()))(self.tp_bounds) - res['tp_default'] = _atd_write_nullable((lambda x: x.to_json()))(self.tp_default) - res['tp_variance'] = _atd_write_nullable((lambda x: x.to_json()))(self.tp_variance) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'TypeParameterClassic': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class TypeParameters: - """Original type: type_parameters""" - - value: List[TypeParameter] - - @classmethod - def from_json(cls, x: Any) -> 'TypeParameters': - return cls(_atd_read_list(TypeParameter.from_json)(x)) - - def to_json(self) -> Any: - return _atd_write_list((lambda x: x.to_json()))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'TypeParameters': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class VariableDefinition: - """Original type: variable_definition = { ... }""" - - vinit: Optional[Expr] = None - vtype: Optional[Type] = None - - @classmethod - def from_json(cls, x: Any) -> 'VariableDefinition': - if isinstance(x, dict): - return cls( - vinit=Expr.from_json(x['vinit']) if 'vinit' in x else None, - vtype=Type.from_json(x['vtype']) if 'vtype' in x else None, - ) - else: - _atd_bad_json('VariableDefinition', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - if self.vinit is not None: - res['vinit'] = (lambda x: x.to_json())(self.vinit) - if self.vtype is not None: - res['vtype'] = (lambda x: x.to_json())(self.vtype) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'VariableDefinition': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class Xml: - """Original type: xml = { ... }""" - - xml_kind: XmlKind - xml_attrs: List[XmlAttribute] - xml_body: List[XmlBody] - - @classmethod - def from_json(cls, x: Any) -> 'Xml': - if isinstance(x, dict): - return cls( - xml_kind=XmlKind.from_json(x['xml_kind']) if 'xml_kind' in x else _atd_missing_json_field('Xml', 'xml_kind'), - xml_attrs=_atd_read_list(XmlAttribute.from_json)(x['xml_attrs']) if 'xml_attrs' in x else _atd_missing_json_field('Xml', 'xml_attrs'), - xml_body=_atd_read_list(XmlBody.from_json)(x['xml_body']) if 'xml_body' in x else _atd_missing_json_field('Xml', 'xml_body'), - ) - else: - _atd_bad_json('Xml', x) - - def to_json(self) -> Any: - res: Dict[str, Any] = {} - res['xml_kind'] = (lambda x: x.to_json())(self.xml_kind) - res['xml_attrs'] = _atd_write_list((lambda x: x.to_json()))(self.xml_attrs) - res['xml_body'] = _atd_write_list((lambda x: x.to_json()))(self.xml_body) - return res - - @classmethod - def from_json_string(cls, x: str) -> 'Xml': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class XmlAttrValue: - """Original type: xml_attr_value""" - - value: Expr - - @classmethod - def from_json(cls, x: Any) -> 'XmlAttrValue': - return cls(Expr.from_json(x)) - - def to_json(self) -> Any: - return (lambda x: x.to_json())(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'XmlAttrValue': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class XmlAttr: - """Original type: xml_attribute = [ ... | XmlAttr of ... | ... ]""" - - value: Tuple[Ident, Tok, XmlAttrValue] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'XmlAttr' - - def to_json(self) -> Any: - return ['XmlAttr', (lambda x: [(lambda x: x.to_json())(x[0]), (lambda x: x.to_json())(x[1]), (lambda x: x.to_json())(x[2])] if isinstance(x, tuple) and len(x) == 3 else _atd_bad_python('tuple of length 3', x))(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class XmlAttrExpr: - """Original type: xml_attribute = [ ... | XmlAttrExpr of ... | ... ]""" - - value: ExprBracket - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'XmlAttrExpr' - - def to_json(self) -> Any: - return ['XmlAttrExpr', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class XmlAttribute: - """Original type: xml_attribute = [ ... ]""" - - value: Union[XmlAttr, XmlAttrExpr] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'XmlAttribute': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'XmlAttr': - return cls(XmlAttr((lambda x: (Ident.from_json(x[0]), Tok.from_json(x[1]), XmlAttrValue.from_json(x[2])) if isinstance(x, list) and len(x) == 3 else _atd_bad_json('array of length 3', x))(x[1]))) - if cons == 'XmlAttrExpr': - return cls(XmlAttrExpr(ExprBracket.from_json(x[1]))) - _atd_bad_json('XmlAttribute', x) - _atd_bad_json('XmlAttribute', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'XmlAttribute': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - -@dataclass -class XmlText: - """Original type: xml_body = [ ... | XmlText of ... | ... ]""" - - value: StringWrap - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'XmlText' - - def to_json(self) -> Any: - return ['XmlText', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class XmlExpr: - """Original type: xml_body = [ ... | XmlExpr of ... | ... ]""" - - value: ExprNullableBracket - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'XmlExpr' - - def to_json(self) -> Any: - return ['XmlExpr', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class XmlXml: - """Original type: xml_body = [ ... | XmlXml of ... | ... ]""" - - value: Xml - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return 'XmlXml' - - def to_json(self) -> Any: - return ['XmlXml', (lambda x: x.to_json())(self.value)] - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class XmlBody: - """Original type: xml_body = [ ... ]""" - - value: Union[XmlText, XmlExpr, XmlXml] - - @property - def kind(self) -> str: - """Name of the class representing this variant.""" - return self.value.kind - - @classmethod - def from_json(cls, x: Any) -> 'XmlBody': - if isinstance(x, List) and len(x) == 2: - cons = x[0] - if cons == 'XmlText': - return cls(XmlText(StringWrap.from_json(x[1]))) - if cons == 'XmlExpr': - return cls(XmlExpr(ExprNullableBracket.from_json(x[1]))) - if cons == 'XmlXml': - return cls(XmlXml(Xml.from_json(x[1]))) - _atd_bad_json('XmlBody', x) - _atd_bad_json('XmlBody', x) - - def to_json(self) -> Any: - return self.value.to_json() - - @classmethod - def from_json_string(cls, x: str) -> 'XmlBody': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) - - -@dataclass -class Program: - """Original type: program""" - - value: List[Item] - - @classmethod - def from_json(cls, x: Any) -> 'Program': - return cls(_atd_read_list(Item.from_json)(x)) - - def to_json(self) -> Any: - return _atd_write_list((lambda x: x.to_json()))(self.value) - - @classmethod - def from_json_string(cls, x: str) -> 'Program': - return cls.from_json(json.loads(x)) - - def to_json_string(self, **kw: Any) -> str: - return json.dumps(self.to_json(), **kw) diff --git a/ast_generic_v1_j.ml b/ast_generic_v1_j.ml deleted file mode 100644 index 040de46..0000000 --- a/ast_generic_v1_j.ml +++ /dev/null @@ -1,26489 +0,0 @@ -(* Auto-generated from "ast_generic_v1.atd" *) -[@@@ocaml.warning "-27-32-33-35-39"] - -type class_kind = Ast_generic_v1_t.class_kind - -type concat_string_kind = Ast_generic_v1_t.concat_string_kind - -type const_type = Ast_generic_v1_t.const_type - -type container_operator = Ast_generic_v1_t.container_operator - -type function_kind = Ast_generic_v1_t.function_kind - -type incr_decr = Ast_generic_v1_t.incr_decr - -type keyword_attribute = Ast_generic_v1_t.keyword_attribute - -type operator = Ast_generic_v1_t.operator - -type prefix_postfix = Ast_generic_v1_t.prefix_postfix - -type sid = Ast_generic_v1_t.sid - -type special = Ast_generic_v1_t.special - -type token_location = Ast_generic_v1_t.token_location = { - str: string; - charpos: int; - line: int; - column: int; - filename: string -} - -type token = Ast_generic_v1_t.token - -type tok = Ast_generic_v1_t.tok - -type 'a bracket = 'a Ast_generic_v1_t.bracket - -type sc = Ast_generic_v1_t.sc - -type variance = Ast_generic_v1_t.variance - -type 'a wrap_ = 'a Ast_generic_v1_t.wrap_ - -type ident = Ast_generic_v1_t.ident - -type dotted_ident = Ast_generic_v1_t.dotted_ident - -type label = Ast_generic_v1_t.label - -type literal = Ast_generic_v1_t.literal - -type module_name = Ast_generic_v1_t.module_name - -type resolved_name_kind = Ast_generic_v1_t.resolved_name_kind - -type resolved_name = Ast_generic_v1_t.resolved_name - -type todo_kind = Ast_generic_v1_t.todo_kind - -type xml_kind = Ast_generic_v1_t.xml_kind - -type alias = Ast_generic_v1_t.alias - -and any = Ast_generic_v1_t.any - -and argument = Ast_generic_v1_t.argument - -and arguments = Ast_generic_v1_t.arguments - -and attribute = Ast_generic_v1_t.attribute - -and case = Ast_generic_v1_t.case - -and case_and_body = Ast_generic_v1_t.case_and_body - -and catch = Ast_generic_v1_t.catch - -and catch_exn = Ast_generic_v1_t.catch_exn - -and class_definition = Ast_generic_v1_t.class_definition = { - ckind: class_kind wrap_; - cextends: class_parent list; - cimplements: type_ list; - cmixins: type_ list; - cparams: parameters; - cbody: field list bracket -} - -and class_parent = Ast_generic_v1_t.class_parent - -and comprehension = Ast_generic_v1_t.comprehension - -and condition = Ast_generic_v1_t.condition - -and definition = Ast_generic_v1_t.definition - -and definition_kind = Ast_generic_v1_t.definition_kind - -and directive = Ast_generic_v1_t.directive - -and entity = Ast_generic_v1_t.entity = { - name: entity_name; - attrs: attribute list; - tparams: type_parameters -} - -and entity_name = Ast_generic_v1_t.entity_name - -and enum_entry_definition = Ast_generic_v1_t.enum_entry_definition = { - ee_args: arguments option; - ee_body: field list bracket option -} - -and expr = Ast_generic_v1_t.expr - -and field = Ast_generic_v1_t.field - -and field_name = Ast_generic_v1_t.field_name - -and finally = Ast_generic_v1_t.finally - -and for_each = Ast_generic_v1_t.for_each - -and for_header = Ast_generic_v1_t.for_header - -and for_or_if_comp = Ast_generic_v1_t.for_or_if_comp - -and for_var_or_expr = Ast_generic_v1_t.for_var_or_expr - -and function_body = Ast_generic_v1_t.function_body - -and function_definition = Ast_generic_v1_t.function_definition = { - fkind: function_kind wrap_; - fparams: parameters; - frettype: type_ option; - fbody: function_body -} - -and id_info = Ast_generic_v1_t.id_info = { - id_resolved: resolved_name option; - id_type: type_ option; - id_svalue: svalue option -} - -and import_from_kind = Ast_generic_v1_t.import_from_kind - -and item = Ast_generic_v1_t.item - -and label_ident = Ast_generic_v1_t.label_ident - -and macro_definition = Ast_generic_v1_t.macro_definition = { - macroparams: ident list; - macrobody: any list -} - -and module_definition = Ast_generic_v1_t.module_definition = { - mbody: module_definition_kind -} - -and module_definition_kind = Ast_generic_v1_t.module_definition_kind - -and multi_for_each = Ast_generic_v1_t.multi_for_each - -and name = Ast_generic_v1_t.name - -and or_type_element = Ast_generic_v1_t.or_type_element - -and parameter = Ast_generic_v1_t.parameter - -and parameter_classic = Ast_generic_v1_t.parameter_classic = { - pname: ident option; - ptype: type_ option; - pdefault: expr option; - pattrs: attribute list; - pinfo: id_info -} - -and parameters = Ast_generic_v1_t.parameters - -and pattern = Ast_generic_v1_t.pattern - -and qualified_info = Ast_generic_v1_t.qualified_info = { - name_last: (ident * type_arguments option); - name_middle: qualifier option; - name_top: tok option; - name_info: id_info -} - -and qualifier = Ast_generic_v1_t.qualifier - -and stmt = Ast_generic_v1_t.stmt - -and svalue = Ast_generic_v1_t.svalue - -and type_ = Ast_generic_v1_t.type_ - -and type_argument = Ast_generic_v1_t.type_argument - -and type_arguments = Ast_generic_v1_t.type_arguments - -and type_definition = Ast_generic_v1_t.type_definition = { - tbody: type_definition_kind -} - -and type_definition_kind = Ast_generic_v1_t.type_definition_kind - -and type_parameter = Ast_generic_v1_t.type_parameter - -and type_parameter_classic = Ast_generic_v1_t.type_parameter_classic = { - tp_id: ident; - tp_attrs: attribute list; - tp_bounds: type_ list; - tp_default: type_ option; - tp_variance: variance wrap_ option -} - -and type_parameters = Ast_generic_v1_t.type_parameters - -and variable_definition = Ast_generic_v1_t.variable_definition = { - vinit: expr option; - vtype: type_ option -} - -and xml = Ast_generic_v1_t.xml = { - xml_kind: xml_kind; - xml_attrs: xml_attribute list; - xml_body: xml_body list -} - -and xml_attr_value = Ast_generic_v1_t.xml_attr_value - -and xml_attribute = Ast_generic_v1_t.xml_attribute - -and xml_body = Ast_generic_v1_t.xml_body - -type program = Ast_generic_v1_t.program - -let write__float_nullable = ( - Atdgen_runtime.Oj_run.write_nullable ( - Yojson.Safe.write_std_float - ) -) -let string_of__float_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__float_nullable ob x; - Buffer.contents ob -let read__float_nullable = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - Atdgen_runtime.Oj_run.read_number - ) p lb) : _ option) -) -let _float_nullable_of_string s = - read__float_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_71cb4bf = ( - Atdgen_runtime.Oj_run.write_nullable ( - Atdgen_runtime.Oj_run.write_int64 - ) -) -let string_of__x_71cb4bf ?(len = 1024) x = - let ob = Buffer.create len in - write__x_71cb4bf ob x; - Buffer.contents ob -let read__x_71cb4bf = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - Atdgen_runtime.Oj_run.read_int64 - ) p lb) : _ option) -) -let _x_71cb4bf_of_string s = - read__x_71cb4bf (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_class_kind = ( - fun ob x -> - match x with - | `Class -> Buffer.add_string ob "\"Class\"" - | `Interface -> Buffer.add_string ob "\"Interface\"" - | `Trait -> Buffer.add_string ob "\"Trait\"" - | `Object -> Buffer.add_string ob "\"Object\"" -) -let string_of_class_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_class_kind ob x; - Buffer.contents ob -let read_class_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Class" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Class - | "Interface" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Interface - | "Trait" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Trait - | "Object" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Object - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "Class" -> - `Class - | "Interface" -> - `Interface - | "Trait" -> - `Trait - | "Object" -> - `Object - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let class_kind_of_string s = - read_class_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_concat_string_kind = ( - fun ob x -> - match x with - | `InterpolatedConcat -> Buffer.add_string ob "\"InterpolatedConcat\"" - | `SequenceConcat -> Buffer.add_string ob "\"SequenceConcat\"" - | `FString x -> - Buffer.add_string ob "[\"FString\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' - | `TaggedTemplateLiteral -> Buffer.add_string ob "\"TaggedTemplateLiteral\"" -) -let string_of_concat_string_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_concat_string_kind ob x; - Buffer.contents ob -let read_concat_string_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "InterpolatedConcat" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `InterpolatedConcat - | "SequenceConcat" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `SequenceConcat - | "FString" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `FString x - | "TaggedTemplateLiteral" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TaggedTemplateLiteral - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "InterpolatedConcat" -> - `InterpolatedConcat - | "SequenceConcat" -> - `SequenceConcat - | "TaggedTemplateLiteral" -> - `TaggedTemplateLiteral - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "FString" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `FString x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let concat_string_kind_of_string s = - read_concat_string_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_const_type = ( - fun ob x -> - match x with - | `Cbool -> Buffer.add_string ob "\"Cbool\"" - | `Cint -> Buffer.add_string ob "\"Cint\"" - | `Cstr -> Buffer.add_string ob "\"Cstr\"" - | `Cany -> Buffer.add_string ob "\"Cany\"" -) -let string_of_const_type ?(len = 1024) x = - let ob = Buffer.create len in - write_const_type ob x; - Buffer.contents ob -let read_const_type = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Cbool" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Cbool - | "Cint" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Cint - | "Cstr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Cstr - | "Cany" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Cany - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "Cbool" -> - `Cbool - | "Cint" -> - `Cint - | "Cstr" -> - `Cstr - | "Cany" -> - `Cany - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let const_type_of_string s = - read_const_type (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_container_operator = ( - fun ob x -> - match x with - | `Array -> Buffer.add_string ob "\"Array\"" - | `List -> Buffer.add_string ob "\"List\"" - | `Set -> Buffer.add_string ob "\"Set\"" - | `Dict -> Buffer.add_string ob "\"Dict\"" - | `Tuple -> Buffer.add_string ob "\"Tuple\"" -) -let string_of_container_operator ?(len = 1024) x = - let ob = Buffer.create len in - write_container_operator ob x; - Buffer.contents ob -let read_container_operator = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Array" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Array - | "List" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `List - | "Set" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Set - | "Dict" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Dict - | "Tuple" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Tuple - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "Array" -> - `Array - | "List" -> - `List - | "Set" -> - `Set - | "Dict" -> - `Dict - | "Tuple" -> - `Tuple - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let container_operator_of_string s = - read_container_operator (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_function_kind = ( - fun ob x -> - match x with - | `Function -> Buffer.add_string ob "\"Function\"" - | `Method -> Buffer.add_string ob "\"Method\"" - | `LambdaKind -> Buffer.add_string ob "\"LambdaKind\"" - | `Arrow -> Buffer.add_string ob "\"Arrow\"" - | `BlockCases -> Buffer.add_string ob "\"BlockCases\"" -) -let string_of_function_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_function_kind ob x; - Buffer.contents ob -let read_function_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Function" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Function - | "Method" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Method - | "LambdaKind" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `LambdaKind - | "Arrow" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Arrow - | "BlockCases" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `BlockCases - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "Function" -> - `Function - | "Method" -> - `Method - | "LambdaKind" -> - `LambdaKind - | "Arrow" -> - `Arrow - | "BlockCases" -> - `BlockCases - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let function_kind_of_string s = - read_function_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_incr_decr = ( - fun ob x -> - match x with - | `Incr -> Buffer.add_string ob "\"Incr\"" - | `Decr -> Buffer.add_string ob "\"Decr\"" -) -let string_of_incr_decr ?(len = 1024) x = - let ob = Buffer.create len in - write_incr_decr ob x; - Buffer.contents ob -let read_incr_decr = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Incr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Incr - | "Decr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Decr - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "Incr" -> - `Incr - | "Decr" -> - `Decr - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let incr_decr_of_string s = - read_incr_decr (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_keyword_attribute = ( - fun ob x -> - match x with - | `Static -> Buffer.add_string ob "\"Static\"" - | `Volatile -> Buffer.add_string ob "\"Volatile\"" - | `Extern -> Buffer.add_string ob "\"Extern\"" - | `Public -> Buffer.add_string ob "\"Public\"" - | `Private -> Buffer.add_string ob "\"Private\"" - | `Protected -> Buffer.add_string ob "\"Protected\"" - | `Abstract -> Buffer.add_string ob "\"Abstract\"" - | `Final -> Buffer.add_string ob "\"Final\"" - | `Override -> Buffer.add_string ob "\"Override\"" - | `RecordClass -> Buffer.add_string ob "\"RecordClass\"" - | `AnnotationClass -> Buffer.add_string ob "\"AnnotationClass\"" - | `EnumClass -> Buffer.add_string ob "\"EnumClass\"" - | `SealedClass -> Buffer.add_string ob "\"SealedClass\"" - | `Var -> Buffer.add_string ob "\"Var\"" - | `Let -> Buffer.add_string ob "\"Let\"" - | `Mutable -> Buffer.add_string ob "\"Mutable\"" - | `Const -> Buffer.add_string ob "\"Const\"" - | `Optional -> Buffer.add_string ob "\"Optional\"" - | `NotNull -> Buffer.add_string ob "\"NotNull\"" - | `Recursive -> Buffer.add_string ob "\"Recursive\"" - | `MutuallyRecursive -> Buffer.add_string ob "\"MutuallyRecursive\"" - | `Generator -> Buffer.add_string ob "\"Generator\"" - | `Async -> Buffer.add_string ob "\"Async\"" - | `Inline -> Buffer.add_string ob "\"Inline\"" - | `Ctor -> Buffer.add_string ob "\"Ctor\"" - | `Dtor -> Buffer.add_string ob "\"Dtor\"" - | `Getter -> Buffer.add_string ob "\"Getter\"" - | `Setter -> Buffer.add_string ob "\"Setter\"" - | `Unsafe -> Buffer.add_string ob "\"Unsafe\"" - | `DefaultImpl -> Buffer.add_string ob "\"DefaultImpl\"" - | `Lazy -> Buffer.add_string ob "\"Lazy\"" - | `Throws -> Buffer.add_string ob "\"Throws\"" - | `Rethrows -> Buffer.add_string ob "\"Rethrows\"" - | `OtherKeyword x -> - Buffer.add_string ob "[\"OtherKeyword\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' -) -let string_of_keyword_attribute ?(len = 1024) x = - let ob = Buffer.create len in - write_keyword_attribute ob x; - Buffer.contents ob -let read_keyword_attribute = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Static" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Static - | "Volatile" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Volatile - | "Extern" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Extern - | "Public" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Public - | "Private" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Private - | "Protected" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Protected - | "Abstract" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Abstract - | "Final" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Final - | "Override" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Override - | "RecordClass" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `RecordClass - | "AnnotationClass" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `AnnotationClass - | "EnumClass" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `EnumClass - | "SealedClass" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `SealedClass - | "Var" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Var - | "Let" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Let - | "Mutable" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Mutable - | "Const" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Const - | "Optional" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Optional - | "NotNull" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `NotNull - | "Recursive" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Recursive - | "MutuallyRecursive" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `MutuallyRecursive - | "Generator" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Generator - | "Async" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Async - | "Inline" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Inline - | "Ctor" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Ctor - | "Dtor" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Dtor - | "Getter" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Getter - | "Setter" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Setter - | "Unsafe" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Unsafe - | "DefaultImpl" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `DefaultImpl - | "Lazy" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Lazy - | "Throws" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Throws - | "Rethrows" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Rethrows - | "OtherKeyword" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherKeyword x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "Static" -> - `Static - | "Volatile" -> - `Volatile - | "Extern" -> - `Extern - | "Public" -> - `Public - | "Private" -> - `Private - | "Protected" -> - `Protected - | "Abstract" -> - `Abstract - | "Final" -> - `Final - | "Override" -> - `Override - | "RecordClass" -> - `RecordClass - | "AnnotationClass" -> - `AnnotationClass - | "EnumClass" -> - `EnumClass - | "SealedClass" -> - `SealedClass - | "Var" -> - `Var - | "Let" -> - `Let - | "Mutable" -> - `Mutable - | "Const" -> - `Const - | "Optional" -> - `Optional - | "NotNull" -> - `NotNull - | "Recursive" -> - `Recursive - | "MutuallyRecursive" -> - `MutuallyRecursive - | "Generator" -> - `Generator - | "Async" -> - `Async - | "Inline" -> - `Inline - | "Ctor" -> - `Ctor - | "Dtor" -> - `Dtor - | "Getter" -> - `Getter - | "Setter" -> - `Setter - | "Unsafe" -> - `Unsafe - | "DefaultImpl" -> - `DefaultImpl - | "Lazy" -> - `Lazy - | "Throws" -> - `Throws - | "Rethrows" -> - `Rethrows - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "OtherKeyword" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherKeyword x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let keyword_attribute_of_string s = - read_keyword_attribute (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_operator = ( - fun ob x -> - match x with - | `Plus -> Buffer.add_string ob "\"Plus\"" - | `Minus -> Buffer.add_string ob "\"Minus\"" - | `Mult -> Buffer.add_string ob "\"Mult\"" - | `Div -> Buffer.add_string ob "\"Div\"" - | `Mod -> Buffer.add_string ob "\"Mod\"" - | `Pow -> Buffer.add_string ob "\"Pow\"" - | `FloorDiv -> Buffer.add_string ob "\"FloorDiv\"" - | `MatMult -> Buffer.add_string ob "\"MatMult\"" - | `LSL -> Buffer.add_string ob "\"LSL\"" - | `LSR -> Buffer.add_string ob "\"LSR\"" - | `ASR -> Buffer.add_string ob "\"ASR\"" - | `BitOr -> Buffer.add_string ob "\"BitOr\"" - | `BitXor -> Buffer.add_string ob "\"BitXor\"" - | `BitAnd -> Buffer.add_string ob "\"BitAnd\"" - | `BitNot -> Buffer.add_string ob "\"BitNot\"" - | `BitClear -> Buffer.add_string ob "\"BitClear\"" - | `And -> Buffer.add_string ob "\"And\"" - | `Or -> Buffer.add_string ob "\"Or\"" - | `Xor -> Buffer.add_string ob "\"Xor\"" - | `Not -> Buffer.add_string ob "\"Not\"" - | `Eq -> Buffer.add_string ob "\"Eq\"" - | `NotEq -> Buffer.add_string ob "\"NotEq\"" - | `PhysEq -> Buffer.add_string ob "\"PhysEq\"" - | `NotPhysEq -> Buffer.add_string ob "\"NotPhysEq\"" - | `Lt -> Buffer.add_string ob "\"Lt\"" - | `LtE -> Buffer.add_string ob "\"LtE\"" - | `Gt -> Buffer.add_string ob "\"Gt\"" - | `GtE -> Buffer.add_string ob "\"GtE\"" - | `Cmp -> Buffer.add_string ob "\"Cmp\"" - | `Concat -> Buffer.add_string ob "\"Concat\"" - | `Append -> Buffer.add_string ob "\"Append\"" - | `RegexpMatch -> Buffer.add_string ob "\"RegexpMatch\"" - | `NotMatch -> Buffer.add_string ob "\"NotMatch\"" - | `Range -> Buffer.add_string ob "\"Range\"" - | `RangeInclusive -> Buffer.add_string ob "\"RangeInclusive\"" - | `NotNullPostfix -> Buffer.add_string ob "\"NotNullPostfix\"" - | `Length -> Buffer.add_string ob "\"Length\"" - | `Elvis -> Buffer.add_string ob "\"Elvis\"" - | `Nullish -> Buffer.add_string ob "\"Nullish\"" - | `In -> Buffer.add_string ob "\"In\"" - | `NotIn -> Buffer.add_string ob "\"NotIn\"" - | `Is -> Buffer.add_string ob "\"Is\"" - | `NotIs -> Buffer.add_string ob "\"NotIs\"" - | `Background -> Buffer.add_string ob "\"Background\"" - | `Pipe -> Buffer.add_string ob "\"Pipe\"" - | `LDA -> Buffer.add_string ob "\"LDA\"" - | `RDA -> Buffer.add_string ob "\"RDA\"" - | `LSA -> Buffer.add_string ob "\"LSA\"" - | `RSA -> Buffer.add_string ob "\"RSA\"" -) -let string_of_operator ?(len = 1024) x = - let ob = Buffer.create len in - write_operator ob x; - Buffer.contents ob -let read_operator = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Plus" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Plus - | "Minus" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Minus - | "Mult" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Mult - | "Div" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Div - | "Mod" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Mod - | "Pow" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Pow - | "FloorDiv" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `FloorDiv - | "MatMult" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `MatMult - | "LSL" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `LSL - | "LSR" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `LSR - | "ASR" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ASR - | "BitOr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `BitOr - | "BitXor" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `BitXor - | "BitAnd" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `BitAnd - | "BitNot" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `BitNot - | "BitClear" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `BitClear - | "And" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `And - | "Or" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Or - | "Xor" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Xor - | "Not" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Not - | "Eq" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Eq - | "NotEq" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `NotEq - | "PhysEq" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PhysEq - | "NotPhysEq" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `NotPhysEq - | "Lt" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Lt - | "LtE" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `LtE - | "Gt" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Gt - | "GtE" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `GtE - | "Cmp" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Cmp - | "Concat" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Concat - | "Append" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Append - | "RegexpMatch" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `RegexpMatch - | "NotMatch" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `NotMatch - | "Range" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Range - | "RangeInclusive" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `RangeInclusive - | "NotNullPostfix" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `NotNullPostfix - | "Length" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Length - | "Elvis" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Elvis - | "Nullish" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Nullish - | "In" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `In - | "NotIn" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `NotIn - | "Is" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Is - | "NotIs" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `NotIs - | "Background" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Background - | "Pipe" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Pipe - | "LDA" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `LDA - | "RDA" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `RDA - | "LSA" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `LSA - | "RSA" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `RSA - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "Plus" -> - `Plus - | "Minus" -> - `Minus - | "Mult" -> - `Mult - | "Div" -> - `Div - | "Mod" -> - `Mod - | "Pow" -> - `Pow - | "FloorDiv" -> - `FloorDiv - | "MatMult" -> - `MatMult - | "LSL" -> - `LSL - | "LSR" -> - `LSR - | "ASR" -> - `ASR - | "BitOr" -> - `BitOr - | "BitXor" -> - `BitXor - | "BitAnd" -> - `BitAnd - | "BitNot" -> - `BitNot - | "BitClear" -> - `BitClear - | "And" -> - `And - | "Or" -> - `Or - | "Xor" -> - `Xor - | "Not" -> - `Not - | "Eq" -> - `Eq - | "NotEq" -> - `NotEq - | "PhysEq" -> - `PhysEq - | "NotPhysEq" -> - `NotPhysEq - | "Lt" -> - `Lt - | "LtE" -> - `LtE - | "Gt" -> - `Gt - | "GtE" -> - `GtE - | "Cmp" -> - `Cmp - | "Concat" -> - `Concat - | "Append" -> - `Append - | "RegexpMatch" -> - `RegexpMatch - | "NotMatch" -> - `NotMatch - | "Range" -> - `Range - | "RangeInclusive" -> - `RangeInclusive - | "NotNullPostfix" -> - `NotNullPostfix - | "Length" -> - `Length - | "Elvis" -> - `Elvis - | "Nullish" -> - `Nullish - | "In" -> - `In - | "NotIn" -> - `NotIn - | "Is" -> - `Is - | "NotIs" -> - `NotIs - | "Background" -> - `Background - | "Pipe" -> - `Pipe - | "LDA" -> - `LDA - | "RDA" -> - `RDA - | "LSA" -> - `LSA - | "RSA" -> - `RSA - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let operator_of_string s = - read_operator (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_prefix_postfix = ( - fun ob x -> - match x with - | `Prefix -> Buffer.add_string ob "\"Prefix\"" - | `Postfix -> Buffer.add_string ob "\"Postfix\"" -) -let string_of_prefix_postfix ?(len = 1024) x = - let ob = Buffer.create len in - write_prefix_postfix ob x; - Buffer.contents ob -let read_prefix_postfix = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Prefix" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Prefix - | "Postfix" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Postfix - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "Prefix" -> - `Prefix - | "Postfix" -> - `Postfix - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let prefix_postfix_of_string s = - read_prefix_postfix (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_sid = ( - Yojson.Safe.write_int -) -let string_of_sid ?(len = 1024) x = - let ob = Buffer.create len in - write_sid ob x; - Buffer.contents ob -let read_sid = ( - Atdgen_runtime.Oj_run.read_int -) -let sid_of_string s = - read_sid (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_special = ( - fun ob x -> - match x with - | `This -> Buffer.add_string ob "\"This\"" - | `Super -> Buffer.add_string ob "\"Super\"" - | `Cls -> Buffer.add_string ob "\"Cls\"" - | `Self -> Buffer.add_string ob "\"Self\"" - | `Parent -> Buffer.add_string ob "\"Parent\"" - | `Eval -> Buffer.add_string ob "\"Eval\"" - | `Typeof -> Buffer.add_string ob "\"Typeof\"" - | `Instanceof -> Buffer.add_string ob "\"Instanceof\"" - | `Sizeof -> Buffer.add_string ob "\"Sizeof\"" - | `Defined -> Buffer.add_string ob "\"Defined\"" - | `ConcatString x -> - Buffer.add_string ob "[\"ConcatString\","; - ( - write_concat_string_kind - ) ob x; - Buffer.add_char ob ']' - | `EncodedString x -> - Buffer.add_string ob "[\"EncodedString\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' - | `InterpolatedElement -> Buffer.add_string ob "\"InterpolatedElement\"" - | `Spread -> Buffer.add_string ob "\"Spread\"" - | `HashSplat -> Buffer.add_string ob "\"HashSplat\"" - | `ForOf -> Buffer.add_string ob "\"ForOf\"" - | `Op x -> - Buffer.add_string ob "[\"Op\","; - ( - write_operator - ) ob x; - Buffer.add_char ob ']' - | `IncrDecr x -> - Buffer.add_string ob "[\"IncrDecr\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_incr_decr - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_prefix_postfix - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Require -> Buffer.add_string ob "\"Require\"" - | `OtherSpecial x -> - Buffer.add_string ob "[\"OtherSpecial\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' -) -let string_of_special ?(len = 1024) x = - let ob = Buffer.create len in - write_special ob x; - Buffer.contents ob -let read_special = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "This" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `This - | "Super" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Super - | "Cls" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Cls - | "Self" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Self - | "Parent" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Parent - | "Eval" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Eval - | "Typeof" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Typeof - | "Instanceof" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Instanceof - | "Sizeof" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Sizeof - | "Defined" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Defined - | "ConcatString" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_concat_string_kind - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ConcatString x - | "EncodedString" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `EncodedString x - | "InterpolatedElement" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `InterpolatedElement - | "Spread" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Spread - | "HashSplat" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `HashSplat - | "ForOf" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ForOf - | "Op" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_operator - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Op x - | "IncrDecr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_incr_decr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_prefix_postfix - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `IncrDecr x - | "Require" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Require - | "OtherSpecial" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherSpecial x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "This" -> - `This - | "Super" -> - `Super - | "Cls" -> - `Cls - | "Self" -> - `Self - | "Parent" -> - `Parent - | "Eval" -> - `Eval - | "Typeof" -> - `Typeof - | "Instanceof" -> - `Instanceof - | "Sizeof" -> - `Sizeof - | "Defined" -> - `Defined - | "InterpolatedElement" -> - `InterpolatedElement - | "Spread" -> - `Spread - | "HashSplat" -> - `HashSplat - | "ForOf" -> - `ForOf - | "Require" -> - `Require - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "ConcatString" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_concat_string_kind - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ConcatString x - | "EncodedString" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `EncodedString x - | "Op" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_operator - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Op x - | "IncrDecr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_incr_decr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_prefix_postfix - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `IncrDecr x - | "OtherSpecial" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherSpecial x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let special_of_string s = - read_special (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_token_location : _ -> token_location -> _ = ( - fun ob (x : token_location) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"str\":"; - ( - Yojson.Safe.write_string - ) - ob x.str; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"charpos\":"; - ( - Yojson.Safe.write_int - ) - ob x.charpos; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"line\":"; - ( - Yojson.Safe.write_int - ) - ob x.line; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"column\":"; - ( - Yojson.Safe.write_int - ) - ob x.column; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"filename\":"; - ( - Yojson.Safe.write_string - ) - ob x.filename; - Buffer.add_char ob '}'; -) -let string_of_token_location ?(len = 1024) x = - let ob = Buffer.create len in - write_token_location ob x; - Buffer.contents ob -let read_token_location = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_str = ref (None) in - let field_charpos = ref (None) in - let field_line = ref (None) in - let field_column = ref (None) in - let field_filename = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 3 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'r' then ( - 0 - ) - else ( - -1 - ) - ) - | 4 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( - 2 - ) - else ( - -1 - ) - ) - | 6 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'm' && String.unsafe_get s (pos+5) = 'n' then ( - 3 - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' then ( - 4 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_str := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 1 -> - field_charpos := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 2 -> - field_line := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 3 -> - field_column := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 4 -> - field_filename := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 3 -> ( - if String.unsafe_get s pos = 's' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 'r' then ( - 0 - ) - else ( - -1 - ) - ) - | 4 -> ( - if String.unsafe_get s pos = 'l' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'e' then ( - 2 - ) - else ( - -1 - ) - ) - | 6 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'u' && String.unsafe_get s (pos+4) = 'm' && String.unsafe_get s (pos+5) = 'n' then ( - 3 - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'h' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'p' && String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = 'n' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' then ( - 4 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_str := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | 1 -> - field_charpos := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 2 -> - field_line := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 3 -> - field_column := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - ) - ); - | 4 -> - field_filename := ( - Some ( - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - str = (match !field_str with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "str"); - charpos = (match !field_charpos with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "charpos"); - line = (match !field_line with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "line"); - column = (match !field_column with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "column"); - filename = (match !field_filename with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "filename"); - } - : token_location) - ) -) -let token_location_of_string s = - read_token_location (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_token = ( - fun ob x -> - match x with - | `OriginTok x -> - Buffer.add_string ob "[\"OriginTok\","; - ( - write_token_location - ) ob x; - Buffer.add_char ob ']' - | `FakeTok x -> - Buffer.add_string ob "[\"FakeTok\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' -) -let string_of_token ?(len = 1024) x = - let ob = Buffer.create len in - write_token ob x; - Buffer.contents ob -let read_token = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "OriginTok" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_token_location - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OriginTok x - | "FakeTok" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `FakeTok x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "OriginTok" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_token_location - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OriginTok x - | "FakeTok" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `FakeTok x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let token_of_string s = - read_token (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_tok = ( - write_token -) -let string_of_tok ?(len = 1024) x = - let ob = Buffer.create len in - write_tok ob x; - Buffer.contents ob -let read_tok = ( - read_token -) -let tok_of_string s = - read_tok (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__bool_wrap = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - Yojson.Safe.write_bool - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of__bool_wrap ?(len = 1024) x = - let ob = Buffer.create len in - write__bool_wrap ob x; - Buffer.contents ob -let read__bool_wrap = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -let _bool_wrap_of_string s = - read__bool_wrap (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__class_kind_wrap = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_class_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of__class_kind_wrap ?(len = 1024) x = - let ob = Buffer.create len in - write__class_kind_wrap ob x; - Buffer.contents ob -let read__class_kind_wrap = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_class_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -let _class_kind_wrap_of_string s = - read__class_kind_wrap (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__float_nullable_wrap = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write__float_nullable - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of__float_nullable_wrap ?(len = 1024) x = - let ob = Buffer.create len in - write__float_nullable_wrap ob x; - Buffer.contents ob -let read__float_nullable_wrap = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__float_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -let _float_nullable_wrap_of_string s = - read__float_nullable_wrap (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__function_kind_wrap = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_function_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of__function_kind_wrap ?(len = 1024) x = - let ob = Buffer.create len in - write__function_kind_wrap ob x; - Buffer.contents ob -let read__function_kind_wrap = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_function_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -let _function_kind_wrap_of_string s = - read__function_kind_wrap (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__int_wrap = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - Yojson.Safe.write_int - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of__int_wrap ?(len = 1024) x = - let ob = Buffer.create len in - write__int_wrap ob x; - Buffer.contents ob -let read__int_wrap = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - Atdgen_runtime.Oj_run.read_int - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -let _int_wrap_of_string s = - read__int_wrap (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__keyword_attribute_wrap = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_keyword_attribute - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of__keyword_attribute_wrap ?(len = 1024) x = - let ob = Buffer.create len in - write__keyword_attribute_wrap ob x; - Buffer.contents ob -let read__keyword_attribute_wrap = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_keyword_attribute - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -let _keyword_attribute_wrap_of_string s = - read__keyword_attribute_wrap (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__operator_wrap = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_operator - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of__operator_wrap ?(len = 1024) x = - let ob = Buffer.create len in - write__operator_wrap ob x; - Buffer.contents ob -let read__operator_wrap = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_operator - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -let _operator_wrap_of_string s = - read__operator_wrap (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__special_wrap = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_special - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of__special_wrap ?(len = 1024) x = - let ob = Buffer.create len in - write__special_wrap ob x; - Buffer.contents ob -let read__special_wrap = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_special - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -let _special_wrap_of_string s = - read__special_wrap (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__string_wrap = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - Yojson.Safe.write_string - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of__string_wrap ?(len = 1024) x = - let ob = Buffer.create len in - write__string_wrap ob x; - Buffer.contents ob -let read__string_wrap = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -let _string_wrap_of_string s = - read__string_wrap (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__string_wrap_bracket = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__string_wrap - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of__string_wrap_bracket ?(len = 1024) x = - let ob = Buffer.create len in - write__string_wrap_bracket ob x; - Buffer.contents ob -let read__string_wrap_bracket = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__string_wrap - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -let _string_wrap_bracket_of_string s = - read__string_wrap_bracket (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__string_wrap_nullable = ( - Atdgen_runtime.Oj_run.write_nullable ( - write__string_wrap - ) -) -let string_of__string_wrap_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__string_wrap_nullable ob x; - Buffer.contents ob -let read__string_wrap_nullable = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read__string_wrap - ) p lb) : _ option) -) -let _string_wrap_nullable_of_string s = - read__string_wrap_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__tok_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_tok - ) -) -let string_of__tok_option ?(len = 1024) x = - let ob = Buffer.create len in - write__tok_option ob x; - Buffer.contents ob -let read__tok_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let _tok_option_of_string s = - read__tok_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__x_b40703a = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write__x_71cb4bf - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of__x_b40703a ?(len = 1024) x = - let ob = Buffer.create len in - write__x_b40703a ob x; - Buffer.contents ob -let read__x_b40703a = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__x_71cb4bf - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -let _x_b40703a_of_string s = - read__x_b40703a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_ident = ( - write__string_wrap -) -let string_of_ident ?(len = 1024) x = - let ob = Buffer.create len in - write_ident ob x; - Buffer.contents ob -let read_ident = ( - read__string_wrap -) -let ident_of_string s = - read_ident (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__ident_list = ( - Atdgen_runtime.Oj_run.write_list ( - write_ident - ) -) -let string_of__ident_list ?(len = 1024) x = - let ob = Buffer.create len in - write__ident_list ob x; - Buffer.contents ob -let read__ident_list = ( - Atdgen_runtime.Oj_run.read_list ( - read_ident - ) -) -let _ident_list_of_string s = - read__ident_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__ident_nullable = ( - Atdgen_runtime.Oj_run.write_nullable ( - write_ident - ) -) -let string_of__ident_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__ident_nullable ob x; - Buffer.contents ob -let read__ident_nullable = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read_ident - ) p lb) : _ option) -) -let _ident_nullable_of_string s = - read__ident_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_dotted_ident = ( - write__ident_list -) -let string_of_dotted_ident ?(len = 1024) x = - let ob = Buffer.create len in - write_dotted_ident ob x; - Buffer.contents ob -let read_dotted_ident = ( - read__ident_list -) -let dotted_ident_of_string s = - read_dotted_ident (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__dotted_ident_nullable = ( - Atdgen_runtime.Oj_run.write_nullable ( - write_dotted_ident - ) -) -let string_of__dotted_ident_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__dotted_ident_nullable ob x; - Buffer.contents ob -let read__dotted_ident_nullable = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read_dotted_ident - ) p lb) : _ option) -) -let _dotted_ident_nullable_of_string s = - read__dotted_ident_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_label = ( - write_ident -) -let string_of_label ?(len = 1024) x = - let ob = Buffer.create len in - write_label ob x; - Buffer.contents ob -let read_label = ( - read_ident -) -let label_of_string s = - read_label (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_literal = ( - fun ob x -> - match x with - | `Bool x -> - Buffer.add_string ob "[\"Bool\","; - ( - write__bool_wrap - ) ob x; - Buffer.add_char ob ']' - | `Int x -> - Buffer.add_string ob "[\"Int\","; - ( - write__x_b40703a - ) ob x; - Buffer.add_char ob ']' - | `Float x -> - Buffer.add_string ob "[\"Float\","; - ( - write__float_nullable_wrap - ) ob x; - Buffer.add_char ob ']' - | `Char x -> - Buffer.add_string ob "[\"Char\","; - ( - write__string_wrap - ) ob x; - Buffer.add_char ob ']' - | `String x -> - Buffer.add_string ob "[\"String\","; - ( - write__string_wrap - ) ob x; - Buffer.add_char ob ']' - | `Regexp x -> - Buffer.add_string ob "[\"Regexp\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write__string_wrap_bracket - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__string_wrap_nullable - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Atom x -> - Buffer.add_string ob "[\"Atom\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__string_wrap - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Unit x -> - Buffer.add_string ob "[\"Unit\","; - ( - write_tok - ) ob x; - Buffer.add_char ob ']' - | `Null x -> - Buffer.add_string ob "[\"Null\","; - ( - write_tok - ) ob x; - Buffer.add_char ob ']' - | `Undefined x -> - Buffer.add_string ob "[\"Undefined\","; - ( - write_tok - ) ob x; - Buffer.add_char ob ']' - | `Imag x -> - Buffer.add_string ob "[\"Imag\","; - ( - write__string_wrap - ) ob x; - Buffer.add_char ob ']' - | `Ratio x -> - Buffer.add_string ob "[\"Ratio\","; - ( - write__string_wrap - ) ob x; - Buffer.add_char ob ']' -) -let string_of_literal ?(len = 1024) x = - let ob = Buffer.create len in - write_literal ob x; - Buffer.contents ob -let read_literal = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Bool" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__bool_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Bool x - | "Int" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__x_b40703a - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Int x - | "Float" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__float_nullable_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Float x - | "Char" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Char x - | "String" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `String x - | "Regexp" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__string_wrap_bracket - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__string_wrap_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Regexp x - | "Atom" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__string_wrap - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Atom x - | "Unit" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Unit x - | "Null" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Null x - | "Undefined" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Undefined x - | "Imag" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Imag x - | "Ratio" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Ratio x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Bool" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__bool_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Bool x - | "Int" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__x_b40703a - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Int x - | "Float" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__float_nullable_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Float x - | "Char" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Char x - | "String" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `String x - | "Regexp" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__string_wrap_bracket - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__string_wrap_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Regexp x - | "Atom" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__string_wrap - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Atom x - | "Unit" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Unit x - | "Null" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Null x - | "Undefined" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Undefined x - | "Imag" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Imag x - | "Ratio" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Ratio x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let literal_of_string s = - read_literal (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_module_name = ( - fun ob x -> - match x with - | `DottedName x -> - Buffer.add_string ob "[\"DottedName\","; - ( - write_dotted_ident - ) ob x; - Buffer.add_char ob ']' - | `FileName x -> - Buffer.add_string ob "[\"FileName\","; - ( - write__string_wrap - ) ob x; - Buffer.add_char ob ']' -) -let string_of_module_name ?(len = 1024) x = - let ob = Buffer.create len in - write_module_name ob x; - Buffer.contents ob -let read_module_name = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "DottedName" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_dotted_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `DottedName x - | "FileName" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `FileName x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "DottedName" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_dotted_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `DottedName x - | "FileName" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `FileName x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let module_name_of_string s = - read_module_name (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_resolved_name_kind = ( - fun ob x -> - match x with - | `Global -> Buffer.add_string ob "\"Global\"" - | `Local -> Buffer.add_string ob "\"Local\"" - | `Param -> Buffer.add_string ob "\"Param\"" - | `ImportedEntity x -> - Buffer.add_string ob "[\"ImportedEntity\","; - ( - write_dotted_ident - ) ob x; - Buffer.add_char ob ']' - | `ImportedModule x -> - Buffer.add_string ob "[\"ImportedModule\","; - ( - write_module_name - ) ob x; - Buffer.add_char ob ']' - | `OtherResolvedNameKind x -> - Buffer.add_string ob "[\"OtherResolvedNameKind\","; - ( - Yojson.Safe.write_string - ) ob x; - Buffer.add_char ob ']' -) -let string_of_resolved_name_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_resolved_name_kind ob x; - Buffer.contents ob -let read_resolved_name_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Global" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Global - | "Local" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Local - | "Param" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Param - | "ImportedEntity" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_dotted_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ImportedEntity x - | "ImportedModule" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_module_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ImportedModule x - | "OtherResolvedNameKind" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherResolvedNameKind x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "Global" -> - `Global - | "Local" -> - `Local - | "Param" -> - `Param - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "ImportedEntity" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_dotted_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ImportedEntity x - | "ImportedModule" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_module_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ImportedModule x - | "OtherResolvedNameKind" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - Atdgen_runtime.Oj_run.read_string - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherResolvedNameKind x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let resolved_name_kind_of_string s = - read_resolved_name_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_resolved_name = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_resolved_name_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_sid - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of_resolved_name ?(len = 1024) x = - let ob = Buffer.create len in - write_resolved_name ob x; - Buffer.contents ob -let read_resolved_name = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_resolved_name_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_sid - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -let resolved_name_of_string s = - read_resolved_name (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__resolved_name_option = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_resolved_name - ) -) -let string_of__resolved_name_option ?(len = 1024) x = - let ob = Buffer.create len in - write__resolved_name_option ob x; - Buffer.contents ob -let read__resolved_name_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_resolved_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_resolved_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let _resolved_name_option_of_string s = - read__resolved_name_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_sc = ( - write_tok -) -let string_of_sc ?(len = 1024) x = - let ob = Buffer.create len in - write_sc ob x; - Buffer.contents ob -let read_sc = ( - read_tok -) -let sc_of_string s = - read_sc (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_todo_kind = ( - write__string_wrap -) -let string_of_todo_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_todo_kind ob x; - Buffer.contents ob -let read_todo_kind = ( - read__string_wrap -) -let todo_kind_of_string s = - read_todo_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_variance = ( - fun ob x -> - match x with - | `Covariant -> Buffer.add_string ob "\"Covariant\"" - | `Contravariant -> Buffer.add_string ob "\"Contravariant\"" -) -let string_of_variance ?(len = 1024) x = - let ob = Buffer.create len in - write_variance ob x; - Buffer.contents ob -let read_variance = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Covariant" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Covariant - | "Contravariant" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Contravariant - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "Covariant" -> - `Covariant - | "Contravariant" -> - `Contravariant - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let variance_of_string s = - read_variance (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__variance_wrap = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_variance - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of__variance_wrap ?(len = 1024) x = - let ob = Buffer.create len in - write__variance_wrap ob x; - Buffer.contents ob -let read__variance_wrap = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_variance - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -let _variance_wrap_of_string s = - read__variance_wrap (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write__variance_wrap_nullable = ( - Atdgen_runtime.Oj_run.write_nullable ( - write__variance_wrap - ) -) -let string_of__variance_wrap_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__variance_wrap_nullable ob x; - Buffer.contents ob -let read__variance_wrap_nullable = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read__variance_wrap - ) p lb) : _ option) -) -let _variance_wrap_nullable_of_string s = - read__variance_wrap_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_xml_kind = ( - fun ob x -> - match x with - | `XmlClassic x -> - Buffer.add_string ob "[\"XmlClassic\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `XmlSingleton x -> - Buffer.add_string ob "[\"XmlSingleton\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `XmlFragment x -> - Buffer.add_string ob "[\"XmlFragment\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -let string_of_xml_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_xml_kind ob x; - Buffer.contents ob -let read_xml_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "XmlClassic" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x3 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2, x3) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `XmlClassic x - | "XmlSingleton" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `XmlSingleton x - | "XmlFragment" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `XmlFragment x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "XmlClassic" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x3 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2, x3) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `XmlClassic x - | "XmlSingleton" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `XmlSingleton x - | "XmlFragment" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `XmlFragment x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -let xml_kind_of_string s = - read_xml_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let rec write__alias_nullable ob x = ( - Atdgen_runtime.Oj_run.write_nullable ( - write_alias - ) -) ob x -and string_of__alias_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__alias_nullable ob x; - Buffer.contents ob -and write__any_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_any - ) -) ob x -and string_of__any_list ?(len = 1024) x = - let ob = Buffer.create len in - write__any_list ob x; - Buffer.contents ob -and write__argument_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_argument - ) -) ob x -and string_of__argument_list ?(len = 1024) x = - let ob = Buffer.create len in - write__argument_list ob x; - Buffer.contents ob -and write__argument_list_bracket = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__argument_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of__argument_list_bracket ?(len = 1024) x = - let ob = Buffer.create len in - write__argument_list_bracket ob x; - Buffer.contents ob -and write__arguments_nullable ob x = ( - Atdgen_runtime.Oj_run.write_nullable ( - write_arguments - ) -) ob x -and string_of__arguments_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__arguments_nullable ob x; - Buffer.contents ob -and write__attribute_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_attribute - ) -) ob x -and string_of__attribute_list ?(len = 1024) x = - let ob = Buffer.create len in - write__attribute_list ob x; - Buffer.contents ob -and write__bool_wrap_type_nullable ob x = ( - Atdgen_runtime.Oj_run.write_nullable ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write__bool_wrap - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ']'; - ) -) ob x -and string_of__bool_wrap_type_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__bool_wrap_type_nullable ob x; - Buffer.contents ob -and write__bracket_0ecc50b = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write__expr_nullable - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__expr_nullable - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write__expr_nullable - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of__bracket_0ecc50b ?(len = 1024) x = - let ob = Buffer.create len in - write__bracket_0ecc50b ob x; - Buffer.contents ob -and write__case_and_body_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_case_and_body - ) -) ob x -and string_of__case_and_body_list ?(len = 1024) x = - let ob = Buffer.create len in - write__case_and_body_list ob x; - Buffer.contents ob -and write__case_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_case - ) -) ob x -and string_of__case_list ?(len = 1024) x = - let ob = Buffer.create len in - write__case_list ob x; - Buffer.contents ob -and write__catch_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_catch - ) -) ob x -and string_of__catch_list ?(len = 1024) x = - let ob = Buffer.create len in - write__catch_list ob x; - Buffer.contents ob -and write__class_parent_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_class_parent - ) -) ob x -and string_of__class_parent_list ?(len = 1024) x = - let ob = Buffer.create len in - write__class_parent_list ob x; - Buffer.contents ob -and write__comprehension_bracket = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_comprehension - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of__comprehension_bracket ?(len = 1024) x = - let ob = Buffer.create len in - write__comprehension_bracket ob x; - Buffer.contents ob -and write__condition_nullable ob x = ( - Atdgen_runtime.Oj_run.write_nullable ( - write_condition - ) -) ob x -and string_of__condition_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__condition_nullable ob x; - Buffer.contents ob -and write__dotted_ident_pattern_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_dotted_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_pattern - ) ob x - ); - Buffer.add_char ob ']'; - ) -) ob x -and string_of__dotted_ident_pattern_list ?(len = 1024) x = - let ob = Buffer.create len in - write__dotted_ident_pattern_list ob x; - Buffer.contents ob -and write__dotted_ident_pattern_list_bracket = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__dotted_ident_pattern_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of__dotted_ident_pattern_list_bracket ?(len = 1024) x = - let ob = Buffer.create len in - write__dotted_ident_pattern_list_bracket ob x; - Buffer.contents ob -and write__expr_bracket = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of__expr_bracket ?(len = 1024) x = - let ob = Buffer.create len in - write__expr_bracket ob x; - Buffer.contents ob -and write__expr_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_expr - ) -) ob x -and string_of__expr_list ?(len = 1024) x = - let ob = Buffer.create len in - write__expr_list ob x; - Buffer.contents ob -and write__expr_list_bracket = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__expr_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of__expr_list_bracket ?(len = 1024) x = - let ob = Buffer.create len in - write__expr_list_bracket ob x; - Buffer.contents ob -and write__expr_nullable ob x = ( - Atdgen_runtime.Oj_run.write_nullable ( - write_expr - ) -) ob x -and string_of__expr_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__expr_nullable ob x; - Buffer.contents ob -and write__expr_nullable_bracket = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__expr_nullable - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of__expr_nullable_bracket ?(len = 1024) x = - let ob = Buffer.create len in - write__expr_nullable_bracket ob x; - Buffer.contents ob -and write__expr_option ob x = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_expr - ) -) ob x -and string_of__expr_option ?(len = 1024) x = - let ob = Buffer.create len in - write__expr_option ob x; - Buffer.contents ob -and write__field_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_field - ) -) ob x -and string_of__field_list ?(len = 1024) x = - let ob = Buffer.create len in - write__field_list ob x; - Buffer.contents ob -and write__field_list_bracket = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__field_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of__field_list_bracket ?(len = 1024) x = - let ob = Buffer.create len in - write__field_list_bracket ob x; - Buffer.contents ob -and write__field_list_bracket_nullable ob x = ( - Atdgen_runtime.Oj_run.write_nullable ( - write__field_list_bracket - ) -) ob x -and string_of__field_list_bracket_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__field_list_bracket_nullable ob x; - Buffer.contents ob -and write__finally_nullable ob x = ( - Atdgen_runtime.Oj_run.write_nullable ( - write_finally - ) -) ob x -and string_of__finally_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__finally_nullable ob x; - Buffer.contents ob -and write__for_or_if_comp_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_for_or_if_comp - ) -) ob x -and string_of__for_or_if_comp_list ?(len = 1024) x = - let ob = Buffer.create len in - write__for_or_if_comp_list ob x; - Buffer.contents ob -and write__for_var_or_expr_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_for_var_or_expr - ) -) ob x -and string_of__for_var_or_expr_list ?(len = 1024) x = - let ob = Buffer.create len in - write__for_var_or_expr_list ob x; - Buffer.contents ob -and write__ident_type_arguments_nullable_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__type_arguments_nullable - ) ob x - ); - Buffer.add_char ob ']'; - ) -) ob x -and string_of__ident_type_arguments_nullable_list ?(len = 1024) x = - let ob = Buffer.create len in - write__ident_type_arguments_nullable_list ob x; - Buffer.contents ob -and write__import_from_kind_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_import_from_kind - ) -) ob x -and string_of__import_from_kind_list ?(len = 1024) x = - let ob = Buffer.create len in - write__import_from_kind_list ob x; - Buffer.contents ob -and write__item_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_item - ) -) ob x -and string_of__item_list ?(len = 1024) x = - let ob = Buffer.create len in - write__item_list ob x; - Buffer.contents ob -and write__multi_for_each_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_multi_for_each - ) -) ob x -and string_of__multi_for_each_list ?(len = 1024) x = - let ob = Buffer.create len in - write__multi_for_each_list ob x; - Buffer.contents ob -and write__or_type_element_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_or_type_element - ) -) ob x -and string_of__or_type_element_list ?(len = 1024) x = - let ob = Buffer.create len in - write__or_type_element_list ob x; - Buffer.contents ob -and write__parameter_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_parameter - ) -) ob x -and string_of__parameter_list ?(len = 1024) x = - let ob = Buffer.create len in - write__parameter_list ob x; - Buffer.contents ob -and write__pattern_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_pattern - ) -) ob x -and string_of__pattern_list ?(len = 1024) x = - let ob = Buffer.create len in - write__pattern_list ob x; - Buffer.contents ob -and write__pattern_list_bracket = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__pattern_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of__pattern_list_bracket ?(len = 1024) x = - let ob = Buffer.create len in - write__pattern_list_bracket ob x; - Buffer.contents ob -and write__qualifier_option ob x = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_qualifier - ) -) ob x -and string_of__qualifier_option ?(len = 1024) x = - let ob = Buffer.create len in - write__qualifier_option ob x; - Buffer.contents ob -and write__stmt_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_stmt - ) -) ob x -and string_of__stmt_list ?(len = 1024) x = - let ob = Buffer.create len in - write__stmt_list ob x; - Buffer.contents ob -and write__stmt_list_bracket = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__stmt_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of__stmt_list_bracket ?(len = 1024) x = - let ob = Buffer.create len in - write__stmt_list_bracket ob x; - Buffer.contents ob -and write__stmt_nullable ob x = ( - Atdgen_runtime.Oj_run.write_nullable ( - write_stmt - ) -) ob x -and string_of__stmt_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__stmt_nullable ob x; - Buffer.contents ob -and write__svalue_option ob x = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_svalue - ) -) ob x -and string_of__svalue_option ?(len = 1024) x = - let ob = Buffer.create len in - write__svalue_option ob x; - Buffer.contents ob -and write__type_argument_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_type_argument - ) -) ob x -and string_of__type_argument_list ?(len = 1024) x = - let ob = Buffer.create len in - write__type_argument_list ob x; - Buffer.contents ob -and write__type_argument_list_bracket = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__type_argument_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of__type_argument_list_bracket ?(len = 1024) x = - let ob = Buffer.create len in - write__type_argument_list_bracket ob x; - Buffer.contents ob -and write__type_arguments_nullable ob x = ( - Atdgen_runtime.Oj_run.write_nullable ( - write_type_arguments - ) -) ob x -and string_of__type_arguments_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__type_arguments_nullable ob x; - Buffer.contents ob -and write__type_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_type_ - ) -) ob x -and string_of__type_list ?(len = 1024) x = - let ob = Buffer.create len in - write__type_list ob x; - Buffer.contents ob -and write__type_list_bracket = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__type_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of__type_list_bracket ?(len = 1024) x = - let ob = Buffer.create len in - write__type_list_bracket ob x; - Buffer.contents ob -and write__type_nullable ob x = ( - Atdgen_runtime.Oj_run.write_nullable ( - write_type_ - ) -) ob x -and string_of__type_nullable ?(len = 1024) x = - let ob = Buffer.create len in - write__type_nullable ob x; - Buffer.contents ob -and write__type_option ob x = ( - Atdgen_runtime.Oj_run.write_std_option ( - write_type_ - ) -) ob x -and string_of__type_option ?(len = 1024) x = - let ob = Buffer.create len in - write__type_option ob x; - Buffer.contents ob -and write__type_parameter_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_type_parameter - ) -) ob x -and string_of__type_parameter_list ?(len = 1024) x = - let ob = Buffer.create len in - write__type_parameter_list ob x; - Buffer.contents ob -and write__xml_attribute_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_xml_attribute - ) -) ob x -and string_of__xml_attribute_list ?(len = 1024) x = - let ob = Buffer.create len in - write__xml_attribute_list ob x; - Buffer.contents ob -and write__xml_body_list ob x = ( - Atdgen_runtime.Oj_run.write_list ( - write_xml_body - ) -) ob x -and string_of__xml_body_list ?(len = 1024) x = - let ob = Buffer.create len in - write__xml_body_list ob x; - Buffer.contents ob -and write_alias = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_id_info - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of_alias ?(len = 1024) x = - let ob = Buffer.create len in - write_alias ob x; - Buffer.contents ob -and write_any = ( - fun ob x -> - match x with - | `E x -> - Buffer.add_string ob "[\"E\","; - ( - write_expr - ) ob x; - Buffer.add_char ob ']' - | `S x -> - Buffer.add_string ob "[\"S\","; - ( - write_stmt - ) ob x; - Buffer.add_char ob ']' - | `T x -> - Buffer.add_string ob "[\"T\","; - ( - write_type_ - ) ob x; - Buffer.add_char ob ']' - | `P x -> - Buffer.add_string ob "[\"P\","; - ( - write_pattern - ) ob x; - Buffer.add_char ob ']' - | `At x -> - Buffer.add_string ob "[\"At\","; - ( - write_attribute - ) ob x; - Buffer.add_char ob ']' - | `Fld x -> - Buffer.add_string ob "[\"Fld\","; - ( - write_field - ) ob x; - Buffer.add_char ob ']' - | `Ar x -> - Buffer.add_string ob "[\"Ar\","; - ( - write_argument - ) ob x; - Buffer.add_char ob ']' - | `Pa x -> - Buffer.add_string ob "[\"Pa\","; - ( - write_parameter - ) ob x; - Buffer.add_char ob ']' - | `Ta x -> - Buffer.add_string ob "[\"Ta\","; - ( - write_type_argument - ) ob x; - Buffer.add_char ob ']' - | `Tp x -> - Buffer.add_string ob "[\"Tp\","; - ( - write_type_parameter - ) ob x; - Buffer.add_char ob ']' - | `Ce x -> - Buffer.add_string ob "[\"Ce\","; - ( - write_catch_exn - ) ob x; - Buffer.add_char ob ']' - | `Cs x -> - Buffer.add_string ob "[\"Cs\","; - ( - write_case - ) ob x; - Buffer.add_char ob ']' - | `ForOrIfComp x -> - Buffer.add_string ob "[\"ForOrIfComp\","; - ( - write_for_or_if_comp - ) ob x; - Buffer.add_char ob ']' - | `En x -> - Buffer.add_string ob "[\"En\","; - ( - write_entity - ) ob x; - Buffer.add_char ob ']' - | `I x -> - Buffer.add_string ob "[\"I\","; - ( - write_ident - ) ob x; - Buffer.add_char ob ']' - | `Modn x -> - Buffer.add_string ob "[\"Modn\","; - ( - write_module_name - ) ob x; - Buffer.add_char ob ']' - | `Di x -> - Buffer.add_string ob "[\"Di\","; - ( - write_dotted_ident - ) ob x; - Buffer.add_char ob ']' - | `Lbli x -> - Buffer.add_string ob "[\"Lbli\","; - ( - write_label_ident - ) ob x; - Buffer.add_char ob ']' - | `Str x -> - Buffer.add_string ob "[\"Str\","; - ( - write__string_wrap - ) ob x; - Buffer.add_char ob ']' - | `Tk x -> - Buffer.add_string ob "[\"Tk\","; - ( - write_tok - ) ob x; - Buffer.add_char ob ']' - | `TodoK x -> - Buffer.add_string ob "[\"TodoK\","; - ( - write_todo_kind - ) ob x; - Buffer.add_char ob ']' - | `Anys x -> - Buffer.add_string ob "[\"Anys\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_any ?(len = 1024) x = - let ob = Buffer.create len in - write_any ob x; - Buffer.contents ob -and write_argument = ( - fun ob x -> - match x with - | `Arg x -> - Buffer.add_string ob "[\"Arg\","; - ( - write_expr - ) ob x; - Buffer.add_char ob ']' - | `ArgKwd x -> - Buffer.add_string ob "[\"ArgKwd\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `ArgKwdOptional x -> - Buffer.add_string ob "[\"ArgKwdOptional\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `ArgType x -> - Buffer.add_string ob "[\"ArgType\","; - ( - write_type_ - ) ob x; - Buffer.add_char ob ']' - | `OtherArg x -> - Buffer.add_string ob "[\"OtherArg\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_argument ?(len = 1024) x = - let ob = Buffer.create len in - write_argument ob x; - Buffer.contents ob -and write_arguments ob x = ( - write__argument_list_bracket -) ob x -and string_of_arguments ?(len = 1024) x = - let ob = Buffer.create len in - write_arguments ob x; - Buffer.contents ob -and write_attribute = ( - fun ob x -> - match x with - | `KeywordAttr x -> - Buffer.add_string ob "[\"KeywordAttr\","; - ( - write__keyword_attribute_wrap - ) ob x; - Buffer.add_char ob ']' - | `NamedAttr x -> - Buffer.add_string ob "[\"NamedAttr\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_name - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_arguments - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `OtherAttribute x -> - Buffer.add_string ob "[\"OtherAttribute\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_attribute ?(len = 1024) x = - let ob = Buffer.create len in - write_attribute ob x; - Buffer.contents ob -and write_case = ( - fun ob x -> - match x with - | `Case x -> - Buffer.add_string ob "[\"Case\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_pattern - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Default x -> - Buffer.add_string ob "[\"Default\","; - ( - write_tok - ) ob x; - Buffer.add_char ob ']' - | `CaseEqualExpr x -> - Buffer.add_string ob "[\"CaseEqualExpr\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `OtherCase x -> - Buffer.add_string ob "[\"OtherCase\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_case ?(len = 1024) x = - let ob = Buffer.create len in - write_case ob x; - Buffer.contents ob -and write_case_and_body = ( - fun ob x -> - match x with - | `CasesAndBody x -> - Buffer.add_string ob "[\"CasesAndBody\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write__case_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_stmt - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_case_and_body ?(len = 1024) x = - let ob = Buffer.create len in - write_case_and_body ob x; - Buffer.contents ob -and write_catch = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_catch_exn - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_stmt - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of_catch ?(len = 1024) x = - let ob = Buffer.create len in - write_catch ob x; - Buffer.contents ob -and write_catch_exn = ( - fun ob x -> - match x with - | `CatchPattern x -> - Buffer.add_string ob "[\"CatchPattern\","; - ( - write_pattern - ) ob x; - Buffer.add_char ob ']' - | `CatchParam x -> - Buffer.add_string ob "[\"CatchParam\","; - ( - write_parameter_classic - ) ob x; - Buffer.add_char ob ']' - | `OtherCatch x -> - Buffer.add_string ob "[\"OtherCatch\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_catch_exn ?(len = 1024) x = - let ob = Buffer.create len in - write_catch_exn ob x; - Buffer.contents ob -and write_class_definition : _ -> class_definition -> _ = ( - fun ob (x : class_definition) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"ckind\":"; - ( - write__class_kind_wrap - ) - ob x.ckind; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"cextends\":"; - ( - write__class_parent_list - ) - ob x.cextends; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"cimplements\":"; - ( - write__type_list - ) - ob x.cimplements; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"cmixins\":"; - ( - write__type_list - ) - ob x.cmixins; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"cparams\":"; - ( - write_parameters - ) - ob x.cparams; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"cbody\":"; - ( - write__field_list_bracket - ) - ob x.cbody; - Buffer.add_char ob '}'; -) -and string_of_class_definition ?(len = 1024) x = - let ob = Buffer.create len in - write_class_definition ob x; - Buffer.contents ob -and write_class_parent = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__arguments_nullable - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of_class_parent ?(len = 1024) x = - let ob = Buffer.create len in - write_class_parent ob x; - Buffer.contents ob -and write_comprehension = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__for_or_if_comp_list - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of_comprehension ?(len = 1024) x = - let ob = Buffer.create len in - write_comprehension ob x; - Buffer.contents ob -and write_condition = ( - fun ob x -> - match x with - | `Cond x -> - Buffer.add_string ob "[\"Cond\","; - ( - write_expr - ) ob x; - Buffer.add_char ob ']' - | `OtherCond x -> - Buffer.add_string ob "[\"OtherCond\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_condition ?(len = 1024) x = - let ob = Buffer.create len in - write_condition ob x; - Buffer.contents ob -and write_definition = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_entity - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_definition_kind - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of_definition ?(len = 1024) x = - let ob = Buffer.create len in - write_definition ob x; - Buffer.contents ob -and write_definition_kind = ( - fun ob x -> - match x with - | `FuncDef x -> - Buffer.add_string ob "[\"FuncDef\","; - ( - write_function_definition - ) ob x; - Buffer.add_char ob ']' - | `VarDef x -> - Buffer.add_string ob "[\"VarDef\","; - ( - write_variable_definition - ) ob x; - Buffer.add_char ob ']' - | `ClassDef x -> - Buffer.add_string ob "[\"ClassDef\","; - ( - write_class_definition - ) ob x; - Buffer.add_char ob ']' - | `EnumEntryDef x -> - Buffer.add_string ob "[\"EnumEntryDef\","; - ( - write_enum_entry_definition - ) ob x; - Buffer.add_char ob ']' - | `TypeDef x -> - Buffer.add_string ob "[\"TypeDef\","; - ( - write_type_definition - ) ob x; - Buffer.add_char ob ']' - | `ModuleDef x -> - Buffer.add_string ob "[\"ModuleDef\","; - ( - write_module_definition - ) ob x; - Buffer.add_char ob ']' - | `MacroDef x -> - Buffer.add_string ob "[\"MacroDef\","; - ( - write_macro_definition - ) ob x; - Buffer.add_char ob ']' - | `Signature x -> - Buffer.add_string ob "[\"Signature\","; - ( - write_type_ - ) ob x; - Buffer.add_char ob ']' - | `UseOuterDecl x -> - Buffer.add_string ob "[\"UseOuterDecl\","; - ( - write_tok - ) ob x; - Buffer.add_char ob ']' - | `OtherDef x -> - Buffer.add_string ob "[\"OtherDef\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_definition_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_definition_kind ob x; - Buffer.contents ob -and write_directive = ( - fun ob x -> - match x with - | `ImportFrom x -> - Buffer.add_string ob "[\"ImportFrom\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_module_name - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write__import_from_kind_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `ImportAs x -> - Buffer.add_string ob "[\"ImportAs\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_module_name - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write__alias_nullable - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `ImportAll x -> - Buffer.add_string ob "[\"ImportAll\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_module_name - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Package x -> - Buffer.add_string ob "[\"Package\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_dotted_ident - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `PackageEnd x -> - Buffer.add_string ob "[\"PackageEnd\","; - ( - write_tok - ) ob x; - Buffer.add_char ob ']' - | `Pragma x -> - Buffer.add_string ob "[\"Pragma\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `OtherDirective x -> - Buffer.add_string ob "[\"OtherDirective\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_directive ?(len = 1024) x = - let ob = Buffer.create len in - write_directive ob x; - Buffer.contents ob -and write_entity : _ -> entity -> _ = ( - fun ob (x : entity) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"name\":"; - ( - write_entity_name - ) - ob x.name; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"attrs\":"; - ( - write__attribute_list - ) - ob x.attrs; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"tparams\":"; - ( - write_type_parameters - ) - ob x.tparams; - Buffer.add_char ob '}'; -) -and string_of_entity ?(len = 1024) x = - let ob = Buffer.create len in - write_entity ob x; - Buffer.contents ob -and write_entity_name = ( - fun ob x -> - match x with - | `EN x -> - Buffer.add_string ob "[\"EN\","; - ( - write_name - ) ob x; - Buffer.add_char ob ']' - | `EDynamic x -> - Buffer.add_string ob "[\"EDynamic\","; - ( - write_expr - ) ob x; - Buffer.add_char ob ']' - | `EPattern x -> - Buffer.add_string ob "[\"EPattern\","; - ( - write_pattern - ) ob x; - Buffer.add_char ob ']' - | `OtherEntity x -> - Buffer.add_string ob "[\"OtherEntity\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_entity_name ?(len = 1024) x = - let ob = Buffer.create len in - write_entity_name ob x; - Buffer.contents ob -and write_enum_entry_definition : _ -> enum_entry_definition -> _ = ( - fun ob (x : enum_entry_definition) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"ee_args\":"; - ( - write__arguments_nullable - ) - ob x.ee_args; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"ee_body\":"; - ( - write__field_list_bracket_nullable - ) - ob x.ee_body; - Buffer.add_char ob '}'; -) -and string_of_enum_entry_definition ?(len = 1024) x = - let ob = Buffer.create len in - write_enum_entry_definition ob x; - Buffer.contents ob -and write_expr = ( - fun ob x -> - match x with - | `L x -> - Buffer.add_string ob "[\"L\","; - ( - write_literal - ) ob x; - Buffer.add_char ob ']' - | `Container x -> - Buffer.add_string ob "[\"Container\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_container_operator - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__expr_list_bracket - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Comprehension x -> - Buffer.add_string ob "[\"Comprehension\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_container_operator - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__comprehension_bracket - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Record x -> - Buffer.add_string ob "[\"Record\","; - ( - write__field_list_bracket - ) ob x; - Buffer.add_char ob ']' - | `Constructor x -> - Buffer.add_string ob "[\"Constructor\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_name - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__expr_list_bracket - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `N x -> - Buffer.add_string ob "[\"N\","; - ( - write_name - ) ob x; - Buffer.add_char ob ']' - | `IdSpecial x -> - Buffer.add_string ob "[\"IdSpecial\","; - ( - write__special_wrap - ) ob x; - Buffer.add_char ob ']' - | `Call x -> - Buffer.add_string ob "[\"Call\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_arguments - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `New x -> - Buffer.add_string ob "[\"New\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_arguments - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Xml x -> - Buffer.add_string ob "[\"Xml\","; - ( - write_xml - ) ob x; - Buffer.add_char ob ']' - | `Assign x -> - Buffer.add_string ob "[\"Assign\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `AssignOp x -> - Buffer.add_string ob "[\"AssignOp\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__operator_wrap - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `LetPattern x -> - Buffer.add_string ob "[\"LetPattern\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_pattern - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `DotAccess x -> - Buffer.add_string ob "[\"DotAccess\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_field_name - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `ArrayAccess x -> - Buffer.add_string ob "[\"ArrayAccess\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__expr_bracket - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `SliceAccess x -> - Buffer.add_string ob "[\"SliceAccess\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__bracket_0ecc50b - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Lambda x -> - Buffer.add_string ob "[\"Lambda\","; - ( - write_function_definition - ) ob x; - Buffer.add_char ob ']' - | `AnonClass x -> - Buffer.add_string ob "[\"AnonClass\","; - ( - write_class_definition - ) ob x; - Buffer.add_char ob ']' - | `Conditional x -> - Buffer.add_string ob "[\"Conditional\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Yield x -> - Buffer.add_string ob "[\"Yield\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__expr_nullable - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - Yojson.Safe.write_bool - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Await x -> - Buffer.add_string ob "[\"Await\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Cast x -> - Buffer.add_string ob "[\"Cast\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Seq x -> - Buffer.add_string ob "[\"Seq\","; - ( - write__expr_list - ) ob x; - Buffer.add_char ob ']' - | `Ref x -> - Buffer.add_string ob "[\"Ref\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `DeRef x -> - Buffer.add_string ob "[\"DeRef\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Ellipsis x -> - Buffer.add_string ob "[\"Ellipsis\","; - ( - write_tok - ) ob x; - Buffer.add_char ob ']' - | `ParenExpr x -> - Buffer.add_string ob "[\"ParenExpr\","; - ( - write__expr_bracket - ) ob x; - Buffer.add_char ob ']' - | `StmtExpr x -> - Buffer.add_string ob "[\"StmtExpr\","; - ( - write_stmt - ) ob x; - Buffer.add_char ob ']' - | `OtherExpr x -> - Buffer.add_string ob "[\"OtherExpr\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_expr ?(len = 1024) x = - let ob = Buffer.create len in - write_expr ob x; - Buffer.contents ob -and write_field = ( - fun ob x -> - match x with - | `F x -> - Buffer.add_string ob "[\"F\","; - ( - write_stmt - ) ob x; - Buffer.add_char ob ']' -) -and string_of_field ?(len = 1024) x = - let ob = Buffer.create len in - write_field ob x; - Buffer.contents ob -and write_field_name = ( - fun ob x -> - match x with - | `FN x -> - Buffer.add_string ob "[\"FN\","; - ( - write_name - ) ob x; - Buffer.add_char ob ']' - | `FDynamic x -> - Buffer.add_string ob "[\"FDynamic\","; - ( - write_expr - ) ob x; - Buffer.add_char ob ']' -) -and string_of_field_name ?(len = 1024) x = - let ob = Buffer.create len in - write_field_name ob x; - Buffer.contents ob -and write_finally = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_stmt - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of_finally ?(len = 1024) x = - let ob = Buffer.create len in - write_finally ob x; - Buffer.contents ob -and write_for_each = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_pattern - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; -) -and string_of_for_each ?(len = 1024) x = - let ob = Buffer.create len in - write_for_each ob x; - Buffer.contents ob -and write_for_header = ( - fun ob x -> - match x with - | `ForClassic x -> - Buffer.add_string ob "[\"ForClassic\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write__for_var_or_expr_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__expr_nullable - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write__expr_nullable - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `ForEach x -> - Buffer.add_string ob "[\"ForEach\","; - ( - write_for_each - ) ob x; - Buffer.add_char ob ']' - | `MultiForEach x -> - Buffer.add_string ob "[\"MultiForEach\","; - ( - write__multi_for_each_list - ) ob x; - Buffer.add_char ob ']' - | `ForIn x -> - Buffer.add_string ob "[\"ForIn\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write__for_var_or_expr_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__expr_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_for_header ?(len = 1024) x = - let ob = Buffer.create len in - write_for_header ob x; - Buffer.contents ob -and write_for_or_if_comp = ( - fun ob x -> - match x with - | `CompFor x -> - Buffer.add_string ob "[\"CompFor\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _, _ = x in - ( - write_pattern - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `CompIf x -> - Buffer.add_string ob "[\"CompIf\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_for_or_if_comp ?(len = 1024) x = - let ob = Buffer.create len in - write_for_or_if_comp ob x; - Buffer.contents ob -and write_for_var_or_expr = ( - fun ob x -> - match x with - | `ForInitVar x -> - Buffer.add_string ob "[\"ForInitVar\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_entity - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_variable_definition - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `ForInitExpr x -> - Buffer.add_string ob "[\"ForInitExpr\","; - ( - write_expr - ) ob x; - Buffer.add_char ob ']' -) -and string_of_for_var_or_expr ?(len = 1024) x = - let ob = Buffer.create len in - write_for_var_or_expr ob x; - Buffer.contents ob -and write_function_body = ( - fun ob x -> - match x with - | `FBStmt x -> - Buffer.add_string ob "[\"FBStmt\","; - ( - write_stmt - ) ob x; - Buffer.add_char ob ']' - | `FBExpr x -> - Buffer.add_string ob "[\"FBExpr\","; - ( - write_expr - ) ob x; - Buffer.add_char ob ']' - | `FBDecl x -> - Buffer.add_string ob "[\"FBDecl\","; - ( - write_sc - ) ob x; - Buffer.add_char ob ']' - | `FBNothing -> Buffer.add_string ob "\"FBNothing\"" -) -and string_of_function_body ?(len = 1024) x = - let ob = Buffer.create len in - write_function_body ob x; - Buffer.contents ob -and write_function_definition : _ -> function_definition -> _ = ( - fun ob (x : function_definition) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"fkind\":"; - ( - write__function_kind_wrap - ) - ob x.fkind; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"fparams\":"; - ( - write_parameters - ) - ob x.fparams; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"frettype\":"; - ( - write__type_nullable - ) - ob x.frettype; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"fbody\":"; - ( - write_function_body - ) - ob x.fbody; - Buffer.add_char ob '}'; -) -and string_of_function_definition ?(len = 1024) x = - let ob = Buffer.create len in - write_function_definition ob x; - Buffer.contents ob -and write_id_info : _ -> id_info -> _ = ( - fun ob (x : id_info) -> - Buffer.add_char ob '{'; - let is_first = ref true in - (match x.id_resolved with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"id_resolved\":"; - ( - write_resolved_name - ) - ob x; - ); - (match x.id_type with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"id_type\":"; - ( - write_type_ - ) - ob x; - ); - (match x.id_svalue with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"id_svalue\":"; - ( - write_svalue - ) - ob x; - ); - Buffer.add_char ob '}'; -) -and string_of_id_info ?(len = 1024) x = - let ob = Buffer.create len in - write_id_info ob x; - Buffer.contents ob -and write_import_from_kind = ( - fun ob x -> - match x with - | `Direct x -> - Buffer.add_string ob "[\"Direct\","; - ( - write_alias - ) ob x; - Buffer.add_char ob ']' - | `Aliased x -> - Buffer.add_string ob "[\"Aliased\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_alias - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_import_from_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_import_from_kind ob x; - Buffer.contents ob -and write_item ob x = ( - write_stmt -) ob x -and string_of_item ?(len = 1024) x = - let ob = Buffer.create len in - write_item ob x; - Buffer.contents ob -and write_label_ident = ( - fun ob x -> - match x with - | `LNone -> Buffer.add_string ob "\"LNone\"" - | `LId x -> - Buffer.add_string ob "[\"LId\","; - ( - write_label - ) ob x; - Buffer.add_char ob ']' - | `LInt x -> - Buffer.add_string ob "[\"LInt\","; - ( - write__int_wrap - ) ob x; - Buffer.add_char ob ']' - | `LDynamic x -> - Buffer.add_string ob "[\"LDynamic\","; - ( - write_expr - ) ob x; - Buffer.add_char ob ']' -) -and string_of_label_ident ?(len = 1024) x = - let ob = Buffer.create len in - write_label_ident ob x; - Buffer.contents ob -and write_macro_definition : _ -> macro_definition -> _ = ( - fun ob (x : macro_definition) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"macroparams\":"; - ( - write__ident_list - ) - ob x.macroparams; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"macrobody\":"; - ( - write__any_list - ) - ob x.macrobody; - Buffer.add_char ob '}'; -) -and string_of_macro_definition ?(len = 1024) x = - let ob = Buffer.create len in - write_macro_definition ob x; - Buffer.contents ob -and write_module_definition : _ -> module_definition -> _ = ( - fun ob (x : module_definition) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"mbody\":"; - ( - write_module_definition_kind - ) - ob x.mbody; - Buffer.add_char ob '}'; -) -and string_of_module_definition ?(len = 1024) x = - let ob = Buffer.create len in - write_module_definition ob x; - Buffer.contents ob -and write_module_definition_kind = ( - fun ob x -> - match x with - | `ModuleAlias x -> - Buffer.add_string ob "[\"ModuleAlias\","; - ( - write_dotted_ident - ) ob x; - Buffer.add_char ob ']' - | `ModuleStruct x -> - Buffer.add_string ob "[\"ModuleStruct\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write__dotted_ident_nullable - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__item_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `OtherModule x -> - Buffer.add_string ob "[\"OtherModule\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_module_definition_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_module_definition_kind ob x; - Buffer.contents ob -and write_multi_for_each = ( - fun ob x -> - match x with - | `FE x -> - Buffer.add_string ob "[\"FE\","; - ( - write_for_each - ) ob x; - Buffer.add_char ob ']' - | `FECond x -> - Buffer.add_string ob "[\"FECond\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_for_each - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_multi_for_each ?(len = 1024) x = - let ob = Buffer.create len in - write_multi_for_each ob x; - Buffer.contents ob -and write_name = ( - fun ob x -> - match x with - | `Id x -> - Buffer.add_string ob "[\"Id\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_id_info - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `IdQualified x -> - Buffer.add_string ob "[\"IdQualified\","; - ( - write_qualified_info - ) ob x; - Buffer.add_char ob ']' -) -and string_of_name ?(len = 1024) x = - let ob = Buffer.create len in - write_name ob x; - Buffer.contents ob -and write_or_type_element = ( - fun ob x -> - match x with - | `OrConstructor x -> - Buffer.add_string ob "[\"OrConstructor\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__type_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `OrEnum x -> - Buffer.add_string ob "[\"OrEnum\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__expr_nullable - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `OrUnion x -> - Buffer.add_string ob "[\"OrUnion\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `OtherOr x -> - Buffer.add_string ob "[\"OtherOr\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_or_type_element ?(len = 1024) x = - let ob = Buffer.create len in - write_or_type_element ob x; - Buffer.contents ob -and write_parameter = ( - fun ob x -> - match x with - | `ParamClassic x -> - Buffer.add_string ob "[\"ParamClassic\","; - ( - write_parameter_classic - ) ob x; - Buffer.add_char ob ']' - | `ParamPattern x -> - Buffer.add_string ob "[\"ParamPattern\","; - ( - write_pattern - ) ob x; - Buffer.add_char ob ']' - | `ParamRest x -> - Buffer.add_string ob "[\"ParamRest\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_parameter_classic - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `ParamHashSplat x -> - Buffer.add_string ob "[\"ParamHashSplat\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_parameter_classic - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `OtherParam x -> - Buffer.add_string ob "[\"OtherParam\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_parameter ?(len = 1024) x = - let ob = Buffer.create len in - write_parameter ob x; - Buffer.contents ob -and write_parameter_classic : _ -> parameter_classic -> _ = ( - fun ob (x : parameter_classic) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"pname\":"; - ( - write__ident_nullable - ) - ob x.pname; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"ptype\":"; - ( - write__type_nullable - ) - ob x.ptype; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"pdefault\":"; - ( - write__expr_nullable - ) - ob x.pdefault; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"pattrs\":"; - ( - write__attribute_list - ) - ob x.pattrs; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"pinfo\":"; - ( - write_id_info - ) - ob x.pinfo; - Buffer.add_char ob '}'; -) -and string_of_parameter_classic ?(len = 1024) x = - let ob = Buffer.create len in - write_parameter_classic ob x; - Buffer.contents ob -and write_parameters ob x = ( - write__parameter_list -) ob x -and string_of_parameters ?(len = 1024) x = - let ob = Buffer.create len in - write_parameters ob x; - Buffer.contents ob -and write_pattern = ( - fun ob x -> - match x with - | `PatLiteral x -> - Buffer.add_string ob "[\"PatLiteral\","; - ( - write_literal - ) ob x; - Buffer.add_char ob ']' - | `PatConstructor x -> - Buffer.add_string ob "[\"PatConstructor\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_name - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__pattern_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `PatRecord x -> - Buffer.add_string ob "[\"PatRecord\","; - ( - write__dotted_ident_pattern_list_bracket - ) ob x; - Buffer.add_char ob ']' - | `PatId x -> - Buffer.add_string ob "[\"PatId\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_id_info - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `PatTuple x -> - Buffer.add_string ob "[\"PatTuple\","; - ( - write__pattern_list_bracket - ) ob x; - Buffer.add_char ob ']' - | `PatList x -> - Buffer.add_string ob "[\"PatList\","; - ( - write__pattern_list_bracket - ) ob x; - Buffer.add_char ob ']' - | `PatKeyVal x -> - Buffer.add_string ob "[\"PatKeyVal\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_pattern - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_pattern - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `PatWildcard x -> - Buffer.add_string ob "[\"PatWildcard\","; - ( - write_tok - ) ob x; - Buffer.add_char ob ']' - | `PatDisj x -> - Buffer.add_string ob "[\"PatDisj\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_pattern - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_pattern - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `PatTyped x -> - Buffer.add_string ob "[\"PatTyped\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_pattern - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `PatWhen x -> - Buffer.add_string ob "[\"PatWhen\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_pattern - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `PatAs x -> - Buffer.add_string ob "[\"PatAs\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_pattern - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_id_info - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `PatType x -> - Buffer.add_string ob "[\"PatType\","; - ( - write_type_ - ) ob x; - Buffer.add_char ob ']' - | `OtherPat x -> - Buffer.add_string ob "[\"OtherPat\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_pattern ?(len = 1024) x = - let ob = Buffer.create len in - write_pattern ob x; - Buffer.contents ob -and write_qualified_info : _ -> qualified_info -> _ = ( - fun ob (x : qualified_info) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"name_last\":"; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__type_arguments_nullable - ) ob x - ); - Buffer.add_char ob ']'; - ) - ob x.name_last; - (match x.name_middle with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"name_middle\":"; - ( - write_qualifier - ) - ob x; - ); - (match x.name_top with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"name_top\":"; - ( - write_tok - ) - ob x; - ); - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"name_info\":"; - ( - write_id_info - ) - ob x.name_info; - Buffer.add_char ob '}'; -) -and string_of_qualified_info ?(len = 1024) x = - let ob = Buffer.create len in - write_qualified_info ob x; - Buffer.contents ob -and write_qualifier = ( - fun ob x -> - match x with - | `QDots x -> - Buffer.add_string ob "[\"QDots\","; - ( - write__ident_type_arguments_nullable_list - ) ob x; - Buffer.add_char ob ']' - | `QExpr x -> - Buffer.add_string ob "[\"QExpr\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_qualifier ?(len = 1024) x = - let ob = Buffer.create len in - write_qualifier ob x; - Buffer.contents ob -and write_stmt = ( - fun ob x -> - match x with - | `ExprStmt x -> - Buffer.add_string ob "[\"ExprStmt\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_sc - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Block x -> - Buffer.add_string ob "[\"Block\","; - ( - write__stmt_list_bracket - ) ob x; - Buffer.add_char ob ']' - | `If x -> - Buffer.add_string ob "[\"If\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _, _ = x in - ( - write_condition - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x, _ = x in - ( - write_stmt - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, _, x = x in - ( - write__stmt_nullable - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `While x -> - Buffer.add_string ob "[\"While\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_condition - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_stmt - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Return x -> - Buffer.add_string ob "[\"Return\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__expr_nullable - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_sc - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `DoWhile x -> - Buffer.add_string ob "[\"DoWhile\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_stmt - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `For x -> - Buffer.add_string ob "[\"For\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_for_header - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_stmt - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Switch x -> - Buffer.add_string ob "[\"Switch\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__condition_nullable - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write__case_and_body_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Continue x -> - Buffer.add_string ob "[\"Continue\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_label_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_sc - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Break x -> - Buffer.add_string ob "[\"Break\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_label_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_sc - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Label x -> - Buffer.add_string ob "[\"Label\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_label - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_stmt - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Goto x -> - Buffer.add_string ob "[\"Goto\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_label - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Throw x -> - Buffer.add_string ob "[\"Throw\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_expr - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_sc - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Try x -> - Buffer.add_string ob "[\"Try\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _, _ = x in - ( - write_stmt - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x, _ = x in - ( - write__catch_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, _, x = x in - ( - write__finally_nullable - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `WithUsingResource x -> - Buffer.add_string ob "[\"WithUsingResource\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__stmt_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_stmt - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `Assert x -> - Buffer.add_string ob "[\"Assert\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_arguments - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_sc - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `DefStmt x -> - Buffer.add_string ob "[\"DefStmt\","; - ( - write_definition - ) ob x; - Buffer.add_char ob ']' - | `DirectiveStmt x -> - Buffer.add_string ob "[\"DirectiveStmt\","; - ( - write_directive - ) ob x; - Buffer.add_char ob ']' - | `OtherStmt x -> - Buffer.add_string ob "[\"OtherStmt\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_stmt ?(len = 1024) x = - let ob = Buffer.create len in - write_stmt ob x; - Buffer.contents ob -and write_svalue = ( - fun ob x -> - match x with - | `Lit x -> - Buffer.add_string ob "[\"Lit\","; - ( - write_literal - ) ob x; - Buffer.add_char ob ']' - | `Cst x -> - Buffer.add_string ob "[\"Cst\","; - ( - write_const_type - ) ob x; - Buffer.add_char ob ']' - | `Sym x -> - Buffer.add_string ob "[\"Sym\","; - ( - write_expr - ) ob x; - Buffer.add_char ob ']' - | `NotCst -> Buffer.add_string ob "\"NotCst\"" -) -and string_of_svalue ?(len = 1024) x = - let ob = Buffer.create len in - write_svalue ob x; - Buffer.contents ob -and write_type_ = ( - fun ob x -> - match x with - | `TyN x -> - Buffer.add_string ob "[\"TyN\","; - ( - write_name - ) ob x; - Buffer.add_char ob ']' - | `TyApply x -> - Buffer.add_string ob "[\"TyApply\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_type_arguments - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `TyFun x -> - Buffer.add_string ob "[\"TyFun\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write__parameter_list - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `TyArray x -> - Buffer.add_string ob "[\"TyArray\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write__expr_nullable_bracket - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `TyTuple x -> - Buffer.add_string ob "[\"TyTuple\","; - ( - write__type_list_bracket - ) ob x; - Buffer.add_char ob ']' - | `TyVar x -> - Buffer.add_string ob "[\"TyVar\","; - ( - write_ident - ) ob x; - Buffer.add_char ob ']' - | `TyAny x -> - Buffer.add_string ob "[\"TyAny\","; - ( - write_tok - ) ob x; - Buffer.add_char ob ']' - | `TyPointer x -> - Buffer.add_string ob "[\"TyPointer\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `TyRef x -> - Buffer.add_string ob "[\"TyRef\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `TyQuestion x -> - Buffer.add_string ob "[\"TyQuestion\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `TyRest x -> - Buffer.add_string ob "[\"TyRest\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `TyAnd x -> - Buffer.add_string ob "[\"TyAnd\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `TyOr x -> - Buffer.add_string ob "[\"TyOr\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_type_ - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `TyRecordAnon x -> - Buffer.add_string ob "[\"TyRecordAnon\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write__class_kind_wrap - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__field_list_bracket - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `TyExpr x -> - Buffer.add_string ob "[\"TyExpr\","; - ( - write_expr - ) ob x; - Buffer.add_char ob ']' - | `OtherType x -> - Buffer.add_string ob "[\"OtherType\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_type_ ?(len = 1024) x = - let ob = Buffer.create len in - write_type_ ob x; - Buffer.contents ob -and write_type_argument = ( - fun ob x -> - match x with - | `TA x -> - Buffer.add_string ob "[\"TA\","; - ( - write_type_ - ) ob x; - Buffer.add_char ob ']' - | `TAWildcard x -> - Buffer.add_string ob "[\"TAWildcard\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__bool_wrap_type_nullable - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `TAExpr x -> - Buffer.add_string ob "[\"TAExpr\","; - ( - write_expr - ) ob x; - Buffer.add_char ob ']' - | `OtherTypeArg x -> - Buffer.add_string ob "[\"OtherTypeArg\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_type_argument ?(len = 1024) x = - let ob = Buffer.create len in - write_type_argument ob x; - Buffer.contents ob -and write_type_arguments ob x = ( - write__type_argument_list_bracket -) ob x -and string_of_type_arguments ?(len = 1024) x = - let ob = Buffer.create len in - write_type_arguments ob x; - Buffer.contents ob -and write_type_definition : _ -> type_definition -> _ = ( - fun ob (x : type_definition) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"tbody\":"; - ( - write_type_definition_kind - ) - ob x.tbody; - Buffer.add_char ob '}'; -) -and string_of_type_definition ?(len = 1024) x = - let ob = Buffer.create len in - write_type_definition ob x; - Buffer.contents ob -and write_type_definition_kind = ( - fun ob x -> - match x with - | `OrType x -> - Buffer.add_string ob "[\"OrType\","; - ( - write__or_type_element_list - ) ob x; - Buffer.add_char ob ']' - | `AndType x -> - Buffer.add_string ob "[\"AndType\","; - ( - write__field_list_bracket - ) ob x; - Buffer.add_char ob ']' - | `AliasType x -> - Buffer.add_string ob "[\"AliasType\","; - ( - write_type_ - ) ob x; - Buffer.add_char ob ']' - | `NewType x -> - Buffer.add_string ob "[\"NewType\","; - ( - write_type_ - ) ob x; - Buffer.add_char ob ']' - | `AbstractType x -> - Buffer.add_string ob "[\"AbstractType\","; - ( - write_tok - ) ob x; - Buffer.add_char ob ']' - | `Exception x -> - Buffer.add_string ob "[\"Exception\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__type_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `OtherTypeKind x -> - Buffer.add_string ob "[\"OtherTypeKind\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_type_definition_kind ?(len = 1024) x = - let ob = Buffer.create len in - write_type_definition_kind ob x; - Buffer.contents ob -and write_type_parameter = ( - fun ob x -> - match x with - | `TP x -> - Buffer.add_string ob "[\"TP\","; - ( - write_type_parameter_classic - ) ob x; - Buffer.add_char ob ']' - | `OtherTypeParam x -> - Buffer.add_string ob "[\"OtherTypeParam\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write_todo_kind - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write__any_list - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' -) -and string_of_type_parameter ?(len = 1024) x = - let ob = Buffer.create len in - write_type_parameter ob x; - Buffer.contents ob -and write_type_parameter_classic : _ -> type_parameter_classic -> _ = ( - fun ob (x : type_parameter_classic) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"tp_id\":"; - ( - write_ident - ) - ob x.tp_id; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"tp_attrs\":"; - ( - write__attribute_list - ) - ob x.tp_attrs; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"tp_bounds\":"; - ( - write__type_list - ) - ob x.tp_bounds; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"tp_default\":"; - ( - write__type_nullable - ) - ob x.tp_default; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"tp_variance\":"; - ( - write__variance_wrap_nullable - ) - ob x.tp_variance; - Buffer.add_char ob '}'; -) -and string_of_type_parameter_classic ?(len = 1024) x = - let ob = Buffer.create len in - write_type_parameter_classic ob x; - Buffer.contents ob -and write_type_parameters ob x = ( - write__type_parameter_list -) ob x -and string_of_type_parameters ?(len = 1024) x = - let ob = Buffer.create len in - write_type_parameters ob x; - Buffer.contents ob -and write_variable_definition : _ -> variable_definition -> _ = ( - fun ob (x : variable_definition) -> - Buffer.add_char ob '{'; - let is_first = ref true in - (match x.vinit with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"vinit\":"; - ( - write_expr - ) - ob x; - ); - (match x.vtype with None -> () | Some x -> - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"vtype\":"; - ( - write_type_ - ) - ob x; - ); - Buffer.add_char ob '}'; -) -and string_of_variable_definition ?(len = 1024) x = - let ob = Buffer.create len in - write_variable_definition ob x; - Buffer.contents ob -and write_xml : _ -> xml -> _ = ( - fun ob (x : xml) -> - Buffer.add_char ob '{'; - let is_first = ref true in - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"xml_kind\":"; - ( - write_xml_kind - ) - ob x.xml_kind; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"xml_attrs\":"; - ( - write__xml_attribute_list - ) - ob x.xml_attrs; - if !is_first then - is_first := false - else - Buffer.add_char ob ','; - Buffer.add_string ob "\"xml_body\":"; - ( - write__xml_body_list - ) - ob x.xml_body; - Buffer.add_char ob '}'; -) -and string_of_xml ?(len = 1024) x = - let ob = Buffer.create len in - write_xml ob x; - Buffer.contents ob -and write_xml_attr_value ob x = ( - write_expr -) ob x -and string_of_xml_attr_value ?(len = 1024) x = - let ob = Buffer.create len in - write_xml_attr_value ob x; - Buffer.contents ob -and write_xml_attribute = ( - fun ob x -> - match x with - | `XmlAttr x -> - Buffer.add_string ob "[\"XmlAttr\","; - ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_ident - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_xml_attr_value - ) ob x - ); - Buffer.add_char ob ']'; - ) ob x; - Buffer.add_char ob ']' - | `XmlAttrExpr x -> - Buffer.add_string ob "[\"XmlAttrExpr\","; - ( - write__expr_bracket - ) ob x; - Buffer.add_char ob ']' -) -and string_of_xml_attribute ?(len = 1024) x = - let ob = Buffer.create len in - write_xml_attribute ob x; - Buffer.contents ob -and write_xml_body = ( - fun ob x -> - match x with - | `XmlText x -> - Buffer.add_string ob "[\"XmlText\","; - ( - write__string_wrap - ) ob x; - Buffer.add_char ob ']' - | `XmlExpr x -> - Buffer.add_string ob "[\"XmlExpr\","; - ( - write__expr_nullable_bracket - ) ob x; - Buffer.add_char ob ']' - | `XmlXml x -> - Buffer.add_string ob "[\"XmlXml\","; - ( - write_xml - ) ob x; - Buffer.add_char ob ']' -) -and string_of_xml_body ?(len = 1024) x = - let ob = Buffer.create len in - write_xml_body ob x; - Buffer.contents ob -let rec read__alias_nullable p lb = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read_alias - ) p lb) : _ option) -) p lb -and _alias_nullable_of_string s = - read__alias_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__any_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_any - ) -) p lb -and _any_list_of_string s = - read__any_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__argument_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_argument - ) -) p lb -and _argument_list_of_string s = - read__argument_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__argument_list_bracket = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__argument_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and _argument_list_bracket_of_string s = - read__argument_list_bracket (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__arguments_nullable p lb = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read_arguments - ) p lb) : _ option) -) p lb -and _arguments_nullable_of_string s = - read__arguments_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__attribute_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_attribute - ) -) p lb -and _attribute_list_of_string s = - read__attribute_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__bool_wrap_type_nullable p lb = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__bool_wrap - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb) : _ option) -) p lb -and _bool_wrap_type_nullable_of_string s = - read__bool_wrap_type_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__bracket_0ecc50b = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and _bracket_0ecc50b_of_string s = - read__bracket_0ecc50b (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__case_and_body_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_case_and_body - ) -) p lb -and _case_and_body_list_of_string s = - read__case_and_body_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__case_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_case - ) -) p lb -and _case_list_of_string s = - read__case_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__catch_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_catch - ) -) p lb -and _catch_list_of_string s = - read__catch_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__class_parent_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_class_parent - ) -) p lb -and _class_parent_list_of_string s = - read__class_parent_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__comprehension_bracket = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_comprehension - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and _comprehension_bracket_of_string s = - read__comprehension_bracket (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__condition_nullable p lb = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read_condition - ) p lb) : _ option) -) p lb -and _condition_nullable_of_string s = - read__condition_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__dotted_ident_pattern_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_dotted_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_pattern - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) -) p lb -and _dotted_ident_pattern_list_of_string s = - read__dotted_ident_pattern_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__dotted_ident_pattern_list_bracket = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__dotted_ident_pattern_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and _dotted_ident_pattern_list_bracket_of_string s = - read__dotted_ident_pattern_list_bracket (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__expr_bracket = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and _expr_bracket_of_string s = - read__expr_bracket (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__expr_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_expr - ) -) p lb -and _expr_list_of_string s = - read__expr_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__expr_list_bracket = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and _expr_list_bracket_of_string s = - read__expr_list_bracket (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__expr_nullable p lb = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read_expr - ) p lb) : _ option) -) p lb -and _expr_nullable_of_string s = - read__expr_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__expr_nullable_bracket = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and _expr_nullable_bracket_of_string s = - read__expr_nullable_bracket (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__expr_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and _expr_option_of_string s = - read__expr_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__field_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_field - ) -) p lb -and _field_list_of_string s = - read__field_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__field_list_bracket = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__field_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and _field_list_bracket_of_string s = - read__field_list_bracket (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__field_list_bracket_nullable p lb = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read__field_list_bracket - ) p lb) : _ option) -) p lb -and _field_list_bracket_nullable_of_string s = - read__field_list_bracket_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__finally_nullable p lb = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read_finally - ) p lb) : _ option) -) p lb -and _finally_nullable_of_string s = - read__finally_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__for_or_if_comp_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_for_or_if_comp - ) -) p lb -and _for_or_if_comp_list_of_string s = - read__for_or_if_comp_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__for_var_or_expr_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_for_var_or_expr - ) -) p lb -and _for_var_or_expr_list_of_string s = - read__for_var_or_expr_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__ident_type_arguments_nullable_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__type_arguments_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) -) p lb -and _ident_type_arguments_nullable_list_of_string s = - read__ident_type_arguments_nullable_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__import_from_kind_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_import_from_kind - ) -) p lb -and _import_from_kind_list_of_string s = - read__import_from_kind_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__item_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_item - ) -) p lb -and _item_list_of_string s = - read__item_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__multi_for_each_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_multi_for_each - ) -) p lb -and _multi_for_each_list_of_string s = - read__multi_for_each_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__or_type_element_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_or_type_element - ) -) p lb -and _or_type_element_list_of_string s = - read__or_type_element_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__parameter_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_parameter - ) -) p lb -and _parameter_list_of_string s = - read__parameter_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__pattern_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_pattern - ) -) p lb -and _pattern_list_of_string s = - read__pattern_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__pattern_list_bracket = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__pattern_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and _pattern_list_bracket_of_string s = - read__pattern_list_bracket (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__qualifier_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_qualifier - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_qualifier - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and _qualifier_option_of_string s = - read__qualifier_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__stmt_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_stmt - ) -) p lb -and _stmt_list_of_string s = - read__stmt_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__stmt_list_bracket = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__stmt_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and _stmt_list_bracket_of_string s = - read__stmt_list_bracket (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__stmt_nullable p lb = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read_stmt - ) p lb) : _ option) -) p lb -and _stmt_nullable_of_string s = - read__stmt_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__svalue_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_svalue - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_svalue - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and _svalue_option_of_string s = - read__svalue_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__type_argument_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_type_argument - ) -) p lb -and _type_argument_list_of_string s = - read__type_argument_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__type_argument_list_bracket = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__type_argument_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and _type_argument_list_bracket_of_string s = - read__type_argument_list_bracket (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__type_arguments_nullable p lb = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read_type_arguments - ) p lb) : _ option) -) p lb -and _type_arguments_nullable_of_string s = - read__type_arguments_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__type_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_type_ - ) -) p lb -and _type_list_of_string s = - read__type_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__type_list_bracket = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__type_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and _type_list_bracket_of_string s = - read__type_list_bracket (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__type_nullable p lb = ( - fun p lb -> - Yojson.Safe.read_space p lb; - (if Yojson.Safe.read_null_if_possible p lb then None - else Some (( - read_type_ - ) p lb) : _ option) -) p lb -and _type_nullable_of_string s = - read__type_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__type_option = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "None" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (None : _ option) - | "Some" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "None" -> - (None : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Some" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - (Some x : _ option) - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and _type_option_of_string s = - read__type_option (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__type_parameter_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_type_parameter - ) -) p lb -and _type_parameter_list_of_string s = - read__type_parameter_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__xml_attribute_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_xml_attribute - ) -) p lb -and _xml_attribute_list_of_string s = - read__xml_attribute_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read__xml_body_list p lb = ( - Atdgen_runtime.Oj_run.read_list ( - read_xml_body - ) -) p lb -and _xml_body_list_of_string s = - read__xml_body_list (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_alias = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_id_info - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -and alias_of_string s = - read_alias (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_any = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "E" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `E x - | "S" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_stmt - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `S x - | "T" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `T x - | "P" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_pattern - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `P x - | "At" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_attribute - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `At x - | "Fld" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_field - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Fld x - | "Ar" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_argument - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Ar x - | "Pa" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_parameter - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Pa x - | "Ta" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_type_argument - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Ta x - | "Tp" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_type_parameter - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Tp x - | "Ce" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_catch_exn - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Ce x - | "Cs" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_case - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Cs x - | "ForOrIfComp" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_for_or_if_comp - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ForOrIfComp x - | "En" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_entity - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `En x - | "I" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `I x - | "Modn" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_module_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Modn x - | "Di" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_dotted_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Di x - | "Lbli" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_label_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Lbli x - | "Str" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Str x - | "Tk" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Tk x - | "TodoK" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_todo_kind - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TodoK x - | "Anys" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Anys x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "E" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `E x - | "S" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_stmt - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `S x - | "T" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `T x - | "P" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_pattern - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `P x - | "At" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_attribute - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `At x - | "Fld" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_field - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Fld x - | "Ar" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_argument - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Ar x - | "Pa" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_parameter - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Pa x - | "Ta" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_type_argument - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Ta x - | "Tp" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_type_parameter - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Tp x - | "Ce" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_catch_exn - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Ce x - | "Cs" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_case - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Cs x - | "ForOrIfComp" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_for_or_if_comp - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ForOrIfComp x - | "En" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_entity - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `En x - | "I" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `I x - | "Modn" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_module_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Modn x - | "Di" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_dotted_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Di x - | "Lbli" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_label_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Lbli x - | "Str" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Str x - | "Tk" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Tk x - | "TodoK" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_todo_kind - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TodoK x - | "Anys" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Anys x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and any_of_string s = - read_any (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_argument = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Arg" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Arg x - | "ArgKwd" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ArgKwd x - | "ArgKwdOptional" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ArgKwdOptional x - | "ArgType" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ArgType x - | "OtherArg" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherArg x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Arg" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Arg x - | "ArgKwd" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ArgKwd x - | "ArgKwdOptional" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ArgKwdOptional x - | "ArgType" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ArgType x - | "OtherArg" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherArg x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and argument_of_string s = - read_argument (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_arguments p lb = ( - read__argument_list_bracket -) p lb -and arguments_of_string s = - read_arguments (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_attribute = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "KeywordAttr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__keyword_attribute_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `KeywordAttr x - | "NamedAttr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_name - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_arguments - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `NamedAttr x - | "OtherAttribute" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherAttribute x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "KeywordAttr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__keyword_attribute_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `KeywordAttr x - | "NamedAttr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_name - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_arguments - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `NamedAttr x - | "OtherAttribute" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherAttribute x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and attribute_of_string s = - read_attribute (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_case = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Case" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_pattern - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Case x - | "Default" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Default x - | "CaseEqualExpr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `CaseEqualExpr x - | "OtherCase" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherCase x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Case" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_pattern - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Case x - | "Default" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Default x - | "CaseEqualExpr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `CaseEqualExpr x - | "OtherCase" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherCase x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and case_of_string s = - read_case (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_case_and_body = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "CasesAndBody" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__case_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_stmt - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `CasesAndBody x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "CasesAndBody" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__case_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_stmt - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `CasesAndBody x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and case_and_body_of_string s = - read_case_and_body (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_catch = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_catch_exn - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_stmt - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and catch_of_string s = - read_catch (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_catch_exn = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "CatchPattern" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_pattern - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `CatchPattern x - | "CatchParam" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_parameter_classic - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `CatchParam x - | "OtherCatch" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherCatch x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "CatchPattern" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_pattern - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `CatchPattern x - | "CatchParam" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_parameter_classic - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `CatchParam x - | "OtherCatch" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherCatch x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and catch_exn_of_string s = - read_catch_exn (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_class_definition = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_ckind = ref (None) in - let field_cextends = ref (None) in - let field_cimplements = ref (None) in - let field_cmixins = ref (None) in - let field_cparams = ref (None) in - let field_cbody = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 5 -> ( - if String.unsafe_get s pos = 'c' then ( - match String.unsafe_get s (pos+1) with - | 'b' -> ( - if String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'y' then ( - 5 - ) - else ( - -1 - ) - ) - | 'k' -> ( - if String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'c' then ( - match String.unsafe_get s (pos+1) with - | 'm' -> ( - if String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'x' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' then ( - 4 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_ckind := ( - Some ( - ( - read__class_kind_wrap - ) p lb - ) - ); - | 1 -> - field_cextends := ( - Some ( - ( - read__class_parent_list - ) p lb - ) - ); - | 2 -> - field_cimplements := ( - Some ( - ( - read__type_list - ) p lb - ) - ); - | 3 -> - field_cmixins := ( - Some ( - ( - read__type_list - ) p lb - ) - ); - | 4 -> - field_cparams := ( - Some ( - ( - read_parameters - ) p lb - ) - ); - | 5 -> - field_cbody := ( - Some ( - ( - read__field_list_bracket - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 5 -> ( - if String.unsafe_get s pos = 'c' then ( - match String.unsafe_get s (pos+1) with - | 'b' -> ( - if String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'y' then ( - 5 - ) - else ( - -1 - ) - ) - | 'k' -> ( - if String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'c' then ( - match String.unsafe_get s (pos+1) with - | 'm' -> ( - if String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'x' && String.unsafe_get s (pos+4) = 'i' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | 'p' -> ( - if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' then ( - 4 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = 'x' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'n' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'c' && String.unsafe_get s (pos+1) = 'i' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'l' && String.unsafe_get s (pos+5) = 'e' && String.unsafe_get s (pos+6) = 'm' && String.unsafe_get s (pos+7) = 'e' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 't' && String.unsafe_get s (pos+10) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_ckind := ( - Some ( - ( - read__class_kind_wrap - ) p lb - ) - ); - | 1 -> - field_cextends := ( - Some ( - ( - read__class_parent_list - ) p lb - ) - ); - | 2 -> - field_cimplements := ( - Some ( - ( - read__type_list - ) p lb - ) - ); - | 3 -> - field_cmixins := ( - Some ( - ( - read__type_list - ) p lb - ) - ); - | 4 -> - field_cparams := ( - Some ( - ( - read_parameters - ) p lb - ) - ); - | 5 -> - field_cbody := ( - Some ( - ( - read__field_list_bracket - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - ckind = (match !field_ckind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ckind"); - cextends = (match !field_cextends with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "cextends"); - cimplements = (match !field_cimplements with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "cimplements"); - cmixins = (match !field_cmixins with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "cmixins"); - cparams = (match !field_cparams with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "cparams"); - cbody = (match !field_cbody with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "cbody"); - } - : class_definition) - ) -) -and class_definition_of_string s = - read_class_definition (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_class_parent = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_type_ - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__arguments_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -and class_parent_of_string s = - read_class_parent (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_comprehension = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__for_or_if_comp_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -and comprehension_of_string s = - read_comprehension (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_condition = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Cond" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Cond x - | "OtherCond" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherCond x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Cond" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Cond x - | "OtherCond" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherCond x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and condition_of_string s = - read_condition (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_definition = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_entity - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_definition_kind - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -and definition_of_string s = - read_definition (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_definition_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "FuncDef" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_function_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `FuncDef x - | "VarDef" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_variable_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `VarDef x - | "ClassDef" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_class_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ClassDef x - | "EnumEntryDef" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_enum_entry_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `EnumEntryDef x - | "TypeDef" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_type_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TypeDef x - | "ModuleDef" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_module_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ModuleDef x - | "MacroDef" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_macro_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `MacroDef x - | "Signature" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Signature x - | "UseOuterDecl" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `UseOuterDecl x - | "OtherDef" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherDef x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "FuncDef" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_function_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `FuncDef x - | "VarDef" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_variable_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `VarDef x - | "ClassDef" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_class_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ClassDef x - | "EnumEntryDef" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_enum_entry_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `EnumEntryDef x - | "TypeDef" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_type_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TypeDef x - | "ModuleDef" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_module_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ModuleDef x - | "MacroDef" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_macro_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `MacroDef x - | "Signature" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Signature x - | "UseOuterDecl" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `UseOuterDecl x - | "OtherDef" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherDef x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and definition_kind_of_string s = - read_definition_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_directive = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "ImportFrom" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_module_name - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read__import_from_kind_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ImportFrom x - | "ImportAs" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_module_name - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read__alias_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ImportAs x - | "ImportAll" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_module_name - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ImportAll x - | "Package" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_dotted_ident - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Package x - | "PackageEnd" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PackageEnd x - | "Pragma" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Pragma x - | "OtherDirective" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherDirective x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "ImportFrom" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_module_name - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read__import_from_kind_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ImportFrom x - | "ImportAs" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_module_name - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read__alias_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ImportAs x - | "ImportAll" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_module_name - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ImportAll x - | "Package" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_dotted_ident - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Package x - | "PackageEnd" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PackageEnd x - | "Pragma" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Pragma x - | "OtherDirective" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherDirective x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and directive_of_string s = - read_directive (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_entity = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_name = ref (None) in - let field_attrs = ref (None) in - let field_tparams = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 4 -> ( - if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 5 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_name := ( - Some ( - ( - read_entity_name - ) p lb - ) - ); - | 1 -> - field_attrs := ( - Some ( - ( - read__attribute_list - ) p lb - ) - ); - | 2 -> - field_tparams := ( - Some ( - ( - read_type_parameters - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 4 -> ( - if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 5 -> ( - if String.unsafe_get s pos = 'a' && String.unsafe_get s (pos+1) = 't' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_name := ( - Some ( - ( - read_entity_name - ) p lb - ) - ); - | 1 -> - field_attrs := ( - Some ( - ( - read__attribute_list - ) p lb - ) - ); - | 2 -> - field_tparams := ( - Some ( - ( - read_type_parameters - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - name = (match !field_name with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "name"); - attrs = (match !field_attrs with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "attrs"); - tparams = (match !field_tparams with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "tparams"); - } - : entity) - ) -) -and entity_of_string s = - read_entity (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_entity_name = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "EN" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `EN x - | "EDynamic" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `EDynamic x - | "EPattern" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_pattern - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `EPattern x - | "OtherEntity" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherEntity x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "EN" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `EN x - | "EDynamic" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `EDynamic x - | "EPattern" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_pattern - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `EPattern x - | "OtherEntity" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherEntity x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and entity_name_of_string s = - read_entity_name (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_enum_entry_definition = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_ee_args = ref (None) in - let field_ee_body = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 7 && String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = '_' then ( - match String.unsafe_get s (pos+3) with - | 'a' -> ( - if String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 's' then ( - 0 - ) - else ( - -1 - ) - ) - | 'b' -> ( - if String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'y' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_ee_args := ( - Some ( - ( - read__arguments_nullable - ) p lb - ) - ); - | 1 -> - field_ee_body := ( - Some ( - ( - read__field_list_bracket_nullable - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 7 && String.unsafe_get s pos = 'e' && String.unsafe_get s (pos+1) = 'e' && String.unsafe_get s (pos+2) = '_' then ( - match String.unsafe_get s (pos+3) with - | 'a' -> ( - if String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 'g' && String.unsafe_get s (pos+6) = 's' then ( - 0 - ) - else ( - -1 - ) - ) - | 'b' -> ( - if String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'd' && String.unsafe_get s (pos+6) = 'y' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_ee_args := ( - Some ( - ( - read__arguments_nullable - ) p lb - ) - ); - | 1 -> - field_ee_body := ( - Some ( - ( - read__field_list_bracket_nullable - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - ee_args = (match !field_ee_args with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ee_args"); - ee_body = (match !field_ee_body with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ee_body"); - } - : enum_entry_definition) - ) -) -and enum_entry_definition_of_string s = - read_enum_entry_definition (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_expr = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "L" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_literal - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `L x - | "Container" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_container_operator - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_list_bracket - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Container x - | "Comprehension" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_container_operator - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__comprehension_bracket - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Comprehension x - | "Record" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__field_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Record x - | "Constructor" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_name - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_list_bracket - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Constructor x - | "N" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `N x - | "IdSpecial" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__special_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `IdSpecial x - | "Call" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_arguments - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Call x - | "New" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_arguments - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `New x - | "Xml" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_xml - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Xml x - | "Assign" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Assign x - | "AssignOp" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__operator_wrap - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `AssignOp x - | "LetPattern" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `LetPattern x - | "DotAccess" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_field_name - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `DotAccess x - | "ArrayAccess" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_bracket - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ArrayAccess x - | "SliceAccess" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__bracket_0ecc50b - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `SliceAccess x - | "Lambda" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_function_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Lambda x - | "AnonClass" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_class_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `AnonClass x - | "Conditional" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Conditional x - | "Yield" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Yield x - | "Await" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Await x - | "Cast" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_type_ - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Cast x - | "Seq" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__expr_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Seq x - | "Ref" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Ref x - | "DeRef" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `DeRef x - | "Ellipsis" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Ellipsis x - | "ParenExpr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__expr_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ParenExpr x - | "StmtExpr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_stmt - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `StmtExpr x - | "OtherExpr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherExpr x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "L" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_literal - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `L x - | "Container" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_container_operator - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_list_bracket - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Container x - | "Comprehension" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_container_operator - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__comprehension_bracket - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Comprehension x - | "Record" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__field_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Record x - | "Constructor" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_name - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_list_bracket - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Constructor x - | "N" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `N x - | "IdSpecial" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__special_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `IdSpecial x - | "Call" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_arguments - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Call x - | "New" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_arguments - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `New x - | "Xml" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_xml - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Xml x - | "Assign" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Assign x - | "AssignOp" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__operator_wrap - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `AssignOp x - | "LetPattern" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `LetPattern x - | "DotAccess" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_field_name - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `DotAccess x - | "ArrayAccess" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_bracket - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ArrayAccess x - | "SliceAccess" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__bracket_0ecc50b - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `SliceAccess x - | "Lambda" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_function_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Lambda x - | "AnonClass" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_class_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `AnonClass x - | "Conditional" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Conditional x - | "Yield" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - Atdgen_runtime.Oj_run.read_bool - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Yield x - | "Await" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Await x - | "Cast" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_type_ - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Cast x - | "Seq" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__expr_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Seq x - | "Ref" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Ref x - | "DeRef" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `DeRef x - | "Ellipsis" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Ellipsis x - | "ParenExpr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__expr_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ParenExpr x - | "StmtExpr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_stmt - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `StmtExpr x - | "OtherExpr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherExpr x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and expr_of_string s = - read_expr (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_field = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "F" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_stmt - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `F x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "F" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_stmt - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `F x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and field_of_string s = - read_field (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_field_name = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "FN" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `FN x - | "FDynamic" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `FDynamic x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "FN" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `FN x - | "FDynamic" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `FDynamic x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and field_name_of_string s = - read_field_name (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_finally = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_stmt - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -and finally_of_string s = - read_finally (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_for_each = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -and for_each_of_string s = - read_for_each (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_for_header = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "ForClassic" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__for_var_or_expr_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ForClassic x - | "ForEach" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_for_each - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ForEach x - | "MultiForEach" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__multi_for_each_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `MultiForEach x - | "ForIn" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__for_var_or_expr_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ForIn x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "ForClassic" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__for_var_or_expr_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ForClassic x - | "ForEach" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_for_each - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ForEach x - | "MultiForEach" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__multi_for_each_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `MultiForEach x - | "ForIn" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__for_var_or_expr_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ForIn x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and for_header_of_string s = - read_for_header (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_for_or_if_comp = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "CompFor" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x3 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2, x3) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `CompFor x - | "CompIf" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `CompIf x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "CompFor" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x3 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2, x3) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `CompFor x - | "CompIf" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `CompIf x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and for_or_if_comp_of_string s = - read_for_or_if_comp (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_for_var_or_expr = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "ForInitVar" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_entity - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_variable_definition - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ForInitVar x - | "ForInitExpr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ForInitExpr x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "ForInitVar" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_entity - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_variable_definition - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ForInitVar x - | "ForInitExpr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ForInitExpr x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and for_var_or_expr_of_string s = - read_for_var_or_expr (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_function_body = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "FBStmt" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_stmt - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `FBStmt x - | "FBExpr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `FBExpr x - | "FBDecl" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_sc - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `FBDecl x - | "FBNothing" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `FBNothing - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "FBNothing" -> - `FBNothing - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "FBStmt" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_stmt - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `FBStmt x - | "FBExpr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `FBExpr x - | "FBDecl" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_sc - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `FBDecl x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and function_body_of_string s = - read_function_body (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_function_definition = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_fkind = ref (None) in - let field_fparams = ref (None) in - let field_frettype = ref (None) in - let field_fbody = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 5 -> ( - if String.unsafe_get s pos = 'f' then ( - match String.unsafe_get s (pos+1) with - | 'b' -> ( - if String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'y' then ( - 3 - ) - else ( - -1 - ) - ) - | 'k' -> ( - if String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'e' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_fkind := ( - Some ( - ( - read__function_kind_wrap - ) p lb - ) - ); - | 1 -> - field_fparams := ( - Some ( - ( - read_parameters - ) p lb - ) - ); - | 2 -> - field_frettype := ( - Some ( - ( - read__type_nullable - ) p lb - ) - ); - | 3 -> - field_fbody := ( - Some ( - ( - read_function_body - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 5 -> ( - if String.unsafe_get s pos = 'f' then ( - match String.unsafe_get s (pos+1) with - | 'b' -> ( - if String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'y' then ( - 3 - ) - else ( - -1 - ) - ) - | 'k' -> ( - if String.unsafe_get s (pos+2) = 'i' && String.unsafe_get s (pos+3) = 'n' && String.unsafe_get s (pos+4) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 7 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'f' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 'y' && String.unsafe_get s (pos+6) = 'p' && String.unsafe_get s (pos+7) = 'e' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_fkind := ( - Some ( - ( - read__function_kind_wrap - ) p lb - ) - ); - | 1 -> - field_fparams := ( - Some ( - ( - read_parameters - ) p lb - ) - ); - | 2 -> - field_frettype := ( - Some ( - ( - read__type_nullable - ) p lb - ) - ); - | 3 -> - field_fbody := ( - Some ( - ( - read_function_body - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - fkind = (match !field_fkind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fkind"); - fparams = (match !field_fparams with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fparams"); - frettype = (match !field_frettype with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "frettype"); - fbody = (match !field_fbody with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "fbody"); - } - : function_definition) - ) -) -and function_definition_of_string s = - read_function_definition (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_id_info = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_id_resolved = ref (None) in - let field_id_type = ref (None) in - let field_id_svalue = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 7 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'd' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 'p' && String.unsafe_get s (pos+6) = 'e' then ( - 1 - ) - else ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'd' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 'e' then ( - 2 - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'd' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_id_resolved := ( - Some ( - ( - read_resolved_name - ) p lb - ) - ); - ) - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_id_type := ( - Some ( - ( - read_type_ - ) p lb - ) - ); - ) - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_id_svalue := ( - Some ( - ( - read_svalue - ) p lb - ) - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 7 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'd' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'y' && String.unsafe_get s (pos+5) = 'p' && String.unsafe_get s (pos+6) = 'e' then ( - 1 - ) - else ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'd' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 's' && String.unsafe_get s (pos+4) = 'v' && String.unsafe_get s (pos+5) = 'a' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 'e' then ( - 2 - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'i' && String.unsafe_get s (pos+1) = 'd' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 's' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'l' && String.unsafe_get s (pos+8) = 'v' && String.unsafe_get s (pos+9) = 'e' && String.unsafe_get s (pos+10) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_id_resolved := ( - Some ( - ( - read_resolved_name - ) p lb - ) - ); - ) - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_id_type := ( - Some ( - ( - read_type_ - ) p lb - ) - ); - ) - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_id_svalue := ( - Some ( - ( - read_svalue - ) p lb - ) - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - id_resolved = !field_id_resolved; - id_type = !field_id_type; - id_svalue = !field_id_svalue; - } - : id_info) - ) -) -and id_info_of_string s = - read_id_info (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_import_from_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Direct" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_alias - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Direct x - | "Aliased" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_alias - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Aliased x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Direct" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_alias - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Direct x - | "Aliased" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_alias - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Aliased x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and import_from_kind_of_string s = - read_import_from_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_item p lb = ( - read_stmt -) p lb -and item_of_string s = - read_item (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_label_ident = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "LNone" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `LNone - | "LId" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_label - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `LId x - | "LInt" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__int_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `LInt x - | "LDynamic" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `LDynamic x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "LNone" -> - `LNone - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "LId" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_label - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `LId x - | "LInt" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__int_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `LInt x - | "LDynamic" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `LDynamic x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and label_ident_of_string s = - read_label_ident (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_macro_definition = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_macroparams = ref (None) in - let field_macrobody = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 9 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'b' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'y' then ( - 1 - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'p' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'm' && String.unsafe_get s (pos+10) = 's' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_macroparams := ( - Some ( - ( - read__ident_list - ) p lb - ) - ); - | 1 -> - field_macrobody := ( - Some ( - ( - read__any_list - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 9 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'b' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'y' then ( - 1 - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'c' && String.unsafe_get s (pos+3) = 'r' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'p' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 'a' && String.unsafe_get s (pos+9) = 'm' && String.unsafe_get s (pos+10) = 's' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_macroparams := ( - Some ( - ( - read__ident_list - ) p lb - ) - ); - | 1 -> - field_macrobody := ( - Some ( - ( - read__any_list - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - macroparams = (match !field_macroparams with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "macroparams"); - macrobody = (match !field_macrobody with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "macrobody"); - } - : macro_definition) - ) -) -and macro_definition_of_string s = - read_macro_definition (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_module_definition = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_mbody = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 5 && String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'b' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'y' then ( - 0 - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_mbody := ( - Some ( - ( - read_module_definition_kind - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 5 && String.unsafe_get s pos = 'm' && String.unsafe_get s (pos+1) = 'b' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'y' then ( - 0 - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_mbody := ( - Some ( - ( - read_module_definition_kind - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - mbody = (match !field_mbody with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "mbody"); - } - : module_definition) - ) -) -and module_definition_of_string s = - read_module_definition (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_module_definition_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "ModuleAlias" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_dotted_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ModuleAlias x - | "ModuleStruct" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__dotted_ident_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__item_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ModuleStruct x - | "OtherModule" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherModule x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "ModuleAlias" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_dotted_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ModuleAlias x - | "ModuleStruct" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__dotted_ident_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__item_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ModuleStruct x - | "OtherModule" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherModule x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and module_definition_kind_of_string s = - read_module_definition_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_multi_for_each = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "FE" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_for_each - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `FE x - | "FECond" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_for_each - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `FECond x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "FE" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_for_each - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `FE x - | "FECond" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_for_each - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `FECond x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and multi_for_each_of_string s = - read_multi_for_each (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_name = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Id" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_id_info - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Id x - | "IdQualified" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_qualified_info - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `IdQualified x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Id" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_id_info - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Id x - | "IdQualified" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_qualified_info - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `IdQualified x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and name_of_string s = - read_name (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_or_type_element = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "OrConstructor" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__type_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OrConstructor x - | "OrEnum" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OrEnum x - | "OrUnion" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OrUnion x - | "OtherOr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherOr x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "OrConstructor" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__type_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OrConstructor x - | "OrEnum" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OrEnum x - | "OrUnion" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OrUnion x - | "OtherOr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherOr x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and or_type_element_of_string s = - read_or_type_element (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_parameter = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "ParamClassic" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_parameter_classic - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ParamClassic x - | "ParamPattern" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_pattern - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ParamPattern x - | "ParamRest" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_parameter_classic - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ParamRest x - | "ParamHashSplat" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_parameter_classic - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ParamHashSplat x - | "OtherParam" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherParam x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "ParamClassic" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_parameter_classic - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ParamClassic x - | "ParamPattern" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_pattern - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ParamPattern x - | "ParamRest" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_parameter_classic - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ParamRest x - | "ParamHashSplat" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_parameter_classic - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ParamHashSplat x - | "OtherParam" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherParam x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and parameter_of_string s = - read_parameter (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_parameter_classic = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_pname = ref (None) in - let field_ptype = ref (None) in - let field_pdefault = ref (None) in - let field_pattrs = ref (None) in - let field_pinfo = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 5 -> ( - if String.unsafe_get s pos = 'p' then ( - match String.unsafe_get s (pos+1) with - | 'i' -> ( - if String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'o' then ( - 4 - ) - else ( - -1 - ) - ) - | 'n' -> ( - if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+2) = 'y' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'e' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 6 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'd' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 't' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_pname := ( - Some ( - ( - read__ident_nullable - ) p lb - ) - ); - | 1 -> - field_ptype := ( - Some ( - ( - read__type_nullable - ) p lb - ) - ); - | 2 -> - field_pdefault := ( - Some ( - ( - read__expr_nullable - ) p lb - ) - ); - | 3 -> - field_pattrs := ( - Some ( - ( - read__attribute_list - ) p lb - ) - ); - | 4 -> - field_pinfo := ( - Some ( - ( - read_id_info - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 5 -> ( - if String.unsafe_get s pos = 'p' then ( - match String.unsafe_get s (pos+1) with - | 'i' -> ( - if String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'o' then ( - 4 - ) - else ( - -1 - ) - ) - | 'n' -> ( - if String.unsafe_get s (pos+2) = 'a' && String.unsafe_get s (pos+3) = 'm' && String.unsafe_get s (pos+4) = 'e' then ( - 0 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+2) = 'y' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'e' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 6 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 't' && String.unsafe_get s (pos+4) = 'r' && String.unsafe_get s (pos+5) = 's' then ( - 3 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 'p' && String.unsafe_get s (pos+1) = 'd' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'f' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 'l' && String.unsafe_get s (pos+7) = 't' then ( - 2 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_pname := ( - Some ( - ( - read__ident_nullable - ) p lb - ) - ); - | 1 -> - field_ptype := ( - Some ( - ( - read__type_nullable - ) p lb - ) - ); - | 2 -> - field_pdefault := ( - Some ( - ( - read__expr_nullable - ) p lb - ) - ); - | 3 -> - field_pattrs := ( - Some ( - ( - read__attribute_list - ) p lb - ) - ); - | 4 -> - field_pinfo := ( - Some ( - ( - read_id_info - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - pname = (match !field_pname with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "pname"); - ptype = (match !field_ptype with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "ptype"); - pdefault = (match !field_pdefault with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "pdefault"); - pattrs = (match !field_pattrs with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "pattrs"); - pinfo = (match !field_pinfo with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "pinfo"); - } - : parameter_classic) - ) -) -and parameter_classic_of_string s = - read_parameter_classic (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_parameters p lb = ( - read__parameter_list -) p lb -and parameters_of_string s = - read_parameters (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_pattern = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "PatLiteral" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_literal - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PatLiteral x - | "PatConstructor" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_name - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__pattern_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PatConstructor x - | "PatRecord" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__dotted_ident_pattern_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PatRecord x - | "PatId" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_id_info - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PatId x - | "PatTuple" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__pattern_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PatTuple x - | "PatList" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__pattern_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PatList x - | "PatKeyVal" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_pattern - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PatKeyVal x - | "PatWildcard" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PatWildcard x - | "PatDisj" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_pattern - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PatDisj x - | "PatTyped" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PatTyped x - | "PatWhen" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PatWhen x - | "PatAs" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_id_info - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PatAs x - | "PatType" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `PatType x - | "OtherPat" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherPat x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "PatLiteral" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_literal - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PatLiteral x - | "PatConstructor" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_name - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__pattern_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PatConstructor x - | "PatRecord" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__dotted_ident_pattern_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PatRecord x - | "PatId" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_id_info - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PatId x - | "PatTuple" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__pattern_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PatTuple x - | "PatList" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__pattern_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PatList x - | "PatKeyVal" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_pattern - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PatKeyVal x - | "PatWildcard" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PatWildcard x - | "PatDisj" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_pattern - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PatDisj x - | "PatTyped" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PatTyped x - | "PatWhen" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PatWhen x - | "PatAs" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_pattern - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_id_info - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PatAs x - | "PatType" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `PatType x - | "OtherPat" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherPat x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and pattern_of_string s = - read_pattern (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_qualified_info = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_name_last = ref (None) in - let field_name_middle = ref (None) in - let field_name_top = ref (None) in - let field_name_info = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 8 -> ( - if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'p' then ( - 2 - ) - else ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' then ( - match String.unsafe_get s (pos+5) with - | 'i' -> ( - if String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'o' then ( - 3 - ) - else ( - -1 - ) - ) - | 'l' -> ( - if String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 't' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'd' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'e' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_name_last := ( - Some ( - ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__type_arguments_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - ) - ); - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_name_middle := ( - Some ( - ( - read_qualifier - ) p lb - ) - ); - ) - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_name_top := ( - Some ( - ( - read_tok - ) p lb - ) - ); - ) - | 3 -> - field_name_info := ( - Some ( - ( - read_id_info - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 8 -> ( - if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'o' && String.unsafe_get s (pos+7) = 'p' then ( - 2 - ) - else ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' then ( - match String.unsafe_get s (pos+5) with - | 'i' -> ( - if String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'f' && String.unsafe_get s (pos+8) = 'o' then ( - 3 - ) - else ( - -1 - ) - ) - | 'l' -> ( - if String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 's' && String.unsafe_get s (pos+8) = 't' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 'n' && String.unsafe_get s (pos+1) = 'a' && String.unsafe_get s (pos+2) = 'm' && String.unsafe_get s (pos+3) = 'e' && String.unsafe_get s (pos+4) = '_' && String.unsafe_get s (pos+5) = 'm' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 'd' && String.unsafe_get s (pos+9) = 'l' && String.unsafe_get s (pos+10) = 'e' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_name_last := ( - Some ( - ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__type_arguments_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - ) - ); - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_name_middle := ( - Some ( - ( - read_qualifier - ) p lb - ) - ); - ) - | 2 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_name_top := ( - Some ( - ( - read_tok - ) p lb - ) - ); - ) - | 3 -> - field_name_info := ( - Some ( - ( - read_id_info - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - name_last = (match !field_name_last with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "name_last"); - name_middle = !field_name_middle; - name_top = !field_name_top; - name_info = (match !field_name_info with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "name_info"); - } - : qualified_info) - ) -) -and qualified_info_of_string s = - read_qualified_info (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_qualifier = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "QDots" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__ident_type_arguments_nullable_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `QDots x - | "QExpr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `QExpr x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "QDots" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__ident_type_arguments_nullable_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `QDots x - | "QExpr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `QExpr x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and qualifier_of_string s = - read_qualifier (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_stmt = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "ExprStmt" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_sc - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `ExprStmt x - | "Block" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__stmt_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Block x - | "If" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_condition - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_stmt - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x3 = - let x = - ( - read__stmt_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2, x3) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `If x - | "While" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_condition - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_stmt - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `While x - | "Return" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_sc - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Return x - | "DoWhile" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_stmt - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `DoWhile x - | "For" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_for_header - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_stmt - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `For x - | "Switch" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__condition_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read__case_and_body_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Switch x - | "Continue" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_label_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_sc - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Continue x - | "Break" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_label_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_sc - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Break x - | "Label" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_label - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_stmt - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Label x - | "Goto" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_label - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Goto x - | "Throw" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_sc - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Throw x - | "Try" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_stmt - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read__catch_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x3 = - let x = - ( - read__finally_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2, x3) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Try x - | "WithUsingResource" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__stmt_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_stmt - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `WithUsingResource x - | "Assert" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_arguments - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_sc - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Assert x - | "DefStmt" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `DefStmt x - | "DirectiveStmt" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_directive - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `DirectiveStmt x - | "OtherStmt" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherStmt x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "ExprStmt" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_sc - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `ExprStmt x - | "Block" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__stmt_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Block x - | "If" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_condition - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_stmt - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x3 = - let x = - ( - read__stmt_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2, x3) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `If x - | "While" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_condition - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_stmt - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `While x - | "Return" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__expr_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_sc - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Return x - | "DoWhile" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_stmt - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_expr - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `DoWhile x - | "For" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_for_header - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_stmt - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `For x - | "Switch" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__condition_nullable - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read__case_and_body_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Switch x - | "Continue" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_label_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_sc - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Continue x - | "Break" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_label_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_sc - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Break x - | "Label" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_label - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_stmt - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Label x - | "Goto" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_label - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Goto x - | "Throw" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_expr - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_sc - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Throw x - | "Try" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_stmt - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read__catch_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x3 = - let x = - ( - read__finally_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2, x3) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2; 3 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Try x - | "WithUsingResource" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__stmt_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_stmt - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `WithUsingResource x - | "Assert" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_arguments - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_sc - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Assert x - | "DefStmt" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_definition - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `DefStmt x - | "DirectiveStmt" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_directive - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `DirectiveStmt x - | "OtherStmt" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherStmt x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and stmt_of_string s = - read_stmt (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_svalue = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "Lit" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_literal - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Lit x - | "Cst" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_const_type - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Cst x - | "Sym" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Sym x - | "NotCst" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `NotCst - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | "NotCst" -> - `NotCst - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "Lit" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_literal - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Lit x - | "Cst" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_const_type - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Cst x - | "Sym" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Sym x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and svalue_of_string s = - read_svalue (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_type_ = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "TyN" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyN x - | "TyApply" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_type_ - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_arguments - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyApply x - | "TyFun" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__parameter_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyFun x - | "TyArray" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__expr_nullable_bracket - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyArray x - | "TyTuple" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__type_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyTuple x - | "TyVar" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyVar x - | "TyAny" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyAny x - | "TyPointer" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyPointer x - | "TyRef" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyRef x - | "TyQuestion" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_type_ - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyQuestion x - | "TyRest" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyRest x - | "TyAnd" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_type_ - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyAnd x - | "TyOr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_type_ - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyOr x - | "TyRecordAnon" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__class_kind_wrap - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__field_list_bracket - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyRecordAnon x - | "TyExpr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TyExpr x - | "OtherType" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherType x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "TyN" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_name - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyN x - | "TyApply" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_type_ - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_arguments - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyApply x - | "TyFun" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__parameter_list - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyFun x - | "TyArray" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__expr_nullable_bracket - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyArray x - | "TyTuple" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__type_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyTuple x - | "TyVar" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_ident - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyVar x - | "TyAny" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyAny x - | "TyPointer" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyPointer x - | "TyRef" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyRef x - | "TyQuestion" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_type_ - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyQuestion x - | "TyRest" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyRest x - | "TyAnd" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_type_ - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyAnd x - | "TyOr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_type_ - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_type_ - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyOr x - | "TyRecordAnon" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__class_kind_wrap - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__field_list_bracket - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyRecordAnon x - | "TyExpr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TyExpr x - | "OtherType" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherType x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and type__of_string s = - read_type_ (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_type_argument = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "TA" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TA x - | "TAWildcard" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__bool_wrap_type_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TAWildcard x - | "TAExpr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TAExpr x - | "OtherTypeArg" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherTypeArg x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "TA" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TA x - | "TAWildcard" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__bool_wrap_type_nullable - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TAWildcard x - | "TAExpr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_expr - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TAExpr x - | "OtherTypeArg" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherTypeArg x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and type_argument_of_string s = - read_type_argument (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_type_arguments p lb = ( - read__type_argument_list_bracket -) p lb -and type_arguments_of_string s = - read_type_arguments (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_type_definition = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_tbody = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 5 && String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'b' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'y' then ( - 0 - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_tbody := ( - Some ( - ( - read_type_definition_kind - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 5 && String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'b' && String.unsafe_get s (pos+2) = 'o' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'y' then ( - 0 - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_tbody := ( - Some ( - ( - read_type_definition_kind - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - tbody = (match !field_tbody with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "tbody"); - } - : type_definition) - ) -) -and type_definition_of_string s = - read_type_definition (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_type_definition_kind = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "OrType" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__or_type_element_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OrType x - | "AndType" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__field_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `AndType x - | "AliasType" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `AliasType x - | "NewType" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `NewType x - | "AbstractType" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `AbstractType x - | "Exception" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__type_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `Exception x - | "OtherTypeKind" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherTypeKind x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "OrType" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__or_type_element_list - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OrType x - | "AndType" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__field_list_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `AndType x - | "AliasType" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `AliasType x - | "NewType" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_type_ - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `NewType x - | "AbstractType" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_tok - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `AbstractType x - | "Exception" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__type_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `Exception x - | "OtherTypeKind" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherTypeKind x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and type_definition_kind_of_string s = - read_type_definition_kind (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_type_parameter = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "TP" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_type_parameter_classic - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `TP x - | "OtherTypeParam" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `OtherTypeParam x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "TP" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_type_parameter_classic - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `TP x - | "OtherTypeParam" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_todo_kind - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__any_list - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `OtherTypeParam x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and type_parameter_of_string s = - read_type_parameter (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_type_parameter_classic = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_tp_id = ref (None) in - let field_tp_attrs = ref (None) in - let field_tp_bounds = ref (None) in - let field_tp_default = ref (None) in - let field_tp_variance = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 5 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | 10 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'f' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 'l' && String.unsafe_get s (pos+9) = 't' then ( - 3 - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'v' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'e' then ( - 4 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_tp_id := ( - Some ( - ( - read_ident - ) p lb - ) - ); - | 1 -> - field_tp_attrs := ( - Some ( - ( - read__attribute_list - ) p lb - ) - ); - | 2 -> - field_tp_bounds := ( - Some ( - ( - read__type_list - ) p lb - ) - ); - | 3 -> - field_tp_default := ( - Some ( - ( - read__type_nullable - ) p lb - ) - ); - | 4 -> - field_tp_variance := ( - Some ( - ( - read__variance_wrap_nullable - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 5 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | 8 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 't' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 'r' && String.unsafe_get s (pos+7) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'b' && String.unsafe_get s (pos+4) = 'o' && String.unsafe_get s (pos+5) = 'u' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'd' && String.unsafe_get s (pos+8) = 's' then ( - 2 - ) - else ( - -1 - ) - ) - | 10 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'd' && String.unsafe_get s (pos+4) = 'e' && String.unsafe_get s (pos+5) = 'f' && String.unsafe_get s (pos+6) = 'a' && String.unsafe_get s (pos+7) = 'u' && String.unsafe_get s (pos+8) = 'l' && String.unsafe_get s (pos+9) = 't' then ( - 3 - ) - else ( - -1 - ) - ) - | 11 -> ( - if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'p' && String.unsafe_get s (pos+2) = '_' && String.unsafe_get s (pos+3) = 'v' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 'r' && String.unsafe_get s (pos+6) = 'i' && String.unsafe_get s (pos+7) = 'a' && String.unsafe_get s (pos+8) = 'n' && String.unsafe_get s (pos+9) = 'c' && String.unsafe_get s (pos+10) = 'e' then ( - 4 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_tp_id := ( - Some ( - ( - read_ident - ) p lb - ) - ); - | 1 -> - field_tp_attrs := ( - Some ( - ( - read__attribute_list - ) p lb - ) - ); - | 2 -> - field_tp_bounds := ( - Some ( - ( - read__type_list - ) p lb - ) - ); - | 3 -> - field_tp_default := ( - Some ( - ( - read__type_nullable - ) p lb - ) - ); - | 4 -> - field_tp_variance := ( - Some ( - ( - read__variance_wrap_nullable - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - tp_id = (match !field_tp_id with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "tp_id"); - tp_attrs = (match !field_tp_attrs with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "tp_attrs"); - tp_bounds = (match !field_tp_bounds with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "tp_bounds"); - tp_default = (match !field_tp_default with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "tp_default"); - tp_variance = (match !field_tp_variance with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "tp_variance"); - } - : type_parameter_classic) - ) -) -and type_parameter_classic_of_string s = - read_type_parameter_classic (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_type_parameters p lb = ( - read__type_parameter_list -) p lb -and type_parameters_of_string s = - read_type_parameters (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_variable_definition = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_vinit = ref (None) in - let field_vtype = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 5 && String.unsafe_get s pos = 'v' then ( - match String.unsafe_get s (pos+1) with - | 'i' -> ( - if String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 't' then ( - 0 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+2) = 'y' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'e' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_vinit := ( - Some ( - ( - read_expr - ) p lb - ) - ); - ) - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_vtype := ( - Some ( - ( - read_type_ - ) p lb - ) - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - if len = 5 && String.unsafe_get s pos = 'v' then ( - match String.unsafe_get s (pos+1) with - | 'i' -> ( - if String.unsafe_get s (pos+2) = 'n' && String.unsafe_get s (pos+3) = 'i' && String.unsafe_get s (pos+4) = 't' then ( - 0 - ) - else ( - -1 - ) - ) - | 't' -> ( - if String.unsafe_get s (pos+2) = 'y' && String.unsafe_get s (pos+3) = 'p' && String.unsafe_get s (pos+4) = 'e' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_vinit := ( - Some ( - ( - read_expr - ) p lb - ) - ); - ) - | 1 -> - if not (Yojson.Safe.read_null_if_possible p lb) then ( - field_vtype := ( - Some ( - ( - read_type_ - ) p lb - ) - ); - ) - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - vinit = !field_vinit; - vtype = !field_vtype; - } - : variable_definition) - ) -) -and variable_definition_of_string s = - read_variable_definition (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_xml = ( - fun p lb -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_lcurl p lb; - let field_xml_kind = ref (None) in - let field_xml_attrs = ref (None) in - let field_xml_body = ref (None) in - try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_end lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 8 -> ( - if String.unsafe_get s pos = 'x' && String.unsafe_get s (pos+1) = 'm' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = '_' then ( - match String.unsafe_get s (pos+4) with - | 'b' -> ( - if String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = 'y' then ( - 2 - ) - else ( - -1 - ) - ) - | 'k' -> ( - if String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 'x' && String.unsafe_get s (pos+1) = 'm' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_xml_kind := ( - Some ( - ( - read_xml_kind - ) p lb - ) - ); - | 1 -> - field_xml_attrs := ( - Some ( - ( - read__xml_attribute_list - ) p lb - ) - ); - | 2 -> - field_xml_body := ( - Some ( - ( - read__xml_body_list - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - while true do - Yojson.Safe.read_space p lb; - Yojson.Safe.read_object_sep p lb; - Yojson.Safe.read_space p lb; - let f = - fun s pos len -> - if pos < 0 || len < 0 || pos + len > String.length s then - invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); - match len with - | 8 -> ( - if String.unsafe_get s pos = 'x' && String.unsafe_get s (pos+1) = 'm' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = '_' then ( - match String.unsafe_get s (pos+4) with - | 'b' -> ( - if String.unsafe_get s (pos+5) = 'o' && String.unsafe_get s (pos+6) = 'd' && String.unsafe_get s (pos+7) = 'y' then ( - 2 - ) - else ( - -1 - ) - ) - | 'k' -> ( - if String.unsafe_get s (pos+5) = 'i' && String.unsafe_get s (pos+6) = 'n' && String.unsafe_get s (pos+7) = 'd' then ( - 0 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - ) - else ( - -1 - ) - ) - | 9 -> ( - if String.unsafe_get s pos = 'x' && String.unsafe_get s (pos+1) = 'm' && String.unsafe_get s (pos+2) = 'l' && String.unsafe_get s (pos+3) = '_' && String.unsafe_get s (pos+4) = 'a' && String.unsafe_get s (pos+5) = 't' && String.unsafe_get s (pos+6) = 't' && String.unsafe_get s (pos+7) = 'r' && String.unsafe_get s (pos+8) = 's' then ( - 1 - ) - else ( - -1 - ) - ) - | _ -> ( - -1 - ) - in - let i = Yojson.Safe.map_ident p f lb in - Atdgen_runtime.Oj_run.read_until_field_value p lb; - ( - match i with - | 0 -> - field_xml_kind := ( - Some ( - ( - read_xml_kind - ) p lb - ) - ); - | 1 -> - field_xml_attrs := ( - Some ( - ( - read__xml_attribute_list - ) p lb - ) - ); - | 2 -> - field_xml_body := ( - Some ( - ( - read__xml_body_list - ) p lb - ) - ); - | _ -> ( - Yojson.Safe.skip_json p lb - ) - ); - done; - assert false; - with Yojson.End_of_object -> ( - ( - { - xml_kind = (match !field_xml_kind with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "xml_kind"); - xml_attrs = (match !field_xml_attrs with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "xml_attrs"); - xml_body = (match !field_xml_body with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "xml_body"); - } - : xml) - ) -) -and xml_of_string s = - read_xml (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_xml_attr_value p lb = ( - read_expr -) p lb -and xml_attr_value_of_string s = - read_xml_attr_value (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_xml_attribute = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "XmlAttr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_xml_attr_value - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `XmlAttr x - | "XmlAttrExpr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__expr_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `XmlAttrExpr x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "XmlAttr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_ident - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_xml_attr_value - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `XmlAttr x - | "XmlAttrExpr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__expr_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `XmlAttrExpr x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and xml_attribute_of_string s = - read_xml_attribute (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -and read_xml_body = ( - fun p lb -> - Yojson.Safe.read_space p lb; - match Yojson.Safe.start_any_variant p lb with - | `Edgy_bracket -> ( - match Yojson.Safe.read_ident p lb with - | "XmlText" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `XmlText x - | "XmlExpr" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read__expr_nullable_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `XmlExpr x - | "XmlXml" -> - Atdgen_runtime.Oj_run.read_until_field_value p lb; - let x = ( - read_xml - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_gt p lb; - `XmlXml x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Double_quote -> ( - match Yojson.Safe.finish_string p lb with - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) - | `Square_bracket -> ( - match Atdgen_runtime.Oj_run.read_string p lb with - | "XmlText" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__string_wrap - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `XmlText x - | "XmlExpr" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read__expr_nullable_bracket - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `XmlExpr x - | "XmlXml" -> - Yojson.Safe.read_space p lb; - Yojson.Safe.read_comma p lb; - Yojson.Safe.read_space p lb; - let x = ( - read_xml - ) p lb - in - Yojson.Safe.read_space p lb; - Yojson.Safe.read_rbr p lb; - `XmlXml x - | x -> - Atdgen_runtime.Oj_run.invalid_variant_tag p x - ) -) -and xml_body_of_string s = - read_xml_body (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_wrap_ write__a = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _ = x in - ( - write__a - ) ob x - ); - Buffer.add_char ob ','; - (let _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of_wrap_ write__a ?(len = 1024) x = - let ob = Buffer.create len in - write_wrap_ write__a ob x; - Buffer.contents ob -let read_wrap_ read__a = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read__a - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1 ]); -) -let wrap__of_string read__a s = - read_wrap_ read__a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_program = ( - write__item_list -) -let string_of_program ?(len = 1024) x = - let ob = Buffer.create len in - write_program ob x; - Buffer.contents ob -let read_program = ( - read__item_list -) -let program_of_string s = - read_program (Yojson.Safe.init_lexer ()) (Lexing.from_string s) -let write_bracket write__a = ( - fun ob x -> - Buffer.add_char ob '['; - (let x, _, _ = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ','; - (let _, x, _ = x in - ( - write__a - ) ob x - ); - Buffer.add_char ob ','; - (let _, _, x = x in - ( - write_tok - ) ob x - ); - Buffer.add_char ob ']'; -) -let string_of_bracket write__a ?(len = 1024) x = - let ob = Buffer.create len in - write_bracket write__a ob x; - Buffer.contents ob -let read_bracket read__a = ( - fun p lb -> - Yojson.Safe.read_space p lb; - let std_tuple = Yojson.Safe.start_any_tuple p lb in - let len = ref 0 in - let end_of_tuple = ref false in - (try - let x0 = - let x = - ( - read_tok - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x1 = - let x = - ( - read__a - ) p lb - in - incr len; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - x - in - let x2 = - let x = - ( - read_tok - ) p lb - in - incr len; - (try - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - with Yojson.End_of_tuple -> end_of_tuple := true); - x - in - if not !end_of_tuple then ( - try - while true do - Yojson.Safe.skip_json p lb; - Yojson.Safe.read_space p lb; - Yojson.Safe.read_tuple_sep2 p std_tuple lb; - done - with Yojson.End_of_tuple -> () - ); - (x0, x1, x2) - with Yojson.End_of_tuple -> - Atdgen_runtime.Oj_run.missing_tuple_fields p !len [ 0; 1; 2 ]); -) -let bracket_of_string read__a s = - read_bracket read__a (Yojson.Safe.init_lexer ()) (Lexing.from_string s) diff --git a/ast_generic_v1_j.mli b/ast_generic_v1_j.mli deleted file mode 100644 index 503d739..0000000 --- a/ast_generic_v1_j.mli +++ /dev/null @@ -1,2007 +0,0 @@ -(* Auto-generated from "ast_generic_v1.atd" *) -[@@@ocaml.warning "-27-32-33-35-39"] - -type class_kind = Ast_generic_v1_t.class_kind - -type concat_string_kind = Ast_generic_v1_t.concat_string_kind - -type const_type = Ast_generic_v1_t.const_type - -type container_operator = Ast_generic_v1_t.container_operator - -type function_kind = Ast_generic_v1_t.function_kind - -type incr_decr = Ast_generic_v1_t.incr_decr - -type keyword_attribute = Ast_generic_v1_t.keyword_attribute - -type operator = Ast_generic_v1_t.operator - -type prefix_postfix = Ast_generic_v1_t.prefix_postfix - -type sid = Ast_generic_v1_t.sid - -type special = Ast_generic_v1_t.special - -type token_location = Ast_generic_v1_t.token_location = { - str: string; - charpos: int; - line: int; - column: int; - filename: string -} - -type token = Ast_generic_v1_t.token - -type tok = Ast_generic_v1_t.tok - -type 'a bracket = 'a Ast_generic_v1_t.bracket - -type sc = Ast_generic_v1_t.sc - -type variance = Ast_generic_v1_t.variance - -type 'a wrap_ = 'a Ast_generic_v1_t.wrap_ - -type ident = Ast_generic_v1_t.ident - -type dotted_ident = Ast_generic_v1_t.dotted_ident - -type label = Ast_generic_v1_t.label - -type literal = Ast_generic_v1_t.literal - -type module_name = Ast_generic_v1_t.module_name - -type resolved_name_kind = Ast_generic_v1_t.resolved_name_kind - -type resolved_name = Ast_generic_v1_t.resolved_name - -type todo_kind = Ast_generic_v1_t.todo_kind - -type xml_kind = Ast_generic_v1_t.xml_kind - -type alias = Ast_generic_v1_t.alias - -and any = Ast_generic_v1_t.any - -and argument = Ast_generic_v1_t.argument - -and arguments = Ast_generic_v1_t.arguments - -and attribute = Ast_generic_v1_t.attribute - -and case = Ast_generic_v1_t.case - -and case_and_body = Ast_generic_v1_t.case_and_body - -and catch = Ast_generic_v1_t.catch - -and catch_exn = Ast_generic_v1_t.catch_exn - -and class_definition = Ast_generic_v1_t.class_definition = { - ckind: class_kind wrap_; - cextends: class_parent list; - cimplements: type_ list; - cmixins: type_ list; - cparams: parameters; - cbody: field list bracket -} - -and class_parent = Ast_generic_v1_t.class_parent - -and comprehension = Ast_generic_v1_t.comprehension - -and condition = Ast_generic_v1_t.condition - -and definition = Ast_generic_v1_t.definition - -and definition_kind = Ast_generic_v1_t.definition_kind - -and directive = Ast_generic_v1_t.directive - -and entity = Ast_generic_v1_t.entity = { - name: entity_name; - attrs: attribute list; - tparams: type_parameters -} - -and entity_name = Ast_generic_v1_t.entity_name - -and enum_entry_definition = Ast_generic_v1_t.enum_entry_definition = { - ee_args: arguments option; - ee_body: field list bracket option -} - -and expr = Ast_generic_v1_t.expr - -and field = Ast_generic_v1_t.field - -and field_name = Ast_generic_v1_t.field_name - -and finally = Ast_generic_v1_t.finally - -and for_each = Ast_generic_v1_t.for_each - -and for_header = Ast_generic_v1_t.for_header - -and for_or_if_comp = Ast_generic_v1_t.for_or_if_comp - -and for_var_or_expr = Ast_generic_v1_t.for_var_or_expr - -and function_body = Ast_generic_v1_t.function_body - -and function_definition = Ast_generic_v1_t.function_definition = { - fkind: function_kind wrap_; - fparams: parameters; - frettype: type_ option; - fbody: function_body -} - -and id_info = Ast_generic_v1_t.id_info = { - id_resolved: resolved_name option; - id_type: type_ option; - id_svalue: svalue option -} - -and import_from_kind = Ast_generic_v1_t.import_from_kind - -and item = Ast_generic_v1_t.item - -and label_ident = Ast_generic_v1_t.label_ident - -and macro_definition = Ast_generic_v1_t.macro_definition = { - macroparams: ident list; - macrobody: any list -} - -and module_definition = Ast_generic_v1_t.module_definition = { - mbody: module_definition_kind -} - -and module_definition_kind = Ast_generic_v1_t.module_definition_kind - -and multi_for_each = Ast_generic_v1_t.multi_for_each - -and name = Ast_generic_v1_t.name - -and or_type_element = Ast_generic_v1_t.or_type_element - -and parameter = Ast_generic_v1_t.parameter - -and parameter_classic = Ast_generic_v1_t.parameter_classic = { - pname: ident option; - ptype: type_ option; - pdefault: expr option; - pattrs: attribute list; - pinfo: id_info -} - -and parameters = Ast_generic_v1_t.parameters - -and pattern = Ast_generic_v1_t.pattern - -and qualified_info = Ast_generic_v1_t.qualified_info = { - name_last: (ident * type_arguments option); - name_middle: qualifier option; - name_top: tok option; - name_info: id_info -} - -and qualifier = Ast_generic_v1_t.qualifier - -and stmt = Ast_generic_v1_t.stmt - -and svalue = Ast_generic_v1_t.svalue - -and type_ = Ast_generic_v1_t.type_ - -and type_argument = Ast_generic_v1_t.type_argument - -and type_arguments = Ast_generic_v1_t.type_arguments - -and type_definition = Ast_generic_v1_t.type_definition = { - tbody: type_definition_kind -} - -and type_definition_kind = Ast_generic_v1_t.type_definition_kind - -and type_parameter = Ast_generic_v1_t.type_parameter - -and type_parameter_classic = Ast_generic_v1_t.type_parameter_classic = { - tp_id: ident; - tp_attrs: attribute list; - tp_bounds: type_ list; - tp_default: type_ option; - tp_variance: variance wrap_ option -} - -and type_parameters = Ast_generic_v1_t.type_parameters - -and variable_definition = Ast_generic_v1_t.variable_definition = { - vinit: expr option; - vtype: type_ option -} - -and xml = Ast_generic_v1_t.xml = { - xml_kind: xml_kind; - xml_attrs: xml_attribute list; - xml_body: xml_body list -} - -and xml_attr_value = Ast_generic_v1_t.xml_attr_value - -and xml_attribute = Ast_generic_v1_t.xml_attribute - -and xml_body = Ast_generic_v1_t.xml_body - -type program = Ast_generic_v1_t.program - -val write_class_kind : - Buffer.t -> class_kind -> unit - (** Output a JSON value of type {!type:class_kind}. *) - -val string_of_class_kind : - ?len:int -> class_kind -> string - (** Serialize a value of type {!type:class_kind} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_class_kind : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> class_kind - (** Input JSON data of type {!type:class_kind}. *) - -val class_kind_of_string : - string -> class_kind - (** Deserialize JSON data of type {!type:class_kind}. *) - -val write_concat_string_kind : - Buffer.t -> concat_string_kind -> unit - (** Output a JSON value of type {!type:concat_string_kind}. *) - -val string_of_concat_string_kind : - ?len:int -> concat_string_kind -> string - (** Serialize a value of type {!type:concat_string_kind} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_concat_string_kind : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> concat_string_kind - (** Input JSON data of type {!type:concat_string_kind}. *) - -val concat_string_kind_of_string : - string -> concat_string_kind - (** Deserialize JSON data of type {!type:concat_string_kind}. *) - -val write_const_type : - Buffer.t -> const_type -> unit - (** Output a JSON value of type {!type:const_type}. *) - -val string_of_const_type : - ?len:int -> const_type -> string - (** Serialize a value of type {!type:const_type} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_const_type : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> const_type - (** Input JSON data of type {!type:const_type}. *) - -val const_type_of_string : - string -> const_type - (** Deserialize JSON data of type {!type:const_type}. *) - -val write_container_operator : - Buffer.t -> container_operator -> unit - (** Output a JSON value of type {!type:container_operator}. *) - -val string_of_container_operator : - ?len:int -> container_operator -> string - (** Serialize a value of type {!type:container_operator} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_container_operator : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> container_operator - (** Input JSON data of type {!type:container_operator}. *) - -val container_operator_of_string : - string -> container_operator - (** Deserialize JSON data of type {!type:container_operator}. *) - -val write_function_kind : - Buffer.t -> function_kind -> unit - (** Output a JSON value of type {!type:function_kind}. *) - -val string_of_function_kind : - ?len:int -> function_kind -> string - (** Serialize a value of type {!type:function_kind} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_function_kind : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> function_kind - (** Input JSON data of type {!type:function_kind}. *) - -val function_kind_of_string : - string -> function_kind - (** Deserialize JSON data of type {!type:function_kind}. *) - -val write_incr_decr : - Buffer.t -> incr_decr -> unit - (** Output a JSON value of type {!type:incr_decr}. *) - -val string_of_incr_decr : - ?len:int -> incr_decr -> string - (** Serialize a value of type {!type:incr_decr} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_incr_decr : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> incr_decr - (** Input JSON data of type {!type:incr_decr}. *) - -val incr_decr_of_string : - string -> incr_decr - (** Deserialize JSON data of type {!type:incr_decr}. *) - -val write_keyword_attribute : - Buffer.t -> keyword_attribute -> unit - (** Output a JSON value of type {!type:keyword_attribute}. *) - -val string_of_keyword_attribute : - ?len:int -> keyword_attribute -> string - (** Serialize a value of type {!type:keyword_attribute} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_keyword_attribute : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> keyword_attribute - (** Input JSON data of type {!type:keyword_attribute}. *) - -val keyword_attribute_of_string : - string -> keyword_attribute - (** Deserialize JSON data of type {!type:keyword_attribute}. *) - -val write_operator : - Buffer.t -> operator -> unit - (** Output a JSON value of type {!type:operator}. *) - -val string_of_operator : - ?len:int -> operator -> string - (** Serialize a value of type {!type:operator} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_operator : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> operator - (** Input JSON data of type {!type:operator}. *) - -val operator_of_string : - string -> operator - (** Deserialize JSON data of type {!type:operator}. *) - -val write_prefix_postfix : - Buffer.t -> prefix_postfix -> unit - (** Output a JSON value of type {!type:prefix_postfix}. *) - -val string_of_prefix_postfix : - ?len:int -> prefix_postfix -> string - (** Serialize a value of type {!type:prefix_postfix} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_prefix_postfix : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> prefix_postfix - (** Input JSON data of type {!type:prefix_postfix}. *) - -val prefix_postfix_of_string : - string -> prefix_postfix - (** Deserialize JSON data of type {!type:prefix_postfix}. *) - -val write_sid : - Buffer.t -> sid -> unit - (** Output a JSON value of type {!type:sid}. *) - -val string_of_sid : - ?len:int -> sid -> string - (** Serialize a value of type {!type:sid} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_sid : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> sid - (** Input JSON data of type {!type:sid}. *) - -val sid_of_string : - string -> sid - (** Deserialize JSON data of type {!type:sid}. *) - -val write_special : - Buffer.t -> special -> unit - (** Output a JSON value of type {!type:special}. *) - -val string_of_special : - ?len:int -> special -> string - (** Serialize a value of type {!type:special} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_special : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> special - (** Input JSON data of type {!type:special}. *) - -val special_of_string : - string -> special - (** Deserialize JSON data of type {!type:special}. *) - -val write_token_location : - Buffer.t -> token_location -> unit - (** Output a JSON value of type {!type:token_location}. *) - -val string_of_token_location : - ?len:int -> token_location -> string - (** Serialize a value of type {!type:token_location} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_token_location : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> token_location - (** Input JSON data of type {!type:token_location}. *) - -val token_location_of_string : - string -> token_location - (** Deserialize JSON data of type {!type:token_location}. *) - -val write_token : - Buffer.t -> token -> unit - (** Output a JSON value of type {!type:token}. *) - -val string_of_token : - ?len:int -> token -> string - (** Serialize a value of type {!type:token} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_token : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> token - (** Input JSON data of type {!type:token}. *) - -val token_of_string : - string -> token - (** Deserialize JSON data of type {!type:token}. *) - -val write_tok : - Buffer.t -> tok -> unit - (** Output a JSON value of type {!type:tok}. *) - -val string_of_tok : - ?len:int -> tok -> string - (** Serialize a value of type {!type:tok} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_tok : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> tok - (** Input JSON data of type {!type:tok}. *) - -val tok_of_string : - string -> tok - (** Deserialize JSON data of type {!type:tok}. *) - -val write_bracket : - (Buffer.t -> 'a -> unit) -> - Buffer.t -> 'a bracket -> unit - (** Output a JSON value of type {!type:bracket}. *) - -val string_of_bracket : - (Buffer.t -> 'a -> unit) -> - ?len:int -> 'a bracket -> string - (** Serialize a value of type {!type:bracket} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_bracket : - (Yojson.Safe.lexer_state -> Lexing.lexbuf -> 'a) -> - Yojson.Safe.lexer_state -> Lexing.lexbuf -> 'a bracket - (** Input JSON data of type {!type:bracket}. *) - -val bracket_of_string : - (Yojson.Safe.lexer_state -> Lexing.lexbuf -> 'a) -> - string -> 'a bracket - (** Deserialize JSON data of type {!type:bracket}. *) - -val write_sc : - Buffer.t -> sc -> unit - (** Output a JSON value of type {!type:sc}. *) - -val string_of_sc : - ?len:int -> sc -> string - (** Serialize a value of type {!type:sc} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_sc : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> sc - (** Input JSON data of type {!type:sc}. *) - -val sc_of_string : - string -> sc - (** Deserialize JSON data of type {!type:sc}. *) - -val write_variance : - Buffer.t -> variance -> unit - (** Output a JSON value of type {!type:variance}. *) - -val string_of_variance : - ?len:int -> variance -> string - (** Serialize a value of type {!type:variance} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_variance : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> variance - (** Input JSON data of type {!type:variance}. *) - -val variance_of_string : - string -> variance - (** Deserialize JSON data of type {!type:variance}. *) - -val write_wrap_ : - (Buffer.t -> 'a -> unit) -> - Buffer.t -> 'a wrap_ -> unit - (** Output a JSON value of type {!type:wrap_}. *) - -val string_of_wrap_ : - (Buffer.t -> 'a -> unit) -> - ?len:int -> 'a wrap_ -> string - (** Serialize a value of type {!type:wrap_} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_wrap_ : - (Yojson.Safe.lexer_state -> Lexing.lexbuf -> 'a) -> - Yojson.Safe.lexer_state -> Lexing.lexbuf -> 'a wrap_ - (** Input JSON data of type {!type:wrap_}. *) - -val wrap__of_string : - (Yojson.Safe.lexer_state -> Lexing.lexbuf -> 'a) -> - string -> 'a wrap_ - (** Deserialize JSON data of type {!type:wrap_}. *) - -val write_ident : - Buffer.t -> ident -> unit - (** Output a JSON value of type {!type:ident}. *) - -val string_of_ident : - ?len:int -> ident -> string - (** Serialize a value of type {!type:ident} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_ident : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> ident - (** Input JSON data of type {!type:ident}. *) - -val ident_of_string : - string -> ident - (** Deserialize JSON data of type {!type:ident}. *) - -val write_dotted_ident : - Buffer.t -> dotted_ident -> unit - (** Output a JSON value of type {!type:dotted_ident}. *) - -val string_of_dotted_ident : - ?len:int -> dotted_ident -> string - (** Serialize a value of type {!type:dotted_ident} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_dotted_ident : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> dotted_ident - (** Input JSON data of type {!type:dotted_ident}. *) - -val dotted_ident_of_string : - string -> dotted_ident - (** Deserialize JSON data of type {!type:dotted_ident}. *) - -val write_label : - Buffer.t -> label -> unit - (** Output a JSON value of type {!type:label}. *) - -val string_of_label : - ?len:int -> label -> string - (** Serialize a value of type {!type:label} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_label : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> label - (** Input JSON data of type {!type:label}. *) - -val label_of_string : - string -> label - (** Deserialize JSON data of type {!type:label}. *) - -val write_literal : - Buffer.t -> literal -> unit - (** Output a JSON value of type {!type:literal}. *) - -val string_of_literal : - ?len:int -> literal -> string - (** Serialize a value of type {!type:literal} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_literal : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> literal - (** Input JSON data of type {!type:literal}. *) - -val literal_of_string : - string -> literal - (** Deserialize JSON data of type {!type:literal}. *) - -val write_module_name : - Buffer.t -> module_name -> unit - (** Output a JSON value of type {!type:module_name}. *) - -val string_of_module_name : - ?len:int -> module_name -> string - (** Serialize a value of type {!type:module_name} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_module_name : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> module_name - (** Input JSON data of type {!type:module_name}. *) - -val module_name_of_string : - string -> module_name - (** Deserialize JSON data of type {!type:module_name}. *) - -val write_resolved_name_kind : - Buffer.t -> resolved_name_kind -> unit - (** Output a JSON value of type {!type:resolved_name_kind}. *) - -val string_of_resolved_name_kind : - ?len:int -> resolved_name_kind -> string - (** Serialize a value of type {!type:resolved_name_kind} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_resolved_name_kind : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> resolved_name_kind - (** Input JSON data of type {!type:resolved_name_kind}. *) - -val resolved_name_kind_of_string : - string -> resolved_name_kind - (** Deserialize JSON data of type {!type:resolved_name_kind}. *) - -val write_resolved_name : - Buffer.t -> resolved_name -> unit - (** Output a JSON value of type {!type:resolved_name}. *) - -val string_of_resolved_name : - ?len:int -> resolved_name -> string - (** Serialize a value of type {!type:resolved_name} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_resolved_name : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> resolved_name - (** Input JSON data of type {!type:resolved_name}. *) - -val resolved_name_of_string : - string -> resolved_name - (** Deserialize JSON data of type {!type:resolved_name}. *) - -val write_todo_kind : - Buffer.t -> todo_kind -> unit - (** Output a JSON value of type {!type:todo_kind}. *) - -val string_of_todo_kind : - ?len:int -> todo_kind -> string - (** Serialize a value of type {!type:todo_kind} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_todo_kind : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> todo_kind - (** Input JSON data of type {!type:todo_kind}. *) - -val todo_kind_of_string : - string -> todo_kind - (** Deserialize JSON data of type {!type:todo_kind}. *) - -val write_xml_kind : - Buffer.t -> xml_kind -> unit - (** Output a JSON value of type {!type:xml_kind}. *) - -val string_of_xml_kind : - ?len:int -> xml_kind -> string - (** Serialize a value of type {!type:xml_kind} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_xml_kind : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> xml_kind - (** Input JSON data of type {!type:xml_kind}. *) - -val xml_kind_of_string : - string -> xml_kind - (** Deserialize JSON data of type {!type:xml_kind}. *) - -val write_alias : - Buffer.t -> alias -> unit - (** Output a JSON value of type {!type:alias}. *) - -val string_of_alias : - ?len:int -> alias -> string - (** Serialize a value of type {!type:alias} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_alias : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> alias - (** Input JSON data of type {!type:alias}. *) - -val alias_of_string : - string -> alias - (** Deserialize JSON data of type {!type:alias}. *) - -val write_any : - Buffer.t -> any -> unit - (** Output a JSON value of type {!type:any}. *) - -val string_of_any : - ?len:int -> any -> string - (** Serialize a value of type {!type:any} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_any : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> any - (** Input JSON data of type {!type:any}. *) - -val any_of_string : - string -> any - (** Deserialize JSON data of type {!type:any}. *) - -val write_argument : - Buffer.t -> argument -> unit - (** Output a JSON value of type {!type:argument}. *) - -val string_of_argument : - ?len:int -> argument -> string - (** Serialize a value of type {!type:argument} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_argument : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> argument - (** Input JSON data of type {!type:argument}. *) - -val argument_of_string : - string -> argument - (** Deserialize JSON data of type {!type:argument}. *) - -val write_arguments : - Buffer.t -> arguments -> unit - (** Output a JSON value of type {!type:arguments}. *) - -val string_of_arguments : - ?len:int -> arguments -> string - (** Serialize a value of type {!type:arguments} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_arguments : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> arguments - (** Input JSON data of type {!type:arguments}. *) - -val arguments_of_string : - string -> arguments - (** Deserialize JSON data of type {!type:arguments}. *) - -val write_attribute : - Buffer.t -> attribute -> unit - (** Output a JSON value of type {!type:attribute}. *) - -val string_of_attribute : - ?len:int -> attribute -> string - (** Serialize a value of type {!type:attribute} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_attribute : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> attribute - (** Input JSON data of type {!type:attribute}. *) - -val attribute_of_string : - string -> attribute - (** Deserialize JSON data of type {!type:attribute}. *) - -val write_case : - Buffer.t -> case -> unit - (** Output a JSON value of type {!type:case}. *) - -val string_of_case : - ?len:int -> case -> string - (** Serialize a value of type {!type:case} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_case : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> case - (** Input JSON data of type {!type:case}. *) - -val case_of_string : - string -> case - (** Deserialize JSON data of type {!type:case}. *) - -val write_case_and_body : - Buffer.t -> case_and_body -> unit - (** Output a JSON value of type {!type:case_and_body}. *) - -val string_of_case_and_body : - ?len:int -> case_and_body -> string - (** Serialize a value of type {!type:case_and_body} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_case_and_body : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> case_and_body - (** Input JSON data of type {!type:case_and_body}. *) - -val case_and_body_of_string : - string -> case_and_body - (** Deserialize JSON data of type {!type:case_and_body}. *) - -val write_catch : - Buffer.t -> catch -> unit - (** Output a JSON value of type {!type:catch}. *) - -val string_of_catch : - ?len:int -> catch -> string - (** Serialize a value of type {!type:catch} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_catch : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> catch - (** Input JSON data of type {!type:catch}. *) - -val catch_of_string : - string -> catch - (** Deserialize JSON data of type {!type:catch}. *) - -val write_catch_exn : - Buffer.t -> catch_exn -> unit - (** Output a JSON value of type {!type:catch_exn}. *) - -val string_of_catch_exn : - ?len:int -> catch_exn -> string - (** Serialize a value of type {!type:catch_exn} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_catch_exn : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> catch_exn - (** Input JSON data of type {!type:catch_exn}. *) - -val catch_exn_of_string : - string -> catch_exn - (** Deserialize JSON data of type {!type:catch_exn}. *) - -val write_class_definition : - Buffer.t -> class_definition -> unit - (** Output a JSON value of type {!type:class_definition}. *) - -val string_of_class_definition : - ?len:int -> class_definition -> string - (** Serialize a value of type {!type:class_definition} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_class_definition : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> class_definition - (** Input JSON data of type {!type:class_definition}. *) - -val class_definition_of_string : - string -> class_definition - (** Deserialize JSON data of type {!type:class_definition}. *) - -val write_class_parent : - Buffer.t -> class_parent -> unit - (** Output a JSON value of type {!type:class_parent}. *) - -val string_of_class_parent : - ?len:int -> class_parent -> string - (** Serialize a value of type {!type:class_parent} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_class_parent : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> class_parent - (** Input JSON data of type {!type:class_parent}. *) - -val class_parent_of_string : - string -> class_parent - (** Deserialize JSON data of type {!type:class_parent}. *) - -val write_comprehension : - Buffer.t -> comprehension -> unit - (** Output a JSON value of type {!type:comprehension}. *) - -val string_of_comprehension : - ?len:int -> comprehension -> string - (** Serialize a value of type {!type:comprehension} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_comprehension : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> comprehension - (** Input JSON data of type {!type:comprehension}. *) - -val comprehension_of_string : - string -> comprehension - (** Deserialize JSON data of type {!type:comprehension}. *) - -val write_condition : - Buffer.t -> condition -> unit - (** Output a JSON value of type {!type:condition}. *) - -val string_of_condition : - ?len:int -> condition -> string - (** Serialize a value of type {!type:condition} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_condition : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> condition - (** Input JSON data of type {!type:condition}. *) - -val condition_of_string : - string -> condition - (** Deserialize JSON data of type {!type:condition}. *) - -val write_definition : - Buffer.t -> definition -> unit - (** Output a JSON value of type {!type:definition}. *) - -val string_of_definition : - ?len:int -> definition -> string - (** Serialize a value of type {!type:definition} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_definition : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> definition - (** Input JSON data of type {!type:definition}. *) - -val definition_of_string : - string -> definition - (** Deserialize JSON data of type {!type:definition}. *) - -val write_definition_kind : - Buffer.t -> definition_kind -> unit - (** Output a JSON value of type {!type:definition_kind}. *) - -val string_of_definition_kind : - ?len:int -> definition_kind -> string - (** Serialize a value of type {!type:definition_kind} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_definition_kind : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> definition_kind - (** Input JSON data of type {!type:definition_kind}. *) - -val definition_kind_of_string : - string -> definition_kind - (** Deserialize JSON data of type {!type:definition_kind}. *) - -val write_directive : - Buffer.t -> directive -> unit - (** Output a JSON value of type {!type:directive}. *) - -val string_of_directive : - ?len:int -> directive -> string - (** Serialize a value of type {!type:directive} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_directive : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> directive - (** Input JSON data of type {!type:directive}. *) - -val directive_of_string : - string -> directive - (** Deserialize JSON data of type {!type:directive}. *) - -val write_entity : - Buffer.t -> entity -> unit - (** Output a JSON value of type {!type:entity}. *) - -val string_of_entity : - ?len:int -> entity -> string - (** Serialize a value of type {!type:entity} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_entity : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> entity - (** Input JSON data of type {!type:entity}. *) - -val entity_of_string : - string -> entity - (** Deserialize JSON data of type {!type:entity}. *) - -val write_entity_name : - Buffer.t -> entity_name -> unit - (** Output a JSON value of type {!type:entity_name}. *) - -val string_of_entity_name : - ?len:int -> entity_name -> string - (** Serialize a value of type {!type:entity_name} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_entity_name : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> entity_name - (** Input JSON data of type {!type:entity_name}. *) - -val entity_name_of_string : - string -> entity_name - (** Deserialize JSON data of type {!type:entity_name}. *) - -val write_enum_entry_definition : - Buffer.t -> enum_entry_definition -> unit - (** Output a JSON value of type {!type:enum_entry_definition}. *) - -val string_of_enum_entry_definition : - ?len:int -> enum_entry_definition -> string - (** Serialize a value of type {!type:enum_entry_definition} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_enum_entry_definition : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> enum_entry_definition - (** Input JSON data of type {!type:enum_entry_definition}. *) - -val enum_entry_definition_of_string : - string -> enum_entry_definition - (** Deserialize JSON data of type {!type:enum_entry_definition}. *) - -val write_expr : - Buffer.t -> expr -> unit - (** Output a JSON value of type {!type:expr}. *) - -val string_of_expr : - ?len:int -> expr -> string - (** Serialize a value of type {!type:expr} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_expr : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> expr - (** Input JSON data of type {!type:expr}. *) - -val expr_of_string : - string -> expr - (** Deserialize JSON data of type {!type:expr}. *) - -val write_field : - Buffer.t -> field -> unit - (** Output a JSON value of type {!type:field}. *) - -val string_of_field : - ?len:int -> field -> string - (** Serialize a value of type {!type:field} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_field : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> field - (** Input JSON data of type {!type:field}. *) - -val field_of_string : - string -> field - (** Deserialize JSON data of type {!type:field}. *) - -val write_field_name : - Buffer.t -> field_name -> unit - (** Output a JSON value of type {!type:field_name}. *) - -val string_of_field_name : - ?len:int -> field_name -> string - (** Serialize a value of type {!type:field_name} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_field_name : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> field_name - (** Input JSON data of type {!type:field_name}. *) - -val field_name_of_string : - string -> field_name - (** Deserialize JSON data of type {!type:field_name}. *) - -val write_finally : - Buffer.t -> finally -> unit - (** Output a JSON value of type {!type:finally}. *) - -val string_of_finally : - ?len:int -> finally -> string - (** Serialize a value of type {!type:finally} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_finally : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> finally - (** Input JSON data of type {!type:finally}. *) - -val finally_of_string : - string -> finally - (** Deserialize JSON data of type {!type:finally}. *) - -val write_for_each : - Buffer.t -> for_each -> unit - (** Output a JSON value of type {!type:for_each}. *) - -val string_of_for_each : - ?len:int -> for_each -> string - (** Serialize a value of type {!type:for_each} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_for_each : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> for_each - (** Input JSON data of type {!type:for_each}. *) - -val for_each_of_string : - string -> for_each - (** Deserialize JSON data of type {!type:for_each}. *) - -val write_for_header : - Buffer.t -> for_header -> unit - (** Output a JSON value of type {!type:for_header}. *) - -val string_of_for_header : - ?len:int -> for_header -> string - (** Serialize a value of type {!type:for_header} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_for_header : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> for_header - (** Input JSON data of type {!type:for_header}. *) - -val for_header_of_string : - string -> for_header - (** Deserialize JSON data of type {!type:for_header}. *) - -val write_for_or_if_comp : - Buffer.t -> for_or_if_comp -> unit - (** Output a JSON value of type {!type:for_or_if_comp}. *) - -val string_of_for_or_if_comp : - ?len:int -> for_or_if_comp -> string - (** Serialize a value of type {!type:for_or_if_comp} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_for_or_if_comp : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> for_or_if_comp - (** Input JSON data of type {!type:for_or_if_comp}. *) - -val for_or_if_comp_of_string : - string -> for_or_if_comp - (** Deserialize JSON data of type {!type:for_or_if_comp}. *) - -val write_for_var_or_expr : - Buffer.t -> for_var_or_expr -> unit - (** Output a JSON value of type {!type:for_var_or_expr}. *) - -val string_of_for_var_or_expr : - ?len:int -> for_var_or_expr -> string - (** Serialize a value of type {!type:for_var_or_expr} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_for_var_or_expr : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> for_var_or_expr - (** Input JSON data of type {!type:for_var_or_expr}. *) - -val for_var_or_expr_of_string : - string -> for_var_or_expr - (** Deserialize JSON data of type {!type:for_var_or_expr}. *) - -val write_function_body : - Buffer.t -> function_body -> unit - (** Output a JSON value of type {!type:function_body}. *) - -val string_of_function_body : - ?len:int -> function_body -> string - (** Serialize a value of type {!type:function_body} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_function_body : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> function_body - (** Input JSON data of type {!type:function_body}. *) - -val function_body_of_string : - string -> function_body - (** Deserialize JSON data of type {!type:function_body}. *) - -val write_function_definition : - Buffer.t -> function_definition -> unit - (** Output a JSON value of type {!type:function_definition}. *) - -val string_of_function_definition : - ?len:int -> function_definition -> string - (** Serialize a value of type {!type:function_definition} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_function_definition : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> function_definition - (** Input JSON data of type {!type:function_definition}. *) - -val function_definition_of_string : - string -> function_definition - (** Deserialize JSON data of type {!type:function_definition}. *) - -val write_id_info : - Buffer.t -> id_info -> unit - (** Output a JSON value of type {!type:id_info}. *) - -val string_of_id_info : - ?len:int -> id_info -> string - (** Serialize a value of type {!type:id_info} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_id_info : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> id_info - (** Input JSON data of type {!type:id_info}. *) - -val id_info_of_string : - string -> id_info - (** Deserialize JSON data of type {!type:id_info}. *) - -val write_import_from_kind : - Buffer.t -> import_from_kind -> unit - (** Output a JSON value of type {!type:import_from_kind}. *) - -val string_of_import_from_kind : - ?len:int -> import_from_kind -> string - (** Serialize a value of type {!type:import_from_kind} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_import_from_kind : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> import_from_kind - (** Input JSON data of type {!type:import_from_kind}. *) - -val import_from_kind_of_string : - string -> import_from_kind - (** Deserialize JSON data of type {!type:import_from_kind}. *) - -val write_item : - Buffer.t -> item -> unit - (** Output a JSON value of type {!type:item}. *) - -val string_of_item : - ?len:int -> item -> string - (** Serialize a value of type {!type:item} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_item : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> item - (** Input JSON data of type {!type:item}. *) - -val item_of_string : - string -> item - (** Deserialize JSON data of type {!type:item}. *) - -val write_label_ident : - Buffer.t -> label_ident -> unit - (** Output a JSON value of type {!type:label_ident}. *) - -val string_of_label_ident : - ?len:int -> label_ident -> string - (** Serialize a value of type {!type:label_ident} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_label_ident : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> label_ident - (** Input JSON data of type {!type:label_ident}. *) - -val label_ident_of_string : - string -> label_ident - (** Deserialize JSON data of type {!type:label_ident}. *) - -val write_macro_definition : - Buffer.t -> macro_definition -> unit - (** Output a JSON value of type {!type:macro_definition}. *) - -val string_of_macro_definition : - ?len:int -> macro_definition -> string - (** Serialize a value of type {!type:macro_definition} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_macro_definition : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> macro_definition - (** Input JSON data of type {!type:macro_definition}. *) - -val macro_definition_of_string : - string -> macro_definition - (** Deserialize JSON data of type {!type:macro_definition}. *) - -val write_module_definition : - Buffer.t -> module_definition -> unit - (** Output a JSON value of type {!type:module_definition}. *) - -val string_of_module_definition : - ?len:int -> module_definition -> string - (** Serialize a value of type {!type:module_definition} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_module_definition : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> module_definition - (** Input JSON data of type {!type:module_definition}. *) - -val module_definition_of_string : - string -> module_definition - (** Deserialize JSON data of type {!type:module_definition}. *) - -val write_module_definition_kind : - Buffer.t -> module_definition_kind -> unit - (** Output a JSON value of type {!type:module_definition_kind}. *) - -val string_of_module_definition_kind : - ?len:int -> module_definition_kind -> string - (** Serialize a value of type {!type:module_definition_kind} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_module_definition_kind : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> module_definition_kind - (** Input JSON data of type {!type:module_definition_kind}. *) - -val module_definition_kind_of_string : - string -> module_definition_kind - (** Deserialize JSON data of type {!type:module_definition_kind}. *) - -val write_multi_for_each : - Buffer.t -> multi_for_each -> unit - (** Output a JSON value of type {!type:multi_for_each}. *) - -val string_of_multi_for_each : - ?len:int -> multi_for_each -> string - (** Serialize a value of type {!type:multi_for_each} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_multi_for_each : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> multi_for_each - (** Input JSON data of type {!type:multi_for_each}. *) - -val multi_for_each_of_string : - string -> multi_for_each - (** Deserialize JSON data of type {!type:multi_for_each}. *) - -val write_name : - Buffer.t -> name -> unit - (** Output a JSON value of type {!type:name}. *) - -val string_of_name : - ?len:int -> name -> string - (** Serialize a value of type {!type:name} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_name : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> name - (** Input JSON data of type {!type:name}. *) - -val name_of_string : - string -> name - (** Deserialize JSON data of type {!type:name}. *) - -val write_or_type_element : - Buffer.t -> or_type_element -> unit - (** Output a JSON value of type {!type:or_type_element}. *) - -val string_of_or_type_element : - ?len:int -> or_type_element -> string - (** Serialize a value of type {!type:or_type_element} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_or_type_element : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> or_type_element - (** Input JSON data of type {!type:or_type_element}. *) - -val or_type_element_of_string : - string -> or_type_element - (** Deserialize JSON data of type {!type:or_type_element}. *) - -val write_parameter : - Buffer.t -> parameter -> unit - (** Output a JSON value of type {!type:parameter}. *) - -val string_of_parameter : - ?len:int -> parameter -> string - (** Serialize a value of type {!type:parameter} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_parameter : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> parameter - (** Input JSON data of type {!type:parameter}. *) - -val parameter_of_string : - string -> parameter - (** Deserialize JSON data of type {!type:parameter}. *) - -val write_parameter_classic : - Buffer.t -> parameter_classic -> unit - (** Output a JSON value of type {!type:parameter_classic}. *) - -val string_of_parameter_classic : - ?len:int -> parameter_classic -> string - (** Serialize a value of type {!type:parameter_classic} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_parameter_classic : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> parameter_classic - (** Input JSON data of type {!type:parameter_classic}. *) - -val parameter_classic_of_string : - string -> parameter_classic - (** Deserialize JSON data of type {!type:parameter_classic}. *) - -val write_parameters : - Buffer.t -> parameters -> unit - (** Output a JSON value of type {!type:parameters}. *) - -val string_of_parameters : - ?len:int -> parameters -> string - (** Serialize a value of type {!type:parameters} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_parameters : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> parameters - (** Input JSON data of type {!type:parameters}. *) - -val parameters_of_string : - string -> parameters - (** Deserialize JSON data of type {!type:parameters}. *) - -val write_pattern : - Buffer.t -> pattern -> unit - (** Output a JSON value of type {!type:pattern}. *) - -val string_of_pattern : - ?len:int -> pattern -> string - (** Serialize a value of type {!type:pattern} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_pattern : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> pattern - (** Input JSON data of type {!type:pattern}. *) - -val pattern_of_string : - string -> pattern - (** Deserialize JSON data of type {!type:pattern}. *) - -val write_qualified_info : - Buffer.t -> qualified_info -> unit - (** Output a JSON value of type {!type:qualified_info}. *) - -val string_of_qualified_info : - ?len:int -> qualified_info -> string - (** Serialize a value of type {!type:qualified_info} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_qualified_info : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> qualified_info - (** Input JSON data of type {!type:qualified_info}. *) - -val qualified_info_of_string : - string -> qualified_info - (** Deserialize JSON data of type {!type:qualified_info}. *) - -val write_qualifier : - Buffer.t -> qualifier -> unit - (** Output a JSON value of type {!type:qualifier}. *) - -val string_of_qualifier : - ?len:int -> qualifier -> string - (** Serialize a value of type {!type:qualifier} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_qualifier : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> qualifier - (** Input JSON data of type {!type:qualifier}. *) - -val qualifier_of_string : - string -> qualifier - (** Deserialize JSON data of type {!type:qualifier}. *) - -val write_stmt : - Buffer.t -> stmt -> unit - (** Output a JSON value of type {!type:stmt}. *) - -val string_of_stmt : - ?len:int -> stmt -> string - (** Serialize a value of type {!type:stmt} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_stmt : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> stmt - (** Input JSON data of type {!type:stmt}. *) - -val stmt_of_string : - string -> stmt - (** Deserialize JSON data of type {!type:stmt}. *) - -val write_svalue : - Buffer.t -> svalue -> unit - (** Output a JSON value of type {!type:svalue}. *) - -val string_of_svalue : - ?len:int -> svalue -> string - (** Serialize a value of type {!type:svalue} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_svalue : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> svalue - (** Input JSON data of type {!type:svalue}. *) - -val svalue_of_string : - string -> svalue - (** Deserialize JSON data of type {!type:svalue}. *) - -val write_type_ : - Buffer.t -> type_ -> unit - (** Output a JSON value of type {!type:type_}. *) - -val string_of_type_ : - ?len:int -> type_ -> string - (** Serialize a value of type {!type:type_} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_type_ : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> type_ - (** Input JSON data of type {!type:type_}. *) - -val type__of_string : - string -> type_ - (** Deserialize JSON data of type {!type:type_}. *) - -val write_type_argument : - Buffer.t -> type_argument -> unit - (** Output a JSON value of type {!type:type_argument}. *) - -val string_of_type_argument : - ?len:int -> type_argument -> string - (** Serialize a value of type {!type:type_argument} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_type_argument : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> type_argument - (** Input JSON data of type {!type:type_argument}. *) - -val type_argument_of_string : - string -> type_argument - (** Deserialize JSON data of type {!type:type_argument}. *) - -val write_type_arguments : - Buffer.t -> type_arguments -> unit - (** Output a JSON value of type {!type:type_arguments}. *) - -val string_of_type_arguments : - ?len:int -> type_arguments -> string - (** Serialize a value of type {!type:type_arguments} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_type_arguments : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> type_arguments - (** Input JSON data of type {!type:type_arguments}. *) - -val type_arguments_of_string : - string -> type_arguments - (** Deserialize JSON data of type {!type:type_arguments}. *) - -val write_type_definition : - Buffer.t -> type_definition -> unit - (** Output a JSON value of type {!type:type_definition}. *) - -val string_of_type_definition : - ?len:int -> type_definition -> string - (** Serialize a value of type {!type:type_definition} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_type_definition : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> type_definition - (** Input JSON data of type {!type:type_definition}. *) - -val type_definition_of_string : - string -> type_definition - (** Deserialize JSON data of type {!type:type_definition}. *) - -val write_type_definition_kind : - Buffer.t -> type_definition_kind -> unit - (** Output a JSON value of type {!type:type_definition_kind}. *) - -val string_of_type_definition_kind : - ?len:int -> type_definition_kind -> string - (** Serialize a value of type {!type:type_definition_kind} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_type_definition_kind : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> type_definition_kind - (** Input JSON data of type {!type:type_definition_kind}. *) - -val type_definition_kind_of_string : - string -> type_definition_kind - (** Deserialize JSON data of type {!type:type_definition_kind}. *) - -val write_type_parameter : - Buffer.t -> type_parameter -> unit - (** Output a JSON value of type {!type:type_parameter}. *) - -val string_of_type_parameter : - ?len:int -> type_parameter -> string - (** Serialize a value of type {!type:type_parameter} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_type_parameter : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> type_parameter - (** Input JSON data of type {!type:type_parameter}. *) - -val type_parameter_of_string : - string -> type_parameter - (** Deserialize JSON data of type {!type:type_parameter}. *) - -val write_type_parameter_classic : - Buffer.t -> type_parameter_classic -> unit - (** Output a JSON value of type {!type:type_parameter_classic}. *) - -val string_of_type_parameter_classic : - ?len:int -> type_parameter_classic -> string - (** Serialize a value of type {!type:type_parameter_classic} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_type_parameter_classic : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> type_parameter_classic - (** Input JSON data of type {!type:type_parameter_classic}. *) - -val type_parameter_classic_of_string : - string -> type_parameter_classic - (** Deserialize JSON data of type {!type:type_parameter_classic}. *) - -val write_type_parameters : - Buffer.t -> type_parameters -> unit - (** Output a JSON value of type {!type:type_parameters}. *) - -val string_of_type_parameters : - ?len:int -> type_parameters -> string - (** Serialize a value of type {!type:type_parameters} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_type_parameters : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> type_parameters - (** Input JSON data of type {!type:type_parameters}. *) - -val type_parameters_of_string : - string -> type_parameters - (** Deserialize JSON data of type {!type:type_parameters}. *) - -val write_variable_definition : - Buffer.t -> variable_definition -> unit - (** Output a JSON value of type {!type:variable_definition}. *) - -val string_of_variable_definition : - ?len:int -> variable_definition -> string - (** Serialize a value of type {!type:variable_definition} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_variable_definition : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> variable_definition - (** Input JSON data of type {!type:variable_definition}. *) - -val variable_definition_of_string : - string -> variable_definition - (** Deserialize JSON data of type {!type:variable_definition}. *) - -val write_xml : - Buffer.t -> xml -> unit - (** Output a JSON value of type {!type:xml}. *) - -val string_of_xml : - ?len:int -> xml -> string - (** Serialize a value of type {!type:xml} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_xml : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> xml - (** Input JSON data of type {!type:xml}. *) - -val xml_of_string : - string -> xml - (** Deserialize JSON data of type {!type:xml}. *) - -val write_xml_attr_value : - Buffer.t -> xml_attr_value -> unit - (** Output a JSON value of type {!type:xml_attr_value}. *) - -val string_of_xml_attr_value : - ?len:int -> xml_attr_value -> string - (** Serialize a value of type {!type:xml_attr_value} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_xml_attr_value : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> xml_attr_value - (** Input JSON data of type {!type:xml_attr_value}. *) - -val xml_attr_value_of_string : - string -> xml_attr_value - (** Deserialize JSON data of type {!type:xml_attr_value}. *) - -val write_xml_attribute : - Buffer.t -> xml_attribute -> unit - (** Output a JSON value of type {!type:xml_attribute}. *) - -val string_of_xml_attribute : - ?len:int -> xml_attribute -> string - (** Serialize a value of type {!type:xml_attribute} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_xml_attribute : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> xml_attribute - (** Input JSON data of type {!type:xml_attribute}. *) - -val xml_attribute_of_string : - string -> xml_attribute - (** Deserialize JSON data of type {!type:xml_attribute}. *) - -val write_xml_body : - Buffer.t -> xml_body -> unit - (** Output a JSON value of type {!type:xml_body}. *) - -val string_of_xml_body : - ?len:int -> xml_body -> string - (** Serialize a value of type {!type:xml_body} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_xml_body : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> xml_body - (** Input JSON data of type {!type:xml_body}. *) - -val xml_body_of_string : - string -> xml_body - (** Deserialize JSON data of type {!type:xml_body}. *) - -val write_program : - Buffer.t -> program -> unit - (** Output a JSON value of type {!type:program}. *) - -val string_of_program : - ?len:int -> program -> string - (** Serialize a value of type {!type:program} - into a JSON string. - @param len specifies the initial length - of the buffer used internally. - Default: 1024. *) - -val read_program : - Yojson.Safe.lexer_state -> Lexing.lexbuf -> program - (** Input JSON data of type {!type:program}. *) - -val program_of_string : - string -> program - (** Deserialize JSON data of type {!type:program}. *) - diff --git a/tests/Makefile b/tests/Makefile index e031ad8..96b6fbc 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,9 +1,8 @@ # Run all the tests present in this folder .PHONY: test test: - ./test-ast $(MAKE) -C jsonschema test .PHONY: clean clean: - rm -f data/*.ast.json + nothing to clean for now diff --git a/tests/ast_generic_v1.py b/tests/ast_generic_v1.py deleted file mode 120000 index decc7a8..0000000 --- a/tests/ast_generic_v1.py +++ /dev/null @@ -1 +0,0 @@ -../ast_generic_v1.py \ No newline at end of file diff --git a/tests/data/MainActivity.java b/tests/data/MainActivity.java deleted file mode 100644 index f54d8c1..0000000 --- a/tests/data/MainActivity.java +++ /dev/null @@ -1,230 +0,0 @@ -package me.grishka.houseclub; - -import android.Manifest; -import android.app.Activity; -import android.app.AlertDialog; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.pm.PackageManager; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; -import android.widget.Toast; - -import java.util.Date; -import java.util.List; - -import androidx.annotation.NonNull; -import me.grishka.appkit.FragmentStackActivity; -import me.grishka.appkit.api.Callback; -import me.grishka.appkit.api.ErrorResponse; -import me.grishka.appkit.api.SimpleCallback; -import me.grishka.houseclub.api.BaseResponse; -import me.grishka.houseclub.api.ClubhouseSession; -import me.grishka.houseclub.api.methods.CheckWaitlistStatus; -import me.grishka.houseclub.api.methods.GetChannel; -import me.grishka.houseclub.api.methods.GetEvent; -import me.grishka.houseclub.api.methods.JoinChannel; -import me.grishka.houseclub.api.model.Channel; -import me.grishka.houseclub.fragments.HomeFragment; -import me.grishka.houseclub.fragments.InChannelFragment; -import me.grishka.houseclub.fragments.LoginFragment; -import me.grishka.houseclub.fragments.RegisterFragment; -import me.grishka.houseclub.fragments.WaitlistedFragment; - -public class MainActivity extends FragmentStackActivity{ - - private Channel channelToJoin; - private static final int PERMISSION_RESULT=270; - - @Override - protected void onCreate(Bundle savedInstanceState){ - super.onCreate(savedInstanceState); - - SharedPreferences prefs=getPreferences(MODE_PRIVATE); - if(!prefs.getBoolean("warningShown", false)){ - new AlertDialog.Builder(this) - .setTitle(R.string.warning) - .setMessage(R.string.warning_text) - .setPositiveButton(R.string.i_understand, null) - .setCancelable(false) - .show(); - prefs.edit().putBoolean("warningShown", true).apply(); - } - - if(ClubhouseSession.isLoggedIn()){ - showFragment(ClubhouseSession.isWaitlisted ? new WaitlistedFragment() : new HomeFragment()); - if(ClubhouseSession.isWaitlisted){ - new CheckWaitlistStatus() - .setCallback(new Callback(){ - @Override - public void onSuccess(CheckWaitlistStatus.Response result){ - if(!result.isWaitlisted){ - ClubhouseSession.isWaitlisted=false; - ClubhouseSession.write(); - if(result.isOnboarding){ -// showFragmentClearingBackStack(new RegisterFragment()); - new AlertDialog.Builder(MainActivity.this) - .setMessage(R.string.log_in_to_activate) - .setPositiveButton(R.string.ok, null) - .show(); - ClubhouseSession.userID=ClubhouseSession.userToken=null; - ClubhouseSession.write(); - showFragmentClearingBackStack(new LoginFragment()); - }else{ - showFragmentClearingBackStack(new HomeFragment()); - } -// if(Intent.ACTION_VIEW.equals(getIntent().getAction())){ -// joinChannelFromIntent(); -// } - } - } - - @Override - public void onError(ErrorResponse error){ - - } - }) - .exec(); - }else{ - if(Intent.ACTION_VIEW.equals(getIntent().getAction())){ - joinChannelFromIntent(); - } - } - }else{ - showFragment(new LoginFragment()); - } - } - - @Override - protected void onNewIntent(Intent intent){ - super.onNewIntent(intent); - setIntent(intent); - if(Intent.ACTION_VIEW.equals(intent.getAction())){ - joinChannelFromIntent(); - }else if(intent.hasExtra("openCurrentChannel")){ - if(VoiceService.getInstance()!=null){ - Bundle extras=new Bundle(); - extras.putBoolean("_can_go_back", true); - InChannelFragment fragment=new InChannelFragment(); - fragment.setArguments(extras); - showFragment(fragment); - } - } - } - - private void joinChannelFromIntent(){ - Uri data=getIntent().getData(); - List path=data.getPathSegments(); - String id=path.get(path.size()-1); - if(path.get(0).equals("room")){ - joinChannelById(id); - }else if(path.get(0).equals("event")){ - new GetEvent(id) - .wrapProgress(this) - .setCallback(new Callback(){ - @Override - public void onSuccess(GetEvent.Response result){ - if(result.event.channel!=null){ - joinChannelById(result.event.channel); - }else{ - if(result.event.isExpired) - Toast.makeText(MainActivity.this, R.string.event_expired, Toast.LENGTH_SHORT).show(); - else if(result.event.timeStart.after(new Date())) - Toast.makeText(MainActivity.this, R.string.event_not_started, Toast.LENGTH_SHORT).show(); - } - } - - @Override - public void onError(ErrorResponse error){ - error.showToast(MainActivity.this); - } - }) - .exec(); - } - } - - private void joinChannelById(String id){ - new GetChannel(id) - .wrapProgress(this) - .setCallback(new Callback(){ - @Override - public void onSuccess(final Channel result){ - new AlertDialog.Builder(MainActivity.this) - .setTitle(R.string.join_this_room) - .setMessage(result.topic) - .setPositiveButton(R.string.join, new DialogInterface.OnClickListener(){ - @Override - public void onClick(DialogInterface dialogInterface, int i){ - joinChannel(result); - } - }) - .setNegativeButton(R.string.cancel, null) - .show(); - } - - @Override - public void onError(ErrorResponse error){ - error.showToast(MainActivity.this); - } - }) - .exec(); - } - - public void joinChannel(Channel chan){ - if(VoiceService.getInstance()!=null){ - Channel current=VoiceService.getInstance().getChannel(); - if(current.channel.equals(chan.channel)){ - Bundle extras=new Bundle(); - extras.putBoolean("_can_go_back", true); - InChannelFragment fragment=new InChannelFragment(); - fragment.setArguments(extras); - showFragment(fragment); - return; - } - VoiceService.getInstance().leaveChannel(); - } - if(checkSelfPermission(Manifest.permission.RECORD_AUDIO)==PackageManager.PERMISSION_GRANTED){ - new JoinChannel(chan.channel) - .wrapProgress(this) - .setCallback(new Callback(){ - @Override - public void onSuccess(Channel result){ - Intent intent=new Intent(MainActivity.this, VoiceService.class); - intent.putExtra("channel", result.channel); - DataProvider.saveChannel(result); - if(Build.VERSION.SDK_INT>=26) - startForegroundService(intent); - else - startService(intent); - - Bundle extras=new Bundle(); - extras.putBoolean("_can_go_back", true); - InChannelFragment fragment=new InChannelFragment(); - fragment.setArguments(extras); - showFragment(fragment); - } - - @Override - public void onError(ErrorResponse error){ - error.showToast(MainActivity.this); - } - }) - .exec(); - }else{ - channelToJoin=chan; - requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, PERMISSION_RESULT); - } - } - - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults){ - if(requestCode==PERMISSION_RESULT && grantResults[0]==PackageManager.PERMISSION_GRANTED){ - if(channelToJoin!=null){ - joinChannel(channelToJoin); - } - } - channelToJoin=null; - } -} diff --git a/tests/data/hello.java b/tests/data/hello.java deleted file mode 100644 index 5022342..0000000 --- a/tests/data/hello.java +++ /dev/null @@ -1,7 +0,0 @@ -import com.example; - -class HelloWorld { - public static void main(String []argv) { - System.out.println("Hello"); - } -} diff --git a/tests/read-ast.py b/tests/read-ast.py deleted file mode 100644 index 7f8b405..0000000 --- a/tests/read-ast.py +++ /dev/null @@ -1,6 +0,0 @@ -from ast_generic_v1 import Program -import json -import sys - -model = json.load(sys.stdin) -program = Program.from_json(model) diff --git a/tests/test-ast b/tests/test-ast deleted file mode 100755 index 6004e64..0000000 --- a/tests/test-ast +++ /dev/null @@ -1,22 +0,0 @@ -#! /usr/bin/env bash -# -# Run minimal tests to ensure that the JSON AST of semgrep-core can be read -# back correctly by a Python program. -# -# Use the SEMGREP_CORE environment variable to set the path to semgrep-core -# if necessary. -# -set -eu - -semgrep_core="semgrep-core" - -if [[ -n "${SEMGREP_CORE+z}" ]]; then - semgrep_core="$SEMGREP_CORE" -fi - -echo "semgrep-core is: $(which semgrep-core)" -for javafile in data/*.java; do - echo "### Dump JSON AST, read it from Python program: $javafile" - "$semgrep_core" -lang java -generate_ast_json "$javafile" - python3 read-ast.py < "$javafile".ast.json -done