// Generated by re2js
// re2js $INPUT -o $OUTPUT -i

const YYMAXFILL = 2




function lex_simple(yyinput) {
    let yycursor = 0
    let yymarker = 0
    let yylimit = yyinput.length - 1
    
{
    let yych = 0
    let yystate = 0
    yyl: while (true) {
        switch (yystate) {
            case 0:
                if (yylimit <= yycursor) {
                    yystate = 8
                    continue yyl
                }
                yych = yyinput.charCodeAt(yycursor)
                yycursor += 1;
                switch (yych) {
                    case 0x61:
                        yystate = 3
                        continue yyl
                    case 0x62:
                        yystate = 4
                        continue yyl
                    case 0x63:
                        yystate = 5
                        continue yyl
                    default:
                        yystate = 1
                        continue yyl
                }
            case 1:
                yystate = 2
                continue yyl
            case 2:
                { return 1 }
            case 3:
                if (yylimit <= yycursor) {
                    yystate = 9
                    continue yyl
                }
                { return 3 }
            case 4:
                { return 4 }
            case 5:
                yymarker = yycursor;
                if (yylimit <= yycursor) {
                    yystate = 10
                    continue yyl
                }
                yych = yyinput.charCodeAt(yycursor)
                switch (yych) {
                    case 0x63:
                        yycursor += 1;
                        yystate = 6
                        continue yyl
                    default:
                        yystate = 2
                        continue yyl
                }
            case 6:
                if (yylimit <= yycursor) {
                    yystate = 10
                    continue yyl
                }
                yych = yyinput.charCodeAt(yycursor)
                switch (yych) {
                    case 0x63:
                        yycursor += 1;
                        yystate = 6
                        continue yyl
                    default:
                        yystate = 7
                        continue yyl
                }
            case 7:
                yycursor = yymarker;
                yystate = 2
                continue yyl
            case 8:
                { return 0 }
            case 9:
                { return 2 }
            case 10:
                { return 5 }
            default:
                throw "internal lexer error"
        }
    }
}

}

function lex_eof(yyinput) {
    let yycursor = 0
    let yymarker = 0
    let yylimit = yyinput.length - 1
    
{
    let yych = 0
    let yystate = 0
    yyl: while (true) {
        switch (yystate) {
            case 0:
                yych = yyinput.charCodeAt(yycursor)
                switch (yych) {
                    case 0x61:
                        yycursor += 1;
                        yystate = 3
                        continue yyl
                    case 0x62:
                        yycursor += 1;
                        yystate = 4
                        continue yyl
                    case 0x63:
                        yycursor += 1;
                        yystate = 5
                        continue yyl
                    default:
                        if (yylimit <= yycursor) {
                            if (false) {
                                yystate = 0
                                continue yyl
                            }
                            yystate = 8
                            continue yyl
                        }
                        yycursor += 1;
                        yystate = 1
                        continue yyl
                }
            case 1:
                yystate = 2
                continue yyl
            case 2:
                { return 1 }
            case 3:
                if (yycursor === yylimit) {
                    yystate = 9
                    continue yyl
                }
                { return 3 }
            case 4:
                { return 4 }
            case 5:
                yymarker = yycursor;
                yych = yyinput.charCodeAt(yycursor)
                switch (yych) {
                    case 0x63:
                        yycursor += 1;
                        yystate = 6
                        continue yyl
                    default:
                        if (yylimit <= yycursor) {
                            if (false) {
                                yystate = 5
                                continue yyl
                            }
                            yystate = 10
                            continue yyl
                        }
                        yystate = 2
                        continue yyl
                }
            case 6:
                yych = yyinput.charCodeAt(yycursor)
                switch (yych) {
                    case 0x63:
                        yycursor += 1;
                        yystate = 6
                        continue yyl
                    default:
                        if (yylimit <= yycursor) {
                            if (false) {
                                yystate = 6
                                continue yyl
                            }
                            yystate = 10
                            continue yyl
                        }
                        yystate = 7
                        continue yyl
                }
            case 7:
                yycursor = yymarker;
                yystate = 2
                continue yyl
            case 8:
                { return 0 }
            case 9:
                { return 2 }
            case 10:
                { return 5 }
            default:
                throw "internal lexer error"
        }
    }
}

}

function lex_scc(str) {
    let yyinput = str + "\0".repeat(YYMAXFILL)
    let yycursor = 0
    let yymarker = 0
    let yylimit = yyinput.length
    let end = str.length - 1
    
{
    let yych = 0
    let yystate = 0
    yyl: while (true) {
        switch (yystate) {
            case 0:
                if (yycursor == end) {
                    yystate = 8
                    continue yyl
                }
                if ((yylimit - yycursor) < 2) {
                    return -1
                }
                yych = yyinput.charCodeAt(yycursor)
                yycursor += 1;
                switch (yych) {
                    case 0x61:
                        yystate = 3
                        continue yyl
                    case 0x62:
                        yystate = 4
                        continue yyl
                    case 0x63:
                        yystate = 5
                        continue yyl
                    default:
                        yystate = 1
                        continue yyl
                }
            case 1:
                yystate = 2
                continue yyl
            case 2:
                { return 1 }
            case 3:
                if (yycursor == end) {
                    yystate = 9
                    continue yyl
                }
                { return 3 }
            case 4:
                { return 4 }
            case 5:
                yymarker = yycursor;
                if (yycursor == end) {
                    yystate = 10
                    continue yyl
                }
                yych = yyinput.charCodeAt(yycursor)
                switch (yych) {
                    case 0x63:
                        yycursor += 1;
                        yystate = 6
                        continue yyl
                    default:
                        yystate = 2
                        continue yyl
                }
            case 6:
                if (yycursor == end) {
                    yystate = 10
                    continue yyl
                }
                if (yylimit <= yycursor) {
                    return -1
                }
                yych = yyinput.charCodeAt(yycursor)
                switch (yych) {
                    case 0x63:
                        yycursor += 1;
                        yystate = 6
                        continue yyl
                    default:
                        yystate = 7
                        continue yyl
                }
            case 7:
                yycursor = yymarker;
                yystate = 2
                continue yyl
            case 8:
                { return 0 }
            case 9:
                { return 2 }
            case 10:
                { return 5 }
            default:
                throw "internal lexer error"
        }
    }
}

}

function test(str, ret) {
    if (lex_simple(str) != ret) throw "error simple"
    if (lex_eof(str) != ret) throw "error eof"
    if (lex_scc(str) != ret) throw "error scc"
}

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