cmd/compile/internal/gc: cleaning lex.go

Cleaning along the way:
-convert variable types from int to bool
-remove unnecessary functions
-remove unnecessary type conversion
-remove unnecessary variable declarations
-transform struct{string,string} with lookup to map[string]string

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I259728fe4afd7f23b67f08fab856ce0abee57b21
Reviewed-on: https://go-review.googlesource.com/14435
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Marvin Stenger 2015-09-11 00:03:19 +02:00 committed by Ian Lance Taylor
parent 19d262ffdf
commit 211cdf1e00
6 changed files with 120 additions and 153 deletions

View file

@ -18,15 +18,19 @@ func atoi(s string) int {
return int(n)
}
func isalnum(c int) bool {
return isalpha(c) || isdigit(c)
func isSpace(c int) bool {
return c == ' ' || c == '\t' || c == '\n' || c == '\r'
}
func isalpha(c int) bool {
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 {
func isDigit(c int) bool {
return '0' <= c && c <= '9'
}