Skip to content

Commit

Permalink
syntax: reserve async, await keywords (google#476)
Browse files Browse the repository at this point in the history
This is technically a breaking change, but neither Google's
nor GitHub's Starlark corpus contains a single instance
of either of these used as identifiers, so the change looks
pretty safe.

Fixes google#471
  • Loading branch information
adonovan authored Jun 12, 2023
1 parent a134d8f commit d31a485
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 8 additions & 6 deletions doc/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,14 @@ appear in the grammar; they are reserved as possible future keywords:
<!-- and to remain a syntactic subset of Python -->

```text
as finally nonlocal
assert from raise
class global try
del import with
except is yield
```
as except nonlocal
assert finally raise
async from try
await global with
class import yield
del is
```
<!-- NB: bazelbuild/starlark puts `while` in the second list -->

<b>Implementation note:</b>
The Go implementation permits `assert` to be used as an identifier,
Expand Down
2 changes: 2 additions & 0 deletions syntax/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,8 @@ var keywordToken = map[string]Token{
// reserved words:
"as": ILLEGAL,
// "assert": ILLEGAL, // heavily used by our tests
"async": ILLEGAL,
"await": ILLEGAL,
"class": ILLEGAL,
"del": ILLEGAL,
"except": ILLEGAL,
Expand Down

0 comments on commit d31a485

Please sign in to comment.