diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-09 11:49:13 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-09 11:49:13 -0300 |
| commit | 5f22f8961c80ce36297f086ae31d87bbb6897c97 (patch) | |
| tree | 61837abde7ea51dfe61140734af716437253f605 /lcode.h | |
| parent | a7c1390ffaf0edfe839d075df484f2b81b3151bf (diff) | |
| download | lua-github-5f22f8961c80ce36297f086ae31d87bbb6897c97.tar.gz | |
better code for unary/binary operators
Diffstat (limited to 'lcode.h')
| -rw-r--r-- | lcode.h | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -1,5 +1,5 @@ /* -** $Id: lcode.h,v 1.14 2000/06/16 17:51:40 roberto Exp roberto $ +** $Id: lcode.h,v 1.15 2000/06/28 20:20:36 roberto Exp roberto $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -20,6 +20,20 @@ #define NO_JUMP (-1) +/* +** grep "ORDER OPR" if you change these enums +*/ +typedef enum BinOpr { + OPR_ADD, OPR_SUB, OPR_MULT, OPR_DIV, OPR_POW, + OPR_CONCAT, + OPR_NE, OPR_EQ, OPR_LT, OPR_LE, OPR_GT, OPR_GE, + OPR_AND, OPR_OR, + OPR_NOBINOPR +} BinOpr; + +typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_NOUNOPR } UnOpr; + + enum Mode {iO, iU, iS, iAB}; /* instruction format */ #define VD 100 /* flag for variable delta */ @@ -48,9 +62,9 @@ int luaK_lastisopen (FuncState *fs); void luaK_setcallreturns (FuncState *fs, int nresults); void luaK_tostack (LexState *ls, expdesc *v, int onlyone); void luaK_storevar (LexState *ls, const expdesc *var); -void luaK_prefix (LexState *ls, int op, expdesc *v); -void luaK_infix (LexState *ls, int op, expdesc *v); -void luaK_posfix (LexState *ls, int op, expdesc *v1, expdesc *v2); +void luaK_prefix (LexState *ls, UnOpr op, expdesc *v); +void luaK_infix (LexState *ls, BinOpr op, expdesc *v); +void luaK_posfix (LexState *ls, BinOpr op, expdesc *v1, expdesc *v2); #endif |
