@@ -9,7 +9,7 @@ use winnow::{
9
9
combinator:: { alt, delimited, opt, preceded, repeat, terminated} ,
10
10
stream:: Stream ,
11
11
token:: { none_of, one_of} ,
12
- PResult , Parser ,
12
+ ModalResult , Parser ,
13
13
} ;
14
14
15
15
use super :: {
@@ -20,7 +20,7 @@ use super::{
20
20
} ;
21
21
use crate :: { branchloc:: BranchLocator , wrap:: partial_ref_name} ;
22
22
23
- pub ( in super :: super ) fn range_revision_spec ( input : & mut & str ) -> PResult < RangeRevisionSpec > {
23
+ pub ( in super :: super ) fn range_revision_spec ( input : & mut & str ) -> ModalResult < RangeRevisionSpec > {
24
24
alt ( (
25
25
( branch_prefix, patch_range_bounds)
26
26
. map ( |( branch_loc, bounds) | RangeRevisionSpec :: BranchRange { branch_loc, bounds } ) ,
@@ -30,7 +30,7 @@ pub(in super::super) fn range_revision_spec(input: &mut &str) -> PResult<RangeRe
30
30
. parse_next ( input)
31
31
}
32
32
33
- pub ( in super :: super ) fn single_revision_spec ( input : & mut & str ) -> PResult < SingleRevisionSpec > {
33
+ pub ( in super :: super ) fn single_revision_spec ( input : & mut & str ) -> ModalResult < SingleRevisionSpec > {
34
34
alt ( (
35
35
( branch_prefix, patch_like_spec) . map ( |( branch_loc, patch_like) | {
36
36
SingleRevisionSpec :: Branch {
@@ -43,7 +43,7 @@ pub(in super::super) fn single_revision_spec(input: &mut &str) -> PResult<Single
43
43
. parse_next ( input)
44
44
}
45
45
46
- fn branch_prefix ( input : & mut & str ) -> PResult < BranchLocator > {
46
+ fn branch_prefix ( input : & mut & str ) -> ModalResult < BranchLocator > {
47
47
terminated ( branch_locator, ':' ) . parse_next ( input)
48
48
}
49
49
@@ -58,7 +58,7 @@ impl std::fmt::Display for PrevCheckoutError {
58
58
59
59
impl std:: error:: Error for PrevCheckoutError { }
60
60
61
- pub ( crate ) fn branch_locator ( input : & mut & str ) -> PResult < BranchLocator > {
61
+ pub ( crate ) fn branch_locator ( input : & mut & str ) -> ModalResult < BranchLocator > {
62
62
alt ( (
63
63
delimited ( "@{-" , digit1, "}" )
64
64
. try_map ( |s : & str | s. parse :: < usize > ( ) )
@@ -77,7 +77,7 @@ pub(crate) fn branch_locator(input: &mut &str) -> PResult<BranchLocator> {
77
77
. parse_next ( input)
78
78
}
79
79
80
- fn patch_and_or_git_like_spec ( input : & mut & str ) -> PResult < SingleRevisionSpec > {
80
+ fn patch_and_or_git_like_spec ( input : & mut & str ) -> ModalResult < SingleRevisionSpec > {
81
81
use std:: cmp:: Ordering ;
82
82
83
83
let start_checkpoint = input. checkpoint ( ) ;
@@ -111,20 +111,20 @@ fn patch_and_or_git_like_spec(input: &mut &str) -> PResult<SingleRevisionSpec> {
111
111
}
112
112
}
113
113
114
- pub ( in super :: super ) fn patch_like_spec ( input : & mut & str ) -> PResult < PatchLikeSpec > {
114
+ pub ( in super :: super ) fn patch_like_spec ( input : & mut & str ) -> ModalResult < PatchLikeSpec > {
115
115
( patch_locator, git_revision_suffix)
116
116
. map ( |( patch_loc, suffix) | PatchLikeSpec { patch_loc, suffix } )
117
117
. parse_next ( input)
118
118
}
119
119
120
- fn git_like_spec ( input : & mut & str ) -> PResult < String > {
120
+ fn git_like_spec ( input : & mut & str ) -> ModalResult < String > {
121
121
( partial_ref_name, git_revision_suffix)
122
122
. take ( )
123
123
. map ( |s| s. to_string ( ) )
124
124
. parse_next ( input)
125
125
}
126
126
127
- fn git_revision_suffix ( input : & mut & str ) -> PResult < GitRevisionSuffix > {
127
+ fn git_revision_suffix ( input : & mut & str ) -> ModalResult < GitRevisionSuffix > {
128
128
repeat :: < _ , _ , Vec < & str > , _ , _ > (
129
129
0 ..,
130
130
alt ( (
@@ -139,23 +139,23 @@ fn git_revision_suffix(input: &mut &str) -> PResult<GitRevisionSuffix> {
139
139
. map ( |suffix : & str | GitRevisionSuffix ( suffix. to_string ( ) ) )
140
140
}
141
141
142
- fn at_braced < ' s > ( input : & mut & ' s str ) -> PResult < & ' s str > {
142
+ fn at_braced < ' s > ( input : & mut & ' s str ) -> ModalResult < & ' s str > {
143
143
preceded ( '@' , braced) . parse_next ( input)
144
144
}
145
145
146
- fn caret_braced < ' s > ( input : & mut & ' s str ) -> PResult < & ' s str > {
146
+ fn caret_braced < ' s > ( input : & mut & ' s str ) -> ModalResult < & ' s str > {
147
147
preceded ( '^' , braced) . parse_next ( input)
148
148
}
149
149
150
- fn caret_number ( input : & mut & str ) -> PResult < Option < usize > > {
150
+ fn caret_number ( input : & mut & str ) -> ModalResult < Option < usize > > {
151
151
preceded ( '^' , opt ( unsigned_int) ) . parse_next ( input)
152
152
}
153
153
154
- pub ( crate ) fn tilde_number ( input : & mut & str ) -> PResult < Option < usize > > {
154
+ pub ( crate ) fn tilde_number ( input : & mut & str ) -> ModalResult < Option < usize > > {
155
155
preceded ( '~' , opt ( unsigned_int) ) . parse_next ( input)
156
156
}
157
157
158
- fn braced < ' s > ( input : & mut & ' s str ) -> PResult < & ' s str > {
158
+ fn braced < ' s > ( input : & mut & ' s str ) -> ModalResult < & ' s str > {
159
159
delimited (
160
160
'{' ,
161
161
take_escaped ( none_of ( [ '\\' , '{' , '}' ] ) , '\\' , one_of ( [ '\\' , '{' , '}' ] ) ) ,
0 commit comments