Stream: t-compiler/rust-analyzer

Topic: Examples for ast::* items


Przemysław Horban (Feb 02 2021 at 19:44, on Zulip):

Hello, I've been trying to contribute to RA recently and the problem that I have right now is that it's hard for me to match ast::* elements to what they are parsed from. For example I look at ast::IdentPat and I'm not sure what it represents.

Is there some sort of mapping for this and the text?

Jonas Schievink [he/him] (Feb 02 2021 at 19:45, on Zulip):

hmm, we used to have this as part of the docs

Przemysław Horban (Feb 02 2021 at 19:46, on Zulip):

I don't need nice docs... just any hacky way to quickly figure it out ;)

Laurențiu (Feb 02 2021 at 19:48, on Zulip):

There's a "show syntax tree" command in Code

Przemysław Horban (Feb 02 2021 at 19:50, on Zulip):

Ok, I tried it and it's very helpful. Thank you!

Lukas Wirth (Feb 02 2021 at 20:24, on Zulip):

Looking at https://github.com/rust-analyzer/ungrammar/blob/master/rust.ungram also helps in understanding the AST-structure as thats what RA's ast is based on

Przemysław Horban (Feb 02 2021 at 21:18, on Zulip):

IdentPat =
Attr* 'ref'? 'mut'? Name ('@' Pat)?

Nice! Between viewing the syntax treen in vscode and this grammar I can figure out all the terms. Thank you!

Last update: Jul 29 2021 at 09:45UTC