File tree 3 files changed +7
-1
lines changed
3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,10 @@ pub(crate) mod fragments {
66
66
expressions:: stmt ( p, expressions:: StmtWithSemi :: No )
67
67
}
68
68
69
+ pub ( crate ) fn stmt_optional_semi ( p : & mut Parser ) {
70
+ expressions:: stmt ( p, expressions:: StmtWithSemi :: Optional )
71
+ }
72
+
69
73
pub ( crate ) fn opt_visibility ( p : & mut Parser ) {
70
74
let _ = super :: opt_visibility ( p) ;
71
75
}
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ pub enum FragmentKind {
88
88
Path ,
89
89
Expr ,
90
90
Statement ,
91
+ StatementOptionalSemi ,
91
92
Type ,
92
93
Pattern ,
93
94
Item ,
@@ -118,6 +119,7 @@ pub fn parse_fragment(
118
119
FragmentKind :: Visibility => grammar:: fragments:: opt_visibility,
119
120
FragmentKind :: MetaItem => grammar:: fragments:: meta_item,
120
121
FragmentKind :: Statement => grammar:: fragments:: stmt,
122
+ FragmentKind :: StatementOptionalSemi => grammar:: fragments:: stmt_optional_semi,
121
123
FragmentKind :: Items => grammar:: fragments:: macro_items,
122
124
FragmentKind :: Statements => grammar:: fragments:: macro_stmts,
123
125
FragmentKind :: Attr => grammar:: fragments:: attr,
Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ impl ast::Attr {
215
215
impl ast:: Stmt {
216
216
/// Returns `text`, parsed as statement, but only if it has no errors.
217
217
pub fn parse ( text : & str ) -> Result < Self , ( ) > {
218
- parsing:: parse_text_fragment ( text, parser:: FragmentKind :: Statement )
218
+ parsing:: parse_text_fragment ( text, parser:: FragmentKind :: StatementOptionalSemi )
219
219
}
220
220
}
221
221
You can’t perform that action at this time.
0 commit comments