From 52104f7d250470bc35c640904ee2bc32633dbd7e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 28 Jan 2018 11:43:59 +0300 Subject: Explain TOMBSTONE and EOF --- src/bin/gen.rs | 8 ++++++-- src/syntax_kinds.rs | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/bin/gen.rs b/src/bin/gen.rs index 4b8a5afec..89609bd77 100644 --- a/src/bin/gen.rs +++ b/src/bin/gen.rs @@ -51,8 +51,12 @@ impl Grammar { write!(acc, " {},\n", scream(kind)).unwrap(); } acc.push_str("\n"); - acc.push_str(" TOMBSTONE = !0 - 1,\n"); - acc.push_str(" EOF = !0,\n"); + acc.push_str(" // Technical SyntaxKinds: they appear temporally during parsing,\n"); + acc.push_str(" // but never end up in the final tree\n"); + acc.push_str(" #[doc(hidden)]\n"); + acc.push_str(" TOMBSTONE,\n"); + acc.push_str(" #[doc(hidden)]\n"); + acc.push_str(" EOF,\n"); acc.push_str("}\n"); acc.push_str("pub(crate) use self::SyntaxKind::*;\n"); acc.push_str("\n"); diff --git a/src/syntax_kinds.rs b/src/syntax_kinds.rs index aa19c2adf..cc9e74f8e 100644 --- a/src/syntax_kinds.rs +++ b/src/syntax_kinds.rs @@ -92,8 +92,12 @@ pub enum SyntaxKind { ALIAS, VISIBILITY, - TOMBSTONE = !0 - 1, - EOF = !0, + // Technical SyntaxKinds: they appear temporally during parsing, + // but never end up in the final tree + #[doc(hidden)] + TOMBSTONE, + #[doc(hidden)] + EOF, } pub(crate) use self::SyntaxKind::*; -- cgit v1.2.3