summaryrefslogtreecommitdiff
path: root/test/ragel.d/goto1.rl
blob: 0bf121f413462afa27dc3786016a3ec6a0251103 (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
/*
 * @LANG: indep
 * @PROHIBIT_LANGUAGES: cv ruby ocaml rust crack
 */

int target;

%%{
	machine goto1;

	unused := 'unused';

	one := 'one' @{
		print_str "one\n";
		target = fentry(main);
		fgoto *target;
	};

	two := 'two' @{
		print_str "two\n";
		target = fentry(main);
		fgoto *target;
	};

	main := 
		'1' @{ target = fentry(one); fgoto *target; }
	|	'2' @{ target = fentry(two); fgoto *target; }
	|	'\n';
}%%

##### INPUT #####
"1one2two1one\n"
##### OUTPUT #####
one
two
one
ACCEPT