mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/gc: move functions from util.go to lex.go
Moves the functions:
isSpace(int) bool
isAlpha(int) bool
isDigit(int) bool
isAlnum(int) bool
plan9quote(string) string
Passes go build -toolexec 'toolstash -cmp' -a std.
Change-Id: I6f946981abb6f29b047ad90d5c117847e826789f
Reviewed-on: https://go-review.googlesource.com/14952
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
d08f34e744
commit
ffe743945f
2 changed files with 27 additions and 29 deletions
|
|
@ -5,7 +5,6 @@ import (
|
|||
"runtime"
|
||||
"runtime/pprof"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (n *Node) Line() string {
|
||||
|
|
@ -18,34 +17,6 @@ func atoi(s string) int {
|
|||
return int(n)
|
||||
}
|
||||
|
||||
func isSpace(c int) bool {
|
||||
return c == ' ' || c == '\t' || c == '\n' || c == '\r'
|
||||
}
|
||||
|
||||
func isAlnum(c int) bool {
|
||||
return isAlpha(c) || isDigit(c)
|
||||
}
|
||||
|
||||
func isAlpha(c int) bool {
|
||||
return 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z'
|
||||
}
|
||||
|
||||
func isDigit(c int) bool {
|
||||
return '0' <= c && c <= '9'
|
||||
}
|
||||
|
||||
func plan9quote(s string) string {
|
||||
if s == "" {
|
||||
return "''"
|
||||
}
|
||||
for _, c := range s {
|
||||
if c <= ' ' || c == '\'' {
|
||||
return "'" + strings.Replace(s, "'", "''", -1) + "'"
|
||||
}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// strings.Compare, introduced in Go 1.5.
|
||||
func stringsCompare(a, b string) int {
|
||||
if a == b {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue