Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
42cfe48f
Commit
42cfe48f
authored
Dec 06, 2010
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use the new %U format for runes
R=rsc CC=golang-dev
https://golang.org/cl/3483041
parent
53eaf40e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
15 deletions
+15
-15
goyacc.go
src/cmd/goyacc/goyacc.go
+1
-1
buffer_test.go
src/pkg/bytes/buffer_test.go
+5
-5
maketables.go
src/pkg/unicode/maketables.go
+3
-3
string_test.go
src/pkg/utf8/string_test.go
+3
-3
utf8_test.go
src/pkg/utf8/utf8_test.go
+3
-3
No files found.
src/cmd/goyacc/goyacc.go
View file @
42cfe48f
...
...
@@ -3139,7 +3139,7 @@ out:
c = yyTok2[1] /* unknown char */
}
if yyDebug >= 3 {
fmt.Printf("lex %
.4x
%s\n", uint(yychar), yyTokname(c))
fmt.Printf("lex %
U
%s\n", uint(yychar), yyTokname(c))
}
return c
}
...
...
src/pkg/bytes/buffer_test.go
View file @
42cfe48f
...
...
@@ -275,10 +275,10 @@ func TestRuneIO(t *testing.T) {
size
:=
utf8
.
EncodeRune
(
b
[
n
:
],
r
)
nbytes
,
err
:=
buf
.
WriteRune
(
r
)
if
err
!=
nil
{
t
.
Fatalf
(
"WriteRune(
U+%.4x
) error: %s"
,
r
,
err
)
t
.
Fatalf
(
"WriteRune(
%U
) error: %s"
,
r
,
err
)
}
if
nbytes
!=
size
{
t
.
Fatalf
(
"WriteRune(
U+%.4x
) expected %d, got %d"
,
r
,
size
,
nbytes
)
t
.
Fatalf
(
"WriteRune(
%U
) expected %d, got %d"
,
r
,
size
,
nbytes
)
}
n
+=
size
}
...
...
@@ -295,7 +295,7 @@ func TestRuneIO(t *testing.T) {
size
:=
utf8
.
EncodeRune
(
p
,
r
)
nr
,
nbytes
,
err
:=
buf
.
ReadRune
()
if
nr
!=
r
||
nbytes
!=
size
||
err
!=
nil
{
t
.
Fatalf
(
"ReadRune(
U+%.4x) got U+%.4x,%d not U+%.4x
,%d (err=%s)"
,
r
,
nr
,
nbytes
,
r
,
size
,
err
)
t
.
Fatalf
(
"ReadRune(
%U) got %U,%d not %U
,%d (err=%s)"
,
r
,
nr
,
nbytes
,
r
,
size
,
err
)
}
}
...
...
@@ -305,11 +305,11 @@ func TestRuneIO(t *testing.T) {
for
r
:=
0
;
r
<
NRune
;
r
++
{
r1
,
size
,
_
:=
buf
.
ReadRune
()
if
err
:=
buf
.
UnreadRune
();
err
!=
nil
{
t
.
Fatalf
(
"UnreadRune(
U+%.4x
) got error %q"
,
r
,
err
)
t
.
Fatalf
(
"UnreadRune(
%U
) got error %q"
,
r
,
err
)
}
r2
,
nbytes
,
err
:=
buf
.
ReadRune
()
if
r1
!=
r2
||
r1
!=
r
||
nbytes
!=
size
||
err
!=
nil
{
t
.
Fatalf
(
"ReadRune(
U+%.4x) after UnreadRune got U+%.4x,%d not U+%.4x
,%d (err=%s)"
,
r
,
r2
,
nbytes
,
r
,
size
,
err
)
t
.
Fatalf
(
"ReadRune(
%U) after UnreadRune got %U,%d not %U
,%d (err=%s)"
,
r
,
r2
,
nbytes
,
r
,
size
,
err
)
}
}
}
...
...
src/pkg/unicode/maketables.go
View file @
42cfe48f
...
...
@@ -157,7 +157,7 @@ func parseCategory(line string) (state State) {
char
:=
&
chars
[
point
]
char
.
field
=
field
if
char
.
codePoint
!=
0
{
die
.
Logf
(
"point
U+%04x
reused
\n
"
)
die
.
Logf
(
"point
%U
reused
\n
"
)
}
char
.
codePoint
=
lastChar
char
.
category
=
field
[
FGeneralCategory
]
...
...
@@ -167,7 +167,7 @@ func parseCategory(line string) (state State) {
// Decimal digit
_
,
err
:=
strconv
.
Atoi
(
field
[
FNumericValue
])
if
err
!=
nil
{
die
.
Log
(
"
U+%04x
: bad numeric field: %s"
,
point
,
err
)
die
.
Log
(
"
%U
: bad numeric field: %s"
,
point
,
err
)
}
case
"Lu"
:
char
.
letter
(
field
[
FCodePoint
],
field
[
FSimpleLowercaseMapping
],
field
[
FSimpleTitlecaseMapping
])
...
...
@@ -208,7 +208,7 @@ func (char *Char) letterValue(s string, cas string) int {
v
,
err
:=
strconv
.
Btoui64
(
s
,
16
)
if
err
!=
nil
{
char
.
dump
(
cas
)
die
.
Logf
(
"
U+%04x
: bad letter(%s): %s"
,
char
.
codePoint
,
s
,
err
)
die
.
Logf
(
"
%U
: bad letter(%s): %s"
,
char
.
codePoint
,
s
,
err
)
}
return
int
(
v
)
}
...
...
src/pkg/utf8/string_test.go
View file @
42cfe48f
...
...
@@ -21,7 +21,7 @@ func TestScanForwards(t *testing.T) {
for
i
,
expect
:=
range
runes
{
got
:=
str
.
At
(
i
)
if
got
!=
expect
{
t
.
Errorf
(
"%s[%d]: expected %c (
U+%04x); got %c (U+%04x
)"
,
s
,
i
,
expect
,
expect
,
got
,
got
)
t
.
Errorf
(
"%s[%d]: expected %c (
%U); got %c (%U
)"
,
s
,
i
,
expect
,
expect
,
got
,
got
)
}
}
}
...
...
@@ -39,7 +39,7 @@ func TestScanBackwards(t *testing.T) {
expect
:=
runes
[
i
]
got
:=
str
.
At
(
i
)
if
got
!=
expect
{
t
.
Errorf
(
"%s[%d]: expected %c (
U+%04x); got %c (U+%04x
)"
,
s
,
i
,
expect
,
expect
,
got
,
got
)
t
.
Errorf
(
"%s[%d]: expected %c (
%U); got %c (%U
)"
,
s
,
i
,
expect
,
expect
,
got
,
got
)
}
}
}
...
...
@@ -63,7 +63,7 @@ func TestRandomAccess(t *testing.T) {
expect
:=
runes
[
i
]
got
:=
str
.
At
(
i
)
if
got
!=
expect
{
t
.
Errorf
(
"%s[%d]: expected %c (
U+%04x); got %c (U+%04x
)"
,
s
,
i
,
expect
,
expect
,
got
,
got
)
t
.
Errorf
(
"%s[%d]: expected %c (
%U); got %c (%U
)"
,
s
,
i
,
expect
,
expect
,
got
,
got
)
}
}
}
...
...
src/pkg/utf8/utf8_test.go
View file @
42cfe48f
...
...
@@ -58,11 +58,11 @@ func TestFullRune(t *testing.T) {
m
:=
utf8map
[
i
]
b
:=
[]
byte
(
m
.
str
)
if
!
FullRune
(
b
)
{
t
.
Errorf
(
"FullRune(%q) (
rune %04x
) = false, want true"
,
b
,
m
.
rune
)
t
.
Errorf
(
"FullRune(%q) (
%U
) = false, want true"
,
b
,
m
.
rune
)
}
s
:=
m
.
str
if
!
FullRuneInString
(
s
)
{
t
.
Errorf
(
"FullRuneInString(%q) (
rune %04x
) = false, want true"
,
s
,
m
.
rune
)
t
.
Errorf
(
"FullRuneInString(%q) (
%U
) = false, want true"
,
s
,
m
.
rune
)
}
b1
:=
b
[
0
:
len
(
b
)
-
1
]
if
FullRune
(
b1
)
{
...
...
@@ -172,7 +172,7 @@ func TestIntConversion(t *testing.T) {
i
:=
0
for
_
,
r
:=
range
ts
{
if
r
!=
runes
[
i
]
{
t
.
Errorf
(
"%q[%d]: expected %c (
U+%04x); got %c (U+%04x
)"
,
ts
,
i
,
runes
[
i
],
runes
[
i
],
r
,
r
)
t
.
Errorf
(
"%q[%d]: expected %c (
%U); got %c (%U
)"
,
ts
,
i
,
runes
[
i
],
runes
[
i
],
r
,
r
)
}
i
++
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment