TaglessFinal.Expression
This module provides a type that represents a Python expression.
type ('arguments, 'bin_op, 'bool_op, 'compare, 'comprehension, 'constant, 'expr_context, 'identifier, 'keyword, 'location, 'unary_op, 'expr)
t =
private {
bool_op : location:'location -> op:'bool_op -> values:'expr list -> 'expr; | (* Represents a boolean expression.
|
named_expr : location:'location -> target:'expr -> value:'expr -> 'expr; | (* Represents an assignment expression, a.k.a. the "walrus" operator.
|
bin_op : location:'location ->
left:'expr ->
op:'bin_op ->
right:'expr ->
'expr; | (* Represents a numerical binary expression.
|
unary_op : location:'location -> op:'unary_op -> operand:'expr -> 'expr; | (* Represents an unary expression.
|
lambda : location:'location -> args:'arguments -> body:'expr -> 'expr; | (* Represents a lambda expression. See PEP 312.
|
if_exp : location:'location ->
test:'expr ->
body:'expr ->
orelse:'expr ->
'expr; | (* Represents a conditional expression. See PEP 308.
|
dict : location:'location ->
keys:'expr option list ->
values:'expr list ->
'expr; | (* Represents a Python dictionary display.
|
set : location:'location -> elts:'expr list -> 'expr; | (* Represents a Python set display.
|
list_comp : location:'location ->
elt:'expr ->
generators:'comprehension list ->
'expr; | (* Represents a list comprehension. See PEP 202.
|
set_comp : location:'location ->
elt:'expr ->
generators:'comprehension list ->
'expr; | (* Represents a set comprehension.
|
dict_comp : location:'location ->
key:'expr ->
value:'expr ->
generators:'comprehension list ->
'expr; | (* Represents a dict comprehension. See PEP 274.
|
generator_exp : location:'location ->
elt:'expr ->
generators:'comprehension list ->
'expr; | (* Represents a generator expression. See PEP 289.
|
await : location:'location -> value:'expr -> 'expr; | (* Represents an await expression. See PEP 492.
|
yield : location:'location -> value:'expr option -> 'expr; | (* Represents a yield expression. See PEP 342.
|
yield_from : location:'location -> value:'expr -> 'expr; | (* Represents a yield from expression. See PEP 380.
|
compare : location:'location ->
left:'expr ->
ops:'compare list ->
comparators:'expr list ->
'expr; | (* Represents a comparison expression.
|
call : location:'location ->
func:'expr ->
args:'expr list ->
keywords:'keyword list ->
'expr; | (* Represents a call expression, where
|
formatted_value : location:'location ->
value:'expr ->
conversion:int ->
format_spec:'expr option ->
'expr; | (* Represents the expression component of an f-string. See PEP 498.
|
joined_str : location:'location -> values:'expr list -> 'expr; | (* Represents an f-string. See PEP 498.
|
constant : location:'location ->
value:'constant ->
kind:string option ->
'expr; | (* Represents a constant expression.
|
attribute : location:'location ->
value:'expr ->
attr:'identifier ->
ctx:'expr_context ->
'expr; | (* Represents an attribute access expression.
|
subscript : location:'location ->
value:'expr ->
slice:'expr ->
ctx:'expr_context ->
'expr; | (* Represents a subscript access expression.
|
starred : location:'location -> value:'expr -> ctx:'expr_context -> 'expr; | (* Represents an starred expression, which is used to represent iterable unpacking (inside |
name : location:'location -> id:'identifier -> ctx:'expr_context -> 'expr; | (* Represents a simple identifier.
|
list : location:'location -> elts:'expr list -> ctx:'expr_context -> 'expr; | (* Represents a Python list display.
|
tuple : location:'location -> elts:'expr list -> ctx:'expr_context -> 'expr; | (* Represents a Python tuple display.
|
slice : location:'location ->
lower:'expr option ->
upper:'expr option ->
step:'expr option ->
'expr; | (* Represents a slice expression. This kind of expression can only appear within the
|
}
val make :
bool_op:( location:'a -> op:'b -> values:'c list -> 'c ) ->
named_expr:( location:'a -> target:'c -> value:'c -> 'c ) ->
bin_op:( location:'a -> left:'c -> op:'d -> right:'c -> 'c ) ->
unary_op:( location:'a -> op:'e -> operand:'c -> 'c ) ->
lambda:( location:'a -> args:'f -> body:'c -> 'c ) ->
if_exp:( location:'a -> test:'c -> body:'c -> orelse:'c -> 'c ) ->
dict:( location:'a -> keys:'c option list -> values:'c list -> 'c ) ->
set:( location:'a -> elts:'c list -> 'c ) ->
list_comp:( location:'a -> elt:'c -> generators:'g list -> 'c ) ->
set_comp:( location:'a -> elt:'c -> generators:'g list -> 'c ) ->
dict_comp:( location:'a -> key:'c -> value:'c -> generators:'g list -> 'c ) ->
generator_exp:( location:'a -> elt:'c -> generators:'g list -> 'c ) ->
await:( location:'a -> value:'c -> 'c ) ->
yield:( location:'a -> value:'c option -> 'c ) ->
yield_from:( location:'a -> value:'c -> 'c ) ->
compare:
( location:'a -> left:'c -> ops:'h list -> comparators:'c list -> 'c ) ->
call:( location:'a -> func:'c -> args:'c list -> keywords:'i list -> 'c ) ->
formatted_value:
( location:'a ->
value:'c ->
conversion:int ->
format_spec:'c option ->
'c ) ->
joined_str:( location:'a -> values:'c list -> 'c ) ->
constant:( location:'a -> value:'j -> kind:string option -> 'c ) ->
attribute:( location:'a -> value:'c -> attr:'k -> ctx:'l -> 'c ) ->
subscript:( location:'a -> value:'c -> slice:'c -> ctx:'l -> 'c ) ->
starred:( location:'a -> value:'c -> ctx:'l -> 'c ) ->
name:( location:'a -> id:'k -> ctx:'l -> 'c ) ->
list:( location:'a -> elts:'c list -> ctx:'l -> 'c ) ->
tuple:( location:'a -> elts:'c list -> ctx:'l -> 'c ) ->
slice:
( location:'a ->
lower:'c option ->
upper:'c option ->
step:'c option ->
'c ) ->
unit ->
( 'f, 'd, 'b, 'h, 'g, 'j, 'l, 'k, 'i, 'a, 'e, 'c ) t
Constructor of t
.