You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The lexical analyzer also inserts `indent` and `outdent` tokensthat represent regions of indented code [at certain points](../reference/other-new-features-indentation.html)
89
-
90
-
In the context-free productions below we use the notation `<<< ts >>>`
91
-
to indicate a token sequence `ts` that is either enclosed in a pair of braces `{ ts }` or that constitutes an indented region `indent ts outdent`.
Copy file name to clipboardExpand all lines: docs/docs/reference/other-new-features/indentation.md
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -58,20 +58,23 @@ There are two rules:
58
58
59
59
An indentation region can start
60
60
61
+
- after the leading parameters of an `extension`, or
62
+
- after a `with` in a giveninstance, or
63
+
- after a ": at end of line" token (see below)
61
64
- after one of the following tokens:
65
+
62
66
```
63
-
==>?=><-catchdoelsefinallyforif
64
-
matchreturnthenthrowtrywithwhileyield
67
+
==>?=><-catchdoelsefinallyfor
68
+
ifmatchreturnthenthrowtrywhileyield
65
69
```
66
-
- after the leading parameters of an `extension`.
67
70
68
71
If an `<indent>` is inserted, the indentation width of the token on the next line
69
72
is pushed onto `IW`, which makes it the new current indentation width.
70
73
71
74
2. An `<outdent>` is inserted at a line break, if
72
75
73
76
- the first token on the next line has an indentation width strictly less
74
-
than the current indentation width, and
77
+
than the current indentation width, and
75
78
- the last token on the previous line is not one of the following tokens
76
79
which indicate that the previous statement continues:
77
80
```
@@ -88,7 +91,7 @@ There are two rules:
88
91
89
92
-An `<outdent>` is also inserted if the next token following a statement sequence starting with an `<indent>` closes an indentation region, i.e. is one of `then`, `else`, `do`, `catch`, `finally`, `yield`, `}`, `)`, `]` or `case`.
90
93
91
-
-An `<outdent>` is finally inserted in front of a comma that follows a statement sequence starting with an `<indent>` if the indented region is itself enclosed in parentheses
94
+
An `<outdent>` is finally inserted in front of a comma that follows a statement sequence starting with an `<indent>` if the indented region is itself enclosed in parentheses
92
95
93
96
It is an error if the indentation width of the token following an `<outdent>` does not match the indentation of some previous line in the enclosing indentation region. For instance, the following would be rejected.
0 commit comments