diff options
author | Aleksey Kladov <[email protected]> | 2018-01-28 08:43:59 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-01-28 08:43:59 +0000 |
commit | 52104f7d250470bc35c640904ee2bc32633dbd7e (patch) | |
tree | 4d2bf45c6bbce7edf426eb055b50872510116e30 | |
parent | aff82e5ee1d587b858e7237511e611bb8cc61cf3 (diff) |
Explain TOMBSTONE and EOF
-rw-r--r-- | src/bin/gen.rs | 8 | ||||
-rw-r--r-- | 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 { | |||
51 | write!(acc, " {},\n", scream(kind)).unwrap(); | 51 | write!(acc, " {},\n", scream(kind)).unwrap(); |
52 | } | 52 | } |
53 | acc.push_str("\n"); | 53 | acc.push_str("\n"); |
54 | acc.push_str(" TOMBSTONE = !0 - 1,\n"); | 54 | acc.push_str(" // Technical SyntaxKinds: they appear temporally during parsing,\n"); |
55 | acc.push_str(" EOF = !0,\n"); | 55 | acc.push_str(" // but never end up in the final tree\n"); |
56 | acc.push_str(" #[doc(hidden)]\n"); | ||
57 | acc.push_str(" TOMBSTONE,\n"); | ||
58 | acc.push_str(" #[doc(hidden)]\n"); | ||
59 | acc.push_str(" EOF,\n"); | ||
56 | acc.push_str("}\n"); | 60 | acc.push_str("}\n"); |
57 | acc.push_str("pub(crate) use self::SyntaxKind::*;\n"); | 61 | acc.push_str("pub(crate) use self::SyntaxKind::*;\n"); |
58 | acc.push_str("\n"); | 62 | 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 { | |||
92 | ALIAS, | 92 | ALIAS, |
93 | VISIBILITY, | 93 | VISIBILITY, |
94 | 94 | ||
95 | TOMBSTONE = !0 - 1, | 95 | // Technical SyntaxKinds: they appear temporally during parsing, |
96 | EOF = !0, | 96 | // but never end up in the final tree |
97 | #[doc(hidden)] | ||
98 | TOMBSTONE, | ||
99 | #[doc(hidden)] | ||
100 | EOF, | ||
97 | } | 101 | } |
98 | pub(crate) use self::SyntaxKind::*; | 102 | pub(crate) use self::SyntaxKind::*; |
99 | 103 | ||