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



%%{
	machine indep;

	main := (
		( '1' 'hello' ) |
		( '2' "hello" ) |
		( '3' /hello/ ) |
		( '4' 'hello'i ) |
		( '5' "hello"i ) |
		( '6' /hello/i )
	) '\n';
}%%



%% 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 >= indep_first_final ) {
		println!( "ACCEPT" );
	}
	else {
		println!( "FAIL" );
	}
}

fn main()
{
	unsafe { m( "1hello\n".to_string() ); }
	unsafe { m( "1HELLO\n".to_string() ); }
	unsafe { m( "1HeLLo\n".to_string() ); }
	unsafe { m( "2hello\n".to_string() ); }
	unsafe { m( "2HELLO\n".to_string() ); }
	unsafe { m( "2HeLLo\n".to_string() ); }
	unsafe { m( "3hello\n".to_string() ); }
	unsafe { m( "3HELLO\n".to_string() ); }
	unsafe { m( "3HeLLo\n".to_string() ); }
	unsafe { m( "4hello\n".to_string() ); }
	unsafe { m( "4HELLO\n".to_string() ); }
	unsafe { m( "4HeLLo\n".to_string() ); }
	unsafe { m( "5hello\n".to_string() ); }
	unsafe { m( "5HELLO\n".to_string() ); }
	unsafe { m( "5HeLLo\n".to_string() ); }
	unsafe { m( "6hello\n".to_string() ); }
	unsafe { m( "6HELLO\n".to_string() ); }
	unsafe { m( "6HeLLo\n".to_string() ); }
}