blob: 461d177985b5a5f02ef4278a4a6cf072522bf150 (
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
|
/*
* @LANG: java
*/
class java1
{
%%{
machine java1;
one := 'one\n';
two := 'two\n';
four := 'four\n';
main :=
( 'hello' | 'there' | 'friend' )
'\n' @{int s = fentry(one); fgoto *s; char c = fc;}
( 'one' | 'two' | 'four' ) '\n';
}%%
%% write data;
static void test( char data[] )
{
int cs, p = 0, pe = data.length;
int top;
%% write init;
%% write exec;
if ( cs >= java1_first_final )
System.out.println( "ACCEPT" );
else
System.out.println( "FAIL" );
}
public static void main( String args[] )
{
test( "hello\none\n".toCharArray() );
test( "there\ntwo\n".toCharArray() );
test( "friend\nfour\n".toCharArray() );
}
}
/* _____OUTPUT_____
ACCEPT
FAIL
FAIL
*/
|