refactor(UsageParser) Make the functions passed to .stop_at() straightforward

This commit is contained in:
tormol 2016-09-30 13:48:37 +02:00
parent 1d6a7c6e7e
commit bb1fa0d694

View file

@ -197,27 +197,22 @@ impl<'a> UsageParser<'a> {
#[inline]
fn name_end(b: u8) -> bool {
// 93(]), 62(>)
b > b']' || b < b'>' || (b > b'>' && b < b']')
b != b']' && b != b'>'
}
#[inline]
fn token(b: u8) -> bool {
// 39('), 45(-), 46(.), 60(<), 91([)
b < 39 || b > 91 || (b > 46 && b < 91 && b != b'<') || (b > 39 && b < 45)
b != b'\'' && b != b'.' && b != b'<' && b != b'[' && b != b'-'
}
#[inline]
fn long_end(b: u8) -> bool {
// 39('), 46(.), 60(<), 61(=), 91([), 32( )
(b < 39 && (b > 13 && b != b' ')) || b > 91 || (b > 61 && b < 91) ||
(b > 39 && b < 60 && b != 46)
b != b'\'' && b != b'.' && b != b'<' && b != b'[' && b != b'=' && b != b' '
}
#[inline]
fn help_start(b: u8) -> bool {
// 39(')
b < 39 || b > 39
b != b'\''
}
#[cfg(test)]