diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-01-28 08:07:56 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-01-28 08:07:56 +0000 |
commit | aff82e5ee1d587b858e7237511e611bb8cc61cf3 (patch) | |
tree | 83d1a4bbaa4be96f76c2d48c00ad479173f61274 /src/parser/event_parser | |
parent | efadcf715862a2d96af0f57d2b53bfa325390779 (diff) | |
parent | 4244948c6b1a62bd0e1ef276d1f0cc22c36f6f66 (diff) |
Merge #16
16: Proof-of-concept SyntaxKind as enum r=matklad a=CAD97
This was the one bit about the original RFC I was most confused about. Why isn't `SyntaxKind` a normal `enum`?
If it's to signify that it's non-exhaustive [`#[non_exhaustive]`](https://github.com/rust-lang/rust/issues/44109) should be used. (Or `#[doc(hidden)] __Nonexhaustive` on stable.)
If it's so that more variants can be added externally, why? There's no need for that, that I can foresee.
If it's to expose the `SyntaxKind` type but not any of its instances, why? This is the only actual benefit I can see of this pseudo-enum style.
This diff is meant to be as non-invasive as possible, and as such reexports all symbols as they existed prior to this. It's diffed on top of the assumed-good-to-merge #15 to avoid the conflict between them.
Diff without #15: <https://github.com/matklad/libsyntax2/pull/16/commits/4244948c6b1a62bd0e1ef276d1f0cc22c36f6f66>
Just `src/syntax_kinds.rs`: <https://github.com/matklad/libsyntax2/pull/16/commits/4244948c6b1a62bd0e1ef276d1f0cc22c36f6f66#diff-8f0d69eb4fe0148851505f787b6fd3bb>
Diffstat (limited to 'src/parser/event_parser')
-rw-r--r-- | src/parser/event_parser/grammar/mod.rs | 1 | ||||
-rw-r--r-- | src/parser/event_parser/parser.rs | 3 |
2 files changed, 1 insertions, 3 deletions
diff --git a/src/parser/event_parser/grammar/mod.rs b/src/parser/event_parser/grammar/mod.rs index c6ab1fbe2..82f8b7f3e 100644 --- a/src/parser/event_parser/grammar/mod.rs +++ b/src/parser/event_parser/grammar/mod.rs | |||
@@ -1,6 +1,5 @@ | |||
1 | use super::parser::{Parser, TokenSet}; | 1 | use super::parser::{Parser, TokenSet}; |
2 | use SyntaxKind; | 2 | use SyntaxKind; |
3 | use tree::EOF; | ||
4 | use syntax_kinds::*; | 3 | use syntax_kinds::*; |
5 | 4 | ||
6 | mod items; | 5 | mod items; |
diff --git a/src/parser/event_parser/parser.rs b/src/parser/event_parser/parser.rs index 5ba3071cb..573e3d73a 100644 --- a/src/parser/event_parser/parser.rs +++ b/src/parser/event_parser/parser.rs | |||
@@ -1,8 +1,7 @@ | |||
1 | use {SyntaxKind, TextUnit, Token}; | 1 | use {SyntaxKind, TextUnit, Token}; |
2 | use super::Event; | 2 | use super::Event; |
3 | use super::super::is_insignificant; | 3 | use super::super::is_insignificant; |
4 | use syntax_kinds::{ERROR, L_CURLY, R_CURLY}; | 4 | use SyntaxKind::{EOF, ERROR, L_CURLY, R_CURLY, TOMBSTONE}; |
5 | use tree::{EOF, TOMBSTONE}; | ||
6 | 5 | ||
7 | pub(crate) struct Marker { | 6 | pub(crate) struct Marker { |
8 | pos: u32, | 7 | pos: u32, |