// Generated by re2zig
// re2zig $INPUT -o $OUTPUT --header lexer/state.zig

const std = @import("std");
const state = @import("lexer/state.zig"); // the module is generated by re2c



fn lex(yyrecord: *state.State) usize {
    var t: usize = 0;
    
    var yych: u8 = 0;
    var yystate: u32 = 0;
    yyl: while (true) {
        switch (yystate) {
            0 => {
                yych = yyrecord.yyinput[yyrecord.yycursor];
                switch (yych) {
                    0x61 => {
                        yyrecord.yycursor += 1;
                        yystate = 0;
                        continue :yyl;
                    },
                    0x62 => {
                        yyrecord.yyt1 = yyrecord.yycursor;
                        yyrecord.yycursor += 1;
                        yystate = 2;
                        continue :yyl;
                    },
                    else => {
                        yyrecord.yyt1 = yyrecord.yycursor;
                        yystate = 1;
                        continue :yyl;
                    },
                }
            },
            1 => {
                t = yyrecord.yyt1;
                return t;
            },
            2 => {
                yych = yyrecord.yyinput[yyrecord.yycursor];
                switch (yych) {
                    0x62 => {
                        yyrecord.yycursor += 1;
                        yystate = 2;
                        continue :yyl;
                    },
                    else => {
                        yystate = 1;
                        continue :yyl;
                    },
                }
            },
            else => { @panic("internal lexer error"); },
        }
    }

}

test {
    var st = state.State {
        .yyinput = "ab",
        .yycursor = 0,
        .yyt1 = 0,
    };
    try std.testing.expectEqual(lex(&st), 1);
}
// Generated by re2zig

pub const State = struct {
    yyinput: [:0]const u8,
    yycursor: usize,
    yyt1: usize,
};
zig/headers/header.re:22:21: warning: rule matches empty string [-Wmatch-empty-string]
