Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec: Update the list of tokens that can start/end statements. #18611

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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