module Precedence: sig
.. end
a prefix operation
type
t =
| |
P_prefix |
| |
P_infix of int |
| |
P_infix_left of int |
| |
P_infix_right of int |
| |
P_special |
type
context =
| |
Field |
| |
App_right |
| |
App_left |
| |
Infix_left of t |
| |
Infix_right of t |
| |
Delimited |
type
exp_kind =
| |
App |
| |
Infix of t |
| |
Let |
| |
Atomic |
type
pat_context =
| |
Plist |
| |
Pas_left |
| |
Pcons_left |
| |
Pcons_right |
| |
Pdelimited |
type
pat_kind =
| |
Papp |
| |
Pas |
| |
Padd |
| |
Pcons |
| |
Patomic |
val is_infix : t -> bool
val needs_parens : context -> exp_kind -> bool
val pat_needs_parens : pat_context -> pat_kind -> bool
val get_prec : Target.target -> Typed_ast.env -> Typed_ast.const_descr_ref -> t
get_prec target env c
looks up the precedence of constant c
in environment env
for the target target
. Thereby, it follows target-representations of this constant.
val get_prec_exp : Target.target -> Typed_ast.env -> Typed_ast.exp -> t
get_prec target env e
looks up the precedence of expression e
in environment env
for the target target
. If the expression is essentially a constant (i.e. a constant
with perhaps parenthesis or types added), the precedence of this constant is returned
using get_prec
. Otherwise P_prefix
is returned.