func pragmaFields(s string) []string {
	var a []string
	inQuote := false
	fieldStart := -1 // Set to -1 when looking for start of field.
	for i, c := range s {
		switch {
		case c == '"':
			if inQuote {
				inQuote = false
				a = append(a, s[fieldStart:i+1])
				fieldStart = -1
			} else {
				inQuote = true
				if fieldStart >= 0 {
					a = append(a, s[fieldStart:i])
				}
				fieldStart = i
			}
		case !inQuote && isSpace(c):
			if fieldStart >= 0 {
				a = append(a, s[fieldStart:i])
				fieldStart = -1
			}
		default:
			if fieldStart == -1 {
				fieldStart = i
			}
		}
	}
	if !inQuote && fieldStart >= 0 { // Last field might end at the end of the string.
		a = append(a, s[fieldStart:])
	}
	return a
}
// pragmaFields is similar to strings.FieldsFunc(s, isSpace)
// but does not split when inside double quoted regions and always
// splits before the start and after the end of a double quoted region.
// pragmaFields does not recognize escaped quotes. If a quote in s is not
// closed the part after the opening quote will not be returned as a field.
pragmaFields is similar to strings.FieldsFunc(s, isSpace)
but does not split when inside double quoted regions and always
splits before the start and after the end of a double quoted region.
pragmaFields does not recognize escaped quotes. If a quote in s is not
closed the part after the opening quote will not be returned as a field.
// pragmaFields is similar to strings . FieldsFunc ( s isSpace ) // but does not split when inside double quoted regions and always // splits before the start and after the end of a double quoted region . // pragmaFields does not recognize escaped quotes . If a quote in s is not // closed the part after the opening quote will not be returned as a field .
func pragmaFields(s string) []string {
	var a []string
	inQuote := false
	fieldStart := -1 
	for i, c := range s {
		switch {
		case c == '"':
			if inQuote {
				inQuote = false
				a = append(a, s[fieldStart:i+1])
				fieldStart = -1
			} else {
				inQuote = true
				if fieldStart >= 0 {
					a = append(a, s[fieldStart:i])
				}
				fieldStart = i
			}
		case !inQuote && isSpace(c):
			if fieldStart >= 0 {
				a = append(a, s[fieldStart:i])
				fieldStart = -1
			}
		default:
			if fieldStart == -1 {
				fieldStart = i
			}
		}
	}
	if !inQuote && fieldStart >= 0 { 
		a = append(a, s[fieldStart:])
	}
	return a
}
func pragmaFields ( s string ) [ ] string { var a [ ] string inQuote := false fieldStart := - 1 for i , c := range s { switch { case c == '"' : if inQuote { inQuote = false a = append ( a , s [ fieldStart : i + 1 ] ) fieldStart = - 1 } else { inQuote = true if fieldStart >= 0 { a = append ( a , s [ fieldStart : i ] ) } fieldStart = i } case ! inQuote && isSpace ( c ) : if fieldStart >= 0 { a = append ( a , s [ fieldStart : i ] ) fieldStart = - 1 } default : if fieldStart == - 1 { fieldStart = i } } } if ! inQuote && fieldStart >= 0 { a = append ( a , s [ fieldStart : ] ) } return a }
pragmaFields is similar to strings.FieldsFunc(s, isSpace)
but does not split when inside double quoted regions and always
splits before the start and after the end of a double quoted region.
pragmaFields is similar to strings . FieldsFunc ( s isSpace ) but does not split when inside double quoted regions and always splits before the start and after the end of a double quoted region .
// Set to -1 when looking for start of field. // Last field might end at the end of the string.