14 "code",
"value",
"assign",
"not",
"or",
"and",
"cmp",
"eq",
"neq",
15 "gt",
"gte",
"lt",
"lte",
"pipe",
"caret",
"amp",
"wavy",
"bitl",
16 "bitr",
"plus",
"minus",
"inc",
"times",
"div",
"rem",
"pow",
17 "msg",
"path",
"query",
"pathq",
"expr",
"list",
"block",
"lick",
22 1, 3, 2, 1, 2, 2, 2, 2, 2,
23 2, 2, 2, 2, 2, 2, 2, 1, 2,
24 2, 2, 2, 2, 2, 2, 2, 2,
25 3, 1, 1, 1, 1, 1, 1, 3,
41 t->loc.lineno = lineno;
45 case 3: t->a[2] =
PN_SRC(c);
46 case 2: t->a[1] =
PN_SRC(b);
47 case 1: t->a[0] =
PN_SRC(a);
break;
53 case 2: t->a[0] =
PN_SRC(a); t->a[1] =
PN_SRC(b); t->a[2] = 0;
break;
54 case 1: t->a[0] =
PN_SRC(a); t->a[1] = t->a[2] = 0;
break;
89 return PN_NUM(t->loc.lineno);
107 int lineno = t->loc.lineno;
109 for (i = 0; i < n; i++) {
111 if (i == 0 && n > 1)
pn_printf(P, out,
"(");
127 lineno = t->a[i]->loc.lineno;
129 if (i == n - 1 && n > 1) {
135 if (b->chars[cut-1] ==
' ')
136 b->chars[cut-1] =
'\0';
138 b->chars[cut] =
'\0';
#define PN_TUPLE_AT(t, n)
static PN potion_source_line(Potion *P, PN cl, PN self)
PN_AST
An AST fragment, non-volatile.
PN potion_str(Potion *, const char *)
byte strings are raw character data, volatile, may be appended/changed.
#define PN_ALLOC_N(V, T, C)
PN_SIZE void potion_bytes_obj_string(Potion *, PN, PN)
PN PN potion_byte_str(Potion *, const char *)
#define potion_method(RCV, MSG, FN, SIG)
static PN potion_fwd(PN)
the potion type is the 't' in the vtable tuple (m,t)
static PN potion_source_file(Potion *P, PN cl, PN self)
PN_SIZE fileno
currently parsed file
the ast for Potion code in-memory
static PN potion_source_loc(Potion *P, PN cl, PN self)
const char * potion_ast_names[]
static PN potion_source_name(Potion *P, PN cl, PN self)
static PN potion_source_lineno(Potion *P, PN cl, PN self)
PN potion_source(Potion *P, u8 p, PN a, PN b, PN c, int lineno, PN line)
PNSource constructor.
the global interpreter state P. currently singleton (not threads yet)
PN_SIZE pn_printf(Potion *, PN, const char *,...) __attribute__((format(printf
const int potion_ast_sizes[]
void potion_source_init(Potion *P)
static PN potion_source_string(Potion *P, PN cl, PN self)
void potion_fatal(char *message)
static PN potion_source_size(Potion *P, PN cl, PN self)