Mercurial > hg > dmlib
diff dmeval.h @ 764:181d659bba39
More work.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 09 May 2013 08:28:39 +0300 |
parents | 7be7c7c5deaa |
children | c68258fd81a1 |
line wrap: on
line diff
--- a/dmeval.h Thu May 09 06:36:54 2013 +0300 +++ b/dmeval.h Thu May 09 08:28:39 2013 +0300 @@ -36,7 +36,7 @@ // Special ops OP_FUNC, OP_VAR, - OP_CONST, + OP_VALUE, OP_SUBEXPR, // Total number of operators @@ -65,32 +65,34 @@ enum { - ID_FUNC, - ID_VAR, - ID_CVAR, + SYM_FUNC, + SYM_VAR, + SYM_CVAR, } DMEvalSymbolType; typedef struct { - char *name; - int type; - int nargs; + char *name; // Name of the symbol + int type; // Type (SYM_*) + int nargs; // Number of arguments, if SYM_FUNC + DMValue (*func)(DMValue arg[DM_MAX_ARGS]); - DMValue *var, cvalue; + + DMValue *var; // Pointer to variable value if SYM_VAR + DMValue cvalue; // Const value, if SYM_CVAR } DMEvalSymbol; typedef struct DMEvalNode { - BOOL ok; - int op; - DMValue val; - DMEvalSymbol *id; + int op; // Operator/token type + DMValue val; // Value, if immediate constant + DMEvalSymbol *symbol; // Symbol pointer, if function/variable/constvar - struct DMEvalNode *args[DM_MAX_ARGS]; + struct DMEvalNode *args[DM_MAX_ARGS]; // Arguments, if function - struct DMEvalNode *subexpr, *next, *prev; + struct DMEvalNode *subexpr, *left, *right, *next, *prev; } DMEvalNode;