aboutsummaryrefslogtreecommitdiff
path: root/src/parser/event_parser/grammar.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/event_parser/grammar.rs')
-rw-r--r--src/parser/event_parser/grammar.rs62
1 files changed, 61 insertions, 1 deletions
diff --git a/src/parser/event_parser/grammar.rs b/src/parser/event_parser/grammar.rs
index c3496cccd..5219ed535 100644
--- a/src/parser/event_parser/grammar.rs
+++ b/src/parser/event_parser/grammar.rs
@@ -3,8 +3,68 @@ use super::parser::Parser;
3 3
4use syntax_kinds::*; 4use syntax_kinds::*;
5 5
6// Items //
7
6pub fn file(p: &mut Parser) { 8pub fn file(p: &mut Parser) {
7 p.start(FILE); 9 p.start(FILE);
8 //TODO: parse_shebang 10 shebang(p);
11 inner_attributes(p);
12 mod_items(p);
13 p.finish();
14}
15
16type Result = ::std::result::Result<(), ()>;
17const OK: Result = Ok(());
18const ERR: Result = Err(());
19
20fn shebang(_: &mut Parser) {
21 //TODO
22}
23
24fn inner_attributes(_: &mut Parser) {
25 //TODO
26}
27
28fn mod_items(p: &mut Parser) {
29 loop {
30 skip_until_item(p);
31 if p.is_eof() {
32 return;
33 }
34 if item(p).is_err() {
35 skip_one_token(p);
36 }
37 }
38}
39
40fn item(p: &mut Parser) -> Result {
41 outer_attributes(p)?;
42 visibility(p)?;
43 ERR
44}
45
46
47
48// Paths, types, attributes, and stuff //
49
50fn outer_attributes(_: &mut Parser) -> Result {
51 OK
52}
53
54fn visibility(_: &mut Parser) -> Result {
55 OK
56}
57
58// Expressions //
59
60// Error recovery and high-order utils //
61
62fn skip_until_item(_: &mut Parser) {
63 //TODO
64}
65
66fn skip_one_token(p: &mut Parser) {
67 p.start(ERROR);
68 p.bump().unwrap();
9 p.finish(); 69 p.finish();
10} \ No newline at end of file 70} \ No newline at end of file