Skip to content

Commit f5cfc05

Browse files
committed
rename
1 parent 8234a85 commit f5cfc05

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

crates/parser/src/grammar.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub(crate) mod entry {
5959
}
6060

6161
pub(crate) fn stmt(p: &mut Parser) {
62-
expressions::stmt(p, expressions::StmtWithSemi::No);
62+
expressions::stmt(p, expressions::Semicolon::Forbidden);
6363
}
6464

6565
pub(crate) fn pat(p: &mut Parser) {
@@ -103,7 +103,7 @@ pub(crate) mod entry {
103103
continue;
104104
}
105105

106-
expressions::stmt(p, expressions::StmtWithSemi::Optional);
106+
expressions::stmt(p, expressions::Semicolon::Optional);
107107
}
108108

109109
m.complete(p, MACRO_STMTS);

crates/parser/src/grammar/expressions.rs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ pub(crate) use self::atom::{block_expr, match_arm_list};
66
pub(super) use self::atom::{literal, LITERAL_FIRST};
77

88
#[derive(PartialEq, Eq)]
9-
pub(super) enum StmtWithSemi {
10-
Yes,
11-
No,
9+
pub(super) enum Semicolon {
10+
Required,
1211
Optional,
12+
Forbidden,
1313
}
1414

1515
const EXPR_FIRST: TokenSet = LHS_FIRST;
@@ -29,7 +29,7 @@ fn expr_no_struct(p: &mut Parser) {
2929
expr_bp(p, None, r, 1);
3030
}
3131

32-
pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
32+
pub(super) fn stmt(p: &mut Parser, semicolon: Semicolon) {
3333
let m = p.start();
3434
// test attr_on_expr_stmt
3535
// fn foo() {
@@ -41,7 +41,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
4141
attributes::outer_attrs(p);
4242

4343
if p.at(T![let]) {
44-
let_stmt(p, m, with_semi);
44+
let_stmt(p, m, semicolon);
4545
return;
4646
}
4747

@@ -53,7 +53,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
5353
};
5454

5555
if let Some((cm, blocklike)) = expr_stmt(p, Some(m)) {
56-
if !(p.at(T!['}']) || (with_semi != StmtWithSemi::Yes && p.at(EOF))) {
56+
if !(p.at(T!['}']) || (semicolon != Semicolon::Required && p.at(EOF))) {
5757
// test no_semi_after_block
5858
// fn foo() {
5959
// if true {}
@@ -69,27 +69,26 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
6969
// test!{}
7070
// }
7171
let m = cm.precede(p);
72-
match with_semi {
73-
StmtWithSemi::No => (),
74-
StmtWithSemi::Optional => {
75-
p.eat(T![;]);
76-
}
77-
StmtWithSemi::Yes => {
72+
match semicolon {
73+
Semicolon::Required => {
7874
if blocklike.is_block() {
7975
p.eat(T![;]);
8076
} else {
8177
p.expect(T![;]);
8278
}
8379
}
80+
Semicolon::Optional => {
81+
p.eat(T![;]);
82+
}
83+
Semicolon::Forbidden => (),
8484
}
85-
8685
m.complete(p, EXPR_STMT);
8786
}
8887
}
8988

9089
// test let_stmt
9190
// fn f() { let x: i32 = 92; }
92-
fn let_stmt(p: &mut Parser, m: Marker, with_semi: StmtWithSemi) {
91+
fn let_stmt(p: &mut Parser, m: Marker, with_semi: Semicolon) {
9392
p.bump(T![let]);
9493
patterns::pattern(p);
9594
if p.at(T![:]) {
@@ -114,11 +113,11 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
114113
}
115114

116115
match with_semi {
117-
StmtWithSemi::No => (),
118-
StmtWithSemi::Optional => {
116+
Semicolon::Forbidden => (),
117+
Semicolon::Optional => {
119118
p.eat(T![;]);
120119
}
121-
StmtWithSemi::Yes => {
120+
Semicolon::Required => {
122121
p.expect(T![;]);
123122
}
124123
}
@@ -150,7 +149,7 @@ pub(super) fn expr_block_contents(p: &mut Parser) {
150149
continue;
151150
}
152151

153-
stmt(p, StmtWithSemi::Yes);
152+
stmt(p, Semicolon::Required);
154153
}
155154
}
156155

0 commit comments

Comments
 (0)