File: input.c

package info (click to toggle)
termdebug 2.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch, trixie
  • size: 456 kB
  • ctags: 685
  • sloc: ansic: 5,008; sh: 560; makefile: 48; lex: 46
file content (817 lines) | stat: -rw-r--r-- 19,692 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
/* THIS FILE HAS BEEN AUTOMATICALLY GENERATED BY LLnextgen. DO NOT EDIT */
#define LL_NTERMINALS 13
#define LL_NSETS 2
#define LL_SSETS 4
#define LLinset(LLx) (LLsets[LLx*LL_SSETS + (LLcsymb/8)] & (1<<(LLcsymb & 7)))
#define LL_SCANDONE(LLx) if (LLsymb != LLx) LLerror(LLx);
static int LLscnt[LL_NSETS+1], LLtcnt[LL_NTERMINALS];
static int LLcsymb;
#include <string.h>
static const char LLsets[] = {
	'\xFE', 	'\x0C', 	'\x00', 	'\x00', 
	'\x00', 	'\x13', 	'\x00', 	'\x00', 
	0
};
static const int LLindex[] = { 0,
	   0,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   12,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
	   0,    1,    2,    3,    4,    5,    6,    7,
	   8,    9,   10,   11};
int LLsymb;
static int LLreissue;
int yylex(void);
static int LLlexerWrapper(void) {
	if (LLreissue == -2 /* LL_NEW_TOKEN */) {
		return yylex();
	} else {
		int LLretval = LLreissue;
		LLreissue = -2 /* LL_NEW_TOKEN */;
		return LLretval;
	}
}
void LLmessage(int);
static void LLread(void) { LLcsymb = LLindex[(LLsymb = LLlexerWrapper()) + 1]; }
static int LLskip(void) {
	int LL_i;
	if (LLcsymb >= 0) {
		if (LLtcnt[LLcsymb] != 0) return 0;
		for (LL_i = 0; LL_i < LL_NSETS; LL_i++)
			if (LLscnt[LL_i] != 0 && LLinset(LL_i))
				return 0;
	}

	for (;;) {
		LLmessage(0 /* LL_DELETE */);
		while ((LLcsymb = LLindex[(LLsymb = LLlexerWrapper()) + 1]) < 0) LLmessage(0 /* LL_DELETE */);
		if (LLtcnt[LLcsymb] != 0)
			return 1;
		for (LL_i = 0; LL_i < LL_NSETS; LL_i++)
			if (LLscnt[LL_i] != 0 && LLinset(LL_i))
				return 1;
	}
}
static void LLerror(int LLtoken) {
	if (LLtoken == 256 /* EOFILE */) {
		LLmessage(-1 /* LL_MISSINGEOF */);
		while (LLindex[(LLsymb = LLlexerWrapper()) + 1] != 0) /*NOTHING*/ ;
		return;
	}
	LLtcnt[LLindex[LLtoken + 1]]++;
	LLskip();
	LLtcnt[LLindex[LLtoken + 1]]--;
	if (LLsymb != LLtoken) { LLreissue = LLsymb; LLmessage(LLtoken); }
}
static const char *LLsymbolTable[] = {
"<EOF>", 
"<EOF>", "<SOH>", "<STX>", "<ETX>", 
"<EOT>", "<ENQ>", "<ACK>", "<BEL>", 
"<BS>", "<TAB>", "<NL>", "<VT>", 
"<FF>", "<CR>", "<SO>", "<SI>", 
"<DLE>", "<DC1>", "<DC2>", "<DC3>", 
"<DC4>", "<NAK>", "<SYN>", "<ETB>", 
"<CAN>", "<EM>", "<SUB>", "<ESC>", 
"<FS>", "<GS>", "<RS>", "<US>", 
"<SP>", "'!'", "'\"'", "'#'", 
"'$'", "'%'", "'&'", "'\''", 
"'('", "')'", "'*'", "'+'", 
"','", "'-'", "'.'", "'/'", 
"'0'", "'1'", "'2'", "'3'", 
"'4'", "'5'", "'6'", "'7'", 
"'8'", "'9'", "':'", "';'", 
"'<'", "'='", "'>'", "'?'", 
"'@'", "'A'", "'B'", "'C'", 
"'D'", "'E'", "'F'", "'G'", 
"'H'", "'I'", "'J'", "'K'", 
"'L'", "'M'", "'N'", "'O'", 
"'P'", "'Q'", "'R'", "'S'", 
"'T'", "'U'", "'V'", "'W'", 
"'X'", "'Y'", "'Z'", "'['", 
"'\\'", "']'", "'^'", "'_'", 
"'`'", "'a'", "'b'", "'c'", 
"'d'", "'e'", "'f'", "'g'", 
"'h'", "'i'", "'j'", "'k'", 
"'l'", "'m'", "'n'", "'o'", 
"'p'", "'q'", "'r'", "'s'", 
"'t'", "'u'", "'v'", "'w'", 
"'x'", "'y'", "'z'", "'{'", 
"'|'", "'}'", "'~'", "<DEL>", 
"'\x80'", "'\x81'", "'\x82'", "'\x83'", 
"'\x84'", "'\x85'", "'\x86'", "'\x87'", 
"'\x88'", "'\x89'", "'\x8A'", "'\x8B'", 
"'\x8C'", "'\x8D'", "'\x8E'", "'\x8F'", 
"'\x90'", "'\x91'", "'\x92'", "'\x93'", 
"'\x94'", "'\x95'", "'\x96'", "'\x97'", 
"'\x98'", "'\x99'", "'\x9A'", "'\x9B'", 
"'\x9C'", "'\x9D'", "'\x9E'", "'\x9F'", 
"'\xA0'", "'\xA1'", "'\xA2'", "'\xA3'", 
"'\xA4'", "'\xA5'", "'\xA6'", "'\xA7'", 
"'\xA8'", "'\xA9'", "'\xAA'", "'\xAB'", 
"'\xAC'", "'\xAD'", "'\xAE'", "'\xAF'", 
"'\xB0'", "'\xB1'", "'\xB2'", "'\xB3'", 
"'\xB4'", "'\xB5'", "'\xB6'", "'\xB7'", 
"'\xB8'", "'\xB9'", "'\xBA'", "'\xBB'", 
"'\xBC'", "'\xBD'", "'\xBE'", "'\xBF'", 
"'\xC0'", "'\xC1'", "'\xC2'", "'\xC3'", 
"'\xC4'", "'\xC5'", "'\xC6'", "'\xC7'", 
"'\xC8'", "'\xC9'", "'\xCA'", "'\xCB'", 
"'\xCC'", "'\xCD'", "'\xCE'", "'\xCF'", 
"'\xD0'", "'\xD1'", "'\xD2'", "'\xD3'", 
"'\xD4'", "'\xD5'", "'\xD6'", "'\xD7'", 
"'\xD8'", "'\xD9'", "'\xDA'", "'\xDB'", 
"'\xDC'", "'\xDD'", "'\xDE'", "'\xDF'", 
"'\xE0'", "'\xE1'", "'\xE2'", "'\xE3'", 
"'\xE4'", "'\xE5'", "'\xE6'", "'\xE7'", 
"'\xE8'", "'\xE9'", "'\xEA'", "'\xEB'", 
"'\xEC'", "'\xED'", "'\xEE'", "'\xEF'", 
"'\xF0'", "'\xF1'", "'\xF2'", "'\xF3'", 
"'\xF4'", "'\xF5'", "'\xF6'", "'\xF7'", 
"'\xF8'", "'\xF9'", "'\xFA'", "'\xFB'", 
"'\xFC'", "'\xFD'", "'\xFE'", "'\xFF'", 
"<EOF>", "env", "start", "window_size", 
"expect", "send", "expect_exit", "interact", 
"number", "string", "expect_suspend", "require_version"};
const char *LLgetSymbol(int LLtoken) {
	if (LLtoken < -1 || LLtoken > 267 /* == LL_MAXTOKNO */)
		return (char *) 0;
	return LLsymbolTable[LLtoken+1];
}
#include "input.h"
#line 18 "input.g"

#include <stdlib.h>
#include <ctype.h>
#include <limits.h>
#include "replay.h"
#include "common.h"

static td_bool start_parsed;
static td_bool first_directive;
ExpNode *script;

extern int line_number;
extern const char *file_name;
extern char *yytext;

void LLmessage(int class) {
	switch (class) {
		case LL_MISSINGEOF:
			fatal("%s:%d: Unexpected %s at end of file\n", file_name, line_number, LLgetSymbol(LLsymb));
		case LL_DELETE:
			fatal("%s:%d: Unexpected %s\n", file_name, line_number, LLgetSymbol(LLsymb));
		default:
			fatal("%s:%d: Expected %s before %s\n", file_name, line_number, LLgetSymbol(class), LLgetSymbol(LLsymb));
	}
}

void *safe_calloc(size_t size) {
	void *retval = calloc(1, size);
	if (retval == NULL)
		fatal("Out of memory while reading script\n");
	return retval;
}

char *safe_strdup_remove_quotes(const char *string) {
	size_t size;
	char *retval = strdup(string + 1);

	if (retval == NULL)
		fatal("Out of memory while reading script\n");
	if ((size = strlen(retval)) > 0)
		retval[size - 1] = 0;
	return retval;
}

/** Convert a string from the input format to an internally usable string.
	@param string A @a Token with the string to be converted.
	@param descr A description of the string to be included in error messages.
	@return The length of the resulting string.

	The use of this function processes escape characters. The converted
	characters are written in the original string.
*/
static size_t parseEscapes(char *string) {
	size_t maxReadPosition = strlen(string);
	size_t readPosition = 0, writePosition = 0;
	size_t i;

	while(readPosition < maxReadPosition) {
		if (string[readPosition] == '\\') {
			readPosition++;

			if (readPosition == maxReadPosition)
				fatal("Interal error\n");

			switch(string[readPosition++]) {
				case 'n':
					string[writePosition++] = '\n';
					break;
				case 'r':
					string[writePosition++] = '\r';
					break;
				case '\'':
					string[writePosition++] = '\'';
					break;
				case '\\':
					string[writePosition++] = '\\';
					break;
				case 't':
					string[writePosition++] = '\t';
					break;
				case 'b':
					string[writePosition++] = '\b';
					break;
				case 'f':
					string[writePosition++] = '\f';
					break;
				case 'a':
					string[writePosition++] = '\a';
					break;
				case 'v':
					string[writePosition++] = '\v';
					break;
				case '?':
					string[writePosition++] = '\?';
					break;
				case '"':
					string[writePosition++] = '"';
					break;
				case 'x': {
					/* Hexadecimal escapes */
					unsigned int value = 0;
					/* Read at most two characters, or as many as are valid. */
					for (i = 0; i < 2 && (readPosition + i) < maxReadPosition && isxdigit(string[readPosition + i]); i++) {
						value <<= 4;
						if (isdigit(string[readPosition + i]))
							value += (int) (string[readPosition + i] - '0');
						else
							value += (int) (tolower(string[readPosition + i]) - 'a') + 10;
						if (value > UCHAR_MAX)
							fatal("%s:%d: Invalid hexadecimal escape sequence\n", file_name, line_number);
					}
					readPosition += i;

					if (i == 0)
						fatal("%s:%d: Invalid hexadecimal escape sequence\n", file_name, line_number);

					string[writePosition++] = (char) value;
					break;
				}
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7': {
					/* Octal escapes */
					int value = (int)(string[readPosition - 1] - '0');
					size_t maxIdx = string[readPosition - 1] < '4' ? 2 : 1;
					for (i = 0; i < maxIdx && readPosition + i < maxReadPosition && string[readPosition + i] >= '0' && string[readPosition + i] <= '7'; i++)
						value = value * 8 + (int)(string[readPosition + i] - '0');

					readPosition += i;

					string[writePosition++] = (char) value;
					break;
				}
				default:
					string[writePosition++] = string[readPosition - 1];
					break;
			}
		} else {
			string[writePosition++] = string[readPosition++];
		}
	}
	/* Terminate string. */
	string[writePosition] = 0;
	return writePosition;
}


#line 323 "input.c"
static void LL0_input(void);
static ExpNode * LL1_command(void);
static void LL0_input(void){
#line 190 "input.g"
ExpNode *
#line 329 "input.c"
command;
memset(&command, 0, sizeof(command));
{
#line 172 "input.g"

	ExpNode **current = &script;
	start_parsed = td_false;
	first_directive = td_true;

#line 339 "input.c"
LLscnt[0]++;
switch (LLcsymb) {
case 1:/* ENV */
case 2:/* START */
case 3:/* WINDOW_SIZE */
case 4:/* EXPECT */
case 5:/* SEND */
case 6:/* EXPECT_EXIT */
case 7:/* INTERACT */
case 10:/* EXPECT_SUSPEND */
case 11:/* REQUIRE_VERSION */
break;
default: LLskip(); break;
}
LLscnt[0]--;
LLscnt[0]++;
goto LL_0;
for (;;) {
LL_1:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_1;
break;
case 0:/* <NUL> */
break;
case 1:/* ENV */
case 2:/* START */
case 3:/* WINDOW_SIZE */
case 4:/* EXPECT */
case 5:/* SEND */
case 6:/* EXPECT_EXIT */
case 7:/* INTERACT */
case 10:/* EXPECT_SUSPEND */
case 11:/* REQUIRE_VERSION */
LL_0:
LLscnt[0]++;
command = LL1_command();
#line 179 "input.g"
{
			*current = command;
			current = &(*current)->next;
			first_directive = td_false;
		}
#line 383 "input.c"
continue;
}
LLscnt[0]--;
break;
}
#line 185 "input.g"
{
		check_script(file_name, script);
	}
#line 393 "input.c"
}
}
static ExpNode * LL1_command(void){
#line 190 "input.g"
ExpNode *
#line 399 "input.c"
LLretval;
memset(&LLretval, 0, sizeof(LLretval));
{
#line 190 "input.g"

	StringListNode **next;
	LLretval = safe_calloc(sizeof(ExpNode));
	next = &LLretval->un.args;

#line 409 "input.c"
LL_0:
switch (LLcsymb) {
case 1:/* ENV */
LLscnt[0]--;
LLtcnt[9]++;
LLtcnt[9]++;
LL_SCANDONE(257);/* ENV */
LLread();
LLtcnt[9]--;
LL_SCANDONE(265);/* STRING */
#line 197 "input.g"
{
		if (start_parsed)
			fatal("%s:%d: env directive after start directive\n", file_name, line_number);
		LLretval->type = EXP_ENV;
		LLretval->line = line_number;
		*next = safe_calloc(sizeof(StringListNode));
		(*next)->string = safe_strdup_remove_quotes(yytext);
		next = &(*next)->next;
	}
#line 430 "input.c"
LLread();
LLtcnt[9]--;
LL_SCANDONE(265);/* STRING */
#line 207 "input.g"
{
		*next = safe_calloc(sizeof(StringListNode));
		(*next)->string = safe_strdup_remove_quotes(yytext);
		(*next)->length = parseEscapes((*next)->string);
	}
#line 440 "input.c"
LLread();
break;
case 11:/* REQUIRE_VERSION */
LLscnt[0]--;
LLtcnt[8]++;
LL_SCANDONE(267);/* REQUIRE_VERSION */
LLread();
LLtcnt[8]--;
LL_SCANDONE(264);/* NUMBER */
#line 215 "input.g"
{
		if (!first_directive)
			fatal("%s:%d: require_version directive should be the first directive in the recording\n", file_name, line_number);
		LLretval->type = EXP_REQUIRE_VERSION;
		LLretval->line = line_number;
		LLretval->un.number = atoi(yytext);
		if (LLretval->un.number < 1)
			fatal("%s:%d: lowest possible require_version is 1\n", file_name, line_number);
	}
#line 460 "input.c"
LLread();
break;
case 2:/* START */
LLscnt[0]--;
LLtcnt[9]++;
LL_SCANDONE(258);/* START */
#line 226 "input.g"
{
		if (start_parsed)
			fatal("%s:%d: Multiple start directives specified\n", file_name, line_number);
		start_parsed = td_true;
		LLretval->type = EXP_START;
		LLretval->line = line_number;
	}
#line 475 "input.c"
LLread();
switch (LLcsymb) {
case 9:/* STRING */
break;
default: LLskip(); break;
}
LLtcnt[9]--;
LLtcnt[9]++;
goto LL_1;
for (;;) {
LL_2:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_2;
break;
case 0:/* <NUL> */
case 1:/* ENV */
case 2:/* START */
case 3:/* WINDOW_SIZE */
case 4:/* EXPECT */
case 5:/* SEND */
case 6:/* EXPECT_EXIT */
case 7:/* INTERACT */
case 10:/* EXPECT_SUSPEND */
case 11:/* REQUIRE_VERSION */
break;
case 9:/* STRING */
LL_1:
LL_SCANDONE(265);/* STRING */
#line 235 "input.g"
{
			*next = safe_calloc(sizeof(StringListNode));
			(*next)->string = safe_strdup_remove_quotes(yytext);
			(*next)->length = parseEscapes((*next)->string);
			next = &(*next)->next;
		}
#line 512 "input.c"
LLread();
continue;
}
LLtcnt[9]--;
break;
}
break;
case 3:/* WINDOW_SIZE */
LLscnt[0]--;
LLtcnt[8]++;
LLtcnt[8]++;
LLtcnt[8]++;
LL_SCANDONE(259);/* WINDOW_SIZE */
LLread();
LLtcnt[8]--;
LL_SCANDONE(264);/* NUMBER */
#line 245 "input.g"
{
		LLretval->type = EXP_WINDOW_SIZE;
		LLretval->line = line_number;
		LLretval->un.size.columns = atoi(yytext);
	}
#line 535 "input.c"
LLread();
LLtcnt[8]--;
LL_SCANDONE(264);/* NUMBER */
#line 251 "input.g"
{
		LLretval->un.size.rows = atoi(yytext);
	}
#line 543 "input.c"
LLread();
LL_3:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_3;
LLtcnt[8]--;
break;
case 0:/* <NUL> */
case 1:/* ENV */
case 2:/* START */
case 3:/* WINDOW_SIZE */
case 4:/* EXPECT */
case 5:/* SEND */
case 6:/* EXPECT_EXIT */
case 7:/* INTERACT */
case 10:/* EXPECT_SUSPEND */
case 11:/* REQUIRE_VERSION */
LLtcnt[8]--;
break;
case 8:/* NUMBER */
LLtcnt[8]--;
LLtcnt[12]++;
LL_SCANDONE(264);/* NUMBER */
#line 256 "input.g"
{
			LLretval->un.size.delay = atoi(yytext);
		}
#line 571 "input.c"
LLread();
LL_4:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_4;
LLtcnt[12]--;
break;
case 0:/* <NUL> */
case 1:/* ENV */
case 2:/* START */
case 3:/* WINDOW_SIZE */
case 4:/* EXPECT */
case 5:/* SEND */
case 6:/* EXPECT_EXIT */
case 7:/* INTERACT */
case 10:/* EXPECT_SUSPEND */
case 11:/* REQUIRE_VERSION */
LLtcnt[12]--;
break;
case 12:/* '>' */
LLtcnt[12]--;
LLtcnt[8]++;
LL_SCANDONE(62);/* '>' */
LLread();
LLtcnt[8]--;
LL_SCANDONE(264);/* NUMBER */
#line 262 "input.g"
{
				LLretval->un.size.min_delay = atoi(yytext);
				if (LLretval->un.size.min_delay > LLretval->un.size.delay)
					LLretval->un.size.min_delay = LLretval->un.size.delay;
			}
#line 604 "input.c"
LLread();
}
}
break;
case 4:/* EXPECT */
LLscnt[0]--;
LLtcnt[9]++;
LL_SCANDONE(260);/* EXPECT */
#line 271 "input.g"
{
		if (!start_parsed)
			fatal("%s:%d: expect directive before start directive\n", file_name, line_number);
		LLretval->type = EXP_EXPECT;
		LLretval->line = line_number;
	}
#line 620 "input.c"
LLread();
switch (LLcsymb) {
case 9:/* STRING */
break;
default: LLskip(); break;
}
LLtcnt[9]--;
LLtcnt[9]++;
goto LL_5;
for (;;) {
LL_6:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_6;
break;
case 0:/* <NUL> */
case 1:/* ENV */
case 2:/* START */
case 3:/* WINDOW_SIZE */
case 4:/* EXPECT */
case 5:/* SEND */
case 6:/* EXPECT_EXIT */
case 7:/* INTERACT */
case 10:/* EXPECT_SUSPEND */
case 11:/* REQUIRE_VERSION */
break;
case 9:/* STRING */
LL_5:
LL_SCANDONE(265);/* STRING */
#line 279 "input.g"
{
			*next = safe_calloc(sizeof(StringListNode));
			(*next)->string = safe_strdup_remove_quotes(yytext);
			(*next)->length = parseEscapes((*next)->string);
			next = &(*next)->next;
		}
#line 657 "input.c"
LLread();
continue;
}
LLtcnt[9]--;
break;
}
break;
case 5:/* SEND */
LLscnt[0]--;
LLscnt[1]++;
LL_SCANDONE(261);/* SEND */
#line 288 "input.g"
{
		if (!start_parsed)
			fatal("%s:%d: send directive before start directive\n", file_name, line_number);
		LLretval->type = EXP_SEND;
		LLretval->line = line_number;
	}
#line 676 "input.c"
LLread();
switch (LLcsymb) {
case 8:/* NUMBER */
break;
default: LLskip(); break;
}
LLscnt[1]--;
LLtcnt[8]++;
goto LL_7;
for (;;) {
LL_8:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_8;
break;
case 0:/* <NUL> */
case 1:/* ENV */
case 2:/* START */
case 3:/* WINDOW_SIZE */
case 4:/* EXPECT */
case 5:/* SEND */
case 6:/* EXPECT_EXIT */
case 7:/* INTERACT */
case 10:/* EXPECT_SUSPEND */
case 11:/* REQUIRE_VERSION */
break;
case 8:/* NUMBER */
LL_7:
LLtcnt[12]++;
LLtcnt[9]++;
LL_SCANDONE(264);/* NUMBER */
#line 296 "input.g"
{
			*next = safe_calloc(sizeof(StringListNode));
			(*next)->delay = atoi(yytext);
		}
#line 713 "input.c"
LLread();
LL_9:
switch (LLcsymb) {
default:
if (LLskip()) goto LL_9;
LLtcnt[12]--;
break;
case 9:/* STRING */
LLtcnt[12]--;
break;
case 12:/* '>' */
LLtcnt[12]--;
LLtcnt[8]++;
LL_SCANDONE(62);/* '>' */
LLread();
LLtcnt[8]--;
LL_SCANDONE(264);/* NUMBER */
#line 303 "input.g"
{
				(*next)->min_delay = atoi(yytext);
				if ((*next)->delay < (*next)->min_delay)
					(*next)->min_delay = (*next)->delay;
			}
#line 737 "input.c"
LLread();
}
LLtcnt[9]--;
LL_SCANDONE(265);/* STRING */
#line 310 "input.g"
{
			(*next)->string = safe_strdup_remove_quotes(yytext);
			(*next)->length = parseEscapes((*next)->string);
			next = &(*next)->next;
		}
#line 748 "input.c"
LLread();
continue;
}
LLtcnt[8]--;
break;
}
break;
case 6:/* EXPECT_EXIT */
LLscnt[0]--;
LLtcnt[8]++;
LL_SCANDONE(262);/* EXPECT_EXIT */
LLread();
LLtcnt[8]--;
LL_SCANDONE(264);/* NUMBER */
#line 319 "input.g"
{
		if (!start_parsed)
			fatal("%s:%d: expect_exit directive before start directive\n", file_name, line_number);
		LLretval->type = EXP_EXPECT_EXIT;
		LLretval->line = line_number;
		LLretval->un.number = atoi(yytext);
	}
#line 771 "input.c"
LLread();
break;
default:
if (LLskip())
goto LL_0;
/*FALLTHROUGH*/
case 10:/* EXPECT_SUSPEND */
LLscnt[0]--;
LL_SCANDONE(266);/* EXPECT_SUSPEND */
#line 328 "input.g"
{
		if (!start_parsed)
			fatal("%s:%d: expect_suspend directive before start directive\n", file_name, line_number);
		LLretval->type = EXP_EXPECT_SUSPEND;
		LLretval->line = line_number;
	}
#line 788 "input.c"
LLread();
break;
case 7:/* INTERACT */
LLscnt[0]--;
LL_SCANDONE(263);/* INTERACT */
#line 336 "input.g"
{
		if (!start_parsed)
			fatal("%s:%d: interact directive before start directive\n", file_name, line_number);
		LLretval->type = EXP_INTERACT;
		LLretval->line = line_number;
	}
#line 801 "input.c"
LLread();
break;
}
}
return LLretval;
}
void parse(void) {
	memset(LLscnt, 0, LL_NSETS * sizeof(int));
	memset(LLtcnt, 0, LL_NTERMINALS * sizeof(int));
	LLtcnt[0]++;
	LLsymb = 0;
	LLreissue = -2 /* LL_NEW_TOKEN */;
	LLread();
	LL0_input();
	if (LLcsymb != 0) LLerror(256 /* EOFILE*/);
}