dtolnay / syn

Parser for Rust source code
Apache License 2.0
2.78k stars 306 forks source link

Consider inserting invisible groups, rather than parens, when applying grouping for precedence #1660

Open dtolnay opened 3 months ago

dtolnay commented 3 months ago

As of https://github.com/dtolnay/syn/pull/1659, we are currently using code like token::Paren::default().surround(tokens, |tokens| e.to_tokens(tokens)) .

But maybe a better behavior would be token::Group::default().surround(...).

programmerjake commented 2 days ago

I think using parens still is better because you may want to dump the tokens to a file, which breaks with invisible delimiters afaik