Unified · Split
| @@ -54,11 +54,6 @@ pub mod parse { · 53 unmodified lines | |||
| 54 | use crate::spec::parse::{Delegate, Error}; | 54 | use crate::spec::parse::{Delegate, Error}; |
| 55 | use bstr::{BStr, ByteSlice}; | 55 | use bstr::{BStr, ByteSlice}; |
| 56 | 56 | ||
| 57 | fn next(i: &BStr) -> (u8, &BStr) { | ||
| 58 | let b = i[0]; | ||
| 59 | (b, i[1..].as_bstr()).into() | ||
| 60 | } | ||
| 61 | |||
| 62 | pub fn revision<'a>(mut input: &'a BStr, delegate: &mut impl Delegate) -> Result<&'a BStr, Error> { | 57 | pub fn revision<'a>(mut input: &'a BStr, delegate: &mut impl Delegate) -> Result<&'a BStr, Error> { |
| 63 | if let Some(rest) = input.strip_prefix(b"@").or_else(|| input.strip_prefix(b"HEAD")) { | 58 | if let Some(rest) = input.strip_prefix(b"@").or_else(|| input.strip_prefix(b"HEAD")) { |
| 64 | delegate.resolve_ref("HEAD".into()).ok_or(Error::Delegate)?; | 59 | delegate.resolve_ref("HEAD".into()).ok_or(Error::Delegate)?; |
| @@ -94,6 +89,11 @@ pub mod parse { · 29 unmodified lines | |||
| 94 | .map(|rest| (rest, spec::Kind::MergeBase)) | 89 | .map(|rest| (rest, spec::Kind::MergeBase)) |
| 95 | .or_else(|| input.strip_prefix(b"..").map(|rest| (rest, spec::Kind::Range))) | 90 | .or_else(|| input.strip_prefix(b"..").map(|rest| (rest, spec::Kind::Range))) |
| 96 | } | 91 | } |
| 92 | |||
| 93 | fn next(i: &BStr) -> (u8, &BStr) { | ||
| 94 | let b = i[0]; | ||
| 95 | (b, i[1..].as_bstr()) | ||
| 96 | } | ||
| 97 | } | 97 | } |
| 98 | } | 98 | } |
| 99 | pub use parse::function::parse; | 99 | pub use parse::function::parse; |