@@ -52,9 +52,9 @@ impl Error {
5252/// ```
5353/// # use parse_it::*;
5454/// fn parse_abc(state: &mut ParserState<CharLexer>) -> Result<char, Error> {
55- /// state.parse_terminal ('a')?;
56- /// state.parse_terminal ('b')?;
57- /// state.parse_terminal ('c')?;
55+ /// state.parse ('a')?;
56+ /// state.parse ('b')?;
57+ /// state.parse ('c')?;
5858/// Ok('c')
5959/// }
6060///
@@ -96,8 +96,8 @@ impl Error {
9696/// }
9797///
9898/// let mut state = ParserState::new(CharLexer::new("aaa"));
99- /// assert_eq!(parse_option(&mut state, |state| state.parse_terminal ('a')).unwrap(), Some('a'));
100- /// assert_eq!(parse_option(&mut state, |state| state.parse_terminal ('b')).unwrap(), None);
99+ /// assert_eq!(parse_option(&mut state, |state| state.parse ('a')).unwrap(), Some('a'));
100+ /// assert_eq!(parse_option(&mut state, |state| state.parse ('b')).unwrap(), None);
101101/// ```
102102pub struct ParserState < L > {
103103 span : Span ,
@@ -136,18 +136,18 @@ impl<'a, L: Lexer<'a>> ParserState<L> {
136136 }
137137
138138 /// Consume the next token if it matches the given token.
139- pub fn parse < T > ( & mut self , matches : impl FnOnce ( L :: Token ) -> Option < T > ) -> Result < T , Error > {
139+ pub fn parse_with < T > ( & mut self , matches : impl FnOnce ( L :: Token ) -> Option < T > ) -> Result < T , Error > {
140140 self . next ( )
141141 . and_then ( matches)
142142 . ok_or_else ( || Error :: new ( self . span ) )
143143 }
144144
145145 /// Consume the next token if it matches the given token via [`PartialEq`].
146- pub fn parse_terminal < T > ( & mut self , terminal : T ) -> Result < L :: Token , Error >
146+ pub fn parse < T > ( & mut self , terminal : T ) -> Result < L :: Token , Error >
147147 where
148148 L :: Token : PartialEq < T > ,
149149 {
150- self . parse ( |tt| tt. eq ( & terminal) . then_some ( tt) )
150+ self . parse_with ( |tt| tt. eq ( & terminal) . then_some ( tt) )
151151 }
152152
153153 /// Report an error at the current position.
0 commit comments