summaryrefslogtreecommitdiff
path: root/site/spec.html
blob: 6e140642636ae22d55d4f68dad38c35cb19efa39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta content="width=device-width,initial-scale=1" name="viewport">
	<style>
	td, th {
		border: 2px solid black;
		padding: 0.5em;
	}
	table {
		border-collapse: collapse;
	}
	</style>
	<title>POM Language Specification</title>
	<link rel="icon" href="data:,"><!--TODO-->
</head>

<body>
<p>
	<a href="/index.html">POM homepage</a>
</p>
<h1>POM Language Specification, v. 0.1.0</h1>
<h2>Introduction</h2>
<p>
	POM is a “markup” language, primarily intended for software configuration,
	and designed to be easy to parse without any third-party libraries
	(e.g. for looking up Unicode classes or matching regular expressions),
	while still being terse and legible.
	The POM specification is quite strict, to avoid cases where dubious files can
	be accepted by some parsers while being rejected by others.
</p>
<p>
	Every file describes a <i>configuration</i>, which is a mapping from keys to values.
	A <i>key</i> is a string consisting of <i>components</i> separated by dots (<code>.</code>).
	A <i>value</i> is a string whose interpretation is entirely decided by the application.
	Notably there is no distinction in POM’s syntax between, say,
	the number <code>5</code> and the string <code>5</code>.
	A configuration, such as the one obtained from the POM file
</p>
<pre><code>[ingredients.sugar]
amount = 50&nbsp;g
type = brown

[ingredients.flour]
amount = 100&nbsp;g
type = all-purpose

[baking]
temperature = 150&nbsp;°C
time = 35&nbsp;min
</code></pre>
<p>
	can either be seen as a simple mapping from keys to values:
</p>
<table>
	<thead>
		<tr><th>Key</th><th>Value</th></tr>
	</thead>
	<tbody>
		<tr><td>ingredients.sugar.amount</td><td>50&nbsp;g</td></tr>
		<tr><td>ingredients.sugar.type</td><td>brown</td></tr>
		<tr><td>ingredients.flour.amount</td><td>100&nbsp;g</td></tr>
		<tr><td>ingredients.flour.type</td><td>all-purpose</td></tr>
		<tr><td>baking.temperature</td><td>150&nbsp;°C</td></tr>
		<tr><td>baking.time</td><td>35&nbsp;min</td></tr>
	</tbody>
</table>
<p>
	or a tree of keys, with a value associated to each leaf node:
</p>
<div style="text-align:center;">
	<svg
		viewBox="-281 0 500 200"
		style="width:80%;max-width:600px;"
		xmlns="http://www.w3.org/2000/svg">
		<style>
			text { text-anchor: middle; }
			rect { stroke: black; fill: none; }
			line { stroke: black; stroke-width: 1.5; }
		</style>
		<rect x="-30" y="6" width="60" height="20" />
		<text x="0" y="20" font-size="12">(root)</text>
		<line x1="-20" y1="26" x2="-118" y2="46" />
		<line x1="20" y1="26" x2="118" y2="46" />
		<g transform="translate(-118 46)">
			<rect x="-45" y="0" width="90" height="20" />
			<text x="0" y="14" font-size="12">ingredients</text>
			<line x1="-20" y1="20" x2="-75" y2="54" />
			<line x1="20" y1="20" x2="75" y2="54" />
			<g transform="translate(-75 54)">
				<rect x="-25" y="0" width="50" height="20" />
				<text x="0" y="14" font-size="12">sugar</text>
				<line x1="-10" y1="20" x2="-43" y2="40" />
				<line x1="10" y1="20" x2="43" y2="40" />
				<g transform="translate(-43 40)">
					<rect x="-40" y="0" width="80" height="36" />
					<text x="0" y="14" font-size="12">type</text>
					<text x="0" y="28" font-size="12">brown</text>
				</g>
				<g transform="translate(43 40)">
					<rect x="-40" y="0" width="80" height="36" />
					<text x="0" y="14" font-size="12">amount</text>
					<text x="0" y="28" font-size="12">50&nbsp;g</text>
				</g>
			</g>
			<g transform="translate(75 54)">
				<rect x="-25" y="0" width="50" height="20" />
				<text x="0" y="14" font-size="12">flour</text>
				<line x1="-10" y1="20" x2="-15" y2="40" />
				<line x1="10" y1="20" x2="71" y2="40" />
				<g transform="translate(-15 40)">
					<rect x="-40" y="0" width="80" height="36" />
					<text x="0" y="14" font-size="12">type</text>
					<text x="0" y="28" font-size="12">all-purpose</text>
				</g>
				<g transform="translate(71 40)">
					<rect x="-40" y="0" width="80" height="36" />
					<text x="0" y="14" font-size="12">amount</text>
					<text x="0" y="28" font-size="12">100&nbsp;g</text>
				</g>
			</g>
		</g>
		<g transform="translate(118 46)">
			<rect x="-45" y="0" width="90" height="20" />
			<line x1="-20" y1="20" x2="-50" y2="40" />
			<line x1="20" y1="20" x2="50" y2="40" />
			<text x="0" y="14" font-size="12">baking</text>
			<g transform="translate(-50 40)">
				<rect x="-45" y="0" width="90" height="36" />
				<text x="0" y="14" font-size="12">temperature</text>
				<text x="0" y="30" font-size="12">150&nbsp;°C</text>
			</g>
			<g transform="translate(50 40)">
				<rect x="-45" y="0" width="90" height="36" />
				<text x="0" y="14" font-size="12">time</text>
				<text x="0" y="30" font-size="12">35&nbsp;min</text>
			</g>
		</g>
	</svg>
</div>
<h2>Error handling</h2>
<p>
	All error conditions are described in this specification.
	A general-purpose POM parser should not reject a file in any other case,
	outside of exceptional circumstances such as running out of memory.
	When an error occurs, it should be reported, ideally with information
	about the file name and line number, and the file must be entirely rejected
	(i.e. parsers must not attempt to preserve only the correct parts of an erroneous file).
	Warnings may also be issued according to the judgment of the parser author.
</p>
<h2>Text encoding</h2>
<p>
	All POM files are encoded using UTF-8. Both LF and CRLF line endings may be used (see below).
	If invalid UTF-8 is encountered, including overlong sequences and UTF-16
	surrogate halves (U+D800-DFFF), an error occurs.
</p>
<h2>Valid keys/values</h2>
<p>
	Keys in a POM file may contain the following characters
</p>
<ul>
	<li>
		The ASCII characters <code>a</code><code>z</code>, <code>A</code><code>Z</code>,
		<code>0</code><code>9</code>, as well as each of
		<code>./-*_</code>.
	</li>
	<li>
		Any non-ASCII Unicode scalar value (U+008010FFFF, but not U+D800–U+DFFF).
	</li>
</ul>
<p>
	A non-empty string containing only these characters is a valid key
	if and only if it does not start or end with a dot
	and does not contain two dots in a row (<code>..</code>).
</p>
<p>
	Any string of non-zero Unicode scalar values (U+000110FFFF, but not U+D800–U+DFFF)
	is a valid value.
</p>
<h2>Parsing</h2>
<p>
	If a “byte order mark” of <code>EF BB BF</code> appears at the start of the file,
	it is ignored.
	Every carriage return character (U+000D) which immediately
	precedes a line feed (U+000A) is deleted.
	Then, if any control characters in the range U+0000 to U+001F
	other than the line feed and horizontal tab (U+0009) are
	present in the file, an error occurs.
</p>
<p>
	The <i>current-section</i> is a string variable which should be maintained during parsing.
	It is initally equal to the empty string.
</p>
<p>
	An <i>accepted-space</i> is either a space (U+0020) or horizontal tab (U+0009) character.
</p>
<p>
	Parsing now proceeds line-by-line, with lines being delimited by line feed characters.
	For each line:
</p>
<ol>
	<li>Any accepted-spaces that appear at the start of the line are removed.</li>
	<li>
		If the line begins with <code>#%disable warnings</code> or <code>#%enable warnings</code>,
		warnings should be disabled/enabled if any are implemented.
	</li>
	<li>
		If the line is empty or begins with <code>#</code>,
		parsing proceeds to the next line.
	</li>
	<li>
		If the line begins with <code>[</code>, it is interpreted as a <i>section header</i>.
		In this case:
		<ol>
			<li>
				If the line does not end with <code>]</code> optionally succeeded
				by any number of accepted-spaces, an error occurs.
			</li>
			<li>
				The current-section is set to the text in between
				the initial <code>[</code> and final <code>]</code>
				(white space after the <code>[</code> and before the
				<code>]</code> is <em>not</em> trimmed).
			</li>
			<li>
				If the new current-section is not empty and not a valid key (see above), an error occurs.
			</li>
		</ol>
	</li>
	<li>
		Otherwise, the line is now interpreted as a key-value assignment. In this case:
		<ol>
			<li>If the line does not contain an equal sign (<code>=</code>), an error occurs.</li>
			<li>
				The <i>relative-key</i> is the text preceding the <code>=</code>,
				not including any space or horizontal tab characters
				immediately before the <code>=</code>.
			</li>
			<li>
				If the relative-key is not a valid key (see above), an error occurs.
			</li>
			<li>
				Let <i>c</i> be the first character after the <code>=</code> and any succeeding accepted-spaces.
			</li>
			<li>
				If <i>c</i> is <code>"</code> (U+0022 QUOTATION MARK) or <code>`</code> (U+0060 GRAVE ACCENT),
				the value is <i>quoted</i>. In this case,
				<ol>
					<li>
						The value spans from the first character after <i>c</i>
						to (but not including) the next unescaped instance of
						<i>c</i> in the file (which may be on a different line).
					</li>
					<li>
						Escape sequences in the value are replaced as described below.
					</li>
					<li>
						After the closing <i>c</i>, there may be any number of accepted-spaces,
						then a line feed or the end of the file must follow;
						otherwise, an error occurs.
					</li>
				</ol>
			</li>
			<li>
				Otherwise, the value is <i>unquoted</i>. In this case,
				<ol>
					<li>accepted-spaces at the end of the line are removed.</li>
					<li>
						The value is the exact text starting from <i>c</i> and going
						to the end of the line (escape sequences are not processed).
					</li>
				</ol>
			</li>
			<li>If the value is not a valid value (i.e. it contains a null character), an error occurs.</li>
			<li>
				The key is equal to the relative-key if the current-section is empty; otherwise, it is equal to
				the concatenation of current-section, a dot, and the relative-key.
			</li>
			<li>
				The key is assigned to the value.
			</li>
		</ol>
	</li>
</ol>

<h2>Escape sequences</h2>

<p>
	POM defines the following escape sequences, which may appear in quoted values.
	If a backslash character occurs in a quoted value but does not form
	a defined escape sequence, an error occurs.
</p>

<table>
	<thead>
		<tr><th>Escape sequence</th><th>Value</th></tr>
	</thead>
	<tbody>
		<tr><td><code>\n</code></td><td>Line feed (U+000A)</td></tr>
		<tr><td><code>\r</code></td><td>Carriage return (U+000D)</td></tr>
		<tr><td><code>\t</code></td><td>Horizontal tab (U+0009)</td></tr>
		<tr><td><code>\\</code></td><td>Literal <code>\</code> (U+005C)</td></tr>
		<tr><td><code>\"</code></td><td>Literal <code>"</code> (U+0022)</td></tr>
		<tr><td><code>\'</code></td><td>Literal <code>'</code> (U+0027)</td></tr>
		<tr><td><code>\`</code></td><td>Literal <code>`</code> (U+0060)</td></tr>
		<tr><td><code>\,</code></td><td>Literal <code>\,</code> (U+005C U+002C)</td></tr>
		<tr><td><code>\x</code><i>NM</i></td>
			<td>ASCII character with code <i>NM</i>,
			<br>interpreted as hexadecimal
			<br>(must be in the range 01–7F).</td>
		</tr>
		<tr><td><code>\u{</code><i>digits</i><code>}</code></td>
			<td>Unicode code point <i>digits</i>,<br>
				interpreted as hexadecimal.<br>
				<i>digits</i> must be 1–6 characters long,<br>
				and may contain leading zeros,<br>
				but must not be zero and<br>
				must not be a UTF-16 surrogate<br>
				half D800–DFFF.</td>
		</tr>
	</tbody>
</table>

<h2>Lists</h2>
<p>
	Although POM does not have a way of specially designating a value as being a list,
	there is a recommended syntax for encoding them. Specifically, a value can be treated as a list
	by first splitting it into comma-delimited parts, treating <code>\,</code> as a literal comma
	in a list entry and <code>\\</code> as a literal backslash,
	then removing any accepted-spaces surrounding list entries.
</p>
<p>
	List entries may be empty, but if the last entry in a list is empty, it is removed
	(if there are two or more empty entries at the end of a list, only one is removed).
	As a consequence, an empty string is considered to be an empty list.
</p>
<p>
	If a list’s order is irrelevant and it might be large or benefit from labelling its entries,
	a key prefix should be used instead
	(see the <code>ingredients</code> “list” in the opening example).
</p>
<h3>Examples</h3>
<p>
	The following lines describe 3-entry lists.
</p>
<table>
	<thead>
		<tr><th>POM line</th><th>Entry 1</th><th>Entry 2</th><th>Entry 3</th></tr>
	</thead>
	<tbody>
		<tr>
			<td><code>fonts = monospace, sans-serif, serif</code></td>
			<td><code>monospace</code></td>
			<td><code>sans-serif</code></td>
			<td><code>serif</code></td>
		</tr>
		<tr>
			<td><code>files = " foo.txt, weird\,name,z "</code></td>
			<td><code>foo.txt</code></td>
			<td><code>weird,name</code></td>
			<td><code>z</code></td>
		</tr>
		<tr>
			<td><code>things = \,,,76</code></td>
			<td><code>,</code></td>
			<td><code></code></td>
			<td><code>76</code></td>
		</tr>
		<tr>
			<td><code>empties = ,,,</code></td>
			<td><code></code></td>
			<td><code></code></td>
			<td><code></code></td>
		</tr>
		<tr>
			<td><code>escapees = \\,\a,\,</code></td>
			<td><code>\</code></td>
			<td><code>\a</code></td>
			<td><code>,</code></td>
		</tr>
	</tbody>
</table>


<h2>Merging configurations</h2>
<p>
	A configuration <i>B</i> can be <i>merged into</i> another configuration <i>A</i>
	by parsing both of them and setting the value associated with a key <i>k</i> to be
</p>
<ol>
	<li>The value associated with <i>k</i> in <i>B</i>, if any.</li>
	<li>Otherwise, the value associated with <i>k</i> in <i>A</i>, if any.</li>
</ol>
<p>
	(Likewise, an ordered series of configurations <i>A<sub>1</sub></i>, …, <i>A<sub>n</sub></i>
	can be merged by merging <i>A<sub>2</sub></i> into <i>A<sub>1</sub></i>,
	then <i>A<sub>3</sub></i> into the resulting configuration, etc.)
</p>
<p>
	This is useful, for example, when you want to have a global configuration for
	a piece of software installed on a multi-user machine where individual settings
	can be overriden by each user (in this case, the user configuration would
	be merged into the global configuration).
</p>

<h2>API recommendations</h2>
<p>
	The following functions are recommended
	in any general-purpose library for parsing POM files.
	Their exact names/signatures can be changed to fit the style of the language.
	The main important point here is that the functions <code>get_int</code>,
	<code>get_uint</code>, <code>get_float</code>, <code>get_bool</code> must
	accept exactly the format described below for integers/floating-point numbers/booleans
	(otherwise changing between libraries could subtly change which configurations are valid).
</p>
<ul>
	<li>
		<code>load(filename: String, file: File) -&gt; Configuration</code><br>
		Load a configuration from a file.
		(<code>filename</code> is used for reporting error locations.)
	</li>
	<li>
		<code>load_string(filename: String, string: String) -&gt; Configuration</code><br>
		Load a configuration from a string
		(may be overloaded with <code>load</code> if language supports it).
		(<code>filename</code> is used for reporting error locations.)
	</li>
	<li>
		<code>load_path(path: String) -&gt; Configuration</code><br>
		Convenience function for loading by path.
	</li>
	<li>
		<code>print(conf: Configuration)</code><br>
		Print <code>key = value</code> on a separate line for each key in <code>conf</code>,
		sorted alphabetically by key. The value format doesn’t need to match POM’s format exactly,
		since this function should only be used for debugging anyways.
	</li>
	<li>
		<code>has(conf: Configuration, key: String) -&gt; Bool</code><br>
		Returns whether <code>key</code> is associated with any value.
	</li>
	<li>
		<code>keys(conf: Configuration) -&gt; List&lt;String&gt;</code><br>
		Returns a list of all unique first components of keys in the configuration,
		in an arbitrary order.
	</li>
	<li>
		<code>items(conf: Configuration) -&gt; List&lt;Pair&lt;String, String&gt;&gt;</code><br>
		Returns a list of all defined keys in the configuration and their values,
		in an arbitrary order.
	</li>
	<li>
		<code>location(conf: Configuration, key: String) -&gt; Optional&lt;Location&gt;</code><br>
		Location of the definition of <code>key</code> in the configuration (file and line number).
		Useful for reporting invalid values.
		If a key <i>k</i> isn’t given a value in the configuration, but a key of the form
		<i>k</i><code>.</code><i>j</i> is, then the
		location of the definition of an arbitrary such key
		should be considered the location of <i>k</i>.
	</li>
	<li>
		<code>get(conf: Configuration, key: String) -&gt; Optional&lt;String&gt;</code><br>
		Get value associated with <code>key</code>, if any exists.
	</li>
	<li>
		<code>get_or_default(conf: Configuration, key: String, default: String) -&gt; String</code><br>
		Get value associated with <code>key</code>, if any exists, returning <code>default</code> if not.
	</li>
	<li>
		<code>get_int(conf: Configuration, key: String) -&gt; Optional&lt;Int&gt;</code><br>
		<code>get_int_or_default(conf: Configuration, key: String, default: Int) -&gt; Int</code><br>
		Get value associated with <code>key</code>,
		if any exists, and parse it as a signed integer
		(returning <code>default</code> if the key doesn’t exist).
		The integer’s absolute value must be strictly less than 2<sup>53</sup>,
		written in decimal or
		<code>0x</code>/<code>0X</code>-prefixed hexadecimal.
		Leading zeroes are not permitted for decimal integers.
		White space around or within the integer is not permitted.
		A leading <code>+</code> (or, of course, <code>-</code>) is permitted.
		If the key exists but its value does not follow these rules, an error is returned.
	</li>
	<li>
		<code>get_uint(conf: Configuration, key: String) -&gt; Optional&lt;UInt&gt;</code><br>
		<code>get_uint_or_default(conf: Configuration, key: String, default: UInt) -&gt; UInt</code><br>
		Get value associated with <code>key</code>, if any exists,
		and parse it as an unsigned integer
		(returning <code>default</code> if the key doesn’t exist).
		The integer must be at least 0 and strictly less than 2<sup>53</sup>,
		written in decimal or <code>0x</code> or <code>0X</code>-prefixed hexadecimal.
		A leading <code>+</code> is permitted, but <code>-0</code> is not.
		Leading zeroes are not permitted for decimal integers.
		White space around or within the integer is not permitted.
		If the key exists but its value does not follow these rules, an error is returned.
	</li>
	<li>
		<code>get_float(conf: Configuration, key: String) -&gt; Optional&lt;Float&gt;</code><br>
		<code>get_float_or_default(conf: Configuration, key: String, default: Float) -&gt; Float</code><br>
		Get value associated with <code>key</code>, if any exists,
		and parse it as a 64-bit IEEE-754 double precision
		floating-point number (returning <code>default</code> if the key doesn’t exist).
		The number must be written in ordinary decimal
		(e.g. <code>-1.234</code>, <code>7.</code>, <code>265</code>) or in C-like scientific notation
		(e.g. <code>3e5</code>, <code>3.E-5</code>, <code>-3.7e+005</code>).
		Excessive leading zeroes are not permitted (<code>0.0</code> is allowed, but not <code>00.0</code>).
		Values which overflow to ±∞ are allowed (e.g. <code>1e999</code>), but NaN and explicit
		<code>inf</code>/<code>Infinity</code> are not.
		White space around or within the number is not permitted.
		The decimal point (if one is present) must be preceded and succeeded by digits.
		A leading <code>+</code> (or, of course, <code>-</code>) is permitted.
		Returns an error if the key exists but its value is not a valid floating-point number.
	</li>
	<li>
		<code>get_bool(conf: Configuration, key: String) -&gt; Optional&lt;Bool&gt;</code><br>
		<code>get_bool_or_default(conf: Configuration, key: String, default: Bool) -&gt; Bool</code><br>
		Get value associated with <code>key</code>, if any exists, and parse it as a boolean,
		taking  <code>true</code>, <code>on</code>, <code>yes</code> to be <code>true</code>, and
		<code>false</code>, <code>off</code>, <code>no</code> to be <code>false</code> (case-sensitive).
		Returns an error if the key exists but is not one of those values.
	</li>
	<li>
		<code>get_list(conf: Configuration, key: String) -&gt; Optional&lt;List&lt;String&gt;&gt;</code><br>
		<code>get_list_or_default(conf: Configuration, key: String, default: List&lt;String&gt;) -&gt; List&lt;String&gt;</code><br>
		Get value associated with <code>key</code>, if any exists, and parse it as a list
		(returning <code>default</code> if the key isn’t present).
	</li>
	<li>
		<code>section(conf: Configuration, key: String) -&gt; Configuration</code><br>
		Get the sub-configuration consisting of the descendants of <code>key</code>
		(i.e. keys starting with <code>key.</code>),
		with the initial <code>key.</code> removed, and their corresponding values.
		Returns an empty configuration if there are no descendants of <code>key</code> defined.
	</li>
	<li>
		<code>merge(conf_a: Configuration, conf_b: Configuration) -&gt; Configuration</code><br>
		Returns the result of merging <code>conf_b</code> into <code>conf_a</code>.
	</li>
	<li>
		<code>unread_keys(conf: Configuration) -&gt; List&lt;String&gt;</code><br>
		Returns a list of all keys which have not been the target of a <code>get</code> / <code>get_*</code>
		call (does <em>not</em> include <code>has</code>),
		either directly or through a section obtained from the <code>section</code> function,
		in an arbitrary order.
		When configurations are merged, the gotten-ness of the values is preserved.
		Whether or not getting values from the merged configuration affects the original configurations’
		gotten-nesses is unspecified (and should rarely matter).
	</li>
</ul>

<h2>Examples</h2>
<p>
	This section lists some examples of POM files. For more examples, see the <code>tests/</code>
	directory in the main POM repository.
</p>

<h3>All syntax</h3>
This is a configuration which demonstrates almost all of the syntactic forms of POM.

<pre><code>
title = 'Crème brûlée'
0-*/_description_/*-0 =`A 'beautiful' crème br\u{FB}l\u{0000e9}e recipe
that\'s sure to delight your friends!`
author == `Jean\0\\"P." D'Martingale
[ingredients.flour]
	quantity= "100 g"
	type="all-purpose"
[ingredients.sugar]
	quantity		=	   50 g
	type = "br\x6f\u{77}n"
[ingrédients]
	œufs.quantité=3
	œufs.type = "extra large\,farm fresh\\,free-range"
[]
DIRECTIONS.en_CA.version.5 = "
1. Separate the egg yolks from the \"whites\".
2. Mix the yolks in a bowl with the sugar.
…
59. Enjoy!
"
</code></pre>
<p>
This configuration has the following mapping of keys to values:
</p>
<table>
	<thead>
		<tr><th>Key</th><th>Value</th></tr>
	</thead>
	<tbody>
		<tr><td>title</td><td>'Crème brûlée'</td></tr>
		<tr><td>0-*/_description_/*-0</td><td>A 'beautiful' crème brûlée recipe<br>
that's sure to delight your friends!</td></tr>
		<tr><td>author</td><td>= `Jean\0\\"P." D'Martingale</td></tr>
		<tr><td>ingredients.flour.quantity</td><td>100 g</td></tr>
		<tr><td>ingredients.flour.type</td><td>all-purpose</td></tr>
		<tr><td>ingredients.sugar.quantity</td><td>50 g</td></tr>
		<tr><td>ingredients.sugar.type</td><td>brown</td></tr>
		<tr><td>ingrédients.œufs.quantité</td><td>3</td></tr>
		<tr><td>ingrédients.œufs.type</td><td>extra large\,farm fresh\,free-range</td></tr>
		<tr><td>DIRECTIONS.en_CA.version.5</td><td><br>1. Separate the egg yolks from the "whites".<br>
2. Mix the yolks in a bowl with the sugar.<br>
…<br>
59. Enjoy!<br><br></td></tr>
	</tbody>
</table>

<h3>Configuration for a text editor</h3>
<pre><code>
indentation-type = tabs
show-line-numbers = yes
tab-size = 4
font-size = "18"

[file-extensions]
C = .c
Cpp = .cpp, .h, .hpp

[plug-in.edit-over-ssh]
path = ~/misc/edit-over-ssh.so
enabled = yes

[plug-in.edit-over-ssh.settings]
favourite-host = my-web-server

[plug-in.edit-over-ssh.settings.hosts.my-web-server]
address = example.org
port = 22
ssh-key = ~/.ssh/id_ed25519

</code></pre>
<p>
This configuration has the following mapping of keys to values:
</p>
<table>
	<thead>
		<tr><th>Key</th><th>Value</th></tr>
	</thead>
	<tbody>
		<tr><td>indentation-type</td><td>tabs</td></tr>
		<tr><td>show-line-numbers</td><td>yes</td></tr>
		<tr><td>tab-size</td><td>4</td></tr>
		<tr><td>font-size</td><td>18</td></tr>
		<tr><td>file-extensions.C</td><td>.c</td></tr>
		<tr><td>file-extensions.Cpp</td><td>.cpp, .h, .hpp</td></tr>
		<tr><td>plug-in.edit-over-ssh.path</td><td>~/misc/edit-over-ssh.so</td></tr>
		<tr><td>plug-in.edit-over-ssh.enabled</td><td>yes</td></tr>
		<tr><td>plug-in.edit-over-ssh.settings.favourite-host</td><td>my-web-server</td></tr>
		<tr><td>plug-in.edit-over-ssh.settings.hosts.my-web-server.address</td><td>example.org</td></tr>
		<tr><td>plug-in.edit-over-ssh.settings.hosts.my-web-server.port</td><td>22</td></tr>
		<tr><td>plug-in.edit-over-ssh.settings.hosts.my-web-server.ssh-key</td><td>~/.ssh/id_ed25519</td></tr>
	</tbody>
</table>

<h3>Errors</h3>
<p>
This section lists some erroneous lines that might appear in a POM file:
</p>
<pre><code>
# Invalid key character '!'
cool-key! = 23
# Invalid key character ' '
fun times = yes
# Missing equals
music is on
# No closing ]
[my.section
# Invalid key character ' '
[ my.section ]
# Invalid escape sequence "\?"
no_trigraph = "a?\?=b"
# Invalid escape sequence "\xCE" — even though "\xCE\x92" is valid UTF-8.
#     ("\u{392}" should be used instead)
capital_beta = "\xCE\x92"
# Invalid escape sequence "\x00" / Invalid character in value (null character)
C_string = "Hello, world!\x00"
# Stray characters after closing "
name = "Andy" B
# Duplicate key 'tab-size'
tab-size = 4
tab-size = 8
</code></pre>

</body>

</html>