aboutsummaryrefslogtreecommitdiff
path: root/y_tab.c
diff options
context:
space:
mode:
authorWaldemar Celes <celes@tecgraf.puc-rio.br>1993-12-17 16:53:07 -0200
committerWaldemar Celes <celes@tecgraf.puc-rio.br>1993-12-17 16:53:07 -0200
commit93683d530dde8ac24bce6a39af36ede9e142bb24 (patch)
treef128cfce42f01f8f21f4dee92d92c5109fe38596 /y_tab.c
parent4478f0ce92861e526b35e8889a8ce2706fc78fd1 (diff)
downloadlua-93683d530dde8ac24bce6a39af36ede9e142bb24.tar.gz
lua-93683d530dde8ac24bce6a39af36ede9e142bb24.tar.bz2
lua-93683d530dde8ac24bce6a39af36ede9e142bb24.zip
LUA YACC syntax and semantics
Diffstat (limited to 'y_tab.c')
-rw-r--r--y_tab.c1639
1 files changed, 0 insertions, 1639 deletions
diff --git a/y_tab.c b/y_tab.c
deleted file mode 100644
index d34d2147..00000000
--- a/y_tab.c
+++ /dev/null
@@ -1,1639 +0,0 @@
1# line 2 "lua.stx"
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <string.h>
6
7#include "opcode.h"
8#include "hash.h"
9#include "inout.h"
10#include "table.h"
11#include "lua.h"
12
13#ifndef ALIGNMENT
14#define ALIGNMENT (sizeof(void *))
15#endif
16
17#ifndef MAXCODE
18#define MAXCODE 1024
19#endif
20static long buffer[MAXCODE];
21static Byte *code = (Byte *)buffer;
22static long mainbuffer[MAXCODE];
23static Byte *maincode = (Byte *)mainbuffer;
24static Byte *basepc;
25static Byte *pc;
26
27#define MAXVAR 32
28static long varbuffer[MAXVAR];
29static Byte nvarbuffer=0; /* number of variables at a list */
30
31static Word localvar[STACKGAP];
32static Byte nlocalvar=0; /* number of local variables */
33static int ntemp; /* number of temporary var into stack */
34static int err; /* flag to indicate error */
35
36/* Internal functions */
37#define align(n) align_n(sizeof(n))
38
39static void code_byte (Byte c)
40{
41 if (pc-basepc>MAXCODE-1)
42 {
43 lua_error ("code buffer overflow");
44 err = 1;
45 }
46 *pc++ = c;
47}
48
49static void code_word (Word n)
50{
51 if (pc-basepc>MAXCODE-sizeof(Word))
52 {
53 lua_error ("code buffer overflow");
54 err = 1;
55 }
56 *((Word *)pc) = n;
57 pc += sizeof(Word);
58}
59
60static void code_float (float n)
61{
62 if (pc-basepc>MAXCODE-sizeof(float))
63 {
64 lua_error ("code buffer overflow");
65 err = 1;
66 }
67 *((float *)pc) = n;
68 pc += sizeof(float);
69}
70
71static void incr_ntemp (void)
72{
73 if (ntemp+nlocalvar+MAXVAR+1 < STACKGAP)
74 ntemp++;
75 else
76 {
77 lua_error ("stack overflow");
78 err = 1;
79 }
80}
81
82static void incr_nlocalvar (void)
83{
84 if (ntemp+nlocalvar+MAXVAR+1 < STACKGAP)
85 nlocalvar++;
86 else
87 {
88 lua_error ("too many local variables or expression too complicate");
89 err = 1;
90 }
91}
92
93static void incr_nvarbuffer (void)
94{
95 if (nvarbuffer < MAXVAR-1)
96 nvarbuffer++;
97 else
98 {
99 lua_error ("variable buffer overflow");
100 err = 1;
101 }
102}
103
104static void align_n (unsigned size)
105{
106 if (size > ALIGNMENT) size = ALIGNMENT;
107 while (((pc+1-code)%size) != 0) /* +1 to include BYTECODE */
108 code_byte (NOP);
109}
110
111static void code_number (float f)
112{ int i = f;
113 if (f == i) /* f has an integer value */
114 {
115 if (i <= 2) code_byte(PUSH0 + i);
116 else if (i <= 255)
117 {
118 code_byte(PUSHBYTE);
119 code_byte(i);
120 }
121 else
122 {
123 align(Word);
124 code_byte(PUSHWORD);
125 code_word(i);
126 }
127 }
128 else
129 {
130 align(float);
131 code_byte(PUSHFLOAT);
132 code_float(f);
133 }
134 incr_ntemp();
135}
136
137
138# line 140 "lua.stx"
139typedef union
140{
141 int vInt;
142 long vLong;
143 float vFloat;
144 Word vWord;
145 Byte *pByte;
146} YYSTYPE;
147# define NIL 257
148# define IF 258
149# define THEN 259
150# define ELSE 260
151# define ELSEIF 261
152# define WHILE 262
153# define DO 263
154# define REPEAT 264
155# define UNTIL 265
156# define END 266
157# define RETURN 267
158# define LOCAL 268
159# define NUMBER 269
160# define FUNCTION 270
161# define NAME 271
162# define STRING 272
163# define DEBUG 273
164# define NOT 274
165# define AND 275
166# define OR 276
167# define NE 277
168# define LE 278
169# define GE 279
170# define CONC 280
171# define UNARY 281
172#define yyclearin yychar = -1
173#define yyerrok yyerrflag = 0
174extern int yychar;
175extern int yyerrflag;
176#ifndef YYMAXDEPTH
177#define YYMAXDEPTH 150
178#endif
179YYSTYPE yylval, yyval;
180# define YYERRCODE 256
181
182# line 530 "lua.stx"
183
184
185/*
186** Search a local name and if find return its index. If do not find return -1
187*/
188static int lua_localname (Word n)
189{
190 int i;
191 for (i=nlocalvar-1; i >= 0; i--)
192 if (n == localvar[i]) return i; /* local var */
193 return -1; /* global var */
194}
195
196/*
197** Push a variable given a number. If number is positive, push global variable
198** indexed by (number -1). If negative, push local indexed by ABS(number)-1.
199** Otherwise, if zero, push indexed variable (record).
200*/
201static void lua_pushvar (long number)
202{
203 if (number > 0) /* global var */
204 {
205 align(Word);
206 code_byte(PUSHGLOBAL);
207 code_word(number-1);
208 incr_ntemp();
209 }
210 else if (number < 0) /* local var */
211 {
212 number = (-number) - 1;
213 if (number < 10) code_byte(PUSHLOCAL0 + number);
214 else
215 {
216 code_byte(PUSHLOCAL);
217 code_byte(number);
218 }
219 incr_ntemp();
220 }
221 else
222 {
223 code_byte(PUSHINDEXED);
224 ntemp--;
225 }
226}
227
228static void lua_codeadjust (int n)
229{
230 code_byte(ADJUST);
231 code_byte(n + nlocalvar);
232}
233
234static void lua_codestore (int i)
235{
236 if (varbuffer[i] > 0) /* global var */
237 {
238 align(Word);
239 code_byte(STOREGLOBAL);
240 code_word(varbuffer[i]-1);
241 }
242 else if (varbuffer[i] < 0) /* local var */
243 {
244 int number = (-varbuffer[i]) - 1;
245 if (number < 10) code_byte(STORELOCAL0 + number);
246 else
247 {
248 code_byte(STORELOCAL);
249 code_byte(number);
250 }
251 }
252 else /* indexed var */
253 {
254 int j;
255 int upper=0; /* number of indexed variables upper */
256 int param; /* number of itens until indexed expression */
257 for (j=i+1; j <nvarbuffer; j++)
258 if (varbuffer[j] == 0) upper++;
259 param = upper*2 + i;
260 if (param == 0)
261 code_byte(STOREINDEXED0);
262 else
263 {
264 code_byte(STOREINDEXED);
265 code_byte(param);
266 }
267 }
268}
269
270void yyerror (char *s)
271{
272 static char msg[256];
273 sprintf (msg,"%s near \"%s\" at line %d in file \"%s\"",
274 s, lua_lasttext (), lua_linenumber, lua_filename());
275 lua_error (msg);
276 err = 1;
277}
278
279int yywrap (void)
280{
281 return 1;
282}
283
284
285/*
286** Parse LUA code and execute global statement.
287** Return 0 on success or 1 on error.
288*/
289int lua_parse (void)
290{
291 Byte *initcode = maincode;
292 err = 0;
293 if (yyparse () || (err==1)) return 1;
294 *maincode++ = HALT;
295 if (lua_execute (initcode)) return 1;
296 maincode = initcode;
297 return 0;
298}
299
300
301#if 0
302
303static void PrintCode (void)
304{
305 Byte *p = code;
306 printf ("\n\nCODE\n");
307 while (p != pc)
308 {
309 switch ((OpCode)*p)
310 {
311 case NOP: printf ("%d NOP\n", (p++)-code); break;
312 case PUSHNIL: printf ("%d PUSHNIL\n", (p++)-code); break;
313 case PUSH0: case PUSH1: case PUSH2:
314 printf ("%d PUSH%c\n", p-code, *p-PUSH0+'0');
315 p++;
316 break;
317 case PUSHBYTE:
318 printf ("%d PUSHBYTE %d\n", p-code, *(++p));
319 p++;
320 break;
321 case PUSHWORD:
322 printf ("%d PUSHWORD %d\n", p-code, *((Word *)(p+1)));
323 p += 1 + sizeof(Word);
324 break;
325 case PUSHFLOAT:
326 printf ("%d PUSHFLOAT %f\n", p-code, *((float *)(p+1)));
327 p += 1 + sizeof(float);
328 break;
329 case PUSHSTRING:
330 printf ("%d PUSHSTRING %d\n", p-code, *((Word *)(p+1)));
331 p += 1 + sizeof(Word);
332 break;
333 case PUSHLOCAL0: case PUSHLOCAL1: case PUSHLOCAL2: case PUSHLOCAL3:
334 case PUSHLOCAL4: case PUSHLOCAL5: case PUSHLOCAL6: case PUSHLOCAL7:
335 case PUSHLOCAL8: case PUSHLOCAL9:
336 printf ("%d PUSHLOCAL%c\n", p-code, *p-PUSHLOCAL0+'0');
337 p++;
338 break;
339 case PUSHLOCAL: printf ("%d PUSHLOCAL %d\n", p-code, *(++p));
340 p++;
341 break;
342 case PUSHGLOBAL:
343 printf ("%d PUSHGLOBAL %d\n", p-code, *((Word *)(p+1)));
344 p += 1 + sizeof(Word);
345 break;
346 case PUSHINDEXED: printf ("%d PUSHINDEXED\n", (p++)-code); break;
347 case PUSHMARK: printf ("%d PUSHMARK\n", (p++)-code); break;
348 case PUSHOBJECT: printf ("%d PUSHOBJECT\n", (p++)-code); break;
349 case STORELOCAL0: case STORELOCAL1: case STORELOCAL2: case STORELOCAL3:
350 case STORELOCAL4: case STORELOCAL5: case STORELOCAL6: case STORELOCAL7:
351 case STORELOCAL8: case STORELOCAL9:
352 printf ("%d STORELOCAL%c\n", p-code, *p-STORELOCAL0+'0');
353 p++;
354 break;
355 case STORELOCAL:
356 printf ("%d STORELOCAK %d\n", p-code, *(++p));
357 p++;
358 break;
359 case STOREGLOBAL:
360 printf ("%d STOREGLOBAL %d\n", p-code, *((Word *)(p+1)));
361 p += 1 + sizeof(Word);
362 break;
363 case STOREINDEXED0: printf ("%d STOREINDEXED0\n", (p++)-code); break;
364 case STOREINDEXED: printf ("%d STOREINDEXED %d\n", p-code, *(++p));
365 p++;
366 break;
367 case STOREFIELD: printf ("%d STOREFIELD\n", (p++)-code); break;
368 case ADJUST:
369 printf ("%d ADJUST %d\n", p-code, *(++p));
370 p++;
371 break;
372 case CREATEARRAY: printf ("%d CREATEARRAY\n", (p++)-code); break;
373 case EQOP: printf ("%d EQOP\n", (p++)-code); break;
374 case LTOP: printf ("%d LTOP\n", (p++)-code); break;
375 case LEOP: printf ("%d LEOP\n", (p++)-code); break;
376 case ADDOP: printf ("%d ADDOP\n", (p++)-code); break;
377 case SUBOP: printf ("%d SUBOP\n", (p++)-code); break;
378 case MULTOP: printf ("%d MULTOP\n", (p++)-code); break;
379 case DIVOP: printf ("%d DIVOP\n", (p++)-code); break;
380 case CONCOP: printf ("%d CONCOP\n", (p++)-code); break;
381 case MINUSOP: printf ("%d MINUSOP\n", (p++)-code); break;
382 case NOTOP: printf ("%d NOTOP\n", (p++)-code); break;
383 case ONTJMP:
384 printf ("%d ONTJMP %d\n", p-code, *((Word *)(p+1)));
385 p += sizeof(Word) + 1;
386 break;
387 case ONFJMP:
388 printf ("%d ONFJMP %d\n", p-code, *((Word *)(p+1)));
389 p += sizeof(Word) + 1;
390 break;
391 case JMP:
392 printf ("%d JMP %d\n", p-code, *((Word *)(p+1)));
393 p += sizeof(Word) + 1;
394 break;
395 case UPJMP:
396 printf ("%d UPJMP %d\n", p-code, *((Word *)(p+1)));
397 p += sizeof(Word) + 1;
398 break;
399 case IFFJMP:
400 printf ("%d IFFJMP %d\n", p-code, *((Word *)(p+1)));
401 p += sizeof(Word) + 1;
402 break;
403 case IFFUPJMP:
404 printf ("%d IFFUPJMP %d\n", p-code, *((Word *)(p+1)));
405 p += sizeof(Word) + 1;
406 break;
407 case POP: printf ("%d POP\n", (p++)-code); break;
408 case CALLFUNC: printf ("%d CALLFUNC\n", (p++)-code); break;
409 case RETCODE:
410 printf ("%d RETCODE %d\n", p-code, *(++p));
411 p++;
412 break;
413 default: printf ("%d Cannot happen\n", (p++)-code); break;
414 }
415 }
416}
417#endif
418
419int yyexca[] ={
420-1, 1,
421 0, -1,
422 -2, 2,
423-1, 19,
424 40, 65,
425 91, 95,
426 46, 97,
427 -2, 92,
428-1, 29,
429 40, 65,
430 91, 95,
431 46, 97,
432 -2, 51,
433-1, 70,
434 275, 33,
435 276, 33,
436 61, 33,
437 277, 33,
438 62, 33,
439 60, 33,
440 278, 33,
441 279, 33,
442 280, 33,
443 43, 33,
444 45, 33,
445 42, 33,
446 47, 33,
447 -2, 68,
448-1, 71,
449 91, 95,
450 46, 97,
451 -2, 93,
452-1, 102,
453 260, 27,
454 261, 27,
455 265, 27,
456 266, 27,
457 267, 27,
458 -2, 11,
459-1, 117,
460 93, 85,
461 -2, 87,
462-1, 122,
463 267, 30,
464 -2, 29,
465-1, 145,
466 275, 33,
467 276, 33,
468 61, 33,
469 277, 33,
470 62, 33,
471 60, 33,
472 278, 33,
473 279, 33,
474 280, 33,
475 43, 33,
476 45, 33,
477 42, 33,
478 47, 33,
479 -2, 70,
480 };
481# define YYNPROD 105
482# define YYLAST 318
483int yyact[]={
484
485 54, 52, 136, 53, 13, 55, 54, 52, 14, 53,
486 15, 55, 5, 166, 18, 6, 129, 21, 47, 46,
487 48, 107, 104, 97, 47, 46, 48, 54, 52, 80,
488 53, 21, 55, 54, 52, 40, 53, 9, 55, 54,
489 52, 158, 53, 160, 55, 47, 46, 48, 159, 101,
490 81, 47, 46, 48, 10, 54, 52, 126, 53, 67,
491 55, 54, 52, 60, 53, 155, 55, 148, 149, 135,
492 147, 108, 150, 47, 46, 48, 73, 23, 75, 47,
493 46, 48, 7, 25, 38, 153, 26, 164, 27, 117,
494 61, 62, 74, 11, 76, 54, 24, 127, 65, 66,
495 55, 37, 154, 151, 103, 111, 72, 28, 93, 94,
496 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
497 92, 116, 59, 77, 54, 52, 118, 53, 99, 55,
498 110, 95, 64, 44, 70, 109, 29, 33, 105, 106,
499 42, 112, 41, 165, 139, 19, 17, 152, 79, 123,
500 43, 119, 20, 114, 113, 98, 63, 144, 143, 122,
501 68, 39, 36, 130, 35, 120, 12, 8, 102, 125,
502 128, 141, 78, 69, 70, 71, 142, 131, 132, 140,
503 22, 124, 4, 3, 2, 121, 96, 138, 146, 137,
504 134, 157, 133, 115, 16, 1, 0, 0, 0, 0,
505 0, 0, 0, 156, 0, 0, 0, 0, 161, 0,
506 0, 0, 0, 162, 0, 0, 0, 168, 0, 172,
507 145, 163, 171, 0, 174, 0, 0, 0, 169, 156,
508 167, 170, 173, 57, 58, 49, 50, 51, 56, 57,
509 58, 49, 50, 51, 56, 175, 0, 0, 100, 0,
510 45, 0, 0, 0, 0, 70, 0, 0, 0, 0,
511 57, 58, 49, 50, 51, 56, 57, 58, 49, 50,
512 51, 56, 0, 0, 0, 0, 0, 56, 0, 0,
513 0, 0, 0, 0, 0, 0, 0, 0, 57, 58,
514 49, 50, 51, 56, 0, 0, 49, 50, 51, 56,
515 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
516 0, 0, 30, 0, 21, 31, 0, 34 };
517int yypact[]={
518
519 -1000, -258, -1000, -1000, -1000, -234, -1000, 34, -254, -1000,
520 -1000, -1000, -1000, 43, -1000, -1000, 40, -1000, -236, -1000,
521 -1000, -1000, 93, -9, -1000, 43, 43, 43, 92, -1000,
522 -1000, -1000, -1000, -1000, 43, 43, -1000, 43, -240, 62,
523 31, -13, 48, 83, -242, -1000, 43, 43, 43, 43,
524 43, 43, 43, 43, 43, 43, 43, -1000, -1000, 90,
525 13, -1000, -1000, -248, 43, 19, -15, -216, -1000, 60,
526 -1000, -1000, -249, -1000, -1000, 43, -250, 43, 89, 61,
527 -1000, -1000, -3, -3, -3, -3, -3, -3, 53, 53,
528 -1000, -1000, 82, -1000, -1000, -1000, -2, -1000, 85, 13,
529 -1000, 43, -1000, -1000, 31, 43, -36, -1000, 56, 60,
530 -1000, -255, -1000, 43, 43, -1000, -269, -1000, -1000, -1000,
531 13, 34, -1000, 43, -1000, 13, -1000, -1000, -1000, -1000,
532 -193, 19, 19, -53, 59, -1000, -1000, -8, 58, 43,
533 -1000, -1000, -1000, -1000, -226, -1000, -218, -223, -1000, 43,
534 -1000, -269, 26, -1000, -1000, -1000, 13, -253, 43, -1000,
535 -1000, -1000, -42, -1000, 43, 43, -1000, 34, -1000, 13,
536 -1000, -1000, -1000, -1000, -193, -1000 };
537int yypgo[]={
538
539 0, 195, 50, 96, 71, 135, 194, 193, 192, 190,
540 189, 187, 136, 186, 184, 82, 54, 183, 182, 180,
541 172, 170, 59, 168, 167, 166, 63, 70, 164, 162,
542 137, 161, 160, 159, 158, 157, 156, 155, 154, 153,
543 152, 150, 149, 148, 69, 147, 144, 65, 143, 142,
544 140, 76, 138 };
545int yyr1[]={
546
547 0, 1, 14, 1, 1, 1, 19, 21, 17, 23,
548 23, 24, 15, 16, 16, 25, 28, 25, 29, 25,
549 25, 25, 25, 27, 27, 27, 32, 33, 22, 34,
550 35, 34, 2, 26, 3, 3, 3, 3, 3, 3,
551 3, 3, 3, 3, 3, 3, 3, 3, 36, 3,
552 3, 3, 3, 3, 3, 3, 3, 38, 3, 39,
553 3, 37, 37, 41, 30, 40, 4, 4, 5, 42,
554 5, 20, 20, 43, 43, 13, 13, 7, 7, 8,
555 8, 9, 9, 45, 44, 10, 10, 46, 11, 48,
556 11, 47, 6, 6, 12, 49, 12, 50, 12, 31,
557 31, 51, 52, 51, 18 };
558int yyr2[]={
559
560 0, 0, 1, 9, 4, 4, 1, 1, 19, 0,
561 6, 1, 4, 0, 2, 17, 1, 17, 1, 13,
562 7, 3, 4, 0, 4, 15, 1, 1, 9, 0,
563 1, 9, 1, 3, 7, 7, 7, 7, 7, 7,
564 7, 7, 7, 7, 7, 7, 5, 5, 1, 9,
565 9, 3, 3, 3, 3, 3, 5, 1, 11, 1,
566 11, 1, 2, 1, 11, 3, 1, 3, 3, 1,
567 9, 0, 2, 3, 7, 1, 3, 7, 7, 1,
568 3, 3, 7, 1, 9, 1, 3, 1, 5, 1,
569 9, 3, 3, 7, 3, 1, 11, 1, 9, 5,
570 9, 1, 1, 6, 3 };
571int yychk[]={
572
573 -1000, -1, -14, -17, -18, 270, 273, -15, -24, 271,
574 -16, 59, -25, 258, 262, 264, -6, -30, 268, -12,
575 -40, 271, -19, -26, -3, 40, 43, 45, 64, -12,
576 269, 272, 257, -30, 274, -28, -29, 61, 44, -31,
577 271, -49, -50, -41, 40, 259, 61, 60, 62, 277,
578 278, 279, 43, 45, 42, 47, 280, 275, 276, -3,
579 -26, -26, -26, -36, 40, -26, -26, -22, -32, -5,
580 -3, -12, 44, -51, 61, 91, 46, 40, -20, -43,
581 271, -2, -26, -26, -26, -26, -26, -26, -26, -26,
582 -26, -26, -26, -2, -2, 41, -13, 271, -37, -26,
583 263, 265, -23, 44, 271, -52, -26, 271, -4, -5,
584 41, 44, -22, -38, -39, -7, 123, 91, 41, -2,
585 -26, -15, -33, -42, -51, -26, 93, 41, -21, 271,
586 -2, -26, -26, -8, -9, -44, 271, -10, -11, -46,
587 -22, -2, -16, -34, -35, -3, -22, -27, 260, 261,
588 125, 44, -45, 93, 44, -47, -26, -2, 267, 266,
589 266, -22, -26, -44, 61, -48, 266, -4, 259, -26,
590 -47, -16, -2, -22, -2, -27 };
591int yydef[]={
592
593 1, -2, 11, 4, 5, 0, 104, 13, 0, 6,
594 3, 14, 12, 0, 16, 18, 0, 21, 0, -2,
595 63, 94, 0, 0, 33, 0, 0, 0, 48, -2,
596 52, 53, 54, 55, 0, 0, 26, 0, 0, 22,
597 101, 0, 0, 0, 71, 32, 0, 0, 0, 0,
598 0, 0, 0, 0, 0, 0, 0, 32, 32, 33,
599 0, 46, 47, 75, 61, 56, 0, 0, 9, 20,
600 -2, -2, 0, 99, 102, 0, 0, 66, 0, 72,
601 73, 26, 35, 36, 37, 38, 39, 40, 41, 42,
602 43, 44, 45, 57, 59, 34, 0, 76, 0, 62,
603 32, 0, -2, 69, 101, 0, 0, 98, 0, 67,
604 7, 0, 32, 0, 0, 49, 79, -2, 50, 26,
605 32, 13, -2, 0, 100, 103, 96, 64, 26, 74,
606 23, 58, 60, 0, 80, 81, 83, 0, 86, 0,
607 32, 19, 10, 28, 0, -2, 0, 0, 26, 0,
608 77, 0, 0, 78, 89, 88, 91, 0, 66, 8,
609 15, 24, 0, 82, 0, 0, 17, 13, 32, 84,
610 90, 31, 26, 32, 23, 25 };
611typedef struct { char *t_name; int t_val; } yytoktype;
612#ifndef YYDEBUG
613# define YYDEBUG 0 /* don't allow debugging */
614#endif
615
616#if YYDEBUG
617
618yytoktype yytoks[] =
619{
620 "NIL", 257,
621 "IF", 258,
622 "THEN", 259,
623 "ELSE", 260,
624 "ELSEIF", 261,
625 "WHILE", 262,
626 "DO", 263,
627 "REPEAT", 264,
628 "UNTIL", 265,
629 "END", 266,
630 "RETURN", 267,
631 "LOCAL", 268,
632 "NUMBER", 269,
633 "FUNCTION", 270,
634 "NAME", 271,
635 "STRING", 272,
636 "DEBUG", 273,
637 "NOT", 274,
638 "AND", 275,
639 "OR", 276,
640 "=", 61,
641 "NE", 277,
642 ">", 62,
643 "<", 60,
644 "LE", 278,
645 "GE", 279,
646 "CONC", 280,
647 "+", 43,
648 "-", 45,
649 "*", 42,
650 "/", 47,
651 "%", 37,
652 "UNARY", 281,
653 "-unknown-", -1 /* ends search */
654};
655
656char * yyreds[] =
657{
658 "-no such reduction-",
659 "functionlist : /* empty */",
660 "functionlist : functionlist",
661 "functionlist : functionlist stat sc",
662 "functionlist : functionlist function",
663 "functionlist : functionlist setdebug",
664 "function : FUNCTION NAME",
665 "function : FUNCTION NAME '(' parlist ')'",
666 "function : FUNCTION NAME '(' parlist ')' block END",
667 "statlist : /* empty */",
668 "statlist : statlist stat sc",
669 "stat : /* empty */",
670 "stat : stat1",
671 "sc : /* empty */",
672 "sc : ';'",
673 "stat1 : IF expr1 THEN PrepJump block PrepJump elsepart END",
674 "stat1 : WHILE",
675 "stat1 : WHILE expr1 DO PrepJump block PrepJump END",
676 "stat1 : REPEAT",
677 "stat1 : REPEAT block UNTIL expr1 PrepJump",
678 "stat1 : varlist1 '=' exprlist1",
679 "stat1 : functioncall",
680 "stat1 : LOCAL declist",
681 "elsepart : /* empty */",
682 "elsepart : ELSE block",
683 "elsepart : ELSEIF expr1 THEN PrepJump block PrepJump elsepart",
684 "block : /* empty */",
685 "block : statlist",
686 "block : statlist ret",
687 "ret : /* empty */",
688 "ret : /* empty */",
689 "ret : RETURN exprlist sc",
690 "PrepJump : /* empty */",
691 "expr1 : expr",
692 "expr : '(' expr ')'",
693 "expr : expr1 '=' expr1",
694 "expr : expr1 '<' expr1",
695 "expr : expr1 '>' expr1",
696 "expr : expr1 NE expr1",
697 "expr : expr1 LE expr1",
698 "expr : expr1 GE expr1",
699 "expr : expr1 '+' expr1",
700 "expr : expr1 '-' expr1",
701 "expr : expr1 '*' expr1",
702 "expr : expr1 '/' expr1",
703 "expr : expr1 CONC expr1",
704 "expr : '+' expr1",
705 "expr : '-' expr1",
706 "expr : '@'",
707 "expr : '@' objectname fieldlist",
708 "expr : '@' '(' dimension ')'",
709 "expr : var",
710 "expr : NUMBER",
711 "expr : STRING",
712 "expr : NIL",
713 "expr : functioncall",
714 "expr : NOT expr1",
715 "expr : expr1 AND PrepJump",
716 "expr : expr1 AND PrepJump expr1",
717 "expr : expr1 OR PrepJump",
718 "expr : expr1 OR PrepJump expr1",
719 "dimension : /* empty */",
720 "dimension : expr1",
721 "functioncall : functionvalue",
722 "functioncall : functionvalue '(' exprlist ')'",
723 "functionvalue : var",
724 "exprlist : /* empty */",
725 "exprlist : exprlist1",
726 "exprlist1 : expr",
727 "exprlist1 : exprlist1 ','",
728 "exprlist1 : exprlist1 ',' expr",
729 "parlist : /* empty */",
730 "parlist : parlist1",
731 "parlist1 : NAME",
732 "parlist1 : parlist1 ',' NAME",
733 "objectname : /* empty */",
734 "objectname : NAME",
735 "fieldlist : '{' ffieldlist '}'",
736 "fieldlist : '[' lfieldlist ']'",
737 "ffieldlist : /* empty */",
738 "ffieldlist : ffieldlist1",
739 "ffieldlist1 : ffield",
740 "ffieldlist1 : ffieldlist1 ',' ffield",
741 "ffield : NAME",
742 "ffield : NAME '=' expr1",
743 "lfieldlist : /* empty */",
744 "lfieldlist : lfieldlist1",
745 "lfieldlist1 : /* empty */",
746 "lfieldlist1 : lfield",
747 "lfieldlist1 : lfieldlist1 ','",
748 "lfieldlist1 : lfieldlist1 ',' lfield",
749 "lfield : expr1",
750 "varlist1 : var",
751 "varlist1 : varlist1 ',' var",
752 "var : NAME",
753 "var : var",
754 "var : var '[' expr1 ']'",
755 "var : var",
756 "var : var '.' NAME",
757 "declist : NAME init",
758 "declist : declist ',' NAME init",
759 "init : /* empty */",
760 "init : '='",
761 "init : '=' expr1",
762 "setdebug : DEBUG",
763};
764#endif /* YYDEBUG */
765#line 1 "/usr/lib/yaccpar"
766/* @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10 */
767
768/*
769** Skeleton parser driver for yacc output
770*/
771
772/*
773** yacc user known macros and defines
774*/
775#define YYERROR goto yyerrlab
776#define YYACCEPT { free(yys); free(yyv); return(0); }
777#define YYABORT { free(yys); free(yyv); return(1); }
778#define YYBACKUP( newtoken, newvalue )\
779{\
780 if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
781 {\
782 yyerror( "syntax error - cannot backup" );\
783 goto yyerrlab;\
784 }\
785 yychar = newtoken;\
786 yystate = *yyps;\
787 yylval = newvalue;\
788 goto yynewstate;\
789}
790#define YYRECOVERING() (!!yyerrflag)
791#ifndef YYDEBUG
792# define YYDEBUG 1 /* make debugging available */
793#endif
794
795/*
796** user known globals
797*/
798int yydebug; /* set to 1 to get debugging */
799
800/*
801** driver internal defines
802*/
803#define YYFLAG (-1000)
804
805/*
806** static variables used by the parser
807*/
808static YYSTYPE *yyv; /* value stack */
809static int *yys; /* state stack */
810
811static YYSTYPE *yypv; /* top of value stack */
812static int *yyps; /* top of state stack */
813
814static int yystate; /* current state */
815static int yytmp; /* extra var (lasts between blocks) */
816
817int yynerrs; /* number of errors */
818
819int yyerrflag; /* error recovery flag */
820int yychar; /* current input token number */
821
822
823/*
824** yyparse - return 0 if worked, 1 if syntax error not recovered from
825*/
826int
827yyparse()
828{
829 register YYSTYPE *yypvt; /* top of value stack for $vars */
830 unsigned yymaxdepth = YYMAXDEPTH;
831
832 /*
833 ** Initialize externals - yyparse may be called more than once
834 */
835 yyv = (YYSTYPE*)malloc(yymaxdepth*sizeof(YYSTYPE));
836 yys = (int*)malloc(yymaxdepth*sizeof(int));
837 if (!yyv || !yys)
838 {
839 yyerror( "out of memory" );
840 return(1);
841 }
842 yypv = &yyv[-1];
843 yyps = &yys[-1];
844 yystate = 0;
845 yytmp = 0;
846 yynerrs = 0;
847 yyerrflag = 0;
848 yychar = -1;
849
850 goto yystack;
851 {
852 register YYSTYPE *yy_pv; /* top of value stack */
853 register int *yy_ps; /* top of state stack */
854 register int yy_state; /* current state */
855 register int yy_n; /* internal state number info */
856
857 /*
858 ** get globals into registers.
859 ** branch to here only if YYBACKUP was called.
860 */
861 yynewstate:
862 yy_pv = yypv;
863 yy_ps = yyps;
864 yy_state = yystate;
865 goto yy_newstate;
866
867 /*
868 ** get globals into registers.
869 ** either we just started, or we just finished a reduction
870 */
871 yystack:
872 yy_pv = yypv;
873 yy_ps = yyps;
874 yy_state = yystate;
875
876 /*
877 ** top of for (;;) loop while no reductions done
878 */
879 yy_stack:
880 /*
881 ** put a state and value onto the stacks
882 */
883#if YYDEBUG
884 /*
885 ** if debugging, look up token value in list of value vs.
886 ** name pairs. 0 and negative (-1) are special values.
887 ** Note: linear search is used since time is not a real
888 ** consideration while debugging.
889 */
890 if ( yydebug )
891 {
892 register int yy_i;
893
894 (void)printf( "State %d, token ", yy_state );
895 if ( yychar == 0 )
896 (void)printf( "end-of-file\n" );
897 else if ( yychar < 0 )
898 (void)printf( "-none-\n" );
899 else
900 {
901 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
902 yy_i++ )
903 {
904 if ( yytoks[yy_i].t_val == yychar )
905 break;
906 }
907 (void)printf( "%s\n", yytoks[yy_i].t_name );
908 }
909 }
910#endif /* YYDEBUG */
911 if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */
912 {
913 /*
914 ** reallocate and recover. Note that pointers
915 ** have to be reset, or bad things will happen
916 */
917 int yyps_index = (yy_ps - yys);
918 int yypv_index = (yy_pv - yyv);
919 int yypvt_index = (yypvt - yyv);
920 yymaxdepth += YYMAXDEPTH;
921 yyv = (YYSTYPE*)realloc((char*)yyv,
922 yymaxdepth * sizeof(YYSTYPE));
923 yys = (int*)realloc((char*)yys,
924 yymaxdepth * sizeof(int));
925 if (!yyv || !yys)
926 {
927 yyerror( "yacc stack overflow" );
928 return(1);
929 }
930 yy_ps = yys + yyps_index;
931 yy_pv = yyv + yypv_index;
932 yypvt = yyv + yypvt_index;
933 }
934 *yy_ps = yy_state;
935 *++yy_pv = yyval;
936
937 /*
938 ** we have a new state - find out what to do
939 */
940 yy_newstate:
941 if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
942 goto yydefault; /* simple state */
943#if YYDEBUG
944 /*
945 ** if debugging, need to mark whether new token grabbed
946 */
947 yytmp = yychar < 0;
948#endif
949 if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
950 yychar = 0; /* reached EOF */
951#if YYDEBUG
952 if ( yydebug && yytmp )
953 {
954 register int yy_i;
955
956 (void)printf( "Received token " );
957 if ( yychar == 0 )
958 (void)printf( "end-of-file\n" );
959 else if ( yychar < 0 )
960 (void)printf( "-none-\n" );
961 else
962 {
963 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
964 yy_i++ )
965 {
966 if ( yytoks[yy_i].t_val == yychar )
967 break;
968 }
969 (void)printf( "%s\n", yytoks[yy_i].t_name );
970 }
971 }
972#endif /* YYDEBUG */
973 if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
974 goto yydefault;
975 if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/
976 {
977 yychar = -1;
978 yyval = yylval;
979 yy_state = yy_n;
980 if ( yyerrflag > 0 )
981 yyerrflag--;
982 goto yy_stack;
983 }
984
985 yydefault:
986 if ( ( yy_n = yydef[ yy_state ] ) == -2 )
987 {
988#if YYDEBUG
989 yytmp = yychar < 0;
990#endif
991 if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
992 yychar = 0; /* reached EOF */
993#if YYDEBUG
994 if ( yydebug && yytmp )
995 {
996 register int yy_i;
997
998 (void)printf( "Received token " );
999 if ( yychar == 0 )
1000 (void)printf( "end-of-file\n" );
1001 else if ( yychar < 0 )
1002 (void)printf( "-none-\n" );
1003 else
1004 {
1005 for ( yy_i = 0;
1006 yytoks[yy_i].t_val >= 0;
1007 yy_i++ )
1008 {
1009 if ( yytoks[yy_i].t_val
1010 == yychar )
1011 {
1012 break;
1013 }
1014 }
1015 (void)printf( "%s\n", yytoks[yy_i].t_name );
1016 }
1017 }
1018#endif /* YYDEBUG */
1019 /*
1020 ** look through exception table
1021 */
1022 {
1023 register int *yyxi = yyexca;
1024
1025 while ( ( *yyxi != -1 ) ||
1026 ( yyxi[1] != yy_state ) )
1027 {
1028 yyxi += 2;
1029 }
1030 while ( ( *(yyxi += 2) >= 0 ) &&
1031 ( *yyxi != yychar ) )
1032 ;
1033 if ( ( yy_n = yyxi[1] ) < 0 )
1034 YYACCEPT;
1035 }
1036 }
1037
1038 /*
1039 ** check for syntax error
1040 */
1041 if ( yy_n == 0 ) /* have an error */
1042 {
1043 /* no worry about speed here! */
1044 switch ( yyerrflag )
1045 {
1046 case 0: /* new error */
1047 yyerror( "syntax error" );
1048 goto skip_init;
1049 yyerrlab:
1050 /*
1051 ** get globals into registers.
1052 ** we have a user generated syntax type error
1053 */
1054 yy_pv = yypv;
1055 yy_ps = yyps;
1056 yy_state = yystate;
1057 yynerrs++;
1058 skip_init:
1059 case 1:
1060 case 2: /* incompletely recovered error */
1061 /* try again... */
1062 yyerrflag = 3;
1063 /*
1064 ** find state where "error" is a legal
1065 ** shift action
1066 */
1067 while ( yy_ps >= yys )
1068 {
1069 yy_n = yypact[ *yy_ps ] + YYERRCODE;
1070 if ( yy_n >= 0 && yy_n < YYLAST &&
1071 yychk[yyact[yy_n]] == YYERRCODE) {
1072 /*
1073 ** simulate shift of "error"
1074 */
1075 yy_state = yyact[ yy_n ];
1076 goto yy_stack;
1077 }
1078 /*
1079 ** current state has no shift on
1080 ** "error", pop stack
1081 */
1082#if YYDEBUG
1083# define _POP_ "Error recovery pops state %d, uncovers state %d\n"
1084 if ( yydebug )
1085 (void)printf( _POP_, *yy_ps,
1086 yy_ps[-1] );
1087# undef _POP_
1088#endif
1089 yy_ps--;
1090 yy_pv--;
1091 }
1092 /*
1093 ** there is no state on stack with "error" as
1094 ** a valid shift. give up.
1095 */
1096 YYABORT;
1097 case 3: /* no shift yet; eat a token */
1098#if YYDEBUG
1099 /*
1100 ** if debugging, look up token in list of
1101 ** pairs. 0 and negative shouldn't occur,
1102 ** but since timing doesn't matter when
1103 ** debugging, it doesn't hurt to leave the
1104 ** tests here.
1105 */
1106 if ( yydebug )
1107 {
1108 register int yy_i;
1109
1110 (void)printf( "Error recovery discards " );
1111 if ( yychar == 0 )
1112 (void)printf( "token end-of-file\n" );
1113 else if ( yychar < 0 )
1114 (void)printf( "token -none-\n" );
1115 else
1116 {
1117 for ( yy_i = 0;
1118 yytoks[yy_i].t_val >= 0;
1119 yy_i++ )
1120 {
1121 if ( yytoks[yy_i].t_val
1122 == yychar )
1123 {
1124 break;
1125 }
1126 }
1127 (void)printf( "token %s\n",
1128 yytoks[yy_i].t_name );
1129 }
1130 }
1131#endif /* YYDEBUG */
1132 if ( yychar == 0 ) /* reached EOF. quit */
1133 YYABORT;
1134 yychar = -1;
1135 goto yy_newstate;
1136 }
1137 }/* end if ( yy_n == 0 ) */
1138 /*
1139 ** reduction by production yy_n
1140 ** put stack tops, etc. so things right after switch
1141 */
1142#if YYDEBUG
1143 /*
1144 ** if debugging, print the string that is the user's
1145 ** specification of the reduction which is just about
1146 ** to be done.
1147 */
1148 if ( yydebug )
1149 (void)printf( "Reduce by (%d) \"%s\"\n",
1150 yy_n, yyreds[ yy_n ] );
1151#endif
1152 yytmp = yy_n; /* value to switch over */
1153 yypvt = yy_pv; /* $vars top of value stack */
1154 /*
1155 ** Look in goto table for next state
1156 ** Sorry about using yy_state here as temporary
1157 ** register variable, but why not, if it works...
1158 ** If yyr2[ yy_n ] doesn't have the low order bit
1159 ** set, then there is no action to be done for
1160 ** this reduction. So, no saving & unsaving of
1161 ** registers done. The only difference between the
1162 ** code just after the if and the body of the if is
1163 ** the goto yy_stack in the body. This way the test
1164 ** can be made before the choice of what to do is needed.
1165 */
1166 {
1167 /* length of production doubled with extra bit */
1168 register int yy_len = yyr2[ yy_n ];
1169
1170 if ( !( yy_len & 01 ) )
1171 {
1172 yy_len >>= 1;
1173 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
1174 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
1175 *( yy_ps -= yy_len ) + 1;
1176 if ( yy_state >= YYLAST ||
1177 yychk[ yy_state =
1178 yyact[ yy_state ] ] != -yy_n )
1179 {
1180 yy_state = yyact[ yypgo[ yy_n ] ];
1181 }
1182 goto yy_stack;
1183 }
1184 yy_len >>= 1;
1185 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
1186 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
1187 *( yy_ps -= yy_len ) + 1;
1188 if ( yy_state >= YYLAST ||
1189 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
1190 {
1191 yy_state = yyact[ yypgo[ yy_n ] ];
1192 }
1193 }
1194 /* save until reenter driver code */
1195 yystate = yy_state;
1196 yyps = yy_ps;
1197 yypv = yy_pv;
1198 }
1199 /*
1200 ** code supplied by user is placed in this switch
1201 */
1202 switch( yytmp )
1203 {
1204
1205case 2:
1206# line 179 "lua.stx"
1207{pc=basepc=maincode; nlocalvar=0;} break;
1208case 3:
1209# line 179 "lua.stx"
1210{maincode=pc;} break;
1211case 6:
1212# line 184 "lua.stx"
1213{pc=basepc=code; nlocalvar=0;} break;
1214case 7:
1215# line 185 "lua.stx"
1216{
1217 if (lua_debug)
1218 {
1219 align(Word);
1220 code_byte(SETFUNCTION);
1221 code_word(yypvt[-5].vWord);
1222 code_word(yypvt[-4].vWord);
1223 }
1224 lua_codeadjust (0);
1225 } break;
1226case 8:
1227# line 197 "lua.stx"
1228{
1229 if (lua_debug) code_byte(RESET);
1230 code_byte(RETCODE); code_byte(nlocalvar);
1231 s_tag(yypvt[-7].vWord) = T_FUNCTION;
1232 s_bvalue(yypvt[-7].vWord) = calloc (pc-code, sizeof(Byte));
1233 memcpy (s_bvalue(yypvt[-7].vWord), code, (pc-code)*sizeof(Byte));
1234 } break;
1235case 11:
1236# line 210 "lua.stx"
1237{
1238 ntemp = 0;
1239 if (lua_debug)
1240 {
1241 align(Word); code_byte(SETLINE); code_word(lua_linenumber);
1242 }
1243 } break;
1244case 15:
1245# line 223 "lua.stx"
1246{
1247 {
1248 Byte *elseinit = yypvt[-2].pByte + sizeof(Word)+1;
1249 if (pc - elseinit == 0) /* no else */
1250 {
1251 pc -= sizeof(Word)+1;
1252 /* if (*(pc-1) == NOP) --pc; */
1253 elseinit = pc;
1254 }
1255 else
1256 {
1257 *(yypvt[-2].pByte) = JMP;
1258 *((Word *)(yypvt[-2].pByte+1)) = pc - elseinit;
1259 }
1260 *(yypvt[-4].pByte) = IFFJMP;
1261 *((Word *)(yypvt[-4].pByte+1)) = elseinit - (yypvt[-4].pByte + sizeof(Word)+1);
1262 }
1263 } break;
1264case 16:
1265# line 242 "lua.stx"
1266{yyval.pByte = pc;} break;
1267case 17:
1268# line 244 "lua.stx"
1269{
1270 *(yypvt[-3].pByte) = IFFJMP;
1271 *((Word *)(yypvt[-3].pByte+1)) = pc - (yypvt[-3].pByte + sizeof(Word)+1);
1272
1273 *(yypvt[-1].pByte) = UPJMP;
1274 *((Word *)(yypvt[-1].pByte+1)) = pc - yypvt[-6].pByte;
1275 } break;
1276case 18:
1277# line 252 "lua.stx"
1278{yyval.pByte = pc;} break;
1279case 19:
1280# line 254 "lua.stx"
1281{
1282 *(yypvt[-0].pByte) = IFFUPJMP;
1283 *((Word *)(yypvt[-0].pByte+1)) = pc - yypvt[-4].pByte;
1284 } break;
1285case 20:
1286# line 261 "lua.stx"
1287{
1288 {
1289 int i;
1290 if (yypvt[-0].vInt == 0 || nvarbuffer != ntemp - yypvt[-2].vInt * 2)
1291 lua_codeadjust (yypvt[-2].vInt * 2 + nvarbuffer);
1292 for (i=nvarbuffer-1; i>=0; i--)
1293 lua_codestore (i);
1294 if (yypvt[-2].vInt > 1 || (yypvt[-2].vInt == 1 && varbuffer[0] != 0))
1295 lua_codeadjust (0);
1296 }
1297 } break;
1298case 21:
1299# line 272 "lua.stx"
1300{ lua_codeadjust (0); } break;
1301case 25:
1302# line 279 "lua.stx"
1303{
1304 {
1305 Byte *elseinit = yypvt[-1].pByte + sizeof(Word)+1;
1306 if (pc - elseinit == 0) /* no else */
1307 {
1308 pc -= sizeof(Word)+1;
1309 /* if (*(pc-1) == NOP) --pc; */
1310 elseinit = pc;
1311 }
1312 else
1313 {
1314 *(yypvt[-1].pByte) = JMP;
1315 *((Word *)(yypvt[-1].pByte+1)) = pc - elseinit;
1316 }
1317 *(yypvt[-3].pByte) = IFFJMP;
1318 *((Word *)(yypvt[-3].pByte+1)) = elseinit - (yypvt[-3].pByte + sizeof(Word)+1);
1319 }
1320 } break;
1321case 26:
1322# line 299 "lua.stx"
1323{yyval.vInt = nlocalvar;} break;
1324case 27:
1325# line 299 "lua.stx"
1326{ntemp = 0;} break;
1327case 28:
1328# line 300 "lua.stx"
1329{
1330 if (nlocalvar != yypvt[-3].vInt)
1331 {
1332 nlocalvar = yypvt[-3].vInt;
1333 lua_codeadjust (0);
1334 }
1335 } break;
1336case 30:
1337# line 310 "lua.stx"
1338{ if (lua_debug){align(Word);code_byte(SETLINE);code_word(lua_linenumber);}} break;
1339case 31:
1340# line 312 "lua.stx"
1341{
1342 if (lua_debug) code_byte(RESET);
1343 code_byte(RETCODE); code_byte(nlocalvar);
1344 } break;
1345case 32:
1346# line 319 "lua.stx"
1347{
1348 align(Word);
1349 yyval.pByte = pc;
1350 code_byte(0); /* open space */
1351 code_word (0);
1352 } break;
1353case 33:
1354# line 326 "lua.stx"
1355{ if (yypvt[-0].vInt == 0) {lua_codeadjust (ntemp+1); incr_ntemp();}} break;
1356case 34:
1357# line 329 "lua.stx"
1358{ yyval.vInt = yypvt[-1].vInt; } break;
1359case 35:
1360# line 330 "lua.stx"
1361{ code_byte(EQOP); yyval.vInt = 1; ntemp--;} break;
1362case 36:
1363# line 331 "lua.stx"
1364{ code_byte(LTOP); yyval.vInt = 1; ntemp--;} break;
1365case 37:
1366# line 332 "lua.stx"
1367{ code_byte(LEOP); code_byte(NOTOP); yyval.vInt = 1; ntemp--;} break;
1368case 38:
1369# line 333 "lua.stx"
1370{ code_byte(EQOP); code_byte(NOTOP); yyval.vInt = 1; ntemp--;} break;
1371case 39:
1372# line 334 "lua.stx"
1373{ code_byte(LEOP); yyval.vInt = 1; ntemp--;} break;
1374case 40:
1375# line 335 "lua.stx"
1376{ code_byte(LTOP); code_byte(NOTOP); yyval.vInt = 1; ntemp--;} break;
1377case 41:
1378# line 336 "lua.stx"
1379{ code_byte(ADDOP); yyval.vInt = 1; ntemp--;} break;
1380case 42:
1381# line 337 "lua.stx"
1382{ code_byte(SUBOP); yyval.vInt = 1; ntemp--;} break;
1383case 43:
1384# line 338 "lua.stx"
1385{ code_byte(MULTOP); yyval.vInt = 1; ntemp--;} break;
1386case 44:
1387# line 339 "lua.stx"
1388{ code_byte(DIVOP); yyval.vInt = 1; ntemp--;} break;
1389case 45:
1390# line 340 "lua.stx"
1391{ code_byte(CONCOP); yyval.vInt = 1; ntemp--;} break;
1392case 46:
1393# line 341 "lua.stx"
1394{ yyval.vInt = 1; } break;
1395case 47:
1396# line 342 "lua.stx"
1397{ code_byte(MINUSOP); yyval.vInt = 1;} break;
1398case 48:
1399# line 344 "lua.stx"
1400{
1401 code_byte(PUSHBYTE);
1402 yyval.pByte = pc; code_byte(0);
1403 incr_ntemp();
1404 code_byte(CREATEARRAY);
1405 } break;
1406case 49:
1407# line 351 "lua.stx"
1408{
1409 *(yypvt[-2].pByte) = yypvt[-0].vInt;
1410 if (yypvt[-1].vLong < 0) /* there is no function to be called */
1411 {
1412 yyval.vInt = 1;
1413 }
1414 else
1415 {
1416 lua_pushvar (yypvt[-1].vLong+1);
1417 code_byte(PUSHMARK);
1418 incr_ntemp();
1419 code_byte(PUSHOBJECT);
1420 incr_ntemp();
1421 code_byte(CALLFUNC);
1422 ntemp -= 4;
1423 yyval.vInt = 0;
1424 if (lua_debug)
1425 {
1426 align(Word); code_byte(SETLINE); code_word(lua_linenumber);
1427 }
1428 }
1429 } break;
1430case 50:
1431# line 374 "lua.stx"
1432{
1433 code_byte(CREATEARRAY);
1434 yyval.vInt = 1;
1435 } break;
1436case 51:
1437# line 378 "lua.stx"
1438{ lua_pushvar (yypvt[-0].vLong); yyval.vInt = 1;} break;
1439case 52:
1440# line 379 "lua.stx"
1441{ code_number(yypvt[-0].vFloat); yyval.vInt = 1; } break;
1442case 53:
1443# line 381 "lua.stx"
1444{
1445 align(Word);
1446 code_byte(PUSHSTRING);
1447 code_word(yypvt[-0].vWord);
1448 yyval.vInt = 1;
1449 incr_ntemp();
1450 } break;
1451case 54:
1452# line 388 "lua.stx"
1453{code_byte(PUSHNIL); yyval.vInt = 1; incr_ntemp();} break;
1454case 55:
1455# line 390 "lua.stx"
1456{
1457 yyval.vInt = 0;
1458 if (lua_debug)
1459 {
1460 align(Word); code_byte(SETLINE); code_word(lua_linenumber);
1461 }
1462 } break;
1463case 56:
1464# line 397 "lua.stx"
1465{ code_byte(NOTOP); yyval.vInt = 1;} break;
1466case 57:
1467# line 398 "lua.stx"
1468{code_byte(POP); ntemp--;} break;
1469case 58:
1470# line 399 "lua.stx"
1471{
1472 *(yypvt[-2].pByte) = ONFJMP;
1473 *((Word *)(yypvt[-2].pByte+1)) = pc - (yypvt[-2].pByte + sizeof(Word)+1);
1474 yyval.vInt = 1;
1475 } break;
1476case 59:
1477# line 404 "lua.stx"
1478{code_byte(POP); ntemp--;} break;
1479case 60:
1480# line 405 "lua.stx"
1481{
1482 *(yypvt[-2].pByte) = ONTJMP;
1483 *((Word *)(yypvt[-2].pByte+1)) = pc - (yypvt[-2].pByte + sizeof(Word)+1);
1484 yyval.vInt = 1;
1485 } break;
1486case 61:
1487# line 412 "lua.stx"
1488{ code_byte(PUSHNIL); incr_ntemp();} break;
1489case 63:
1490# line 416 "lua.stx"
1491{code_byte(PUSHMARK); yyval.vInt = ntemp; incr_ntemp();} break;
1492case 64:
1493# line 417 "lua.stx"
1494{ code_byte(CALLFUNC); ntemp = yypvt[-3].vInt-1;} break;
1495case 65:
1496# line 419 "lua.stx"
1497{lua_pushvar (yypvt[-0].vLong); } break;
1498case 66:
1499# line 422 "lua.stx"
1500{ yyval.vInt = 1; } break;
1501case 67:
1502# line 423 "lua.stx"
1503{ yyval.vInt = yypvt[-0].vInt; } break;
1504case 68:
1505# line 426 "lua.stx"
1506{ yyval.vInt = yypvt[-0].vInt; } break;
1507case 69:
1508# line 427 "lua.stx"
1509{if (!yypvt[-1].vInt){lua_codeadjust (ntemp+1); incr_ntemp();}} break;
1510case 70:
1511# line 428 "lua.stx"
1512{yyval.vInt = yypvt[-0].vInt;} break;
1513case 73:
1514# line 435 "lua.stx"
1515{localvar[nlocalvar]=yypvt[-0].vWord; incr_nlocalvar();} break;
1516case 74:
1517# line 436 "lua.stx"
1518{localvar[nlocalvar]=yypvt[-0].vWord; incr_nlocalvar();} break;
1519case 75:
1520# line 439 "lua.stx"
1521{yyval.vLong=-1;} break;
1522case 76:
1523# line 440 "lua.stx"
1524{yyval.vLong=yypvt[-0].vWord;} break;
1525case 77:
1526# line 443 "lua.stx"
1527{ yyval.vInt = yypvt[-1].vInt; } break;
1528case 78:
1529# line 444 "lua.stx"
1530{ yyval.vInt = yypvt[-1].vInt; } break;
1531case 79:
1532# line 447 "lua.stx"
1533{ yyval.vInt = 0; } break;
1534case 80:
1535# line 448 "lua.stx"
1536{ yyval.vInt = yypvt[-0].vInt; } break;
1537case 81:
1538# line 451 "lua.stx"
1539{yyval.vInt=1;} break;
1540case 82:
1541# line 452 "lua.stx"
1542{yyval.vInt=yypvt[-2].vInt+1;} break;
1543case 83:
1544# line 456 "lua.stx"
1545{
1546 align(Word);
1547 code_byte(PUSHSTRING);
1548 code_word(lua_findconstant (s_name(yypvt[-0].vWord)));
1549 incr_ntemp();
1550 } break;
1551case 84:
1552# line 463 "lua.stx"
1553{
1554 code_byte(STOREFIELD);
1555 ntemp-=2;
1556 } break;
1557case 85:
1558# line 469 "lua.stx"
1559{ yyval.vInt = 0; } break;
1560case 86:
1561# line 470 "lua.stx"
1562{ yyval.vInt = yypvt[-0].vInt; } break;
1563case 87:
1564# line 473 "lua.stx"
1565{ code_number(1); } break;
1566case 88:
1567# line 473 "lua.stx"
1568{yyval.vInt=1;} break;
1569case 89:
1570# line 474 "lua.stx"
1571{ code_number(yypvt[-1].vInt+1); } break;
1572case 90:
1573# line 475 "lua.stx"
1574{yyval.vInt=yypvt[-3].vInt+1;} break;
1575case 91:
1576# line 479 "lua.stx"
1577{
1578 code_byte(STOREFIELD);
1579 ntemp-=2;
1580 } break;
1581case 92:
1582# line 486 "lua.stx"
1583{
1584 nvarbuffer = 0;
1585 varbuffer[nvarbuffer] = yypvt[-0].vLong; incr_nvarbuffer();
1586 yyval.vInt = (yypvt[-0].vLong == 0) ? 1 : 0;
1587 } break;
1588case 93:
1589# line 492 "lua.stx"
1590{
1591 varbuffer[nvarbuffer] = yypvt[-0].vLong; incr_nvarbuffer();
1592 yyval.vInt = (yypvt[-0].vLong == 0) ? yypvt[-2].vInt + 1 : yypvt[-2].vInt;
1593 } break;
1594case 94:
1595# line 499 "lua.stx"
1596{
1597 int local = lua_localname (yypvt[-0].vWord);
1598 if (local == -1) /* global var */
1599 yyval.vLong = yypvt[-0].vWord + 1; /* return positive value */
1600 else
1601 yyval.vLong = -(local+1); /* return negative value */
1602 } break;
1603case 95:
1604# line 507 "lua.stx"
1605{lua_pushvar (yypvt[-0].vLong);} break;
1606case 96:
1607# line 508 "lua.stx"
1608{
1609 yyval.vLong = 0; /* indexed variable */
1610 } break;
1611case 97:
1612# line 511 "lua.stx"
1613{lua_pushvar (yypvt[-0].vLong);} break;
1614case 98:
1615# line 512 "lua.stx"
1616{
1617 align(Word);
1618 code_byte(PUSHSTRING);
1619 code_word(lua_findconstant (s_name(yypvt[-0].vWord))); incr_ntemp();
1620 yyval.vLong = 0; /* indexed variable */
1621 } break;
1622case 99:
1623# line 520 "lua.stx"
1624{localvar[nlocalvar]=yypvt[-1].vWord; incr_nlocalvar();} break;
1625case 100:
1626# line 521 "lua.stx"
1627{localvar[nlocalvar]=yypvt[-1].vWord; incr_nlocalvar();} break;
1628case 101:
1629# line 524 "lua.stx"
1630{ code_byte(PUSHNIL); } break;
1631case 102:
1632# line 525 "lua.stx"
1633{ntemp = 0;} break;
1634case 104:
1635# line 528 "lua.stx"
1636{lua_debug = yypvt[-0].vInt;} break;
1637 }
1638 goto yystack; /* reset registers in driver code */
1639}