misc/liblua/lparser.h
author Wuzzy <Wuzzy2@mail.ru>
Wed, 25 Oct 2017 23:09:41 +0200
changeset 12768 ad67a3804981
parent 10017 de822cd3df3a
permissions -rw-r--r--
Fix sometimes ammo schemes not being saved after changing before an ammo scheme got deleted in session This was because the bool isDeleting is not initialized, so its initial value is unpredictable. Which means there's chance it starts with true, confusing the frontend.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     1
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     2
** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     3
** Lua Parser
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     4
** See Copyright Notice in lua.h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     5
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     6
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     7
#ifndef lparser_h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     8
#define lparser_h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     9
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    10
#include "llimits.h"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    11
#include "lobject.h"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    12
#include "lzio.h"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    13
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    14
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    15
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    16
** Expression descriptor
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    17
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    18
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    19
typedef enum {
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    20
  VVOID,    /* no value */
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    21
  VNIL,
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    22
  VTRUE,
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    23
  VFALSE,
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    24
  VK,       /* info = index of constant in `k' */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    25
  VKNUM,    /* nval = numerical value */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    26
  VLOCAL,   /* info = local register */
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    27
  VUPVAL,       /* info = index of upvalue in `upvalues' */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    28
  VGLOBAL,  /* info = index of table; aux = index of global name in `k' */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    29
  VINDEXED, /* info = table register; aux = index register (or `k') */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    30
  VJMP,     /* info = instruction pc */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    31
  VRELOCABLE,   /* info = instruction pc */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    32
  VNONRELOC,    /* info = result register */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    33
  VCALL,    /* info = instruction pc */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 2812
diff changeset
    34
  VVARARG   /* info = instruction pc */
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    35
} expkind;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    36
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    37
typedef struct expdesc {
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    38
  expkind k;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    39
  union {
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    40
    struct { int info, aux; } s;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    41
    lua_Number nval;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    42
  } u;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    43
  int t;  /* patch list of `exit when true' */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    44
  int f;  /* patch list of `exit when false' */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    45
} expdesc;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    46
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    47
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    48
typedef struct upvaldesc {
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    49
  lu_byte k;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    50
  lu_byte info;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    51
} upvaldesc;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    52
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    53
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    54
struct BlockCnt;  /* defined in lparser.c */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    55
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    56
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    57
/* state needed to generate code for a given function */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    58
typedef struct FuncState {
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    59
  Proto *f;  /* current function header */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    60
  Table *h;  /* table to find (and reuse) elements in `k' */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    61
  struct FuncState *prev;  /* enclosing function */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    62
  struct LexState *ls;  /* lexical state */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    63
  struct lua_State *L;  /* copy of the Lua state */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    64
  struct BlockCnt *bl;  /* chain of current blocks */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    65
  int pc;  /* next position to code (equivalent to `ncode') */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    66
  int lasttarget;   /* `pc' of last `jump target' */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    67
  int jpc;  /* list of pending jumps to `pc' */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    68
  int freereg;  /* first free register */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    69
  int nk;  /* number of elements in `k' */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    70
  int np;  /* number of elements in `p' */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    71
  short nlocvars;  /* number of elements in `locvars' */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    72
  lu_byte nactvar;  /* number of active local variables */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    73
  upvaldesc upvalues[LUAI_MAXUPVALUES];  /* upvalues */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    74
  unsigned short actvar[LUAI_MAXVARS];  /* declared-variable stack */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    75
} FuncState;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    76
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    77
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    78
LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    79
                                            const char *name);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    80
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    81
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    82
#endif