// Generated by re2zig
// re2zig $INPUT -o $OUTPUT

// This example shows how to combine reusable re2c blocks: two blocks
// ('colors' and 'fish') are merged into one. The 'salmon' rule occurs
// in both blocks; the 'fish' block takes priority because it is used
// earlier. Default rule * occurs in all three blocks; the local (not
// inherited) definition takes priority.

const std = @import("std");

const Ans = enum {color, fish, dunno};





fn lex(yyinput: [:0]const u8) Ans {
    var yycursor: usize = 0;
    var yymarker: usize = 0;
    
    var yych: u8 = 0;
    var yystate: u32 = 0;
    yyl: while (true) {
        switch (yystate) {
            0 => {
                yych = yyinput[yycursor];
                yycursor += 1;
                switch (yych) {
                    0x65 => {
                        yystate = 3;
                        continue :yyl;
                    },
                    0x68 => {
                        yystate = 4;
                        continue :yyl;
                    },
                    0x6D => {
                        yystate = 5;
                        continue :yyl;
                    },
                    0x72 => {
                        yystate = 6;
                        continue :yyl;
                    },
                    0x73 => {
                        yystate = 7;
                        continue :yyl;
                    },
                    else => {
                        yystate = 1;
                        continue :yyl;
                    },
                }
            },
            1 => {
                yystate = 2;
                continue :yyl;
            },
            2 => { return Ans.dunno; },
            3 => {
                yymarker = yycursor;
                yych = yyinput[yycursor];
                switch (yych) {
                    0x65 => {
                        yycursor += 1;
                        yystate = 8;
                        continue :yyl;
                    },
                    else => {
                        yystate = 2;
                        continue :yyl;
                    },
                }
            },
            4 => {
                yymarker = yycursor;
                yych = yyinput[yycursor];
                switch (yych) {
                    0x61 => {
                        yycursor += 1;
                        yystate = 10;
                        continue :yyl;
                    },
                    else => {
                        yystate = 2;
                        continue :yyl;
                    },
                }
            },
            5 => {
                yymarker = yycursor;
                yych = yyinput[yycursor];
                switch (yych) {
                    0x61 => {
                        yycursor += 1;
                        yystate = 11;
                        continue :yyl;
                    },
                    else => {
                        yystate = 2;
                        continue :yyl;
                    },
                }
            },
            6 => {
                yymarker = yycursor;
                yych = yyinput[yycursor];
                switch (yych) {
                    0x65 => {
                        yycursor += 1;
                        yystate = 12;
                        continue :yyl;
                    },
                    else => {
                        yystate = 2;
                        continue :yyl;
                    },
                }
            },
            7 => {
                yymarker = yycursor;
                yych = yyinput[yycursor];
                switch (yych) {
                    0x61 => {
                        yycursor += 1;
                        yystate = 13;
                        continue :yyl;
                    },
                    else => {
                        yystate = 2;
                        continue :yyl;
                    },
                }
            },
            8 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x6C => {
                        yycursor += 1;
                        yystate = 14;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            9 => {
                yycursor = yymarker;
                yystate = 2;
                continue :yyl;
            },
            10 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x64 => {
                        yycursor += 1;
                        yystate = 15;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            11 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x67 => {
                        yycursor += 1;
                        yystate = 16;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            12 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x64 => {
                        yycursor += 1;
                        yystate = 17;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            13 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x6C => {
                        yycursor += 1;
                        yystate = 18;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            14 => { return Ans.fish; },
            15 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x64 => {
                        yycursor += 1;
                        yystate = 19;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            16 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x65 => {
                        yycursor += 1;
                        yystate = 20;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            17 => { return Ans.color; },
            18 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x6D => {
                        yycursor += 1;
                        yystate = 21;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            19 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x6F => {
                        yycursor += 1;
                        yystate = 22;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            20 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x6E => {
                        yycursor += 1;
                        yystate = 23;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            21 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x6F => {
                        yycursor += 1;
                        yystate = 24;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            22 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x63 => {
                        yycursor += 1;
                        yystate = 25;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            23 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x74 => {
                        yycursor += 1;
                        yystate = 26;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            24 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x6E => {
                        yycursor += 1;
                        yystate = 14;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            25 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x6B => {
                        yycursor += 1;
                        yystate = 14;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            26 => {
                yych = yyinput[yycursor];
                switch (yych) {
                    0x61 => {
                        yycursor += 1;
                        yystate = 17;
                        continue :yyl;
                    },
                    else => {
                        yystate = 9;
                        continue :yyl;
                    },
                }
            },
            else => { @panic("internal lexer error"); },
        }
    }

}

test {
    try std.testing.expectEqual(lex("salmon"), Ans.fish);
    try std.testing.expectEqual(lex("what?"), Ans.dunno);
}
