Skip to content

Commit

Permalink
syntax: improve error message for unmatched close paren (google#74)
Browse files Browse the repository at this point in the history
Fixes google#48
  • Loading branch information
adonovan authored Dec 17, 2018
1 parent f817a90 commit 990a796
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion syntax/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ start:

case ']', ')', '}':
if sc.depth == 0 {
sc.error(sc.pos, "indentation error")
sc.errorf(sc.pos, "unexpected %q", c)
} else {
sc.depth--
}
Expand Down
4 changes: 4 additions & 0 deletions syntax/testdata/errors.star
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,7 @@ c, d = 1, 2 # ok
a, b, = 1, 2 ### `unparenthesized tuple with trailing comma`
---
a, b = 1, 2, ### `unparenthesized tuple with trailing comma`

---
# See github.com/google/starlark-go/issues/48
a = max(range(10))) ### `unexpected '\)'`

0 comments on commit 990a796

Please sign in to comment.