Explain TOMBSTONE and EOF

This commit is contained in:
Aleksey Kladov 2018-01-28 11:43:59 +03:00
parent aff82e5ee1
commit 52104f7d25
2 changed files with 12 additions and 4 deletions

View file

@ -51,8 +51,12 @@ impl Grammar {
write!(acc, " {},\n", scream(kind)).unwrap(); write!(acc, " {},\n", scream(kind)).unwrap();
} }
acc.push_str("\n"); acc.push_str("\n");
acc.push_str(" TOMBSTONE = !0 - 1,\n"); acc.push_str(" // Technical SyntaxKinds: they appear temporally during parsing,\n");
acc.push_str(" EOF = !0,\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("}\n");
acc.push_str("pub(crate) use self::SyntaxKind::*;\n"); acc.push_str("pub(crate) use self::SyntaxKind::*;\n");
acc.push_str("\n"); acc.push_str("\n");

View file

@ -92,8 +92,12 @@ pub enum SyntaxKind {
ALIAS, ALIAS,
VISIBILITY, VISIBILITY,
TOMBSTONE = !0 - 1, // Technical SyntaxKinds: they appear temporally during parsing,
EOF = !0, // but never end up in the final tree
#[doc(hidden)]
TOMBSTONE,
#[doc(hidden)]
EOF,
} }
pub(crate) use self::SyntaxKind::*; pub(crate) use self::SyntaxKind::*;