Skip to content

Commit

Permalink
Backport "Spec: Update the list of tokens that can start/end statemen…
Browse files Browse the repository at this point in the history
…ts." to LTS (#20626)

Backports #18611 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
  • Loading branch information
WojciechMazur committed Jun 20, 2024
2 parents 6cda0e8 + 4ee4929 commit 0b2759f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions docs/_spec/01-lexical-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,19 @@ A newline in a Scala source text is treated as the special token “nl” if the
The tokens that can terminate a statement are: literals, identifiers and the following delimiters and reserved words:

```
this null true false return type <xml-start>
_ ) ] }
this null true false return type given <xml-start>
_ ) ] } outdent
```

The tokens that can begin a statement are all Scala tokens _except_ the following delimiters and reserved words:

```
catch else extends finally forSome match with yield
, . ; : = => <- <: <% >: # [ ) ] }
catch do else extends finally forSome macro
match then with yield
, . ; : = => <- <: <% >: # =>> ?=>
) ] } outdent
```

A `case` token can begin a statement only if followed by a
`class` or `object` token.

A _leading infix operator_ is a symbolic identifier such as `+`, or `approx_==`, or an identifier in backticks that:

- starts a new line, and
Expand Down

0 comments on commit 0b2759f

Please sign in to comment.