Gnm.Expr¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
array_corner |
r/w |
||
array_elem |
r/w |
||
binary |
r/w |
||
cellref |
r/w |
||
constant |
r/w |
||
func |
r/w |
||
name |
r/w |
||
set |
r/w |
||
unary |
r/w |
Methods¶
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Gnm.Expr¶
- classmethod cell_deriv(y, x)¶
- Parameters:
- Returns:
The derivative of cell y with respect to cell x.
- Return type:
Gnm.ExprTop
orNone
- classmethod cell_deriv_value(y, x)¶
- classmethod conv_quote(convs, str)¶
- Parameters:
convs (
Gnm.Conventions
) –Gnm.Conventions
str (
str
) – string to quote
- Returns:
A quoted string according to convs. If no quoting is necessary, a literal copy of str will be returned.
- Return type:
- classmethod deriv_shutdown_()¶
- classmethod lex_all(str, pp, flags, convs)¶
- Parameters:
str (
str
) –pp (
Gnm.ParsePos
) –flags (
Gnm.ExprParseFlags
) –convs (
Gnm.Conventions
) –
- Return type:
- classmethod list_as_string(argc, argv, out)¶
- Parameters:
argc (
int
) –argv (
Gnm.Expr
) –out (
Gnm.ConventionsOut
) –
- classmethod list_copy(list)¶
- classmethod list_unref(list)¶
- Parameters:
list ([
object
]) – expression list
This frees list and all the expressions in it.
- classmethod new_cellref(cr)¶
- Parameters:
cr (
Gnm.CellRef
) – cell reference- Returns:
expression referencing cr.
- Return type:
- classmethod new_constant(v)¶
- classmethod new_funcall(func, args)¶
- classmethod new_funcall1(func, arg0)¶
- classmethod new_funcall2(func, arg0, arg1)¶
- classmethod new_funcall3(func, arg0, arg1, arg2)¶
- classmethod new_funcall4(func, arg0, arg1, arg2, arg3)¶
- classmethod new_funcall5(func, arg0, arg1, arg2, arg3, arg4)¶
- classmethod new_name(name, sheet_scope, wb_scope)¶
- Parameters:
name (
Gnm.NamedExpr
) –sheet_scope (
Gnm.Sheet
) –wb_scope (
Gnm.Workbook
) –
- Return type:
- classmethod new_set(args)¶
- classmethod new_unary(op, e)¶
- Parameters:
op (
Gnm.ExprOp
) – Unary operator
- Returns:
Unary expression
- Return type:
- classmethod parse_str(str, pp, flags, convs, error)¶
- Parameters:
str (
str
) –pp (
Gnm.ParsePos
) –flags (
Gnm.ExprParseFlags
) –convs (
Gnm.Conventions
) –error (
Gnm.ParseError
) –
- Return type:
- as_gstring(out)¶
- Parameters:
out (
Gnm.ConventionsOut
) – output conventions
Renders the expression as a string according to out and places the result in out's accumulator.
- as_string(pp, convs)¶
- Parameters:
pp (
Gnm.ParsePos
orNone
) – Parse position.None
should be used for debugging only.convs (
Gnm.Conventions
orNone
) –Gnm.Conventions
.None
should be used for debugging or when pp identifies aGnm.Sheet
.
- Returns:
self as a string.
- Return type:
Renders the expression as a string according to convs.
- deriv(ep, info)¶
- Parameters:
ep (
Gnm.EvalPos
) – position for selfinfo (
Gnm.ExprDeriv
) – Derivative information
- Returns:
the derivative of self with respect to info.
- Return type:
- deriv_chain(deriv, ep, info)¶
- Parameters:
ep (
Gnm.EvalPos
) – position for selfinfo (
Gnm.ExprDeriv
) – Derivative information
- Returns:
the derivative of self with respect to info.
- Return type:
Applies the chain rule to self.
- deriv_collect(ep, info)¶
- Parameters:
ep (
Gnm.EvalPos
) – evaluation positioninfo (
Gnm.ExprDeriv
) – extra information, not currently used
- Returns:
list of expressions expanded from self
- Return type:
[
Gnm.Expr
]
- equal(b)¶
- eval(pos, flags)¶
- Parameters:
pos (
Gnm.EvalPos
) – evaluation positionflags (
Gnm.ExprEvalFlags
) –Gnm.ExprEvalFlags
- Returns:
result.
- Return type:
Evaluatates the given expression. If
Gnm.ExprEvalFlags.PERMIT_EMPTY
is not set then return zero if the expression instead of the emptyGOffice.value
, or theGOffice.value
of an unused cell.
- free()¶
Deletes self with all its subexpressions.
- get_cellref()¶
- Returns:
If this expression consists of just a cell reference, return it. Otherwise,
None
.- Return type:
Gnm.CellRef
orNone
- get_constant()¶
- get_func_arg(i)¶
- get_name()¶
- Returns:
If this expression consists of just a name, return it. Otherwise,
None
.- Return type:
- get_range()¶
- is_data_table(c_in, r_in)¶
- Parameters:
c_in (
Gnm.CellPos
) –r_in (
Gnm.CellPos
) –
- Return type:
- is_empty()¶
- is_rangeref()¶
- new_binary(op, r)¶
- Parameters:
op (
Gnm.ExprOp
) – Unary operatorr (
Gnm.Expr
) – right operand.
- Returns:
Binary expression
- Return type:
- new_range_ctor(r)¶
- Parameters:
r (
Gnm.Expr
) – end range- Returns:
And expression referencing self to r.
- Return type:
This function builds a range constructor or something simpler, but equivalent, if the arguments allow it.
- simplify_if()¶
-
Simplifies self if it is a call to “if” with a constant condition.
- walk(walker, user)¶
- Parameters:
walker (
Gnm.ExprWalkerFunc
) – callback for each sub-expression
- Returns:
transformed expression.
This function walks the expression and calls the walker function for each subexpression. If the walker returns a non-
None
expression, a new expression is built.The walker will be called for an expression before its subexpressions. It will receive the expression as its first argument and a
Gnm.ExprWalk
pointer as its second. It may set the stop flag to terminate the walk in which caseGnm.Expr.walk
will returnNone
.- Return type: