summaryrefslogtreecommitdiff
path: root/test/ragel.d/rust1.rl
blob: 5eac919b8b1dd77d82007331f3d1ecda6467bbe6 (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
//
// @LANG: rust
//

%%{
	machine atoi;

	main := '-'? [0-9]+ '.' @{
		println!( "match" );
	};
}%%

fn some_fn() -> &'static str { "foo" }

%% write data;

fn m( s: String )
{
	let data: &[u8] = s.as_bytes();
	let mut p = 0;
	let mut pe = s.len();
	let mut cs: i32 = 0;

	%% write init;
	%% write exec;
}

fn main()
{
	m( "-99.".to_string() );
	m( "100.".to_string() );
	m( "100x.".to_string() );
	m( "1000.".to_string() );
}

##### OUTPUT #####
match
match
match