1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
11 func isChar(c rune) bool { return c <= 127 }
13 func isCtl(c rune) bool { return c <= 31 || c == 127 }
15 func isSeparator(c rune) bool {
17 case '(', ')', '<', '>', '@', ',', ';', ':', '\\', '"', '/', '[', ']', '?', '=', '{', '}', ' ', '\t':
23 func TestIsToken(t *testing.T) {
24 for i := 0; i <= 130; i++ {
26 expected := isChar(r) && !isCtl(r) && !isSeparator(r)
27 if isToken(r) != expected {
28 t.Errorf("isToken(0x%x) = %v", r, !expected)