mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Add a Parse impl for symbol Value
This commit is contained in:
parent
ba17934bc1
commit
95742ff23c
@ -65,13 +65,19 @@ impl Parse for Symbol {
|
||||
fn parse(input: ParseStream<'_>) -> Result<Self> {
|
||||
let name = input.parse()?;
|
||||
let colon_token: Option<Token![:]> = input.parse()?;
|
||||
let value =
|
||||
if colon_token.is_some() { Value::String(input.parse()?) } else { Value::SameAsName };
|
||||
let value = if colon_token.is_some() { input.parse()? } else { Value::SameAsName };
|
||||
|
||||
Ok(Symbol { name, value })
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for Value {
|
||||
fn parse(input: ParseStream<'_>) -> Result<Self> {
|
||||
let lit: LitStr = input.parse()?;
|
||||
Ok(Value::String(lit))
|
||||
}
|
||||
}
|
||||
|
||||
struct Input {
|
||||
keywords: Punctuated<Keyword, Token![,]>,
|
||||
symbols: Punctuated<Symbol, Token![,]>,
|
||||
|
Loading…
Reference in New Issue
Block a user