func NewConfigParserFromFile(filename string) (*ConfigParser, error) {
	p, err := Parse(filename)
	if err != nil {
		return nil, err
	}
	return p, nil
}
NewConfigParserFromFile creates a new ConfigParser struct populated from the
supplied filename.
package configparser
import (
	"bufio"
	"fmt"
	"os"
	"regexp"
	"sort"
	"strings"
	"unicode"
)
const (
	defaultSectionName        = "DEFAULT"
	maxInterpolationDepth int = 10
)
var (
	sectionHeader    = regexp.MustCompile("\\[([^]]+)\\]")
	keyValue         = regexp.MustCompile("([^:=\\s][^:=]*)\\s*(?P<vi>[:=])\\s*(.*)$")
	continuationLine = regexp.MustCompile("\\w+(.*)$")
	interpolater     = regexp.MustCompile("%\\(([^)]*)\\)s")
)
var boolMapping = map[string]bool{
	"1":     true,
	"true":  true,
	"on":    true,
	"yes":   true,
	"0":     false,
	"false": false,
	"off":   false,
	"no":    false,
}
type Dict map[string]string
type Config map[string]*Section
type ConfigParser struct {
	config   Config
	defaults *Section
}
func (d Dict) Keys() []string {
	var keys []string
	for key := range d {
		keys = append(keys, key)
	}
	sort.Strings(keys)
	return keys
}
func getNoSectionError(section string) error {
	return fmt.Errorf("No section: '%s'", section)
}
func getNoOptionError(section, option string) error {
	return fmt.Errorf("No option '%s' in section: '%s'", option, section)
}
func New() *ConfigParser {
	return &ConfigParser{
		config:   make(Config),
		defaults: newSection(defaultSectionName),
	}
}
func NewWithDefaults(defaults Dict) *ConfigParser {
	p := ConfigParser{
		config:   make(Config),
		defaults: newSection(defaultSectionName),
	}
	for key, value := range defaults {
		p.defaults.Add(key, value)
	}
	return &p
}