diff options
author | Ian Lance Taylor <iant@google.com> | 2016-02-03 21:58:02 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-02-03 21:58:02 +0000 |
commit | f98dd1a338867a408f7c72d73fbad7fe7fc93e3a (patch) | |
tree | 2f8da9862a9c1fe0df138917f997b03439c02773 /libgo/go/strconv/makeisprint.go | |
parent | b081ed4efc144da0c45a6484aebfd10e0eb9fda3 (diff) | |
download | gcc-f98dd1a338867a408f7c72d73fbad7fe7fc93e3a.tar.gz |
libgo: Update to go1.6rc1.
Reviewed-on: https://go-review.googlesource.com/19200
From-SVN: r233110
Diffstat (limited to 'libgo/go/strconv/makeisprint.go')
-rw-r--r-- | libgo/go/strconv/makeisprint.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libgo/go/strconv/makeisprint.go b/libgo/go/strconv/makeisprint.go index 588d0a00b53..514258060e5 100644 --- a/libgo/go/strconv/makeisprint.go +++ b/libgo/go/strconv/makeisprint.go @@ -174,6 +174,23 @@ func main() { } fmt.Fprintf(&buf, "\t%#04x,\n", r-0x10000) } + fmt.Fprintf(&buf, "}\n\n") + + // The list of graphic but not "printable" runes is short. Just make one easy table. + fmt.Fprintf(&buf, "// isGraphic lists the graphic runes not matched by IsPrint.\n") + fmt.Fprintf(&buf, "var isGraphic = []uint16{\n") + for r := rune(0); r <= unicode.MaxRune; r++ { + if unicode.IsPrint(r) != unicode.IsGraphic(r) { + // Sanity check. + if !unicode.IsGraphic(r) { + log.Fatalf("%U is printable but not graphic\n", r) + } + if r > 0xFFFF { // We expect only 16-bit values. + log.Fatalf("%U too big for isGraphic\n", r) + } + fmt.Fprintf(&buf, "\t%#04x,\n", r) + } + } fmt.Fprintf(&buf, "}\n") data, err := format.Source(buf.Bytes()) |