Class in macro compiler

Expr

class Expr
Import
use macro::{Expr};
Source: compiler/src/prelude/macro.hy

A function-style macro argument as written: f(1), a + b, "text".

Fields#

FieldTypeDescription
textstring
kind_namestringliteral, ident, path, call or other.
value_kindstringFor a constant argument (3, -2.5, "a\n", 1 + 2): int, float, bool or string, else "".
value_textstringThe 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_expint

Methods#

NameDescription
strThe source text as written.
srcThe source to splice: parenthesized unless it is a single term, so ${a} * 2 keeps a whole.
kind
is_literal
is_ident
intThe argument’s value when it is an integer constant: 3, -2, 2 * 21.
floatThe value of a float constant (2.5, -1.0e3), or of an integer one.
boolThe value of a true / false constant.
stringThe value of a string constant, escapes decoded: for "a\"b", a"b.

See also#

↑ ↓ navigate ↵ open