diff options
author | Aleksey Kladov <[email protected]> | 2018-08-08 21:09:40 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-08 21:09:40 +0100 |
commit | 1f6c442a3f2f660803f598d70f3f69b469637829 (patch) | |
tree | 6fa236aa3a1cdfaef96603c9f3c6a76ec78246c8 /src/parser_api.rs | |
parent | 8c598d3d8a9d6fe0b8303250c88c252ff98883fd (diff) |
Fix panic with EOF token
Diffstat (limited to 'src/parser_api.rs')
-rw-r--r-- | src/parser_api.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/parser_api.rs b/src/parser_api.rs index 58002a8fc..c78c6e43a 100644 --- a/src/parser_api.rs +++ b/src/parser_api.rs | |||
@@ -29,6 +29,15 @@ macro_rules! token_set_union { | |||
29 | ($($ts:expr),* ,) => { token_set_union!($($ts),*) }; | 29 | ($($ts:expr),* ,) => { token_set_union!($($ts),*) }; |
30 | } | 30 | } |
31 | 31 | ||
32 | #[test] | ||
33 | fn token_set_works_for_tokens() { | ||
34 | use SyntaxKind::*; | ||
35 | let ts = token_set! { EOF, SHEBANG }; | ||
36 | assert!(ts.contains(EOF)); | ||
37 | assert!(ts.contains(SHEBANG)); | ||
38 | assert!(!ts.contains(PLUS)); | ||
39 | } | ||
40 | |||
32 | /// `Parser` struct provides the low-level API for | 41 | /// `Parser` struct provides the low-level API for |
33 | /// navigating through the stream of tokens and | 42 | /// navigating through the stream of tokens and |
34 | /// constructing the parse tree. The actual parsing | 43 | /// constructing the parse tree. The actual parsing |