-
-
Save msassak/242283 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; | |
alphtype byte; | |
# hello = 'hello' @{ System.out.println("ACCEPT hello"); }; | |
hello = 'hållo' @{ System.out.println("ACCEPT aring"); }; | |
there = 'there' @{ System.out.println("ACCEPT there"); }; | |
friend = 'friend' @{ System.out.println("ACCEPT friend"); }; | |
main := (hello|there|friend); | |
}%% | |
%% write data; | |
static void test( byte data[] ) | |
{ | |
int cs, p = 0, pe = data.length; | |
int top; | |
%% write init; | |
%% write exec; | |
} | |
public static void main( String args[] ) | |
{ | |
test( "hållo\none\n".getBytes() ); | |
test( "there\ntwo\n".getBytes() ); | |
test( "friend\nfour\n".getBytes() ); | |
} | |
} | |
/* _____OUTPUT_____ | |
ACCEPT | |
FAIL | |
FAIL | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment