Граф коммитов

15 Коммитов

Автор SHA1 Сообщение Дата
Marcel van Lohuizen 8d4ab0ee82 transform: fix Append for len(dst) > 0
Change-Id: I9b3eb475d7936d9d1288e5c08136a0c3fb8b7929
Reviewed-on: https://go-review.googlesource.com/18699
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-01-29 17:38:40 +00:00
Marcel van Lohuizen 4fa7f58f8e transform: added Append function
Change-Id: Idcc31efc78ef36f3d90706f06bfeb02e3641f5c0
Reviewed-on: https://go-review.googlesource.com/18698
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-01-25 18:02:14 +00:00
David Symonds f3d52e0263 text: add import comments.
Change-Id: Ifdb6e8b968ae432c1e4c703c25ae034382c94cc9
Reviewed-on: https://go-review.googlesource.com/1243
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-09 22:46:39 +00:00
Marcel van Lohuizen 29c876dd07 text/transform: fixed test build
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/176510043
2014-12-02 13:52:02 +01:00
Andrew Gerrand d541d34d9c go.text: use golang.org/x/... import paths
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/165930044
2014-11-10 08:48:25 +11:00
Marcel van Lohuizen 7eb4c23133 go.text.transform: added Reset method to Transformer interface.
Reasons to pick explicit Reset instead of optional one:
- Explict reset is about 3-4 times faster.
- More Transformers than I expected (7 of 19 currently in go.text) can use
  a Reset method to some extent.
- Simpler code overall compared to an implementation of an optional Reset.
- Makes it easier to change implementations that currently don't need
  a Reset method to use one later.

I'm somewhat ambivalent about the NopResetter type, but it does simplify
the code a bit. One notable advantage is that it gives standardized
documentation for the Reset method of types embedding this type.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/144400043
2014-09-23 09:12:29 +02:00
Joe Shaw b2a2294c2a go.text/transform: fix out-of-bounds panic when buffer size exceeds initial default
LGTM=mpvl
R=golang-codereviews, gobot, mpvl
CC=golang-codereviews
https://golang.org/cl/123570044
2014-08-27 09:42:37 +02:00
Marcel van Lohuizen 22240b87e7 go.text/transform: added String func to the transform package.
This will be used in the upcoming cases package.

Also expanded the tests and fixed some code to be a bit more robust in
case a Transformer returns ErrShortDst while making progress.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews, r
https://golang.org/cl/101630043
2014-07-22 11:49:01 +02:00
Marcel van Lohuizen 2806c7f5a4 go.text/transform: Added Bytes function, analoguous to the Bytes
in unicode/norm.

R=r
CC=golang-codereviews
https://golang.org/cl/52760043
2014-01-16 20:52:22 +01:00
Marcel van Lohuizen 191b11aac8 go.text/transform: added RemoveFunc transform for removing individual
runes from the input. This corresponds to ICU's Remove transform.
For example, to remove accents from characters one could use RemoveFunc
as follows:
        nonspacingMark := func(r rune) bool {
                return unicode.Is(unicode.Mn, r)
        }
        transform.Chain(norm.NFD, transform.RemoveFunc(nonspacingMark), norm.NFC)
(Once norm.Form implements Transformer; guess what will be my next CL.)

R=r
CC=golang-dev, nigeltao
https://golang.org/cl/23220043
2013-11-26 08:29:24 +01:00
Nigel Tao d0bbf51710 go.text/transform: fix s/src/dst/ typo in Writer.Close.
R=r
CC=golang-dev, mpvl
https://golang.org/cl/11823043
2013-07-26 09:22:10 +10:00
Marcel van Lohuizen b67299ac79 go.text/transform: implementation of Writer, Chain, Nop and Discard.
R=nigeltao, r
CC=golang-dev
https://golang.org/cl/10964043
2013-07-24 16:26:05 +02:00
Nigel Tao 0c7fb33750 go.text/transform: re-arrange TestReader's test cases so that they can
be re-used by other tests.

R=mpvl, r
CC=golang-dev
https://golang.org/cl/10672044
2013-07-10 10:37:15 +10:00
Nigel Tao 8a29aad8b1 go.text/transform: improve comments based on review of
https://golang.org/cl/10538043.

R=r, mpvl
CC=golang-dev
https://golang.org/cl/10996043
2013-07-09 16:03:01 +10:00
Nigel Tao 79b045a0f2 go.text/transform: new package.
This CL only provides the Reader type; Writer will be in a follow-up.

R=mpvl, r, mpvl
CC=andybalholm, golang-dev, rogpeppe
https://golang.org/cl/10538043
2013-07-02 09:56:20 +10:00