Switch to ungrammar from ast_src

The primary advantage of ungrammar is that it (eventually) allows one
to describe concrete syntax tree structure -- with alternatives and
specific sequence of tokens & nodes.

That should be re-usable for:

* generate `make` calls
* Rust reference
* Hypothetical parser's evented API

We loose doc comments for the time being unfortunately. I don't think
we should add support for doc comments to ungrammar -- they'll make
grammar file hard to read. We might supply docs as out-of band info,
or maybe just via a reference, but we'll think about that once things
are no longer in flux
This commit is contained in:
Aleksey Kladov 2020-07-29 15:45:23 +02:00
parent 525ae706b3
commit 3d28292157
9 changed files with 2393 additions and 4994 deletions

View file

@ -472,3 +472,19 @@ impl ast::TokenTree {
.filter(|it| matches!(it.kind(), T!['}'] | T![')'] | T![']']))
}
}
impl ast::DocCommentsOwner for ast::SourceFile {}
impl ast::DocCommentsOwner for ast::FnDef {}
impl ast::DocCommentsOwner for ast::StructDef {}
impl ast::DocCommentsOwner for ast::UnionDef {}
impl ast::DocCommentsOwner for ast::RecordFieldDef {}
impl ast::DocCommentsOwner for ast::TupleFieldDef {}
impl ast::DocCommentsOwner for ast::EnumDef {}
impl ast::DocCommentsOwner for ast::EnumVariant {}
impl ast::DocCommentsOwner for ast::TraitDef {}
impl ast::DocCommentsOwner for ast::Module {}
impl ast::DocCommentsOwner for ast::StaticDef {}
impl ast::DocCommentsOwner for ast::ConstDef {}
impl ast::DocCommentsOwner for ast::TypeAliasDef {}
impl ast::DocCommentsOwner for ast::ImplDef {}
impl ast::DocCommentsOwner for ast::MacroCall {}