aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/json/scanner.go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-12-03 02:17:34 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-12-03 02:17:34 +0000
commit2fd401c8f190f1fe43e51a7f726f6ed6119a1f96 (patch)
tree7f76eff391f37fe6467ff4ffbc0c582c9959ea30 /libgo/go/json/scanner.go
parent02e9018f1616b23f1276151797216717b3564202 (diff)
downloadgcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.zip
gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.tar.gz
gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.tar.bz2
libgo: Update to weekly.2011-11-02.
From-SVN: r181964
Diffstat (limited to 'libgo/go/json/scanner.go')
-rw-r--r--libgo/go/json/scanner.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/libgo/go/json/scanner.go b/libgo/go/json/scanner.go
index 1a39b4c..1796904 100644
--- a/libgo/go/json/scanner.go
+++ b/libgo/go/json/scanner.go
@@ -13,14 +13,11 @@ package json
// This file starts with two simple examples using the scanner
// before diving into the scanner itself.
-import (
- "os"
- "strconv"
-)
+import "strconv"
// checkValid verifies that data is valid JSON-encoded data.
// scan is passed in for use by checkValid to avoid an allocation.
-func checkValid(data []byte, scan *scanner) os.Error {
+func checkValid(data []byte, scan *scanner) error {
scan.reset()
for _, c := range data {
scan.bytes++
@@ -37,7 +34,7 @@ func checkValid(data []byte, scan *scanner) os.Error {
// nextValue splits data after the next whole JSON value,
// returning that value and the bytes that follow it as separate slices.
// scan is passed in for use by nextValue to avoid an allocation.
-func nextValue(data []byte, scan *scanner) (value, rest []byte, err os.Error) {
+func nextValue(data []byte, scan *scanner) (value, rest []byte, err error) {
scan.reset()
for i, c := range data {
v := scan.step(scan, int(c))
@@ -62,7 +59,7 @@ type SyntaxError struct {
Offset int64 // error occurred after reading Offset bytes
}
-func (e *SyntaxError) String() string { return e.msg }
+func (e *SyntaxError) Error() string { return e.msg }
// A scanner is a JSON scanning state machine.
// Callers call scan.reset() and then pass bytes in one at a time
@@ -87,7 +84,7 @@ type scanner struct {
parseState []int
// Error that happened, if any.
- err os.Error
+ err error
// 1-byte redo (see undo method)
redoCode int