mirror of
https://github.com/golang/go
synced 2024-11-18 10:14:45 -07: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
@ -840,6 +840,33 @@ func cannedimports(file string, cp string) {
|
||||
incannedimport = 1
|
||||
}
|
||||
|
||||
func isSpace(c int) bool {
|
||||
return c == ' ' || c == '\t' || c == '\n' || c == '\r'
|
||||
}
|
||||
|
||||
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 isAlnum(c int) bool {
|
||||
return isAlpha(c) || isDigit(c)
|
||||
}
|
||||
|
||||
func plan9quote(s string) string {
|
||||
if s == "" {
|
||||
return "''"
|
||||
}
|
||||
for _, c := range s {
|
||||
if c <= ' ' || c == '\'' {
|
||||
return "'" + strings.Replace(s, "'", "''", -1) + "'"
|
||||
}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func isfrog(c int) bool {
|
||||
// complain about possibly invisible control characters
|
||||
if c < ' ' {
|
||||
|
@ -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…
Reference in New Issue
Block a user