From b3fd7c6de341644616a5f67be36b256686032f37 Mon Sep 17 00:00:00 2001
From: pommicket .pom
file extension to identify themselves.
Every file describes a configuration, which is a mapping from keys to values. @@ -138,11 +137,11 @@ time = 35 min
- All error conditions are described in this specification. A compliant POM parser should not - reject any file in any other case, outside of exceptional circumstances such as running out of memory. + 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 library author. + Warnings may also be issued according to the judgment of the parser author.
@@ -168,7 +167,7 @@ time = 35 min
and does not contain two dots in a row (..
).
- Any string of non-zero Unicode scalar values (U+0080–10FFFF, but not U+D800–U+DFFF) is a valid value. + Any string of non-zero Unicode scalar values (U+0001–10FFFF, but not U+D800–U+DFFF) is a valid value.
@@ -204,7 +203,7 @@ time = 35 min
]
optionally succeeded by any number of accepted-spaces, an error occurs.[
and final ]
- (white space between the [
and ]
is not trimmed).
+ (white space after the [
and before the ]
is not trimmed).
=
and any succeeding accepted-spaces.
"'`
(U+0022 QUOTATION MARK, U+0027 APOSTROPHE, U+0060 GRAVE ACCENT),
+ If c is "
(U+0022 QUOTATION MARK) or `
(U+0060 GRAVE ACCENT),
the value is quoted, and spans from the first character after c to the next unescaped
instance of c in the file (which may be on a different line). In this case,
- If a list's order is irrelevant and it might be large or benefit from labelling its entries,
+ 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 ingredients
“list” in the opening example).
z
things = `\,,,76`
things = \,,,76
,
76
(Likewise, an ordered series of configurations A1, …, An - can be merged by merging An-1 into An, then An-2 into + can be merged by merging A2 into A1, then A3 into the resulting configuration, etc.)
@@ -379,7 +384,7 @@ time = 35 min some will have to be enforced by the application.
- Every schema key is of the form k.
rule, where k is a valid key,
+ Every schema key must be of the form k.
rule, where k is a valid key,
and rule is one of the rule names listed below.
@@ -387,12 +392,12 @@ time = 35 min
*
are equal to the corresponding components
- of k
, add s to the candidate-list.
+ If every component of s is equal to *
or the corresponding component
+ of k, add s.rule to the candidate-list.
-The value of type
rule for vehicle.car.id is String,
+The value of the 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,
@@ -435,7 +440,7 @@ and for my.nephews.car.id is String (no schema key matches, so the default of St
String
— accepts any valueNone
— accepts an unset value (special—see below)Empty
— accepts an empty valueBool
— accepts true
, on
, yes
,
+ Bool
— accepts true
, on
, yes
,
false
, off
, no
(case-sensitive).UInt
— accepts any unsigned
integer that fits in 63 [sic] bits, written in decimal or 0x
or 0X
-prefixed hexadecimal.
@@ -448,8 +453,7 @@ and for my.nephews.car.id is String (no schema key matches, so the default of St
A floating-point number, written in ordinary decimal (e.g. -1.234
, 7.
, 265
) or in scientific notation
(e.g. 3e5
, 3.E-5
, -3.7e+5
).
A leading +
(or, of course, -
) is permitted.
- '
value'
— accepts the literal value value. Note that this must be written like
- thing.type = "'special_string'"
in the schema. Note also that value cannot contain a literal apostrophe '
. '
value'
— accepts the literal value value. value cannot contain a literal apostrophe '
. |
U, where T, U are types — accepts a value of type T or U.Optional[
T]
, where T is a type — equivalent to T | None
.List[
T]
, where T is a type — accepts a list of entries of type T (see description
@@ -472,18 +476,19 @@ and for my.nephews.car.id is String (no schema key matches, so the default of St
If a key is encountered in a configuration
and the value of its allow_unknown
rule is no
,
- and it has no matching type
rule,
+ and it has no matching type
, maxlength
, or default
rule,
the configuration does not follow the schema.
min
, max
rules
- This schema key's value sets the minimum/maximum value for the key's value. This must not be set if type
- does not explicitly allow numeric values (i.e. it does not contain a type Int
/UInt
/Float
).
+ This schema key’s value sets the minimum/maximum value for the key’s value. This may only be set if type
+ explicitly allows numeric values (i.e. it contains a type Int
/UInt
/Float
).
maxlength
rule- The value of this rule must be a non-negative integer no greater than 231−1. - Specifies that the value of a key can be no longer than that number of UTF-8 bytes. + This schema key’s value must be a non-negative integer no greater than 231−1, + written in decimal with no leading sign. + It specifies that the value of a key can be no longer than that number of UTF-8 bytes.
default
rule@@ -498,7 +503,7 @@ then a configuration must contain the key k to follow the schema.
Additionally, if there is a schema key j.*.
k.type
that does not allow unset values
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.
+containing a key x matching j.*
must also contain the key x.
k.
.*
must also contain
load_string(string: String) -> Configuration
load
if language supports it).
load_path(path: String) -> Configuration
load
if language supports it).
+ Convenience function for loading by path.
print(conf: Configuration)
.*
must also contain
location(conf: Configuration, key: String) -> Optional<Location>
key
in the configuration (file and line number).
- Useful for reporting invalid values when the value format is more complicated than integer/float/boolean.
+ Useful for reporting invalid values when the format of valid values can’t be described by a schema type.
get(conf: Configuration, key: String) -> Optional<String>
.*
must also contain
get_int(conf: Configuration, key: String) -> Optional<Int>
get_int_or_default(conf: Configuration, key: String, default: Int) -> Int
key
, if any exists, and parse it as a signed 64-bit integer
+ Get value associated with key
, if any exists, and parse it as a signed 64-bit integer,
+ following the Int
schema type described above
(returning default
if the key doesn’t exist).
- Return an error if the key exists but its value is not a valid signed 64-bit integer.
+ Returns an error if the key exists but its value is not a valid signed 64-bit integer.
get_uint(conf: Configuration, key: String) -> Optional<UInt>
get_uint_or_default(conf: Configuration, key: String, default: UInt) -> UInt
key
, if any exists, and parse it as an unsigned 63-bit [sic] integer
+ Get value associated with key
, if any exists, and parse it as an unsigned 63-bit [sic] integer,
+ following the UInt
schema type described above
(returning default
if the key doesn’t exist).
Returns an error if the key exists but its value is not a valid unsigned 63-bit integer.
.*
must also contain
get_float(conf: Configuration, key: String) -> Optional<Float>
get_float_or_default(conf: Configuration, key: String, default: Float) -> Float
key
, if any exists, and parse it as a 64-bit IEEE-754 double precision
- floating-point number, following the description of the Float
schema type above
+ floating-point number, following the Float
schema type described above
(returning default
if the key doesn’t exist).
Returns an error if the key exists but its value is not a valid floating-point number.
@@ -584,7 +591,7 @@ which contains a key x matching j.*
must also contain
Get value associated with key
, if any exists, and parse it as a boolean,
taking true
, on
, yes
to be true
, and
false
, off
, no
to be false
(case-sensitive).
- Returns an error if the key exists but is not one of the above values.
+ Returns an error if the key exists but is not one of those values.
get_list(conf: Configuration, key: String) -> Optional<List<String>>
.*
must also contain
section(conf: Configuration, key: String) -> Configuration
key
, i.e. keys starting with key.
- (with the initial key.
removed) and their corresponding values.
- Returns an empty configuration if there are no descendants of key
.
+ Get the sub-configuration consisting of the descendants of key
(i.e. keys starting with key.
),
+ with the initial key.
removed, and their corresponding values.
+ Returns an empty configuration if there are no descendants of key
defined.
check_schema(schema: Configuration, conf: Configuration) -> Configuration
(optional)conf
follows the schema schema
(and that schema
- is a valid schema),
+ check_against_schema(conf: Configuration, schema: Configuration) -> Configuration
(optional)schema
+ is a valid schema and that conf
follows it,
returning an error with detailed information
- if it does not. If successful, returns a configuration with default values filled out.
+ if not. If successful, returns a configuration with default values filled out.
merge(conf_a: Configuration, conf_b: Configuration) -> Configuration
.*
must also contain
This is a configuration which demonstrates almost all of the syntactic forms of POM.
-title = Crème brûlée
+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
+author == `Jean\0\\"P." D'Martingale
[ingredients.flour]
- quantity= '100 g'
+ quantity= "100 g"
type="all-purpose"
[ingredients.sugar]
quantity = 50 g
- type = 'br\x6f\u{77}n'
+ type = "br\x6f\u{77}n"
[ingrédients]
œufs.quantité=3
œufs.type = "extra large\,farm fresh\\,free-range"
@@ -650,10 +657,10 @@ This configuration has the following mapping of keys to values:
Key Value
- title Crème brûlée
+ 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
+ author = `Jean\0\\"P." D'Martingale
ingredients.flour.quantity 100 g
ingredients.flour.type all-purpose
ingredients.sugar.quantity 50 g
@@ -669,10 +676,10 @@ that's sure to delight your friends!
Configuration for a text editor
-indent-using-spaces = yes
+indentation-type = tabs
show-line-numbers = yes
tab-size = 4
-font-size = 18
+font-size = "18"
[file-extensions]
C = .c
@@ -699,7 +706,7 @@ This configuration has the following mapping of keys to values:
Key Value
- indent-using-spaces yes
+ indentation-type tabs
show-line-numbers yes
tab-size 4
font-size 18
@@ -714,7 +721,7 @@ This configuration has the following mapping of keys to values:
-Schema for text editor's configuration
+Schema for text editor’s configuration
Here is a schema which a text editor might use. The example text editor configuration above follows it.
@@ -723,7 +730,7 @@ This configuration has the following mapping of keys to values:
*.allow_unknown = no
# must put this in your config! I can't make the decision for you!
-indent-using-spaces.type = Bool
+indentation-type.type = 'spaces' | 'tabs'
show-line-numbers.type = Bool
show-line-numbers.default = on
@@ -740,14 +747,14 @@ min = 0.5
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
+[plug-in.*]
+enabled.type = Bool
+enabled.default = yes
+path.type = String
+# everyone be nice to the Microsoft Windows®
+path.maxlength = 260
# allow arbitrary keys in plug-ins' settings
-*.settings.allow_unknown = yes
+settings.allow_unknown = yes
[file-extensions]
C.type = List[String]
--
cgit v1.2.3