Skip to content

Commit 464fa20

Browse files
committed
upd
1 parent 5138034 commit 464fa20

3 files changed

Lines changed: 9 additions & 24 deletions

File tree

src/lang-patterns.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
# ShockScript: Patterns
22

3-
Matching patterns may be used in a number of contexts, including variable bindings, `try..catch` clauses, `switch type` cases, `if`-let and assignment left-hand sides.
3+
Matching patterns may be used in a number of contexts, including variable bindings, `try..catch` clauses, `switch type` cases, `if..let` and assignment left-hand sides.
44

55
Where applicable, expressions are disambiguated into those patterns, in which case any incompatible or illegal expression results in a syntax error; for example, an expression is disambiguated into a pattern inside an assignment whose left-hand side is either an array or object literal.
66

7-
An *IdentifierPattern* representing exactly a single wildcard **\*** identifier, when inside a variant arguments pattern, is treated as a parameter skip.
8-
9-
```sx
10-
if (let Plus(*, 10) = exp) {
11-
f = true
12-
}
13-
```
14-
157
**Syntax**
168

179
<ul>

src/lang-patterns/identifier-pattern.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ Vector({ x, y })
2222
<ul>
2323
<i>IdentifierPatternStart</i> :
2424
<ul>
25-
<i>PropertyIdentifier</i>
25+
<i>Identifier</i> [when keywords are enabled]<br>
26+
<i>IdentifierName</i> [when keywords are disabled]
2627
</ul>
2728
</ul>
2829

@@ -45,17 +46,9 @@ Vector({ x, y })
4546
<ul>
4647
<i>IdentifierPatternArgument</i> :
4748
<ul>
49+
<b>*</b><br>
4850
<i>Pattern</i><br>
49-
<i>IdentifierPatternArgument</i> <b>,</b> <i>Pattern</i>
51+
<i>IdentifierPatternArgument</i> <b>,</b> <i>Pattern</i><br>
52+
<i>IdentifierPatternArgument</i> <b>,</b> <b>*</b>
5053
</ul>
51-
</ul>
52-
53-
**Semantics**
54-
55-
An *IdentifierPattern* representing exactly a single wildcard **\*** identifier is treated as a parameter skip.
56-
57-
```sx
58-
if (let Plus(*, 10) = exp) {
59-
f = true
60-
}
61-
```
54+
</ul>

src/lang-statements/if-let-statement.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# If let statement
22

3-
The `if let` statement may be used for pattern matching on algebraic data types.
3+
The `if..let` statement may be used for pattern matching on algebraic data types.
44

55
```sx
66
if (let Plus(10, right) = exp) {
@@ -16,7 +16,7 @@ if (let node = parseAtom()) {
1616
}
1717
```
1818

19-
`if let` can also be useful for, say, iterator results.
19+
`if..let` can also be useful for, say, iterator results.
2020

2121
```sx
2222
if (let [x] = characters.next()) {

0 commit comments

Comments
 (0)