From 93683d530dde8ac24bce6a39af36ede9e142bb24 Mon Sep 17 00:00:00 2001 From: Waldemar Celes Date: Fri, 17 Dec 1993 16:53:07 -0200 Subject: LUA YACC syntax and semantics --- lua.stx | 771 ++++++++++++++++++++++++++++++ y_tab.c | 1639 --------------------------------------------------------------- y_tab.h | 35 -- 3 files changed, 771 insertions(+), 1674 deletions(-) create mode 100644 lua.stx delete mode 100644 y_tab.c delete mode 100644 y_tab.h diff --git a/lua.stx b/lua.stx new file mode 100644 index 00000000..dc44cc12 --- /dev/null +++ b/lua.stx @@ -0,0 +1,771 @@ +%{ + +char *rcs_luastx = "$Id: $"; + +#include +#include +#include + +#include "opcode.h" +#include "hash.h" +#include "inout.h" +#include "table.h" +#include "lua.h" + +#ifndef ALIGNMENT +#define ALIGNMENT (sizeof(void *)) +#endif + +#ifndef MAXCODE +#define MAXCODE 1024 +#endif +static long buffer[MAXCODE]; +static Byte *code = (Byte *)buffer; +static long mainbuffer[MAXCODE]; +static Byte *maincode = (Byte *)mainbuffer; +static Byte *basepc; +static Byte *pc; + +#define MAXVAR 32 +static long varbuffer[MAXVAR]; +static Byte nvarbuffer=0; /* number of variables at a list */ + +static Word localvar[STACKGAP]; +static Byte nlocalvar=0; /* number of local variables */ +static int ntemp; /* number of temporary var into stack */ +static int err; /* flag to indicate error */ + +/* Internal functions */ +#define align(n) align_n(sizeof(n)) + +static void code_byte (Byte c) +{ + if (pc-basepc>MAXCODE-1) + { + lua_error ("code buffer overflow"); + err = 1; + } + *pc++ = c; +} + +static void code_word (Word n) +{ + if (pc-basepc>MAXCODE-sizeof(Word)) + { + lua_error ("code buffer overflow"); + err = 1; + } + *((Word *)pc) = n; + pc += sizeof(Word); +} + +static void code_float (float n) +{ + if (pc-basepc>MAXCODE-sizeof(float)) + { + lua_error ("code buffer overflow"); + err = 1; + } + *((float *)pc) = n; + pc += sizeof(float); +} + +static void incr_ntemp (void) +{ + if (ntemp+nlocalvar+MAXVAR+1 < STACKGAP) + ntemp++; + else + { + lua_error ("stack overflow"); + err = 1; + } +} + +static void add_nlocalvar (int n) +{ + if (ntemp+nlocalvar+MAXVAR+n < STACKGAP) + nlocalvar += n; + else + { + lua_error ("too many local variables or expression too complicate"); + err = 1; + } +} + +static void incr_nvarbuffer (void) +{ + if (nvarbuffer < MAXVAR-1) + nvarbuffer++; + else + { + lua_error ("variable buffer overflow"); + err = 1; + } +} + +static void align_n (unsigned size) +{ + if (size > ALIGNMENT) size = ALIGNMENT; + while (((pc+1-code)%size) != 0) /* +1 to include BYTECODE */ + code_byte (NOP); +} + +static void code_number (float f) +{ int i = f; + if (f == i) /* f has an integer value */ + { + if (i <= 2) code_byte(PUSH0 + i); + else if (i <= 255) + { + code_byte(PUSHBYTE); + code_byte(i); + } + else + { + align(Word); + code_byte(PUSHWORD); + code_word(i); + } + } + else + { + align(float); + code_byte(PUSHFLOAT); + code_float(f); + } + incr_ntemp(); +} + +%} + + +%union +{ + int vInt; + long vLong; + float vFloat; + Word vWord; + Byte *pByte; +} + +%start functionlist + +%token NIL +%token IF THEN ELSE ELSEIF WHILE DO REPEAT UNTIL END +%token RETURN +%token LOCAL +%token NUMBER +%token FUNCTION NAME STRING +%token DEBUG + +%type PrepJump +%type expr, exprlist, exprlist1, varlist1, typeconstructor +%type fieldlist, localdeclist +%type ffieldlist, ffieldlist1 +%type lfieldlist, lfieldlist1 +%type var, objectname + + +%left AND OR +%left '=' NE '>' '<' LE GE +%left CONC +%left '+' '-' +%left '*' '/' +%left UNARY NOT + + +%% /* beginning of rules section */ + + +functionlist : /* empty */ + | functionlist {pc=basepc=maincode; nlocalvar=0;} stat sc {maincode=pc;} + | functionlist function + | functionlist setdebug + ; + +function : FUNCTION NAME {pc=basepc=code; nlocalvar=0;} '(' parlist ')' + { + if (lua_debug) + { + align(Word); + code_byte(SETFUNCTION); + code_word($1); + code_word($2); + } + lua_codeadjust (0); + } + block + END + { + if (lua_debug) code_byte(RESET); + code_byte(RETCODE); code_byte(nlocalvar); + s_tag($2) = T_FUNCTION; + s_bvalue($2) = calloc (pc-code, sizeof(Byte)); + memcpy (s_bvalue($2), code, (pc-code)*sizeof(Byte)); + } + ; + +statlist : /* empty */ + | statlist stat sc + ; + +stat : { + ntemp = 0; + if (lua_debug) + { + align(Word); code_byte(SETLINE); code_word(lua_linenumber); + } + } + stat1 + +sc : /* empty */ | ';' ; + + +stat1 : IF expr1 THEN PrepJump block PrepJump elsepart END + { + { + Byte *elseinit = $6 + sizeof(Word)+1; + if (pc - elseinit == 0) /* no else */ + { + pc -= sizeof(Word)+1; + /* if (*(pc-1) == NOP) --pc; */ + elseinit = pc; + } + else + { + *($6) = JMP; + *((Word *)($6+1)) = pc - elseinit; + } + *($4) = IFFJMP; + *((Word *)($4+1)) = elseinit - ($4 + sizeof(Word)+1); + } + } + + | WHILE {$$ = pc;} expr1 DO PrepJump block PrepJump END + + { + *($5) = IFFJMP; + *((Word *)($5+1)) = pc - ($5 + sizeof(Word)+1); + + *($7) = UPJMP; + *((Word *)($7+1)) = pc - $2; + } + + | REPEAT {$$ = pc;} block UNTIL expr1 PrepJump + + { + *($6) = IFFUPJMP; + *((Word *)($6+1)) = pc - $2; + } + + + | varlist1 '=' exprlist1 + { + { + int i; + if ($3 == 0 || nvarbuffer != ntemp - $1 * 2) + lua_codeadjust ($1 * 2 + nvarbuffer); + for (i=nvarbuffer-1; i>=0; i--) + lua_codestore (i); + if ($1 > 1 || ($1 == 1 && varbuffer[0] != 0)) + lua_codeadjust (0); + } + } + | functioncall { lua_codeadjust (0); } + | typeconstructor { lua_codeadjust (0); } + | LOCAL localdeclist decinit { add_nlocalvar($2); lua_codeadjust (0); } + ; + +elsepart : /* empty */ + | ELSE block + | ELSEIF expr1 THEN PrepJump block PrepJump elsepart + { + { + Byte *elseinit = $6 + sizeof(Word)+1; + if (pc - elseinit == 0) /* no else */ + { + pc -= sizeof(Word)+1; + /* if (*(pc-1) == NOP) --pc; */ + elseinit = pc; + } + else + { + *($6) = JMP; + *((Word *)($6+1)) = pc - elseinit; + } + *($4) = IFFJMP; + *((Word *)($4+1)) = elseinit - ($4 + sizeof(Word)+1); + } + } + ; + +block : {$$ = nlocalvar;} statlist {ntemp = 0;} ret + { + if (nlocalvar != $1) + { + nlocalvar = $1; + lua_codeadjust (0); + } + } + ; + +ret : /* empty */ + | { if (lua_debug){align(Word);code_byte(SETLINE);code_word(lua_linenumber);}} + RETURN exprlist sc + { + if (lua_debug) code_byte(RESET); + code_byte(RETCODE); code_byte(nlocalvar); + } + ; + +PrepJump : /* empty */ + { + align(Word); + $$ = pc; + code_byte(0); /* open space */ + code_word (0); + } + +expr1 : expr { if ($1 == 0) {lua_codeadjust (ntemp+1); incr_ntemp();}} + ; + +expr : '(' expr ')' { $$ = $2; } + | expr1 '=' expr1 { code_byte(EQOP); $$ = 1; ntemp--;} + | expr1 '<' expr1 { code_byte(LTOP); $$ = 1; ntemp--;} + | expr1 '>' expr1 { code_byte(LEOP); code_byte(NOTOP); $$ = 1; ntemp--;} + | expr1 NE expr1 { code_byte(EQOP); code_byte(NOTOP); $$ = 1; ntemp--;} + | expr1 LE expr1 { code_byte(LEOP); $$ = 1; ntemp--;} + | expr1 GE expr1 { code_byte(LTOP); code_byte(NOTOP); $$ = 1; ntemp--;} + | expr1 '+' expr1 { code_byte(ADDOP); $$ = 1; ntemp--;} + | expr1 '-' expr1 { code_byte(SUBOP); $$ = 1; ntemp--;} + | expr1 '*' expr1 { code_byte(MULTOP); $$ = 1; ntemp--;} + | expr1 '/' expr1 { code_byte(DIVOP); $$ = 1; ntemp--;} + | expr1 CONC expr1 { code_byte(CONCOP); $$ = 1; ntemp--;} + | '+' expr1 %prec UNARY { $$ = 1; } + | '-' expr1 %prec UNARY { code_byte(MINUSOP); $$ = 1;} + | typeconstructor { $$ = $1; } + | '@' '(' dimension ')' + { + code_byte(CREATEARRAY); + $$ = 1; + } + | var { lua_pushvar ($1); $$ = 1;} + | NUMBER { code_number($1); $$ = 1; } + | STRING + { + align(Word); + code_byte(PUSHSTRING); + code_word($1); + $$ = 1; + incr_ntemp(); + } + | NIL {code_byte(PUSHNIL); $$ = 1; incr_ntemp();} + | functioncall + { + $$ = 0; + if (lua_debug) + { + align(Word); code_byte(SETLINE); code_word(lua_linenumber); + } + } + | NOT expr1 { code_byte(NOTOP); $$ = 1;} + | expr1 AND PrepJump {code_byte(POP); ntemp--;} expr1 + { + *($3) = ONFJMP; + *((Word *)($3+1)) = pc - ($3 + sizeof(Word)+1); + $$ = 1; + } + | expr1 OR PrepJump {code_byte(POP); ntemp--;} expr1 + { + *($3) = ONTJMP; + *((Word *)($3+1)) = pc - ($3 + sizeof(Word)+1); + $$ = 1; + } + ; + +typeconstructor: '@' + { + code_byte(PUSHBYTE); + $$ = pc; code_byte(0); + incr_ntemp(); + code_byte(CREATEARRAY); + } + objectname fieldlist + { + *($2) = $4; + if ($3 < 0) /* there is no function to be called */ + { + $$ = 1; + } + else + { + lua_pushvar ($3+1); + code_byte(PUSHMARK); + incr_ntemp(); + code_byte(PUSHOBJECT); + incr_ntemp(); + code_byte(CALLFUNC); + ntemp -= 4; + $$ = 0; + if (lua_debug) + { + align(Word); code_byte(SETLINE); code_word(lua_linenumber); + } + } + } + ; + +dimension : /* empty */ { code_byte(PUSHNIL); incr_ntemp();} + | expr1 + ; + +functioncall : functionvalue {code_byte(PUSHMARK); $$ = ntemp; incr_ntemp();} + '(' exprlist ')' { code_byte(CALLFUNC); ntemp = $2-1;} + +functionvalue : var {lua_pushvar ($1); } + ; + +exprlist : /* empty */ { $$ = 1; } + | exprlist1 { $$ = $1; } + ; + +exprlist1 : expr { $$ = $1; } + | exprlist1 ',' {if (!$1){lua_codeadjust (ntemp+1); incr_ntemp();}} + expr {$$ = $4;} + ; + +parlist : /* empty */ + | parlist1 + ; + +parlist1 : NAME {localvar[nlocalvar]=$1; add_nlocalvar(1);} + | parlist1 ',' NAME {localvar[nlocalvar]=$3; add_nlocalvar(1);} + ; + +objectname : /* empty */ {$$=-1;} + | NAME {$$=$1;} + ; + +fieldlist : '{' ffieldlist '}' { $$ = $2; } + | '[' lfieldlist ']' { $$ = $2; } + ; + +ffieldlist : /* empty */ { $$ = 0; } + | ffieldlist1 { $$ = $1; } + ; + +ffieldlist1 : ffield {$$=1;} + | ffieldlist1 ',' ffield {$$=$1+1;} + ; + +ffield : NAME + { + align(Word); + code_byte(PUSHSTRING); + code_word(lua_findconstant (s_name($1))); + incr_ntemp(); + } + '=' expr1 + { + code_byte(STOREFIELD); + ntemp-=2; + } + ; + +lfieldlist : /* empty */ { $$ = 0; } + | lfieldlist1 { $$ = $1; } + ; + +lfieldlist1 : { code_number(1); } lfield {$$=1;} + | lfieldlist1 ',' { code_number($1+1); } lfield + {$$=$1+1;} + ; + +lfield : expr1 + { + code_byte(STOREFIELD); + ntemp-=2; + } + ; + +varlist1 : var + { + nvarbuffer = 0; + varbuffer[nvarbuffer] = $1; incr_nvarbuffer(); + $$ = ($1 == 0) ? 1 : 0; + } + | varlist1 ',' var + { + varbuffer[nvarbuffer] = $3; incr_nvarbuffer(); + $$ = ($3 == 0) ? $1 + 1 : $1; + } + ; + +var : NAME + { + int local = lua_localname ($1); + if (local == -1) /* global var */ + $$ = $1 + 1; /* return positive value */ + else + $$ = -(local+1); /* return negative value */ + } + + | var {lua_pushvar ($1);} '[' expr1 ']' + { + $$ = 0; /* indexed variable */ + } + | var {lua_pushvar ($1);} '.' NAME + { + align(Word); + code_byte(PUSHSTRING); + code_word(lua_findconstant (s_name($4))); incr_ntemp(); + $$ = 0; /* indexed variable */ + } + ; + +localdeclist : NAME {localvar[nlocalvar]=$1; $$ = 1;} + | localdeclist ',' NAME {localvar[nlocalvar+$1]=$3; $$ = $1+1;} + ; + +decinit : /* empty */ + | '=' exprlist1 + ; + +setdebug : DEBUG {lua_debug = $1;} + +%% + +/* +** Search a local name and if find return its index. If do not find return -1 +*/ +static int lua_localname (Word n) +{ + int i; + for (i=nlocalvar-1; i >= 0; i--) + if (n == localvar[i]) return i; /* local var */ + return -1; /* global var */ +} + +/* +** Push a variable given a number. If number is positive, push global variable +** indexed by (number -1). If negative, push local indexed by ABS(number)-1. +** Otherwise, if zero, push indexed variable (record). +*/ +static void lua_pushvar (long number) +{ + if (number > 0) /* global var */ + { + align(Word); + code_byte(PUSHGLOBAL); + code_word(number-1); + incr_ntemp(); + } + else if (number < 0) /* local var */ + { + number = (-number) - 1; + if (number < 10) code_byte(PUSHLOCAL0 + number); + else + { + code_byte(PUSHLOCAL); + code_byte(number); + } + incr_ntemp(); + } + else + { + code_byte(PUSHINDEXED); + ntemp--; + } +} + +static void lua_codeadjust (int n) +{ + code_byte(ADJUST); + code_byte(n + nlocalvar); +} + +static void lua_codestore (int i) +{ + if (varbuffer[i] > 0) /* global var */ + { + align(Word); + code_byte(STOREGLOBAL); + code_word(varbuffer[i]-1); + } + else if (varbuffer[i] < 0) /* local var */ + { + int number = (-varbuffer[i]) - 1; + if (number < 10) code_byte(STORELOCAL0 + number); + else + { + code_byte(STORELOCAL); + code_byte(number); + } + } + else /* indexed var */ + { + int j; + int upper=0; /* number of indexed variables upper */ + int param; /* number of itens until indexed expression */ + for (j=i+1; j -#include -#include - -#include "opcode.h" -#include "hash.h" -#include "inout.h" -#include "table.h" -#include "lua.h" - -#ifndef ALIGNMENT -#define ALIGNMENT (sizeof(void *)) -#endif - -#ifndef MAXCODE -#define MAXCODE 1024 -#endif -static long buffer[MAXCODE]; -static Byte *code = (Byte *)buffer; -static long mainbuffer[MAXCODE]; -static Byte *maincode = (Byte *)mainbuffer; -static Byte *basepc; -static Byte *pc; - -#define MAXVAR 32 -static long varbuffer[MAXVAR]; -static Byte nvarbuffer=0; /* number of variables at a list */ - -static Word localvar[STACKGAP]; -static Byte nlocalvar=0; /* number of local variables */ -static int ntemp; /* number of temporary var into stack */ -static int err; /* flag to indicate error */ - -/* Internal functions */ -#define align(n) align_n(sizeof(n)) - -static void code_byte (Byte c) -{ - if (pc-basepc>MAXCODE-1) - { - lua_error ("code buffer overflow"); - err = 1; - } - *pc++ = c; -} - -static void code_word (Word n) -{ - if (pc-basepc>MAXCODE-sizeof(Word)) - { - lua_error ("code buffer overflow"); - err = 1; - } - *((Word *)pc) = n; - pc += sizeof(Word); -} - -static void code_float (float n) -{ - if (pc-basepc>MAXCODE-sizeof(float)) - { - lua_error ("code buffer overflow"); - err = 1; - } - *((float *)pc) = n; - pc += sizeof(float); -} - -static void incr_ntemp (void) -{ - if (ntemp+nlocalvar+MAXVAR+1 < STACKGAP) - ntemp++; - else - { - lua_error ("stack overflow"); - err = 1; - } -} - -static void incr_nlocalvar (void) -{ - if (ntemp+nlocalvar+MAXVAR+1 < STACKGAP) - nlocalvar++; - else - { - lua_error ("too many local variables or expression too complicate"); - err = 1; - } -} - -static void incr_nvarbuffer (void) -{ - if (nvarbuffer < MAXVAR-1) - nvarbuffer++; - else - { - lua_error ("variable buffer overflow"); - err = 1; - } -} - -static void align_n (unsigned size) -{ - if (size > ALIGNMENT) size = ALIGNMENT; - while (((pc+1-code)%size) != 0) /* +1 to include BYTECODE */ - code_byte (NOP); -} - -static void code_number (float f) -{ int i = f; - if (f == i) /* f has an integer value */ - { - if (i <= 2) code_byte(PUSH0 + i); - else if (i <= 255) - { - code_byte(PUSHBYTE); - code_byte(i); - } - else - { - align(Word); - code_byte(PUSHWORD); - code_word(i); - } - } - else - { - align(float); - code_byte(PUSHFLOAT); - code_float(f); - } - incr_ntemp(); -} - - -# line 140 "lua.stx" -typedef union -{ - int vInt; - long vLong; - float vFloat; - Word vWord; - Byte *pByte; -} YYSTYPE; -# define NIL 257 -# define IF 258 -# define THEN 259 -# define ELSE 260 -# define ELSEIF 261 -# define WHILE 262 -# define DO 263 -# define REPEAT 264 -# define UNTIL 265 -# define END 266 -# define RETURN 267 -# define LOCAL 268 -# define NUMBER 269 -# define FUNCTION 270 -# define NAME 271 -# define STRING 272 -# define DEBUG 273 -# define NOT 274 -# define AND 275 -# define OR 276 -# define NE 277 -# define LE 278 -# define GE 279 -# define CONC 280 -# define UNARY 281 -#define yyclearin yychar = -1 -#define yyerrok yyerrflag = 0 -extern int yychar; -extern int yyerrflag; -#ifndef YYMAXDEPTH -#define YYMAXDEPTH 150 -#endif -YYSTYPE yylval, yyval; -# define YYERRCODE 256 - -# line 530 "lua.stx" - - -/* -** Search a local name and if find return its index. If do not find return -1 -*/ -static int lua_localname (Word n) -{ - int i; - for (i=nlocalvar-1; i >= 0; i--) - if (n == localvar[i]) return i; /* local var */ - return -1; /* global var */ -} - -/* -** Push a variable given a number. If number is positive, push global variable -** indexed by (number -1). If negative, push local indexed by ABS(number)-1. -** Otherwise, if zero, push indexed variable (record). -*/ -static void lua_pushvar (long number) -{ - if (number > 0) /* global var */ - { - align(Word); - code_byte(PUSHGLOBAL); - code_word(number-1); - incr_ntemp(); - } - else if (number < 0) /* local var */ - { - number = (-number) - 1; - if (number < 10) code_byte(PUSHLOCAL0 + number); - else - { - code_byte(PUSHLOCAL); - code_byte(number); - } - incr_ntemp(); - } - else - { - code_byte(PUSHINDEXED); - ntemp--; - } -} - -static void lua_codeadjust (int n) -{ - code_byte(ADJUST); - code_byte(n + nlocalvar); -} - -static void lua_codestore (int i) -{ - if (varbuffer[i] > 0) /* global var */ - { - align(Word); - code_byte(STOREGLOBAL); - code_word(varbuffer[i]-1); - } - else if (varbuffer[i] < 0) /* local var */ - { - int number = (-varbuffer[i]) - 1; - if (number < 10) code_byte(STORELOCAL0 + number); - else - { - code_byte(STORELOCAL); - code_byte(number); - } - } - else /* indexed var */ - { - int j; - int upper=0; /* number of indexed variables upper */ - int param; /* number of itens until indexed expression */ - for (j=i+1; j ", 62, - "<", 60, - "LE", 278, - "GE", 279, - "CONC", 280, - "+", 43, - "-", 45, - "*", 42, - "/", 47, - "%", 37, - "UNARY", 281, - "-unknown-", -1 /* ends search */ -}; - -char * yyreds[] = -{ - "-no such reduction-", - "functionlist : /* empty */", - "functionlist : functionlist", - "functionlist : functionlist stat sc", - "functionlist : functionlist function", - "functionlist : functionlist setdebug", - "function : FUNCTION NAME", - "function : FUNCTION NAME '(' parlist ')'", - "function : FUNCTION NAME '(' parlist ')' block END", - "statlist : /* empty */", - "statlist : statlist stat sc", - "stat : /* empty */", - "stat : stat1", - "sc : /* empty */", - "sc : ';'", - "stat1 : IF expr1 THEN PrepJump block PrepJump elsepart END", - "stat1 : WHILE", - "stat1 : WHILE expr1 DO PrepJump block PrepJump END", - "stat1 : REPEAT", - "stat1 : REPEAT block UNTIL expr1 PrepJump", - "stat1 : varlist1 '=' exprlist1", - "stat1 : functioncall", - "stat1 : LOCAL declist", - "elsepart : /* empty */", - "elsepart : ELSE block", - "elsepart : ELSEIF expr1 THEN PrepJump block PrepJump elsepart", - "block : /* empty */", - "block : statlist", - "block : statlist ret", - "ret : /* empty */", - "ret : /* empty */", - "ret : RETURN exprlist sc", - "PrepJump : /* empty */", - "expr1 : expr", - "expr : '(' expr ')'", - "expr : expr1 '=' expr1", - "expr : expr1 '<' expr1", - "expr : expr1 '>' expr1", - "expr : expr1 NE expr1", - "expr : expr1 LE expr1", - "expr : expr1 GE expr1", - "expr : expr1 '+' expr1", - "expr : expr1 '-' expr1", - "expr : expr1 '*' expr1", - "expr : expr1 '/' expr1", - "expr : expr1 CONC expr1", - "expr : '+' expr1", - "expr : '-' expr1", - "expr : '@'", - "expr : '@' objectname fieldlist", - "expr : '@' '(' dimension ')'", - "expr : var", - "expr : NUMBER", - "expr : STRING", - "expr : NIL", - "expr : functioncall", - "expr : NOT expr1", - "expr : expr1 AND PrepJump", - "expr : expr1 AND PrepJump expr1", - "expr : expr1 OR PrepJump", - "expr : expr1 OR PrepJump expr1", - "dimension : /* empty */", - "dimension : expr1", - "functioncall : functionvalue", - "functioncall : functionvalue '(' exprlist ')'", - "functionvalue : var", - "exprlist : /* empty */", - "exprlist : exprlist1", - "exprlist1 : expr", - "exprlist1 : exprlist1 ','", - "exprlist1 : exprlist1 ',' expr", - "parlist : /* empty */", - "parlist : parlist1", - "parlist1 : NAME", - "parlist1 : parlist1 ',' NAME", - "objectname : /* empty */", - "objectname : NAME", - "fieldlist : '{' ffieldlist '}'", - "fieldlist : '[' lfieldlist ']'", - "ffieldlist : /* empty */", - "ffieldlist : ffieldlist1", - "ffieldlist1 : ffield", - "ffieldlist1 : ffieldlist1 ',' ffield", - "ffield : NAME", - "ffield : NAME '=' expr1", - "lfieldlist : /* empty */", - "lfieldlist : lfieldlist1", - "lfieldlist1 : /* empty */", - "lfieldlist1 : lfield", - "lfieldlist1 : lfieldlist1 ','", - "lfieldlist1 : lfieldlist1 ',' lfield", - "lfield : expr1", - "varlist1 : var", - "varlist1 : varlist1 ',' var", - "var : NAME", - "var : var", - "var : var '[' expr1 ']'", - "var : var", - "var : var '.' NAME", - "declist : NAME init", - "declist : declist ',' NAME init", - "init : /* empty */", - "init : '='", - "init : '=' expr1", - "setdebug : DEBUG", -}; -#endif /* YYDEBUG */ -#line 1 "/usr/lib/yaccpar" -/* @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10 */ - -/* -** Skeleton parser driver for yacc output -*/ - -/* -** yacc user known macros and defines -*/ -#define YYERROR goto yyerrlab -#define YYACCEPT { free(yys); free(yyv); return(0); } -#define YYABORT { free(yys); free(yyv); return(1); } -#define YYBACKUP( newtoken, newvalue )\ -{\ - if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ - {\ - yyerror( "syntax error - cannot backup" );\ - goto yyerrlab;\ - }\ - yychar = newtoken;\ - yystate = *yyps;\ - yylval = newvalue;\ - goto yynewstate;\ -} -#define YYRECOVERING() (!!yyerrflag) -#ifndef YYDEBUG -# define YYDEBUG 1 /* make debugging available */ -#endif - -/* -** user known globals -*/ -int yydebug; /* set to 1 to get debugging */ - -/* -** driver internal defines -*/ -#define YYFLAG (-1000) - -/* -** static variables used by the parser -*/ -static YYSTYPE *yyv; /* value stack */ -static int *yys; /* state stack */ - -static YYSTYPE *yypv; /* top of value stack */ -static int *yyps; /* top of state stack */ - -static int yystate; /* current state */ -static int yytmp; /* extra var (lasts between blocks) */ - -int yynerrs; /* number of errors */ - -int yyerrflag; /* error recovery flag */ -int yychar; /* current input token number */ - - -/* -** yyparse - return 0 if worked, 1 if syntax error not recovered from -*/ -int -yyparse() -{ - register YYSTYPE *yypvt; /* top of value stack for $vars */ - unsigned yymaxdepth = YYMAXDEPTH; - - /* - ** Initialize externals - yyparse may be called more than once - */ - yyv = (YYSTYPE*)malloc(yymaxdepth*sizeof(YYSTYPE)); - yys = (int*)malloc(yymaxdepth*sizeof(int)); - if (!yyv || !yys) - { - yyerror( "out of memory" ); - return(1); - } - yypv = &yyv[-1]; - yyps = &yys[-1]; - yystate = 0; - yytmp = 0; - yynerrs = 0; - yyerrflag = 0; - yychar = -1; - - goto yystack; - { - register YYSTYPE *yy_pv; /* top of value stack */ - register int *yy_ps; /* top of state stack */ - register int yy_state; /* current state */ - register int yy_n; /* internal state number info */ - - /* - ** get globals into registers. - ** branch to here only if YYBACKUP was called. - */ - yynewstate: - yy_pv = yypv; - yy_ps = yyps; - yy_state = yystate; - goto yy_newstate; - - /* - ** get globals into registers. - ** either we just started, or we just finished a reduction - */ - yystack: - yy_pv = yypv; - yy_ps = yyps; - yy_state = yystate; - - /* - ** top of for (;;) loop while no reductions done - */ - yy_stack: - /* - ** put a state and value onto the stacks - */ -#if YYDEBUG - /* - ** if debugging, look up token value in list of value vs. - ** name pairs. 0 and negative (-1) are special values. - ** Note: linear search is used since time is not a real - ** consideration while debugging. - */ - if ( yydebug ) - { - register int yy_i; - - (void)printf( "State %d, token ", yy_state ); - if ( yychar == 0 ) - (void)printf( "end-of-file\n" ); - else if ( yychar < 0 ) - (void)printf( "-none-\n" ); - else - { - for ( yy_i = 0; yytoks[yy_i].t_val >= 0; - yy_i++ ) - { - if ( yytoks[yy_i].t_val == yychar ) - break; - } - (void)printf( "%s\n", yytoks[yy_i].t_name ); - } - } -#endif /* YYDEBUG */ - if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */ - { - /* - ** reallocate and recover. Note that pointers - ** have to be reset, or bad things will happen - */ - int yyps_index = (yy_ps - yys); - int yypv_index = (yy_pv - yyv); - int yypvt_index = (yypvt - yyv); - yymaxdepth += YYMAXDEPTH; - yyv = (YYSTYPE*)realloc((char*)yyv, - yymaxdepth * sizeof(YYSTYPE)); - yys = (int*)realloc((char*)yys, - yymaxdepth * sizeof(int)); - if (!yyv || !yys) - { - yyerror( "yacc stack overflow" ); - return(1); - } - yy_ps = yys + yyps_index; - yy_pv = yyv + yypv_index; - yypvt = yyv + yypvt_index; - } - *yy_ps = yy_state; - *++yy_pv = yyval; - - /* - ** we have a new state - find out what to do - */ - yy_newstate: - if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG ) - goto yydefault; /* simple state */ -#if YYDEBUG - /* - ** if debugging, need to mark whether new token grabbed - */ - yytmp = yychar < 0; -#endif - if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) ) - yychar = 0; /* reached EOF */ -#if YYDEBUG - if ( yydebug && yytmp ) - { - register int yy_i; - - (void)printf( "Received token " ); - if ( yychar == 0 ) - (void)printf( "end-of-file\n" ); - else if ( yychar < 0 ) - (void)printf( "-none-\n" ); - else - { - for ( yy_i = 0; yytoks[yy_i].t_val >= 0; - yy_i++ ) - { - if ( yytoks[yy_i].t_val == yychar ) - break; - } - (void)printf( "%s\n", yytoks[yy_i].t_name ); - } - } -#endif /* YYDEBUG */ - if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) ) - goto yydefault; - if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/ - { - yychar = -1; - yyval = yylval; - yy_state = yy_n; - if ( yyerrflag > 0 ) - yyerrflag--; - goto yy_stack; - } - - yydefault: - if ( ( yy_n = yydef[ yy_state ] ) == -2 ) - { -#if YYDEBUG - yytmp = yychar < 0; -#endif - if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) ) - yychar = 0; /* reached EOF */ -#if YYDEBUG - if ( yydebug && yytmp ) - { - register int yy_i; - - (void)printf( "Received token " ); - if ( yychar == 0 ) - (void)printf( "end-of-file\n" ); - else if ( yychar < 0 ) - (void)printf( "-none-\n" ); - else - { - for ( yy_i = 0; - yytoks[yy_i].t_val >= 0; - yy_i++ ) - { - if ( yytoks[yy_i].t_val - == yychar ) - { - break; - } - } - (void)printf( "%s\n", yytoks[yy_i].t_name ); - } - } -#endif /* YYDEBUG */ - /* - ** look through exception table - */ - { - register int *yyxi = yyexca; - - while ( ( *yyxi != -1 ) || - ( yyxi[1] != yy_state ) ) - { - yyxi += 2; - } - while ( ( *(yyxi += 2) >= 0 ) && - ( *yyxi != yychar ) ) - ; - if ( ( yy_n = yyxi[1] ) < 0 ) - YYACCEPT; - } - } - - /* - ** check for syntax error - */ - if ( yy_n == 0 ) /* have an error */ - { - /* no worry about speed here! */ - switch ( yyerrflag ) - { - case 0: /* new error */ - yyerror( "syntax error" ); - goto skip_init; - yyerrlab: - /* - ** get globals into registers. - ** we have a user generated syntax type error - */ - yy_pv = yypv; - yy_ps = yyps; - yy_state = yystate; - yynerrs++; - skip_init: - case 1: - case 2: /* incompletely recovered error */ - /* try again... */ - yyerrflag = 3; - /* - ** find state where "error" is a legal - ** shift action - */ - while ( yy_ps >= yys ) - { - yy_n = yypact[ *yy_ps ] + YYERRCODE; - if ( yy_n >= 0 && yy_n < YYLAST && - yychk[yyact[yy_n]] == YYERRCODE) { - /* - ** simulate shift of "error" - */ - yy_state = yyact[ yy_n ]; - goto yy_stack; - } - /* - ** current state has no shift on - ** "error", pop stack - */ -#if YYDEBUG -# define _POP_ "Error recovery pops state %d, uncovers state %d\n" - if ( yydebug ) - (void)printf( _POP_, *yy_ps, - yy_ps[-1] ); -# undef _POP_ -#endif - yy_ps--; - yy_pv--; - } - /* - ** there is no state on stack with "error" as - ** a valid shift. give up. - */ - YYABORT; - case 3: /* no shift yet; eat a token */ -#if YYDEBUG - /* - ** if debugging, look up token in list of - ** pairs. 0 and negative shouldn't occur, - ** but since timing doesn't matter when - ** debugging, it doesn't hurt to leave the - ** tests here. - */ - if ( yydebug ) - { - register int yy_i; - - (void)printf( "Error recovery discards " ); - if ( yychar == 0 ) - (void)printf( "token end-of-file\n" ); - else if ( yychar < 0 ) - (void)printf( "token -none-\n" ); - else - { - for ( yy_i = 0; - yytoks[yy_i].t_val >= 0; - yy_i++ ) - { - if ( yytoks[yy_i].t_val - == yychar ) - { - break; - } - } - (void)printf( "token %s\n", - yytoks[yy_i].t_name ); - } - } -#endif /* YYDEBUG */ - if ( yychar == 0 ) /* reached EOF. quit */ - YYABORT; - yychar = -1; - goto yy_newstate; - } - }/* end if ( yy_n == 0 ) */ - /* - ** reduction by production yy_n - ** put stack tops, etc. so things right after switch - */ -#if YYDEBUG - /* - ** if debugging, print the string that is the user's - ** specification of the reduction which is just about - ** to be done. - */ - if ( yydebug ) - (void)printf( "Reduce by (%d) \"%s\"\n", - yy_n, yyreds[ yy_n ] ); -#endif - yytmp = yy_n; /* value to switch over */ - yypvt = yy_pv; /* $vars top of value stack */ - /* - ** Look in goto table for next state - ** Sorry about using yy_state here as temporary - ** register variable, but why not, if it works... - ** If yyr2[ yy_n ] doesn't have the low order bit - ** set, then there is no action to be done for - ** this reduction. So, no saving & unsaving of - ** registers done. The only difference between the - ** code just after the if and the body of the if is - ** the goto yy_stack in the body. This way the test - ** can be made before the choice of what to do is needed. - */ - { - /* length of production doubled with extra bit */ - register int yy_len = yyr2[ yy_n ]; - - if ( !( yy_len & 01 ) ) - { - yy_len >>= 1; - yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ - yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + - *( yy_ps -= yy_len ) + 1; - if ( yy_state >= YYLAST || - yychk[ yy_state = - yyact[ yy_state ] ] != -yy_n ) - { - yy_state = yyact[ yypgo[ yy_n ] ]; - } - goto yy_stack; - } - yy_len >>= 1; - yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ - yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + - *( yy_ps -= yy_len ) + 1; - if ( yy_state >= YYLAST || - yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) - { - yy_state = yyact[ yypgo[ yy_n ] ]; - } - } - /* save until reenter driver code */ - yystate = yy_state; - yyps = yy_ps; - yypv = yy_pv; - } - /* - ** code supplied by user is placed in this switch - */ - switch( yytmp ) - { - -case 2: -# line 179 "lua.stx" -{pc=basepc=maincode; nlocalvar=0;} break; -case 3: -# line 179 "lua.stx" -{maincode=pc;} break; -case 6: -# line 184 "lua.stx" -{pc=basepc=code; nlocalvar=0;} break; -case 7: -# line 185 "lua.stx" -{ - if (lua_debug) - { - align(Word); - code_byte(SETFUNCTION); - code_word(yypvt[-5].vWord); - code_word(yypvt[-4].vWord); - } - lua_codeadjust (0); - } break; -case 8: -# line 197 "lua.stx" -{ - if (lua_debug) code_byte(RESET); - code_byte(RETCODE); code_byte(nlocalvar); - s_tag(yypvt[-7].vWord) = T_FUNCTION; - s_bvalue(yypvt[-7].vWord) = calloc (pc-code, sizeof(Byte)); - memcpy (s_bvalue(yypvt[-7].vWord), code, (pc-code)*sizeof(Byte)); - } break; -case 11: -# line 210 "lua.stx" -{ - ntemp = 0; - if (lua_debug) - { - align(Word); code_byte(SETLINE); code_word(lua_linenumber); - } - } break; -case 15: -# line 223 "lua.stx" -{ - { - Byte *elseinit = yypvt[-2].pByte + sizeof(Word)+1; - if (pc - elseinit == 0) /* no else */ - { - pc -= sizeof(Word)+1; - /* if (*(pc-1) == NOP) --pc; */ - elseinit = pc; - } - else - { - *(yypvt[-2].pByte) = JMP; - *((Word *)(yypvt[-2].pByte+1)) = pc - elseinit; - } - *(yypvt[-4].pByte) = IFFJMP; - *((Word *)(yypvt[-4].pByte+1)) = elseinit - (yypvt[-4].pByte + sizeof(Word)+1); - } - } break; -case 16: -# line 242 "lua.stx" -{yyval.pByte = pc;} break; -case 17: -# line 244 "lua.stx" -{ - *(yypvt[-3].pByte) = IFFJMP; - *((Word *)(yypvt[-3].pByte+1)) = pc - (yypvt[-3].pByte + sizeof(Word)+1); - - *(yypvt[-1].pByte) = UPJMP; - *((Word *)(yypvt[-1].pByte+1)) = pc - yypvt[-6].pByte; - } break; -case 18: -# line 252 "lua.stx" -{yyval.pByte = pc;} break; -case 19: -# line 254 "lua.stx" -{ - *(yypvt[-0].pByte) = IFFUPJMP; - *((Word *)(yypvt[-0].pByte+1)) = pc - yypvt[-4].pByte; - } break; -case 20: -# line 261 "lua.stx" -{ - { - int i; - if (yypvt[-0].vInt == 0 || nvarbuffer != ntemp - yypvt[-2].vInt * 2) - lua_codeadjust (yypvt[-2].vInt * 2 + nvarbuffer); - for (i=nvarbuffer-1; i>=0; i--) - lua_codestore (i); - if (yypvt[-2].vInt > 1 || (yypvt[-2].vInt == 1 && varbuffer[0] != 0)) - lua_codeadjust (0); - } - } break; -case 21: -# line 272 "lua.stx" -{ lua_codeadjust (0); } break; -case 25: -# line 279 "lua.stx" -{ - { - Byte *elseinit = yypvt[-1].pByte + sizeof(Word)+1; - if (pc - elseinit == 0) /* no else */ - { - pc -= sizeof(Word)+1; - /* if (*(pc-1) == NOP) --pc; */ - elseinit = pc; - } - else - { - *(yypvt[-1].pByte) = JMP; - *((Word *)(yypvt[-1].pByte+1)) = pc - elseinit; - } - *(yypvt[-3].pByte) = IFFJMP; - *((Word *)(yypvt[-3].pByte+1)) = elseinit - (yypvt[-3].pByte + sizeof(Word)+1); - } - } break; -case 26: -# line 299 "lua.stx" -{yyval.vInt = nlocalvar;} break; -case 27: -# line 299 "lua.stx" -{ntemp = 0;} break; -case 28: -# line 300 "lua.stx" -{ - if (nlocalvar != yypvt[-3].vInt) - { - nlocalvar = yypvt[-3].vInt; - lua_codeadjust (0); - } - } break; -case 30: -# line 310 "lua.stx" -{ if (lua_debug){align(Word);code_byte(SETLINE);code_word(lua_linenumber);}} break; -case 31: -# line 312 "lua.stx" -{ - if (lua_debug) code_byte(RESET); - code_byte(RETCODE); code_byte(nlocalvar); - } break; -case 32: -# line 319 "lua.stx" -{ - align(Word); - yyval.pByte = pc; - code_byte(0); /* open space */ - code_word (0); - } break; -case 33: -# line 326 "lua.stx" -{ if (yypvt[-0].vInt == 0) {lua_codeadjust (ntemp+1); incr_ntemp();}} break; -case 34: -# line 329 "lua.stx" -{ yyval.vInt = yypvt[-1].vInt; } break; -case 35: -# line 330 "lua.stx" -{ code_byte(EQOP); yyval.vInt = 1; ntemp--;} break; -case 36: -# line 331 "lua.stx" -{ code_byte(LTOP); yyval.vInt = 1; ntemp--;} break; -case 37: -# line 332 "lua.stx" -{ code_byte(LEOP); code_byte(NOTOP); yyval.vInt = 1; ntemp--;} break; -case 38: -# line 333 "lua.stx" -{ code_byte(EQOP); code_byte(NOTOP); yyval.vInt = 1; ntemp--;} break; -case 39: -# line 334 "lua.stx" -{ code_byte(LEOP); yyval.vInt = 1; ntemp--;} break; -case 40: -# line 335 "lua.stx" -{ code_byte(LTOP); code_byte(NOTOP); yyval.vInt = 1; ntemp--;} break; -case 41: -# line 336 "lua.stx" -{ code_byte(ADDOP); yyval.vInt = 1; ntemp--;} break; -case 42: -# line 337 "lua.stx" -{ code_byte(SUBOP); yyval.vInt = 1; ntemp--;} break; -case 43: -# line 338 "lua.stx" -{ code_byte(MULTOP); yyval.vInt = 1; ntemp--;} break; -case 44: -# line 339 "lua.stx" -{ code_byte(DIVOP); yyval.vInt = 1; ntemp--;} break; -case 45: -# line 340 "lua.stx" -{ code_byte(CONCOP); yyval.vInt = 1; ntemp--;} break; -case 46: -# line 341 "lua.stx" -{ yyval.vInt = 1; } break; -case 47: -# line 342 "lua.stx" -{ code_byte(MINUSOP); yyval.vInt = 1;} break; -case 48: -# line 344 "lua.stx" -{ - code_byte(PUSHBYTE); - yyval.pByte = pc; code_byte(0); - incr_ntemp(); - code_byte(CREATEARRAY); - } break; -case 49: -# line 351 "lua.stx" -{ - *(yypvt[-2].pByte) = yypvt[-0].vInt; - if (yypvt[-1].vLong < 0) /* there is no function to be called */ - { - yyval.vInt = 1; - } - else - { - lua_pushvar (yypvt[-1].vLong+1); - code_byte(PUSHMARK); - incr_ntemp(); - code_byte(PUSHOBJECT); - incr_ntemp(); - code_byte(CALLFUNC); - ntemp -= 4; - yyval.vInt = 0; - if (lua_debug) - { - align(Word); code_byte(SETLINE); code_word(lua_linenumber); - } - } - } break; -case 50: -# line 374 "lua.stx" -{ - code_byte(CREATEARRAY); - yyval.vInt = 1; - } break; -case 51: -# line 378 "lua.stx" -{ lua_pushvar (yypvt[-0].vLong); yyval.vInt = 1;} break; -case 52: -# line 379 "lua.stx" -{ code_number(yypvt[-0].vFloat); yyval.vInt = 1; } break; -case 53: -# line 381 "lua.stx" -{ - align(Word); - code_byte(PUSHSTRING); - code_word(yypvt[-0].vWord); - yyval.vInt = 1; - incr_ntemp(); - } break; -case 54: -# line 388 "lua.stx" -{code_byte(PUSHNIL); yyval.vInt = 1; incr_ntemp();} break; -case 55: -# line 390 "lua.stx" -{ - yyval.vInt = 0; - if (lua_debug) - { - align(Word); code_byte(SETLINE); code_word(lua_linenumber); - } - } break; -case 56: -# line 397 "lua.stx" -{ code_byte(NOTOP); yyval.vInt = 1;} break; -case 57: -# line 398 "lua.stx" -{code_byte(POP); ntemp--;} break; -case 58: -# line 399 "lua.stx" -{ - *(yypvt[-2].pByte) = ONFJMP; - *((Word *)(yypvt[-2].pByte+1)) = pc - (yypvt[-2].pByte + sizeof(Word)+1); - yyval.vInt = 1; - } break; -case 59: -# line 404 "lua.stx" -{code_byte(POP); ntemp--;} break; -case 60: -# line 405 "lua.stx" -{ - *(yypvt[-2].pByte) = ONTJMP; - *((Word *)(yypvt[-2].pByte+1)) = pc - (yypvt[-2].pByte + sizeof(Word)+1); - yyval.vInt = 1; - } break; -case 61: -# line 412 "lua.stx" -{ code_byte(PUSHNIL); incr_ntemp();} break; -case 63: -# line 416 "lua.stx" -{code_byte(PUSHMARK); yyval.vInt = ntemp; incr_ntemp();} break; -case 64: -# line 417 "lua.stx" -{ code_byte(CALLFUNC); ntemp = yypvt[-3].vInt-1;} break; -case 65: -# line 419 "lua.stx" -{lua_pushvar (yypvt[-0].vLong); } break; -case 66: -# line 422 "lua.stx" -{ yyval.vInt = 1; } break; -case 67: -# line 423 "lua.stx" -{ yyval.vInt = yypvt[-0].vInt; } break; -case 68: -# line 426 "lua.stx" -{ yyval.vInt = yypvt[-0].vInt; } break; -case 69: -# line 427 "lua.stx" -{if (!yypvt[-1].vInt){lua_codeadjust (ntemp+1); incr_ntemp();}} break; -case 70: -# line 428 "lua.stx" -{yyval.vInt = yypvt[-0].vInt;} break; -case 73: -# line 435 "lua.stx" -{localvar[nlocalvar]=yypvt[-0].vWord; incr_nlocalvar();} break; -case 74: -# line 436 "lua.stx" -{localvar[nlocalvar]=yypvt[-0].vWord; incr_nlocalvar();} break; -case 75: -# line 439 "lua.stx" -{yyval.vLong=-1;} break; -case 76: -# line 440 "lua.stx" -{yyval.vLong=yypvt[-0].vWord;} break; -case 77: -# line 443 "lua.stx" -{ yyval.vInt = yypvt[-1].vInt; } break; -case 78: -# line 444 "lua.stx" -{ yyval.vInt = yypvt[-1].vInt; } break; -case 79: -# line 447 "lua.stx" -{ yyval.vInt = 0; } break; -case 80: -# line 448 "lua.stx" -{ yyval.vInt = yypvt[-0].vInt; } break; -case 81: -# line 451 "lua.stx" -{yyval.vInt=1;} break; -case 82: -# line 452 "lua.stx" -{yyval.vInt=yypvt[-2].vInt+1;} break; -case 83: -# line 456 "lua.stx" -{ - align(Word); - code_byte(PUSHSTRING); - code_word(lua_findconstant (s_name(yypvt[-0].vWord))); - incr_ntemp(); - } break; -case 84: -# line 463 "lua.stx" -{ - code_byte(STOREFIELD); - ntemp-=2; - } break; -case 85: -# line 469 "lua.stx" -{ yyval.vInt = 0; } break; -case 86: -# line 470 "lua.stx" -{ yyval.vInt = yypvt[-0].vInt; } break; -case 87: -# line 473 "lua.stx" -{ code_number(1); } break; -case 88: -# line 473 "lua.stx" -{yyval.vInt=1;} break; -case 89: -# line 474 "lua.stx" -{ code_number(yypvt[-1].vInt+1); } break; -case 90: -# line 475 "lua.stx" -{yyval.vInt=yypvt[-3].vInt+1;} break; -case 91: -# line 479 "lua.stx" -{ - code_byte(STOREFIELD); - ntemp-=2; - } break; -case 92: -# line 486 "lua.stx" -{ - nvarbuffer = 0; - varbuffer[nvarbuffer] = yypvt[-0].vLong; incr_nvarbuffer(); - yyval.vInt = (yypvt[-0].vLong == 0) ? 1 : 0; - } break; -case 93: -# line 492 "lua.stx" -{ - varbuffer[nvarbuffer] = yypvt[-0].vLong; incr_nvarbuffer(); - yyval.vInt = (yypvt[-0].vLong == 0) ? yypvt[-2].vInt + 1 : yypvt[-2].vInt; - } break; -case 94: -# line 499 "lua.stx" -{ - int local = lua_localname (yypvt[-0].vWord); - if (local == -1) /* global var */ - yyval.vLong = yypvt[-0].vWord + 1; /* return positive value */ - else - yyval.vLong = -(local+1); /* return negative value */ - } break; -case 95: -# line 507 "lua.stx" -{lua_pushvar (yypvt[-0].vLong);} break; -case 96: -# line 508 "lua.stx" -{ - yyval.vLong = 0; /* indexed variable */ - } break; -case 97: -# line 511 "lua.stx" -{lua_pushvar (yypvt[-0].vLong);} break; -case 98: -# line 512 "lua.stx" -{ - align(Word); - code_byte(PUSHSTRING); - code_word(lua_findconstant (s_name(yypvt[-0].vWord))); incr_ntemp(); - yyval.vLong = 0; /* indexed variable */ - } break; -case 99: -# line 520 "lua.stx" -{localvar[nlocalvar]=yypvt[-1].vWord; incr_nlocalvar();} break; -case 100: -# line 521 "lua.stx" -{localvar[nlocalvar]=yypvt[-1].vWord; incr_nlocalvar();} break; -case 101: -# line 524 "lua.stx" -{ code_byte(PUSHNIL); } break; -case 102: -# line 525 "lua.stx" -{ntemp = 0;} break; -case 104: -# line 528 "lua.stx" -{lua_debug = yypvt[-0].vInt;} break; - } - goto yystack; /* reset registers in driver code */ -} diff --git a/y_tab.h b/y_tab.h deleted file mode 100644 index b973d540..00000000 --- a/y_tab.h +++ /dev/null @@ -1,35 +0,0 @@ - -typedef union -{ - int vInt; - long vLong; - float vFloat; - Word vWord; - Byte *pByte; -} YYSTYPE; -extern YYSTYPE yylval; -# define NIL 257 -# define IF 258 -# define THEN 259 -# define ELSE 260 -# define ELSEIF 261 -# define WHILE 262 -# define DO 263 -# define REPEAT 264 -# define UNTIL 265 -# define END 266 -# define RETURN 267 -# define LOCAL 268 -# define NUMBER 269 -# define FUNCTION 270 -# define NAME 271 -# define STRING 272 -# define DEBUG 273 -# define NOT 274 -# define AND 275 -# define OR 276 -# define NE 277 -# define LE 278 -# define GE 279 -# define CONC 280 -# define UNARY 281 -- cgit v1.2.3-55-g6feb