summaryrefslogtreecommitdiff
path: root/src/pkg/go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/go')
-rw-r--r--src/pkg/go/doc/comment.go12
-rw-r--r--src/pkg/go/parser/parser.go12
-rw-r--r--src/pkg/go/printer/printer.go5
-rw-r--r--src/pkg/go/scanner/scanner_test.go10
4 files changed, 21 insertions, 18 deletions
diff --git a/src/pkg/go/doc/comment.go b/src/pkg/go/doc/comment.go
index 064080fe7..ac04e82f2 100644
--- a/src/pkg/go/doc/comment.go
+++ b/src/pkg/go/doc/comment.go
@@ -142,8 +142,8 @@ func split(text []byte) [][]byte {
var (
- ldquo = io.StringBytes("“");
- rdquo = io.StringBytes("”");
+ ldquo = strings.Bytes("“");
+ rdquo = strings.Bytes("”");
)
// Escape comment text for HTML.
@@ -168,10 +168,10 @@ func commentEscape(w io.Writer, s []byte) {
var (
- html_p = io.StringBytes("<p>\n");
- html_endp = io.StringBytes("</p>\n");
- html_pre = io.StringBytes("<pre>");
- html_endpre = io.StringBytes("</pre>\n");
+ html_p = strings.Bytes("<p>\n");
+ html_endp = strings.Bytes("</p>\n");
+ html_pre = strings.Bytes("<pre>");
+ html_endpre = strings.Bytes("</pre>\n");
)
diff --git a/src/pkg/go/parser/parser.go b/src/pkg/go/parser/parser.go
index aabd2248b..b8bb3b85a 100644
--- a/src/pkg/go/parser/parser.go
+++ b/src/pkg/go/parser/parser.go
@@ -10,6 +10,7 @@
package parser
import (
+ "bytes";
"container/vector";
"fmt";
"go/ast";
@@ -17,6 +18,7 @@ import (
"go/token";
"io";
"os";
+ "strings";
)
@@ -1964,16 +1966,16 @@ func readSource(src interface{}) ([]byte, os.Error) {
if src != nil {
switch s := src.(type) {
case string:
- return io.StringBytes(s), nil;
+ return strings.Bytes(s), nil;
case []byte:
return s, nil;
- case *io.ByteBuffer:
- // is io.Read, but src is already available in []byte form
+ case *bytes.Buffer:
+ // is io.Reader, but src is already available in []byte form
if s != nil {
return s.Data(), nil;
}
case io.Reader:
- var buf io.ByteBuffer;
+ var buf bytes.Buffer;
n, err := io.Copy(s, &buf);
if err != nil {
return nil, err;
@@ -1997,7 +1999,7 @@ func scannerMode(mode uint) uint {
// Parse parses a Go program.
//
// The program source src may be provided in a variety of formats. At the
-// moment the following types are supported: string, []byte, and io.Read.
+// moment the following types are supported: string, []byte, and io.Reader.
// The mode parameter controls the amount of source text parsed and other
// optional parser functionality.
//
diff --git a/src/pkg/go/printer/printer.go b/src/pkg/go/printer/printer.go
index 4465314bc..19cb4d108 100644
--- a/src/pkg/go/printer/printer.go
+++ b/src/pkg/go/printer/printer.go
@@ -12,6 +12,7 @@ import (
"io";
"os";
"reflect";
+ "strings";
)
@@ -166,9 +167,9 @@ func (p *printer) print(args ...) {
case []byte:
p.write(x);
case string:
- p.write(io.StringBytes(x));
+ p.write(strings.Bytes(x));
case token.Token:
- p.write(io.StringBytes(x.String()));
+ p.write(strings.Bytes(x.String()));
case token.Position:
// set current position
p.pos = x;
diff --git a/src/pkg/go/scanner/scanner_test.go b/src/pkg/go/scanner/scanner_test.go
index 0906d5c0e..17491e656 100644
--- a/src/pkg/go/scanner/scanner_test.go
+++ b/src/pkg/go/scanner/scanner_test.go
@@ -7,7 +7,7 @@ package scanner
import (
"go/scanner";
"go/token";
- "io";
+ "strings";
"testing";
)
@@ -190,7 +190,7 @@ func TestScan(t *testing.T) {
// verify scan
index := 0;
eloc := token.Position{0, 1, 1};
- nerrors := scanner.Tokenize(io.StringBytes(src), &TestErrorHandler{t}, scanner.ScanComments,
+ nerrors := scanner.Tokenize(strings.Bytes(src), &TestErrorHandler{t}, scanner.ScanComments,
func (pos token.Position, tok token.Token, litb []byte) bool {
e := elt{token.EOF, "", special};
if index < len(tokens) {
@@ -236,7 +236,7 @@ func TestInit(t *testing.T) {
var s scanner.Scanner;
// 1st init
- s.Init(io.StringBytes("if true { }"), nil, 0);
+ s.Init(strings.Bytes("if true { }"), nil, 0);
s.Scan(); // if
s.Scan(); // true
pos, tok, lit := s.Scan(); // {
@@ -245,7 +245,7 @@ func TestInit(t *testing.T) {
}
// 2nd init
- s.Init(io.StringBytes("go true { ]"), nil, 0);
+ s.Init(strings.Bytes("go true { ]"), nil, 0);
pos, tok, lit = s.Scan(); // go
if tok != token.GO {
t.Errorf("bad token: got %s, expected %s", tok.String(), token.GO);
@@ -261,7 +261,7 @@ func TestIllegalChars(t *testing.T) {
var s scanner.Scanner;
const src = "*?*$*@*";
- s.Init(io.StringBytes(src), &TestErrorHandler{t}, scanner.AllowIllegalChars);
+ s.Init(strings.Bytes(src), &TestErrorHandler{t}, scanner.AllowIllegalChars);
for offs, ch := range src {
pos, tok, lit := s.Scan();
if pos.Offset != offs {