package pfff

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tok = Parse_info.t
type 'a wrap = 'a * tok
type 'a bracket = tok * 'a * tok
type ident = string wrap
type dotted_ident = ident list
type module_name =
  1. | DottedName of dotted_ident
  2. | FileName of string wrap
type sid = int
and resolved_name = resolved_name_kind * sid
and resolved_name_kind =
  1. | Global
  2. | Local
  3. | Param
  4. | EnclosedVar
  5. | ImportedEntity of dotted_ident
  6. | ImportedModule of module_name
  7. | TypeName
  8. | Macro
  9. | EnumConstant
type name = ident * name_info
and name_info = {
  1. name_qualifier : qualifier option;
  2. name_typeargs : type_arguments option;
}
and qualifier = dotted_ident
and id_info = {
  1. id_resolved : resolved_name option ref;
  2. id_type : type_ option ref;
  3. id_const_literal : literal option ref;
}
and expr =
  1. | L of literal
  2. | Container of container_operator * expr list bracket
  3. | Tuple of expr list
  4. | Record of field list bracket
  5. | Constructor of name * expr list
  6. | Lambda of function_definition
  7. | AnonClass of class_definition
  8. | Id of ident * id_info
  9. | IdQualified of name * id_info
  10. | IdSpecial of special wrap
  11. | Call of expr * arguments
  12. | Xml of xml
  13. | Assign of expr * tok * expr
  14. | AssignOp of expr * arithmetic_operator wrap * expr
  15. | LetPattern of pattern * expr
  16. | DotAccess of expr * tok * field_ident
  17. | ArrayAccess of expr * expr
  18. | SliceAccess of expr * expr option * expr option * expr option
  19. | Conditional of expr * expr * expr
  20. | MatchPattern of expr * action list
  21. | Yield of tok * expr option * bool
  22. | Await of tok * expr
  23. | Cast of type_ * expr
  24. | Seq of expr list
  25. | Ref of tok * expr
  26. | DeRef of tok * expr
  27. | Ellipsis of tok
  28. | TypedMetavar of ident * tok * type_
  29. | DisjExpr of expr * expr
  30. | OtherExpr of other_expr_operator * any list
and literal =
  1. | Bool of bool wrap
  2. | Int of string wrap
  3. | Float of string wrap
  4. | Char of string wrap
  5. | String of string wrap
  6. | Regexp of string wrap
  7. | Unit of tok
  8. | Null of tok
  9. | Undefined of tok
  10. | Imag of string wrap
and container_operator =
  1. | Array
  2. | List
  3. | Set
  4. | Dict
and special =
  1. | This
  2. | Super
  3. | Self
  4. | Parent
  5. | Eval
  6. | Typeof
  7. | Instanceof
  8. | Sizeof
  9. | New
  10. | Concat
  11. | EncodedString of string wrap
  12. | Spread
  13. | ArithOp of arithmetic_operator
  14. | IncrDecr of incr_decr * prefix_postfix
and arithmetic_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
and incr_decr =
  1. | Incr
  2. | Decr
and prefix_postfix =
  1. | Prefix
  2. | Postfix
and field_ident =
  1. | FId of ident
  2. | FName of name
  3. | FDynamic of expr
and action = pattern * expr
and xml = {
  1. xml_tag : ident;
  2. xml_attrs : xml_attribute list;
  3. xml_body : xml_body list;
}
and xml_attribute = ident * xml_attr_value
and xml_attr_value = expr
and xml_body =
  1. | XmlText of string wrap
  2. | XmlExpr of expr
  3. | XmlXml of xml
and arguments = argument list
and argument =
  1. | Arg of expr
  2. | ArgKwd of ident * expr
  3. | ArgType of type_
  4. | ArgOther of other_argument_operator * any list
and other_argument_operator =
  1. | OA_ArgPow
  2. | OA_ArgComp
  3. | OA_ArgQuestion
and other_expr_operator =
  1. | OE_Exports
  2. | OE_Module
  3. | OE_Define
  4. | OE_Arguments
  5. | OE_NewTarget
  6. | OE_Delete
  7. | OE_YieldStar
  8. | OE_EncapsName
  9. | OE_Require
  10. | OE_UseStrict
  11. | OE_In
  12. | OE_NotIn
  13. | OE_Invert
  14. | OE_Slices
  15. | OE_CompForIf
  16. | OE_CompFor
  17. | OE_CompIf
  18. | OE_CmpOps
  19. | OE_Repr
  20. | OE_NameOrClassType
  21. | OE_ClassLiteral
  22. | OE_NewQualifiedClass
  23. | OE_GetRefLabel
  24. | OE_ArrayInitDesignator
  25. | OE_Unpack
  26. | OE_RecordWith
  27. | OE_RecordFieldName
  28. | OE_StmtExpr
  29. | OE_Send
  30. | OE_Recv
and stmt =
  1. | ExprStmt of expr
  2. | DefStmt of definition
  3. | DirectiveStmt of directive
  4. | Block of stmt list
  5. | If of tok * expr * stmt * stmt
  6. | While of tok * expr * stmt
  7. | DoWhile of tok * stmt * expr
  8. | For of tok * for_header * stmt
  9. | Switch of tok * expr option * case_and_body list
  10. | Return of tok * expr option
  11. | Continue of tok * label_ident
  12. | Break of tok * label_ident
  13. | Label of label * stmt
  14. | Goto of tok * label
  15. | Throw of tok * expr
  16. | Try of tok * stmt * catch list * finally option
  17. | Assert of tok * expr * expr option
  18. | DisjStmt of stmt * stmt
  19. | OtherStmtWithStmt of other_stmt_with_stmt_operator * expr * stmt
  20. | OtherStmt of other_stmt_operator * any list
and case_and_body = case list * stmt
and case =
  1. | Case of tok * pattern
  2. | Default of tok
  3. | CaseEqualExpr of tok * expr
and catch = tok * pattern * stmt
and finally = tok * stmt
and label = ident
and label_ident =
  1. | LNone
  2. | LId of label
  3. | LInt of int wrap
  4. | LDynamic of expr
and for_header =
  1. | ForClassic of for_var_or_expr list * expr option * expr option
  2. | ForEach of pattern * tok * expr
and for_var_or_expr =
  1. | ForInitVar of entity * variable_definition
  2. | ForInitExpr of expr
and other_stmt_with_stmt_operator =
  1. | OSWS_With
and other_stmt_operator =
  1. | OS_Delete
  2. | OS_ForOrElse
  3. | OS_WhileOrElse
  4. | OS_TryOrElse
  5. | OS_ThrowFrom
  6. | OS_ThrowNothing
  7. | OS_Pass
  8. | OS_Async
  9. | OS_Sync
  10. | OS_Asm
  11. | OS_Go
  12. | OS_Defer
  13. | OS_Fallthrough
  14. | OS_GlobalComplex
and pattern =
  1. | PatLiteral of literal
  2. | PatConstructor of name * pattern list
  3. | PatRecord of (name * pattern) list bracket
  4. | PatId of ident * id_info
  5. | PatTuple of pattern list
  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. | PatVar of type_ * (ident * id_info) option
  15. | OtherPat of other_pattern_operator * any list
and other_pattern_operator =
  1. | OP_Expr
and type_ =
  1. | TyBuiltin of string wrap
  2. | TyName of name
  3. | TyNameApply of name * type_arguments
  4. | TyVar of ident
  5. | TyFun of parameter_classic list * type_
  6. | TyArray of expr option * type_
  7. | TyPointer of tok * type_
  8. | TyTuple of type_ list bracket
  9. | TyQuestion of type_ * tok
  10. | TyAnd of (ident * type_) list bracket
  11. | TyOr of type_ list
  12. | OtherType of other_type_operator * any list
and type_arguments = type_argument list
and type_argument =
  1. | TypeArg of type_
  2. | OtherTypeArg of other_type_argument_operator * any list
and other_type_argument_operator =
  1. | OTA_Question
and other_type_operator =
  1. | OT_Expr
  2. | OT_Arg
  3. | OT_StructName
  4. | OT_UnionName
  5. | OT_EnumName
  6. | OT_ShapeComplex
  7. | OT_Variadic
and attribute =
  1. | KeywordAttr of keyword_attribute wrap
  2. | NamedAttr of ident * id_info * argument list
  3. | OtherAttribute of other_attribute_operator * any list
and keyword_attribute =
  1. | Static
  2. | Volatile
  3. | Extern
  4. | Public
  5. | Private
  6. | Protected
  7. | Abstract
  8. | Final
  9. | Var
  10. | Let
  11. | Mutable
  12. | Const
  13. | Generator
  14. | Async
  15. | Recursive
  16. | MutuallyRecursive
  17. | Ctor
  18. | Dtor
  19. | Getter
  20. | Setter
  21. | Variadic
and other_attribute_operator =
  1. | OA_StrictFP
  2. | OA_Transient
  3. | OA_Synchronized
  4. | OA_Native
  5. | OA_AnnotJavaOther
  6. | OA_AnnotThrow
  7. | OA_Expr
and definition = entity * definition_kind
and entity = {
  1. name : ident;
  2. attrs : attribute list;
  3. tparams : type_parameter list;
  4. info : id_info;
}
and definition_kind =
  1. | FuncDef of function_definition
  2. | VarDef of variable_definition
  3. | TypeDef of type_definition
  4. | ClassDef of class_definition
  5. | ModuleDef of module_definition
  6. | MacroDef of macro_definition
  7. | Signature of type_
  8. | UseOuterDecl of tok
and type_parameter = ident * type_parameter_constraints
and type_parameter_constraints = type_parameter_constraint list
and type_parameter_constraint =
  1. | Extends of type_
and function_definition = {
  1. fparams : parameters;
  2. frettype : type_ option;
  3. fbody : stmt;
}
and parameters = parameter list
and parameter =
  1. | ParamClassic of parameter_classic
  2. | ParamPattern of pattern
  3. | ParamEllipsis of tok
  4. | OtherParam of other_parameter_operator * 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 other_parameter_operator =
  1. | OPO_KwdParam
  2. | OPO_SingleStarParam
  3. | OPO_Receiver
  4. | OPO_Ref
and variable_definition = {
  1. vinit : expr option;
  2. vtype : type_ option;
}
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. | Exception of ident * type_ list
  6. | OtherTypeKind of other_type_kind_operator * any list
and or_type_element =
  1. | OrConstructor of ident * type_ list
  2. | OrEnum of ident * expr option
  3. | OrUnion of ident * type_
  4. | OtherOr of other_or_type_element_operator * any list
and other_or_type_element_operator =
  1. | OOTEO_EnumWithMethods
  2. | OOTEO_EnumWithArguments
and field =
  1. | FieldStmt of stmt
  2. | FieldDynamic of expr * attribute list * expr
  3. | FieldSpread of tok * expr
and other_type_kind_operator =
  1. | OTKO_AbstractType
and class_definition = {
  1. ckind : class_kind;
  2. cextends : type_ list;
  3. cimplements : type_ list;
  4. cmixins : type_ list;
  5. cbody : field list bracket;
}
and class_kind =
  1. | Class
  2. | Interface
  3. | Trait
and module_definition = {
  1. mbody : module_definition_kind;
}
and module_definition_kind =
  1. | ModuleAlias of name
  2. | ModuleStruct of dotted_ident option * item list
  3. | OtherModule of other_module_operator * any list
and other_module_operator =
  1. | OMO_Functor
and macro_definition = {
  1. macroparams : ident list;
  2. macrobody : any list;
}
and directive =
  1. | ImportFrom of tok * module_name * ident * alias option
  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. | OtherDirective of other_directive_operator * any list
and alias = ident
and other_directive_operator =
  1. | OI_Export
  2. | OI_ImportCss
  3. | OI_ImportEffect
and item = stmt
and program = item list
and any =
  1. | I of ident
  2. | N of name
  3. | En of entity
  4. | E of expr
  5. | S of stmt
  6. | T of type_
  7. | P of pattern
  8. | Def of definition
  9. | Dir of directive
  10. | Pa of parameter
  11. | Ar of argument
  12. | At of attribute
  13. | Dk of definition_kind
  14. | Di of dotted_ident
  15. | Fld of field
  16. | Ss of stmt list
  17. | Tk of tok
  18. | Pr of program
val str_of_ident : ('a * 'b) -> 'a
exception Error of string * Parse_info.t
val error : Parse_info.t -> string -> 'a
val gensym_counter : int ref
val gensym : unit -> int
val sid_TODO : int
val empty_name_info : name_info
val empty_var : variable_definition
val empty_id_info : unit -> id_info
val basic_id_info : resolved_name -> id_info
val param_of_id : ident -> parameter_classic
val param_of_type : type_ -> parameter_classic
val basic_entity : ident -> attribute list -> entity
val basic_field : ident -> expr option -> type_ option -> field
val expr_to_arg : expr -> argument
val expr_to_pattern : expr -> pattern
val expr_to_type : expr -> type_
val opt_to_empty : stmt option -> stmt
val opt_to_label_ident : label option -> label_ident
val stmt1 : stmt list -> stmt
val is_boolean_operator : arithmetic_operator -> bool
val vardef_to_assign : (entity * variable_definition) -> resolved_name option -> expr
val funcdef_to_lambda : (entity * function_definition) -> resolved_name option -> expr
val has_keyword_attr : keyword_attribute -> attribute list -> bool
val fake : string -> Parse_info.t
val fake_bracket : 'a -> Parse_info.t * 'a * Parse_info.t
val unbracket : ('a * 'b * 'c) -> 'b