Expr
class Expr Import
Source: use macro::{Expr}; compiler/src/prelude/macro.hy A function-style macro argument as written: f(1), a + b, "text".
Fields#
| Field | Type | Description |
|---|---|---|
text | string | |
kind_name | string | literal, ident, path, call or other. |
value_kind | string | For a constant argument (3, -2.5, "a\n", 1 + 2): int, float, bool or string, else "". |
value_text | string | The value: decimal digits for an int, the text for a string, 1 / 0 for a bool; for a float, the digits of d in d * 10^value_exp. |
value_exp | int |
Methods#
| Name | Description |
|---|---|
str | The source text as written. |
src | The source to splice: parenthesized unless it is a single term, so ${a} * 2 keeps a whole. |
kind | |
is_literal | |
is_ident | |
int | The argument’s value when it is an integer constant: 3, -2, 2 * 21. |
float | The value of a float constant (2.5, -1.0e3), or of an integer one. |
bool | The value of a true / false constant. |
string | The value of a string constant, escapes decoded: for "a\"b", a"b. |
See also#
macro::identpathExpr::intExpr::floatExpr::boolExpr::stringCode: Generated coil source: declarations, an expression, statements or a type.Ident: A name as written in source.