Skip to content

Commit 983c9c1

Browse files
committed
Derive kinds information from ungrammar file
1 parent 8f044d9 commit 983c9c1

File tree

12 files changed

+434
-704
lines changed

12 files changed

+434
-704
lines changed

crates/parser/src/grammar.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -165,42 +165,6 @@ pub(crate) mod entry {
165165
}
166166
m.complete(p, ERROR);
167167
}
168-
169-
pub(crate) fn eager_macro_input(p: &mut Parser<'_>) {
170-
let m = p.start();
171-
172-
let closing_paren_kind = match p.current() {
173-
T!['{'] => T!['}'],
174-
T!['('] => T![')'],
175-
T!['['] => T![']'],
176-
_ => {
177-
p.error("expected `{`, `[`, `(`");
178-
while !p.at(EOF) {
179-
p.bump_any();
180-
}
181-
m.complete(p, ERROR);
182-
return;
183-
}
184-
};
185-
p.bump_any();
186-
while !p.at(EOF) && !p.at(closing_paren_kind) {
187-
if expressions::expr(p).is_none() {
188-
break;
189-
}
190-
if !p.at(EOF) && !p.at(closing_paren_kind) {
191-
p.expect(T![,]);
192-
}
193-
}
194-
p.expect(closing_paren_kind);
195-
if p.at(EOF) {
196-
m.complete(p, MACRO_EAGER_INPUT);
197-
return;
198-
}
199-
while !p.at(EOF) {
200-
p.bump_any();
201-
}
202-
m.complete(p, ERROR);
203-
}
204168
}
205169
}
206170

crates/parser/src/grammar/items.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,6 @@ pub(super) fn opt_item(p: &mut Parser<'_>, m: Marker) -> Result<(), Marker> {
173173
}
174174
}
175175

176-
// test existential_type
177-
// existential type Foo: Fn() -> usize;
178-
if p.at_contextual_kw(T![existential]) && p.nth(1) == T![type] {
179-
p.bump_remap(T![existential]);
180-
has_mods = true;
181-
}
182-
183176
// items
184177
match p.current() {
185178
T![fn] => fn_(p, m),
@@ -201,7 +194,7 @@ pub(super) fn opt_item(p: &mut Parser<'_>, m: Marker) -> Result<(), Marker> {
201194

202195
_ if has_visibility || has_mods => {
203196
if has_mods {
204-
p.error("expected existential, fn, trait or impl");
197+
p.error("expected fn, trait or impl");
205198
} else {
206199
p.error("expected an item");
207200
}

crates/parser/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ pub enum TopEntryPoint {
8282
/// Edge case -- macros generally don't expand to attributes, with the
8383
/// exception of `cfg_attr` which does!
8484
MetaItem,
85-
/// Edge case 2 -- eager macros expand their input to a delimited list of comma separated expressions
86-
MacroEagerInput,
8785
}
8886

8987
impl TopEntryPoint {
@@ -97,7 +95,6 @@ impl TopEntryPoint {
9795
TopEntryPoint::Type => grammar::entry::top::type_,
9896
TopEntryPoint::Expr => grammar::entry::top::expr,
9997
TopEntryPoint::MetaItem => grammar::entry::top::meta_item,
100-
TopEntryPoint::MacroEagerInput => grammar::entry::top::eager_macro_input,
10198
};
10299
let mut p = parser::Parser::new(input, edition);
103100
entry_point(&mut p);

0 commit comments

Comments
 (0)