You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: parser.go
    path of file: ./repos/dae/config
    
    the code of the file until where you have to start completion: /*
 * SPDX-License-Identifier: AGPL-3.0-only
 * Copyright (c) 2022-2024, daeuniverse Organization <dae@v2raya.org>
 */

package config

import (
	"fmt"
	"reflect"
	"strings"

	"github.com/daeuniverse/dae/common"
	"github.com/daeuniverse/dae/pkg/config_parser"
)

func StringListParser(to reflect.Value, section *config_parser.Section) error {
	if to.Kind() != reflect.Pointer {
		return fmt.Errorf("StringListParser can only unmarshal section to *[]string")
	}
	to = to.Elem()
	if to.Type() != reflect.TypeOf([]string{}) &&
		!(to.Kind() == reflect.Slice && to.Type().Elem().Kind() == reflect.String) {
		return fmt.Errorf("StringListParser can only unmarshal section to *[]string")
	}
	for _, item := range section.Items {
		switch itemVal := item.Value.(type) {
		case *config_parser.Param:
			to.Set(reflect.Append(to, reflect.ValueOf(itemVal.String(true, false)).Convert(to.Type().Elem())))
		default:
			return fmt.Errorf("section %v does not support type %v: %v", section.Name, item.Type.String(), item.String(false, false))
		}
	}
	return nil
}

func ParamParser(to reflect.Value, section *config_parser.Section, ignoreType []reflect.Type) error {
	if to.Kind() != reflect.Pointer {
		return fmt.Errorf("ParamParser can only unmarshal section to *struct")
	}
	to = to.Elem()
	if to.Kind() != reflect.Struct {
		return fmt.Errorf("ParamParser can only unmarshal section to struct")
	}

	// keyToField is for further parsing use.
	type Field struct {
		Val        reflect.Value
		Annotation reflect.Value
		Index      int
		Se
    
func SectionParser(to reflect.Value, section *config_parser.Section) error {
	if to.Kind() != reflect.Pointer {
		return fmt.Errorf("SectionParser can only unmarshal section to a pointer")
	}
	to = to.Elem()
	switch to.Kind() {
	case reflect.Slice:
		elemType := to.Type().Elem()
		switch elemType.Kind() {
		case reflect.String:
			return StringListParser(to.Addr(), section)
		case reflect.Struct:
			// "to" is a section list (sections in section).
			/**
			  	to {
			  		field1 {
			  			...
			  		}
			  		field2 {
			  			...
			  		}
			  	}
			  should be parsed to:
			  	to []struct {
			  			Name string `mapstructure: "_"`
			  			...
			  		}
			*/
			// The struct should contain Name.
			nameStructField, ok := elemType.FieldByName("Name")
			if !ok || nameStructField.Type.Kind() != reflect.String || nameStructField.Tag.Get("mapstructure") != "_" {
				return fmt.Errorf("a string field \"Name\" with mapstructure:\"_\" is required in struct %v to parse section", to.Type().Elem().String())
			}
			// Scan sections.
			for _, item := range section.Items {
				elem := reflect.New(elemType).Elem()
				switch itemVal := item.Value.(type) {
				case *config_parser.Section:
					elem.FieldByName("Name").SetString(itemVal.Name)
					if err := SectionParser(elem.Addr(), itemVal); err != nil {
						return fmt.Errorf("error when parse \"%v\": %w", itemVal.Name, err)
					}
					to.Set(reflect.Append(to, elem))
				default:
					return fmt.Errorf("unmatched type: %v -> %v", item.Type.String(), elemType)
				}
			}
			return nil
		default:
			goto unsupported
		}
	case reflect.Struct:
		// Section.
		return ParamParser(to.Addr(), section, nil)
	default:
		goto unsupported
	}

	panic("code should not reach here")

unsupported:
	return fmt.Errorf("unsupported section type %v", to.Type())
}