1138: Add L_DOLLAR and R_DOLLAR r=matklad a=edwin0cheng

As discussion in issue https://github.com/rust-analyzer/rust-analyzer/issues/1132 and PR #1125 , this PR add 2 `Syntax::Kind` : `L_DOLLAR` and `R_DOLLAR` for representing `Delimiter::None` in mbe and proc_marco. By design, It should not affect the final syntax tree, and will be discard in `TreeSink`.

My original idea is handling these 2 tokens case by case, but i found that they will appear in every place in the parser (imagine `tt` matcher). So this PR only handle it in `Parser::do_bump` and `Parser::start`, although It will not fix the `expr` matcher executing order problem in original idea.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
bors[bot] 2019-04-14 14:16:42 +00:00
commit 5d35f284f5
13 changed files with 561 additions and 244 deletions

View file

@ -120,6 +120,8 @@ pub enum SyntaxKind {
LIFETIME,
COMMENT,
SHEBANG,
L_DOLLAR,
R_DOLLAR,
SOURCE_FILE,
STRUCT_DEF,
ENUM_DEF,
@ -477,6 +479,8 @@ impl SyntaxKind {
LIFETIME => &SyntaxInfo { name: "LIFETIME" },
COMMENT => &SyntaxInfo { name: "COMMENT" },
SHEBANG => &SyntaxInfo { name: "SHEBANG" },
L_DOLLAR => &SyntaxInfo { name: "L_DOLLAR" },
R_DOLLAR => &SyntaxInfo { name: "R_DOLLAR" },
SOURCE_FILE => &SyntaxInfo { name: "SOURCE_FILE" },
STRUCT_DEF => &SyntaxInfo { name: "STRUCT_DEF" },
ENUM_DEF => &SyntaxInfo { name: "ENUM_DEF" },