package nginx import ( "io" ) type LineType byte const ( NONE LineType = iota COMMENT // # comment COLONCOMMENT // ; comment ASSIGNMENT INCLUDE SECTION ) type Line struct { // Number of the line in the input file Number int // Type of line Type LineType // Path is the absolute dot-separated path to this line // "" | at the root of the file // "a.b" | inside the 'a' section inside the 'a' section Path string // Components of the line Components []string // Children of the current section (nil if not a section) Children []Line // Indent is the indentation characters Indent string } type nginx struct { Lines []*Line } func (n *nginx) NewDecoder(r io.Reader) *decoder { return &decoder{reader: r} }