Name Paths with Multiple Elements

A name path can also consist of multiple elements, each separated by a period (.). This structure allows you to navigate deeper into the hierarchy. For example, the name path server.backend.filter points to the last section in the configuration file.

[main]
user: "example"

[server]
threads: 4
startup delay: 20 s

*[server.connection]
port: 8080
interface: "web"

*[server.connection]
port: 9000
interface: "api"

[server.backend.filter]
reject: "bad"
accept: "good"
Path: server.backend.filter

(root)                    <== Document ( size=2 ) 
── [main]                  <== SectionWithNames ( size=1 ) 
└── user                    <== Text ( "example" ) 
┗━━ [server]                <== SectionWithNames ( size=4 ) 
    ┡━━ [backend]               <== IntermediateSection (  ) 
    ┗━━ [filter]                <== SectionWithNames ( size=2 ) 
        ├── accept                  <== Text ( "good" ) 
        └── reject                  <== Text ( "bad" ) 
    ├── *[connection]           <== SectionList ( size=2 ) 
    ├── [0]                     <== SectionWithNames ( size=2 ) 
    ├── interface               <== Text ( "web" ) 
    └── port                    <== Integer ( 8080 ) 
    └── [1]                     <== SectionWithNames ( size=2 ) 
        ├── interface               <== Text ( "api" ) 
        └── port                    <== Integer ( 9000 ) 
    ├── startup_delay           <== TimeDelta ( Not supported ) 
    └── threads                 <== Integer ( 4 ) 

Here, the path server.backend.filter helps identify the specific filter section nested within the server.backend structure.

In addition to sections, you can use name paths to target individual values within the configuration. For instance, the name path server.startup_delay directly references the startup_delay value within the server section.

Path: server.startup_delay

(root)                    <== Document ( size=2 ) 
── [main]                  <== SectionWithNames ( size=1 ) 
└── user                    <== Text ( "example" ) 
┗━━ [server]                <== SectionWithNames ( size=4 ) 
    ── [backend]               <== IntermediateSection (  ) 
    └── [filter]                <== SectionWithNames ( size=2 ) 
        ├── accept                  <== Text ( "good" ) 
        └── reject                  <== Text ( "bad" ) 
    ── *[connection]           <== SectionList ( size=2 ) 
    ├── [0]                     <== SectionWithNames ( size=2 ) 
    ├── interface               <== Text ( "web" ) 
    └── port                    <== Integer ( 8080 ) 
    └── [1]                     <== SectionWithNames ( size=2 ) 
        ├── interface               <== Text ( "api" ) 
        └── port                    <== Integer ( 9000 ) 
    ┡━━ startup_delay           <== TimeDelta ( Not supported ) 
    └── threads                 <== Integer ( 4 ) 

Name paths like this one are crucial when using the parser API to retrieve specific values in a configuration file.