// Generated by re2zig
// re2zig $INPUT -o $OUTPUT --loop-switch --computed-continue --no-generation-date --no-version

const std = @import("std");

const Token = enum {
    identifier,
    invalid,
};

fn lex(yyinput: [:0]const u8) Token {
    var yycursor: u32 = 0;

    var yych: u8 = 0;
    yystate: switch (@as(enum {
        yy0,
        yy1,
        yy2,
        yy3,
    }, .yy0)) {
        .yy0 => {
            yych = yyinput[yycursor];
            yycursor += 1;
            switch (yych) {
                0x61...0x7A => {
                    continue :yystate .yy2;
                },
                else => {
                    continue :yystate .yy1;
                },
            }
        },
        .yy1 => {
            return .invalid;
        },
        .yy2 => {
            yych = yyinput[yycursor];
            switch (yych) {
                0x61...0x7A => {
                    yycursor += 1;
                    continue :yystate .yy2;
                },
                else => {
                    continue :yystate .yy3;
                },
            }
        },
        .yy3 => {
            return .identifier;
        },
    }

}

test {
    try std.testing.expectEqual(Token.identifier, lex("abc"));
    try std.testing.expectEqual(Token.invalid, lex("123"));
}
