// Generated by re2java
// re2java $INPUT -o $OUTPUT --input-encoding utf8

// This example supports multiple input encodings: UTF-8 and UTF-32.
// Both lexers are generated from the same rules block, and the use
// blocks add only encoding-specific configurations.



class Main {
    static boolean lex_utf8(int[] yyinput) {
        int yycursor = 0;
        int yymarker = 0;
        
    {
        int yych = 0;
        int yystate = 0;
        yyl: while (true) {
            switch (yystate) {
                case 0:
                    yych = yyinput[yycursor];
                    yycursor += 1;
                    switch (yych) {
                        case 0xE2:
                            yystate = 3;
                            continue yyl;
                        default:
                            yystate = 1;
                            continue yyl;
                    }
                case 1:
                    yystate = 2;
                    continue yyl;
                case 2:
                    { return false; }
                case 3:
                    yymarker = yycursor;
                    yych = yyinput[yycursor];
                    switch (yych) {
                        case 0x88:
                            yycursor += 1;
                            yystate = 4;
                            continue yyl;
                        default:
                            yystate = 2;
                            continue yyl;
                    }
                case 4:
                    yych = yyinput[yycursor];
                    switch (yych) {
                        case 0x80:
                            yycursor += 1;
                            yystate = 6;
                            continue yyl;
                        default:
                            yystate = 5;
                            continue yyl;
                    }
                case 5:
                    yycursor = yymarker;
                    yystate = 2;
                    continue yyl;
                case 6:
                    yych = yyinput[yycursor];
                    switch (yych) {
                        case 0x78:
                            yycursor += 1;
                            yystate = 7;
                            continue yyl;
                        default:
                            yystate = 5;
                            continue yyl;
                    }
                case 7:
                    yych = yyinput[yycursor];
                    switch (yych) {
                        case 0x20:
                            yycursor += 1;
                            yystate = 8;
                            continue yyl;
                        default:
                            yystate = 5;
                            continue yyl;
                    }
                case 8:
                    yych = yyinput[yycursor];
                    switch (yych) {
                        case 0xE2:
                            yycursor += 1;
                            yystate = 9;
                            continue yyl;
                        default:
                            yystate = 5;
                            continue yyl;
                    }
                case 9:
                    yych = yyinput[yycursor];
                    switch (yych) {
                        case 0x88:
                            yycursor += 1;
                            yystate = 10;
                            continue yyl;
                        default:
                            yystate = 5;
                            continue yyl;
                    }
                case 10:
                    yych = yyinput[yycursor];
                    switch (yych) {
                        case 0x83:
                            yycursor += 1;
                            yystate = 11;
                            continue yyl;
                        default:
                            yystate = 5;
                            continue yyl;
                    }
                case 11:
                    yych = yyinput[yycursor];
                    switch (yych) {
                        case 0x79:
                            yycursor += 1;
                            yystate = 12;
                            continue yyl;
                        default:
                            yystate = 5;
                            continue yyl;
                    }
                case 12:
                    { return true; }
                default:
                    throw new IllegalStateException("internal lexer error");
            }
        }
    }

    }

    static boolean lex_utf32(int[] yyinput) {
        int yycursor = 0;
        int yymarker = 0;
        
    {
        int yych = 0;
        int yystate = 0;
        yyl: while (true) {
            switch (yystate) {
                case 0:
                    yych = yyinput[yycursor];
                    yycursor += 1;
                    if (yych == 0x00002200) {
                        yystate = 2;
                        continue yyl;
                    }
                    yystate = 1;
                    continue yyl;
                case 1:
                    { return false; }
                case 2:
                    yymarker = yycursor;
                    yych = yyinput[yycursor];
                    if (yych != 0x00000078) {
                        yystate = 1;
                        continue yyl;
                    }
                    yycursor += 1;
                    yych = yyinput[yycursor];
                    if (yych == 0x00000020) {
                        yycursor += 1;
                        yystate = 4;
                        continue yyl;
                    }
                    yystate = 3;
                    continue yyl;
                case 3:
                    yycursor = yymarker;
                    yystate = 1;
                    continue yyl;
                case 4:
                    yych = yyinput[yycursor];
                    if (yych != 0x00002203) {
                        yystate = 3;
                        continue yyl;
                    }
                    yycursor += 1;
                    yych = yyinput[yycursor];
                    if (yych != 0x00000079) {
                        yystate = 3;
                        continue yyl;
                    }
                    yycursor += 1;
                    { return true; }
                default:
                    throw new IllegalStateException("internal lexer error");
            }
        }
    }

    }

    public static void main(String []args) {
        // we have to use `int`, because `byte`in Java cannot represent values greater than 127
        int[] s_utf8 = new int[]{0xe2, 0x88, 0x80, 0x78, 0x20, 0xe2, 0x88, 0x83, 0x79};
        assert lex_utf8(s_utf8);

        int[] s_utf32 = new int[]{0x2200, 0x78, 0x20, 0x2203, 0x79};
        assert lex_utf32(s_utf32);
    }
};
