Describe syntax of advanced configuration w/ PEG

This commit is contained in:
Přemysl Eric Janouch 2018-04-17 00:50:46 +02:00
parent da75b6f735
commit fe1035633a
Signed by: p
GPG Key ID: B715679E3A361BE6

View File

@ -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 // This is a more powerful configuration format, adding key-value maps and
// simplifying item validation and dynamic handling of changes. All strings // simplifying item validation and dynamic handling of changes. All strings
// must be encoded in UTF-8. // 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 enum config_item_type
{ {