x int
}
-var txType = reflect.TypeOf((*tx)(nil)).Elem()
-
// A type that can unmarshal itself.
type unmarshaler struct {
func TestStringKind(t *testing.T) {
type stringKind string
- type aMap map[stringKind]int
var m1, m2 map[stringKind]int
m1 = map[stringKind]int{
return b
}
-// lower lower-cases the A-Z bytes in b in-place, so that "aBc" becomes "abc".
-func lower(b []byte) []byte {
- for i, c := range b {
- if 'A' <= c && c <= 'Z' {
- b[i] = c + 'a' - 'A'
- }
- }
- return b
-}
-
const escapedChars = `&'<>"`
func escape(w writer, s string) error {
}
return strings.IndexFunc(s, isNotTokenChar) < 0
}
-
-// isQText returns true if rune is in 'qtext' as defined by RFC 822.
-func isQText(r int) bool {
- // CHAR = <any ASCII character> ; ( 0-177, 0.-127.)
- // qtext = <any CHAR excepting <">, ; => may be folded
- // "\" & CR, and including
- // linear-white-space>
- switch r {
- case '"', '\\', '\r':
- return false
- }
- return r < 0x80
-}
"runtime"
"strconv"
"strings"
- "unicode"
)
// Tree is the representation of a single parsed template.
t.funcs = nil
}
-// atEOF returns true if, possibly after spaces, we're at EOF.
-func (t *Tree) atEOF() bool {
- for {
- token := t.peek()
- switch token.typ {
- case itemEOF:
- return true
- case itemText:
- for _, r := range token.val {
- if !unicode.IsSpace(r) {
- return false
- }
- }
- t.next() // skip spaces.
- continue
- }
- break
- }
- return false
-}
-
// Parse parses the template definition string to construct a representation of
// the template for execution. If either action delimiter string is empty, the
// default ("{{" or "}}") is used. Embedded template definitions are added to
daysPer400Years = 365*400 + 97
daysPer100Years = 365*100 + 24
daysPer4Years = 365*4 + 1
- days1970To2001 = 31*365 + 8
)
// date computes the year, day of year, and when full=true,
return
}
-// lookupOffset returns information about the time zone with
-// the given offset (such as -5*60*60).
-func (l *Location) lookupOffset(offset int) (name string, isDST bool, ok bool) {
- l = l.get()
- for i := range l.zone {
- zone := &l.zone[i]
- if zone.offset == offset {
- return zone.name, zone.isDST, true
- }
- }
- return
-}
-
// NOTE(rsc): Eventually we will need to accept the POSIX TZ environment
// syntax too, but I don't feel like implementing it today.
import "errors"
-const (
- headerSize = 4 + 16 + 4*7
-)
-
// Simple I/O interface to binary blob of data.
type data struct {
p []byte