syntax: parse unicode escape sequences as uints (#96)
Fixes #85
diff --git a/syntax/quote.go b/syntax/quote.go
index e08d780..d31eb2a 100644
--- a/syntax/quote.go
+++ b/syntax/quote.go
@@ -168,7 +168,7 @@
err = fmt.Errorf(`truncated escape sequence %s`, quoted)
return
}
- n, err1 := strconv.ParseInt(quoted[2:4], 16, 0)
+ n, err1 := strconv.ParseUint(quoted[2:4], 16, 0)
if err1 != nil {
err = fmt.Errorf(`invalid escape sequence %s`, quoted[:4])
return
diff --git a/syntax/testdata/errors.star b/syntax/testdata/errors.star
index 965fbf5..b7c9b3d 100644
--- a/syntax/testdata/errors.star
+++ b/syntax/testdata/errors.star
@@ -208,3 +208,7 @@
---
# See github.com/google/starlark-go/issues/48
a = max(range(10))) ### `unexpected '\)'`
+
+---
+# github.com/google/starlark-go/issues/85
+s = "\x-0" ### `invalid escape sequence`