Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
AST_generic_helpers
Sourceval vardef_to_assign :
(AST_generic.entity * AST_generic.variable_definition) ->
AST_generic.expr
val funcdef_to_lambda :
(AST_generic.entity * AST_generic.function_definition) ->
AST_generic.resolved_name option ->
AST_generic.expr
val name_of_ids_with_opt_typeargs :
(AST_generic.ident * AST_generic.type_arguments option) list ->
AST_generic.name
val add_id_opt_type_args_to_name :
AST_generic.name ->
(AST_generic.ident * AST_generic.type_arguments option) ->
AST_generic.name
val add_type_args_to_name :
AST_generic.name ->
AST_generic.type_arguments ->
AST_generic.name
val add_type_args_opt_to_name :
AST_generic.name ->
AST_generic.type_arguments option ->
AST_generic.name
Abstract away position and svalue for comparison * with polymorphic operators.
Test whether an operator is suitable for associative-matching.
val ac_matching_nf :
AST_generic.operator ->
AST_generic.argument list ->
AST_generic.expr list option
ac_matching_nf op args
converts the operands args
of an * AC-operator op
to a normal form (NF) better suited for AC-matching. * Essentially, we flatten out all op
-operations. Note that this is not * a canonical form (i.e., it is not a unique representation). * E.g. * ac_matching_nf And a; Call(Op And, [b; c])
= Some a; b; c
* The function returns None
if op
is not an AC-operator. It also * returns None
if the operands have an unexpected shape (see code), * in which case we just log an error and skip AC-matching (rather * than crashing).
val undo_ac_matching_nf :
Parse_info.t ->
AST_generic.operator ->
AST_generic.expr list ->
AST_generic.expr option
undo_ac_matching_nf tok op args_nf
folds args_nf
using op
* (in a sense, it "undoes" ac_matching_nf
). Here tok
is the token of * the operand op
in the source file. Note that this does not remember * the original grouping of the operands! * E.g. * undo_ac_matching_nf tok And a; b; c
= Call(Op And, Call(Op And, [a; b]); c
)