summaryrefslogtreecommitdiff
path: root/test/rlhc.d/case/patact_cs.cs-A-F1--goto-backend.exp
blob: ffeb80dcf1163708d939a0bff5a59b55ed9119a6 (plain)
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
using System;
// Disables lots of warnings that appear in the test suite
#pragma warning disable 0168, 0169, 0219, 0162, 0414
namespace Test {
	class Test
	{
		char comm;
		int top;
		int [] stack = new int [32];
		int ts;
		int te;
		int act;
		int value;
		
		
		
		
		static readonly char  []_patact_trans_keys = { '\u0001', '\u0000', '\u0008', '\u0008', '\u000b', '\u000b', '\u0009', '\u0009', '\u000a', '\u000a', '\u0008', '\u0008', '\u000b', '\u000b', '\u0009', '\u0009', '\u000a', '\u000a', '\u0008', '\u0008', '\u000b', '\u000b', '\u0009', '\u0009', '\u000a', '\u000a', '\u0008', '\u0008', '\u000b', '\u000b', '\u0009', '\u0009', '\u000a', '\u000a', '\u0000', '\u000b', '\u0002', '\u0005', '\u0002', '\u0005', '\u0002', '\u000b', '\u0000', '\u000b', '\u0004', '\u0005', '\u0007', '\u000b', '\u0000', '\u000b', '\u0002', '\u0005', '\u0002', '\u0005', '\u0002', '\u000b', '\u0006', '\u0006', '\u0000',  };
		static readonly sbyte  []_patact_char_class = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 1, 6, 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, 7, 7, 7, 7, 7, 8, 7, 7, 9, 7, 7, 10, 7, 7, 11, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0,  };
		static readonly sbyte  []_patact_index_offsets = { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 28, 32, 36, 46, 58, 60, 65, 77, 81, 85, 95, 0,  };
		static readonly sbyte  []_patact_indicies = { 1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 20, 22, 23, 24, 25, 26, 26, 26, 26, 26, 27, 0, 23, 23, 27, 28, 23, 29, 31, 30, 30, 30, 30, 26, 26, 26, 26, 26, 32, 21, 32, 21, 33, 33, 21, 34, 34, 34, 34, 34, 33, 33, 34, 34, 34, 34, 34, 37, 21, 37, 38, 39, 40, 21, 41, 41, 41, 41, 41, 42, 10, 39, 39, 42, 43, 39, 44, 46, 45, 45, 45, 45, 41, 41, 41, 41, 41, 47, 0,  };
		static readonly sbyte  []_patact_index_defaults = { 0, 0, 0, 0, 0, 5, 5, 5, 5, 10, 10, 10, 10, 15, 15, 15, 15, 21, 0, 28, 30, 21, 35, 36, 21, 10, 43, 45, 21, 0,  };
		static readonly sbyte  []_patact_trans_cond_spaces = { -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,  };
		static readonly sbyte  []_patact_cond_targs = { 17, 2, 3, 4, 17, 17, 6, 7, 8, 17, 24, 10, 11, 12, 24, 24, 14, 15, 16, 24, 17, 0, 17, 18, 19, 17, 20, 1, 17, 18, 17, 5, 21, 22, 23, 21, 21, 24, 24, 25, 26, 27, 9, 24, 25, 24, 13, 28, 0,  };
		static readonly sbyte  []_patact_cond_actions = { 1, 0, 0, 0, 2, 3, 0, 0, 0, 4, 5, 0, 0, 0, 6, 7, 0, 0, 0, 8, 11, 0, 12, 13, 13, 14, 15, 0, 16, 17, 18, 0, 19, 0, 0, 20, 21, 22, 23, 24, 24, 15, 0, 25, 26, 27, 0, 28, 0,  };
		static readonly sbyte  []_patact_to_state_actions = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 9, 0, 0, 9, 0, 0, 0, 9, 0,  };
		static readonly sbyte  []_patact_from_state_actions = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 10, 0, 0, 0, 10, 0,  };
		static readonly sbyte  []_patact_eof_trans = { 0, 1, 1, 1, 1, 6, 6, 6, 6, 11, 11, 11, 11, 16, 16, 16, 16, 0, 1, 29, 31, 0, 36, 37, 0, 11, 44, 46, 0, 0,  };
		static readonly sbyte  []_patact_nfa_targs = { 0, 0,  };
		static readonly sbyte  []_patact_nfa_offsets = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  };
		static readonly sbyte  []_patact_nfa_push_actions = { 0, 0,  };
		static readonly sbyte  []_patact_nfa_pop_trans = { 0, 0,  };
		static readonly int  patact_start  = 17;
		static readonly int  patact_first_final  = 17;
		static readonly int  patact_error  = 0;
		static readonly int  patact_en_other  = 21;
		static readonly int  patact_en_exec_test  = 24;
		static readonly int  patact_en_semi  = 28;
		static readonly int  patact_en_main  = 17;
		int cs;
		
		void init()
		{
		
			{
				cs = (int)patact_start;
				ts = 0;
				te = 0;
				act = 0;
			}
		}
		
		void exec( char[] data, int len )
		{
			int p = 0;
			int pe = len;
			int eof = len;
			string _s;
			char [] buffer = new char [1024];
			int blen = 0;
			
			{
				int _trans = 0;
				int _keys;
				int _inds;
				if ( p == pe  )
				goto _test_eof;
				
				if ( cs == 0 )
				goto _out;
				
				_resume :
				switch ( _patact_from_state_actions[cs]  ) {
					case 10:
					{{ts = p;
						}}
					
					break;
					
				}
				_keys = (cs<<1) ;
				_inds = _patact_index_offsets[cs] ;
				if ( ( data[p ]) <= 122&& ( data[p ]) >= 10 )
				{
					int _ic = (int)_patact_char_class[(int)( data[p ]) - 10];
					if ( _ic <= (int)_patact_trans_keys[_keys+1]&& _ic >= (int)_patact_trans_keys[_keys ] )
					_trans = (int)_patact_indicies[_inds + (int)( _ic - (int)_patact_trans_keys[_keys ])  ];
					
					else
					_trans = (int)_patact_index_defaults[cs];
					
				}
				
				else
				{
					_trans = (int)_patact_index_defaults[cs];
				}
				
				
				goto _match_cond;
				
				_match_cond :
				cs = (int)_patact_cond_targs[_trans];
				if ( _patact_cond_actions[_trans] == 0 )
				goto _again;
				
				
				switch ( _patact_cond_actions[_trans]  ) {
					case 15:
					{{te = p+1;
						}}
					
					break;
					case 19:
					{{te = p+1;
							{Console.Write( "space\n" );}
						}}
					
					break;
					case 21:
					{{te = p;
							p = p - 1;
							{Console.Write( "word\n" );}
						}}
					
					break;
					case 20:
					{{te = p;
							p = p - 1;
							{Console.Write( "num\n" );}
						}}
					
					break;
					case 8:
					{{te = p+1;
							{Console.Write( "word (c/lbh)\n" );}
						}}
					
					break;
					case 22:
					{{te = p+1;
							{Console.Write( "space\n" );}
						}}
					
					break;
					case 6:
					{{te = p+1;
							{Console.Write( "num (c/switch)\n" );}
						}}
					
					break;
					case 23:
					{{te = p+1;
						}}
					
					break;
					case 27:
					{{te = p;
							p = p - 1;
							{Console.Write( "word (w/lbh)\n" );{p = (( te-1))-1;
								}
								{cs = 21;
									goto _again;}}
						}}
					
					break;
					case 25:
					{{te = p;
							p = p - 1;
							{Console.Write( "num (w/switch)\n" );{p = (( te-1))-1;
								}
								{cs = 21;
									goto _again;}}
						}}
					
					break;
					case 7:
					{{p = ((te))-1;
							{Console.Write( "word (w/lbh)\n" );{p = (( te-1))-1;
								}
								{cs = 21;
									goto _again;}}
						}}
					
					break;
					case 5:
					{{switch ( act  ) {
								case 7:
								p = ((te))-1;
								{Console.Write( "num (w/switch)\n" );}
								
								break;
								case 8:
								p = ((te))-1;
								{Console.Write( "num (w/switch)\n" );{p = (( te-1))-1;
									}
									{cs = 21;
										goto _again;}}
								
								break;
								
							}
						}
					}
					
					break;
					case 28:
					{{te = p+1;
							{Console.Write( "in semi\n" );{cs = 17;
									goto _again;}}
						}}
					
					break;
					case 4:
					{{te = p+1;
							{Console.Write( "word (c/lbh)\n" );}
						}}
					
					break;
					case 11:
					{{te = p+1;
							{Console.Write( "space\n" );}
						}}
					
					break;
					case 2:
					{{te = p+1;
							{Console.Write( "num (c/switch)\n" );}
						}}
					
					break;
					case 14:
					{{te = p+1;
							{Console.Write( "going to semi\n" );{p = p - 1;
								}{cs = 28;
									goto _again;}}
						}}
					
					break;
					case 12:
					{{te = p+1;
							{Console.Write( "immdiate\n" );{cs = 24;
									goto _again;}}
						}}
					
					break;
					case 18:
					{{te = p;
							p = p - 1;
							{Console.Write( "word (w/lbh)\n" );{p = p - 1;
								}{cs = 21;
									goto _again;}}
						}}
					
					break;
					case 16:
					{{te = p;
							p = p - 1;
							{Console.Write( "num (w/switch)\n" );{p = p - 1;
								}{cs = 21;
									goto _again;}}
						}}
					
					break;
					case 3:
					{{p = ((te))-1;
							{Console.Write( "word (w/lbh)\n" );{p = p - 1;
								}{cs = 21;
									goto _again;}}
						}}
					
					break;
					case 1:
					{{switch ( act  ) {
								case 15:
								p = ((te))-1;
								{Console.Write( "num (w/switch)\n" );}
								
								break;
								case 16:
								p = ((te))-1;
								{Console.Write( "num (w/switch)\n" );{p = p - 1;
									}{cs = 21;
										goto _again;}}
								
								break;
								
							}
						}
					}
					
					break;
					case 26:
					{{te = p+1;
						}}
					{{act = 7;
						}}
					
					break;
					case 24:
					{{te = p+1;
						}}
					{{act = 8;
						}}
					
					break;
					case 17:
					{{te = p+1;
						}}
					{{act = 15;
						}}
					
					break;
					case 13:
					{{te = p+1;
						}}
					{{act = 16;
						}}
					
					break;
					
				}
				
				_again :
				switch ( _patact_to_state_actions[cs]  ) {
					case 9:
					{{ts = 0;
						}}
					
					break;
					
				}
				if ( cs == 0 )
				goto _out;
				
				p+= 1;
				if ( p != pe  )
				goto _resume;
				
				
				_test_eof :
				{}
				if ( p == eof  )
				{
					if ( _patact_eof_trans[cs] > 0 )
					{
						_trans = (int)_patact_eof_trans[cs] - 1;
						goto _match_cond;
					}
					
				}
				
				
				
				_out :
				{}
				
			}
		}
		
		void finish( )
		{
			if ( cs >= patact_first_final )
			Console.WriteLine( "ACCEPT" );
			else
			Console.WriteLine( "FAIL" );
		}
		
		static readonly string[] inp = {
			"abcd foix\n",
			"abcd\nanother\n",
			"123 foix\n",
			"!abcd foix\n",
			"!abcd\nanother\n",
			"!123 foix\n",
			";",
		};
		
		
		static readonly int inplen = 7;
		
		public static void Main (string[] args)
		{
			Test machine = new Test();
			for ( int i = 0; i < inplen; i++ ) {
				machine.init();
				machine.exec( inp[i].ToCharArray(), inp[i].Length );
				machine.finish();
			}
		}
	}
}