package ast_generic

  1. Overview
  2. Docs
type class_kind = [
  1. | `Class
  2. | `Interface
  3. | `Trait
  4. | `Object
]
type concat_string_kind = [
  1. | `InterpolatedConcat
  2. | `SequenceConcat
  3. | `FString of string
  4. | `TaggedTemplateLiteral
]
type const_type = [
  1. | `Cbool
  2. | `Cint
  3. | `Cstr
  4. | `Cany
]
type container_operator = [
  1. | `Array
  2. | `List
  3. | `Set
  4. | `Dict
  5. | `Tuple
]
type function_kind = [
  1. | `Function
  2. | `Method
  3. | `LambdaKind
  4. | `Arrow
  5. | `BlockCases
]
type incr_decr = [
  1. | `Incr
  2. | `Decr
]
type keyword_attribute = [
  1. | `Static
  2. | `Volatile
  3. | `Extern
  4. | `Public
  5. | `Private
  6. | `Protected
  7. | `Abstract
  8. | `Final
  9. | `Override
  10. | `RecordClass
  11. | `AnnotationClass
  12. | `EnumClass
  13. | `SealedClass
  14. | `Var
  15. | `Let
  16. | `Mutable
  17. | `Const
  18. | `Optional
  19. | `NotNull
  20. | `Recursive
  21. | `MutuallyRecursive
  22. | `Generator
  23. | `Async
  24. | `Inline
  25. | `Ctor
  26. | `Dtor
  27. | `Getter
  28. | `Setter
  29. | `Unsafe
  30. | `DefaultImpl
  31. | `Lazy
  32. | `Throws
  33. | `Rethrows
  34. | `OtherKeyword of string
]
type operator = [
  1. | `Plus
  2. | `Minus
  3. | `Mult
  4. | `Div
  5. | `Mod
  6. | `Pow
  7. | `FloorDiv
  8. | `MatMult
  9. | `LSL
  10. | `LSR
  11. | `ASR
  12. | `BitOr
  13. | `BitXor
  14. | `BitAnd
  15. | `BitNot
  16. | `BitClear
  17. | `And
  18. | `Or
  19. | `Xor
  20. | `Not
  21. | `Eq
  22. | `NotEq
  23. | `PhysEq
  24. | `NotPhysEq
  25. | `Lt
  26. | `LtE
  27. | `Gt
  28. | `GtE
  29. | `Cmp
  30. | `Concat
  31. | `Append
  32. | `RegexpMatch
  33. | `NotMatch
  34. | `Range
  35. | `RangeInclusive
  36. | `NotNullPostfix
  37. | `Length
  38. | `Elvis
  39. | `Nullish
  40. | `In
  41. | `NotIn
  42. | `Is
  43. | `NotIs
  44. | `Background
  45. | `Pipe
]
type prefix_postfix = [
  1. | `Prefix
  2. | `Postfix
]
type sid = int
type special = [
  1. | `This
  2. | `Super
  3. | `Self
  4. | `Parent
  5. | `Eval
  6. | `Typeof
  7. | `Instanceof
  8. | `Sizeof
  9. | `Defined
  10. | `ConcatString of concat_string_kind
  11. | `EncodedString of string
  12. | `InterpolatedElement
  13. | `Spread
  14. | `HashSplat
  15. | `ForOf
  16. | `Op of operator
  17. | `IncrDecr of incr_decr * prefix_postfix
  18. | `Require
  19. | `OtherSpecial of string
]
type token_location = {
  1. str : string;
  2. charpos : int;
  3. line : int;
  4. column : int;
  5. filename : string;
}
type token = [
  1. | `OriginTok of token_location
  2. | `FakeTok of string
]
type tok = token
type 'a bracket = tok * 'a * tok
type sc = tok
type variance = [
  1. | `Covariant
  2. | `Contravariant
]
type 'a wrap_ = 'a * tok
type ident = string wrap_
type dotted_ident = ident list
type label = ident
type literal = [
  1. | `Bool of bool wrap_
  2. | `Int of int option wrap_
  3. | `Float of float option wrap_
  4. | `Char of string wrap_
  5. | `String of string wrap_
  6. | `Regexp of string wrap_ bracket * string wrap_ option
  7. | `Atom of tok * string wrap_
  8. | `Unit of tok
  9. | `Null of tok
  10. | `Undefined of tok
  11. | `Imag of string wrap_
  12. | `Ratio of string wrap_
]
type module_name = [
  1. | `DottedName of dotted_ident
  2. | `FileName of string wrap_
]
type resolved_name_kind = [
  1. | `Global
  2. | `Local
  3. | `Param
  4. | `ImportedEntity of dotted_ident
  5. | `ImportedModule of module_name
  6. | `OtherResolvedNameKind of string
]
type resolved_name = resolved_name_kind * sid
type todo_kind = string wrap_
type xml_kind = [
  1. | `XmlClassic of tok * ident * tok * tok
  2. | `XmlSingleton of tok * ident * tok
  3. | `XmlFragment of tok * tok
]
type alias = ident * id_info
and any = [
  1. | `E of expr
  2. | `S of stmt
  3. | `T of type_
  4. | `P of pattern
  5. | `At of attribute
  6. | `Fld of field
  7. | `Ar of argument
  8. | `Pa of parameter
  9. | `Ta of type_argument
  10. | `Tp of type_parameter
  11. | `Ce of catch_exn
  12. | `Cs of case
  13. | `ForOrIfComp of for_or_if_comp
  14. | `En of entity
  15. | `I of ident
  16. | `Modn of module_name
  17. | `Di of dotted_ident
  18. | `Lbli of label_ident
  19. | `Str of string wrap_
  20. | `Tk of tok
  21. | `TodoK of todo_kind
  22. | `Anys of any list
]
and argument = [
  1. | `Arg of expr
  2. | `ArgKwd of ident * expr
  3. | `ArgKwdOptional of ident * expr
  4. | `ArgType of type_
  5. | `OtherArg of todo_kind * any list
]
and arguments = argument list bracket
and attribute = [
  1. | `KeywordAttr of keyword_attribute wrap_
  2. | `NamedAttr of tok * name * arguments
  3. | `OtherAttribute of todo_kind * any list
]
and case = [
  1. | `Case of tok * pattern
  2. | `Default of tok
  3. | `CaseEqualExpr of tok * expr
  4. | `OtherCase of todo_kind * any list
]
and case_and_body = [
  1. | `CasesAndBody of case list * stmt
]
and catch = tok * catch_exn * stmt
and catch_exn = [
  1. | `CatchPattern of pattern
  2. | `CatchParam of parameter_classic
  3. | `OtherCatch of todo_kind * any list
]
and class_definition = {
  1. ckind : class_kind wrap_;
  2. cextends : class_parent list;
  3. cimplements : type_ list;
  4. cmixins : type_ list;
  5. cparams : parameters;
  6. cbody : field list bracket;
}
and class_parent = type_ * arguments option
and comprehension = expr * for_or_if_comp list
and condition = [
  1. | `Cond of expr
  2. | `OtherCond of todo_kind * any list
]
and definition = entity * definition_kind
and definition_kind = [
  1. | `FuncDef of function_definition
  2. | `VarDef of variable_definition
  3. | `ClassDef of class_definition
  4. | `EnumEntryDef of enum_entry_definition
  5. | `TypeDef of type_definition
  6. | `ModuleDef of module_definition
  7. | `MacroDef of macro_definition
  8. | `Signature of type_
  9. | `UseOuterDecl of tok
  10. | `OtherDef of todo_kind * any list
]
and directive = [
  1. | `ImportFrom of tok * module_name * (ident * alias option) list
  2. | `ImportAs of tok * module_name * alias option
  3. | `ImportAll of tok * module_name * tok
  4. | `Package of tok * dotted_ident
  5. | `PackageEnd of tok
  6. | `Pragma of ident * any list
  7. | `OtherDirective of todo_kind * any list
]
and entity = {
  1. name : entity_name;
  2. attrs : attribute list;
  3. tparams : type_parameters;
}
and entity_name = [
  1. | `EN of name
  2. | `EDynamic of expr
  3. | `EPattern of pattern
  4. | `OtherEntity of todo_kind * any list
]
and enum_entry_definition = {
  1. ee_args : arguments option;
  2. ee_body : field list bracket option;
}
and expr = [
  1. | `L of literal
  2. | `Container of container_operator * expr list bracket
  3. | `Comprehension of container_operator * comprehension bracket
  4. | `Record of field list bracket
  5. | `Constructor of name * expr list bracket
  6. | `N of name
  7. | `IdSpecial of special wrap_
  8. | `Call of expr * arguments
  9. | `New of tok * type_ * arguments
  10. | `Xml of xml
  11. | `Assign of expr * tok * expr
  12. | `AssignOp of expr * operator wrap_ * expr
  13. | `LetPattern of pattern * expr
  14. | `DotAccess of expr * tok * field_name
  15. | `ArrayAccess of expr * expr bracket
  16. | `SliceAccess of expr * (expr option * expr option * expr option) bracket
  17. | `Lambda of function_definition
  18. | `AnonClass of class_definition
  19. | `Conditional of expr * expr * expr
  20. | `Yield of tok * expr option * bool
  21. | `Await of tok * expr
  22. | `Cast of type_ * expr
  23. | `Seq of expr list
  24. | `Ref of tok * expr
  25. | `DeRef of tok * expr
  26. | `Ellipsis of tok
  27. | `ParenExpr of expr bracket
  28. | `StmtExpr of stmt
  29. | `OtherExpr of todo_kind * any list
]
and field = [
  1. | `F of stmt
]
and field_name = [
  1. | `FN of name
  2. | `FDynamic of expr
]
and finally = tok * stmt
and for_each = pattern * tok * expr
and for_header = [
  1. | `ForClassic of for_var_or_expr list * expr option * expr option
  2. | `ForEach of for_each
  3. | `MultiForEach of multi_for_each list
  4. | `ForIn of for_var_or_expr list * expr list
]
and for_or_if_comp = [
  1. | `CompFor of tok * pattern * tok * expr
  2. | `CompIf of tok * expr
]
and for_var_or_expr = [
  1. | `ForInitVar of entity * variable_definition
  2. | `ForInitExpr of expr
]
and function_body = [
  1. | `FBStmt of stmt
  2. | `FBExpr of expr
  3. | `FBDecl of sc
  4. | `FBNothing
]
and function_definition = {
  1. fkind : function_kind wrap_;
  2. fparams : parameters;
  3. frettype : type_ option;
  4. fbody : function_body;
}
and id_info = {
  1. id_resolved : resolved_name option;
  2. id_type : type_ option;
  3. id_svalue : svalue option;
}
and item = stmt
and label_ident = [
  1. | `LNone
  2. | `LId of label
  3. | `LInt of int wrap_
  4. | `LDynamic of expr
]
and macro_definition = {
  1. macroparams : ident list;
  2. macrobody : any list;
}
and module_definition = {
  1. mbody : module_definition_kind;
}
and module_definition_kind = [
  1. | `ModuleAlias of dotted_ident
  2. | `ModuleStruct of dotted_ident option * item list
  3. | `OtherModule of todo_kind * any list
]
and multi_for_each = [
  1. | `FE of for_each
  2. | `FECond of for_each * tok * expr
]
and name = [
  1. | `Id of ident * id_info
  2. | `IdQualified of qualified_info
]
and or_type_element = [
  1. | `OrConstructor of ident * type_ list
  2. | `OrEnum of ident * expr option
  3. | `OrUnion of ident * type_
  4. | `OtherOr of todo_kind * any list
]
and parameter = [
  1. | `ParamClassic of parameter_classic
  2. | `ParamPattern of pattern
  3. | `ParamRest of tok * parameter_classic
  4. | `ParamHashSplat of tok * parameter_classic
  5. | `OtherParam of todo_kind * any list
]
and parameter_classic = {
  1. pname : ident option;
  2. ptype : type_ option;
  3. pdefault : expr option;
  4. pattrs : attribute list;
  5. pinfo : id_info;
}
and parameters = parameter list
and pattern = [
  1. | `PatLiteral of literal
  2. | `PatConstructor of name * pattern list
  3. | `PatRecord of (dotted_ident * pattern) list bracket
  4. | `PatId of ident * id_info
  5. | `PatTuple of pattern list bracket
  6. | `PatList of pattern list bracket
  7. | `PatKeyVal of pattern * pattern
  8. | `PatUnderscore of tok
  9. | `PatDisj of pattern * pattern
  10. | `PatTyped of pattern * type_
  11. | `PatWhen of pattern * expr
  12. | `PatAs of pattern * (ident * id_info)
  13. | `PatType of type_
  14. | `OtherPat of todo_kind * any list
]
and qualified_info = {
  1. name_last : ident * type_arguments option;
  2. name_middle : qualifier option;
  3. name_top : tok option;
  4. name_info : id_info;
}
and qualifier = [
  1. | `QDots of (ident * type_arguments option) list
  2. | `QExpr of expr * tok
]
and stmt = [
  1. | `ExprStmt of expr * sc
  2. | `Block of stmt list bracket
  3. | `If of tok * condition * stmt * stmt option
  4. | `While of tok * condition * stmt
  5. | `Return of tok * expr option * sc
  6. | `DoWhile of tok * stmt * expr
  7. | `For of tok * for_header * stmt
  8. | `Switch of tok * condition option * case_and_body list
  9. | `Continue of tok * label_ident * sc
  10. | `Break of tok * label_ident * sc
  11. | `Label of label * stmt
  12. | `Goto of tok * label
  13. | `Throw of tok * expr * sc
  14. | `Try of tok * stmt * catch list * finally option
  15. | `WithUsingResource of tok * stmt list * stmt
  16. | `Assert of tok * arguments * sc
  17. | `DefStmt of definition
  18. | `DirectiveStmt of directive
  19. | `OtherStmt of todo_kind * any list
]
and svalue = [
  1. | `Lit of literal
  2. | `Cst of const_type
  3. | `Sym of expr
  4. | `NotCst
]
and type_ = [
  1. | `TyN of name
  2. | `TyApply of type_ * type_arguments
  3. | `TyFun of parameter list * type_
  4. | `TyArray of expr option bracket * type_
  5. | `TyTuple of type_ list bracket
  6. | `TyVar of ident
  7. | `TyAny of tok
  8. | `TyPointer of tok * type_
  9. | `TyRef of tok * type_
  10. | `TyQuestion of type_ * tok
  11. | `TyRest of tok * type_
  12. | `TyAnd of type_ * tok * type_
  13. | `TyOr of type_ * tok * type_
  14. | `TyRecordAnon of class_kind wrap_ * field list bracket
  15. | `TyExpr of expr
  16. | `OtherType of todo_kind * any list
]
and type_argument = [
  1. | `TA of type_
  2. | `TAWildcard of tok * (bool wrap_ * type_) option
  3. | `TAExpr of expr
  4. | `OtherTypeArg of todo_kind * any list
]
and type_arguments = type_argument list bracket
and type_definition = {
  1. tbody : type_definition_kind;
}
and type_definition_kind = [
  1. | `OrType of or_type_element list
  2. | `AndType of field list bracket
  3. | `AliasType of type_
  4. | `NewType of type_
  5. | `AbstractType of tok
  6. | `Exception of ident * type_ list
  7. | `OtherTypeKind of todo_kind * any list
]
and type_parameter = [
  1. | `TP of type_parameter_classic
  2. | `OtherTypeParam of todo_kind * any list
]
and type_parameter_classic = {
  1. tp_id : ident;
  2. tp_attrs : attribute list;
  3. tp_bounds : type_ list;
  4. tp_default : type_ option;
  5. tp_variance : variance wrap_ option;
}
and type_parameters = type_parameter list
and variable_definition = {
  1. vinit : expr option;
  2. vtype : type_ option;
}
and xml = {
  1. xml_kind : xml_kind;
  2. xml_attrs : xml_attribute list;
  3. xml_body : xml_body list;
}
and xml_attr_value = expr
and xml_attribute = [
  1. | `XmlAttr of ident * tok * xml_attr_value
  2. | `XmlAttrExpr of expr bracket
]
and xml_body = [
  1. | `XmlText of string wrap_
  2. | `XmlExpr of expr option bracket
  3. | `XmlXml of xml
]
type program = item list