diff options
author | Aleksey Kladov <[email protected]> | 2018-01-01 13:05:46 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-01-01 13:05:46 +0000 |
commit | 4cda3255309e7ed9c9d9094e12a8d91bdc1554ab (patch) | |
tree | e82fd275d4b019397c4f8d559c4036fbd80e01d9 /src/parser/event_parser/mod.rs | |
parent | e24cadb490ee3d912a500d8ae4f1455ece0d5e68 (diff) |
Parser: even more groundwork
Diffstat (limited to 'src/parser/event_parser/mod.rs')
-rw-r--r-- | src/parser/event_parser/mod.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/parser/event_parser/mod.rs b/src/parser/event_parser/mod.rs new file mode 100644 index 000000000..14107720a --- /dev/null +++ b/src/parser/event_parser/mod.rs | |||
@@ -0,0 +1,20 @@ | |||
1 | use {Token, TextUnit, SyntaxKind}; | ||
2 | |||
3 | use syntax_kinds::*; | ||
4 | mod grammar; | ||
5 | mod parser; | ||
6 | |||
7 | pub(crate) enum Event { | ||
8 | Start { kind: SyntaxKind }, | ||
9 | Finish, | ||
10 | Token { | ||
11 | kind: SyntaxKind, | ||
12 | n_raw_tokens: u8, | ||
13 | } | ||
14 | } | ||
15 | |||
16 | pub(crate) fn parse<'t>(text: &'t str, raw_tokens: &'t [Token]) -> Vec<Event> { | ||
17 | let mut parser = parser::Parser::new(text, raw_tokens); | ||
18 | grammar::parse_file(&mut parser); | ||
19 | parser.into_events() | ||
20 | } \ No newline at end of file | ||