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

Issue 4243055: code review 4243055: fmt: make ScanState.Token more general. (Closed)

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

Description

fmt: make ScanState.Token more general. When writing custom scanners, I found that Token itself was rarely useful, as I did not always want to stop at white space. This change makes it possible to stop at any class of characters while reusing the buffer within State. (also fix a bug in Token)

Patch Set 1 #

Patch Set 2 : diff -r 03da6860bb39 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 03da6860bb39 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 03da6860bb39 https://go.googlecode.com/hg/ #

Total comments: 6

Patch Set 5 : diff -r 03da6860bb39 https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 03da6860bb39 https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 7 : diff -r 03da6860bb39 https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 8 : diff -r 611653f358d7 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+36 lines, -16 lines) Patch
M src/pkg/fmt/scan.go View 1 2 3 4 5 6 7 5 chunks +28 lines, -11 lines 0 comments Download
M src/pkg/fmt/scan_test.go View 1 2 3 4 5 3 chunks +8 lines, -5 lines 0 comments Download

Messages

Total messages: 13
rog
Hello r (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
14 years, 2 months ago (2011-03-04 17:17:32 UTC) #1
rog
On 4 March 2011 17:17, <rogpeppe@gmail.com> wrote: > + // Token skips space in the ...
14 years, 2 months ago (2011-03-04 17:21:30 UTC) #2
r
is there more? i'd rather not make this a replacement for lex. http://codereview.appspot.com/4243055/diff/2002/src/pkg/fmt/scan.go File src/pkg/fmt/scan.go ...
14 years, 2 months ago (2011-03-04 17:43:11 UTC) #3
rog
On 4 March 2011 17:43, <r@golang.org> wrote: > is there more? i'd rather not make ...
14 years, 2 months ago (2011-03-04 18:06:02 UTC) #4
r2
you're right about the return value from Token. let's do that now and be done. ...
14 years, 2 months ago (2011-03-04 18:14:46 UTC) #5
rog
PTAL i'm sure my phrasing of the Token comment could be better. On 4 March ...
14 years, 2 months ago (2011-03-04 18:26:04 UTC) #6
r
http://codereview.appspot.com/4243055/diff/12001/src/pkg/fmt/scan.go File src/pkg/fmt/scan.go (right): http://codereview.appspot.com/4243055/diff/12001/src/pkg/fmt/scan.go#newcode46 src/pkg/fmt/scan.go:46: // or when the calling Scan method returns. The ...
14 years, 2 months ago (2011-03-04 18:31:10 UTC) #7
rog
PTAL thanks, by the way. http://codereview.appspot.com/4243055/diff/12001/src/pkg/fmt/scan.go File src/pkg/fmt/scan.go (right): http://codereview.appspot.com/4243055/diff/12001/src/pkg/fmt/scan.go#newcode46 src/pkg/fmt/scan.go:46: // or when the ...
14 years, 2 months ago (2011-03-04 19:02:13 UTC) #8
rog
ping
14 years, 2 months ago (2011-03-08 10:07:20 UTC) #9
r
http://codereview.appspot.com/4243055/diff/14001/src/pkg/fmt/scan.go File src/pkg/fmt/scan.go (right): http://codereview.appspot.com/4243055/diff/14001/src/pkg/fmt/scan.go#newcode44 src/pkg/fmt/scan.go:44: // by next call to Token, a call to ...
14 years, 2 months ago (2011-03-08 19:42:58 UTC) #10
rog
http://codereview.appspot.com/4243055/diff/14001/src/pkg/fmt/scan.go File src/pkg/fmt/scan.go (right): http://codereview.appspot.com/4243055/diff/14001/src/pkg/fmt/scan.go#newcode44 src/pkg/fmt/scan.go:44: // by next call to Token, a call to ...
14 years, 2 months ago (2011-03-09 12:06:16 UTC) #11
r
LGTM
14 years, 2 months ago (2011-03-09 17:53:47 UTC) #12
r
14 years, 2 months ago (2011-03-09 18:01:53 UTC) #13
*** Submitted as http://code.google.com/p/go/source/detail?r=7a78dd1642ad ***

fmt: make ScanState.Token more general.
When writing custom scanners, I found that
Token itself was rarely useful, as I did not always
want to stop at white space. This change makes
it possible to stop at any class of characters
while reusing the buffer within State.
(also fix a bug in Token)

R=r, r2
CC=golang-dev
http://codereview.appspot.com/4243055

Committer: Rob Pike <r@golang.org>
Sign in to reply to this message.

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