Skip to content

Commit 485c5e6

Browse files
committed
internal: remove unused dollars
1 parent 5a83d1b commit 485c5e6

File tree

5 files changed

+5
-53
lines changed

5 files changed

+5
-53
lines changed

crates/parser/src/grammar/expressions/atom.rs

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet =
3939
T!['('],
4040
T!['{'],
4141
T!['['],
42-
L_DOLLAR,
4342
T![|],
4443
T![move],
4544
T![box],
@@ -59,7 +58,7 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet =
5958
LIFETIME_IDENT,
6059
]));
6160

62-
const EXPR_RECOVERY_SET: TokenSet = TokenSet::new(&[T![let], R_DOLLAR]);
61+
const EXPR_RECOVERY_SET: TokenSet = TokenSet::new(&[T![let]]);
6362

6463
pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> {
6564
if let Some(m) = literal(p) {
@@ -72,7 +71,6 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar
7271
let done = match p.current() {
7372
T!['('] => tuple_expr(p),
7473
T!['['] => array_expr(p),
75-
L_DOLLAR => meta_var_expr(p),
7674
T![|] => closure_expr(p),
7775
T![move] if la == T![|] => closure_expr(p),
7876
T![async] if la == T![|] || (la == T![move] && p.nth(2) == T![|]) => closure_expr(p),
@@ -622,27 +620,3 @@ fn box_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker {
622620
}
623621
m.complete(p, BOX_EXPR)
624622
}
625-
626-
/// Expression from `$var` macro expansion, wrapped in dollars
627-
fn meta_var_expr(p: &mut Parser) -> CompletedMarker {
628-
assert!(p.at(L_DOLLAR));
629-
let m = p.start();
630-
p.bump(L_DOLLAR);
631-
let expr = expr_bp(p, None, Restrictions { forbid_structs: false, prefer_stmt: false }, 1);
632-
633-
match (expr, p.current()) {
634-
(Some((cm, _)), R_DOLLAR) => {
635-
p.bump(R_DOLLAR);
636-
// FIXME: this leaves the dollar hanging in the air...
637-
m.abandon(p);
638-
cm
639-
}
640-
_ => {
641-
while !p.at(R_DOLLAR) {
642-
p.bump_any();
643-
}
644-
p.bump(R_DOLLAR);
645-
m.complete(p, ERROR)
646-
}
647-
}
648-
}

crates/parser/src/grammar/types.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ pub(super) const TYPE_FIRST: TokenSet = paths::PATH_FIRST.union(TokenSet::new(&[
1919
const TYPE_RECOVERY_SET: TokenSet = TokenSet::new(&[
2020
T![')'],
2121
T![,],
22-
L_DOLLAR,
2322
// test_err struct_field_recover
2423
// struct S { f pub g: () }
2524
T![pub],

crates/parser/src/parser.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use drop_bomb::DropBomb;
77
use crate::{
88
event::Event,
99
ParseError,
10-
SyntaxKind::{self, EOF, ERROR, L_DOLLAR, R_DOLLAR, TOMBSTONE},
10+
SyntaxKind::{self, EOF, ERROR, TOMBSTONE},
1111
TokenSet, TokenSource, T,
1212
};
1313

@@ -215,23 +215,13 @@ impl<'t> Parser<'t> {
215215

216216
/// Create an error node and consume the next token.
217217
pub(crate) fn err_and_bump(&mut self, message: &str) {
218-
match self.current() {
219-
L_DOLLAR | R_DOLLAR => {
220-
let m = self.start();
221-
self.error(message);
222-
self.bump_any();
223-
m.complete(self, ERROR);
224-
}
225-
_ => {
226-
self.err_recover(message, TokenSet::EMPTY);
227-
}
228-
}
218+
self.err_recover(message, TokenSet::EMPTY);
229219
}
230220

231221
/// Create an error node and consume the next token.
232222
pub(crate) fn err_recover(&mut self, message: &str, recovery: TokenSet) {
233223
match self.current() {
234-
T!['{'] | T!['}'] | L_DOLLAR | R_DOLLAR => {
224+
T!['{'] | T!['}'] => {
235225
self.error(message);
236226
return;
237227
}

crates/parser/src/syntax_kind/generated.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ pub enum SyntaxKind {
120120
LIFETIME_IDENT,
121121
COMMENT,
122122
SHEBANG,
123-
L_DOLLAR,
124-
R_DOLLAR,
125123
SOURCE_FILE,
126124
STRUCT,
127125
UNION,

crates/syntax/src/tests/ast_src.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
7272
],
7373
contextual_keywords: &["auto", "default", "existential", "union", "raw", "macro_rules"],
7474
literals: &["INT_NUMBER", "FLOAT_NUMBER", "CHAR", "BYTE", "STRING", "BYTE_STRING"],
75-
tokens: &[
76-
"ERROR",
77-
"IDENT",
78-
"WHITESPACE",
79-
"LIFETIME_IDENT",
80-
"COMMENT",
81-
"SHEBANG",
82-
"L_DOLLAR",
83-
"R_DOLLAR",
84-
],
75+
tokens: &["ERROR", "IDENT", "WHITESPACE", "LIFETIME_IDENT", "COMMENT", "SHEBANG"],
8576
nodes: &[
8677
"SOURCE_FILE",
8778
"STRUCT",

0 commit comments

Comments
 (0)