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

// Returns "fake" terminating null if cursor has reached limit.
fn peek(str string, cur int) u8 {
    return if cur >= str.len { u8(0) } /* fake null */ else { return str[cur] }
}

// Expects a string without terminating null.
fn lex(str string) int {
    mut cur := 0
    mut count := 0

loop: 
//line "v/eof/04_fake_sentinel.v":17
    mut yych := u8(0)
    yych = peek(str, cur)
    match yych {
        0x00 { unsafe { goto yy1 } }
        0x20 { unsafe { goto yy3 } }
        0x61...0x7A { unsafe { goto yy5 } }
        else { unsafe { goto yy2 } }
    }
yy1:
    cur += 1
//line "v/eof/04_fake_sentinel.re":20
    return count
//line "v/eof/04_fake_sentinel.v":30
yy2:
    cur += 1
//line "v/eof/04_fake_sentinel.re":19
    return -1
//line "v/eof/04_fake_sentinel.v":35
yy3:
    cur += 1
    yych = peek(str, cur)
    match yych {
        0x20 { unsafe { goto yy3 } }
        else { unsafe { goto yy4 } }
    }
yy4:
//line "v/eof/04_fake_sentinel.re":22
    unsafe { goto loop }
//line "v/eof/04_fake_sentinel.v":46
yy5:
    cur += 1
    yych = peek(str, cur)
    match yych {
        0x61...0x7A { unsafe { goto yy5 } }
        else { unsafe { goto yy6 } }
    }
yy6:
//line "v/eof/04_fake_sentinel.re":21
    count += 1; unsafe { goto loop }
//line "v/eof/04_fake_sentinel.v":57
//line "v/eof/04_fake_sentinel.re":24

}

fn main() {
    assert lex("") == 0
    assert lex("one two three") == 3
    assert lex("f0ur") == -1
}
