p2  0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ast.h File Reference

the ast for Potion code in-memory More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PNArg
 PNArg - call a function (unused). See now macro PN_S(name,1), PN_S(name,2) More...
 

Macros

#define PN_TOK_MISSING   0x10000
 
#define PN_AST(T, A, N, L)   potion_source(P, AST_##T, A, PN_NIL, PN_NIL, N, L)
 
#define PN_AST2(T, A, B, N, L)   potion_source(P, AST_##T, A, B, PN_NIL, N, L)
 
#define PN_AST3(T, A, B, C, N, L)   potion_source(P, AST_##T, A, B, C, N, L)
 
#define PN_AST_(T, A)   potion_source(P, AST_##T, A, PN_NIL, PN_NIL, -1, PN_NIL)
 
#define PN_AST2_(T, A, B)   potion_source(P, AST_##T, A, B, PN_NIL, -1, PN_NIL)
 
#define PN_AST3_(T, A, B, C)   potion_source(P, AST_##T, A, B, C, -1, PN_NIL)
 
#define PN_OP(T, A, B)   potion_source(P, T, A, B, PN_NIL, 0, PN_NIL)
 Warning: This might conflict with the typedef struct PN_OP. More...
 
#define PN_TUPIF(T)   PN_IS_TUPLE(T) ? T : PN_TUP(T)
 
#define PN_SRC(S)   ((struct PNSource *)S)
 
#define PN_PART(S)   ((struct PNSource *)S)->part
 
#define PN_S_(S, N)   ((struct PNSource *)S)->a[N]
 
#define PN_S(S, N)   (PN)(((struct PNSource *)S)->a[N])
 
#define PN_CLOSE(B)
 

Functions

PN potion_source (Potion *, u8, PN, PN, PN, int, PN)
 PNSource constructor. More...
 

Detailed Description

the ast for Potion code in-memory

(c) 2008 why the lucky stiff, the freelance professor

Definition in file ast.h.

Macro Definition Documentation

#define PN_TOK_MISSING   0x10000

Definition at line 19 of file ast.h.

#define PN_AST (   T,
  A,
  N,
  L 
)    potion_source(P, AST_##T, A, PN_NIL, PN_NIL, N, L)

Definition at line 21 of file ast.h.

#define PN_AST2 (   T,
  A,
  B,
  N,
  L 
)    potion_source(P, AST_##T, A, B, PN_NIL, N, L)

Definition at line 22 of file ast.h.

#define PN_AST3 (   T,
  A,
  B,
  C,
  N,
  L 
)    potion_source(P, AST_##T, A, B, C, N, L)

Definition at line 23 of file ast.h.

#define PN_AST_ (   T,
 
)    potion_source(P, AST_##T, A, PN_NIL, PN_NIL, -1, PN_NIL)

Definition at line 24 of file ast.h.

#define PN_AST2_ (   T,
  A,
 
)    potion_source(P, AST_##T, A, B, PN_NIL, -1, PN_NIL)

Definition at line 25 of file ast.h.

#define PN_AST3_ (   T,
  A,
  B,
 
)    potion_source(P, AST_##T, A, B, C, -1, PN_NIL)

Definition at line 26 of file ast.h.

#define PN_OP (   T,
  A,
 
)    potion_source(P, T, A, B, PN_NIL, 0, PN_NIL)

Warning: This might conflict with the typedef struct PN_OP.

Definition at line 28 of file ast.h.

#define PN_TUPIF (   T)    PN_IS_TUPLE(T) ? T : PN_TUP(T)

Definition at line 29 of file ast.h.

#define PN_SRC (   S)    ((struct PNSource *)S)

Definition at line 30 of file ast.h.

#define PN_PART (   S)    ((struct PNSource *)S)->part

Definition at line 31 of file ast.h.

#define PN_S_ (   S,
  N 
)    ((struct PNSource *)S)->a[N]

Definition at line 32 of file ast.h.

#define PN_S (   S,
  N 
)    (PN)(((struct PNSource *)S)->a[N])

Definition at line 33 of file ast.h.

#define PN_CLOSE (   B)
Value:
({ \
PN endname = B; \
if (PN_IS_TUPLE(endname)) endname = PN_TUPLE_AT(endname, 0); \
if (endname != PN_NIL) { \
if (PN_PART(endname) == AST_EXPR) endname = PN_TUPLE_AT(PN_S(endname, 0), 0); \
if (PN_PART(endname) == AST_MSG || PN_PART(endname) == AST_PATH) \
endname = PN_S(endname, 0); \
if (P->unclosed == endname) { P->unclosed = PN_NIL; } \
} \
})
#define PN_TUPLE_AT(t, n)
Definition: potion.h:278
#define PN_S(S, N)
Definition: ast.h:33
#define PN_PART(S)
Definition: ast.h:31
volatile _PN PN
Definition: potion.h:81
#define PN_NIL
Definition: potion.h:139
#define PN_IS_TUPLE(v)
Definition: potion.h:174

Definition at line 34 of file ast.h.

Function Documentation

PN potion_source ( Potion P,
u8  p,
PN  a,
PN  b,
PN  c,
int  lineno,
PN  line 
)

PNSource constructor.

Parameters
pAST type
a,b,cAST operands
linenolinenumber in src file
lineassociated line PNString in src file
Returns
a new AST node with up to three operands

Definition at line 35 of file ast.c.