summaryrefslogtreecommitdiff
path: root/test/cases/trans.d/case/zlen1_rust.rl
blob: b47751ca5bdcbd82d4500fe53eabff7e760dbaa5 (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
//
// @LANG: rust
// @GENERATED: true
//




%%{
	machine zlen1;
	main := zlen;
}%%



%% write data;

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

	%% write init;
	%% write exec;

	if ( cs >= zlen1_first_final ) {
		println!( "ACCEPT" );
	}
	else {
		println!( "FAIL" );
	}
}

fn main()
{
	unsafe { m( "".to_string() ); }
	unsafe { m( "x".to_string() ); }
}