Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1347)

Issue 1252045: code review 1252045: fmt.Scan, fmt.Scanln: Start of a simple scanning package. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 10 months ago by r
Modified:
14 years, 10 months ago
Reviewers:
CC:
rsc, golang-dev
Visibility:
Public.

Description

fmt.Scan, fmt.Scanln: Start of a simple scanning API in the fmt package. Still to do: - composite types - user-defined scanners - format-driven scanning The package comment will be updated when more of the functionality is in place.

Patch Set 1 #

Total comments: 16

Patch Set 2 : code review 1252045: fmt.Scan, fmt.Scanln: Start of a simple scanning API in... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+595 lines, -0 lines) Patch
M src/pkg/fmt/Makefile View 1 chunk +1 line, -0 lines 0 comments Download
A src/pkg/fmt/scan.go View 1 1 chunk +413 lines, -0 lines 0 comments Download
A src/pkg/fmt/scan_test.go View 1 1 chunk +181 lines, -0 lines 0 comments Download

Messages

Total messages: 3
r
Hello rsc (cc: golang-dev@googlegroups.com), I'd like you to review this change.
14 years, 10 months ago (2010-05-24 20:53:58 UTC) #1
rsc1
LGTM http://codereview.appspot.com/1252045/diff/1/3 File src/pkg/fmt/scan.go (right): http://codereview.appspot.com/1252045/diff/1/3#newcode32 src/pkg/fmt/scan.go:32: // readRune is a structure to enable reading ...
14 years, 10 months ago (2010-05-25 23:48:21 UTC) #2
r
14 years, 10 months ago (2010-05-26 04:02:42 UTC) #3
*** Submitted as http://code.google.com/p/go/source/detail?r=b0cbd8aa908e ***

fmt.Scan, fmt.Scanln: Start of a simple scanning API in the fmt package.
Still to do:
	- composite types
	- user-defined scanners
	- format-driven scanning
The package comment will be updated when more of the functionality is in place.

R=rsc
CC=golang-dev
http://codereview.appspot.com/1252045

http://codereview.appspot.com/1252045/diff/1/3
File src/pkg/fmt/scan.go (right):

http://codereview.appspot.com/1252045/diff/1/3#newcode32
src/pkg/fmt/scan.go:32: // readRune is a structure to enable reading UTF-8
encoded code points
On 2010/05/25 23:48:21, rsc1 wrote:
> // TODO: readByteRune for things that can read bytes
> 

Done.

http://codereview.appspot.com/1252045/diff/1/3#newcode57
src/pkg/fmt/scan.go:57: if c, w := utf8.DecodeRune(r.buf[0:size]); w == size{
On 2010/05/25 23:48:21, rsc1 wrote:
> Should use utf8.FullRune to handle malformed encodings correctly.
>  

Done.

http://codereview.appspot.com/1252045/diff/1/3#newcode93
src/pkg/fmt/scan.go:93: _ = ssFree <- s
On 2010/05/25 23:48:21, rsc1 wrote:
> s.rr = nil first
> 

Done.

http://codereview.appspot.com/1252045/diff/1/3#newcode135
src/pkg/fmt/scan.go:135: if err == os.EOF {
it's a special case. consider scanning a (Reader) string "123" looking for an
integer. we hit EOF in this case, but it's not an error.

http://codereview.appspot.com/1252045/diff/1/3#newcode150
src/pkg/fmt/scan.go:150: // Scan parses text read from r, storing successive
white-space-separated
On 2010/05/25 23:48:21, rsc1 wrote:
> s/white-//
> again throughout
> 
> 

Done.

http://codereview.appspot.com/1252045/diff/1/3#newcode197
src/pkg/fmt/scan.go:197: real, str = floatPart(str)
On 2010/05/25 23:48:21, rsc1 wrote:
> Looks like this will parse 1.0.2i as a complex 1.0 + 0.2i
> Must have + or - at beginning of str at this point.
> 
> 

Done.

http://codereview.appspot.com/1252045/diff/1/3#newcode207
src/pkg/fmt/scan.go:207: func floatPart(str string) (first, last string) {
not needed. this code does not need to handle erroneously formatted floats; atof
will report the error.

http://codereview.appspot.com/1252045/diff/1/3#newcode320
src/pkg/fmt/scan.go:320: for n, param := range a {
On 2010/05/25 23:48:21, rsc1 wrote:
> Maybe do s.getToken() once here instead of in some of the getters below.
> 

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b