]> Cypherpunks repositories - gostls13.git/commit
fmt: make ScanState.Token more general.
authorRoger Peppe <rogpeppe@gmail.com>
Wed, 9 Mar 2011 18:01:47 +0000 (10:01 -0800)
committerRob Pike <r@golang.org>
Wed, 9 Mar 2011 18:01:47 +0000 (10:01 -0800)
commit3a95587e019c2a0da3f960dd05c19caaf59d704a
treec789ad8a2abb3c03460b2e582269925999c58497
parent2c420ece67e25c7692e28f641d374deb0bec9b7d
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
https://golang.org/cl/4243055
src/pkg/fmt/scan.go
src/pkg/fmt/scan_test.go