aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2018-04-17 00:50:46 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2018-04-19 00:09:46 +0200
commitfe1035633a1a17febbec6d42d53ab8c9afeddfc1 (patch)
tree58735b5b47961770175059f4d4d3dca556be5681
parentda75b6f7356e9dc34dc4005ee993cee84c6bf5ba (diff)
downloadliberty-fe1035633a1a17febbec6d42d53ab8c9afeddfc1.tar.gz
liberty-fe1035633a1a17febbec6d42d53ab8c9afeddfc1.tar.xz
liberty-fe1035633a1a17febbec6d42d53ab8c9afeddfc1.zip
Describe syntax of advanced configuration w/ PEG
-rw-r--r--liberty.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/liberty.c b/liberty.c
index ef6a398..51b7058 100644
--- a/liberty.c
+++ b/liberty.c
@@ -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
{