code: func (p *parser) directive() error {
  	dir := p.Val()
  	nesting := 0
  
  	// TODO: More helpful error message ("did you mean..." or "maybe you need to install its server type")
  	if !p.validDirective(dir) {
  		return p.Errf("Unknown directive '%s'", dir)
  	}
  
  	// The directive itself is appended as a relevant token
  	p.block.Tokens[dir] = append(p.block.Tokens[dir], p.tokens[p.cursor])
  
  	for p.Next() {
  		if p.Val() == "{" {
  			nesting++
  		} else if p.isNewLine() && nesting == 0 {
  			p.cursor-- // read too far
  			break
  		} else if p.Val() == "}" && nesting > 0 {
  			nesting--
  		} else if p.Val() == "}" && nesting == 0 {
  			return p.Err("Unexpected '}' because no matching opening brace")
  		}
  		p.tokens[p.cursor].Text = replaceEnvVars(p.tokens[p.cursor].Text)
  		p.block.Tokens[dir] = append(p.block.Tokens[dir], p.tokens[p.cursor])
  	}
  
  	if nesting > 0 {
  		return p.EOFErr()
  	}
  	return nil
  }
docs: // directive collects tokens until the directive's scope
  // closes (either end of line or end of curly brace block).
  // It expects the currently-loaded token to be a directive
  // (or } that ends a server block). The collected tokens
  // are loaded into the current server block for later use
  // by directive setup functions.