xref: /inferno-os/appl/cmd/mash/mashparse.b (revision 37da2899f40661e3e9631e497da8dc59b971cbd0)
1implement Mashparse;
2
3#line	2	"mash.y"
4include	"mash.m";
5
6#
7#	mash parser.  Thread safe.
8#
9Mashparse: module {
10
11	PATH:	con "/dis/lib/mashparse.dis";
12
13	init:		fn(l: Mashlib);
14	parse:	fn(e: ref Mashlib->Env);
15
16	YYSTYPE: adt
17	{
18		cmd:		ref Mashlib->Cmd;
19		item:		ref Mashlib->Item;
20		items:	list of ref Mashlib->Item;
21		flag:		int;
22	};
23
24	YYETYPE:	type ref Mashlib->Env;
25Lcase: con	57346;
26Lfor: con	57347;
27Lif: con	57348;
28Lwhile: con	57349;
29Loffparen: con	57350;
30Lelse: con	57351;
31Lpipe: con	57352;
32Leqeq: con	57353;
33Lmatch: con	57354;
34Lnoteq: con	57355;
35Lcons: con	57356;
36Lcaret: con	57357;
37Lnot: con	57358;
38Lhd: con	57359;
39Ltl: con	57360;
40Llen: con	57361;
41Lword: con	57362;
42Lbackq: con	57363;
43Lcolon: con	57364;
44Lcolonmatch: con	57365;
45Ldefeq: con	57366;
46Leq: con	57367;
47Lmatched: con	57368;
48Lquote: con	57369;
49Loncurly: con	57370;
50Lonparen: con	57371;
51Loffcurly: con	57372;
52Lat: con	57373;
53Lgreat: con	57374;
54Lgreatgreat: con	57375;
55Lless: con	57376;
56Llessgreat: con	57377;
57Lfn: con	57378;
58Lin: con	57379;
59Lrescue: con	57380;
60Land: con	57381;
61Leof: con	57382;
62Lsemi: con	57383;
63Lerror: con	57384;
64
65};
66
67#line	28	"mash.y"
68	lib:		Mashlib;
69
70	Cmd, Item, Stab, Env:		import lib;
71YYEOFCODE: con 1;
72YYERRCODE: con 2;
73YYMAXDEPTH: con 150;
74
75#line	244	"mash.y"
76
77
78init(l: Mashlib)
79{
80	lib = l;
81}
82
83parse(e: ref Env)
84{
85	y := ref YYENV;
86	y.yyenv = e;
87	y.yysys = lib->sys;
88	y.yystderr = e.stderr;
89	yyeparse(y);
90}
91
92yyerror(e: ref YYENV, s: string)
93{
94	e.yyenv.report(s);
95	e.yyenv.suck();
96}
97
98yyelex(e: ref YYENV): int
99{
100	return e.yyenv.lex(e.yylval);
101}
102yyexca := array[] of {-1, 1,
103	1, -1,
104	-2, 0,
105-1, 2,
106	1, 1,
107	-2, 0,
108-1, 21,
109	24, 51,
110	25, 51,
111	-2, 48,
112};
113YYNPROD: con 75;
114YYPRIVATE: con 57344;
115yytoknames: array of string;
116yystates: array of string;
117yydebug: con 0;
118YYLAST:	con 249;
119yyact := array[] of {
120   7,  20,   4,  49,  41,  47, 110,  65, 103,  95,
121  17,  24,  32, 112,  33, 146, 142,  38,  39,  28,
122  59,  60, 140, 129,  40,  64,  22,  46,  63,  35,
123  36,  34,  37, 128, 127,  38,  67,  69,  70,  71,
124  27,  26,  25,  76,  22,  75, 126, 111,  77,  74,
125  45,  80,  81,  38,  44,  78,  88,  89,  90,  91,
126  92,  68,  22,  98,  99,  93,  94,  32, 124,  33,
127  97, 106,  62, 107,  38,  39, 104, 108, 109, 104,
128  68,  40, 105,  22,  66, 105,  56, 143,  55, 116,
129 117, 118, 119, 120,  73,  32,  32,  33,  33,  38,
130  39, 122, 132,  36, 131,  37,  40, 123,  22,  72,
131 125,  56,  43,  55, 135, 136,  58,  57, 133,  62,
132 134, 139,  38,   6,  62,  16,  13,  14,  15, 141,
133  66,  22,  96,  67,  69,  62,  32,  79,  33,  84,
134  83,  21,  24,  61, 147, 148, 144,  24, 149,  11,
135  22,   3,  12,  16,  13,  14,  15,  18,   2,  19,
136   1,   5,  85,  87,  86,  84,  83,   8, 101,  21,
137  54,  51,  52,  53,  48,  39,   9,  11,  22,  82,
138  12,  40,  42,  50, 137,  18,  56,  19,  55,  54,
139  51,  52,  53,  48,  39, 115, 138,  38,  39, 130,
140  40,  10,  50,  29,  40,  56,  22,  55, 102,  56,
141  31,  55,  85,  87,  86,  84,  83, 121,  23,  30,
142  85,  87,  86,  84,  83, 114,   0, 145,  85,  87,
143  86,  84,  83, 113,   0,   0,  85,  87,  86,  84,
144  83, 100,   0,   0,  85,  87,  86,  84,  83,
145};
146yypact := array[] of {
147-1000,-1000, 121,-1000,-1000,-1000,-1000,   1,-1000,-1000,
148  -3,-1000,  84,  25,  21,  -2, 173,  92,  15,  15,
149 120,-1000, 173,-1000, 149,-1000,-1000,-1000,-1000,-1000,
150-1000,-1000, 109,-1000, 102,  33,  15,  15,-1000,  81,
151  66,  19, 149,-1000, 117, 173, 173, 151,-1000,-1000,
152 173, 173, 173, 173, 173,  56,  52,-1000,-1000, 104,
153 104,  15,  15, 233,-1000,  54,-1000, 109,-1000, 109,
154 109, 109,-1000,-1000,-1000,-1000,   1,  17, -24,-1000,
155 225, 217,-1000, 173, 173, 173, 173, 173, 209,-1000,
156-1000,-1000,-1000, 177, 177,-1000,-1000,-1000,  57,-1000,
157-1000,-1000,-1000,-1000,  40,-1000,  16,   4,   3,  -7,
158  70,-1000,-1000, 149, 149, 154,-1000, 125, 125, 125,
159 125,-1000,  -8,-1000,-1000, -14,-1000,-1000,-1000,-1000,
160-1000,  15,  15,  70,  79, 137, 132,-1000,-1000, 201,
161-1000, -15,-1000, 149, 149, 149,-1000, 132, 132,-1000,
162};
163yypgo := array[] of {
164   0, 218, 203,   3, 208,   1, 199,  10, 201,   7,
165 196, 195,   0,   2,   4, 182, 176,   6,   5,   8,
166 168,   9, 167, 160, 158, 151,
167};
168yyr1 := array[] of {
169   0,  23,  24,  24,  25,  25,  25,  15,  15,  13,
170  14,  14,  12,  12,  12,  22,  22,  16,  16,  16,
171  16,  16,  16,  16,  16,  16,  16,  16,  16,  19,
172  19,  20,  20,  21,  21,  11,  11,  10,   8,   8,
173   2,   2,   4,   4,   3,   3,   3,   3,   5,   5,
174   5,   7,   9,   9,  17,  17,   6,   6,   6,   6,
175   1,   1,   1,  18,  18,  18,  18,  18,  18,  18,
176  18,  18,  18,  18,  18,
177};
178yyr2 := array[] of {
179   0,   1,   0,   2,   1,   1,   1,   0,   2,   2,
180   1,   2,   1,   1,   3,   1,   4,   4,   5,   7,
181   5,   7,   5,   5,   3,   3,   3,   3,   4,   4,
182   3,   0,   1,   0,   3,   0,   2,   3,   1,   2,
183   1,   1,   1,   1,   4,   4,   4,   4,   1,   3,
184   3,   1,   0,   2,   0,   2,   2,   2,   2,   2,
185   1,   1,   1,   1,   1,   3,   3,   2,   2,   2,
186   2,   3,   3,   3,   3,
187};
188yychk := array[] of {
189-1000, -23, -24, -25, -13,  40,   2, -12, -22, -16,
190  -8,  28,  31,   5,   6,   7,   4,  -7,  36,  38,
191  -5,  20,  29,  -1,  10,  41,  40,  39,  22,  -2,
192  -4,  -6,  -5,  -3,  34,  32,  33,  35,  20,  21,
193  27, -14, -15,  28,  29,  29,  29, -18,  20,  -3,
194  29,  17,  18,  19,  16,  34,  32,  25,  24,  -5,
195  -5,  23,  15, -18, -12,  -9,  28,  -5,  28,  -5,
196  -5,  -5,  28,  28,  30, -13, -12, -14,  -7,  20,
197 -18, -18,  28,  15,  14,  11,  13,  12, -18, -18,
198 -18, -18, -18,  -9,  -9, -21,  28, -21,  -5,  -5,
199   8, -20,  -4, -19,  22,  28, -14, -14, -14, -14,
200 -17,  30,  37,   8,   8, -11, -18, -18, -18, -18,
201 -18,   8, -14, -19,  28, -14,  30,  30,  30,  30,
202  -6,  34,  32, -17,  -9, -12, -12,  30, -10, -18,
203  30, -14,  30,   8,   9,  26,  30, -12, -12, -13,
204};
205yydef := array[] of {
206   2,  -2,  -2,   3,   4,   5,   6,   0,  12,  13,
207  15,   7,   0,   0,   0,   0,   0,   0,   0,   0,
208  38,  -2,   0,   9,   0,  60,  61,  62,  52,  39,
209  40,  41,  42,  43,   0,   0,   0,   0,  48,   0,
210   0,   0,  10,   7,   0,   0,   0,   0,  63,  64,
211   0,   0,   0,   0,   0,   0,   0,  52,  52,  33,
212  33,   0,   0,   0,  14,  31,   7,  56,   7,  57,
213  58,  59,   7,   7,  54,   8,  11,   0,   0,  51,
214   0,   0,  35,   0,   0,   0,   0,   0,   0,  67,
215  68,  69,  70,  24,  25,  26,   7,  27,   0,  49,
216  50,  16,  53,  32,   0,   7,   0,   0,   0,   0,
217  17,  54,  52,   0,   0,   0,  66,  71,  72,  73,
218  74,  65,   0,  28,   7,   0,  46,  47,  44,  45,
219  55,   0,   0,  18,   0,  20,  22,  23,  36,   0,
220  34,   0,  30,   0,   0,   0,  29,  19,  21,  37,
221};
222yytok1 := array[] of {
223   1,
224};
225yytok2 := array[] of {
226   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,
227  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,
228  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
229  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,
230  42,
231};
232yytok3 := array[] of {
233   0
234};
235
236YYFLAG: con -1000;
237
238# parser for yacc output
239YYENV: adt
240{
241	yylval:	ref YYSTYPE;	# lexical value
242	yyval:	YYSTYPE;		# goto value
243	yyenv:	YYETYPE;		# useer environment
244	yynerrs:	int;			# number of errors
245	yyerrflag:	int;			# error recovery flag
246	yysys:	Sys;
247	yystderr:	ref Sys->FD;
248};
249
250yytokname(yyc: int): string
251{
252	if(yyc > 0 && yyc <= len yytoknames && yytoknames[yyc-1] != nil)
253		return yytoknames[yyc-1];
254	return "<"+string yyc+">";
255}
256
257yystatname(yys: int): string
258{
259	if(yys >= 0 && yys < len yystates && yystates[yys] != nil)
260		return yystates[yys];
261	return "<"+string yys+">\n";
262}
263
264yylex1(e: ref YYENV): int
265{
266	c, yychar : int;
267	yychar = yyelex(e);
268	if(yychar <= 0)
269		c = yytok1[0];
270	else if(yychar < len yytok1)
271		c = yytok1[yychar];
272	else if(yychar >= YYPRIVATE && yychar < YYPRIVATE+len yytok2)
273		c = yytok2[yychar-YYPRIVATE];
274	else{
275		n := len yytok3;
276		c = 0;
277		for(i := 0; i < n; i+=2) {
278			if(yytok3[i+0] == yychar) {
279				c = yytok3[i+1];
280				break;
281			}
282		}
283		if(c == 0)
284			c = yytok2[1];	# unknown char
285	}
286	if(yydebug >= 3)
287		e.yysys->fprint(e.yystderr, "lex %.4ux %s\n", yychar, yytokname(c));
288	return c;
289}
290
291YYS: adt
292{
293	yyv: YYSTYPE;
294	yys: int;
295};
296
297yyparse(): int
298{
299	return yyeparse(nil);
300}
301
302yyeparse(e: ref YYENV): int
303{
304	if(e == nil)
305		e = ref YYENV;
306	if(e.yylval == nil)
307		e.yylval = ref YYSTYPE;
308	if(e.yysys == nil) {
309		e.yysys = load Sys "$Sys";
310		e.yystderr = e.yysys->fildes(2);
311	}
312
313	yys := array[YYMAXDEPTH] of YYS;
314
315	yystate := 0;
316	yychar := -1;
317	e.yynerrs = 0;
318	e.yyerrflag = 0;
319	yyp := -1;
320	yyn := 0;
321
322yystack:
323	for(;;){
324		# put a state and value onto the stack
325		if(yydebug >= 4)
326			e.yysys->fprint(e.yystderr, "char %s in %s", yytokname(yychar), yystatname(yystate));
327
328		yyp++;
329		if(yyp >= YYMAXDEPTH) {
330			yyerror(e, "yacc stack overflow");
331			yyn = 1;
332			break yystack;
333		}
334		yys[yyp].yys = yystate;
335		yys[yyp].yyv = e.yyval;
336
337		for(;;){
338			yyn = yypact[yystate];
339			if(yyn > YYFLAG) {	# simple state
340				if(yychar < 0)
341					yychar = yylex1(e);
342				yyn += yychar;
343				if(yyn >= 0 && yyn < YYLAST) {
344					yyn = yyact[yyn];
345					if(yychk[yyn] == yychar) { # valid shift
346						yychar = -1;
347						yyp++;
348						if(yyp >= YYMAXDEPTH) {
349							yyerror(e, "yacc stack overflow");
350							yyn = 1;
351							break yystack;
352						}
353						yystate = yyn;
354						yys[yyp].yys = yystate;
355						yys[yyp].yyv = *e.yylval;
356						if(e.yyerrflag > 0)
357							e.yyerrflag--;
358						if(yydebug >= 4)
359							e.yysys->fprint(e.yystderr, "char %s in %s", yytokname(yychar), yystatname(yystate));
360						continue;
361					}
362				}
363			}
364
365			# default state action
366			yyn = yydef[yystate];
367			if(yyn == -2) {
368				if(yychar < 0)
369					yychar = yylex1(e);
370
371				# look through exception table
372				for(yyxi:=0;; yyxi+=2)
373					if(yyexca[yyxi] == -1 && yyexca[yyxi+1] == yystate)
374						break;
375				for(yyxi += 2;; yyxi += 2) {
376					yyn = yyexca[yyxi];
377					if(yyn < 0 || yyn == yychar)
378						break;
379				}
380				yyn = yyexca[yyxi+1];
381				if(yyn < 0){
382					yyn = 0;
383					break yystack;
384				}
385			}
386
387			if(yyn != 0)
388				break;
389
390			# error ... attempt to resume parsing
391			if(e.yyerrflag == 0) { # brand new error
392				yyerror(e, "syntax error");
393				e.yynerrs++;
394				if(yydebug >= 1) {
395					e.yysys->fprint(e.yystderr, "%s", yystatname(yystate));
396					e.yysys->fprint(e.yystderr, "saw %s\n", yytokname(yychar));
397				}
398			}
399
400			if(e.yyerrflag != 3) { # incompletely recovered error ... try again
401				e.yyerrflag = 3;
402
403				# find a state where "error" is a legal shift action
404				while(yyp >= 0) {
405					yyn = yypact[yys[yyp].yys] + YYERRCODE;
406					if(yyn >= 0 && yyn < YYLAST) {
407						yystate = yyact[yyn];  # simulate a shift of "error"
408						if(yychk[yystate] == YYERRCODE) {
409							yychar = -1;
410							continue yystack;
411						}
412					}
413
414					# the current yyp has no shift on "error", pop stack
415					if(yydebug >= 2)
416						e.yysys->fprint(e.yystderr, "error recovery pops state %d, uncovers %d\n",
417							yys[yyp].yys, yys[yyp-1].yys );
418					yyp--;
419				}
420				# there is no state on the stack with an error shift ... abort
421				yyn = 1;
422				break yystack;
423			}
424
425			# no shift yet; clobber input char
426			if(yydebug >= 2)
427				e.yysys->fprint(e.yystderr, "error recovery discards %s\n", yytokname(yychar));
428			if(yychar == YYEOFCODE) {
429				yyn = 1;
430				break yystack;
431			}
432			yychar = -1;
433			# try again in the same state
434		}
435
436		# reduction by production yyn
437		if(yydebug >= 2)
438			e.yysys->fprint(e.yystderr, "reduce %d in:\n\t%s", yyn, yystatname(yystate));
439
440		yypt := yyp;
441		yyp -= yyr2[yyn];
442#		yyval = yys[yyp+1].yyv;
443		yym := yyn;
444
445		# consult goto table to find next state
446		yyn = yyr1[yyn];
447		yyg := yypgo[yyn];
448		yyj := yyg + yys[yyp].yys + 1;
449
450		if(yyj >= YYLAST || yychk[yystate=yyact[yyj]] != -yyn)
451			yystate = yyact[yyg];
452		case yym {
453
4544=>
455#line	63	"mash.y"
456{ yys[yypt-0].yyv.cmd.xeq(e.yyenv); }
4577=>
458#line	69	"mash.y"
459{ e.yyval.cmd = nil; }
4608=>
461#line	71	"mash.y"
462{ e.yyval.cmd = Cmd.cmd2(Cseq, yys[yypt-1].yyv.cmd, yys[yypt-0].yyv.cmd); }
4639=>
464#line	75	"mash.y"
465{ e.yyval.cmd = yys[yypt-1].yyv.cmd.mkcmd(e.yyenv, yys[yypt-0].yyv.flag); }
46610=>
467e.yyval.cmd = yys[yyp+1].yyv.cmd;
46811=>
469#line	80	"mash.y"
470{ e.yyval.cmd = Cmd.cmd2(Cseq, yys[yypt-1].yyv.cmd, yys[yypt-0].yyv.cmd.mkcmd(e.yyenv, 0)); }
47112=>
472e.yyval.cmd = yys[yyp+1].yyv.cmd;
47313=>
474e.yyval.cmd = yys[yyp+1].yyv.cmd;
47514=>
476#line	86	"mash.y"
477{  e.yyval.cmd = Cmd.cmd2(Cpipe, yys[yypt-2].yyv.cmd, yys[yypt-0].yyv.cmd); }
47815=>
479#line	90	"mash.y"
480{ e.yyval.cmd = e.yyenv.mksimple(yys[yypt-0].yyv.items); }
48116=>
482#line	92	"mash.y"
483{
484				yys[yypt-0].yyv.cmd.words = e.yyenv.mklist(yys[yypt-1].yyv.items);
485				e.yyval.cmd = Cmd.cmd1w(Cdepend, yys[yypt-0].yyv.cmd, e.yyenv.mklist(yys[yypt-3].yyv.items));
486			}
48717=>
488#line	99	"mash.y"
489{ e.yyval.cmd = yys[yypt-0].yyv.cmd.cmde(Cgroup, yys[yypt-2].yyv.cmd, nil); }
49018=>
491#line	101	"mash.y"
492{ e.yyval.cmd = yys[yypt-0].yyv.cmd.cmde(Csubgroup, yys[yypt-2].yyv.cmd, nil); }
49319=>
494#line	103	"mash.y"
495{ e.yyval.cmd = Cmd.cmd1i(Cfor, yys[yypt-0].yyv.cmd, yys[yypt-4].yyv.item); e.yyval.cmd.words = lib->revitems(yys[yypt-2].yyv.items); }
49620=>
497#line	105	"mash.y"
498{ e.yyval.cmd = Cmd.cmd2(Cif, yys[yypt-2].yyv.cmd, yys[yypt-0].yyv.cmd); }
49921=>
500#line	107	"mash.y"
501{ e.yyval.cmd = Cmd.cmd2(Cif, yys[yypt-4].yyv.cmd, Cmd.cmd2(Celse, yys[yypt-2].yyv.cmd, yys[yypt-0].yyv.cmd)); }
50222=>
503#line	109	"mash.y"
504{ e.yyval.cmd = Cmd.cmd2(Cwhile, yys[yypt-2].yyv.cmd, yys[yypt-0].yyv.cmd); }
50523=>
506#line	111	"mash.y"
507{ e.yyval.cmd = Cmd.cmd2(Ccase, yys[yypt-3].yyv.cmd, yys[yypt-1].yyv.cmd.rotcases()); }
50824=>
509#line	113	"mash.y"
510{ e.yyval.cmd = Cmd.cmdiw(Ceq, yys[yypt-2].yyv.item, yys[yypt-0].yyv.items); }
51125=>
512#line	115	"mash.y"
513{ e.yyval.cmd = Cmd.cmdiw(Cdefeq, yys[yypt-2].yyv.item, yys[yypt-0].yyv.items); }
51426=>
515#line	117	"mash.y"
516{ e.yyval.cmd = Cmd.cmd1i(Cfn, yys[yypt-0].yyv.cmd, yys[yypt-1].yyv.item); }
51727=>
518#line	119	"mash.y"
519{ e.yyval.cmd = Cmd.cmd1i(Crescue, yys[yypt-0].yyv.cmd, yys[yypt-1].yyv.item); }
52028=>
521#line	121	"mash.y"
522{
523				yys[yypt-0].yyv.cmd.item = yys[yypt-1].yyv.item;
524				e.yyval.cmd = Cmd.cmd1i(Crule, yys[yypt-0].yyv.cmd, yys[yypt-3].yyv.item);
525			}
52629=>
527#line	128	"mash.y"
528{ e.yyval.cmd = Cmd.cmd1(Clistgroup, yys[yypt-1].yyv.cmd); }
52930=>
530#line	130	"mash.y"
531{ e.yyval.cmd = Cmd.cmd1(Cgroup, yys[yypt-1].yyv.cmd); }
53231=>
533#line	134	"mash.y"
534{ e.yyval.cmd = Cmd.cmd1(Cnop, nil); }
53532=>
536e.yyval.cmd = yys[yyp+1].yyv.cmd;
53733=>
538#line	139	"mash.y"
539{ e.yyval.cmd = nil; }
54034=>
541#line	141	"mash.y"
542{ e.yyval.cmd = yys[yypt-1].yyv.cmd; }
54335=>
544#line	145	"mash.y"
545{ e.yyval.cmd = nil; }
54636=>
547#line	147	"mash.y"
548{ e.yyval.cmd = Cmd.cmd2(Ccases, yys[yypt-1].yyv.cmd, yys[yypt-0].yyv.cmd); }
54937=>
550#line	151	"mash.y"
551{ e.yyval.cmd = Cmd.cmd2(Cmatched, yys[yypt-2].yyv.cmd, yys[yypt-0].yyv.cmd); }
55238=>
553#line	155	"mash.y"
554{ e.yyval.items = yys[yypt-0].yyv.item :: nil; }
55539=>
556#line	157	"mash.y"
557{ e.yyval.items = yys[yypt-0].yyv.item :: yys[yypt-1].yyv.items; }
55840=>
559e.yyval.item = yys[yyp+1].yyv.item;
56041=>
561e.yyval.item = yys[yyp+1].yyv.item;
56242=>
563e.yyval.item = yys[yyp+1].yyv.item;
56443=>
565e.yyval.item = yys[yyp+1].yyv.item;
56644=>
567#line	169	"mash.y"
568{ e.yyval.item = Item.itemc(Ibackq, yys[yypt-1].yyv.cmd); }
56945=>
570#line	171	"mash.y"
571{ e.yyval.item = Item.itemc(Iquote, yys[yypt-1].yyv.cmd); }
57246=>
573#line	173	"mash.y"
574{ e.yyval.item = Item.itemc(Iinpipe, yys[yypt-1].yyv.cmd); }
57547=>
576#line	175	"mash.y"
577{ e.yyval.item = Item.itemc(Ioutpipe, yys[yypt-1].yyv.cmd); }
57848=>
579e.yyval.item = yys[yyp+1].yyv.item;
58049=>
581#line	180	"mash.y"
582{ e.yyval.item = Item.item2(Icaret, yys[yypt-2].yyv.item, yys[yypt-0].yyv.item); }
58350=>
584#line	182	"mash.y"
585{ e.yyval.item = Item.itemc(Iexpr, yys[yypt-1].yyv.cmd); }
58651=>
587#line	186	"mash.y"
588{ e.yyval.item = yys[yypt-0].yyv.item.sword(e.yyenv); }
58952=>
590#line	190	"mash.y"
591{ e.yyval.items = nil; }
59253=>
593#line	192	"mash.y"
594{ e.yyval.items = yys[yypt-0].yyv.item :: yys[yypt-1].yyv.items; }
59554=>
596#line	196	"mash.y"
597{ e.yyval.cmd = ref Cmd; e.yyval.cmd.error = 0; }
59855=>
599#line	198	"mash.y"
600{ e.yyval.cmd = yys[yypt-1].yyv.cmd; yys[yypt-1].yyv.cmd.cmdio(e.yyenv, yys[yypt-0].yyv.item); }
60156=>
602#line	202	"mash.y"
603{ e.yyval.item = Item.itemr(Rin, yys[yypt-0].yyv.item); }
60457=>
605#line	204	"mash.y"
606{ e.yyval.item = Item.itemr(Rout, yys[yypt-0].yyv.item); }
60758=>
608#line	206	"mash.y"
609{ e.yyval.item = Item.itemr(Rappend, yys[yypt-0].yyv.item); }
61059=>
611#line	208	"mash.y"
612{ e.yyval.item = Item.itemr(Rinout, yys[yypt-0].yyv.item); }
61360=>
614#line	212	"mash.y"
615{ e.yyval.flag = 0; }
61661=>
617#line	214	"mash.y"
618{ e.yyval.flag = 0; }
61962=>
620#line	216	"mash.y"
621{ e.yyval.flag = 1; }
62263=>
623#line	220	"mash.y"
624{ e.yyval.cmd = Cmd.cmd1i(Cword, nil, yys[yypt-0].yyv.item); }
62564=>
626#line	222	"mash.y"
627{ e.yyval.cmd = Cmd.cmd1i(Cword, nil, yys[yypt-0].yyv.item); }
62865=>
629#line	224	"mash.y"
630{ e.yyval.cmd = yys[yypt-1].yyv.cmd; }
63166=>
632#line	226	"mash.y"
633{ e.yyval.cmd = Cmd.cmd2(Ccaret, yys[yypt-2].yyv.cmd, yys[yypt-0].yyv.cmd); }
63467=>
635#line	228	"mash.y"
636{ e.yyval.cmd = Cmd.cmd1(Chd, yys[yypt-0].yyv.cmd); }
63768=>
638#line	230	"mash.y"
639{ e.yyval.cmd = Cmd.cmd1(Ctl, yys[yypt-0].yyv.cmd); }
64069=>
641#line	232	"mash.y"
642{ e.yyval.cmd = Cmd.cmd1(Clen, yys[yypt-0].yyv.cmd); }
64370=>
644#line	234	"mash.y"
645{ e.yyval.cmd = Cmd.cmd1(Cnot, yys[yypt-0].yyv.cmd); }
64671=>
647#line	236	"mash.y"
648{ e.yyval.cmd = Cmd.cmd2(Ccons, yys[yypt-2].yyv.cmd, yys[yypt-0].yyv.cmd); }
64972=>
650#line	238	"mash.y"
651{ e.yyval.cmd = Cmd.cmd2(Ceqeq, yys[yypt-2].yyv.cmd, yys[yypt-0].yyv.cmd); }
65273=>
653#line	240	"mash.y"
654{ e.yyval.cmd = Cmd.cmd2(Cnoteq, yys[yypt-2].yyv.cmd, yys[yypt-0].yyv.cmd); }
65574=>
656#line	242	"mash.y"
657{ e.yyval.cmd = Cmd.cmd2(Cmatch, yys[yypt-2].yyv.cmd, yys[yypt-0].yyv.cmd); }
658		}
659	}
660
661	return yyn;
662}
663