diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2018-04-17 00:50:46 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2018-04-19 00:09:46 +0200 |
commit | fe1035633a1a17febbec6d42d53ab8c9afeddfc1 (patch) | |
tree | 58735b5b47961770175059f4d4d3dca556be5681 | |
parent | da75b6f7356e9dc34dc4005ee993cee84c6bf5ba (diff) | |
download | liberty-fe1035633a1a17febbec6d42d53ab8c9afeddfc1.tar.gz liberty-fe1035633a1a17febbec6d42d53ab8c9afeddfc1.tar.xz liberty-fe1035633a1a17febbec6d42d53ab8c9afeddfc1.zip |
Describe syntax of advanced configuration w/ PEG
-rw-r--r-- | liberty.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -4337,6 +4337,32 @@ socket_io_try_write (int socket_fd, struct str *wb) // This is a more powerful configuration format, adding key-value maps and // simplifying item validation and dynamic handling of changes. All strings // must be encoded in UTF-8. +// +// The syntax is roughly described by the following parsing expression grammar: +// +// config = entries eof # as if there were implicit curly braces around +// entries = (newline* pair)* newline* +// pair = key newline* lws '=' newline* value (&endobj / newline / eof) +// key = string / !null !boolean lws [A-Za-z_][0-9A-Za-z_]* +// value = object / string / integer / null / boolean +// +// object = lws '{' entries endobj +// endobj = lws '}' +// +// string = lws '"' ('\\' escape / ![\\"] char)* '"' +// char = [\0-\177] # or any Unicode codepoint in the UTF-8 encoding +// escape = [\\"abfnrtv] / [xX][0-9A-Fa-f][0-9A-Fa-f]? / [0-7][0-7]?[0-7]? +// +// integer = lws '-'? [0-9]+ # whatever strtoll() accepts on your system +// null = lws 'null' +// boolean = lws 'yes' / lws 'YES' / lws 'no' / lws 'NO' +// / lws 'on' / lws 'ON' / lws 'off' / lws 'OFF' +// / lws 'true' / lws 'TRUE' / lws 'false' / lws 'FALSE' +// +// newline = lws comment? '\n' +// eof = lws comment? !. +// lws = [ \t\r]* # linear whitespace (plus CR as it is insignificant) +// comment = '#' (!'\n' .)* enum config_item_type { |