(
&mut self,
keywords: &[Keyword],
location: &str,
)
| 1860 | } |
| 1861 | |
| 1862 | fn parse_at_most_one_keyword( |
| 1863 | &mut self, |
| 1864 | keywords: &[Keyword], |
| 1865 | location: &str, |
| 1866 | ) -> Result<Option<Keyword>, ParserError> { |
| 1867 | match self.parse_one_of_keywords(keywords) { |
| 1868 | Some(first) => { |
| 1869 | let remaining_keywords = keywords |
| 1870 | .iter() |
| 1871 | .cloned() |
| 1872 | .filter(|k| *k != first) |
| 1873 | .collect::<Vec<_>>(); |
| 1874 | if let Some(second) = self.parse_one_of_keywords(remaining_keywords.as_slice()) { |
| 1875 | let second_pos = self.peek_prev_pos(); |
| 1876 | parser_err!( |
| 1877 | self, |
| 1878 | second_pos, |
| 1879 | "Cannot specify both {} and {} in {}", |
| 1880 | first, |
| 1881 | second, |
| 1882 | location, |
| 1883 | ) |
| 1884 | } else { |
| 1885 | Ok(Some(first)) |
| 1886 | } |
| 1887 | } |
| 1888 | None => Ok(None), |
| 1889 | } |
| 1890 | } |
| 1891 | |
| 1892 | /// Look for one of the given keywords and return the one that matches. |
| 1893 | #[must_use] |
nothing calls this directly
no test coverage detected