]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/gc: move functions from util.go to lex.go
authorMarvin Stenger <marvin.stenger94@gmail.com>
Thu, 24 Sep 2015 13:41:05 +0000 (15:41 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 24 Sep 2015 14:45:28 +0000 (14:45 +0000)
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>
src/cmd/compile/internal/gc/lex.go
src/cmd/compile/internal/gc/util.go

index 3f27e6182337fdef86073166953c31771754413f..1fafdf453c77d6517d4e22fa761bd5921f34d4a6 100644 (file)
@@ -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 < ' ' {
index fc9173e383220d9941e375b0525419036b166bc8..b75bc2051812fa8afe02d67cbcfa43be30dc2489 100644 (file)
@@ -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 {