Created
November 24, 2009 21:27
-
-
Save aslakhellesoy/242235 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* @LANG: java | |
*/ | |
class java1 | |
{ | |
%%{ | |
machine java1; | |
one := 'one\n'; | |
two := 'two\n'; | |
four := 'four\n'; | |
main := | |
( 'h' 0xC3 0xA5 'llo' | '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( "hållo\none\n".toCharArray() ); | |
test( "there\ntwo\n".toCharArray() ); | |
test( "friend\nfour\n".toCharArray() ); | |
} | |
} | |
/* _____OUTPUT_____ | |
ACCEPT | |
FAIL | |
FAIL | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment