Bail out if the current token is not one of the expected keywords, or consume it if it is
(&mut self, keywords: &[Keyword])
| 1903 | |
| 1904 | /// Bail out if the current token is not one of the expected keywords, or consume it if it is |
| 1905 | fn expect_one_of_keywords(&mut self, keywords: &[Keyword]) -> Result<Keyword, ParserError> { |
| 1906 | if let Some(keyword) = self.parse_one_of_keywords(keywords) { |
| 1907 | Ok(keyword) |
| 1908 | } else { |
| 1909 | self.expected( |
| 1910 | self.peek_pos(), |
| 1911 | format!("one of {}", keywords.iter().join(" or ")), |
| 1912 | self.peek_token(), |
| 1913 | ) |
| 1914 | } |
| 1915 | } |
| 1916 | |
| 1917 | /// Bail out if the current token is not an expected keyword, or consume it if it is |
| 1918 | fn expect_keyword(&mut self, expected: Keyword) -> Result<(), ParserError> { |
no test coverage detected