summaryrefslogtreecommitdiff
path: root/test/ragel.d/targs1.rl
blob: b97a550e21cac9cbe2f122b5306ad48fe96d85ca (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
/*
 * @LANG: indep
 */

int return_to;

%%{
	machine targs1;

	unused := 'unused';

	one := 'one' @{
		print_str "one\n";
		fnext *return_to;
	};

	two := 'two' @{
		print_str "two\n";
		fnext *return_to;
	};

	main := (
			'1' @{ return_to = ftargs; fnext one; }
		|	'2' @{ return_to = ftargs; fnext two; }
		|	'\n'
	)*;
}%%

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