// Code generated by re2v, DO NOT EDIT.
// re2v $INPUT -o $OUTPUT -i



fn lex_simple(yyinput string) int {
    mut yycursor := 0
    mut yymarker := 0
    yylimit := yyinput.len - 1

    
    mut yych := u8(0)
    if yylimit <= yycursor {
        unsafe { goto yy8 }
    }
    yych = yyinput[yycursor]
    match yych {
        0x61 { unsafe { goto yy3 } }
        0x62 { unsafe { goto yy4 } }
        0x63 { unsafe { goto yy5 } }
        else { unsafe { goto yy1 } }
    }
yy1:
    yycursor += 1
yy2:
    return 1
yy3:
    yycursor += 1
    if yylimit <= yycursor {
        unsafe { goto yy9 }
    }
    return 3
yy4:
    yycursor += 1
    return 4
yy5:
    yycursor += 1
    yymarker = yycursor
    if yylimit <= yycursor {
        unsafe { goto yy10 }
    }
    yych = yyinput[yycursor]
    match yych {
        0x63 { unsafe { goto yy6 } }
        else { unsafe { goto yy2 } }
    }
yy6:
    yycursor += 1
    if yylimit <= yycursor {
        unsafe { goto yy10 }
    }
    yych = yyinput[yycursor]
    match yych {
        0x63 { unsafe { goto yy6 } }
        else { unsafe { goto yy7 } }
    }
yy7:
    yycursor = yymarker
    unsafe { goto yy2 }
yy8:
    return 0
yy9:
    return 2
yy10:
    return 5

}

fn lex_eof(yyinput string) int {
    mut yycursor := 0
    mut yymarker := 0
    yylimit := yyinput.len - 1

    
    mut yych := u8(0)
yyFillLabel0:
    yych = yyinput[yycursor]
    match yych {
        0x61 { unsafe { goto yy14 } }
        0x62 { unsafe { goto yy15 } }
        0x63 { unsafe { goto yy16 } }
        else {
            if yylimit <= yycursor {
                if false {
                    unsafe { goto yyFillLabel0 }
                }
                unsafe { goto yy19 }
            }
            unsafe { goto yy12 }
        }
    }
yy12:
    yycursor += 1
yy13:
    return 1
yy14:
    yycursor += 1
    if yycursor == yylimit {
        unsafe { goto yy20 }
    }
    return 3
yy15:
    yycursor += 1
    return 4
yy16:
    yycursor += 1
    yymarker = yycursor
yyFillLabel1:
    yych = yyinput[yycursor]
    match yych {
        0x63 { unsafe { goto yy17 } }
        else {
            if yylimit <= yycursor {
                if false {
                    unsafe { goto yyFillLabel1 }
                }
                unsafe { goto yy21 }
            }
            unsafe { goto yy13 }
        }
    }
yy17:
    yycursor += 1
yyFillLabel2:
    yych = yyinput[yycursor]
    match yych {
        0x63 { unsafe { goto yy17 } }
        else {
            if yylimit <= yycursor {
                if false {
                    unsafe { goto yyFillLabel2 }
                }
                unsafe { goto yy21 }
            }
            unsafe { goto yy18 }
        }
    }
yy18:
    yycursor = yymarker
    unsafe { goto yy13 }
yy19:
    return 0
yy20:
    return 2
yy21:
    return 5

}

const yymaxfill = 2


fn lex_scc(str string) int {
    mut yycursor := 0
    mut yymarker := 0
    end := str.len - 1
    yylimit := end + yymaxfill

    mut yyinput := []u8{len: yylimit}
    copy(mut &yyinput, str.bytes())

    
    mut yych := u8(0)
    if yycursor == end {
        unsafe { goto yy30 }
    }
    if (yylimit - yycursor) < 2 {
        return -1
    }
    yych = yyinput[yycursor]
    match yych {
        0x61 { unsafe { goto yy25 } }
        0x62 { unsafe { goto yy26 } }
        0x63 { unsafe { goto yy27 } }
        else { unsafe { goto yy23 } }
    }
yy23:
    yycursor += 1
yy24:
    return 1
yy25:
    yycursor += 1
    if yycursor == end {
        unsafe { goto yy31 }
    }
    return 3
yy26:
    yycursor += 1
    return 4
yy27:
    yycursor += 1
    yymarker = yycursor
    if yycursor == end {
        unsafe { goto yy32 }
    }
    yych = yyinput[yycursor]
    match yych {
        0x63 { unsafe { goto yy28 } }
        else { unsafe { goto yy24 } }
    }
yy28:
    yycursor += 1
    if yycursor == end {
        unsafe { goto yy32 }
    }
    if yylimit <= yycursor {
        return -1
    }
    yych = yyinput[yycursor]
    match yych {
        0x63 { unsafe { goto yy28 } }
        else { unsafe { goto yy29 } }
    }
yy29:
    yycursor = yymarker
    unsafe { goto yy24 }
yy30:
    return 0
yy31:
    return 2
yy32:
    return 5

}

fn test(str string, ret int) {
    assert lex_simple(str) == ret
    assert lex_eof(str) == ret
    assert lex_scc(str) == ret
}

fn main() {
    test("\0", 0)
    test("a\0", 2)
    test("ax\0", 3)
    test("b\0", 4)
    test("bx\0", 4)
    test("ccc\0", 5)
}
