MCPcopy Create free account
hub / github.com/dtolnay/rustversion / parse

Function parse

src/expr.rs:52–69  ·  view source on GitHub ↗
(iter: Iter)

Source from the content-addressed store, hash-verified

50}
51
52pub fn parse(iter: Iter) -> Result<Expr> {
53 match &iter.next() {
54 Some(TokenTree::Ident(i)) if i.to_string() == "stable" => parse_stable(iter),
55 Some(TokenTree::Ident(i)) if i.to_string() == "beta" => Ok(Expr::Beta),
56 Some(TokenTree::Ident(i)) if i.to_string() == "nightly" => parse_nightly(iter),
57 Some(TokenTree::Ident(i)) if i.to_string() == "since" => parse_since(i, iter),
58 Some(TokenTree::Ident(i)) if i.to_string() == "before" => parse_before(i, iter),
59 Some(TokenTree::Ident(i)) if i.to_string() == "not" => parse_not(i, iter),
60 Some(TokenTree::Ident(i)) if i.to_string() == "any" => parse_any(i, iter),
61 Some(TokenTree::Ident(i)) if i.to_string() == "all" => parse_all(i, iter),
62 unexpected => {
63 let span = unexpected
64 .as_ref()
65 .map_or_else(Span::call_site, TokenTree::span);
66 Err(Error::new(span, "expected one of `stable`, `beta`, `nightly`, `since`, `before`, `not`, `any`, `all`"))
67 }
68 }
69}
70
71fn parse_nightly(iter: Iter) -> Result<Expr> {
72 let paren = match token::parse_optional_paren(iter) {

Callers 6

parse_nightlyFunction · 0.70
parse_stableFunction · 0.70
parse_sinceFunction · 0.70
parse_beforeFunction · 0.70
parse_notFunction · 0.70
parse_comma_separatedFunction · 0.70

Calls 9

parse_stableFunction · 0.85
parse_nightlyFunction · 0.85
parse_sinceFunction · 0.85
parse_beforeFunction · 0.85
parse_notFunction · 0.85
parse_anyFunction · 0.85
parse_allFunction · 0.85
newFunction · 0.85
nextMethod · 0.80

Tested by

no test coverage detected