// Code generated by re2v, DO NOT EDIT.
//line "v/eof/03_eof_rule.re":1
// re2v $INPUT -o $OUTPUT

// Expects a null-terminated string.
fn lex(yyinput string) int {
    mut yycursor, mut yymarker := 0, 0
    yylimit := yyinput.len - 1 // yylimit points at the terminating null
    mut count := 0

loop: 
//line "v/eof/03_eof_rule.v":13
    mut yych := u8(0)
    yych = yyinput[yycursor]
    match yych {
        0x20 { unsafe { goto yy3 } }
        0x27 { unsafe { goto yy5 } }
        else {
            if yylimit <= yycursor {
                unsafe { goto yy10 }
            }
            unsafe { goto yy1 }
        }
    }
yy1:
    yycursor += 1
yy2:
//line "v/eof/03_eof_rule.re":15
    return -1
//line "v/eof/03_eof_rule.v":31
yy3:
    yycursor += 1
    yych = yyinput[yycursor]
    match yych {
        0x20 { unsafe { goto yy3 } }
        else { unsafe { goto yy4 } }
    }
yy4:
//line "v/eof/03_eof_rule.re":18
    unsafe { goto loop }
//line "v/eof/03_eof_rule.v":42
yy5:
    yycursor += 1
    yymarker = yycursor
    yych = yyinput[yycursor]
    if yych >= 0x01 {
        unsafe { goto yy7 }
    }
    if yylimit <= yycursor {
        unsafe { goto yy2 }
    }
yy6:
    yycursor += 1
    yych = yyinput[yycursor]
yy7:
    match yych {
        0x27 { unsafe { goto yy8 } }
        0x5C { unsafe { goto yy9 } }
        else {
            if yylimit <= yycursor {
                unsafe { goto yy11 }
            }
            unsafe { goto yy6 }
        }
    }
yy8:
    yycursor += 1
//line "v/eof/03_eof_rule.re":17
    count += 1; unsafe { goto loop }
//line "v/eof/03_eof_rule.v":71
yy9:
    yycursor += 1
    yych = yyinput[yycursor]
    if yych <= 0x00 {
        if yylimit <= yycursor {
            unsafe { goto yy11 }
        }
        unsafe { goto yy6 }
    }
    unsafe { goto yy6 }
yy10:
//line "v/eof/03_eof_rule.re":16
    return count
//line "v/eof/03_eof_rule.v":85
yy11:
    yycursor = yymarker
    unsafe { goto yy2 }
//line "v/eof/03_eof_rule.re":20

}

fn main() {
    assert lex("\0") == 0
    assert lex("'qu\0tes' 'are' 'fine: \\'' \0") == 3
    assert lex("'unterminated\\'\0") == -1
}
