From 6a58f4bebafc418ed9d3b96c10f40f06baa3fbaf Mon Sep 17 00:00:00 2001
From: pommicket
POM is a “markup” language, primarily intended for software configuration,
- and designed to be easy to parse and use.
+ 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.
POM files should use the Page not found
diff --git a/site/index.html b/site/index.html
index 026778b..ce3d6e7 100644
--- a/site/index.html
+++ b/site/index.html
@@ -3,6 +3,7 @@
+
Coming soon
diff --git a/site/main.css b/site/main.css
deleted file mode 100644
index b771e2a..0000000
--- a/site/main.css
+++ /dev/null
@@ -1,7 +0,0 @@
-td, th {
- border: 2px solid black;
- padding: 0.5em;
-}
-table {
- border-collapse: collapse;
-}
diff --git a/site/spec.html b/site/spec.html
index c3ae3fa..90573d6 100644
--- a/site/spec.html
+++ b/site/spec.html
@@ -3,7 +3,15 @@
-
+
Introduction
.pom
file extension to identify themselves.
@@ -147,7 +157,7 @@ time = 35 min
a
–z
, A
–Z
, 0
–9
, as well as each of
- ./-+*_
.
+ ./-*_
.
@@ -287,10 +299,12 @@ time = 35 min
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 \u{
digits}
Unicode code point digits,
+ but must not be zero and
- interpreted as hexidecimal
+ interpreted as hexadecimal.
digits must be 1–6 characters long,
and may contain leading zeros,
- but must not be zero.
+ must not be a UTF-16 surrogate
+ half D800–DFFF.
\,
as a literal comma
- in a list entry), then removing any accepted-spaces surrounding list entries. List entries may be empty.
+ in a list entry), then removing any accepted-spaces surrounding list entries.
- An empty string is considered to be an empty list. + 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.
If a list's order is irrelevant and it might be large or benefit from labelling its entries,
@@ -298,6 +312,9 @@ time = 35 min
(see the ingredients
“list” in the opening example).
+ The following lines describe 3-entry lists. +
POM line | Entry 1 | Entry 2 | Entry 3 |
|
76 |
+
---|---|---|---|
empties = ,,,, |
+
|
+
|
+
|
+
- If needed for a particular domain, an parser may accept an extended form of the POM syntax.
- Ideally, extensions should use lines beginning with invalid key characters (e.g. !&%
)
- so that there is no ambiguity, and the file cannot be interpreted without the extension.
-
A schema is a POM file that describes how other POM files should be formatted (i.e. what keys they should include, and what values they can be associated with). A configuration can be said to follow a schema when it obeys all of the schema’s rules.
++ POM’s schema format is not powerful to enforce all possible restrictions; + some will have to be enforced by the application. +
Every schema key is of the form k.
rule, where k is a valid key,
and rule is one of the rule names listed below.
- For any valid key k the value of the rule rule is determined for k as follows: + For any valid key k the value of the rule rule for k is determined as follows:
*
-component (in terms of component index),
preferring keys with no *
,
breaking ties by the latest second *
-component, preferring keys with only one *
, etc.
- Use its value for the key.
+ Use its value.
+Given the following schema: +
+
+*.*.id.type = Int
+vehicle.*.id.type = UInt
+*.truck.id.type = Float
+vehicle.car.id.type = String
+
+
+The value of type
rule for vehicle.car.id is String,
+for vehicle.truck.id is UInt,
+for my.truck.id is Float,
+for my.car.id is Int,
+and for my.nephews.car.id is String (no schema key matches, so the default of String is used).
+
type
rule
Default: String
.
@@ -418,6 +456,9 @@ time = 35 min
of lists above). Nested lists are not permitted.
+
+ A type may optionally have accepted-spaces on either side; this does not change its meaning. +
allow_unknown
rule@@ -430,7 +471,9 @@ time = 35 min
If a key is encountered in a configuration
- and the value of its allow_unknown
rule is no
, the configuration does not follow the schema.
+ and the value of its allow_unknown
rule is no
,
+ and it has no matching type
rule,
+ the configuration does not follow the schema.
min
, max
rules
@@ -457,6 +500,15 @@ Additionally, if there is a schema key j.*.
k.ty
and no correspoding
default
schema key, where k does not contain any *
-components, then a configuration
which contains a key x matching j.*
must also contain the key x.
k.
+ If needed for a particular domain, an parser may accept an extended form of the POM syntax.
+ Ideally, extensions should use lines containing invalid key characters (e.g. !&%
)
+ before the =
(if any)
+ so that there is no ambiguity, and the file cannot be parsed without the extension.
+
The following functions are (lightly) recommended
@@ -472,14 +524,14 @@ which contains a key x matching j.*
must also contain
load_path(path: String) -> Configuration
Convenience function for loading by path (may be overloaded with load
if language supports it).
-
get(conf: Configuration, key: String) -> Optional<String>
key
, if any exists.
- has(conf: Configuration, key: String) -> Bool
key
is associated with any value.
get(conf: Configuration, key: String) -> Optional<String>
key
, if any exists.
+ get_or_default(conf: Configuration, key: String, default: String) -> String
key
, if any exists, returning default
if not.
@@ -514,9 +566,10 @@ which contains a key x matching j.*
must also contain
Returns an error if the key exists but is not one of the above values.
get_list(conf: Configuration, key: String) -> List<String>
key
, if any exists, and parse it as a list,
- returning an empty list if the key isn’t present.
+ get_list(conf: Configuration, key: String) -> Optional<List<String>>
get_list_or_default(conf: Configuration, key: String, default: List<String>) -> List<String>
key
, if any exists, and parse it as a list
+ (returning default
if the key isn’t present).
section(conf: Configuration, key: String) -> Configuration
.*
must also contain
+ This section lists some examples of POM files. For more examples, see the tests/
+ directory in the main POM repository.
+
+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!
+"
+
++This configuration has the following mapping of keys to values: +
+Key | Value |
---|---|
title | Crème brûlée |
0-*/_description_/*-0 | A 'beautiful' crème brûlée recipe +that's sure to delight your friends! |
author | = Jean\0\\"P."D'Martingale |
ingredients.flour.quantity | 100 g |
ingredients.flour.type | all-purpose |
ingredients.sugar.quantity | 50 g |
ingredients.sugar.type | brown |
ingrédients.œufs.quantité | 3 |
ingrédients.œ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! |
+indent-using-spaces = yes
+show-line-numbers = yes
+tab-size = 4
+font-size = 18
+
+[file-extensions]
+C = .c
+C++ = .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
+
+
++This configuration has the following mapping of keys to values: +
+Key | Value |
---|---|
indent-using-spaces | yes |
show-line-numbers | yes |
tab-size | 4 |
font-size | 18 |
file-extensions.C | .c |
file-extensions.C++ | .cpp, .h, .hpp |
plug-in.edit-over-ssh.path | ~/misc/edit-over-ssh.so |
plug-in.edit-over-ssh.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 |
plug-in.edit-over-ssh.settings.hosts.my-web-server.port | 22 |
plug-in.edit-over-ssh.settings.hosts.my-web-server.ssh-key | ~/.ssh/id_ed25519 |
+ Here is a schema which a text editor might use. The example text editor configuration above follows it. +
# don't allow unknown keys by default
*.allow_unknown = no
@@ -563,6 +720,8 @@ max = 100
default = 14
[plug-in]
+*.enabled.type = Bool
+*.enabled.default = yes
*.path.type = String
# everyone be nice to the Microsoft Windows
*.path.maxlength = 260
@@ -578,6 +737,35 @@ C-sharp.type = List[String]
C-sharp.default = .cs
++This section lists some erroneous lines that might appear in a POM file: +
+
+# 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
+
+
--
cgit v1.2.3