Skip to content

Commit 039a274

Browse files
Support destructuring assignments (RFC 2909)
The supported patterns are already valid as expressions, except the rest pattern (`..`) and the wildcard pattern (`_`).
1 parent c391a33 commit 039a274

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "ungrammar"
33
description = "A DSL for describing concrete syntax trees"
4-
version = "1.15.0"
4+
version = "1.16.0"
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/matklad/ungrammar"
77
edition = "2018"

rust.ungram

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ Expr =
358358
| WhileExpr
359359
| YieldExpr
360360
| LetExpr
361+
| UnderscoreExpr
361362

362363
Literal =
363364
Attr* value:(
@@ -426,7 +427,7 @@ RecordExprFieldList =
426427
'{'
427428
Attr*
428429
fields:(RecordExprField (',' RecordExprField)* ','?)?
429-
('..' spread:Expr)?
430+
('..' spread:Expr?)?
430431
'}'
431432

432433
RecordExprField =
@@ -500,6 +501,9 @@ YieldExpr =
500501
LetExpr =
501502
Attr* 'let' Pat '=' Expr
502503

504+
UnderscoreExpr =
505+
Attr* '_'
506+
503507
AwaitExpr =
504508
Attr* Expr '.' 'await'
505509

0 commit comments

Comments
 (0)