(&mut self)
| 112 | |
| 113 | impl<'a> Context<'a> { |
| 114 | pub fn scan(&mut self) -> Result<Option<Token<'a>>, ParseError> { |
| 115 | let previous_end = self.last_token_end; |
| 116 | let token = self.scan_handling_comments()?; |
| 117 | self.last_token_end = self.scanner.token_end(); |
| 118 | |
| 119 | // store the comment for the previous token end, and current token start |
| 120 | if let Some(comments) = self.comments.as_mut() |
| 121 | && let Some(current_comments) = self.current_comments.take() |
| 122 | { |
| 123 | let current_comments = Rc::new(current_comments); |
| 124 | comments.insert(previous_end, current_comments.clone()); |
| 125 | comments.insert(self.scanner.token_start(), current_comments); |
| 126 | } |
| 127 | |
| 128 | if let Some(token) = &token |
| 129 | && self.tokens.is_some() |
| 130 | { |
| 131 | self.capture_token(token.clone()); |
| 132 | } |
| 133 | |
| 134 | Ok(token) |
| 135 | } |
| 136 | |
| 137 | pub fn token(&self) -> Option<Token<'a>> { |
| 138 | self.scanner.token() |
no test coverage detected