potion  0.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ast.h
Go to the documentation of this file.
1 
5 #ifndef POTION_AST_H
6 #define POTION_AST_H
7 
9 typedef struct {
10  PN v;
11  PN b;
12 } PNArg;
13 
14 
15 // PN_AST - tree-types, now in potion.h
16 //enum PN_AST {
17 //};
18 
19 #define PN_TOK_MISSING 0x10000
20 
21 #define PN_AST(T, A, N, L) potion_source(P, AST_##T, A, PN_NIL, PN_NIL, N, L)
22 #define PN_AST2(T, A, B, N, L) potion_source(P, AST_##T, A, B, PN_NIL, N, L)
23 #define PN_AST3(T, A, B, C, N, L) potion_source(P, AST_##T, A, B, C, N, L)
24 #define PN_AST_(T, A) potion_source(P, AST_##T, A, PN_NIL, PN_NIL, -1, PN_NIL)
25 #define PN_AST2_(T, A, B) potion_source(P, AST_##T, A, B, PN_NIL, -1, PN_NIL)
26 #define PN_AST3_(T, A, B, C) potion_source(P, AST_##T, A, B, C, -1, PN_NIL)
27 #define PN_OP(T, A, B) potion_source(P, T, A, B, PN_NIL, 0, PN_NIL)
29 #define PN_TUPIF(T) PN_IS_TUPLE(T) ? T : PN_TUP(T)
30 #define PN_SRC(S) ((struct PNSource *)S)
31 #define PN_PART(S) ((struct PNSource *)S)->part
32 #define PN_S_(S, N) ((struct PNSource *)S)->a[N] //lvalue
33 #define PN_S(S, N) (PN)(((struct PNSource *)S)->a[N])
34 #define PN_CLOSE(B) ({ \
35  PN endname = B; \
36  if (PN_IS_TUPLE(endname)) endname = PN_TUPLE_AT(endname, 0); \
37  if (endname != PN_NIL) { \
38  if (PN_PART(endname) == AST_EXPR) endname = PN_TUPLE_AT(PN_S(endname, 0), 0); \
39  if (PN_PART(endname) == AST_MSG || PN_PART(endname) == AST_PATH) \
40  endname = PN_S(endname, 0); \
41  if (P->unclosed == endname) { P->unclosed = PN_NIL; } \
42  } \
43  })
44 
45 PN potion_source(Potion *, u8, PN, PN, PN, int, PN);
46 
47 #endif
PN b
block
Definition: ast.h:11
PNArg - call a function (unused). See now macro PN_S(name,1), PN_S(name,2)
Definition: ast.h:9
unsigned char u8
Definition: internal.h:8
PN v
args
Definition: ast.h:10
the global interpreter state P. currently singleton (not threads yet)
Definition: potion.h:644
volatile _PN PN
Definition: potion.h:81
PN potion_source(Potion *, u8, PN, PN, PN, int, PN)
PNSource constructor.
Definition: ast.c:35